/* 28天最後圍捕 — 黑色電影偵探風
   地圖：深夜雷達螢幕＋霓虹路線；側欄：牛皮紙偵查卷宗＋打字機字體 */
:root {
  --night: #0a111d;
  --night-2: #121b2a;
  --steel: #9fb3c8;
  --glow: #3fb6ff;
  --paper: #e7d6b2;
  --paper-2: #f3e8cf;
  --paper-edge: #b89a66;
  --ink: #2a2118;
  --ink-soft: #6b5a43;
  --stamp: #b3201d;
  --amber: #ffb627;
  --road: #ffc93c;
  --bus: #3ee08a;
  --hsr: #ff5a1f;
  --express: #8b6cff;
  --ferry: #4da3ff;
  --black: #1a1a1a;
  --shinkansen: var(--hsr);  /* 新幹線視同高鐵 */
  --flight: #ff62b6;
  --trail: #d9b77a;
  --local: #c9bbff;
  --type: "Special Elite", "Noto Serif TC", "PMingLiU", "MingLiU", serif;
  --serif: "Noto Serif TC", "PMingLiU", "MingLiU", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--serif); color: var(--ink); background: var(--night); }
.hidden { display: none !important; }
button {
  font: inherit; font-family: var(--type); cursor: pointer; border: 1.5px solid var(--ink); background: var(--paper-2);
  color: var(--ink); border-radius: 3px; padding: 8px 14px; letter-spacing: 1px;
  box-shadow: 2px 2px 0 rgba(42,33,24,.35); transition: transform .08s, box-shadow .08s;
}
button:hover { background: #fff6e0; }
button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(42,33,24,.35); }
button.primary { background: var(--ink); color: var(--paper-2); }
button.primary:hover { background: #3d3023; }
button.ghost { background: transparent; color: var(--ink-soft); border-color: transparent; box-shadow: none; }
button:disabled { opacity: .45; cursor: default; }
input, select {
  font: inherit; font-family: var(--type); padding: 8px 4px; border: 0; border-bottom: 1.5px dashed var(--ink-soft);
  background: transparent; color: var(--ink); border-radius: 0; outline: none;
}
input:focus, select:focus { border-bottom-style: solid; border-bottom-color: var(--stamp); }
select { background: rgba(255,255,255,.35); }

/* ---------- 首頁 / 大廳 ---------- */
.screen { min-height: 100%; }
#home, #lobby {
  display: flex; align-items: center; justify-content: center; padding: 48px 16px 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 35%, rgba(255,214,140,.16), transparent 70%),
    repeating-linear-gradient(115deg, rgba(0,0,0,.25) 0 26px, rgba(0,0,0,0) 26px 60px),
    linear-gradient(180deg, #121a27, #05080e);
}
.card {
  position: relative; width: 100%; max-width: 470px; padding: 34px 30px 26px; border-radius: 2px 6px 6px 6px;
  box-shadow: 0 30px 60px rgba(0,0,0,.6), inset 0 0 0 1px rgba(120,90,40,.35);
  transform: rotate(-.6deg);
}
#home .card, #lobby .card { background-color: var(--paper); background-image:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.35), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(120,80,30,.2), transparent 45%),
    repeating-linear-gradient(0deg, rgba(90,60,20,.035) 0 1px, transparent 1px 3px); }
.folder-tab {
  position: absolute; top: -26px; left: 0; padding: 5px 18px 4px; font-family: var(--type); font-size: 13px;
  background: var(--paper); border-radius: 6px 6px 0 0; color: var(--ink-soft); letter-spacing: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.stamp {
  position: absolute; top: 22px; right: 18px; padding: 4px 12px; font-family: var(--serif); font-weight: 900;
  font-size: 22px; color: var(--stamp); border: 3px double var(--stamp); letter-spacing: 6px; transform: rotate(12deg);
  opacity: .78; mix-blend-mode: multiply; pointer-events: none;
}
.stamp.small { font-size: 16px; top: 18px; }
.kicker { margin: 0 0 4px; font-family: var(--type); font-size: 13px; letter-spacing: 3px; color: var(--ink-soft); }
.card h1 { margin: 0; font-size: 38px; font-weight: 900; letter-spacing: 3px; line-height: 1.1; padding-right: 84px; }  /* 右側留給「極機密」章 */
.card h2 { margin: 0 0 6px; font-weight: 900; letter-spacing: 2px; }
.card h3 { margin: 18px 0 8px; font-size: 15px; font-family: var(--type); letter-spacing: 2px; border-bottom: 1px solid var(--paper-edge); padding-bottom: 4px; }
.card label { display: block; margin: 16px 0 6px; font-size: 13px; color: var(--ink-soft); font-family: var(--type); letter-spacing: 1px; }
.card label input, .card label select { display: block; width: 100%; margin-top: 4px; }
.sub { color: var(--ink-soft); margin: 8px 0 12px; font-size: 14px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row > * { flex: 1; }
.divider { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 20px 0 0; font-family: var(--type); letter-spacing: 2px; }
.divider::before, .divider::after { content: " — "; }
.code-input { text-transform: uppercase; letter-spacing: 6px; text-align: center; }
.code { font-family: var(--type); letter-spacing: 5px; color: var(--stamp); }
.share { width: 100%; margin-top: 6px; font-size: 13px; }
.err { color: var(--stamp); min-height: 1.2em; font-size: 14px; font-family: var(--type); }
.hint { color: var(--ink-soft); font-size: 13px; }
.rules { margin-top: 12px; font-size: 14px; color: var(--ink); }
.rules summary { cursor: pointer; color: var(--stamp); font-family: var(--type); letter-spacing: 2px; }
.rules li { margin: 7px 0; line-height: 1.6; }
.rules .rules-h { margin: 16px 0 4px; font-size: 15px; color: var(--stamp); font-family: var(--type); letter-spacing: 1px; }
.player-list { list-style: none; padding: 0; margin: 0; }
.player-list li { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px dashed var(--paper-edge);
  font-family: var(--type); }
.add-ai { width: 100%; margin-top: 8px; background: transparent; border-style: dashed; box-shadow: none; }
.rm-ai { padding: 0 6px; font-size: 13px; }
.thinking { margin-top: 4px; font-size: 13px; color: var(--ink-soft); }
.thinking span { animation: blink 1.2s infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; }
.thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #9a8a70; flex: none; }
.dot.on { background: #2f9e5a; box-shadow: 0 0 6px #2f9e5a; }
.tag { font-size: 11px; padding: 1px 6px; border: 1px solid var(--ink-soft); color: var(--ink-soft); border-radius: 2px; }
.tag.you { border-color: var(--stamp); color: var(--stamp); }

/* ---------- 遊戲 ---------- */
/* 遊戲版面：上方兩列工具列、左側專案小組、中央地圖、右側動態與聊天 */
#game { display: grid; height: 100vh; grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: 190px minmax(0, 1fr) 300px; grid-template-areas: "top top top" "squad map feed"; }
#game.hidden { display: none !important; }
.map-wrap { grid-area: map; position: relative; min-width: 0; background: var(--night); overflow: hidden; touch-action: none; }
.map-wrap::after { /* 暗角 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55));
}
#map { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; }
#map.dragging { cursor: grabbing; }

.panel {
  width: 370px; flex: none; overflow-y: auto; padding: 0 16px 22px; position: relative;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 10% 5%, rgba(255,255,255,.3), transparent 35%),
    radial-gradient(circle at 90% 60%, rgba(120,80,30,.16), transparent 40%),
    repeating-linear-gradient(0deg, rgba(90,60,20,.035) 0 1px, transparent 1px 3px);
  box-shadow: inset 8px 0 18px -10px rgba(0,0,0,.6);
}
.dossier-head {
  display: flex; justify-content: space-between; align-items: center; margin: 0 -16px 12px; padding: 10px 16px;
  font-family: var(--type); font-size: 13px; letter-spacing: 2px; color: var(--paper-2); background: var(--ink);
}
.mini-stamp { color: #ff6b5e; border: 1.5px solid #ff6b5e; padding: 0 6px; transform: rotate(6deg); font-size: 12px; }
.panel h3 {
  font-family: var(--type); font-size: 14px; letter-spacing: 3px; font-weight: normal; margin: 22px 0 8px;
  display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1.5px solid var(--ink); padding-bottom: 3px;
}
.panel h3 small { color: var(--ink-soft); letter-spacing: 1px; }

.map-tools { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.map-tools button {
  width: 38px; height: 38px; padding: 0; font-size: 18px; background: rgba(10,17,29,.85); color: var(--glow);
  border: 1px solid rgba(63,182,255,.45); box-shadow: 0 0 10px rgba(63,182,255,.18);
}
.map-tools button:hover { background: rgba(20,40,60,.95); }
.legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 2; background: rgba(8,13,22,.86); color: var(--steel);
  padding: 8px 12px; border: 1px solid rgba(63,182,255,.25); border-radius: 4px; font-size: 12.5px;
  display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--type); letter-spacing: 1px;
}
.legend button {
  background: transparent; color: inherit; border: 0; box-shadow: none; padding: 2px 4px; font-size: inherit;
  letter-spacing: inherit; display: inline-flex; align-items: center;
}
.legend button:hover { background: rgba(63,182,255,.12); }
.legend button.off { opacity: .35; text-decoration: line-through; }
.panel-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; padding: 0; font-size: 18px;
  background: rgba(10,17,29,.85); color: var(--glow); border: 1px solid rgba(63,182,255,.45);
}
.panel-toggle:hover { background: rgba(20,40,60,.95); }
#game.panel-collapsed .panel { display: none; }
.ln { display: inline-block; width: 22px; height: 0; vertical-align: middle; margin-right: 4px; border-top: 4px solid; }
.ln.road { border-color: var(--road); border-top-width: 3px; box-shadow: 0 0 6px var(--road); }
.ln.bus { border-color: var(--bus); box-shadow: 0 0 6px var(--bus); }
.ln.hsr { border-color: var(--hsr); border-top-width: 3px; border-top-style: dashed; }
.ln.express { border-color: var(--express); border-top-width: 4px; }
.ln.ferry { border-color: var(--ferry); border-top-style: dashed; border-top-width: 3px; }
.ln.shinkansen { border-color: var(--shinkansen); border-top-width: 5px; box-shadow: 0 0 6px var(--shinkansen); }
.ln.flight { border-color: var(--flight); border-top-style: dashed; border-top-width: 3px; }
.ln.local { border-color: var(--local); border-top-width: 3px; }
.ln.trail { border-color: var(--trail); border-top-style: dotted; border-top-width: 3px; }
.banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3; background: rgba(5,8,14,.92);
  color: var(--amber); padding: 8px 18px; border: 1px solid rgba(255,182,39,.5); font-family: var(--type); font-size: 14px;
  letter-spacing: 1px; pointer-events: none; opacity: 0; transition: opacity .3s; white-space: nowrap;
  box-shadow: 0 0 18px rgba(255,182,39,.2);
}
.banner.show { opacity: 1; }

/* 卷宗內的紙條 */
.turn-box {
  position: relative; padding: 12px 14px; background: var(--paper-2); font-size: 15px; line-height: 1.6;
  box-shadow: 1px 2px 0 rgba(0,0,0,.12); border-left: 4px solid var(--ink-soft); font-family: var(--type);
}
.turn-box.mine { border-left-color: var(--stamp); background: #fff4dc; padding-right: 66px; }
.turn-box.mine::after {
  content: "行動"; position: absolute; right: 10px; top: 8px; color: var(--stamp); border: 2px solid var(--stamp);
  font-family: var(--serif); font-weight: 900; padding: 0 6px; transform: rotate(10deg); opacity: .8;
}
.turn-box .role { font-size: 12.5px; color: var(--ink-soft); }
.double-box { margin-top: 8px; padding: 8px 12px; background: rgba(166,107,255,.15); border: 1px dashed #7b4fc9; font-size: 14px; }
.action-box { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.alert-btn { background: var(--stamp); color: #fff; border-color: #6e1210; font-size: 13px; text-align: left; }
.alert-btn:hover { background: #8f1714; }
.tip-row { font-size: 13px; padding: 8px 10px; background: var(--paper-2); border: 1px dashed var(--ink-soft);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--type); }
.tip-row select { padding: 2px 6px; }
.tip-row button { padding: 4px 10px; }
.tip-row small { color: var(--ink-soft); }
.status-box { margin-top: 8px; font-size: 12.5px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 3px; font-family: var(--type); }
.status-box .hot { color: var(--stamp); }
.role-tag { font-size: 11px; padding: 0 5px; border: 1px solid; white-space: nowrap; font-family: var(--serif); }
.role-tag.interpol { color: #a3175c; }
.role-tag.intel { color: #1d4f8a; }
.role-tag.alarm { color: #9a5b00; }
.role-tag.normal { color: #3f4a3a; }
.extra-row { font-size: 13px; padding: 8px 10px; background: rgba(62,224,138,.12); border: 1px dashed #2f7a4a; font-family: var(--type); display: block; }
.alarm-mark circle { fill: #0a111d; stroke: var(--amber); stroke-width: 1.2; filter: drop-shadow(0 0 4px var(--amber)); }
.alarm-mark text { font-size: 8px; text-anchor: middle; dominant-baseline: central; }
.over-box {
  margin-top: 12px; padding: 16px; background: var(--ink); color: var(--paper-2); text-align: center;
  font-family: var(--type); box-shadow: 3px 3px 0 rgba(0,0,0,.3);
}
.over-box b { font-family: var(--serif); font-weight: 900; font-size: 22px; display: block; margin-bottom: 6px; letter-spacing: 2px; color: #ffcf6e; }
.over-box button { margin-top: 12px; background: var(--paper-2); color: var(--ink); }

/* X 行蹤表：證物標籤 */
.xlog { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.xcell {
  text-align: center; padding: 3px 0 2px; font-size: 11px; min-height: 44px; position: relative;
  background: var(--paper-2); border: 1px solid rgba(107,90,67,.45); box-shadow: 1px 1px 0 rgba(0,0,0,.1);
  font-family: var(--type);
}
.xcell .n { color: var(--ink-soft); font-size: 10px; }
.xcell .tk { display: block; margin: 2px auto 0; width: 26px; height: 13px; border-radius: 1px; box-shadow: 0 0 4px rgba(0,0,0,.25); }
.xcell .pos { display: block; font-weight: 700; font-size: 12px; color: var(--stamp); }
.xcell.reveal { border: 1.5px solid var(--stamp); }
.xcell.reveal::after { content: "現"; position: absolute; top: 1px; right: 2px; color: var(--stamp); font-size: 9px; font-family: var(--serif); font-weight: 900; }
.xcell.tip { border: 1.5px dashed #1d4f8a; }
.xcell.tip::before { content: "線"; position: absolute; top: 1px; left: 2px; font-size: 9px; color: #1d4f8a; font-family: var(--serif); font-weight: 900; }
.xcell.now { background: #fff; box-shadow: 0 0 0 2px var(--ink); }
.tk.road { background: var(--road); } .tk.bus { background: var(--bus); } .tk.tra { background: var(--express); } .tk.hsr { background: var(--hsr); }
.tk.black { background: var(--black); }
.tk.shinkansen { background: var(--shinkansen); } .tk.ferry { background: var(--ferry); } .tk.flight { background: var(--flight); }

.tickets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; font-size: 12px; font-family: var(--type); }
.ticket { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px 1px 3px; background: var(--paper-2);
  border: 1px solid rgba(107,90,67,.4); }
.ticket i { width: 14px; height: 9px; display: inline-block; }
.ticket.zero { opacity: .35; text-decoration: line-through; }

/* 刑警名單：索引卡 */
.pawn-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin-bottom: 6px; font-size: 13px; position: relative;
  background: var(--paper-2); border-top: 3px solid rgba(107,90,67,.3); box-shadow: 1px 2px 0 rgba(0,0,0,.12);
}
.pawn-row.active { border-top-color: var(--stamp); background: #fff4dc; }
.pawn-row .chip { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 2px solid var(--ink); }
.pawn-row .who { flex: 1; min-width: 0; font-family: var(--type); }
.pawn-row .who small { color: var(--ink-soft); }
.pawn-row .tickets { margin: 0; gap: 3px; }

/* 動態：電報紙帶 */
.events {
  max-height: 170px; overflow-y: auto; font-size: 12.5px; padding: 6px 10px; font-family: var(--type);
  background: #f7efd9; border: 1px solid rgba(107,90,67,.35);
  background-image: repeating-linear-gradient(0deg, transparent 0 22px, rgba(29,79,138,.12) 22px 23px);
}
.events div { padding: 3px 0; line-height: 1.45; }
.events div::before { content: "▸ "; color: var(--stamp); }
.chat { max-height: 140px; overflow-y: auto; font-size: 13px; background: #f7efd9; border: 1px solid rgba(107,90,67,.35); padding: 6px 10px; font-family: var(--type); }
.chat b { color: var(--stamp); }
.chat-form { display: flex; gap: 6px; margin-top: 6px; }
.chat-form input { flex: 1; min-width: 0; }

/* ---------- SVG：夜間雷達 ---------- */
.radar-ring { fill: none; stroke: rgba(63,182,255,.08); stroke-width: 1; }
.radar-sweep { animation: sweep 9s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.coast-glow { fill: none; stroke: var(--glow); stroke-width: 7; opacity: .45; }
.landmass { fill: url(#landGrad); stroke: rgba(120,200,255,.75); stroke-width: 1.3; stroke-linejoin: round; }
.map-title { font-family: var(--serif); font-size: 52px; font-weight: 900; fill: #e8c26a; opacity: .5; letter-spacing: 8px; }
.map-sub { font-family: var(--type); font-size: 12px; fill: #e8c26a; opacity: .4; letter-spacing: 3px; }
.sea-label { font-family: var(--type); font-size: 15px; fill: rgba(63,182,255,.35); letter-spacing: 10px; }
.jp-box { fill: rgba(6,10,18,.75); stroke: rgba(255,98,182,.45); stroke-width: 1.2; stroke-dasharray: 5 4; }
.jp-label { font-family: var(--type); font-size: 13px; fill: rgba(255,98,182,.75); letter-spacing: 3px; }
.jp-closed-stamp { font-family: var(--serif); font-size: 22px; font-weight: 900; fill: none; stroke: var(--stamp); stroke-width: 1.2;
  text-anchor: middle; letter-spacing: 4px; }

.sea-bg { fill: #0a111d; }
.ridge { stroke: #0b111b; opacity: .85; }

/* 路線：參考原版——機車是「馬路」（深色路邊＋路面），火車是粗紅虛線 */
.edge { fill: none; stroke-linecap: round; transition: opacity .15s; }
.edge.road-case { stroke: #04070c; stroke-width: 4.2; }
.edge.road { stroke: var(--road); stroke-width: 1.8; opacity: .9; }
.edge.bus { stroke: var(--bus); stroke-width: 2.4; }
.edge.hsr { stroke: var(--hsr); stroke-width: 2; stroke-dasharray: 7 4; stroke-linecap: butt; }
.edge.express { stroke: var(--express); stroke-width: 2.8; }
.edge.local { stroke: var(--local); stroke-width: 1.6; }
.edge.ferry { stroke: var(--ferry); stroke-width: 1.6; stroke-dasharray: 5 5; opacity: .7; }
.edge.shinkansen { stroke: var(--shinkansen); stroke-width: 2; stroke-dasharray: 7 4; stroke-linecap: butt; }
.edge.trail { stroke: var(--trail); stroke-width: 1.8; stroke-dasharray: 1.5 4; }
.node.peak .tri { fill: #2a2318; stroke: var(--trail); stroke-width: 1.4; stroke-linejoin: round; }
.node.peak .name { font-size: 7.5px; fill: #d9c49a; }
.node.peak.legal .tri { stroke: var(--amber); stroke-width: 2.2; }
/* 航線平常很淡，只有被突顯（滑鼠所在站／輪到我）時才亮起並流動 */
.edge.flight { stroke: var(--flight); stroke-width: 1.3; stroke-dasharray: 7 6; opacity: .2; }
.edge.flight.hl { opacity: 1; stroke-width: 2.2; animation: flow 1.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -26; } }
/* 焦點模式 */
#map.focus .edge:not(.hl) { opacity: .16; }
#map.focus .edge.hl { opacity: 1; }
#map.focus .node:not(.nb):not(.legal) { opacity: .35; }
#map.focus-soft .edge:not(.hl) { opacity: .5; }
#map.focus-soft .edge.hl { opacity: 1; }
/* 圖例開關 */
#map.hide-road .edge.road, #map.hide-road .edge.road-case, #map.hide-bus .edge.bus, #map.hide-hsr .edge.hsr, #map.hide-express .edge.express, #map.hide-ferry .edge.ferry,
#map.hide-local .edge.local, #map.hide-hsr .edge.shinkansen, #map.hide-flight .edge.flight, #map.hide-trail .edge.trail { display: none; }
/* 機場關閉：航線變灰並在中間打 ✕；機場通報期間：進出台灣的航線和所有渡輪打 ✕ */
.route-x { pointer-events: none; }
.route-x text { display: none; font-size: 22px; font-weight: 900; fill: #d0201c; text-anchor: middle; dominant-baseline: central;
  paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.route-x text.x-ferry { font-size: 16px; }
#map.jp-closed .route-x .x-flight, #map.sealed .route-x .x-tw { display: inline; }
#map.jp-closed .edge.flight, #map.sealed .edge.ferry { stroke: #8a8a8a; opacity: .55; animation: none; }
.pawn.in-air { opacity: .5; }
.landing circle { fill: none; stroke-width: 2; stroke-dasharray: 4 3; }
.landing text { font-family: var(--type); font-size: 10px; text-anchor: middle; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }

/* 站點：橢圓站名牌（上下半部顏色＝可搭的交通，中間白底寫站名）；高鐵站外圈粗框 */
.node { cursor: default; transition: opacity .15s; }
.node .body { fill: none; stroke: #04070c; stroke-width: 1.4; }
.node .plate { fill: #f7f2e6; }
.node .ferry-ring { fill: none; stroke: var(--ferry); stroke-width: 1.6; stroke-dasharray: 3 2; }
.node .hsr-ring { fill: none; stroke: var(--hsr); stroke-width: 2.2; }
.node .num { font-family: var(--serif); font-size: 9px; font-weight: 900; text-anchor: middle;
  dominant-baseline: central; fill: #111; pointer-events: none; }
.node .name { font-family: var(--serif); font-size: 8px; font-weight: 700; text-anchor: middle; fill: #c9d6e3;
  paint-order: stroke; stroke: #0a111d; stroke-width: 3px; pointer-events: none; }
.node .hq { font-size: 13px; fill: var(--amber); pointer-events: none; paint-order: stroke; stroke: #0a111d; stroke-width: 2px;
  filter: drop-shadow(0 0 3px var(--amber)); }
.node .airport { font-size: 10px; fill: var(--flight); pointer-events: none; filter: drop-shadow(0 0 3px var(--flight)); }
.node .glow { fill: none; stroke: none; }
.node.legal { cursor: pointer; }
.node.legal .glow { fill: rgba(255,182,39,.28); stroke: var(--amber); stroke-width: 2; animation: pulse 1.1s ease-in-out infinite;
  filter: drop-shadow(0 0 8px var(--amber)); }
.node.legal .body { stroke: var(--amber); stroke-width: 2.4; }
@keyframes pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* ---------- 桌遊版地圖風格（參考原版淺色板面） ---------- */
.map-wrap.board {
  background: #a9d3ea;
  --road: #f2b705; --bus: #1f9d55; --hsr: #e8501a; --express: #4b2fb0; --local: #9a86e8; --shinkansen: #e8501a; --ferry: #2b6cb0; --flight: #d63384; --trail: #8a6a3a;
}
.map-wrap.board::after { display: none; }
.board .sea-bg { fill: #a9d3ea; }
.board .sea-grid, .board .radar-ring, .board .radar-sweep, .board .coast-glow { display: none; }
.board .landmass { fill: #f1e8cf; stroke: #5d8ea8; stroke-width: 1.6; }
.board .ridge { stroke: #b9d39a; opacity: .75; }
.board .map-title { fill: #6b4a1e; opacity: .75; }
.board .map-sub { fill: #6b4a1e; opacity: .6; }
.board .sea-label { fill: #3f7ea3; }
.board .jp-box { fill: #a9d3ea; stroke: #5d8ea8; }
.board .jp-label { fill: #3f6f8c; }
.board .lines { filter: none; }
.board .edge.road-case { stroke: #d79a00; stroke-width: 5.2; }
.board .edge.road { stroke: #fff8e1; stroke-width: 2.8; opacity: 1; }
.board .edge.bus { stroke-width: 2.4; }
.board .edge.flight { opacity: .35; }
.board .edge.flight.hl { opacity: 1; }
.board .node .body { stroke: #2b2418; }
.board .node .plate { fill: #fff; }
.board .node .name { fill: #2f2717; stroke: #f6efdb; }
.board .node.peak .tri { fill: #b08a55; stroke: #5a4422; }
.board .node.peak .name { fill: #5a4422; }
.board .node .hq { fill: #c47f00; stroke: #fff; filter: none; }
.board .node .airport { fill: #b0206b; filter: none; }
.board .node.legal .glow { fill: rgba(255,170,0,.35); stroke: #e08a00; filter: none; }
.board .node.legal .body { stroke: #e08a00; }
.board .pawn circle { stroke: #fff; }
.board .pawn.active circle { stroke: #111; }
.board .ghost text { fill: #b3122f; stroke: #fff; }
.board .alarm-mark circle { fill: #fff; filter: none; }
.board .map-tools button, .board .panel-toggle { background: rgba(255,255,255,.92); color: #2b4a5e; border-color: #8fb4c9; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.board .legend { background: rgba(255,255,255,.92); color: #2b3a44; border-color: #8fb4c9; }
.board .banner { background: rgba(255,255,255,.95); color: #6b3a00; border-color: #e0a800; }

.pawn circle { stroke: #0a111d; stroke-width: 2; }
.pawn text { font-family: var(--type); font-size: 10px; font-weight: 700; fill: #0a111d; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pawn.active circle { stroke: #fff; stroke-width: 2.6; }
.x-pawn { filter: drop-shadow(0 0 7px #ff3d5e); }
.x-pawn circle { stroke: #ff3d5e; stroke-width: 2.2; }
.x-pawn text { fill: #ff3d5e; font-size: 13px; }
.ghost .ring { fill: rgba(255,61,94,.08); stroke: #ff3d5e; stroke-width: 1.6; stroke-dasharray: 4 3; }
.ghost .ping { fill: none; stroke: #ff3d5e; stroke-width: 1.5; transform-box: fill-box; transform-origin: center;
  animation: ping 2.4s ease-out infinite; }
.ghost .ping.late { animation-delay: 1.2s; }
@keyframes ping { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }
.ghost text { font-family: var(--type); font-size: 10px; fill: #ff8a9c; text-anchor: middle; paint-order: stroke; stroke: #0a111d; stroke-width: 3px; }
.pawn, .ghost { pointer-events: none; }

/* ---------- 車票選擇 ---------- */
.picker {
  position: fixed; z-index: 20; padding: 12px; min-width: 190px; font-family: var(--type);
  background: var(--paper-2); border: 1px solid var(--paper-edge); box-shadow: 4px 6px 0 rgba(0,0,0,.35), 0 12px 30px rgba(0,0,0,.4);
}
.picker .title { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; border-bottom: 1px dashed var(--paper-edge); padding-bottom: 6px; }
.picker button { display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 6px; text-align: left; }
.picker button i { width: 18px; height: 12px; display: inline-block; }
.picker .cancel { color: var(--ink-soft); border-color: transparent; justify-content: center; margin: 0; box-shadow: none; background: transparent; }
.conn { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--stamp); color: #fff;
  padding: 8px 16px; font-size: 14px; z-index: 30; font-family: var(--type); letter-spacing: 1px; }

/* ---------- 新版遊戲 UI ---------- */
.paperbg { background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, rgba(90,60,20,.035) 0 1px, transparent 1px 3px); }
.topbar, .squad, .feed-panel, .log-panel, #picker { background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, rgba(90,60,20,.035) 0 1px, transparent 1px 3px); }

/* 上方兩列 */
.topbar { grid-area: top; border-bottom: 2px solid var(--ink); z-index: 5; }
.topbar.mine { box-shadow: inset 0 -3px 0 var(--stamp); }
.tb-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; min-height: 44px; overflow-x: auto; }
.tb-row + .tb-row { border-top: 1px dashed var(--paper-edge); }
.tb-label { font-family: var(--type); font-size: 12px; color: var(--ink-soft); letter-spacing: 1px; flex: none; min-width: 64px; }
.abilities { display: flex; gap: 6px; align-items: center; }
.abilities .muted { font-size: 12.5px; color: var(--ink-soft); font-family: var(--type); }
.ability { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; }
.ability .n { font-size: 11px; background: var(--ink); color: var(--paper-2); border-radius: 8px; padding: 0 6px; }
.ability.hot { background: var(--stamp); color: #fff; border-color: #6e1210; }
.ability.hot .n, .ability.on .n { background: #fff; color: var(--stamp); }
.ability.on { background: #4b2fb0; color: #fff; border-color: #2a1870; }
.turn-info { margin-left: auto; font-family: var(--type); font-size: 13px; flex: none; }
.turn-info b { color: var(--stamp); }
.thinking span { animation: blink 1.2s infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; } .thinking span:nth-child(3) { animation-delay: .4s; }
.my-tickets { display: flex; gap: 10px; align-items: center; }
.ticket { display: inline-flex; align-items: center; gap: 5px; flex: none; }
.ticket .count { font-family: var(--type); font-size: 18px; min-width: 18px; }
.ticket.zero { opacity: .35; }
.chip { width: 36px; height: 24px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.18); color: #fff; font-family: var(--type); font-size: 12px; }
.chip svg { width: 24px; height: 16px; fill: #fff; }
.picker .chip { width: 26px; height: 18px; }
.picker .chip svg { width: 18px; height: 12px; }
.tk-road { background: var(--road); } .tk-bus { background: var(--bus); } .tk-tra { background: var(--express); }
.tk-hsr { background: var(--hsr); } .tk-ferry { background: var(--ferry); } .tk-flight { background: var(--flight); }
.tk-black { background: #1a1a1a; }
/* 雙倍移動卡：灰色斜紋，和台鐵的紫色區分開 */
.tk-double, .tk.double { background: repeating-linear-gradient(135deg, #8d98a3 0 3px, #5b6570 3px 6px); }
.status-line { margin-left: auto; display: flex; gap: 10px; font-family: var(--type); font-size: 12.5px; color: var(--ink-soft); flex: none; }
.status-line .hot { color: var(--stamp); }

/* 左側專案小組 */
.squad { grid-area: squad; overflow-y: auto; padding: 10px; border-right: 1.5px solid var(--paper-edge); }
.squad h3 { font-family: var(--type); font-size: 12px; letter-spacing: 2px; margin: 0 0 8px; color: var(--ink-soft); font-weight: normal; }
.mini { background: var(--paper-2); border: 1px solid rgba(107,90,67,.4); padding: 6px 8px; margin-bottom: 8px; box-shadow: 1px 1px 0 rgba(0,0,0,.1); }
.mini.active { outline: 2px solid var(--stamp); outline-offset: -1px; }
.mini.me { background: #fff4dc; border: 2px solid var(--ink); }
.mini .who { font-family: var(--type); font-size: 12.5px; display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.mini .dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--ink); flex: none; }
.mini .you { font-size: 10px; background: var(--stamp); color: #fff; padding: 0 4px; margin-left: auto; }
.mini .ai { font-size: 10px; border: 1px solid var(--ink-soft); color: var(--ink-soft); padding: 0 3px; margin-left: auto; }
.mini .role { font-size: 11.5px; color: var(--stamp); font-weight: 700; margin-bottom: 2px; }
.mini .abs { font-size: 12px; margin-bottom: 4px; font-family: var(--type); }
.mini .abs .none { font-size: 11px; color: var(--ink-soft); }
.mini .tix { display: flex; flex-wrap: wrap; gap: 3px 7px; }
.mini .t { display: inline-flex; align-items: center; gap: 3px; font-family: var(--type); font-size: 11.5px; }
.mini .t i { width: 12px; height: 9px; border-radius: 2px; display: inline-block; }
.mini.x { background: #2a2118; color: var(--paper-2); border-color: #000; }
.mini.x .ai, .mini.x .t { color: var(--paper-2); }

/* 地圖下方：神偷行蹤 4×6（可收合） */
.log-dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: 54px; z-index: 4;
  width: min(380px, calc(100% - 24px)); display: flex; flex-direction: column; align-items: center; gap: 24px; pointer-events: none; }
.log-dock > * { pointer-events: auto; }
.log-dock .abilities { flex-wrap: wrap; justify-content: center; }
.log-dock .abilities:empty { display: none; }
.log-dock .ability { box-shadow: 2px 3px 0 rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.25); }
.log-panel { position: relative; width: 100%; border: 1.5px solid var(--ink); box-shadow: 3px 4px 0 rgba(0,0,0,.25); }
.log-head { display: flex; align-items: center; gap: 8px; padding: 5px 9px; border-bottom: 1px dashed var(--paper-edge); }
.log-head b { font-family: var(--type); letter-spacing: 2px; font-weight: normal; font-size: 13px; }
.log-head .sub { font-size: 11px; color: var(--ink-soft); }
.mini-btn { margin-left: auto; padding: 1px 9px; font-size: 12px; box-shadow: none; }
.log-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; padding: 6px 8px 8px; }
.log-panel.collapsed .log-grid { display: none; }
.cell { position: relative; height: 22px; border: 1px solid rgba(107,90,67,.4); background: #fffaf0; display: flex;
  align-items: center; justify-content: center; font-family: var(--type); font-size: 11px; color: var(--ink-soft); }
.cell.used { border: none; color: rgba(255,255,255,.9); }
.cell.tk-road { background: var(--road); } .cell.tk-bus { background: var(--bus); } .cell.tk-tra { background: var(--express); }
.cell.tk-hsr { background: var(--hsr); } .cell.tk-ferry { background: var(--ferry); } .cell.tk-flight { background: var(--flight); }
.cell.tk-black { background: #1a1a1a; }
#picker { max-height: 72vh; overflow-y: auto; }
.cell .pos { font-family: var(--serif); font-weight: 900; font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  white-space: nowrap; overflow: hidden; }
.cell.reveal { outline: 2px solid var(--stamp); outline-offset: -1px; }
.cell.tip { outline: 2px dashed #1d4f8a; outline-offset: -1px; }
.cell.now { box-shadow: 0 0 0 2px var(--ink); }
.cell[data-pos] { cursor: pointer; }
.node.lit .glow { fill: rgba(255,176,0,.55); stroke: var(--stamp); stroke-width: 3; animation: pulse 1s ease-in-out infinite; }

/* 遊戲結束：浮在地圖中央 */
#game .over-box { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 6; margin: 0;
  min-width: 300px; max-width: calc(100% - 32px); }
#game .over-box .sub { margin-top: 6px; font-size: 13px; opacity: .8; }

/* 右側：動態與聊天 */
.feed-panel { grid-area: feed; display: flex; flex-direction: column; padding: 10px 12px; border-left: 1.5px solid var(--ink); min-height: 0; }
.feed-panel h3 { font-family: var(--type); font-size: 13px; letter-spacing: 2px; font-weight: normal; margin: 0 0 6px;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 3px; }
.feed { flex: 1; overflow-y: auto; min-height: 0; }
.feed div { font-family: var(--type); font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed rgba(107,90,67,.3); line-height: 1.45; }
.feed .sys { color: var(--ink-soft); font-size: 12px; }
.feed .chat b { color: var(--stamp); }

/* 地圖針 */
.pin { pointer-events: none; transition: opacity .2s; }
/* 輪到自己選路線、或滑鼠指著站時，棋子變半透明，看得到底下的路線和站名 */
#map.focus .pin, #map.focus-soft .pin:not(.mine.active) { opacity: .4; }  /* 輪到自己時正在行動的那顆不變透明；滑鼠指著站（突顯路線）時全部變透明 */
/* 只藏棋子；最後目擊、警報站、空警降落點這些情報標記照常顯示 */
#map.hide-others .pin:not(.keep):not(.ghost) { display: none; }
.map-tools button.on { background: #2b4a5e; color: #fff; border-color: #2b4a5e; }
.pin .pin-body { stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.pin .roman { font-family: Georgia, serif; font-weight: 700; fill: #fff; text-anchor: middle; }
.pin.mine { transform-box: fill-box; }
.pin .mine-ring { fill: none; stroke-width: 1.8; stroke-dasharray: 3 2; }
.pin.active .pin-body { stroke: #ffd400; stroke-width: 2; }
.pin.in-air, .pin.ghost { opacity: .45; }
.pin-label { font-family: var(--type); font-size: 10px; text-anchor: middle; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }

@media (max-width: 1100px) { #game { grid-template-columns: 150px minmax(0, 1fr) 240px; } .ability .lbl { display: none; } }
/* 手機：專案小組改成橫向捲動列，動態與聊天移到地圖下方 */
@media (max-width: 760px) {
  #game { height: 100dvh; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) 150px;
    grid-template-areas: "top" "squad" "map" "feed"; }
  .squad { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1.5px solid var(--paper-edge); padding: 6px 10px; }
  .squad h3 { display: none; }
  .mini { flex: none; margin: 0; min-width: 130px; }
  .turn-info, .status-line { display: none; }
  .feed-panel { border-left: 0; border-top: 1.5px solid var(--ink); padding: 6px 10px; }
  .feed-panel h3 { display: none; }
  .legend { display: none; }
  .log-dock { bottom: 8px; }
  .card { transform: none; }
  .card h1 { font-size: 30px; padding-right: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .radar-sweep, .edge.flight.hl, .ghost .ping, .node.legal .glow, .node.lit .glow { animation: none; }
}

/* ---------- UI 細節 ---------- */
/* 票卡：上亮下暗的立體感 */
.chip { box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -2px 0 rgba(0,0,0,.2), 0 1px 2px rgba(0,0,0,.25); }
.ticket .count { text-shadow: 0 1px 0 #fff; }
.ability { transition: transform .12s, box-shadow .12s; }
.ability:hover { transform: translateY(-1px); box-shadow: 2px 3px 0 rgba(0,0,0,.3); }

/* 回合進度條 */
.turn-info { display: flex; align-items: center; gap: 4px; }
.rtrack { display: inline-flex; gap: 1.5px; margin-right: 8px; padding: 3px; border: 1px solid var(--paper-edge); background: #fffaf0; }
.rtrack i { width: 5px; height: 12px; background: rgba(107,90,67,.18); }
.rtrack i.rv { box-shadow: inset 0 -3px 0 var(--stamp); }
.rtrack i.done { background: var(--ink-soft); }
.rtrack i.cur { background: var(--stamp); animation: blink 1.2s infinite; }

/* 專案小組卡片：左側色條＝棋子顏色，行動中蓋章 */
.mini { position: relative; border-left: 4px solid var(--c, var(--ink)); transition: transform .15s; }
.mini.me { border-left-width: 5px; border-left-color: var(--c, var(--ink)); }
.mini:hover { transform: translateX(2px); }
.mini.active::after { content: '行動中'; position: absolute; right: 8px; top: 24px; font-family: var(--type); font-size: 10px;
  color: var(--stamp); border: 1.5px solid var(--stamp); padding: 0 4px; transform: rotate(-8deg); opacity: .85; background: rgba(255,255,255,.4); }
.mini.x.active::after { background: rgba(0,0,0,.3); color: #ff8a80; border-color: #ff8a80; }
.squad h3, .feed-panel h3 { display: flex; align-items: center; gap: 5px; }

/* 動態：聊天訊息做成便條、系統訊息淡一點 */
.feed .chat { background: #fff8e3; border: 1px solid rgba(107,90,67,.25); border-left: 3px solid var(--stamp);
  padding: 4px 7px; margin: 4px 0; box-shadow: 1px 1px 0 rgba(0,0,0,.08); }
.feed div:last-child:not(.chat) { font-weight: 700; }

/* 地圖：四周暗角＋右下角羅盤 */
.map-wrap.board::after { display: block; background: none; z-index: 1;
  box-shadow: inset 0 0 40px rgba(0,0,0,.18), inset 0 0 0 1px rgba(0,0,0,.15); }
.compass { position: absolute; right: 14px; bottom: 14px; width: 54px; height: 54px; z-index: 2; pointer-events: none; opacity: .85; }
.compass .c-ring { fill: rgba(255,255,255,.75); stroke: #2b4a5e; stroke-width: 1.2; }
.compass .c-ring2 { fill: none; stroke: #2b4a5e; stroke-width: .6; stroke-dasharray: 1.5 2; }
.compass .c-n { fill: var(--stamp); } .compass .c-s { fill: #2b4a5e; } .compass .c-ew { fill: rgba(43,74,94,.45); }
.compass .c-t { font-family: Georgia, serif; font-size: 7px; font-weight: 700; text-anchor: middle; fill: #fff; }

/* 神偷行蹤：檔案夾標籤 */
.log-panel::before { content: 'CASE FILE'; position: absolute; top: -17px; left: 10px; font-family: var(--type); font-size: 9.5px;
  letter-spacing: 2px; padding: 2px 8px 1px; background: var(--paper); border: 1.5px solid var(--ink); border-bottom: 0; color: var(--ink-soft); }
.cell.reveal:not(.used)::after { content: '👁'; font-size: 9px; opacity: .55; }

@media (max-width: 760px) { .rtrack, .compass { display: none; } }

/* ---------- 夜間風格（整個遊戲畫面；body.night-ui，由 🌙 按鈕切換，預設開啟） ---------- */
body.night-ui #game { background: #0b121c; }
body.night-ui .topbar, body.night-ui .squad, body.night-ui .feed-panel, body.night-ui .log-panel {
  background-color: #101a27; color: #d6e2ee;
  background-image: linear-gradient(rgba(62,224,208,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(62,224,208,.035) 1px, transparent 1px);
  background-size: 22px 22px; }
body.night-ui .topbar { border-bottom: 1px solid #2bd4c4; box-shadow: 0 0 18px rgba(43,212,196,.25); }
body.night-ui .topbar.mine { box-shadow: 0 0 18px rgba(43,212,196,.25), inset 0 -3px 0 #ff5a6e; }
body.night-ui .tb-row + .tb-row { border-top-color: rgba(43,212,196,.25); }
body.night-ui .tb-label, body.night-ui .squad h3, body.night-ui .feed .sys, body.night-ui .log-head .sub,
body.night-ui .abilities .muted, body.night-ui .status-line { color: #7f93a8; }
body.night-ui .status-line .hot, body.night-ui .turn-info b { color: #ff5a6e; }
body.night-ui .ticket .count { color: #e8f1f8; text-shadow: none; }
body.night-ui .chip { box-shadow: 0 0 8px rgba(255,255,255,.12), inset 0 1px 0 rgba(255,255,255,.35); }
body.night-ui .tk-black { box-shadow: inset 0 0 0 1.5px #8fa3b8; }  /* 黑票在深底上加亮框 */
body.night-ui .ability { background: #16263a; color: #cfe8f0; border-color: #2bd4c4; box-shadow: 0 0 8px rgba(43,212,196,.3); }
body.night-ui .ability.hot { background: #5a1220; border-color: #ff5a6e; color: #fff; box-shadow: 0 0 10px rgba(255,90,110,.5); }
body.night-ui .ability.on { background: #2a1870; border-color: #8b6cff; color: #fff; }
body.night-ui .squad { border-right-color: rgba(43,212,196,.3); }
body.night-ui .mini { background: #14212f; border-color: rgba(127,147,168,.35); border-left-color: var(--c, #2bd4c4); color: #d6e2ee; box-shadow: none; }
body.night-ui .mini.me { background: #182c3d; border-color: #2bd4c4; border-left-color: var(--c, #2bd4c4); }
body.night-ui .mini .role { color: #ff7a8a; }
body.night-ui .mini .t, body.night-ui .mini .abs { color: #c3d2e0; }
body.night-ui .mini .dot { border-color: #101a27; box-shadow: 0 0 0 1px #c3d2e0; }
body.night-ui .mini.x { background: #2a0f16; border-color: #ff5a6e; }
body.night-ui .mini.active { outline-color: #ff5a6e; }
body.night-ui .mini.active::after { background: rgba(0,0,0,.4); color: #ff7a8a; border-color: #ff7a8a; }
body.night-ui .feed-panel { border-left-color: rgba(43,212,196,.3); }
body.night-ui .feed-panel h3 { border-bottom-color: #2bd4c4; color: #2bd4c4; }
body.night-ui .feed div { border-bottom-color: rgba(127,147,168,.18); color: #c9d6e3; }
body.night-ui .feed .chat { background: #16263a; border-color: rgba(43,212,196,.3); border-left-color: #ff5a6e; }
body.night-ui .feed .chat b { color: #ff7a8a; }
body.night-ui .log-panel { border-color: #2bd4c4; box-shadow: 0 0 16px rgba(43,212,196,.25); }
body.night-ui .log-panel::before { background: #101a27; border-color: #2bd4c4; color: #2bd4c4; }
body.night-ui .log-head { border-bottom-color: rgba(43,212,196,.25); }
body.night-ui .log-head b { color: #d6e2ee; }
body.night-ui .cell:not(.used) { background: #0e1823; border-color: rgba(127,147,168,.3); color: #5f7489; }
body.night-ui .cell.reveal { outline-color: #ff5a6e; }
body.night-ui .cell.now { box-shadow: 0 0 0 2px #2bd4c4; }
body.night-ui .rtrack { background: #0e1823; border-color: rgba(43,212,196,.3); }
body.night-ui .rtrack i { background: rgba(127,147,168,.25); }
body.night-ui .rtrack i.done { background: #2bd4c4; }
body.night-ui .rtrack i.cur { background: #ff5a6e; }
body.night-ui .mini-btn, body.night-ui #chatForm button { background: #16263a; color: #cfe8f0; border-color: #2bd4c4; box-shadow: none; }
body.night-ui #chatForm input { background: #0e1823; color: #d6e2ee; border-color: rgba(43,212,196,.3); }
body.night-ui .map-tools button.on { background: #2bd4c4; color: #0b121c; }
body.night-ui .compass .c-ring { fill: rgba(16,26,39,.8); stroke: #2bd4c4; }
body.night-ui .compass .c-ring2, body.night-ui .compass .c-s { stroke: #2bd4c4; fill: #2bd4c4; }
body.night-ui .picker { background: #101a27; color: #d6e2ee; border-color: #2bd4c4; }
body.night-ui .picker .title { color: #7f93a8; border-bottom-color: rgba(43,212,196,.3); }
body.night-ui .picker button { background: #16263a; color: #d6e2ee; border-color: rgba(43,212,196,.4); }
body.night-ui .ticket { background: #16263a; border-color: rgba(43,212,196,.35); box-shadow: none; }

/* 行蹤表：機場封鎖的回合在右上角打紅色三角形 */
.cell.sealed::before { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 9px 9px 0;
  border-color: transparent #e0262b transparent transparent; }

/* 拖拉／縮放地圖時暫停發光濾鏡與動畫（手機上每次移動都重算模糊濾鏡會閃爍），放開後恢復 */
#map.dragging .lines, #map.dragging .coast-glow, #map.dragging [filter] { filter: none; }
#map.dragging *, #map.dragging *::before, #map.dragging *::after { animation-play-state: paused; transition: none; }
/* 觸控裝置：路線不套發光濾鏡（最耗效能） */
@media (pointer: coarse) { #map .lines { filter: none; } }

/* 手機：行蹤卡縮小，少擋地圖 */
@media (max-width: 760px) {
  .log-dock { width: min(300px, calc(100% - 16px)); gap: 18px; }
  .log-head { padding: 3px 7px; gap: 6px; }
  .log-head b { font-size: 11.5px; letter-spacing: 1px; }
  .log-head .sub { display: none; }
  .log-panel .mini-btn { font-size: 11px; padding: 0 7px; }
  .log-grid { gap: 2px; padding: 4px 5px 5px; }
  .cell { height: 15px; font-size: 9px; }
  .cell .pos { font-size: 9px; }
  .cell.reveal:not(.used)::after { font-size: 7px; }
  .cell.sealed::before { border-width: 0 6px 6px 0; }
  .log-panel::before { font-size: 8px; top: -14px; padding: 1px 6px 0; }
}

/* 手機：能力剩餘次數寫在職業右邊 */
@media (max-width: 760px) {
  .mini .role-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 3px; }
  .mini .role-row .role, .mini .role-row .abs { margin-bottom: 0; white-space: nowrap; }
}

/* 終局重播：重播時隱藏即時棋子，只顯示重播的路線與棋子 */
#map.replaying .pin:not(.rp), #map.replaying .landing { display: none; }
.rp-line { fill: none; stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; opacity: .85; pointer-events: none; }
.rp-thief { stroke: #ff3d5e; stroke-width: 4.5; stroke-dasharray: 9 6; filter: drop-shadow(0 0 4px rgba(255,61,94,.8)); }
#replayInfo { color: #ff5a6e; font-weight: 700; }
#game .over-box .over-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
/* 重播時結束框移到上方，不擋地圖中央 */
/* 重播模式：收起上方列、專案小組、動態聊天、地圖工具與圖例，地圖放到最大；結束框縮成上方小橫幅 */
#game.replay-mode { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "map"; }
#game.replay-mode .topbar, #game.replay-mode .squad, #game.replay-mode .feed-panel,
#game.replay-mode .map-tools, #game.replay-mode .legend, #game.replay-mode .compass, #game.replay-mode #banner { display: none; }
#game.replay-mode .over-box { top: 10px; transform: translateX(-50%); padding: 6px 12px; min-width: 0; width: max-content;
  max-width: calc(100% - 20px); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
#game.replay-mode .over-box b { font-size: 15px; margin: 0; letter-spacing: 1px; }
#game.replay-mode .over-box .reason, #game.replay-mode .over-box .sub:not(#replayInfo) { display: none; }
#game.replay-mode .over-box #replayInfo { margin: 0; }
#game.replay-mode .over-box .over-btns { margin: 0; }
#game.replay-mode .over-box button { margin: 0; padding: 3px 10px; font-size: 13px; }

/* 重播時只有神偷路線是亮的：地圖、路線、站牌、刑警都調暗 */
#map.replaying > g:not(.replay-layer) { opacity: .25; transition: opacity .4s; }
#map.replaying .rp-cop { opacity: .3; }  /* 刑警路線調暗，刑警棋子保持亮著 */
.rp-name { font-family: var(--serif); font-size: 11px; font-weight: 900; text-anchor: middle; fill: #fff;
  paint-order: stroke; stroke: #b0162e; stroke-width: 3px; pointer-events: none; }

/* 回房碼、斷線標籤、交給電腦按鈕、卡片可點 */
.squad .pin-code { margin-left: auto; font-size: 11px; letter-spacing: 1px; color: var(--stamp); border: 1px solid currentColor; padding: 0 5px; }
body.night-ui .squad .pin-code { color: #2bd4c4; }
.mini[data-node] { cursor: pointer; }
.mini .off { font-size: 10px; background: #8a8a8a; color: #fff; padding: 0 4px; margin-left: auto; }
.mini .hand { margin-left: 4px; font-size: 10.5px; padding: 0 5px; }
.rejoin { margin-top: 10px; font-size: 13px; }
.rejoin summary { cursor: pointer; color: var(--ink-soft); }
.rejoin .row { margin-top: 6px; }
.pin-hint b { letter-spacing: 2px; color: var(--stamp); }

/* 離開按鈕、首頁「你還在房間」提示 */
.feed-panel h3 #btnLeaveGame { margin-left: auto; font-size: 11px; letter-spacing: 0; }
.pending { margin: 10px 0; padding: 8px 10px; border: 1px dashed var(--stamp); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pending b { letter-spacing: 2px; color: var(--stamp); }
.pending button { padding: 3px 10px; font-size: 13px; }

/* 首頁署名 */
.credit { margin: 14px 0 0; text-align: center; font-family: var(--type); font-size: 12px; letter-spacing: 1px; color: var(--ink-soft); opacity: .8; }

/* 回房碼：電腦版放在專案小組標題，手機版（專案小組標題收起）改放動態列 */
.feed-pin { display: none; }
@media (max-width: 760px) {
  .squad h3 { display: none; }
  .feed-panel h3 { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 4px; }
  .feed-pin { display: inline; margin-left: auto; font-size: 11px; color: var(--stamp); border: 1px solid currentColor; padding: 0 5px; }
  body.night-ui .feed-pin { color: #2bd4c4; }
  .feed-pin + #btnLeaveGame { margin-left: 6px; }
}

/* 開場提示（第一回合） */
.intro-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 7; width: min(440px, calc(100% - 24px));
  max-height: calc(100% - 24px); overflow-y: auto; padding: 18px 20px; background: var(--paper-2); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 4px 6px 0 rgba(0,0,0,.35); font-family: var(--type); font-size: 14px; line-height: 1.6; }
.intro-box b { display: block; font-family: var(--serif); font-size: 24px; letter-spacing: 3px; color: var(--stamp); margin-bottom: 6px; }
.intro-box p { margin: 6px 0; }
.intro-box em { font-style: normal; font-weight: 700; color: var(--stamp); }
.intro-box .intro-pawn { border-left: 4px solid var(--c); padding-left: 8px; }
.intro-box .intro-pawn span { display: block; font-weight: 700; }
.intro-box button { margin-top: 10px; width: 100%; }
body.night-ui .intro-box { background: #101a27; color: #d6e2ee; border-color: #2bd4c4; box-shadow: 0 0 20px rgba(43,212,196,.3); }
body.night-ui .intro-box b, body.night-ui .intro-box em { color: #ff7a8a; }
/* 專案小組標題：回房碼太擠時換到下一行，不要把標題擠成直排 */
.squad h3 { flex-wrap: wrap; row-gap: 4px; white-space: nowrap; }
.squad .pin-code { white-space: nowrap; }

.spectator-count { font-size: 11px; color: var(--ink-soft); margin-left: auto; letter-spacing: 0; }
.spectator-count:empty { display: none; }
.spectator-count + #btnLeaveGame, .feed-pin + .spectator-count { margin-left: 6px; }

/* 大廳：案件簡報（遊戲情境與目標） */
.briefing { margin: 8px 0 14px; padding: 10px 12px; border: 1px dashed var(--stamp); background: rgba(176,22,46,.05);
  font-size: 13.5px; line-height: 1.65; }
.briefing p { margin: 0 0 6px; }
.briefing .brief-lead { font-family: var(--type); letter-spacing: 3px; color: var(--stamp); font-size: 12px; margin-bottom: 4px; }
.briefing ul { margin: 0; padding-left: 1.2em; }
.briefing li { margin: 2px 0; }
/* 機密塗黑 */
.briefing .redact { color: #1a1a1a; background: #1a1a1a; padding: 0 1px; margin: 0 2px; letter-spacing: -1px; user-select: none; }
body.night-ui .briefing .redact { color: #000; background: #000; }

/* ---------- 大廳重新排版：上方房號與分享、左欄玩家與設定、右欄案件檔案 ---------- */
#lobby .lobby-card { max-width: 960px; transform: rotate(-.3deg); }
.lobby-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; padding-bottom: 14px;
  border-bottom: 2px solid var(--ink); margin-bottom: 4px; padding-right: 90px; }
.lobby-head .kicker { margin: 0 0 2px; }
.lobby-head h2 { margin: 0; }
.big-code { font-size: 44px; letter-spacing: 10px; line-height: 1; }
.share-box { flex: 1; min-width: 240px; }
.share-row { display: flex; gap: 6px; }
.share-row .share { margin-top: 0; flex: 1; min-width: 0; }
.share-row button { flex: none; padding: 6px 12px; font-size: 13px; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.lobby-main h3:first-child { margin-top: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.settings-grid label { margin: 6px 0 4px; }
.start-btn { width: 100%; padding: 12px; font-size: 17px; letter-spacing: 4px; margin-top: 6px; }
#lobby #btnLeave { margin-top: 6px; }
.lobby-grid .briefing { margin: 14px 0 0; position: relative; background: rgba(255,255,255,.35); border-style: solid;
  border-color: rgba(176,22,46,.45); box-shadow: 2px 3px 0 rgba(0,0,0,.08); }
.lobby-grid .briefing::before { content: '機密'; position: absolute; top: -11px; right: 12px; font-family: var(--type); font-size: 11px;
  letter-spacing: 3px; color: #fff; background: var(--stamp); padding: 1px 8px; }
@media (max-width: 760px) {
  .lobby-head { padding-right: 0; }
  .big-code { font-size: 36px; }
  .lobby-grid { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
.start-note { margin: 6px 0 0; font-size: 12px; text-align: center; color: var(--ink-soft); }  /* 放在按鈕外，非房主也看得到 */

/* 專案小組卡片標題：羅馬數字＋玩家名字（取代「刑警1 I」） */
.mini .who .roman { font-family: Georgia, serif; white-space: nowrap; }
.mini .who .owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 電腦玩家的機器人小圖示 */
.bot-ico { width: 1.05em; height: 1.05em; vertical-align: -0.15em; margin-right: 3px; fill: none; stroke: currentColor;
  stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; opacity: .85; flex: none; }
.bot-ico circle { fill: currentColor; stroke: none; }

/* ---------- 首頁開場動畫（intro.js）：路線一站一站逃竄 → 資料夾滑入、天數跳動、打字、蓋章 ---------- */
#introTrail { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; transition: opacity .8s; }
#introTrail .land { fill: rgba(231,214,178,.05); stroke: rgba(231,214,178,.35); stroke-width: 1.2; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
#introTrail.go .land { animation: introDraw .8s ease-out forwards; }
@keyframes introDraw { to { stroke-dashoffset: 0; } }
#introTrail .dot { fill: rgba(231,214,178,.45); opacity: 0; transition: opacity .3s; }
#introTrail .peak { fill: rgba(231,214,178,.55); opacity: 0; transition: opacity .3s; }
#introTrail.go .dot, #introTrail.go .peak { opacity: 1; }
#introTrail .dot.hit { fill: #f0a08c; r: 3.8; }
#introTrail .peak.hit { fill: #f0a08c; }
#introTrail .bolt { fill: none; stroke-linecap: round; stroke-linejoin: round; }
#introTrail .glow { stroke: rgba(255,70,40,.25); stroke-width: 7; filter: blur(4px); }
#introTrail .mid { stroke: #e2442f; stroke-width: 2; }
#introTrail .core { stroke: #ffd9c8; stroke-width: .7; opacity: .7; }
#introTrail .fork { stroke: #e2442f; stroke-width: .9; opacity: 0; }
#introTrail .fork.on { animation: introFork .5s ease-out forwards; }
@keyframes introFork { 0% { opacity: .5; } 100% { opacity: 0; } }
#introTrail.strike .bolts { animation: introFlicker .45s steps(1) forwards; }
@keyframes introFlicker { 0% { opacity: 1; } 25% { opacity: .65; } 50%, 100% { opacity: 1; } }
#introTrail.settle .core { transition: opacity .6s; opacity: 0; }
#introTrail.settle .glow { transition: opacity .6s; opacity: .6; }
#introTrail .q { font: 900 22px "Noto Serif TC", serif; fill: #ff4b3a; opacity: 0; letter-spacing: 2px; paint-order: stroke; stroke: rgba(10,16,26,.8); stroke-width: 4px; }
#introTrail .q.on { animation: introQ .4s cubic-bezier(.3,1.6,.5,1) forwards; }
@keyframes introQ { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }
#introTrail.dim { opacity: .35; }
#introFlash { position: fixed; inset: 0; background: #ffe9d0; opacity: 0; pointer-events: none; z-index: 2; }
#introFlash.on { animation: introFlash .35s ease-out; }
@keyframes introFlash { 0% { opacity: .08; } 100% { opacity: 0; } }
#home .home-card { z-index: 1; }
#home h1 .n { color: var(--stamp); }
#home.intro .home-card { opacity: 0; }
#home.intro.card-in .home-card { opacity: 1; animation: introFileIn .55s cubic-bezier(.2,.8,.3,1.1) both; }
@keyframes introFileIn { from { transform: translateY(60px) rotate(-3deg); opacity: 0; } to { transform: rotate(var(--card-rot)); opacity: 1; } }
#home.intro .stamp { opacity: 0; }
#home.intro .stamp.slam { animation: introSlam .35s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes introSlam { 0% { opacity: 0; transform: rotate(12deg) scale(2.6); } 70% { opacity: 1; transform: rotate(12deg) scale(.92); } 100% { opacity: 1; transform: rotate(12deg) scale(1); } }
#home.intro .home-card.shake { animation: introShake .18s; }
@keyframes introShake { 0%, 100% { transform: rotate(var(--card-rot)); } 30% { transform: translate(2px,1px) rotate(var(--card-rot)); } 60% { transform: translate(-2px,-1px) rotate(var(--card-rot)); } }
#home.intro h1 .n { display: inline-block; }  /* 寬度由 intro.js 先量好「28」固定住，跳數字時標題不晃、結束時也不位移 */
#home.intro h1 .t span { opacity: 0; }
#home.intro h1 .t span.on { opacity: 1; animation: introKey .12s ease-out; }
@keyframes introKey { from { transform: translateY(-4px); } }
#home.intro .home-card > :not(.folder-tab):not(.stamp):not(h1) { opacity: 0; transition: opacity .4s; }
#home.intro.done .home-card > :not(.folder-tab):not(.stamp):not(h1) { opacity: 1; }

/* 地圖右側「可前往」清單（輪到你時出現；點站名＝地圖移過去，再選交通方式） */
.move-panel { display: none; }
@media all {
  .move-panel:not(.hidden) { display: flex; flex-direction: column; position: absolute; top: 8px; right: 8px; z-index: 5;
    width: 150px; max-height: calc(100% - 190px); min-height: 0; font-family: var(--type);
    background: var(--paper-2); border: 1.5px solid var(--ink); box-shadow: 3px 4px 0 rgba(0,0,0,.25); }
  .move-panel.closed { width: auto; }
  .move-panel.closed .mv-list { display: none; }
  .move-panel .mv-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 8px; font-size: 12px; border: 0;
    border-bottom: 1px dashed var(--paper-edge); background: transparent; box-shadow: none; color: var(--ink-soft); letter-spacing: 1px; }
  .move-panel.closed .mv-head { border-bottom: 0; }
  .move-panel .mv-head b { color: var(--stamp); font-size: 14px; }
  .move-panel .mv-arrow { margin-left: auto; font-size: 16px; }
  .move-panel .mv-list { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .move-panel .mv-row { display: flex; align-items: center; gap: 4px; width: 100%; padding: 6px 6px; border: 0; border-bottom: 1px dotted rgba(107,90,67,.25);
    background: transparent; box-shadow: none; color: inherit; text-align: left; border-radius: 0; letter-spacing: 0; }
  .move-panel .mv-row.on { background: rgba(179,32,29,.12); }
  .move-panel .mv-name { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .move-panel .mv-chips { display: flex; gap: 3px; flex: none; }
  .move-panel .chip { width: 24px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 3px; }
  .move-panel .chip svg { width: 15px; height: 11px; }
  body.night-ui .move-panel { background: #101a27; color: #d6e2ee; border-color: #2bd4c4; }
  body.night-ui .move-panel .mv-head { color: #7f93a8; border-bottom-color: rgba(43,212,196,.3); }
  body.night-ui .move-panel .mv-row { border-bottom-color: rgba(43,212,196,.15); }
  body.night-ui .move-panel .mv-row.on { background: rgba(43,212,196,.15); }
}

/* 觸控裝置：地圖一律不用濾鏡（發光、陰影）。原本拖拉時拿掉、放開又加回，濾鏡一開一關就是看到的閃爍 */
@media (pointer: coarse) {
  #map *, #map .lines, #map .coast-glow { filter: none !important; }
}

/* 手機：交通方式橫條（在能力按鈕上方） */
.move-bar { display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 6px; font-family: var(--type);
  background: var(--paper-2); border: 1.5px solid var(--stamp); box-shadow: 3px 4px 0 rgba(0,0,0,.25); overflow-x: auto; }
.move-bar.hidden { display: none; }
.move-bar .mb-title { flex: none; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.move-bar .mb-title b { color: var(--stamp); }
.move-bar button { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; font-size: 13px; letter-spacing: 0; }
.move-bar button small { color: var(--ink-soft); font-size: 11px; }
.move-bar .chip { width: 22px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.move-bar .chip svg { width: 14px; height: 10px; }
.move-bar .mb-x { margin-left: auto; border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-soft); }
body.night-ui .move-bar { background: #101a27; color: #d6e2ee; border-color: #ff5a6e; }
body.night-ui .move-bar .mb-title, body.night-ui .move-bar button small { color: #7f93a8; }
body.night-ui .move-bar button:not(.mb-x) { background: #16263a; color: #d6e2ee; border-color: rgba(43,212,196,.4); }
/* 標題和 ✕ 一列、票一列，窄螢幕也不會被切掉 */
.move-bar { flex-wrap: wrap; overflow-x: visible; row-gap: 5px; }
.move-bar .mb-title { order: 0; flex: 1 0 calc(100% - 40px); }
.move-bar .mb-x { order: 1; margin-left: 0; padding: 0 4px; }
.move-bar button[data-t] { order: 2; flex: 1 1 0; justify-content: center; white-space: nowrap; }
/* 「輪到你了」等提示永遠在地圖上所有浮動元件之上（可前往清單、行蹤卡、說明框），但不擋點擊 */
.banner { z-index: 15; pointer-events: none; }
@media (min-width: 761px) { .move-panel:not(.hidden) { top: 12px; right: 12px; width: 170px; } }
/* 可前往清單縮小：色塊變小色條、行距與字變小，少佔地圖 */
.move-panel:not(.hidden) { width: auto; min-width: 0; max-width: 150px; }
.move-panel .mv-head { padding: 3px 7px; font-size: 11px; }
.move-panel .mv-head b { font-size: 12px; }
.move-panel .mv-arrow { font-size: 14px; }
.move-panel .mv-row { padding: 3px 7px; gap: 6px; }
.move-panel .mv-name { font-size: 12px; }
.move-panel .mv-chips { gap: 2px; }
.move-panel .chip { width: 12px; height: 9px; border-radius: 2px; box-shadow: none; }
.move-panel .chip svg { display: none; }
@media (min-width: 761px) { .move-panel:not(.hidden) { width: auto; } }
/* 開場結束：資料夾停止所有動畫（否則拿掉震動時滑入動畫會重播一次，看起來像閃一下）；角度和平常一致 */
#home .home-card { --card-rot: -.6deg; }
@media (max-width: 760px) { #home .home-card { --card-rot: 0deg; } }
#home.intro.done .home-card { animation: none; opacity: 1; }
/* 公告：太長就換行，不超出地圖兩側（手機上原本一行到底會被切掉） */
.banner { white-space: normal; width: max-content; max-width: calc(100% - 24px); text-align: center; line-height: 1.45; }
@media (max-width: 760px) { .banner { padding: 6px 12px; font-size: 13px; letter-spacing: .5px; } }

/* 台鐵站更醒目：上半部改深紫、外框紫色、站名往下移讓紫色露出更多 */
.node.tra { --tra-mark: #6247cf; }
.board .node.tra { --tra-mark: #36208f; }
.node.tra .mk.top { fill: var(--tra-mark); }
.node.tra .body { stroke: var(--tra-mark); stroke-width: 1.6; }
.node.tra .num { dominant-baseline: central; transform: translateY(.6px); }

/* 結束畫面：重播前先停幾秒，地圖變暗、蓋上「結案／懸案」章 */
#game .over-box .end-stamp { display: none; }
#game .over-box.ending { box-shadow: 0 0 0 100vmax rgba(3,6,12,.6), 0 20px 50px rgba(0,0,0,.6); padding-top: 22px; }
#game .over-box.ending .end-stamp { display: block; position: absolute; top: -26px; right: -18px; padding: 2px 12px;
  font-family: var(--serif); font-weight: 900; font-size: 30px; letter-spacing: 6px; color: #ff4b3a; border: 4px double #ff4b3a;
  background: rgba(10,16,26,.85); transform: rotate(12deg); animation: endSlam .45s .35s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes endSlam { 0% { opacity: 0; transform: rotate(12deg) scale(2.8); } 70% { opacity: 1; transform: rotate(12deg) scale(.92); } 100% { opacity: 1; transform: rotate(12deg) scale(1); } }
#game .over-box.ending { animation: endIn .4s ease-out both; }
@keyframes endIn { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
#game .over-box.ending[data-slammed] .end-stamp, #game .over-box.ending[data-slammed] { animation: none; }

/* 夜間地圖：淡淡的等高線（不影響閱讀；桌遊版不畫） */
.contours .ct { fill: none; stroke: rgba(150,195,230,.09); stroke-width: 1; stroke-linejoin: round; }
.contours .ct.major { stroke: rgba(150,195,230,.15); }
.board .contours { display: none; }
/* 夜間地圖改用真實等高線，拿掉原本沿中央山脈的示意暗色帶（桌遊版沒有等高線，保留綠色山帶） */
.map-wrap:not(.board) .ridge { display: none; }

/* 桌遊版：疊一層淡淡的舊紙質感（粗細一致的橫向纖維＋暈開的水漬），不擋點擊 */
.map-wrap.board::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .32; mix-blend-mode: multiply;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .55' numOctaves='1' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .3 0 0 0 0 .14 .55 0 0 0 -.22'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='700'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008' numOctaves='4' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .36 0 0 0 0 .16 1 0 0 0 -.5'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 260px 260px, 700px 700px; }
