/* 九宫旅馆谋杀夜 —— 雪夜暗色底 + 暖纸色棋盘 */

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --ink: #1e1b17;
  --paper: #efe7d6;
  --night: #181c24;
  --night2: #232936;
  --gold: #c9a227;
  --blood: #a33327;
  --line: #3a2f24;
}
html, body { height: 100%; }
body {
  --bg-hi: #2c3446;
  --bg-lo: #181c24;
  background: radial-gradient(1200px 700px at 70% -10%, var(--bg-hi), var(--bg-lo));
  color: var(--paper);
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  overflow: hidden;
}
/* 时刻氛围底色：随章节推进，黄昏 → 深夜 → 案发 → 黎明前 */
body[data-ch="ch0"] { --bg-hi: #5a4048; --bg-lo: #241d26; } /* 18:00 黄昏暖紫 */
body[data-ch="ch1"] { --bg-hi: #3a4562; --bg-lo: #1b202c; } /* 20:00 入夜 */
body[data-ch="ch2"] { --bg-hi: #2c3446; --bg-lo: #181c24; } /* 21:00 夜 */
body[data-ch="ch3"] { --bg-hi: #2b2a48; --bg-lo: #141522; } /* 22:00 深夜偏紫 */
body[data-ch="ch4"] { --bg-hi: #38222b; --bg-lo: #120f16; } /* 23:00 案发暗红 */
body[data-ch="ch5"] { --bg-hi: #1e2a3a; --bg-lo: #0d1219; } /* 00:00 零点冷蓝 */
body[data-ch="ch6"] { --bg-hi: #1f3a3e; --bg-lo: #0f1a1c; } /* 01:00 黎明前青 */
.hidden { display: none !important; }
.screen { height: 100vh; display: flex; flex-direction: column; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 标题屏 ---------- */
#screen-title { align-items: center; justify-content: center; }
.title-box { text-align: center; }
.title-moon { font-size: 56px; filter: drop-shadow(0 0 24px rgba(201,162,39,.5)); }
#t-title { font-size: 56px; letter-spacing: .18em; margin: 18px 0 8px; color: var(--paper); text-shadow: 0 2px 0 #000; }
#t-sub { color: #9aa3b5; letter-spacing: .35em; margin-bottom: 42px; }
.title-box nav { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.menu-btn {
  min-width: 220px; padding: 12px 28px; font-size: 17px; letter-spacing: .2em;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  border-radius: 4px; box-shadow: 0 3px 0 var(--ink);
}
.menu-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); }
.menu-btn.ghost-btn { background: transparent; color: var(--paper); border-color: #5a6376; box-shadow: 0 3px 0 #10131a; }
/* 亮色弹窗内的次级按钮改用墨色 */
.modal .menu-btn.ghost-btn { color: var(--ink); border-color: #8a7a5a; box-shadow: 0 3px 0 #b3a482; }

/* ---------- 顶栏 ---------- */
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 22px; background: rgba(0,0,0,.35); border-bottom: 1px solid #39415a;
  flex: 0 0 auto;
}
#tb-chapter { font-size: 18px; letter-spacing: .1em; }
#tb-chapter .tb-time { color: var(--gold); margin-left: 10px; font-size: 22px; }
.tb-right { display: flex; align-items: center; gap: 16px; }
.tb-btn { background: none; border: none; font-size: 20px; line-height: 1; opacity: .8; filter: grayscale(.2); transition: opacity .15s; }
.tb-btn:hover { opacity: 1; }
#tb-energy { display: flex; align-items: center; gap: 3px; font-size: 14px; color: #9aa3b5; }
#tb-energy i { font-style: normal; color: var(--blood); font-size: 20px; }
#tb-energy i.off { color: #4a5164; }
#tb-energy span { margin-right: 8px; letter-spacing: .2em; }

/* ---------- 主布局 ---------- */
#layout { flex: 1 1 auto; display: flex; min-height: 0; }
#suspects {
  flex: 0 0 280px; overflow-y: auto; padding: 12px;
  background: rgba(0,0,0,.25); border-right: 1px solid #39415a;
}
#center { flex: 1 1 auto; position: relative; display: flex; flex-direction: column; min-width: 0; }
#toolbar {
  flex: 0 0 130px; display: flex; flex-direction: column; gap: 8px; padding: 14px 10px;
  background: rgba(0,0,0,.25); border-left: 1px solid #39415a;
}
#toolbar button {
  padding: 10px 6px; background: var(--night2); color: var(--paper);
  border: 1px solid #4a5164; border-radius: 6px; font-size: 14px; letter-spacing: .12em;
}
#toolbar button:hover { border-color: var(--gold); }
#toolbar button.active { background: var(--gold); color: var(--ink); font-weight: bold; }
#toolbar button.primary { background: var(--blood); border-color: #6e2018; font-weight: bold; margin-top: auto; }
#toolbar button.primary:disabled { opacity: .45; cursor: not-allowed; }
#toolbar hr { border: none; border-top: 1px solid #39415a; margin: 4px 0; }

/* ---------- 人物证词卡 ---------- */
.panel-head { margin-bottom: 10px; color: #9aa3b5; }
.panel-head b { display: block; letter-spacing: .2em; color: var(--paper); }
.panel-head small { font-size: 11px; line-height: 1.5; display: block; margin-top: 4px; }
.suspect-card {
  background: var(--night2); border: 1px solid #4a5164; border-radius: 8px;
  padding: 10px; margin-bottom: 10px; cursor: pointer; transition: transform .1s;
}
.suspect-card:hover { border-color: var(--gold); }
.suspect-card.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); transform: translateX(4px); }
.suspect-card.placed { opacity: .55; }
.suspect-card.fixed { cursor: default; opacity: .8; }
.sc-top { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.sc-token { position: relative; width: 42px; height: 42px; flex: 0 0 42px; }
/* 头像图叠层：铺满棋子容器、圆形裁剪、描边取人物主色（缺图时 img 已自删，露出下层剪影） */
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 2px solid; box-sizing: border-box; pointer-events: none; }
.sc-name { font-size: 17px; font-weight: bold; letter-spacing: .1em; }
.sc-name small { display: block; font-weight: normal; font-size: 11px; color: #9aa3b5; letter-spacing: .05em; }
.tst { font-size: 13px; line-height: 1.6; color: #cfd6e4; padding: 5px 8px; border-left: 3px solid #4a5164; margin-top: 5px; background: rgba(0,0,0,.2); border-radius: 0 4px 4px 0; }
.tst.note { border-left-color: var(--gold); color: #d9cfae; font-style: italic; }

/* ---------- 棋盘 ---------- */
#board-wrap { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 6px; min-height: 0; }
#board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  width: min(94vmin, 100%); aspect-ratio: 1;
  border: 6px solid #5a4632; border-radius: 5px;
  background-color: #ece2cf;
  /* 羊皮纸底：顶部暖光 + 极淡纤维纹 + 可选纹理图（board_paper.webp 存在则铺底；缺图则仅剩渐变，无碍） */
  background-image:
    radial-gradient(140% 100% at 50% -15%, rgba(255,251,242,.5), rgba(120,92,56,0) 55%),
    repeating-linear-gradient(0deg, rgba(120,95,60,.03) 0 3px, transparent 3px 6px),
    repeating-linear-gradient(90deg, rgba(120,95,60,.024) 0 3px, transparent 3px 6px),
    url('../assets/art/board_paper.webp');
  background-size: auto, auto, auto, cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow:
    0 0 0 2px rgba(203,180,136,.55),          /* 外圈浅描金 */
    inset 0 0 0 1px rgba(255,250,240,.35),     /* 内圈高光 */
    0 24px 60px rgba(0,0,0,.62);               /* 落在场景上的投影 */
}
/* 做旧暗角 + 纤维叠层：只压暗四周、中心透亮，不影响解题可读性 */
#board::after {
  content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: 3px;
  background:
    radial-gradient(118% 118% at 50% 46%, rgba(0,0,0,0) 60%, rgba(58,40,22,.30) 100%),
    repeating-linear-gradient(0deg, rgba(120,95,60,.025) 0 3px, transparent 3px 6px);
}
/* 逐房间小图拼接：每间独立加载，只隐藏加载成功那间的色块/家具图标（见 board.js composeRoomTiles） */
.room-tile {
  position: absolute; z-index: 0; pointer-events: none;
  background-size: 100% 100%; background-repeat: no-repeat;
  box-shadow: inset 0 0 0 3px rgba(90,70,45,.35); /* 房间小图之间的接缝线，掩盖裁切边缘不完全对齐 */
}
/* 房间内部仍是 2×2/3×3 可放置格子——保留细网格线标出内部格界；只在真正的房间外墙那一侧
   （.bt/.bb/.bl/.br，已画进插画里）单独清零那一条边，其余边保留可见网格线 */
.cell.room-has-art { background: none !important; border-color: rgba(255,244,224,.55) !important; }
.cell.room-has-art.bt { border-top-width: 0; }
.cell.room-has-art.bb { border-bottom-width: 0; }
.cell.room-has-art.bl { border-left-width: 0; }
.cell.room-has-art.br { border-right-width: 0; }
.cell.room-has-art .furn { display: none; }
#board:has(.room-tile)::after { opacity: .5; } /* 做旧暗角在插画上柔化，避免过暗盖掉细节 */

/* 方位标注（北在上） */
.compass {
  position: absolute; z-index: 3; pointer-events: none;
  font-size: 12px; color: var(--gold); letter-spacing: .1em;
  background: rgba(14,16,22,.85); border: 1px solid var(--line);
  padding: 1px 7px; border-radius: 10px;
}
.compass-n { top: 0; left: 50%; transform: translate(-50%, -50%); }
.compass-s { bottom: 0; left: 50%; transform: translate(-50%, 50%); }
.compass-w { left: 0; top: 50%; transform: translate(-50%, -50%); }
.compass-e { right: 0; top: 50%; transform: translate(50%, -50%); }
/* 证词参照物高亮：金=证词引用的房间/家具/行列；红=证词否定的区域 */
.cell.hl { box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 16px rgba(201,162,39,.35); }
.cell.hl-not { box-shadow: inset 0 0 0 3px var(--blood); opacity: .8; }
#board.locked { pointer-events: none; filter: brightness(.82); }
.cell { position: relative; border: 1px solid rgba(58,47,36,.35); user-select: none; touch-action: pinch-zoom; }
/* 房间边界：加粗成温馨木墙/隔断（每个房间像被墙围起来的独立空间） */
.cell.bt { border-top: 7px solid #9a7b4f; box-shadow: inset 0 3px 0 rgba(255,244,225,.35), inset 0 -1px 0 rgba(58,40,22,.4); }
.cell.bb { border-bottom: 7px solid #9a7b4f; }
.cell.bl { border-left: 7px solid #9a7b4f; }
.cell.br { border-right: 7px solid #9a7b4f; }
/* 房间底色：软化为低饱和羊皮纸调，仍可区分（inRoom 还有房间名标签与加粗边界佐证） */
.room-foyer  { background: rgba(232,222,208,.55); }
.room-lobby  { background: rgba(233,220,207,.55); }
.room-study  { background: rgba(224,211,186,.60); }
.room-dining { background: rgba(232,221,196,.55); }
.room-hall   { background: rgba(226,218,205,.48); }
.room-kitchen{ background: rgba(224,228,214,.55); }
.room-guest  { background: rgba(226,218,224,.55); }
.room-green  { background: rgba(213,224,201,.60); }
.room-store  { background: rgba(221,212,193,.55); }
/* 地面纹理：温馨手绘地板贴图（缺图回退房间底色）。board.js 按格设 background-position 打散重复 */
.floor-wood   { background-image: url('../assets/art/floor_wood.webp'); }
.floor-tile   { background-image: url('../assets/art/floor_tile.webp'); }
.floor-carpet { background-image: url('../assets/art/floor_carpet.webp'); }
.floor-grass  { background-image: url('../assets/art/floor_grass.webp'); }
.cell[class*="floor-"] { background-size: 200%; }

.furn { position: absolute; inset: 7%; opacity: .94; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(90,70,45,.28)); }
/* 家具图片叠层：铺满家具位、等比不裁切（缺图时 img 已自删，露出下层 SVG） */
.furn-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cell.blocked { cursor: not-allowed; }
.room-label {
  position: absolute; right: 4px; bottom: 2px; font-size: clamp(10px, 1.6vmin, 15px);
  color: rgba(30,27,23,.55); letter-spacing: .1em; pointer-events: none; font-weight: bold;
}
.ghost { position: absolute; left: 4%; top: 4%; width: 30%; height: 30%; opacity: .35; pointer-events: none; }
.notes { position: absolute; left: 5%; bottom: 5%; display: flex; flex-wrap: wrap; gap: 2px; pointer-events: none; max-width: 90%; }
.notes i {
  font-style: normal; width: 16px; height: 16px; border-radius: 50%;
  font-size: 10px; line-height: 16px; text-align: center; color: #fff; font-weight: bold;
  border: 1px solid rgba(0,0,0,.4);
}
.cell .xmark { display: none; position: absolute; inset: 0; font-size: 34px; color: rgba(163,51,39,.75); text-align: center; align-content: center; pointer-events: none; font-weight: bold; }
.cell.xed .xmark { display: grid; place-items: center; }
.token { position: absolute; inset: 12%; pointer-events: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
.token svg { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.6); } to { transform: scale(1); } }
.cell.conflict { outline: 3px solid var(--blood); outline-offset: -3px; }
/* 行/列占用记号：贴在棋盘外缘，空心=该行列还没人，金实心=就位，红=同行列撞人 */
.rank-mark {
  position: absolute; width: 13px; height: 13px; border-radius: 50%;
  box-sizing: border-box; border: 2px solid rgba(201,162,39,.55);
  background: transparent; pointer-events: none; z-index: 3;
  transform: translate(-50%, -50%); transition: background .15s, border-color .15s;
}
.row-mark { left: 0; }   /* top 由内联样式按行定位，居中在左边框上 */
.col-mark { top: 0; }    /* left 由内联样式按列定位，居中在上边框上 */
.rank-mark.filled { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px rgba(201,162,39,.6); }
.rank-mark.conflict { background: var(--blood); border-color: var(--blood); box-shadow: 0 0 6px rgba(163,51,39,.7); }
/* 拖拽 */
.drag-ghost {
  position: fixed; width: 64px; height: 64px; z-index: 100;
  transform: translate(-50%, -50%) scale(1.05); pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.5));
}
body.dragging { cursor: grabbing; user-select: none; }
body.dragging .suspect-card { cursor: grabbing; }
/* pan-x：触屏上横向滑动交给浏览器（滚动人物栏），其余方向进入拖拽 */
.suspect-card { cursor: grab; touch-action: pan-x; }
.cell.drop-ok { outline: 3px dashed #2e6b30; outline-offset: -3px; background-image: none; }
.cell.drop-ok::after { content: ''; position: absolute; inset: 0; background: rgba(46,107,48,.15); }
.cell.drop-bad { outline: 3px dashed var(--blood); outline-offset: -3px; }
.cell.wrong { animation: shake .5s; }
.cell.wrong .token { filter: drop-shadow(0 0 8px var(--blood)); }
/* 关键格锁定：就位确认后棋子变暗、带锁标，不可再移动 */
.token.keylock { filter: brightness(.6) saturate(.7) drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
.token.keylock::after { content: '🔒'; position: absolute; right: -4px; bottom: -4px; font-size: 13px; filter: none; }
.suspect-card.keylock { opacity: .55; }
.suspect-card.keylock .sc-token { filter: brightness(.6) saturate(.7); }
@keyframes shake { 20%,60% { transform: translateX(-4px); } 40%,80% { transform: translateX(4px); } }

/* ---------- 剧情插画位 ---------- */
#scene-art {
  position: absolute; left: 0; right: 0; top: 0; bottom: 140px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 12, 17, .55); pointer-events: none; z-index: 5;
}
#scene-art img {
  max-width: 82%; max-height: 92%; border: 4px solid var(--line);
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.7);
  animation: artIn .35s ease-out;
}
@keyframes artIn { from { transform: translateY(14px) scale(.96); opacity: 0; } }
#ov-end-art img { width: 100%; border-radius: 8px; border: 3px solid var(--line); margin-bottom: 14px; }

/* ---------- 每章场景背景层（棋盘后面的氛围底；缺图回退为 body 渐变） ---------- */
#scene-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity .6s ease;
}
#scene-bg.on { opacity: 1; }
/* 压暗层：保证棋盘与文字在场景图上仍清晰 */
#scene-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,12,18,.34), rgba(10,12,18,.64));
}

/* ---------- 落雪氛围层 ---------- */
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
#dialog, #tutor { z-index: 6; }
#topbar, #suspects, #toolbar { position: relative; z-index: 2; }

/* ---------- 标题主视觉（缺图自动降级为月亮） ---------- */
.title-moon.has-art { font-size: 0; line-height: 0; }
.title-moon img {
  width: min(560px, 84vw); aspect-ratio: 16 / 9; object-fit: cover;
  border: 4px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.65);
  animation: artIn .5s ease-out;
}

/* ---------- 漫画页（逐格浮现） ---------- */
#scene-art.comic { pointer-events: auto; cursor: pointer; background: rgba(10, 12, 17, .82); bottom: 0; }
.comic-page { position: relative; }
/* 入场 + 极缓慢的呼吸推移（Ken Burns 感） */
.comic-page { animation: artIn .35s ease-out, pageBreathe 18s ease-in-out 1.2s infinite alternate; }
@keyframes pageBreathe {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.015) translate(-0.3%, 0.25%); }
}
@media (prefers-reduced-motion: reduce) {
  .comic-page { animation: artIn .35s ease-out; }
}
.comic-panel {
  position: absolute; background-repeat: no-repeat;
  border: 3px solid #0c0e13; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
  opacity: 0;
}
/* 斜线分镜格：整页铺满 + clip-path 裁形，边线由画作自带的斜缝呈现 */
.comic-panel.poly { border: none; border-radius: 0; }
/* 入场：浮起→轻微回弹落定，模糊渐清（墨迹聚焦感） */
.comic-panel.on { animation: panelIn .65s cubic-bezier(.22, .8, .3, 1) both; }
@keyframes panelIn {
  0%   { opacity: 0; transform: translateY(22px) scale(.9); filter: blur(10px); }
  55%  { opacity: 1; filter: blur(0); }
  78%  { transform: translateY(-3px) scale(1.008); }
  100% { opacity: 1; transform: none; filter: none; }
}
.comic-next {
  position: absolute; right: 2px; bottom: -24px; font-size: 12px;
  color: var(--gold); animation: blink 1.2s infinite;
}

/* ---------- 对白框 ---------- */
#dialog {
  position: absolute; left: 24px; right: 24px; bottom: 18px;
  background: rgba(14,16,22,.94); border: 1px solid var(--gold); border-radius: 10px;
  padding: 16px 22px 30px; min-height: 108px; cursor: pointer;
  box-shadow: 0 10px 40px rgba(0,0,0,.7);
}
.dlg-name { font-weight: bold; font-size: 16px; letter-spacing: .15em; margin-bottom: 6px; }
.dlg-text { font-size: 16px; line-height: 1.8; }
.dlg-text.narr { color: #b8c0d2; font-style: italic; }
.dlg-text.hint { color: var(--gold); }
.dlg-next { position: absolute; right: 16px; bottom: 8px; font-size: 12px; color: var(--gold); animation: blink 1.2s infinite; }

/* ---------- 章节题卡（漫画式转场） ---------- */
#ch-card {
  position: absolute; inset: 0; z-index: 30; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(ellipse at center, #232838 0%, #10131b 72%);
  opacity: 0; transition: opacity .38s ease;
}
#ch-card.show { opacity: 1; }
.chc-num { font-size: 14px; letter-spacing: .5em; text-indent: .5em; color: var(--gold); }
.chc-title { font-size: 34px; letter-spacing: .3em; text-indent: .3em; color: #efe7d6; font-weight: bold; }
.chc-time { font-size: 17px; letter-spacing: .25em; text-indent: .25em; color: #8fa0c0; }

/* ---------- 教学步骤条（棋盘上方流式贴条，不遮挡棋盘） ---------- */
#tutor {
  order: -1; flex: 0 0 auto; margin: 8px 16px 0; z-index: 4;
  background: rgba(24,20,10,.95); border: 1px solid var(--gold); border-radius: 10px;
  padding: 10px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.5);
  font-size: 14px; line-height: 1.7; color: #e8d9a8;
  animation: artIn .3s ease-out;
}
.tutor-step::before { content: '💡 '; }
.suspect-card.tutor-target { border-color: var(--gold); animation: tutorPulse 1.4s ease-in-out infinite; }
@keyframes tutorPulse {
  50% { box-shadow: 0 0 0 4px rgba(201,162,39,.35); }
}
@keyframes blink { 50% { opacity: .25; } }
.choice-prompt { margin-bottom: 12px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn {
  text-align: left; padding: 10px 16px; font-size: 15px; letter-spacing: .06em;
  background: var(--night2); color: var(--paper); border: 1px solid #5a6376; border-radius: 6px;
}
.choice-btn:hover { border-color: var(--gold); color: var(--gold); }
.sname { font-weight: bold; }

/* ---------- 覆盖层 & 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(8,10,14,.72); z-index: 40;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px);
}
.modal {
  position: relative; background: var(--paper); color: var(--ink);
  border: 3px solid var(--line); border-radius: 10px; padding: 26px 30px;
  max-width: 480px; width: calc(100% - 60px); box-shadow: 0 24px 80px rgba(0,0,0,.8);
  text-align: center;
}
.modal.wide { max-width: 720px; text-align: left; }
.modal h2 { letter-spacing: .12em; margin-bottom: 12px; }
.scrollbody { max-height: 56vh; overflow-y: auto; line-height: 1.9; }
.ov-close { position: absolute; right: 12px; top: 10px; background: none; border: none; font-size: 20px; color: var(--ink); }
.clue-tag {
  display: inline-block; background: var(--blood); color: #fff; font-size: 12px;
  letter-spacing: .3em; padding: 3px 12px; border-radius: 99px; margin-bottom: 10px;
}
.clue-modal p { margin: 10px 0 20px; line-height: 1.9; font-size: 16px; }
.clue-modal { animation: cardIn .3s ease-out; }
@keyframes cardIn { from { transform: translateY(24px) scale(.92); opacity: 0; } }

/* 线索手册 */
.clue-item { border-bottom: 1px dashed #8a7a5a; padding: 10px 2px; }
.clue-item b { letter-spacing: .06em; }
.fs-tag, .hd-tag {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%; text-align: center;
  line-height: 18px; font-size: 12px; color: #fff; margin-right: 6px;
}
.fs-tag { background: var(--blood); }
.hd-tag { background: #5b4a8a; }
.empty { color: #6d6252; }

/* 时间线 */
.tl-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tl-table th, .tl-table td { border: 1px solid #b3a482; padding: 7px 6px; text-align: center; }
.tl-table th { background: rgba(58,47,36,.1); letter-spacing: .1em; }
.tl-name { font-weight: bold; letter-spacing: .1em; }
.tl-table td.dead { color: var(--blood); }
.tl-table td.contradiction { background: rgba(163,51,39,.14); color: var(--blood); font-weight: bold; }
.tl-note { margin-top: 10px; font-size: 12px; color: #6d6252; }

/* 指认 */
.accuse-modal { border-color: var(--blood); }
.accuse-prompt { margin-bottom: 14px; line-height: 1.9; }
.ev-box { background: rgba(58,47,36,.08); border: 1px dashed #8a7a5a; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.ev-box b { letter-spacing: .15em; display: block; margin-bottom: 6px; }
.ev { display: inline-block; margin-right: 18px; font-size: 15px; }
.ev.ok { color: #2e6b30; font-weight: bold; }
.ev.miss { color: #a33327; }
.accuse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.accuse-card {
  padding: 14px 10px; background: #fff8; border: 2px solid var(--line); border-radius: 8px;
  font-size: 16px; transition: all .12s;
}
.accuse-card b { display: block; font-size: 18px; letter-spacing: .1em; }
.accuse-card small { color: #6d6252; }
.accuse-card:hover { background: var(--ink); }
.accuse-card:hover b, .accuse-card:hover small { color: var(--paper) !important; }
.accuse-card.combo { border-color: var(--blood); background: rgba(163,51,39,.08); grid-column: 1 / -1; }

/* 结局 */
.ending-modal { max-width: 640px; }
.ending-modal h2 { font-size: 30px; letter-spacing: .25em; margin: 8px 0 16px; }
#ov-end-text { line-height: 2.05; font-size: 15.5px; text-align: left; white-space: normal; }
.end-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* 图鉴 */
#screen-gallery { align-items: center; justify-content: center; gap: 14px; padding: 30px; }
#g-title { letter-spacing: .2em; }
#g-sub { color: #9aa3b5; letter-spacing: .25em; }
#g-grid { display: grid; grid-template-columns: repeat(3, 200px); gap: 14px; margin: 18px 0; }
.g-card {
  background: var(--night2); border: 1px solid #4a5164; border-radius: 10px;
  padding: 16px; text-align: center; min-height: 120px;
}
.g-card b { color: #5a6376; font-size: 12px; letter-spacing: .2em; }
.g-card h3 { margin: 8px 0 6px; letter-spacing: .15em; }
.g-card small { color: #9aa3b5; font-size: 12px; line-height: 1.6; display: block; }
.g-card.seen { border-color: var(--gold); }
.g-card.seen b { color: var(--gold); }
.g-card.seen h3 { color: var(--gold); }

/* toast / debug */
#toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%) translateY(-16px);
  background: var(--ink); color: var(--paper); padding: 10px 26px; border-radius: 99px;
  border: 1px solid var(--gold); opacity: 0; pointer-events: none; transition: all .25s; z-index: 60;
  letter-spacing: .1em;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { border-color: var(--blood); color: #f0b6a8; }
#debug {
  position: fixed; left: 10px; bottom: 10px; z-index: 70; background: rgba(0,0,0,.8);
  border: 1px solid #5a6376; border-radius: 8px; padding: 10px; font-size: 12px;
  display: flex; flex-direction: column; gap: 6px; color: #9aa3b5;
}
#debug button { padding: 2px 8px; margin: 0 2px; background: var(--night2); color: var(--paper); border: 1px solid #5a6376; border-radius: 4px; font-size: 12px; }
#debug input { width: 110px; background: var(--night2); border: 1px solid #5a6376; color: var(--paper); padding: 2px 6px; border-radius: 4px; }

/* 窄屏兜底 */
@media (max-width: 980px) {
  #suspects { flex-basis: 220px; }
  #toolbar { flex-basis: 100px; }
}

/* ---------- 手机竖屏：堆叠布局 ---------- */
@media (max-width: 760px) {
  .screen { height: 100dvh; }
  #layout { flex-direction: column; }

  /* 人物证词栏：横向滑动条 + 头像优先紧凑卡（默认只头像+名，选中才展开证词） */
  #suspects {
    flex: 0 0 auto; display: flex; flex-direction: row; gap: 8px;
    overflow-x: auto; overflow-y: hidden; padding: 8px;
    border-right: none; border-bottom: 1px solid #39415a;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .panel-head { flex: 0 0 88px; margin-bottom: 0; }
  .panel-head small { font-size: 10px; }
  .suspect-card {
    flex: 0 0 auto; width: 148px; margin-bottom: 0;
    scroll-snap-align: center; transition: transform .1s, width .2s ease;
  }
  .suspect-card .sc-top { margin-bottom: 0; }
  .suspect-card .tst { display: none; }                 /* 折叠：隐藏证词 */
  /* 折叠态给个"点看证词"的提示箭头 */
  .suspect-card:not(.selected):not(.fixed) .sc-name::after {
    content: ' ▾ 证词'; color: var(--gold); font-size: 10px; font-weight: normal; letter-spacing: 0;
  }
  .suspect-card.selected { width: 236px; transform: translateY(2px); }
  .suspect-card.selected .sc-top { margin-bottom: 6px; }
  .suspect-card.selected .tst { display: block; }        /* 选中：展开证词 */
  .sc-token { width: 44px; height: 44px; flex-basis: 44px; }
  .sc-name { font-size: 15px; }
  .tst { font-size: 12px; }

  /* 棋盘区 */
  #board-wrap { padding: 4px; }
  #board { width: min(99vw, 100%); }
  .room-label { font-size: clamp(8px, 2.4vw, 12px); }

  /* 工具栏：底部整齐网格（4 列工具键 + 整行提交键） */
  #toolbar {
    flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    padding: 8px; border-left: none; border-top: 1px solid #39415a;
  }
  #toolbar hr { display: none; }
  #toolbar button { margin: 0; padding: 9px 4px; font-size: 12.5px; letter-spacing: .05em; }
  #toolbar button.primary { grid-column: 1 / -1; margin-top: 2px; padding: 11px; font-size: 14px; }

  /* 顶栏 / 对白 / 插画 */
  #topbar { padding: 6px 10px; }
  #tb-chapter { font-size: 14px; }
  #tb-chapter .tb-time { font-size: 17px; }
  #tb-energy span { display: none; }
  #tb-energy i { font-size: 16px; }
  .tb-right { gap: 10px; }
  .tb-btn { font-size: 18px; }
  #dialog { left: 8px; right: 8px; bottom: 8px; padding: 12px 14px 26px; min-height: 88px; }
  #tutor { margin: 6px 8px 0; padding: 8px 12px; font-size: 13px; }
  .rank-mark { width: 10px; height: 10px; }
  .dlg-text { font-size: 14.5px; }
  .choice-btn { font-size: 14px; padding: 9px 12px; }
  #scene-art { bottom: 118px; }
  #scene-art img { max-width: 94%; }

  /* 弹窗 / 图鉴 / 标题 */
  .modal { padding: 18px 16px; width: calc(100% - 24px); }
  .modal.wide { max-width: none; }
  .scrollbody { max-height: 62vh; }
  .ending-modal h2 { font-size: 22px; letter-spacing: .15em; }
  #ov-end-text { font-size: 14px; line-height: 1.9; }
  .tl-table { font-size: 11px; }
  .tl-table th, .tl-table td { padding: 4px 3px; }
  .accuse-grid { grid-template-columns: repeat(2, 1fr); }
  #g-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); width: 100%; max-width: 420px; }
  #screen-gallery { padding: 16px; overflow-y: auto; justify-content: flex-start; }
  #t-title { font-size: 34px; }
  .menu-btn { min-width: 190px; padding: 10px 20px; font-size: 15px; }
  #debug { font-size: 10px; max-width: 46vw; }
}
