/* 一局的版式：顶栏、今天的条件、现象台（固定 150px）、推理表、底栏。现象动画在 scene.css。 */
.play {
  position: relative; display: flex; flex-direction: column;
  padding: 0 max(4px, env(safe-area-inset-right)) calc(78px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
}
.bar { display: flex; align-items: center; gap: 6px; min-height: 52px; color: var(--paper); }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .07); color: var(--paper); display: grid; place-items: center; flex: none; }
.bar-title { min-width: 0; flex: 1; }
.case-name { font-family: var(--serif); font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { flex: none; text-align: right; line-height: 1.1; padding-left: 2px; }
.spent-line { font-size: 12px; color: #d9d2c2; white-space: nowrap; }
.spent-line .spent { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; color: #f2d48b; vertical-align: -3px; }
.stars-line { font-size: 12px; color: #d9d2c2; display: flex; align-items: center; justify-content: flex-end; gap: 1px; margin-top: 2px; }
/* "≤N 点"在只剩一星时消失：给它留住宽度，顶栏不跳 */
.stars-line .limit { margin-left: 4px; display: inline-block; min-width: 3.3em; text-align: right; }
.story { color: #d9d2c2; font-size: 13px; margin: 0 4px 6px; line-height: 1.45; text-wrap: pretty; }
.conds { display: flex; flex-wrap: wrap; gap: 4px; margin: -2px 4px 6px; }
.cond { font-size: 12px; background: rgba(243, 238, 226, .1); color: #e9e2d1; border-radius: 8px; padding: 2px 8px; }
.cond b { color: #f2d48b; margin-right: 6px; }

/* 现象台：观察窗 96px + 最多两行说明，总高固定 150px，空闲时也一样 */
.stage { height: 150px; background: var(--paper); border-radius: 14px; padding: 6px; border: 1px solid var(--line); display: grid; grid-template-rows: 96px 1fr; gap: 6px; overflow: hidden; }
.window { position: relative; height: 96px; border-radius: 10px; background: radial-gradient(#2a3b35, #15201c 70%); }
.window.unclear { outline: 1.5px dashed #7f796c; outline-offset: 2px; }
.window > .scene { width: 100%; height: 100%; display: block; }
.loupe { position: absolute; right: 12px; top: 12px; width: 64px; height: 64px; animation: loupe .25s ease-out both; }
.loupe .lens { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--brass); overflow: hidden; background: radial-gradient(#2a3b35, #15201c 80%); box-shadow: 0 2px 10px rgba(0, 0, 0, .55); }
.loupe .lens .scene { width: 100%; height: 100%; display: block; }
.loupe .handle { position: absolute; width: 18px; height: 6px; border-radius: 3px; background: var(--brass); left: -10px; bottom: 2px; transform: rotate(-45deg); }
@keyframes loupe { from { transform: scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }
.caption { font-size: 13px; line-height: 18px; max-height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: left; background: none; border: 0; padding: 0 2px; width: 100%; color: var(--ink); }
.caption.idle { color: var(--ink-2); }
.caption .cap-name { margin-right: 6px; }
.caption .tag.unsure { margin-right: 4px; }

/* 做实验时观察窗浮到表格上方放大 */
.float-stage {
  position: fixed; height: 200px; z-index: 30;
  border-radius: 14px; background: radial-gradient(#2a3b35, #15201c 70%); border: 2px solid var(--paper);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .6); padding: 10px 8px 6px; display: grid; grid-template-rows: 1fr auto;
  animation: floatin .2s ease-out both; transform-origin: 50% 20%;
}
.float-stage.unclear { outline: 1.5px dashed #7f796c; outline-offset: 3px; }
.float-stage > .scene { width: 100%; height: 100%; }
.float-cap { color: var(--paper); font-size: 14px; text-align: center; }
.float-stage.out { transition: transform .22s ease-in, opacity .22s ease-in; transform: translateY(-36px) scale(.5); opacity: 0; }
@keyframes floatin { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* 推理表 */
.board { margin-top: 6px; background: var(--paper); border-radius: 14px; border: 1px solid var(--line); padding: 2px; }
.grid { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); gap: 1px; }
.grid > .corner, .grid > .th { position: sticky; top: 0; z-index: 3; }
/* 样品行贴在表头下面：表头的实际高度由 play.js 量出来放进 --th-h */
.grid > .sample-head, .grid > .cell.sample { position: sticky; top: calc(var(--th-h, 72px) + 1px); z-index: 3; box-shadow: 0 1px 0 #f3eee2; }
.corner { font-size: 11px; color: var(--ink-2); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; background: #f3eee2; }
.th {
  min-height: 56px; border: 0; border-radius: 9px; background: var(--bench-2); color: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 3px 0;
  box-shadow: 0 0 0 1px #f3eee2;
}
.th .th-name { font-size: 11px; line-height: 1.15; text-align: center; }
.th .cost { font-size: 12px; font-weight: 700; color: #f2d48b; }
.th.repriced .cost { background: #f2d48b; color: var(--ink); border-radius: 5px; padding: 0 4px; }
.th.done { background: #46574f; }
.th.done .cost { color: #dfeee5; font-weight: 600; background: none; }
/* 用完了的实验：斜纹（第 0 轮评审说"一眼就懂"，保留），"用完了"是实心小签上的墨色字 */
.th.missing { background: repeating-linear-gradient(45deg, #cfc7b4 0 4px, #ddd5c3 4px 8px); color: #4a463e; }
.used-up { font-size: 11px; font-weight: 700; color: var(--ink); background: #f3eee2; border-radius: 5px; padding: 0 4px; }
.rowhead {
  min-height: 44px; border: 0; border-radius: 8px; background: transparent; display: flex; align-items: center; gap: 1px;
  padding: 0 2px 0 4px; text-align: left; font-size: 14px; font-weight: 700; position: relative; line-height: 1.1;
}
.rowhead.mix .sname { font-size: 12px; }
.sample-head { font-family: var(--serif); font-weight: 800; color: var(--brass-ink); background: #f0dfb4; justify-content: center; }
.cell {
  min-height: 44px; border: 1px solid transparent; border-radius: 7px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 0; position: relative;
}
.cell .short { font-size: 12px; line-height: 1.1; color: var(--ink); white-space: nowrap; }
.cell .tilde { font-size: 11px; font-style: normal; }
.cell.plain .short { color: #6b665c; }
.cell.plain .glyph { opacity: .8; }
.cell.inked { background: #fff; border: 1px solid var(--ink); }
.cell.inked .short { font-weight: 700; }
.cell.unclear { border: 1.5px dashed #7f796c; }
.cell.unclear .short { color: var(--unsure-ink); font-weight: 400; }
.cell.unclear .glyph * { fill-opacity: .35; }
.cell.sweep { animation: sweep .32s calc(var(--r, 0) * 36ms) ease-out both; }
@keyframes sweep { 0% { box-shadow: inset 0 0 0 30px rgba(201, 143, 42, .6); } 100% { box-shadow: inset 0 0 0 0 rgba(201, 143, 42, 0); } }
.cell.sample { background: #f6e7c1; }
.cell.sample.empty .qmark { font-family: var(--serif); font-size: 18px; color: #a08648; }
.cell.sample.missing { background: repeating-linear-gradient(45deg, #ece6d8 0 4px, #f4efe4 4px 8px); }
.cell.sample.seen { background: #fff; border: 2px solid var(--ink); }
.cell.sample.seen.unclear { border: 2px dashed #7f796c; }
.cell.sample.just-seen { animation: flashcell .7s ease-out; }
@keyframes flashcell { from { background: #f2d48b; box-shadow: 0 0 0 4px rgba(201, 143, 42, .55); } to { background: #fff; box-shadow: 0 0 0 0 rgba(201, 143, 42, 0); } }
.cell.missing { background: repeating-linear-gradient(45deg, #ece6d8 0 4px, #f4efe4 4px 8px); border: 0; }
.rowhead.suspect .sname { position: relative; }
.rowhead.suspect .haz { position: absolute; top: 2px; right: 1px; }
.rowhead.suspect.crossed .sname { color: #8f8a80; }
.rowhead.suspect.crossed .sname::after {
  content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 2.5px; background: var(--ink); border-radius: 2px; transform-origin: left;
}
.rowhead.suspect.wrong .sname::after { background: #a8371f; }
.rowhead.suspect.strike-now .sname::after { animation: strike .28s ease-out both; }
@keyframes strike { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.rowhead.suspect.crossed, .cell.crossed { opacity: .42; }
.wrong-mark { color: #a8371f; font-weight: 900; margin-left: 1px; }
/* 指错的 ✕ 放在名字格右下角（危险标志在右上角），三个字的名字不会被挤得折行 */
.rowhead.suspect .wrong-mark { position: absolute; right: 2px; bottom: 2px; margin: 0; font-size: 12px; line-height: 1; }
.haz { color: #a8371f; display: inline-flex; }
.grid.accusing .rowhead.suspect.pickable { background: #f6e7c1; box-shadow: inset 0 0 0 2px var(--brass); }
.row-stamp {
  position: absolute; left: 6px; top: 50%; z-index: 5; white-space: nowrap; font-family: var(--serif); font-weight: 900; font-size: 16px;
  color: var(--good); border: 2.5px solid var(--good); border-radius: 5px; padding: 0 6px; background: rgba(255, 255, 255, .9);
  transform: translateY(-50%) rotate(-8deg); animation: rowstamp .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes rowstamp { from { transform: translateY(-50%) rotate(-25deg) scale(2.2); opacity: 0; } to { transform: translateY(-50%) rotate(-8deg) scale(1); opacity: 1; } }
.legend { font-size: 12px; color: var(--ink-2); margin: 4px 4px 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lg { display: inline-block; width: 18px; height: 14px; border-radius: 4px; flex: none; }
.lg.solid { border: 1px solid var(--ink); background: #fff; }
.lg.dashed { border: 1.5px dashed #7f796c; margin-left: 10px; }
.shake { animation: shake .42s; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* 指认提示浮在底栏上方；底栏：笔记 1 份宽、指认 2 份宽 */
.accuse-banner {
  position: fixed; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: calc(80px + env(safe-area-inset-bottom));
  max-width: 464px; margin: 0 auto; z-index: 25; background: var(--brass); color: var(--brass-ink); border-radius: 12px;
  padding: 0 0 0 12px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
}
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; z-index: 20;
  display: grid; grid-template-columns: 1fr 2fr; gap: 8px;
  padding: 10px max(8px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: linear-gradient(rgba(21, 32, 28, 0), var(--bench) 30%);
}
.act {
  min-height: 52px; border-radius: 14px; border: 1.5px solid rgba(243, 238, 226, .3); background: var(--bench-2); color: var(--paper);
  display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700;
}
.act.primary { background: var(--brass); color: var(--brass-ink); border-color: #9c6c16; box-shadow: 0 2px 0 #8a5e12; }
.play.accusing .act.primary { background: #f2d48b; }
.act.pulse { animation: pulse 1.2s ease-out 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(242, 212, 139, .9); } 70% { box-shadow: 0 0 0 14px rgba(242, 212, 139, 0); } 100% { box-shadow: 0 2px 0 #8a5e12; } }
.act b { font-variant-numeric: tabular-nums; }
/* 指认状态时提示条让到横幅上面 */
.play.accusing ~ #toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
.plus { position: fixed; z-index: 70; color: #a8371f; font-weight: 900; font-size: 22px; pointer-events: none; transition: transform .5s ease-in, opacity .5s ease-in; text-shadow: 0 1px 0 #fff; }

@media (max-width: 370px) {
  .grid { grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); }
  .rowhead { font-size: 13px; }
  .th .th-name { font-size: 11px; }
}
