/* TOP-Pix — 広い台の上に写真を置き、道具は白い面にして上に浮かせる。

   組み方は2段だけ
   ・1段目：台の上に置く物は**塗りつぶした白い面**。後ろは透かさない。
     浮いていることは、髪の毛ほどの縁と、高さで変わる影だけで示す
   ・2段目：面の中は Cupertino（iOS）の作法。面を重ねない。
     白い塊（グループ）、髪の毛ほどの仕切り、塗りの濃さ3段、青の文字ボタン
   ・段は増やさない。白い面の上に白い面は、どちらが手前か分からなくなる
   ・角丸は面の大きさに従う。小さい操作子ほど小さく、浮かぶ帯は丸ピル
   ・文字色はすべて面に対して 4.5:1 以上（実測は下の一覧のとおり） */

:root {
  /* 台。白い面が浮いて見えるよう、ごく薄い濃淡を持たせる */
  --ground: #e7eaf0;
  --ground-2: #dfe4ec;

  /* Cupertino の文字と塗り */
  --ink: #1c1c1e;                        /* label */
  --ink-2: #4a4f57;                      /* secondaryLabel */
  --ink-3: #5b616b;                      /* tertiaryLabel */
  --card: #ffffff;                       /* 塊の地。iOS のグループ背景と同じ */
  --fill-1: rgba(120, 120, 128, .1);
  --fill-2: rgba(120, 120, 128, .16);
  --fill-3: rgba(120, 120, 128, .22);
  --separator: rgba(60, 60, 67, .22);    /* 髪の毛ほどの仕切り */
  --line: var(--separator);
  --line-strong: rgba(60, 60, 67, .34);

  /* 主色。iOS の systemBlue を、白い面の上で 4.5:1 に届くまで締めたもの */
  --accent: #0a63c9;
  --accent-ink: #ffffff;
  --accent-8: rgba(10, 99, 201, .08);
  --accent-12: rgba(10, 99, 201, .14);
  --accent-tint: rgba(10, 99, 201, .1);
  --ok: #1a6e3e;
  --warn: #8a5a12;
  --danger: #c0332a;

  /* 修正指示（出した側）と納品物（返ってきた側）は、全画面で同じ約束 */
  --before: #5b616b;
  --after: #0a63c9;

  /* 面は塗りつぶし。後ろは透かさない。
     台から浮いていることは、髪の毛ほどの縁と、離れ方の違う影だけで示す。
     高さが上がるほど影は広く薄くなる（iOS の持ち上げ方と同じ考え） */
  --surface: #ffffff;
  --edge: inset 0 0 0 .5px rgba(60, 60, 67, .13);
  --lift-1: var(--edge),
    0 1px 2px rgba(60, 70, 90, .07),
    0 4px 14px rgba(60, 70, 90, .10);
  --lift-2: var(--edge),
    0 2px 6px rgba(60, 70, 90, .08),
    0 12px 30px rgba(60, 70, 90, .14);
  --lift-3: var(--edge),
    0 4px 12px rgba(60, 70, 90, .10),
    0 24px 56px rgba(60, 70, 90, .20);

  /* iOS のセグメントのつまみ。面の影ではなく、あの部品固有の影 */
  --knob: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);

  /* 面と面のあいだの空き。指示の画面も管理画面も同じ物を使う。
     （以前は #app だけに置いていたので、管理画面では効かず面が詰まっていた） */
  --gap: 14px;

  --r-s: 9px;                            /* iOS の小さい操作子 */
  --r-m: 13px;                           /* 塊・カード */
  --r-l: 22px;                           /* 浮かぶ面・対話箱 */
  --radius: var(--r-s);
  --ease: cubic-bezier(.25, .1, .25, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans",
          "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
/* 写真を掴んだときに、ブラウザの画像ドラッグを始めさせない
   （そのままだと写真を動かせず、自分の画面へ落としてカットが増える） */
img { -webkit-user-drag: none; user-drag: none; user-select: none; }
/* display を持つクラスが hidden 属性に勝たないようにする */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  /* 真っ平らな地だと面が浮いて見えない。ごく薄い濃淡を敷く */
  background: var(--ground);
  background-image:
    radial-gradient(120% 80% at 12% 0%, rgba(255, 255, 255, .85), transparent 55%),
    radial-gradient(110% 90% at 95% 100%, var(--ground-2), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* 和文は約物が1文字ぶんの幅を取る。見出し・操作子では詰めないと締まらない */
:lang(ja) :where(h1, h2, h3, .label, .title, .brand-name) { font-feature-settings: "palt" 1; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

/* 日本語は語の切れ目にスペースが無いので、指定しないと文節の途中で折れる
   （「次のものも一緒に消／えます」のように）。狭い面に置く短い説明ほど効く。
   行末の右端は揃わなくなるが、意味が切れないほうを取る */
:lang(ja) :where(h2, h3, .empty strong, .hint, .note, .summary,
                 .confirm-lead, .draft-lead, .draft-why, .draft-caveats li,
                 .confirm-pick .pick-note,
                 .plan-item .why, .check-item .why, .words,
                 .tour-body p, .tour-try, .onboard-body p,
                 .start-lead, .start-note, .start-opt-lead, .start-opt-ex,
                 .gate-lead, .gate-error) { word-break: auto-phrase; }
:lang(ja) :where(p, li) { line-break: strict; }
:lang(ja) :where(.btn, .step, .tab, .seg-btn, .menu-item) { font-feature-settings: "palt" 1; }

/* ------------------------------------------------------------------ 骨格 */

#app {
  --rail-w: 214px;
  --panel-w: 360px;
  --head-h: 60px;
  /* 面に囲まれた「空き」。台は窓の端まで広げるので、外側の余白も足して測る */
  --in-t: calc(var(--head-h) + var(--gap) * 2);
  --in-r: calc(var(--panel-w) + var(--gap) * 2);
  --in-l: calc(var(--rail-w) + var(--gap) * 2);
  --in-b: var(--gap);
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--panel-w);
  grid-template-rows: var(--head-h) minmax(0, 1fr);
  gap: var(--gap);
  padding: var(--gap);
  height: 100vh;
  background: transparent;
  position: relative;               /* 狭い幅の引き出しの拠り所 */
}
.head { grid-column: 1 / -1; grid-row: 1; }
/* 台は窓いっぱい。見出し帯も左右の面も、その上に重なる。
   寄った写真は面の下へ潜り込み、端で切られない */
/* 外側の余白は面を窓から浮かせる為のもの。写真にまで効かせない。
   台だけは窓の端まで広げ、寄った写真が隅まで届くようにする */
.stage { grid-column: 1 / -1; grid-row: 1 / -1; margin: calc(var(--gap) * -1); }
.rail { grid-column: 1; grid-row: 2; z-index: 3; }
.panel { grid-column: 3; grid-row: 2; z-index: 3; }
#app[data-gallery="true"] { --panel-w: 0px; }
#app[data-gallery="true"] .panel { display: none; }
/* カット一覧はいつでもしまえる。しまった分だけ写真が広くなる */
#app[data-rail="closed"] { --rail-w: 0px; }
#app[data-rail="closed"] .rail { display: none; }

/* 1段目。台の上に直に置く面。
   この中はもう面を重ねず、Cupertino の塊と仕切りだけで組む */
/* 見出し帯は左右の面より手前。その他メニューが右の面の後ろへ回らないように */
.head { z-index: 20; }
.head, .rail, .panel {
  border-radius: var(--r-l);
  background: var(--surface);
  box-shadow: var(--lift-2);
}

/* ---------------------------------------------------------------- 見出し帯 */

.head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand .mark {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  background:
    linear-gradient(135deg, #d6a400 0 50%, transparent 50%),
    linear-gradient(315deg, #2f8fb8 0 50%, #c13a2f 50%);
}
.brand-name { font-weight: 600; font-size: 13px; letter-spacing: .04em; white-space: nowrap; }

.proj {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 260px; min-width: 0;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-1);
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
.proj:hover { background: var(--fill-1); }
.proj:active { background: var(--fill-2); }
.proj-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-caret { color: var(--ink-3); font-size: 10px; }

/* 練習モードの帯。
   練習は別の道具ではなく、この画面のいちモードなので、案内の吹き出しではなく
   見出し帯そのものに出す。出ている間は「本番ではない」ことが常に見えていて、
   終える所も同じ場所にある */
.practice {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  background: var(--accent-12);
}
.practice-tag { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.practice-note { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }

.steps {
  display: flex; align-items: center; gap: 4px; margin-left: 6px; flex: none;
  padding: 2px;
  border-radius: var(--r-s);
  background: var(--fill-1);
}
.step {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s var(--ease), box-shadow .2s var(--ease), color .2s var(--ease);
}
.step:hover:not([disabled]) { background: var(--fill-1); color: var(--ink); }
.step[disabled] { color: var(--ink-3); opacity: .5; cursor: default; }
.step .num {
  display: inline-grid; place-items: center;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--fill-2);
  font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.step[data-done="true"] .num { color: var(--ok); background: rgba(26, 110, 62, .18); }
/* いまの段は白いつまみ。iOS のセグメンテッドコントロールと同じ見え方 */
.step[aria-current="step"] {
  background: var(--card);
  box-shadow: var(--knob);
  color: var(--ink);
  font-weight: 600;
}
.step[aria-current="step"] .num {
  background: var(--accent); color: var(--accent-ink); box-shadow: none;
}
.step-sep { display: none; }

.head-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.job-state { font-size: 11.5px; color: var(--accent); font-variant-numeric: tabular-nums; }
.job-state[data-lost="true"] { color: var(--danger); }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
/* 閉じている引き出しの中身は、場所も持たせない。
   絶対配置の中身は、閉じても大きさを返すことがあり、案内が中の項目を
   「見えている」と見なして、何もない所を指していた */
.menu:not([open]) .menu-body { display: none; }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
  display: grid; gap: 2px;
  min-width: 232px;
  padding: 8px;
  border-radius: var(--r-m);
}
.menu-item {
  padding: 9px 12px;
  border: 0; border-radius: var(--r-s);
  background: transparent;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .16s var(--ease);
}
/* 引き出しの中の行き先は、押す物と同じ見え方にそろえる（a でも button でも） */
a.menu-item { display: block; color: inherit; text-decoration: none; }
/* 名乗りはメールアドレス。長いものは端を省いて、引き出しの幅を押し広げない */
#whoBtn { display: flex; align-items: baseline; gap: 8px; }
#whoName { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.who-out { margin-left: auto; color: var(--ink-3); font-size: 11.5px; }
.menu-item:hover { background: var(--accent-8); }
.menu-item:active { background: var(--accent-12); }
.menu-item:disabled { color: var(--ink-3); opacity: .55; cursor: not-allowed; }
.menu-item:disabled:hover { background: transparent; }
/* 消す操作は、他の項目と同じ顔で並んでいると押し間違える。色と仕切りで隔てる */
.menu-line { height: 1px; margin: 5px 6px; border: 0; background: var(--separator); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: rgba(163, 53, 47, .1); }
.menu-item.danger:disabled { color: var(--ink-3); }

/* --------------------------------------------------------------- 汎用部品 */

/* 浮いた面の「上」に置く操作子は、そこで重ねて浮かせない。
   持ち上がりは面が作り、面の上ではマテリアルの色と重ねで押せることを示す。
   段を二重に積むと、どれが一段目でどれが二段目か分からなくなる */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-12);
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { background: rgba(26, 104, 153, .22); }
.btn:active { background: rgba(26, 104, 153, .3); }
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--fill-1); color: var(--ink-3);
  cursor: not-allowed;
}
/* 主ボタンだけは面から一段持ち上げる。その段でどれが次の一手かが決まる */
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn.primary:hover { background: #14587f; }
.btn.primary:active { background: #11506f; }
.btn.primary[disabled] { background: rgba(26, 104, 153, .32); color: rgba(255, 255, 255, .8); box-shadow: none; }
.btn.quiet { background: transparent; color: var(--ink-2); padding: 6px 12px; }
.btn.quiet:hover { background: var(--accent-8); color: var(--ink); }
.btn.quiet[aria-pressed="true"] {
  background: var(--accent-12); color: var(--accent); font-weight: 600;
}
.btn.small { padding: 5px 12px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(163, 53, 47, .1); }
/* 押せない時まで赤いと、押せる物に見えてしまう。押せない見た目に戻す
   （.btn[disabled] より後ろにあるので、ここで言い直す必要がある） */
.btn.danger[disabled] { color: var(--ink-3); background: var(--fill-1); }
.btn.danger[disabled]:hover { background: var(--fill-1); }

.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row > select, .row > input[type="text"] { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }

::placeholder { color: var(--ink-3); opacity: 1; }
input[type="text"], input[type="search"], input[type="email"], input[type="password"],
textarea, select {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-s);
  background: var(--fill-1);
  outline: none;
  transition: box-shadow .2s var(--ease), background-color .2s var(--ease);
}
input[type="text"]:hover, input[type="search"]:hover, input[type="email"]:hover,
input[type="password"]:hover, textarea:hover { background: var(--fill-3); }
input[type="text"]:focus, input[type="search"]:focus, input[type="email"]:focus,
input[type="password"]:focus, textarea:focus, select:focus {
  background: var(--card);
  box-shadow: inset 0 0 0 2px var(--accent);
}
textarea { resize: vertical; line-height: 1.6; }
select { cursor: pointer; appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type="range"] {
  appearance: none; height: 22px; padding: 0; background: transparent; box-shadow: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px; background: var(--fill-3);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; margin-top: -5px;
  border-radius: 50%; background: var(--accent);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { display: grid; gap: 5px; margin-top: 10px; }
.field > .label { font-size: 11.5px; color: var(--ink-3); }
.count { color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.65; }
.note {
  font-size: 12px; color: var(--ink-2);
  padding: 9px 12px; border-radius: var(--r-s);
  background: var(--fill-1);
}
.note.warn { color: var(--warn); }
.summary { font-size: 12.5px; color: var(--ink-2); }

/* ------------------------------------------------------------ カット一覧 */

.rail {
  /* 縦に積む。段組みの行数で位置を決めると、隠れる区画（進み具合・見比べ）が
     出入りするたびに、伸びる行が別の区画に当たって崩れる */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rail > .cut-list { flex: 1 1 auto; }
.rail > :not(.cut-list) { flex: 0 0 auto; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; }
.rail-head h2 { font-size: 14px; font-weight: 600; }
.rail-state { padding: 0 14px 10px; font-size: 11.5px; color: var(--ink-3); }
.cut-list { overflow-y: auto; padding: 0 10px 4px; display: grid; gap: 8px; align-content: start; }
.cut-row { position: relative; }
.cut-row[draggable="true"] .cut { cursor: grab; }
.cut-row[data-dragging="true"] { opacity: .45; }
.cut {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--r-s);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.cut:hover { background: var(--accent-8); }
.cut[aria-current="true"] { background: var(--accent-tint); }
.cut img {
  width: 48px; height: 60px; object-fit: cover; border-radius: 7px; background: #9aa3b0;
}
.cut-text { display: grid; gap: 2px; min-width: 0; }
.cut-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.cut-meta { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
/* カットを外す。押し間違えると納品物ごと消えるので、指した時だけ出す */
.cut-x {
  position: absolute; top: 5px; right: 5px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--ground);
  box-shadow: 0 1px 3px rgba(88, 100, 124, .3);
  color: var(--ink-2);
  cursor: pointer;
  /* 以前は hover のときだけ出していたが、触って使う画面には hover が無く、
     カットを消す道がそこだけだったため「消せない」状態になっていた。
     常に置いて、写真の邪魔にならないよう控えめな濃さにする */
  opacity: .55;
  transition: opacity .16s var(--ease), color .16s var(--ease);
}
.cut-row:hover .cut-x, .cut-x:focus-visible, .cut-x:hover { opacity: 1; }
.cut-x:hover { color: var(--danger); }
/* ゴミ箱の絵。消す所はどれも同じ形・同じ色にする。
   ×は「閉じる」とも読めるので、消す所には使わない */
.cut-x .ic, .trash .ic { width: 15px; height: 15px; }
.trash {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: var(--r-s);
  background: transparent; color: var(--ink-3);
  cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.trash:hover { background: rgba(163, 53, 47, .1); color: var(--danger); }
.trash:disabled { color: var(--ink-3); opacity: .4; cursor: not-allowed; }
.trash:disabled:hover { background: transparent; color: var(--ink-3); }
.rail-foot { padding: 10px 14px 14px; }
.pad { padding: 10px 4px; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.done { background: var(--ok); }
.dot.running { background: var(--warn); animation: pulse 1s infinite alternate; }
.dot.stale { background: var(--accent); }
.dot.error { background: var(--danger); }
@keyframes pulse { to { opacity: .25; } }

/* ------------------------------------------------------- 台（キャンバス） */

/* 台は地そのもの。囲いも段も付けない。周りの余白とひと続きに見えるので、
   カットは「広い台の上に置いた1枚」に、道具は「その上に浮いた物」になる */
.stage {
  position: relative;
  overflow: hidden;
  background: transparent;
  min-width: 0;
}
.stage.panning, .stage.panning canvas { cursor: grabbing; }
/* 中身は面に挟まれた空きの真ん中へ。はみ出した分は面の下へ潜る */
.canvas-wrap, .compare, .gallery {
  position: absolute;
  inset: var(--in-t) var(--in-r) var(--in-b) var(--in-l);
  overflow: visible;
}
#viewport {
  /* 拡大縮小と移動は毎フレーム transform で動かす。層として切り出しておくと、
     写真と指示の面を作り直さずに済む（作り直すと寄るたびに引っかかる） */
  will-change: transform;
  position: absolute; left: 50%; top: 50%;
  transform-origin: center center;
  /* 台の上に置いた1枚の紙。影は写真と一緒に拡大縮小する */
  box-shadow: 0 18px 48px rgba(70, 78, 92, .34), 0 2px 8px rgba(70, 78, 92, .2);
}
#viewport canvas, #viewport img { position: absolute; left: 0; top: 0; }
#maskImg, #overlay { pointer-events: none; }
#baseImg { display: block; }
#overlay { pointer-events: auto; }
/* ペンや指で書くには、その動きを閲覧側（頁送り・つまんで拡大）へ渡さないと
   宣言しておく必要がある。これが無いと、Apple Pencil で線を引き始めた瞬間に
   閲覧側が横取りして pointercancel が飛び、描きかけが毎回捨てられる。
   写真を動かす・寄せるは指2本に割り当ててある（app.js の bindStage） */
#stage, #overlay, #compareStage { touch-action: none; }
/* 長押しの吹き出しと、写真の選択も止める。書いている途中に出ると線が切れる */
#stage { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* 指示の段では、どこでもそのまま書き出せる。掴める物の上ではその都度
   カーソルが変わる（layer.js が上書きする） */
#overlay[data-tool="select"] { cursor: crosshair; }
#overlay[data-tool="region"], #overlay[data-tool="pen"] { cursor: crosshair; }
#overlay[data-tool="dots"] { cursor: cell; }
#overlay[data-tool="text"] { cursor: text; }

/* 台の上に浮かぶ小さな面。写真の上に重なるので、塗りを少し濃くして
   どんな写真の上でも字が読めるようにする */
.armed, .view-tag, .stage-tools, .drop-hint, .pick, .compare-bar, .compare-tag,
.gallery-bar, .card, .menu-body, .toast, dialog {
  /* 写真の上に置く面。どんな写真の上でも字が読めるよう、塗りつぶす */
  background: var(--surface);
}
.armed, .view-tag, .stage-tools, .compare-bar, .compare-tag, .gallery-bar, .card {
  box-shadow: var(--lift-1);
}
.pick, .menu-body, .drop-hint { box-shadow: var(--lift-2); }
.toast, dialog { box-shadow: var(--lift-3); }

.armed {
  position: absolute; left: 50%; top: calc(var(--in-t) + 14px); z-index: 6;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - var(--in-l) - var(--in-r) - 28px);
  padding: 9px 10px 9px 14px;
  border-radius: 999px;
}
.armed-swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.armed-text { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.armed-text strong { font-weight: 600; white-space: nowrap; }
.armed-text span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.armed-size { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-3); }
.armed-size input { width: 122px; }

.view-tag {
  position: absolute;
  left: calc(var(--in-l) + 16px);
  top: calc(var(--in-t) + 16px);
  z-index: 4;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
}
.view-tag::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: currentColor; }
.view-tag[data-state="before"] { color: var(--before); }
.view-tag[data-state="mask"] { color: var(--warn); }
.view-tag[data-state="waiting"] { color: var(--ink-3); }
.view-tag[data-state="waiting"]::before { animation: pulse .8s infinite alternate; }

.tool-read {
  display: flex; gap: 8px; align-items: center;
  padding: 0 10px;
  font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.empty {
  position: absolute;
  inset: var(--in-t) var(--in-r) var(--in-b) var(--in-l);
  display: grid; place-content: center; justify-items: center; gap: 10px;
  text-align: center;
  padding: 24px;
}
.empty strong { font-size: 16px; font-weight: 600; }
.empty span { font-size: 12px; color: var(--ink-3); max-width: 30em; }
.drop-hint {
  position: absolute;
  inset: calc(var(--in-t) + 16px) calc(var(--in-r) + 16px)
         calc(var(--in-b) + 16px) calc(var(--in-l) + 16px);
  display: grid; place-items: center;
  border-radius: var(--r-m);
  box-shadow: var(--lift-2), inset 0 0 0 2px var(--accent);
  font-weight: 600; color: var(--accent);
  z-index: 20;
}

.stage-tools {
  position: absolute; left: 50%; bottom: 16px; z-index: 6;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 3px;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 5px;
  border-radius: 999px;
  /* 幅が足りない時は、帯の中だけを横に送る。折り返すとピルの形が崩れる */
  overflow-x: auto;
  scrollbar-width: none;
}
.stage-tools::-webkit-scrollbar { display: none; }
.tool-btn {
  padding: 6px 13px;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.tool-btn:hover { background: var(--accent-8); color: var(--ink); }
.tool-btn[aria-pressed="true"] { background: var(--accent-12); color: var(--accent); font-weight: 600; }
/* 作るのに数秒かかる物は、待っている間そうと分かるようにする */
.tool-btn[data-busy="true"]::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px; margin-left: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse .8s infinite alternate;
  vertical-align: middle;
}
/* 台の直下に置く帯（指示する段）は、左右の面に挟まれた空きの真ん中へ。
   見比べの帯は、すでにその空きの中にあるので寄せ直さない */
.stage > .stage-tools, .stage > .armed {
  left: calc(50% + (var(--rail-w) - var(--panel-w)) / 2);
  max-width: calc(100% - var(--in-l) - var(--in-r) - 28px);
}
/* 台は窓の端まで広げてあるので、下の帯は外側の余白のぶん上げて左右と高さを揃える */
.stage > .stage-tools { bottom: calc(var(--in-b) + 16px); }
.tool-sep { width: 1px; height: 17px; background: var(--line-strong); margin: 0 4px; }
/* 仕切りは「左右に物があって初めて仕切り」になる。左が出ていないときは、
   帯の頭に縦線が1本立っているだけになるので出さない
   （指示モードの切り替えが隠れる「確認」の段で、そう見えていた） */
.stage-tools > :first-child[hidden] + .tool-sep { display: none; }

/* 絵記号。線は1本の太さでそろえ、色は文字と同じものを継ぐ */
.ic {
  width: 17px; height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn.icon, .tool-btn.icon, .seg-btn.icon {
  display: inline-grid; place-items: center;
  padding: 7px;
}
.btn.wide.icon { width: 100%; }
.btn.quiet.small.icon { padding: 5px; }
.seg-btn.icon { padding: 5px 13px; }
/* 道具の帯の中のセグメントは、帯の丸みに合わせて少し小さく */
/* 帯が丸ピルなので、その中の溝とつまみも丸ピルにそろえる。
   角の丸みが二種類あると、乗っている物が別の部品に見える */
#modeSeg { padding: 2px; border-radius: 999px; }
#modeSeg .seg-btn { border-radius: 999px; padding: 4px 12px; font-size: 11.5px; }
#modeSeg .seg-btn.icon { padding: 5px 13px; }

.loupe {
  position: fixed; z-index: 60; pointer-events: none;
  border-radius: var(--r-m);
  box-shadow: 0 20px 50px rgba(60, 70, 90, .3), inset 0 0 0 .5px rgba(255, 255, 255, .6);
}

/* ------------------------------------------------------------------ 右の面 */

.panel { display: flex; min-height: 0; overflow: hidden; }
.pane {
  display: flex; flex-direction: column; gap: 14px;
  width: 100%; padding: 14px;
  overflow-y: auto;
}
/* 指示する段だけは、上の「探す」と下の「指示書」を別々に送る。
   29件の指示書を送るたびに探す所まで動くと、目の置き場が定まらない */
.pane[data-pane="instruct"] { overflow: hidden; }
.pane[data-pane="instruct"] > .sect { flex: none; }
.pane[data-pane="instruct"] > .add-sect { flex: 0 0 auto; max-height: 55%; overflow-y: auto; }
.pane[data-pane="instruct"] > .sect.grow {
  flex: 1 1 auto; min-height: 120px; overflow-y: auto;
  /* 行が浮いているので、送る箱の縁で影が切れないよう左右に逃げを取る */
  margin: 0 -4px; padding: 0 4px;
}
/* 中身が少ない時に行を引き伸ばさない。上から順に積む */
.sect { display: grid; gap: 9px; align-content: start; }
.sect.grow { flex: 1 0 auto; }
/* 幅が足りない時は、操作子の並びごと次の行へ送る。並びの途中で折れると
   「まとめて直す／取り消す」と「やり直す」が別の組に見えてしまう */
.sect-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px 8px; flex-wrap: wrap;
}
/* 見出しは折り返さない。幅が足りない時に縮むのは、右の操作子の側 */
/* 見出しは大きさと太さの両方で本文と離す。太さだけの差だと、
   影や色を外した時に階層が消える */
.sect > h2, .sect-head h2 {
  font-size: 15px; font-weight: 600; letter-spacing: .01em; line-height: 1.5;
  white-space: nowrap; flex: none;
}
.sect-head > .row { min-width: 0; flex-wrap: nowrap; justify-content: flex-end; margin-left: auto; }
.sect-head .btn.quiet.small { padding: 4px 9px; }
.sect > h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }

.add-sect { gap: 8px; }
.finder { display: flex; align-items: center; gap: 8px; }
.finder input { flex: 1; min-width: 0; }
.finder input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.5); }
.find-hint { margin-top: 2px; }

/* カット全体への指示。数が少ないので、一覧ではなく押せる札を並べる */
.whole-list { display: flex; flex-wrap: wrap; gap: 6px; }
.whole-chip {
  padding: 6px 11px;
  border: 0; border-radius: 999px;
  background: var(--fill-1);
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.whole-chip:hover { background: var(--accent-12); color: var(--accent); }
.whole-chip:active { background: var(--fill-2); }

.pal-item, .pick-item, .unused-item {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto;
  gap: 9px; align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 0; border-radius: var(--r-s);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color .16s var(--ease), box-shadow .16s var(--ease);
}
.pal-item:hover, .pick-item:hover, .unused-item:hover { background: var(--accent-8); }
.pal-item .sw, .pick-item .sw, .unused-item .sw, .plan-item .sw {
  width: 11px; height: 11px; border-radius: 4px;
}
.pal-item .label, .pick-item .label, .unused-item .label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.pal-item .label b, .unused-item .label b {
  color: var(--ink-3); font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums;
}
.how { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.pal-item .used { color: var(--accent); font-weight: 600; }

.browse {
  display: grid; gap: 9px;
  padding: 10px;
  border-radius: var(--r-m);
  background: var(--card);
}
.palette { display: grid; gap: 3px; max-height: 300px; overflow-y: auto; }
.pal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.pal-item[aria-pressed="true"] {
  background: var(--accent-12);
}
.pal-item[aria-pressed="true"] .label { font-weight: 600; }

/* 分類と絞り込みは iOS のセグメンテッドコントロール。
   溝の中を白いつまみが移り、選んでいる1つだけが手前に来る */
.tabs {
  display: flex; flex-wrap: nowrap; gap: 2px;
  padding: 2px;
  border-radius: var(--r-s);
  background: var(--fill-1);
  /* 溝は1本。入り切らない時は折り返さず、中を横に送る。
     横送りにすると自動の最小高さが0になって溝が潰れるので、高さを押さえる */
  overflow-x: auto;
  scrollbar-width: none;
  min-height: 32px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 0; border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .16s var(--ease), box-shadow .16s var(--ease), color .16s var(--ease);
}
.tab:hover { background: var(--fill-1); color: var(--ink); }
.tab[aria-selected="true"] {
  background: var(--card); box-shadow: var(--knob); color: var(--ink); font-weight: 600;
}
.tabs.filter .count { margin-left: 5px; color: var(--ink-3); }
.tabs.filter .tab[aria-selected="true"] .count { color: var(--accent); }

.bulk-bar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 11px;
  border-radius: var(--r-s);
  background: var(--fill-1);
}
.bulk-bar .small { color: var(--ink-2); }

/* ------------------------------------------------------------ 指示書の行 */

.ann-list, .plan-list, .check-list, .common-edit { list-style: none; margin: 0; padding: 0; }
.ann-list { display: grid; gap: 0; align-content: start; }

.ann-group {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px 2px;
  font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em;
}
.ann-group:first-child { padding-top: 2px; }

/* 行は地の上に直に置く。白い塊を敷くと、面の上にもう一枚板が乗って濁る。
   区切りは「文字の始まりから引いて、右へ消えていく細い線」1本だけにする */
.ann, .plan-item, .check-item, .run { position: relative; }
.ann {
  border-radius: var(--r-s);
  transition: background-color .2s var(--ease);
}
.ann + .ann::before, .plan-item + .plan-item::before,
.check-item + .check-item::before, .run + .run::before {
  content: "";
  position: absolute; left: 45px; right: 6px; top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0, var(--separator) 7%, var(--separator) 58%, transparent 100%);
}
.plan-item + .plan-item::before, .check-item + .check-item::before { left: 38px; }
.run + .run::before { left: 16px; }
/* 選んでいる行は面で示すので、その上下の線は消す */
.ann[aria-selected="true"]::before, .ann[aria-selected="true"] + .ann::before,
.check-item[data-focus="true"]::before, .check-item[data-focus="true"] + .check-item::before,
.plan-item[data-here="true"]::before, .plan-item[data-here="true"] + .plan-item::before,
.run[data-current="true"]::before, .run[data-current="true"] + .run::before { opacity: 0; }
/* 選んだ行は、見出しも開いた中身もひと続きの一枚にする。
   行と中身で濃さを変えると、境目が増えて別の物が並んで見える */
.ann[aria-selected="true"] { background: var(--accent-tint); margin: 3px 0; }
.ann[aria-selected="true"]::before,
.ann[aria-selected="true"] + .ann::before { opacity: 0; }
.ann[data-off="true"] .ann-row { opacity: .6; }
.ann[data-off="true"] .ann-main { opacity: .5; text-decoration: line-through; }
/* 番号札・件名・効かせ方・ゴミ箱。件名は入る分だけ出し、あふれたら「…」で切る */
.ann-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 10px 9px 7px 11px; }
.ann-kill { width: 24px; height: 24px; }
.ann-kill .ic { width: 14px; height: 14px; }
.idx {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 24px;
  border: 0; border-radius: 7px;
  background: color-mix(in srgb, var(--c, var(--ink-3)) 26%, #fff);
  color: var(--ink);
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.idx.choose { background: var(--fill-2); }
.idx.choose[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.ann-main {
  display: grid; gap: 2px; min-width: 0;
  padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.ann-main .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ann-main .title b { color: var(--ink-3); font-weight: 600; margin-right: 6px; }
/* 幅が足りない時は、右の目盛りに重ねずに切る */
.ann-main .meta {
  display: flex; gap: 9px; font-size: 11px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden;
}
.ann-main .meta > span { overflow: hidden; text-overflow: ellipsis; }
.state { color: var(--ink-3); }
.state.new { color: var(--accent); font-weight: 600; }

/* 棒の高さがそのまま目盛り。溝を敷いても読む物は増えない。
   読み（標準・しっかり…）は棒の隣に置く。左の行にも同じ言葉を書くと、
   同じことが1行に二度出て、32行ぶん並んだときに札の壁になる */
.str { display: inline-flex; align-items: center; gap: 7px; padding: 2px 0; }
.str-bars { display: inline-flex; gap: 3px; align-items: flex-end; }
.str-read { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; min-width: 3.5em; }
/* 面が細いときは、目盛りの読みを引っ込めて件名に幅を譲る。
   読みは目盛りの title と読み上げに残るので、分からなくなることはない。
   件名が「手法1 アホ…」まで削られるほうが、読む物としては痛い */
@media (max-width: 1180px) { .ann-list .str-read { display: none; } }
.str-seg {
  width: 5px; padding: 0; border: 0; border-radius: 999px;
  background: var(--fill-3);
  cursor: pointer;
  transition: background-color .16s var(--ease), height .16s var(--ease);
}
.str-seg:nth-child(1) { height: 7px; }
.str-seg:nth-child(2) { height: 10px; }
.str-seg:nth-child(3) { height: 13px; }
.str-seg:nth-child(4) { height: 16px; }
.str-seg:nth-child(5) { height: 19px; }
.str-seg[data-on="true"] { background: var(--accent); }
.str-seg:hover { background: var(--ink-2); }

/* 罫は「行と行のあいだ」にだけ引く。ここに罫を足すと、開き口が上の行と
   下の行のどちらに属するのか分からなくなる。字下げと色で、その行の物だと示す */
.ann-more > summary {
  padding: 0 11px 9px 45px;
  font-size: 11.5px; color: var(--accent);
  cursor: pointer; list-style: none;
  width: max-content;
}
.ann-more > summary:hover { text-decoration: underline; }
.ann-more > summary::-webkit-details-marker { display: none; }
.ann-more > summary::before { content: "▸"; margin-right: 5px; font-size: 9px; vertical-align: 1px; }
.ann-more[open] > summary::before { content: "▾"; }
.ann-more[open] { padding-bottom: 14px; }

.ann-more > *:not(summary) { padding-left: 45px; padding-right: 11px; }
.ann-more .field input[type="text"], .ann-more .field select { font-size: 12px; }
.range { display: flex; gap: 6px; }

/* ------------------------------------------------------------ 段取りと検収 */

.plan-item, .check-item {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: var(--r-s);
  transition: background-color .2s var(--ease);
}
.plan-list, .check-list { display: grid; gap: 0; }
.plan-item .sw { margin-top: 5px; }
.plan-item[data-here="true"] { background: var(--accent-tint); margin: 3px 0; }
.plan-body {
  display: grid; gap: 2px; min-width: 0;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer;
}
.plan-body:hover .title { color: var(--accent); }
.plan-item .title, .check-item .title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.plan-item .meta, .check-item .meta { font-size: 12px; color: var(--ink-3); }
.plan-item .why, .check-item .why { font-size: 11px; color: var(--ink-3); }
/* デザイナーへ渡る文面。読みたいときだけ開く */
.words { display: none; font-size: 11.5px; color: var(--ink-2); margin-top: 5px; line-height: 1.6; }
#app[data-words="true"] .words { display: block; }

.unused { display: grid; gap: 7px; padding: 11px; border-radius: var(--r-m); background: var(--fill-1); }
.unused-list { display: grid; gap: 3px; }

.check-item { grid-template-columns: auto minmax(0, 1fr) auto; }
/* 色の点と色の字で足りる。ひとつずつ下敷きを敷くと、行が札だらけになる */
.verdict {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.verdict::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.verdict.good { color: var(--ok); }
.verdict.weak, .verdict.warn { color: var(--warn); }
.verdict.none { color: var(--ink-3); }
.check-item[data-mark="ok"] { background: rgba(26, 110, 62, .09); }
.check-item[data-mark="ng"] { background: rgba(192, 51, 42, .09); }
/* 下敷きの付いた行は、隣とぴったり接すると一枚の塊に見える。
   わずかに離して、両隣の髪の毛ほどの仕切りも消す（線と余白が二重になるため） */
.check-item[data-mark="ok"], .check-item[data-mark="ng"],
.check-item[data-focus="true"] { margin: 3px 0; }
.check-item[data-focus="true"]::before,
.check-item[data-focus="true"] + .check-item::before { opacity: 0; }
.check-item[data-mark="ok"]::before, .check-item[data-mark="ng"]::before,
.check-item[data-mark="ok"] + .check-item::before,
.check-item[data-mark="ng"] + .check-item::before { opacity: 0; }
.check-item[data-mark="ng"] .title { color: var(--danger); }
/* いま手を付けている行の印。判定（合格＝緑／直っていない＝赤）は下敷きで示すので、
   居場所は下敷きではなく**枠**で示す。こうすると、判定を選び直して外した後も
   色が残っているように見えない。
   枠は四辺に回す。左の縁だけを色で塗る形（inset 3px 0 0）は、意味を持たない
   飾りとして使われがちな型で、この画面でも「どちら側が特別なのか」を偽装する。
   四辺の枠は、この画面の他の「選んでいる物」（カット・型・入力欄）と同じ形。 */
.check-item[data-focus="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.check-item[data-jump="true"] { cursor: pointer; }
/* 押せる字は青。iOS では色の付いた文字がそのままボタンになる */
.check-item .jump {
  padding: 4px 8px; border: 0; border-radius: 7px;
  background: transparent; color: var(--accent); font-size: 11.5px; cursor: pointer;
  transition: background-color .16s var(--ease);
}
.check-item .jump:hover { background: var(--accent-8); }
/* 合格か差し戻しかの二択。iOS のセグメンテッドコントロールに寄せる */
/* 判定は言葉で選ばせる。行ごとに下敷きを敷いた2つ組を置くと、
   15行ぶんで同じ箱が15個並び、どの行を見ているのか分からなくなる。
   押せることは字の色と、押した時に入る下敷きだけで示す */
.judge {
  grid-column: 1 / -1;
  display: flex; justify-content: flex-end; gap: 4px;
  margin-top: 6px;
}
.judge-btn {
  padding: 4px 10px;
  border: 0; border-radius: 7px;
  background: transparent;
  color: var(--ink-2); font-size: 12px; cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.judge-btn:hover { background: var(--fill-1); color: var(--ink); }
/* 決めた側だけに下敷きが入る。押していない側は字のまま */
.judge-btn.ok[aria-pressed="true"] { background: rgba(26, 110, 62, .12); color: var(--ok); font-weight: 600; }
.judge-btn.ng[aria-pressed="true"] { background: rgba(192, 51, 42, .12); color: var(--danger); font-weight: 600; }
.why-input { grid-column: 1 / -1; margin-top: 7px; font-size: 12px; }

#reviewState { color: var(--ink-3); font-size: 11.5px; }
#reviewState[data-state="accepted"] { color: var(--ok); font-weight: 600; }
#reviewState[data-state="rework"] { color: var(--danger); font-weight: 600; }

.runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.run {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 10px 14px;
  border-radius: var(--r-s);
  cursor: pointer;
  transition: background-color .16s var(--ease);
}
.run:hover { background: var(--fill-1); }
.run[data-current="true"] { background: var(--accent-tint); margin: 3px 0; }
.run-no { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.run .meta { font-size: 11px; color: var(--ink-3); }
.run-state { font-size: 11px; color: var(--ink-3); }
.run-state.accepted { color: var(--ok); }
.run-state.rework { color: var(--danger); }

.choice { display: grid; gap: 7px; }
.choice label { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; cursor: pointer; }
.choice input { accent-color: var(--accent); }
.bar { height: 8px; border-radius: 999px; background: var(--fill-3); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s var(--ease); }

/* --------------------------------------------------------------- 見比べ */

.compare { display: grid; grid-template-rows: auto minmax(0, 1fr); }
/* どのカットの、どの版を、どう見比べているか。写真の上に重ねると
   顔の辺りに被って作業の邪魔になるので、左の面に置く */
.rail-sect { display: grid; gap: 7px; padding: 12px 14px; border-top: 1px solid var(--separator); }
.rail-sect h3 { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; }
#cmpName { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cmpMeta { color: var(--ink-3); font-variant-numeric: tabular-nums; line-height: 1.5; }
.seg.wide { width: 100%; }
.seg.wide .seg-btn { flex: 1 1 auto; padding: 5px 4px; text-align: center; }

.seg { display: flex; padding: 2px; border-radius: var(--r-s); background: var(--fill-1); flex: none; }
.seg-btn {
  padding: 5px 15px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-2); font-size: 12px; cursor: pointer;
  white-space: nowrap;
  transition: background-color .16s var(--ease), box-shadow .16s var(--ease), color .16s var(--ease);
}
.seg-btn:hover { background: var(--fill-1); color: var(--ink); }
.seg-btn[aria-pressed="true"] {
  background: var(--card); box-shadow: var(--knob); color: var(--ink); font-weight: 600;
}

.compare-stage { position: relative; grid-row: 1 / -1; }
.compare-viewport {
  will-change: transform;
  position: absolute; left: 50%; top: 50%;
  transform-origin: center center;
  box-shadow: 0 18px 48px rgba(70, 78, 92, .34), 0 2px 8px rgba(70, 78, 92, .2);
}
.compare-base { position: absolute; inset: 0; }
#cmpMarks { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.compare-viewport img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.compare-clip { position: absolute; inset: 0; }
.compare-handle {
  --u: 1;
  position: absolute; top: 0; bottom: 0;
  width: calc(44px * var(--u));
  margin-left: calc(-22px * var(--u));       /* 線からずれても掴めるよう、当たりを広く取る */
  background-image: linear-gradient(var(--before) 0 50%, var(--after) 0 100%);
  background-size: calc(2px * var(--u)) 100%;
  background-position: center top;
  background-repeat: no-repeat;
  cursor: ew-resize;
  touch-action: none;                        /* 触った指で写真が動かないようにする */
}
.compare-handle::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: calc(30px * var(--u)); height: calc(30px * var(--u));
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--ground);
  box-shadow: 0 calc(2px * var(--u)) calc(8px * var(--u)) rgba(40, 46, 56, .45);
}
.compare-handle:focus-visible { outline: none; }
.compare-handle:focus-visible::after { box-shadow: 0 0 0 calc(3px * var(--u)) var(--accent); }
.compare-stage[data-mode="side"] .compare-handle,
.compare-stage[data-mode="only"] .compare-handle,
.compare-stage[data-mode="blink"] .compare-handle { display: none; }
.compare-stage[data-mode="blink"] .compare-clip,
.compare-stage[data-mode="only"] .compare-clip { clip-path: none; }
/* 1枚しか出ない見せ方では、出ていない側の札を残さない */
.compare-stage[data-mode="blink"] .compare-tag.left,
.compare-stage[data-mode="only"] .compare-tag.left { display: none; }
.compare-stage[data-mode="side"] .compare-viewport { display: flex; gap: 4px; width: auto !important; }
.compare-stage[data-mode="side"] .compare-base { flex: none; position: relative; }
.compare-stage[data-mode="side"] .compare-clip { position: static; clip-path: none; flex: none; }
.compare-stage[data-mode="side"] .compare-clip img { position: static; }
.compare-tag {
  position: absolute; z-index: 7;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  pointer-events: none;
  overflow: hidden;                 /* 溜まりを札の丸みで切る */
  transition: opacity .18s var(--ease);
}
.compare-tag::before {
  content: ""; width: 8px; height: 8px; border-radius: 3px; background: currentColor;
  position: relative; z-index: 1; flex: none;
}
/* 字は黒のまま。どちらの側かは、印の丸と溜まりの色が言う。
   色字のままだと、溜まった上で 3.7:1 まで落ちて読めなくなる（実測） */
.tag-label { position: relative; z-index: 1; white-space: nowrap; color: var(--ink); }

/* 次に入れ替わるまでの残り。札そのものが左から満ちていく。
   写真の上に道具を増やさず、いま読んでいる札がそのまま時計になる */
.tag-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: calc(var(--p, 0) * 100%);
  background: currentColor;
  opacity: .2;
}
/* 押している間は満ちるのを止める。薄くして「止めている」と分かるようにする */
.compare-tag[data-hold="true"] { opacity: .62; }

.compare-tag.left { color: var(--before); }
.compare-tag.right { color: var(--after); }

/* ------------------------------------------------------------ カット一覧（大） */

.gallery {
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  background: transparent;
}
/* 左右の面と同じ高さなので、丸みもそろえる。同じ高さの物が
   違う丸みを持っていると、別の部品に見える */
.gallery-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 0 0 4px;
  padding: 11px 12px 11px 16px;
  border-radius: var(--r-l);
}
/* 帯の中は、狭くなったら行を折る。折らずに詰めると「絞り込み」の見出しが
   一文字ずつ縦に割れていた（選ぶ所だけが伸びて、字の居場所が無くなるため） */
.gallery-bar .row { gap: 9px; flex-wrap: wrap; }
.gallery-bar .row > label { flex: none; }
.gallery-bar .row span, .gallery-bar .row .muted { white-space: nowrap; }
.gallery-bar select { width: auto; min-width: 160px; }
.gallery-grid {
  overflow-y: auto;
  padding: 12px 4px 4px;
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  align-content: start;
}
.card {
  display: grid; gap: 0;
  border-radius: var(--r-l);
  overflow: hidden;
  transition: box-shadow .2s var(--ease);
}
.card:hover { box-shadow: var(--lift-2); }
/* 選んだ印。枠線は写真がその上に乗って見えず、残しておくと印が二つになる。
   選んだ物がある間は**選んでいない写真を沈める**だけにする。色が残っているほうが
   選ばれた物で、一覧のどこを見ても、写真そのもので判る */
.gallery-grid[data-picking="true"] .card[data-selected="false"] .card-shots {
  filter: grayscale(1) contrast(.88) opacity(.45);
}
.gallery-grid[data-picking="true"] .card[data-selected="false"] { box-shadow: none; }
.card-shots { transition: filter .2s var(--ease); }
@media (prefers-reduced-motion: reduce) { .card-shots { transition: none; } }
.card-shots { display: grid; gap: 2px; cursor: pointer; background: rgba(92, 101, 112, .18); }
.card-shots[data-mode="pair"] { grid-template-columns: 1fr 1fr; }
.shot { position: relative; margin: 0; aspect-ratio: 3 / 4; overflow: hidden; background: #cfd4dc; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot > figcaption {
  position: absolute; left: 7px; top: 7px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  font-size: 10.5px; font-weight: 600; color: var(--before);
}
.shot[data-kind="out"] > figcaption { color: var(--after); }
.shot.empty { display: grid; place-items: center; color: var(--ink-3); font-size: 11.5px; }
.shot.empty > figcaption { position: static; background: none; padding: 0; margin-bottom: 4px; }
.card-foot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; }
.card-foot .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; }
.card-foot .meta { font-size: 11px; color: var(--ink-3); }
.card-foot input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
/* 押す物は2つ＋ゴミ箱。ゴミ箱は字の幅を取らないので、残りを2等分する */
.card-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 0 12px 12px; }
.card-actions .btn { padding: 7px 10px; font-size: 12px; }
.card-actions .btn[disabled] { background: rgba(92, 101, 112, .1); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: var(--ink-3); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.new { color: var(--accent); }
.badge.done { color: var(--ok); }

/* ------------------------------------------------------------------ 対話箱 */

dialog {
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  padding: 24px;
  border: 0;
  border-radius: var(--r-l);
  color: var(--ink);
  overflow: auto;
}
dialog::backdrop { background: rgba(70, 78, 92, .42); }
/* 閉じた窓は必ず消す。
   窓そのものに display を書くと（.onboard の display:grid など）、閉じても
   居座る。閉じている間はここで確実に伏せる（:not([open]) は class より強い） */
dialog:not([open]) { display: none; }
/* 使い方の案内から開く窓は、重ねない窓（show）で出す。重ねると画面の他が
   触れなくなり、案内の吹き出しまで押せなくなるため。
   ただし既定のままだと文書の流れに置かれて画面が下へ送られるので、
   居場所は重ねた時と同じ「画面の真ん中」にそろえる */
/* 使い方の案内が出ている間だけ使う「重ねない窓」。
   重ねる窓（showModal）は画面の他をすべて触れなくするので、案内の吹き出しまで
   押せなくなる。代わりに重ねない窓（show）で出すが、そちらは画面の天井
   （top layer）へ上がらないため、左右の面の後ろへ回り込んで右側が切れていた。
   位置と重なりの順をここで与える。付け外しは showDialog が行う */
dialog.over[open] {
  position: fixed; inset: 0; margin: auto;
  z-index: 110;           /* 面(3)・見出し帯(20) より手前、案内の吹き出し(120) より後ろ */
}
dialog h2 { font-size: 19px; font-weight: 600; letter-spacing: .01em; margin-bottom: 6px; }
dialog h3 { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 14px 0 7px; }
dialog > .hint { margin-bottom: 14px; }
dialog > .row { margin-top: 12px; }
dialog .check { align-items: baseline; }
.dialog-list {
  max-height: 280px; overflow: auto;
  border-radius: var(--r-m);
  background: var(--fill-1);
  padding: 8px 12px;
}
.dialog-list > * { padding: 7px 0; border-bottom: 1px solid var(--line); }
.dialog-list > *:last-child { border-bottom: 0; }
.common-edit { max-height: 300px; overflow: auto; margin-bottom: 6px; padding: 4px 2px; }
.common-edit li {
  display: grid; grid-template-columns: 26px 28px minmax(0, 1fr) auto auto;
  gap: 10px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.common-edit li.hint { display: block; }
.common-edit li:last-child { border-bottom: 0; }
.common-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 24px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--c, var(--ink-3)) 26%, #fff);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.common-color {
  width: 28px; height: 26px; padding: 0;
  border: 0; border-radius: 7px;
  background: none; box-shadow: inset 0 0 0 1.5px var(--line-strong); cursor: pointer;
}
.common-color::-webkit-color-swatch-wrapper { padding: 3px; }
.common-color::-webkit-color-swatch { border: 0; border-radius: 4px; }
.common-body { display: grid; gap: 5px; min-width: 0; }
.common-body input { width: 100%; }
.common-body input:last-child { font-size: 12px; color: var(--ink-2); }

/* ------------------------------------------------- はじめての案内（写真つき） */

/* 実際の画面を撮った写真で、何をする道具なのかを先に見せる。
   絵は上、言葉は下。読む順が上から下で一本に通る */
.onboard {
  width: min(760px, calc(100vw - 32px));
  padding: 0; overflow: hidden;
  display: grid; gap: 0;
}
.onboard-count { padding: 16px 20px 0; font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.onboard-shot { margin: 12px 20px 0; border-radius: var(--r-m); overflow: hidden;
  background: var(--ground); box-shadow: var(--edge); }
.onboard-shot img { display: block; width: 100%; height: auto; }
.onboard-body { padding: 16px 20px 4px; display: grid; gap: 7px; }
.onboard-body h2 { font-size: 18px; font-weight: 600; }
.onboard-body p { font-size: 13px; line-height: 1.85; color: var(--ink-2); }
.onboard-body p + p { margin-top: 4px; }
.onboard-foot { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 20px 18px; }
.onboard-dots { display: inline-flex; gap: 6px; }
.onboard-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--fill-3); }
.onboard-dots i[data-on="true"] { background: var(--accent); }

@media (max-width: 700px) {
  .onboard-shot { margin: 10px 12px 0; }
  .onboard-body { padding: 12px 14px 2px; }
  .onboard-foot { padding: 12px 14px 14px; }
}

/* --------------------------------------------------------- 使い方の案内 */

/* 画面の上に重ねるが、**操作は妨げない**。触りたければそのまま触れる。
   暗くするのは案内の相手を見つけやすくするためで、閉じ込めるためではない */
#tour { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
/* 指す相手を丸く抜く。抜き方は「外側へ広がる影」で作る（重ねる板を増やさない） */
.tour-hole {
  position: fixed; border-radius: var(--r-m);
  box-shadow: 0 0 0 9999px rgba(36, 42, 54, .5), inset 0 0 0 2px var(--accent);
  transition: left .22s var(--ease), top .22s var(--ease),
              width .22s var(--ease), height .22s var(--ease);
}
/* 指す相手がまだ無い段では、画面全体を静かに沈める */
.tour-veil { position: fixed; inset: 0; background: rgba(36, 42, 54, .5); }

.tour-card {
  position: fixed; z-index: 1; pointer-events: auto;
  width: min(352px, calc(100vw - 24px));
  padding: 16px 18px 14px;
  border-radius: var(--r-m);
  background: var(--surface);
  box-shadow: var(--lift-3);
  display: grid; gap: 7px;
}
.tour-count { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.tour-card h2 { font-size: 15px; font-weight: 600; }
.tour-body { display: grid; gap: 6px; font-size: 12.5px; line-height: 1.85; color: var(--ink-2); }
.tour-body b { color: var(--ink); font-weight: 600; }
/* 「やってみる」の一行だけは、読む物ではなく**指図**なので色で立てる。
   できたら緑に変わる。案内を勝手に先へ進めず、できたことだけを伝える */
.tour-try { font-size: 12.5px; font-weight: 600; color: var(--accent); line-height: 1.7; }
.tour-try[data-done="true"] { color: var(--ok); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 5px; }
.tour-nav { display: flex; gap: 6px; }

@media (prefers-reduced-motion: reduce) { .tour-hole { transition: none; } }

/* ----------------------------------------------------------- 案件の窓 */

.proj-dialog { width: min(620px, calc(100vw - 40px)); }
/* 名前と型は、その案件の持ち物どうしなので横に並べる。
   型を選ぶのに別の窓を開かずに済む（以前は「型を変える」窓へ飛んでいた） */
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 15em); gap: 12px; }
.field-row .field { min-width: 0; }
/* 上（この案件のこと）と下（ほかの案件を探す）は別の話なので、線で分ける */
.rule { height: 1px; margin: 18px 0 14px; border: 0; background: var(--separator); }
.find-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 10px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.proj-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.proj-table th, .proj-table td { padding: 7px 8px; text-align: left; white-space: nowrap; }
.proj-table th { font-weight: 600; color: var(--ink-3); font-size: 11.5px; }
.proj-table tbody tr + tr td { border-top: 1px solid var(--separator); }
.proj-table td.num, .proj-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.proj-table td.name { white-space: normal; width: 100%; }
.proj-table tr[data-here="true"] { background: var(--accent-tint); }
.proj-open {
  padding: 2px 0; border: 0; background: none;
  color: var(--accent); font: inherit; text-align: left; cursor: pointer;
}
.proj-open:hover { text-decoration: underline; }
.proj-open:disabled { color: var(--ink); font-weight: 600; cursor: default; text-decoration: none; }
/* 5件ずつしか出さないので、丈は決め打ちしない（送りの位置が動くと押し間違える） */
.proj-dialog .table-wrap { overflow-x: auto; }

/* ------------------------------------------------------- 消す前の確かめ */

.confirm-dialog { width: min(460px, calc(100vw - 40px)); }
.confirm-lead { font-size: 13px; line-height: 1.75; color: var(--ink-2); }
.confirm-lead b { color: var(--ink); font-weight: 600; }
/* 何が一緒に消えるかは、文に混ぜず並べる。数と名前が目に入るようにする */
.confirm-lost { display: grid; gap: 5px; margin: 10px 0 0; padding: 10px 14px;
  border-radius: var(--r-m); background: var(--fill-1); list-style: none; }
.confirm-lost li { font-size: 12.5px; color: var(--ink-2); }
/* 選ばせる物があるとき。進めるかどうかと、どちらでやるかを同じ窓で決める */
.confirm-pick { display: grid; gap: 8px; margin-top: 12px; }
.confirm-pick label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; align-items: start; cursor: pointer; }
.confirm-pick input { margin: 3px 0 0; }
.confirm-pick b { font-size: 12.5px; font-weight: 600; display: block; }
.confirm-pick .pick-note { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.7; }
.confirm-final { margin-top: 12px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.btn.danger.strong { background: var(--danger); color: #fff; }
.btn.danger.strong:hover { background: color-mix(in srgb, var(--danger) 86%, #000); }

/* ------------------------------------------------ 写真からの指示の下書き */

.draft-dialog { width: min(620px, calc(100vw - 40px)); }
.draft-lead { font-size: 13px; line-height: 1.75; color: var(--ink-2); margin-bottom: 12px; }
.draft-lead b { color: var(--ink); font-weight: 600; }

/* 断り書きは読ませたい本文なので、注意喚起の色や縁では飾らない。
   中黒の箇条書きにして、字そのものを読んでもらう */
.draft-caveats { display: grid; gap: 7px; margin-bottom: 4px; list-style: none; }
.draft-caveats li {
  position: relative; padding-left: 15px;
  font-size: 12.5px; line-height: 1.7; color: var(--ink-2);
}
.draft-caveats li::before {
  content: ""; position: absolute; left: 3px; top: .72em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3);
}

.draft-list { max-height: 330px; overflow: auto; margin: 2px 0 2px; list-style: none; padding: 0; }
.draft-item {
  display: grid; grid-template-columns: auto 10px minmax(0, 1fr) auto;
  gap: 10px; align-items: baseline;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.draft-item:last-child { border-bottom: 0; }
.draft-item input { margin: 0; align-self: center; }
.draft-swatch { width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.draft-body { display: grid; gap: 3px; min-width: 0; }
.draft-name { font-size: 13px; font-weight: 600; }
.draft-why { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.draft-where { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; align-self: center; }
.draft-item[data-placed="false"] .draft-where { color: var(--warn); }

/* 読んでいる間の棒。終わりの時刻が読めないので、行ったり来たりさせる */
.bar > .indet {
  display: block; height: 100%; width: 38%;
  border-radius: 999px; background: var(--accent);
  animation: draft-slide 1.15s var(--ease) infinite alternate;
}
@keyframes draft-slide { from { transform: translateX(-30%); } to { transform: translateX(200%); } }
@media (prefers-reduced-motion: reduce) {
  .bar > .indet { animation: none; width: 100%; opacity: .5; }
}

/* 知らせは1行。丸ピルが2行になると、ただの箱に見えて目に入らなくなる */
.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 100;
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.err { color: var(--danger); font-weight: 600; }

/* ------------------------------------------ 写真の上で「ここに指示する」 */

.pick {
  position: absolute; z-index: 30;
  width: 278px;
  padding: 12px;
  border-radius: var(--r-m);
}
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.pick-shape { font-size: 12px; font-weight: 600; }
.pick-x {
  width: 24px; height: 24px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-3);
  cursor: pointer; font-size: 14px; line-height: 1;
}
.pick-x:hover { background: var(--accent-8); color: var(--ink); }
.pick-why { font-size: 11px; color: var(--ink-3); margin-bottom: 8px; }
#pickFilter { margin-bottom: 6px; font-size: 12px; }
.pick-items {
  display: grid; gap: 2px;
  max-height: 300px; overflow-y: auto;
  overscroll-behavior: contain;      /* 端まで送っても写真へ流さない */
}
.pick-group {
  padding: 9px 10px 3px;
  font-size: 10.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em;
}
.pick-group:first-child { padding-top: 2px; }
.pick-free { display: flex; gap: 7px; margin-top: 10px; }
.pick-free input { flex: 1; min-width: 0; font-size: 12px; }

/* ------------------------------------------------ この指示で上がる見本 */

.try { display: grid; gap: 7px; margin: 8px 0 12px; }
.try-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.try-head span { font-size: 11px; }
.try-view {
  position: relative; overflow: hidden;
  border-radius: var(--r-s);
  aspect-ratio: 1;
}
.try-view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.try-clip { position: absolute; inset: 0; }
.try-handle {
  position: absolute; top: 0; bottom: 0; width: 36px; margin-left: -18px;
  background-image: linear-gradient(var(--before) 0 50%, var(--after) 0 100%);
  background-size: 2px 100%; background-position: center top; background-repeat: no-repeat;
  cursor: ew-resize; touch-action: none;
}
.try-handle::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 22px; height: 22px; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--ground); box-shadow: 0 2px 6px rgba(88, 100, 124, .5);
}
.try-tag {
  position: absolute; top: 8px; z-index: 2;
  padding: 2px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  font-size: 10.5px; font-weight: 600;
}
.try-tag.left { left: 8px; color: var(--before); }
.try-tag.right { right: 8px; color: var(--after); }

/* ---------------------------------------------------------- 案件の型を選ぶ */

/* ------------------------------------------------------------ 案件を作る頁

   絵は置かない。ここで要るのは「案件名」と「どの手法で始めるか」の二つだけで、
   その二つを大きさと空きの差だけで順に読ませる。字が主で、面は従。 */

.start {
  position: fixed; inset: 0; z-index: 100;
  overflow: auto;
  background: var(--ground);
}
.start-sheet {
  width: min(620px, calc(100vw - 40px));
  margin: 0 auto;
  padding: clamp(36px, 8vh, 88px) 0 72px;
}
.start-brand { margin-bottom: clamp(22px, 5vh, 46px); }
/* 見出し帯では幅が惜しくて名前を伏せているが、この頁は一枚まるごと空いている */
.start-brand .brand-name { display: inline; }
.start-title { font-size: 25px; font-weight: 600; letter-spacing: .01em; line-height: 1.45; }
.start-lead { margin-top: 9px; font-size: 13px; line-height: 1.85; color: var(--ink-2); }

.start-field { display: block; margin-top: clamp(26px, 4vh, 38px); font-size: 11.5px; color: var(--ink-3); }
.start-name { width: 100%; margin-top: 6px; padding: 11px 13px; font-size: 15px; }

.start-sub { margin-top: clamp(30px, 5vh, 44px); font-size: 13.5px; font-weight: 600; }
.start-note { margin-top: 5px; font-size: 11.5px; line-height: 1.75; color: var(--ink-3); }

/* 束ねた面の中に枠を描くと、面の側の丸めと切り抜きに枠の角と底が食われる。
   一段ずつ独立した面にして、枠はその面の縁にぴったり回す（どこも欠けない） */
.start-list { display: grid; gap: 8px; margin-top: 14px; }
.start-opt {
  display: grid; gap: 4px;
  width: 100%; padding: 15px 17px;
  border: 0; border-radius: var(--r-m);
  background: var(--card); box-shadow: var(--lift-1);
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  transition: background-color .18s var(--ease), box-shadow .18s var(--ease);
}
.start-opt:hover { background: var(--fill-1); }
/* 選んだ一段は、四辺に回した枠と薄い塗りで示す（片側だけ色を引かない） */
.start-opt[aria-checked="true"] {
  background: var(--accent-tint);
  box-shadow: var(--lift-1), inset 0 0 0 2px var(--accent);
}
.start-opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.start-opt-name { font-size: 14px; font-weight: 600; }
.start-opt-count { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.start-opt-lead { font-size: 12.5px; line-height: 1.7; color: var(--ink-2); }
.start-opt-ex { font-size: 11.5px; line-height: 1.7; color: var(--ink-3); }

.start-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: clamp(24px, 4vh, 34px);
}
/* まだ案件が無い人は、ここが画面の全部。練習への入口（その他の引き出し）が
   この頁の後ろに隠れてしまうので、左端に出しておく */
#startPractice { margin-right: auto; }

/* -------------------------------------------------------------- キーの一覧 */

.keys-dialog { width: min(500px, calc(100vw - 40px)); }
.keys { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; margin: 6px 0 18px; }
.keys dt { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.keys dd { margin: 0; font-size: 12.5px; color: var(--ink-2); align-self: center; }
.keys .or { font-size: 11px; color: var(--ink-3); }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 3px 7px;
  border: 0;
  border-radius: 6px;
  background: var(--fill-3);
  color: var(--ink);
  font: 500 11.5px/1.4 var(--mono);
  text-align: center;
}

/* --------------------------------------------------- 立ち上がりの待ち時間 */

#stageBoot { display: none; }
#app:is([data-boot="true"], [data-boot="error"]) #stageBoot { display: grid; }
#app:is([data-boot="true"], [data-boot="error"]) :is(#stageEmpty, .rail-foot, .panel) {
  visibility: hidden;
}
#app[data-boot="true"] #bootTitle::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse .8s infinite alternate;
  vertical-align: middle;
}
#app[data-boot="error"] #bootTitle { color: var(--danger); }

/* -------------------------------------------------------------- 幅が狭い時 */

@media (max-width: 1180px) {
  #app { --rail-w: 178px; --panel-w: 322px; --gap: 10px; }
  /* 寸法より、どのカットを見ているかの方が先に要る */
  #hudSize, #cmpMeta { display: none; }
  /* 帯が詰まってくる。練習モードは「練習を終える」だけ残せば伝わる */
  .practice-note { display: none; }
  .tool-btn { padding: 6px 10px; }
  .tool-sep { margin: 0 2px; }
}
@media (max-width: 980px) {
  #app { --rail-w: 84px; --panel-w: 296px; }
  .rail-head h2, .cut-text, .rail-state, .rail-sect h3, #cmpName, #cmpMeta { display: none; }
  /* 84pxの帯では、この文は一文字ずつ縦に割れる。同じことは写真の場所にも
     出ているので、細い帯では出さない */
  .cut-list > .hint { display: none; }
  /* 帯が細いので、見比べ方は縦に積む */
  .rail-sect { padding: 10px 7px; justify-items: center; }
  .rail-sect .seg { flex-direction: column; }
  .rail-sect .seg { width: 100%; }
  .rail-sect .seg-btn { flex: 0 0 auto; width: 100%; padding: 6px 2px; }
  .rail-head { justify-content: center; padding: 12px 6px 8px; }
  .cut-list { padding: 0 6px 4px; }
  .cut { grid-template-columns: 1fr; justify-items: center; padding: 5px; }
  /* 幅84pxの帯に収める。これより大きいと札が面の外へはみ出す */
  .cut img { width: 52px; height: 66px; }
  .rail-foot { padding: 8px 6px 10px; }
  .rail-foot .btn { padding: 8px 6px; font-size: 11px; }
  .steps .step { padding: 6px 9px; }
  .practice-tag { display: none; }
  .practice { padding: 5px 6px; background: none; }
  .brand-name { display: none; }
}

/* 手のひらの幅では、指示は出せない。届いた納品物を交互で見るだけの画面にする。
   JS 側の narrow も同じ 700px で切り替える（app.js の NARROW）*/
@media (max-width: 700px) {
  #app {
    --rail-w: 0px;                  /* 一覧は場所を取らず、写真の上へ出し入れする */
    --panel-w: 0px;
    --head-h: 46px;
    --gap: 8px;
  }
  .panel, .steps, #moreMenu, #ctaBtn, #galleryBtn, .rail-foot, #railCompare,
  #compareTools, .rail-head h2, .rail-state { display: none !important; }
  #emptyAddBtn { display: none; }
  .head { gap: 10px; padding: 0 12px; }
  .proj { max-width: none; flex: 1 1 auto; }
  .compare-tag { font-size: 11px; }

  /* カット一覧は引き出し。写真は組み直さず、その上へ滑り込ませる。
     段組みの中で absolute にすると「行の中の位置」になり、
     見出し帯のぶんが二重に空く。窓を基準に置く */
  .rail {
    position: fixed;
    left: var(--gap); top: var(--in-t); bottom: var(--gap);
    width: 92px;
    z-index: 15;
    transition: transform .26s var(--ease), opacity .2s var(--ease);
  }
  #app[data-rail="closed"] .rail {
    display: flex;                  /* 消さずに外へ滑らせる */
    transform: translateX(calc(-100% - var(--gap) - 6px));
    opacity: 0;
    pointer-events: none;
  }
  /* 中身が全部隠れる見出しの段は、空の余白として残さない */
  .rail-head { display: none; }
  .cut-list { padding-top: 10px; }
  .cut img { width: 60px; height: 76px; }
}
@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  .rail { transition: none; }
}
