/* ===== 全臺通緝令：戰情室風格 ===== */
:root {
  --bg: #0a0e14;
  --panel: #111823;
  --card: #151e2b;
  --line: #233044;
  --text: #e6edf6;
  --muted: #8796ab;
  --accent: #4cc3ff;
  --accent-2: #1e88e5;
  --gold: #ffb224;
  --red: #ff4d4f;
  --green: #3ddc84;
  --paper: #f3ead7;
  --ink: #1d1a16;
  --sans: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  --serif: "Noto Serif TC", "PMingLiU", serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
.mono { font-family: var(--mono); }

/* ----- 按鈕 ----- */
.btn {
  border: 1px solid var(--line); background: #1a2536; color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-weight: 500; transition: background .15s, border-color .15s, transform .05s;
}
.btn:not(:disabled):hover { border-color: var(--accent); background: #1f2d42; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #2b9bf0, #1e6fd0); border-color: #2b9bf0; color: #fff; font-weight: 700; }
.btn.primary:not(:disabled):hover { background: linear-gradient(180deg, #45acf5, #2a7fe0); }
.btn.big { padding: 12px 22px; font-size: 16px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #141c28; font-size: 16px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

/* ----- HUD ----- */
.hud {
  display: flex; align-items: center; gap: 18px; padding: 8px 16px;
  background: linear-gradient(180deg, #0f1724, #0b111a); border-bottom: 1px solid var(--line);
  position: relative; z-index: 1100;
}
.hud::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--red), transparent 30%, transparent 70%, var(--accent-2)); opacity: .7; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 18px; letter-spacing: 2px; white-space: nowrap; }
.badge { width: 32px; height: 32px; display: grid; place-items: center; background: #1b2840; border-radius: 8px; }
.hud-case { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hud-case .mug { font-size: 22px; width: 34px; height: 34px; display: grid; place-items: center; border: 1px dashed var(--red); border-radius: 8px; background: #1a1215; }
.hud-case .who { display: flex; flex-direction: column; line-height: 1.2; }
.hud-case small { color: var(--red); font-size: 11px; font-weight: 700; }
.hud-stat { display: flex; flex-direction: column; gap: 4px; min-width: 70px; }
.hud-stat.wide { min-width: 150px; }
.hud-stat label { font-size: 11px; color: var(--muted); letter-spacing: 1px; white-space: nowrap; }
.hud-stat label b { color: var(--text); font-family: var(--mono); font-size: 13px; margin-left: 4px; }
.hud-stat #clock { font-size: 15px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.meter { height: 7px; background: #1c2635; border-radius: 4px; overflow: hidden; }
.meter > div { height: 100%; width: 100%; background: var(--green); transition: width .5s, background .3s; }
.meter > div.warn { background: var(--gold); }
.meter > div.danger { background: var(--red); box-shadow: 0 0 10px var(--red); }
.meter.alert > div { background: linear-gradient(90deg, #3ddc84, #ffb224 60%, #ff4d4f); background-size: 150px 100%; }
.meter.alert > div.danger { animation: pulse 1s infinite; }
#blocks { font-size: 15px; letter-spacing: 2px; }
.hud-tools { margin-left: auto; display: flex; gap: 6px; }

/* ----- 版面 ----- */
.layout { flex: 1; display: grid; grid-template-columns: 1fr 440px; min-height: 0; }
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #0b0f15; }
.panel { overflow-y: auto; padding: 12px; background: var(--panel); border-left: 1px solid var(--line); }
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: #243246; border-radius: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h3 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: 1px; }
.live { font-size: 10px; color: var(--red); font-weight: 700; letter-spacing: 1px; animation: blink 1.4s infinite; }

.here { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.here b { font-size: 22px; font-weight: 900; }
.here small { color: var(--muted); }
.status { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: #1a2433; color: var(--muted); margin-bottom: 10px; border-left: 3px solid var(--line); }
.status.warm { color: #ffd88a; border-left-color: var(--gold); background: #2a2213; }
.status.cold { color: #9fb0c6; border-left-color: #4b5b70; }
.status.alarm { color: #fff; background: #4a1218; border-left-color: var(--red); font-weight: 700; animation: alarmbg 1s infinite; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.act {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left;
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: #1a2536;
}
.act .ico { grid-row: span 2; font-size: 22px; }
.act span:nth-child(2) { font-size: 13px; font-weight: 700; }
.act small { color: var(--muted); font-size: 11px; }
.act:not(:disabled):hover { border-color: var(--accent); background: #1f2d42; }
.tools { margin-bottom: 8px; }
.tools .btn { font-size: 13px; }
.raid { width: 100%; border-color: #6b2a2e; color: #ff8a8c; font-weight: 700; background: #1f1518; }
.raid.ready { background: linear-gradient(180deg, #ff4d4f, #c62828); color: #fff; border-color: var(--red); animation: pulse 1s infinite; }

select { width: 100%; padding: 9px; border-radius: 10px; border: 1px solid var(--line); background: #0f1620; color: var(--text); font: inherit; margin-bottom: 10px; }
.travel .dest { margin-bottom: 10px; }
.travel .dest b { font-size: 18px; margin-right: 6px; }
.travel .dest small { color: var(--muted); }
.plan { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.plan span { font-size: 12px; padding: 3px 8px; background: #0f1620; border: 1px solid var(--line); border-radius: 999px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

.notes, .log { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.notes li { padding: 9px 10px; border-left: 3px solid var(--accent); background: #0f1620; border-radius: 8px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.55; }
.notes li.dead { border-left-color: #4b5b70; color: var(--muted); }
.notes li.empty { border-left-color: var(--line); color: var(--muted); font-size: 13px; }
.notes li small { color: var(--muted); font-size: 11px; }
.log li { font-family: var(--mono), var(--sans); font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed #1f2a3a; color: #b8c6d8; line-height: 1.5; }
.log li.hot { color: #ffd88a; }
.log li.alarm { color: #ff8a8c; font-weight: 700; }

/* ----- 地圖元素 ----- */
.leaflet-container { font-family: var(--sans); background: #0b0f15; }
.dark-tiles { filter: invert(1) hue-rotate(185deg) brightness(.82) contrast(.92) saturate(.55); }
.pin-wrap { background: none; border: none; }
.pin { position: relative; width: 14px; height: 14px; }
.pin i { position: absolute; inset: 0; border-radius: 50%; background: #ff6b6e; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(255,107,110,.25); }
.pin span {
  position: absolute; left: 18px; top: -3px; white-space: nowrap; font-size: 12px; font-weight: 700; color: #e6edf6;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 6px #000; pointer-events: none;
}
.pin b { display: none; position: absolute; left: -6px; top: -20px; font-size: 14px; }
.pin.blocked b { display: block; }
.pin.visited i { background: #6b7a90; box-shadow: none; }
.pin.selected i { background: var(--gold); box-shadow: 0 0 0 5px rgba(255,178,36,.35); }
.pin.selected span { color: var(--gold); }
.pin.current i { background: var(--accent); box-shadow: 0 0 0 0 rgba(76,195,255,.7); animation: ping 1.6s infinite; }
.pin.current span { color: var(--accent); font-size: 13px; }
.car-icon { font-size: 22px; filter: drop-shadow(0 0 6px rgba(76,195,255,.9)); background: none; border: none; }
.raid-pin {
  background: #fff; border: 3px solid var(--gold); border-radius: 50%; display: grid !important; place-items: center;
  font-size: 22px; box-shadow: 0 0 0 6px rgba(255,178,36,.25), 0 4px 14px rgba(0,0,0,.5); animation: ping-gold 1.2s infinite;
}
.raid-pin em { position: absolute; top: 52px; white-space: nowrap; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: rgba(0,0,0,.75); padding: 2px 8px; border-radius: 999px; }
.trail-line { filter: drop-shadow(0 0 4px rgba(76,195,255,.8)); }
.leaflet-control-attribution { background: rgba(10,14,20,.7) !important; color: #8796ab !important; }
.leaflet-control-attribution a { color: #a9c4e0 !important; }
.leaflet-bar a { background: #151e2b !important; color: var(--text) !important; border-color: var(--line) !important; }

.legend { position: absolute; right: 10px; bottom: 26px; z-index: 500; display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--muted); background: rgba(10,14,20,.8); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.legend span { display: flex; align-items: center; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.current { background: var(--accent); } .dot.visited { background: #6b7a90; } .dot.selected { background: var(--gold); }

.raid-overlay {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 800; pointer-events: none;
  text-align: center; background: rgba(40,6,10,.85); border: 2px solid var(--red); border-radius: 16px; padding: 8px 28px;
  box-shadow: 0 0 30px rgba(255,77,79,.5);
}
.raid-overlay[hidden] { display: none; }
.raid-label { font-weight: 900; letter-spacing: 3px; color: #ff8a8c; font-size: 13px; }
.raid-count { font-family: var(--mono); font-size: 54px; font-weight: 900; line-height: 1; color: #fff; }
.raid-sub { font-size: 12px; color: #ffc9ca; }
.raid-overlay.urgent .raid-count { color: var(--red); animation: shake .3s infinite; }

/* ----- 危急特效 ----- */
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1500; opacity: 0; transition: opacity .4s;
  box-shadow: inset 0 0 120px 30px rgba(255,0,20,.55); }
body.danger .vignette, body.raiding .vignette { opacity: 1; animation: vig 1.2s infinite; }
body.flash .vignette { animation: flash 1s 1; opacity: 0; }

/* ----- 對話框 ----- */
.modal { position: fixed; inset: 0; background: rgba(3, 6, 12, .78); backdrop-filter: blur(3px); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; z-index: 2000; padding: 16px; overflow-y: auto; }
.modal[hidden] { display: none; }
/* 內容比畫面高時從頂端開始、可捲動；矮的內容仍置中 */
.modal { align-items: start; }
.modal > * { margin-block: auto; }
.dialog { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; max-width: 600px; width: 100%; max-height: 92vh; overflow-y: auto; line-height: 1.7; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.dialog h2 { margin-top: 0; }
.rules li { margin-bottom: 8px; }
.rules ul { padding-left: 18px; margin: 4px 0; color: #c4d0e0; font-size: 14px; }

.title-screen { text-align: center; max-width: 680px; background: radial-gradient(circle at 50% 0%, #1c2a42, var(--card) 70%); }
.title-screen h1 { font-family: var(--serif); font-size: 52px; margin: 4px 0; letter-spacing: 8px; text-shadow: 0 0 24px rgba(76,195,255,.4); }
.stamp-badge { display: inline-block; border: 2px solid var(--red); color: var(--red); padding: 2px 12px; border-radius: 6px; font-weight: 900; letter-spacing: 4px; transform: rotate(-4deg); font-size: 13px; }
.tagline { color: var(--accent); font-weight: 700; margin: 6px 0 12px; }
.lead { color: #c4d0e0; text-align: left; }
.career { color: var(--gold); font-size: 14px; }
.diffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.diffs button { display: flex; flex-direction: column; gap: 3px; padding: 16px 10px; border-radius: 14px; border: 1px solid var(--line); background: #0f1620; transition: all .15s; }
.diffs button b { font-size: 17px; }
.diffs button small { color: var(--accent); font-weight: 700; }
.diffs button em { font-style: normal; font-size: 11px; color: var(--muted); }
.diffs button:hover { border-color: var(--red); background: #1d1418; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,77,79,.2); }
.disclaimer { font-size: 12px; color: var(--muted); }

.event { max-width: 460px; border-color: var(--gold); text-align: center; }
.event h2 { color: var(--gold); }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ----- 通緝海報 ----- */
.poster {
  background: var(--paper); color: var(--ink); width: 100%; max-width: 520px; border-radius: 4px; padding: 22px 26px 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 0 80px rgba(120,80,30,.25); position: relative;
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.015) 0 2px, transparent 2px 4px);
  animation: drop .35s ease-out;
}
.poster-top { text-align: center; border-bottom: 3px double var(--ink); padding-bottom: 6px; margin-bottom: 14px; }
.poster-org { font-size: 13px; letter-spacing: 6px; font-weight: 700; }
.poster-title { font-family: var(--serif); font-size: 76px; font-weight: 900; line-height: 1; color: #b3171c; letter-spacing: 24px; padding-left: 24px; }
.poster-body { display: flex; gap: 16px; }
.mugshot { flex: 0 0 140px; height: 160px; background: #d9ceb6; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 84px; position: relative; overflow: hidden; }
.poster-info { flex: 1; min-width: 0; }
.pname { font-family: var(--serif); font-size: 30px; font-weight: 900; }
.palias { font-size: 14px; margin-bottom: 6px; }
.poster-info dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 14px; }
.poster-info dt { font-weight: 900; }
.poster-info dd { margin: 0; }
.poster-info ul { margin: 0; padding-left: 16px; }
.poster-intro { font-size: 14px; line-height: 1.7; min-height: 72px; margin: 14px 0 8px; border-top: 1px solid rgba(0,0,0,.3); padding-top: 10px; }
.reward { text-align: center; font-size: 16px; font-weight: 700; border: 2px solid var(--ink); padding: 6px; }
.reward b { color: #b3171c; font-size: 22px; font-family: var(--serif); }
.poster-diff { text-align: center; font-size: 12px; margin: 8px 0 12px; color: #5b5244; }
.poster-actions .btn.ghost-dark { background: transparent; color: var(--ink); border-color: rgba(0,0,0,.35); }
.poster-actions .btn.ghost-dark:hover { background: rgba(0,0,0,.06); border-color: var(--ink); }
.poster-actions .btn.big { flex: 1.6; }
.poster-note { text-align: center; font-size: 10px; color: #8a7f6c; margin-top: 8px; }

/* ----- 報紙 ----- */
.newspaper {
  background: var(--paper); color: var(--ink); width: 100%; max-width: 780px; padding: 22px 28px 20px; border-radius: 3px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 0 90px rgba(120,80,30,.22); max-height: 94vh; overflow-y: auto;
  animation: spin-in .6s cubic-bezier(.2,.8,.2,1);
}
.masthead { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 4px double var(--ink); padding-bottom: 6px; font-size: 12px; }
.masthead h1 { font-family: var(--serif); font-size: 46px; margin: 0; letter-spacing: 10px; line-height: 1; }
.kicker { margin-top: 14px; display: inline-block; background: #b3171c; color: #fff; font-weight: 900; padding: 2px 10px; letter-spacing: 2px; }
.headline { font-family: var(--serif); font-size: 36px; line-height: 1.25; margin: 6px 0 12px; font-weight: 900; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; border-top: 1px solid var(--ink); padding-top: 12px; }
.article p { font-size: 14.5px; line-height: 1.85; margin: 0 0 8px; text-align: justify; }
.photo { float: left; width: 110px; height: 120px; margin: 0 12px 6px 0; background: #d9ceb6; border: 2px solid var(--ink); position: relative; display: grid; place-items: center; }
.photo .f { font-size: 64px; filter: grayscale(1) contrast(1.2); }
.photo .tag { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%) rotate(-10deg); border: 3px solid #b3171c; color: #b3171c; font-weight: 900; padding: 0 6px; font-size: 16px; background: rgba(243,234,215,.8); white-space: nowrap; }
.photo.escaped .tag { border-color: #333; color: #333; }
.score { font-size: 18px !important; border-top: 1px dashed var(--ink); padding-top: 8px; }
.score b { color: #b3171c; font-family: var(--serif); font-size: 26px; }
.sidebar { border-left: 1px solid var(--ink); padding-left: 16px; }
.sidebar h3 { margin: 0 0 8px; font-family: var(--serif); }
.sidebar ul { list-style: none; padding: 0; margin: 0; font-size: 13px; line-height: 1.6; }
.sidebar li { padding: 6px 0; border-bottom: 1px dotted rgba(0,0,0,.35); }
.paper-foot { clear: both; margin-top: 12px; border-top: 3px double var(--ink); padding-top: 8px; font-size: 12px; color: #5b5244; text-align: center; }
.newspaper > .btn { display: block; margin: 14px auto 0; }

/* ----- 動畫 ----- */
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(76,195,255,.7); } 100% { box-shadow: 0 0 0 14px rgba(76,195,255,0); } }
@keyframes ping-gold { 0% { box-shadow: 0 0 0 0 rgba(255,178,36,.7); } 100% { box-shadow: 0 0 0 18px rgba(255,178,36,0); } }
@keyframes pulse { 50% { filter: brightness(1.35); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes alarmbg { 50% { background: #6b151d; } }
@keyframes vig { 50% { opacity: .45; } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes drop { from { transform: translateY(-30px) rotate(-2deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin-in { from { transform: scale(.2) rotate(-200deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ----- 全螢幕警報（桌機、手機共用） ----- */
.alarm-screen { position: fixed; inset: 0; z-index: 1900; pointer-events: none; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(255,40,50,.35), rgba(120,0,10,.75)); animation: alarm-in 1.8s ease-out forwards; }
.alarm-screen[hidden] { display: none; }
.alarm-screen div { font-size: clamp(26px, 6vw, 54px); font-weight: 900; color: #fff; text-align: center; padding: 0 20px; letter-spacing: 2px;
  text-shadow: 0 0 20px #ff1a2a, 0 2px 0 #000; animation: shake .25s 4; }
@keyframes alarm-in { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* 手機專用元件：桌機隱藏 */
.m-ticker, .m-chip, .m-bubble, .m-trip, .m-hotbar, .m-more, .drawer-head, .drawer-bg { display: none; }

/* ----- 手機版：全螢幕地圖 + 浮動操作 ----- */
@media (max-width: 900px) {
  :root { --hud-h: 52px; --bar-h: 64px; }
  body { overflow: hidden; height: 100dvh; }

  /* 單行 HUD */
  .hud { height: var(--hud-h); gap: 10px; padding: 6px 10px; flex-wrap: nowrap; }
  .brand, .hud-case .who, .stat-time label, .stat-blocks label, #help-btn { display: none; }
  .hud-case .mug { width: 30px; height: 30px; font-size: 18px; }
  .hud-stat { min-width: 0; gap: 3px; }
  .hud-stat.wide { min-width: 0; flex: 1; }
  .hud-stat #clock { font-size: 12px; line-height: 1.1; white-space: normal; width: 44px; }
  .stat-escape label, .stat-alert label { font-size: 0; }
  .stat-escape label b, .stat-alert label b { font-size: 12px; margin: 0; }
  .stat-escape label::before { content: "⏱️"; font-size: 12px; margin-right: 2px; }
  .stat-alert label::before { content: "🔥"; font-size: 12px; margin-right: 2px; }
  .meter { height: 5px; }
  #blocks { font-size: 12px; letter-spacing: 0; white-space: nowrap; }
  .icon-btn { width: 32px; height: 32px; font-size: 14px; }

  .layout { display: block; height: calc(100dvh - var(--hud-h)); }
  .map-wrap { position: absolute; top: var(--hud-h); left: 0; right: 0; bottom: 0; }
  .legend, .leaflet-control-zoom { display: none; }
  .leaflet-bottom { bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  .pin span { font-size: 11px; }

  /* 無線電跑馬燈 */
  .m-ticker { display: flex; align-items: center; gap: 6px; position: absolute; top: 8px; left: 8px; right: 8px; z-index: 600;
    background: rgba(10,14,20,.88); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; text-align: left;
    font-size: 12.5px; color: #cfdbe9; font-family: var(--mono), var(--sans); backdrop-filter: blur(4px); }
  .m-ticker #ticker-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; min-width: 0; }
  .m-ticker.hot { border-color: var(--gold); color: #ffd88a; }
  .m-ticker.alarm { border-color: var(--red); color: #fff; background: rgba(90,10,18,.92); }

  /* 位置與足跡 */
  .m-chip { display: block; position: absolute; top: 50px; left: 8px; z-index: 600; max-width: calc(100% - 16px);
    background: rgba(10,14,20,.88); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; backdrop-filter: blur(4px); }
  .m-chip b { font-size: 14px; margin-right: 6px; }
  .m-chip.warm { border-color: var(--gold); color: #ffd88a; }
  .m-chip.cold { color: #9fb0c6; }
  .m-chip.alarm { border-color: var(--red); background: rgba(90,10,18,.92); color: #fff; animation: alarmbg 1s infinite; }
  body.raiding .m-chip, body.raiding .m-ticker { display: none; }

  /* 線索泡泡 */
  .m-bubble { display: flex; flex-direction: column; gap: 4px; position: absolute; left: 50%; top: 92px; transform: translateX(-50%);
    width: min(88%, 420px); z-index: 650; background: #f3ead7; color: var(--ink); border-radius: 16px; padding: 12px 14px 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,.55); border-left: 5px solid var(--accent-2); animation: pop .25s ease-out; }
  .m-bubble[hidden] { display: none; }
  .m-bubble::after { content: ""; position: absolute; left: 28px; bottom: -10px; border: 10px solid transparent; border-top-color: #f3ead7; border-bottom: 0; }
  .m-bubble.dead { border-left-color: #6b7a90; }
  .m-bubble small { font-size: 11px; color: #6b604f; font-weight: 700; }
  .m-bubble span { font-size: 15.5px; line-height: 1.6; font-weight: 500; }
  .m-bubble em { font-style: normal; font-size: 10px; color: #9a8f7c; text-align: right; }

  /* 行程卡 */
  .m-trip { display: block; position: absolute; left: 8px; right: 8px; bottom: calc(var(--bar-h) + 10px + env(safe-area-inset-bottom)); z-index: 650;
    background: rgba(17,24,35,.97); border: 1px solid var(--gold); border-radius: 16px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: slide-up .2s ease-out; }
  .m-trip[hidden] { display: none; }
  .m-trip .dest { margin-bottom: 10px; }
  .m-trip .dest b { font-size: 19px; margin-right: 6px; }
  .m-trip .dest small { color: var(--muted); }
  .m-trip .row .btn { padding: 11px; }

  /* 底部快捷列 */
  .m-hotbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1150; height: calc(var(--bar-h) + env(safe-area-inset-bottom));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 4px; background: linear-gradient(180deg, #111926, #0b111a); border-top: 1px solid var(--line); }
  .m-hotbar button { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    border: 1px solid var(--line); background: #172131; border-radius: 12px; padding: 0; }
  .m-hotbar button span { font-size: 21px; line-height: 1; }
  .m-hotbar button small { font-size: 10px; color: var(--muted); white-space: nowrap; }
  .m-hotbar button.done { opacity: .35; }
  .m-hotbar button.done::after { content: "✔"; position: absolute; top: 2px; right: 5px; font-size: 10px; color: var(--green); }
  .m-hotbar button:not(:disabled):active { transform: scale(.94); background: #1f2d42; }
  .m-hotbar .hb-raid { flex: 1.3; border-color: #6b2a2e; background: #1f1518; }
  .m-hotbar .hb-raid small { color: #ff8a8c; font-weight: 700; }
  .m-hotbar .hb-raid.ready { background: linear-gradient(180deg, #ff4d4f, #c62828); border-color: var(--red); animation: pulse .8s infinite; }
  .m-hotbar .hb-raid.ready small { color: #fff; }
  #badge { position: absolute; top: 3px; right: 6px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  #badge[hidden] { display: none; }

  .m-more { display: flex; flex-direction: column; position: fixed; right: 8px; bottom: calc(var(--bar-h) + 8px + env(safe-area-inset-bottom)); z-index: 1160;
    background: #151e2b; border: 1px solid var(--line); border-radius: 14px; padding: 6px; min-width: 200px; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: slide-up .15s ease-out; }
  .m-more[hidden] { display: none; }
  .m-more button { text-align: left; background: none; border: 0; padding: 12px; border-radius: 10px; font-size: 15px; }
  .m-more button:not(:disabled):active { background: #1f2d42; }

  /* 抽屜：筆記／無線電／目的地 */
  .drawer-bg { display: block; position: fixed; inset: 0; z-index: 1190; background: rgba(0,0,0,.5); }
  .drawer-bg[hidden] { display: none; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200; height: 72dvh; border-left: none; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); overflow-y: auto;
    transform: translateY(105%); transition: transform .25s ease; box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
  .panel.open { transform: none; }
  .drawer-head { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 2; background: var(--panel); padding: 16px 0 10px; }
  .drawer-head .grip { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 2px; background: #33445c; }
  .drawer-head .tabs { flex: 1; display: flex; gap: 6px; }
  .drawer-head .tabs button { flex: 1; border: 1px solid var(--line); background: #172131; border-radius: 10px; padding: 8px 4px; font-size: 13px; }
  .panel[data-tab="notes"] .tabs [data-tab="notes"], .panel[data-tab="log"] .tabs [data-tab="log"], .panel[data-tab="dest"] .tabs [data-tab="dest"] { border-color: var(--accent); color: var(--accent); background: #13263a; }
  .panel .card { display: none; }
  .panel[data-tab="notes"] [data-sec="notes"], .panel[data-tab="log"] [data-sec="log"], .panel[data-tab="dest"] [data-sec="dest"] { display: block; }
  .panel .card-head { display: none; }
  .notes, .log { max-height: none; }

  .diffs { grid-template-columns: 1fr; }
  .title-screen h1 { font-size: 38px; }
  .cols { grid-template-columns: 1fr; }
  .sidebar { border-left: none; padding-left: 0; border-top: 1px solid var(--ink); padding-top: 10px; }
  .headline { font-size: 26px; }
  .masthead h1 { font-size: 30px; letter-spacing: 4px; }
  .poster-title { font-size: 56px; }
  .mugshot { flex-basis: 110px; height: 130px; font-size: 64px; }
  .poster-actions { flex-wrap: wrap; }
  .raid-overlay { top: 10px; padding: 6px 22px; }
  .raid-count { font-size: 44px; }
}
/* 手機：照片旁只放姓名／綽號／基本資料，案由等清單改成整列，避免照片下方空白 */
@media (max-width: 560px) {
  .poster-body { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; align-items: center; }
  .poster-info { display: contents; }
  .poster-id { grid-column: 2; grid-row: 1; min-width: 0; }
  .poster-info dl { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 360px) {
  .m-hotbar button small { display: none; }
}
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== v2：包圍網、目擊者、監視器、警官檔案 ===== */
.pin.hot { transform: scale(1.35); z-index: 5; }
.pin.hot i { background: #ff2d55; border-color: #fff; animation: hotpin 1s infinite; }
.pin.hot span { color: #fff; background: #d1153b; padding: 0 6px; border-radius: 6px; text-shadow: none; box-shadow: 0 0 10px rgba(255,45,85,.7); }
.pin.hot span::before { content: "🎯 "; }
.pin.current.hot i, .pin.selected.hot i { animation: hotpin 1s infinite; }
@keyframes hotpin { 0% { box-shadow: 0 0 0 0 rgba(255,45,85,.8); } 100% { box-shadow: 0 0 0 16px rgba(255,45,85,0); } }
.net-badge { position: absolute; top: 12px; right: 12px; z-index: 600; background: rgba(60,8,18,.9); border: 1px solid #ff2d55; color: #fff;
  font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px; box-shadow: 0 0 18px rgba(255,45,85,.4); pointer-events: none; }
.net-badge[hidden] { display: none; }
body.raiding .net-badge { display: none; }
.hot-tag { font-style: normal; font-size: 12px; color: #ff8aa0; font-weight: 700; margin-left: 6px; }
.budget { font-size: 12.5px; color: var(--accent); margin-bottom: 8px; }
.budget b { font-size: 15px; }
.budget.empty { color: var(--muted); }
.chip-budget { font-style: normal; font-size: 11px; color: var(--accent); margin-right: 6px; }

/* 標題畫面模式 */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.modes button { display: flex; flex-direction: column; gap: 3px; padding: 12px 10px; border-radius: 14px; border: 1px dashed #3a4c66; background: #0d141d; transition: all .15s; }
.modes button b { font-size: 14px; }
.modes button small { font-size: 11px; color: var(--muted); }
.modes button:hover { border-style: solid; border-color: var(--gold); transform: translateY(-2px); }
.modes button.glow { border: 1px solid var(--gold); box-shadow: 0 0 16px rgba(255,178,36,.35); animation: pulse 1.6s infinite; }
.modes button.glow small { color: var(--gold); }

/* 目擊者 */
.witness { max-width: 480px; border-color: var(--accent); }
.wit-card { display: flex; gap: 14px; align-items: center; background: #0f1620; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.wit-face { font-size: 54px; width: 76px; height: 76px; display: grid; place-items: center; background: #1a2536; border-radius: 50%; flex: none; }
.wit-role { font-weight: 900; font-size: 17px; }
.mood { font-size: 13.5px; color: #b8c6d8; margin-top: 4px; }
.mood.sus { color: #ffb224; font-weight: 700; }
.wit-hint { font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.witness .choices .btn { text-align: left; }

/* 監視器比對 */
.cctv { max-width: 720px; border-color: var(--red); }
.cctv-head { display: flex; align-items: center; justify-content: space-between; }
.cctv-head h2 { margin: 0; }
.cctv-timer { font-family: var(--mono); font-size: 20px; color: #ff8a8c; }
.cctv-timer b { font-size: 30px; color: #fff; }
.cctv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 12px; }
.cam { position: relative; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid #2a3a50; background: #05080c;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px); }
.cam:hover { border-color: var(--gold); }
.cam.wrong { border-color: var(--red); opacity: .5; }
.cam-id { font-family: var(--mono); font-size: 10px; color: #3ddc84; letter-spacing: 1px; }
.cam-face { display: block; text-align: center; font-size: 40px; filter: grayscale(1) blur(1.5px) contrast(1.3); margin: 4px 0; }
.cam ul { margin: 0; padding-left: 16px; font-size: 12px; line-height: 1.5; color: #c4d0e0; }
.cctv-traits { background: var(--paper); color: var(--ink); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-top: 8px; }
.cctv-traits[hidden] { display: none; }
.cctv-traits b { color: #b3171c; }

/* 警官檔案 */
.pf-head { background: #0f1620; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14px; }
.pf-head b { color: var(--gold); }
.pf-head small { color: var(--muted); }
.xpbar { height: 8px; background: #1c2635; border-radius: 4px; overflow: hidden; margin: 8px 0 6px; }
.xpbar div { height: 100%; background: linear-gradient(90deg, #ffb224, #ffd88a); }
.skills { display: grid; gap: 8px; margin: 10px 0 14px; }
.skill { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #141c28; }
.skill:not(:disabled):hover { border-color: var(--gold); }
.skill .sk-ico { font-size: 26px; }
.skill .sk-txt { flex: 1; display: flex; flex-direction: column; }
.skill .sk-txt small { color: var(--muted); font-size: 12px; }
.skill em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.skill.own { border-color: #2c6b48; background: #0f1d16; opacity: 1; }
.skill.own em { color: var(--green); }
.saga-line { background: rgba(179,23,28,.08); border-left: 3px solid #b3171c; padding: 6px 10px; }
.xp-line { font-size: 13px !important; color: #5b5244; }
.xp-line b { color: #b3171c; }

@media (max-width: 900px) {
  .net-badge { top: auto; bottom: calc(var(--bar-h) + 12px + env(safe-area-inset-bottom)); right: 8px; font-size: 12px; }
  body:has(#trip:not([hidden])) .net-badge { display: none; }
  .modes { grid-template-columns: 1fr; }
  .cctv-grid { grid-template-columns: repeat(2, 1fr); }
  .cam-face { font-size: 30px; }
  .cam ul { font-size: 11px; }
}

/* v3：地點描述 */
.here-desc { margin: -4px 0 8px; font-size: 13px; line-height: 1.55; color: var(--muted); font-style: italic; }
.here-desc:empty { display: none; }

/* v4：新手教學 */
.tut-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; margin: 0 0 12px; padding: 12px; border-radius: 14px;
  border: 1px dashed #3a4c66; background: #0d141d; transition: all .15s; }
.tut-btn b { font-size: 15px; }
.tut-btn small { font-size: 12px; color: var(--muted); }
.tut-btn:hover { border-style: solid; border-color: var(--gold); }
.tut-btn.glow { border: 1px solid var(--gold); box-shadow: 0 0 16px rgba(255,178,36,.35); animation: pulse 1.6s infinite; }
.tut-btn.glow small { color: var(--gold); }
.coach { position: fixed; left: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); z-index: 2100;
  background: #f3ead7; color: var(--ink); border-radius: 16px; padding: 12px 14px; box-shadow: 0 12px 36px rgba(0,0,0,.6);
  border-left: 6px solid var(--gold); animation: pop .25s ease-out; }
.coach[hidden] { display: none; }
.coach.final { border-left-color: #2fbf71; }
.coach-head { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 6px; }
.coach-face { font-size: 20px; }
.coach-head small { color: #6b604f; font-weight: 700; }
.coach-skip { margin-left: auto; background: none; border: none; color: #8a7d68; font-size: 12px; cursor: pointer; }
#coach-text { margin: 0; font-size: 14.5px; line-height: 1.65; }
#coach-next { margin-top: 10px; width: 100%; }
.tut-hl { outline: 3px solid var(--gold) !important; outline-offset: 2px; animation: tuthl 1.1s ease-in-out infinite; }
@keyframes tuthl { 50% { outline-color: rgba(255,178,36,.25); box-shadow: 0 0 22px rgba(255,178,36,.6); } }
@media (max-width: 900px) {
  .coach { left: 8px; right: 8px; width: auto; top: 8px; bottom: auto; padding: 10px 12px; }
  #coach-text { font-size: 13.5px; line-height: 1.55; }
  .coach-face { font-size: 17px; }
}

/* ===== v5：嫌犯簡訊、抵達轉場、抓捕追逐、逮捕慢動作 ===== */
.sms { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); z-index: 1950; width: min(360px, calc(100vw - 24px));
  background: rgba(247,245,239,.97); color: #111; border-radius: 16px; padding: 10px 14px 12px; box-shadow: 0 14px 40px rgba(0,0,0,.55);
  border-left: 6px solid #ff2a3d; animation: sms-in .35s cubic-bezier(.2,1.3,.4,1) both; pointer-events: none; }
.sms[hidden] { display: none; }
.sms-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sms-head span { font-size: 22px; filter: grayscale(.4); }
.sms-head small { margin-left: auto; color: #777; font-size: 11px; }
.sms p { margin: 4px 0 0; font-size: 15px; font-weight: 700; line-height: 1.5; }
@keyframes sms-in { from { transform: translate(-50%, -30px); opacity: 0; } }
@media (max-width: 900px) { .sms { top: 96px; } }

.arrive { position: fixed; inset: 0; z-index: 1800; pointer-events: none; overflow: hidden; display: grid; place-items: center; animation: ar-out 1.5s forwards; }
.arrive[hidden] { display: none; }
.ar-tape { position: absolute; left: -20%; width: 140%; height: 40px; background: #ffd400; border-top: 3px solid #0b0b0d; border-bottom: 3px solid #0b0b0d;
  display: flex; align-items: center; white-space: nowrap; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,.5); }
.ar-tape span { font-family: "Bebas Neue", "Noto Sans TC", sans-serif; font-weight: 900; font-size: 22px; letter-spacing: 3px; color: #0b0b0d; }
.ar-tape.a1 { top: 38%; transform: rotate(-8deg); animation: ar-l .45s cubic-bezier(.2,.9,.2,1) both; }
.ar-tape.a2 { top: 56%; transform: rotate(6deg); animation: ar-r .45s .08s cubic-bezier(.2,.9,.2,1) both; }
@keyframes ar-l { from { transform: translateX(-110%) rotate(-8deg); } }
@keyframes ar-r { from { transform: translateX(110%) rotate(6deg); } }
.ar-name { position: relative; background: #0b0b0d; color: #f7f5ef; padding: 10px 30px 12px; transform: skewX(-10deg);
  box-shadow: 8px 8px 0 #ffd400; text-align: center; animation: ar-pop .35s .2s cubic-bezier(.2,1.6,.4,1) both; }
.ar-name > * { display: block; transform: skewX(10deg); }
.ar-name small { font-family: "Bebas Neue", sans-serif; letter-spacing: 4px; color: #ffd400; font-size: 15px; }
.ar-name b { font-size: clamp(34px, 8vw, 56px); font-weight: 900; line-height: 1.1; }
.ar-name em { font-style: normal; font-size: 13px; color: #bbb; }
@keyframes ar-pop { from { transform: skewX(-10deg) scale(1.8); opacity: 0; } }
@keyframes ar-out { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

.chase-modal { z-index: 2050; }
.chase { max-width: 560px; border-color: #ff2a3d; }
.chase-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chase-head h2 { margin: 0; }
.chase-head span { font-family: var(--mono); color: #ffd400; font-weight: 700; }
.chase-timer { height: 8px; background: rgba(255,255,255,.12); margin: 12px 0 10px; overflow: hidden; }
.chase-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff2a3d, #ffd400); }
.chase-cue { font-size: 19px; font-weight: 900; line-height: 1.5; margin: 6px 0; min-height: 2.2em; animation: cue-shake .4s; }
.chase-cue.ok { color: #6be38a; animation: none; }
.chase-cue.bad { color: #ff8a8c; animation: none; }
@keyframes cue-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.chase-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.chase-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 6px; font: inherit; color: #f7f5ef; cursor: pointer;
  background: #151518; border: 2px solid rgba(255,255,255,.18); transition: transform .1s, background .1s; }
.chase-opt span { font-size: 34px; }
.chase-opt b { font-size: 16px; }
.chase-opt:hover:not(:disabled) { background: #ffd400; color: #0b0b0d; transform: translateY(-3px); }
.chase-opt.right { background: #1f7a3a; border-color: #6be38a; }
.chase-opt.wrong { background: #7a1f2a; border-color: #ff8a8c; }
.chase-opt:disabled { cursor: default; }
.chase-dots { display: flex; justify-content: center; gap: 10px; }
.chase-dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.18); }
.chase-dots i.now { background: #ffd400; box-shadow: 0 0 10px #ffd400; }
.chase-dots i.hit { background: #6be38a; }
.chase-dots i.miss { background: #ff2a3d; }

.bust { position: fixed; inset: 0; z-index: 2300; background: radial-gradient(circle, rgba(20,20,24,.97), #000); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; color: #f7f5ef; cursor: default; }
.bust.ready { cursor: pointer; }
.bust[hidden] { display: none; }
.bust-photo { position: relative; width: min(56vw, 240px); aspect-ratio: 4 / 5; background: #1d1d22; border: 6px solid #f7f5ef; display: grid; place-items: center;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.18) 0 2px, transparent 2px 22px); box-shadow: 12px 12px 0 #ffd400; }
.bust-photo > span { font-size: min(30vw, 130px); animation: bust-slow 2.6s cubic-bezier(.1,.6,.2,1) both; }
@keyframes bust-slow { from { transform: scale(1.5) rotate(-6deg); filter: blur(4px); } 35% { filter: none; } to { transform: scale(1) rotate(0); filter: grayscale(1) contrast(1.2); } }
.bust-stamp { position: absolute; left: 50%; top: 50%; padding: 4px 18px; border: 6px solid #ff2a3d; color: #ff2a3d; font-weight: 900;
  font-size: clamp(34px, 9vw, 56px); letter-spacing: 6px; background: rgba(255,255,255,.08); transform: translate(-50%, -50%) rotate(-14deg);
  animation: bust-stamp .25s .9s cubic-bezier(.5,1.8,.5,1) both; white-space: nowrap; text-shadow: 0 0 2px #ff2a3d; }
@keyframes bust-stamp { from { transform: translate(-50%, -50%) rotate(-14deg) scale(3); opacity: 0; } }
.bust-name { font-size: 24px; font-weight: 900; animation: ar-pop .3s 1.1s both; }
.bust-sub { background: #ffd400; color: #0b0b0d; font-weight: 900; padding: 4px 14px; transform: skewX(-10deg); animation: ar-pop .3s 1.3s both; }
.pay-line { background: #fff3c4; border-left: 5px solid #e6b800; padding: 6px 10px; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .arrive, .ar-tape, .ar-name, .bust-photo > span, .bust-stamp { animation-duration: .01s !important; } }
