/* SIHAOLOU (四号楼) — Vertical 9:16 Tactile 1986 Beijing Brick, Enamel & Brass Gatehouse UI
   Zero web-app SaaS cards, zero border-radius fluff, strict integer pixel fonts throughout:
   PressStart 8px/16px; Sembako 14px/16px; Fusion Pixel ZH 12px/14px under html[data-lang="zh"]. */

@font-face {
  font-family: 'PressStart';
  src: url('fonts/press-start-2p.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Sembako';
  src: url('fonts/sembako-pixel-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Sembako';
  src: url('fonts/sembako-pixel-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Fusion Pixel Latin';
  src: url('fonts/fusion-pixel-latin.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+00A0-024F, U+2000-2BFF;
}
@font-face {
  font-family: 'Fusion Pixel ZH';
  src: url('fonts/fusion-pixel-zh.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF;
}

:root {
  --abyss: #120d0c;
  --brick-dk: #2c1814;
  --brick: #582d22;
  --brick-lt: #7a4232;
  --enamel-dk: #172534;
  --enamel: #23384d;
  --enamel-lt: #345372;
  --brass-dk: #6f4b18;
  --brass: #c39239;
  --brass-hi: #f5d87e;
  --paper: #efe4c8;
  --paper-dk: #d7c59d;
  --paper-line: #bda97f;
  --ink: #251711;
  --ink-soft: #5c4334;
  --seal: #a53126;
  --seal-hi: #d94e3f;
  --good: #2d7a49;
  --warn: #b8671b;
  --cjk: 'PingFang SC', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Sembako', 'Fusion Pixel Latin', var(--cjk), monospace;
  --font-px: 'PressStart', var(--cjk), monospace;
  --vvh: 100dvh;
}

html[data-lang="zh"] {
  --cjk: 'Fusion Pixel ZH', 'PingFang SC', 'Noto Sans CJK SC', sans-serif;
  --font-px: 'Fusion Pixel ZH', 'PressStart', monospace;
}
html[data-lang="zh"] * {
  line-break: strict;
  word-break: normal;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font-family: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 1px; }

html, body {
  width: 100%;
  height: 100%;
  background: var(--abyss);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  image-rendering: pixelated;
}

.hidden { display: none !important; }

/* VERTICAL 9:16 PHONE-FIRST CABINET (fills mobile cleanly, centered on desktop) */
#cabinet {
  width: min(100vw, 440px);
  max-width: 100vw;
  height: var(--vvh);
  max-height: 860px;
  background: var(--brick-dk);
  border: 3px solid var(--brass-dk);
  box-shadow: inset 0 0 0 2px var(--brick), inset 0 0 0 4px #180d0a, 0 0 36px rgba(0, 0, 0, 0.7);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 58px minmax(210px, 47%) 1fr;
  padding: max(4px, env(safe-area-inset-top)) 4px max(4px, env(safe-area-inset-bottom));
  gap: 4px;
  position: relative;
  overflow: hidden;
}

@media (max-width: 460px) {
  #cabinet {
    width: 100vw;
    max-height: none;
    border-width: 2px;
  }
}

/* SHARED TACTILE BUTTONS */
button {
  cursor: pointer;
  border: 2px solid #160d0a;
  color: var(--paper);
  background: var(--brick);
  padding: 5px 7px;
  font-size: 14px;
  line-height: 1.25;
  transition: transform 0.05s;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-brass {
  background: var(--brass);
  color: #1f1208;
  border-color: #2b1a06;
  box-shadow: inset 0 2px 0 var(--brass-hi), inset 0 -2px 0 var(--brass-dk);
  font-family: var(--font-px);
  font-size: 8px;
  padding: 8px 8px;
}
html[data-lang="zh"] .btn-brass,
html[data-lang="zh"] .btn-enamel,
html[data-lang="zh"] .btn-wood,
html[data-lang="zh"] .btn-seal { font-size: 12px; padding: 6px 8px; line-height: 1.3; }

.btn-enamel {
  background: var(--enamel);
  color: var(--paper);
  border-color: #0e1721;
  box-shadow: inset 0 2px 0 var(--enamel-lt), inset 0 -2px 0 var(--enamel-dk);
  font-family: var(--font-px);
  font-size: 8px;
  padding: 7px 8px;
}
.btn-wood {
  background: var(--brick);
  color: var(--paper);
  box-shadow: inset 0 2px 0 var(--brick-lt), inset 0 -2px 0 var(--brick-dk);
  font-family: var(--font-px);
  font-size: 8px;
  padding: 7px 7px;
}
.btn-seal {
  background: var(--seal);
  color: #fff6e0;
  box-shadow: inset 0 2px 0 var(--seal-hi), inset 0 -2px 0 #5f1812;
  font-family: var(--font-px);
  font-size: 8px;
  padding: 7px 7px;
}

.btn-mini {
  background: var(--enamel);
  color: var(--paper);
  border: 2px solid #101720;
  box-shadow: inset 0 1px 0 var(--enamel-lt);
  font-family: var(--font-px);
  font-size: 8px;
  padding: 2px 4px;
  height: 24px;
  flex-shrink: 0;
}
html[data-lang="zh"] .btn-mini { font-size: 11px; padding: 1px 4px; }
.btn-mini.off { background: #3b2a25; color: #a7927e; }

/* BOOT PRELOADER */
#boot-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: radial-gradient(circle at 50% 35%, #34211b 0%, #19100e 100%);
  display: flex;
  flex-direction: column;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
}
.boot-top-bar { display: flex; justify-content: flex-end; padding-top: env(safe-area-inset-top); }
.boot-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 0 12px;
}
.boot-presents { font-family: var(--font-px); font-size: 8px; color: var(--brass); letter-spacing: 1px; }
html[data-lang="zh"] .boot-presents { font-size: 12px; }
#boot-sprite { image-rendering: pixelated; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.boot-brand { font-family: var(--font-px); font-size: 16px; color: var(--brass-hi); text-shadow: 2px 2px 0 #140b09; }
.boot-bar-wrap {
  width: 220px;
  height: 12px;
  background: #140c0a;
  border: 2px solid var(--brass-dk);
  padding: 2px;
}
#boot-bar { width: 8%; height: 100%; background: var(--brass); transition: width 0.18s linear; }
#boot-status { font-family: var(--font-px); font-size: 8px; color: var(--paper-dk); }
html[data-lang="zh"] #boot-status { font-size: 12px; }
#boot-tip { font-size: 14px; color: #c7b494; max-width: 300px; line-height: 1.35; min-height: 38px; }
#boot-enter { margin-top: 6px; padding: 11px 18px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.14); } }

/* LIVE ANIMATED TITLE SCREEN */
#title-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #1b1214;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#title-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.title-top-row {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 8px 8px;
}
.lang-strip { display: flex; gap: 4px; }
.lang-pill {
  background: rgba(24, 16, 14, 0.85);
  border: 2px solid var(--brass-dk);
  color: var(--paper-dk);
  font-family: var(--font-px);
  font-size: 8px;
  padding: 4px 6px;
}
html[data-lang="zh"] .lang-pill { font-size: 12px; padding: 2px 6px; }
.lang-pill.active { background: var(--brass); color: #1b1006; border-color: var(--brass-hi); }

.title-menu {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(22, 14, 12, 0.72) 0%, rgba(22, 14, 12, 0.96) 22%);
  border-top: 3px solid var(--brass-dk);
  padding: 10px 10px max(8px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.title-menu.shown { opacity: 1; pointer-events: auto; transform: translateY(0); }
.title-sub { font-size: 14px; color: var(--paper); text-align: center; line-height: 1.25; }
.sprint-best { font-size: 13px; color: var(--brass-hi); text-align: center; }

.slot-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.slot-card {
  min-width: 0;
  background: #221612;
  border: 2px solid #4c3324;
  color: var(--paper-dk);
  padding: 5px 5px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.slot-card.active { border-color: var(--brass-hi); background: #332018; color: var(--paper); }
.slot-card.bad .slot-top span:last-child { color: #ff8e6e; }
.slot-top { display: flex; justify-content: space-between; font-family: var(--font-px); font-size: 8px; color: var(--brass); }
html[data-lang="zh"] .slot-top { font-size: 11px; }
.slot-body { font-size: 13px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.slot-confirm {
  background: #2f1512;
  border: 2px solid var(--seal-hi);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.slot-confirm-btns { display: flex; gap: 6px; justify-content: flex-end; }
.title-actions { display: flex; flex-direction: column; gap: 5px; }
.title-credit { font-family: var(--font-px); font-size: 8px; color: #9c866d; text-align: center; margin-top: 2px; }
html[data-lang="zh"] .title-credit { font-size: 11px; }

/* TOP 2-ROW ENAMEL & BRASS HUD */
#hud {
  background: var(--brick);
  border: 2px solid #160c09;
  box-shadow: inset 0 2px 0 var(--brick-lt), inset 0 -2px 0 var(--brick-dk);
  padding: 2px 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.hud-row {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}
.hud-plate {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #1b120e;
  border: 2px solid var(--brass-dk);
  padding: 1px 4px;
  height: 24px;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}
#hud-cash { overflow: hidden; text-overflow: ellipsis; }
.hud-season { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.pill {
  font-family: var(--font-px);
  font-size: 8px;
  background: var(--enamel);
  color: var(--brass-hi);
  padding: 2px 3px;
  border: 1px solid var(--enamel-lt);
}
html[data-lang="zh"] .pill { font-size: 11px; padding: 0 3px; }
.season-txt { font-size: 13px; color: var(--paper); overflow: hidden; text-overflow: ellipsis; }
.lbl { font-family: var(--font-px); font-size: 8px; color: var(--brass); }
html[data-lang="zh"] .lbl { font-size: 11px; }
#hud strong { font-size: 14px; font-weight: 700; color: var(--brass-hi); line-height: 1; }
#hud strong.warn { color: #f28468; }
.hud-tools { display: flex; gap: 3px; margin-left: auto; flex-shrink: 0; }
.hud-tools .btn-mini { position: relative; padding: 2px 6px; }
/* a bigger invisible hit area than the 24 px plate allows */
.hud-tools .btn-mini::after { content: ''; position: absolute; inset: -6px -2px; }

.hud-alert-plate { flex: 1 1 auto; min-width: 0; justify-content: center; overflow: hidden; }
.flag-badge { font-family: var(--font-px); font-size: 8px; color: #c7d9ea; overflow: hidden; text-overflow: ellipsis; background: none; border: none; padding: 0 2px; white-space: nowrap; }
.flag-badge:disabled { opacity: 1; cursor: default; }
.flag-badge.on { color: #f6c36b; }
html[data-lang="zh"] .flag-badge { font-size: 11px; }
.flag-badge.hot { color: #ff8e6e; animation: hotblink 1.2s steps(2, jump-none) infinite; }
@keyframes hotblink { 50% { color: #ffd2c2; } }
.btn-next {
  background: var(--brass);
  color: #1d1006;
  border: 2px solid #2a1805;
  box-shadow: inset 0 2px 0 var(--brass-hi), inset 0 -2px 0 var(--brass-dk);
  font-family: var(--font-px);
  font-size: 8px;
  padding: 2px 8px;
  height: 24px;
  margin-left: auto;
  flex-shrink: 0;
}
html[data-lang="zh"] .btn-next { font-size: 11px; padding: 1px 8px; }

/* VERTICAL CUTAWAY PIXEL STAGE */
#stage-wrap {
  position: relative;
  background: #140e0d;
  border: 2px solid #140b09;
  box-shadow: inset 0 0 0 2px #3c261f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
}
#stage {
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 216 / 252;
  image-rendering: pixelated;
  cursor: pointer;
  display: block;
}

#toast-bar {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 60;
  background: rgba(24, 15, 12, 0.96);
  border: 2px solid var(--brass-hi);
  color: var(--brass-hi);
  padding: 6px 8px;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

/* STAGE-CAPPED DIALOGUE BOX (heading & choices pinned, prose scrolls cleanly) */
#dialogue {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  max-height: calc(100% - 12px);
  z-index: 15;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid #26150e;
  box-shadow: inset 0 0 0 2px var(--brass-dk), 0 6px 18px rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  padding: 7px;
  gap: 5px;
}
.dlg-head { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
#dlg-portrait {
  width: 44px;
  height: 44px;
  background: #2b1d18;
  border: 2px solid var(--brass-dk);
  image-rendering: pixelated;
  flex-shrink: 0;
}
.dlg-meta { min-width: 0; flex: 1; }
#dlg-speaker { font-family: var(--font-px); font-size: 8px; color: var(--enamel); }
html[data-lang="zh"] #dlg-speaker { font-size: 12px; }
#dlg-title { font-size: 15px; font-weight: 700; color: var(--seal); line-height: 1.15; }
#dlg-body {
  font-size: 14px;
  line-height: 1.3;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding: 4px 5px;
  background: var(--paper-dk);
  border: 1px solid var(--paper-line);
  cursor: pointer;
}
#dlg-choices { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.dlg-choice {
  background: var(--enamel);
  color: var(--paper);
  text-align: left;
  padding: 6px 8px;
  font-size: 14px;
  border: 2px solid #0e1822;
  box-shadow: inset 0 1px 0 var(--enamel-lt);
}
.dlg-choice:hover:not(:disabled) { background: var(--enamel-lt); }

/* CARETAKER'S TIN CLIPBOARD & ONE-THUMB FOOTER */
#clipboard {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid #160c09;
  box-shadow: inset 0 0 0 2px var(--paper-line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
#tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--brick-dk);
  border-bottom: 2px solid #160c09;
  gap: 2px;
  padding: 2px 2px 0;
  flex-shrink: 0;
}
.tab {
  background: #3d2219;
  color: #c9b598;
  border: 2px solid #190d0a;
  border-bottom: none;
  font-family: var(--font-px);
  font-size: 8px;
  padding: 6px 2px;
  min-height: 32px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-lang="zh"] .tab { font-size: 12px; padding: 4px 1px; }
html[data-lang="id"] .tab { font-size: 7px; letter-spacing: -0.3px; }
.tab.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 2px 0 var(--brass);
}

#desk-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  min-width: 0;
}

#thumb-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--brick-dk);
  border-top: 2px solid #160c09;
  flex-shrink: 0;
}
.room-pills {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.rm-pill {
  background: #2b1a14;
  color: #c7b194;
  border: 1px solid #593b2a;
  font-family: 'PressStart', monospace;
  font-size: 8px;
  padding: 6px 0;
  min-height: 34px;
  text-align: center;
  line-height: 1;
}
.rm-pill.vacant { color: #8c7b6b; border-style: dashed; }
.rm-pill.warn { border-color: var(--seal-hi); color: #ffb29e; }
.rm-pill.active { background: var(--enamel); color: var(--brass-hi); border: 2px solid var(--brass-hi); padding: 5px 0; }
#thumb-bar .btn-next {
  height: 36px;
  min-width: 64px;
  padding: 4px 10px;
  margin-left: 0;
}
.btn-next.armed { background: var(--seal); color: #fff6e0; box-shadow: inset 0 2px 0 var(--seal-hi), inset 0 -2px 0 #5f1812; }
.btn-next.done { background: var(--enamel); color: var(--brass-hi); box-shadow: inset 0 2px 0 var(--enamel-lt), inset 0 -2px 0 var(--enamel-dk); }

/* CLIPBOARD CARDS & LEDGER ROWS */
.card {
  background: #f5ebd2;
  border: 2px solid var(--paper-line);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-head > button { flex-shrink: 0; }
.port-thumb {
  width: 40px;
  height: 40px;
  background: #2b1d18;
  border: 2px solid var(--brass-dk);
  image-rendering: pixelated;
  flex-shrink: 0;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.card-sub { font-size: 13px; color: var(--ink-soft); line-height: 1.2; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-box {
  background: var(--paper-dk);
  border: 1px solid var(--paper-line);
  padding: 3px 2px;
  text-align: center;
  min-width: 0;
}
.stat-box .k { font-size: 11px; color: var(--ink-soft); display: block; }
.stat-box .v { font-size: 14px; font-weight: 700; color: var(--ink); }
.stat-box .v.bad { color: var(--seal); }
.stat-box .v.good { color: var(--good); }
.opt-slot-tag { font-size: 13px; color: var(--brass-hi); }

.tag-row { display: flex; flex-wrap: wrap; gap: 3px; }
.tag {
  font-size: 12px;
  padding: 2px 5px;
  background: var(--paper-dk);
  border: 1px solid var(--paper-line);
  color: var(--ink);
}
.tag.warn { background: #f2d1c4; border-color: var(--seal); color: #6e1a13; }
.tag.good { background: #cfe6d4; border-color: var(--good); color: #194d2c; }

.btn-row { display: flex; flex-wrap: wrap; gap: 4px; }
.btn-row button { flex: 1 1 0; min-width: 0; }

.section-lbl {
  font-family: var(--font-px);
  font-size: 8px;
  color: var(--enamel);
  border-bottom: 1px solid var(--paper-line);
  padding-bottom: 2px;
}
html[data-lang="zh"] .section-lbl { font-size: 12px; }

.bar-track {
  height: 8px;
  background: #33241c;
  border: 1px solid #1b110d;
  overflow: hidden;
}
.bar-fill { height: 100%; background: var(--good); }
.bar-fill.mid { background: var(--warn); }
.bar-fill.low { background: var(--seal-hi); }

.spine-row {
  background: #f5ebd2;
  border: 2px solid var(--paper-line);
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.spine-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.spine-meta { font-size: 12px; color: var(--ink-soft); }

.led-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 2px 0;
  border-bottom: 1px dashed var(--paper-line);
}
.led-row.total { font-weight: 700; border-bottom: none; padding-top: 4px; }
.pos { color: var(--good); }
.neg { color: var(--seal); }

.log-item {
  font-size: 13px;
  padding: 3px 5px;
  border-left: 3px solid var(--paper-line);
  background: #f5ebd2;
  line-height: 1.25;
}
.log-item.alert { border-left-color: var(--seal); background: #f5ddd5; }
.log-item.warn { border-left-color: var(--warn); }
.log-item.passing { border-left-color: var(--enamel); background: #e6ecf0; }
.log-item.money { border-left-color: var(--good); }

.key-card {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f5ebd2;
  border: 2px solid var(--paper-line);
  padding: 5px 6px;
}
.key-card.passed { border-color: var(--enamel-lt); background: #e8edf0; }
.key-card.taller { border-color: var(--brass); }

/* MODALS (OPTIONS & 10-YEAR REVIEW) */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  padding-top: max(12px, env(safe-area-inset-top)) !important;
  padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
  background: rgba(14, 9, 8, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.modal-card {
  width: 100%;
  max-height: 92%;
  overflow-y: auto;
  background: var(--brick-dk);
  border: 3px solid var(--brass);
  box-shadow: inset 0 0 0 2px var(--brick);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--paper);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-px);
  font-size: 10px;
  color: var(--brass-hi);
  border-bottom: 2px solid var(--brass-dk);
  padding-bottom: 6px;
}
html[data-lang="zh"] .modal-head { font-size: 14px; }
.opt-group { display: flex; flex-direction: column; gap: 4px; }
.opt-label { font-family: var(--font-px); font-size: 8px; color: var(--brass); }
html[data-lang="zh"] .opt-label { font-size: 12px; }
.opt-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.opt-pill {
  background: #231512;
  border: 2px solid #593b2a;
  color: var(--paper-dk);
  font-family: var(--font-px);
  font-size: 8px;
  padding: 5px 7px;
}
html[data-lang="zh"] .opt-pill { font-size: 12px; padding: 3px 7px; }
.opt-pill.active { background: var(--brass); color: #1c1006; border-color: var(--brass-hi); }
.opt-io-row { display: flex; gap: 6px; }
.opt-io-row button { flex: 1; }
#save-io-box {
  width: 100%;
  background: #160e0c;
  color: var(--paper);
  border: 2px solid var(--brass-dk);
  padding: 5px;
  font-size: 12px;
  resize: none;
  user-select: text;
}

.rev-body { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.rev-rank { font-family: var(--font-px); font-size: 14px; color: var(--brass-hi); text-align: center; }
.rev-score-big { font-size: 26px; font-weight: 700; color: var(--brass-hi); text-align: center; }
.rev-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.rev-cell { background: #211410; border: 2px solid var(--brass-dk); padding: 6px 4px; text-align: center; }
.rev-cell .k { font-size: 11px; color: var(--paper-dk); display: block; }
.rev-cell .v { font-size: 16px; font-weight: 700; color: var(--brass-hi); }
.rev-cell .v small, .rev-score-big small { font-size: 0.6em; color: var(--paper-dk); font-weight: 400; }
.rev-stats { text-align: center; color: #d7c59d; line-height: 1.35; }
.rev-actions { display: flex; gap: 6px; }
.rev-actions button { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  #boot-sprite, #boot-enter { animation: none; }
  .title-menu { transition: none; }
}

/* Options sits above the review (both are overlays); the wide back-to-title action */
#opts-overlay { z-index: 55; }
.opt-wide { width: 100%; }
#opt-audio-row.muted .opt-pill:not(.master) { opacity: 0.45; }
.opt-pill.master { border-color: var(--brass-dk); }

/* First-turn hint above the room card */
.tap-hint {
  font-size: 13px;
  color: var(--ink);
  background: #f9e6a8;
  border: 2px dashed var(--brass-dk);
  padding: 4px 6px;
  text-align: center;
  animation: hintpulse 2.4s ease-in-out infinite;
}
@keyframes hintpulse { 50% { background: #fff2c4; } }

/* LAST-TURN REPORT: a ledger slip pinned to the top of the stage */
.turn-report {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  z-index: 6;
  max-height: 58%;
  overflow-y: auto;
  background: rgba(245, 235, 210, 0.97);
  color: var(--ink);
  border: 2px solid var(--paper-line);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), inset 0 0 0 1px #fffaf0;
  padding: 5px 7px 6px;
  font-size: 13px;
  animation: slipin 0.28s ease-out;
}
@keyframes slipin { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.tr-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-family: var(--font-px); font-size: 8px; color: var(--seal); }
html[data-lang="zh"] .tr-head { font-size: 12px; }
.tr-head .btn-mini { height: 26px; min-width: 40px; }
.tr-money { font-weight: 700; margin: 3px 0 2px; }
.tr-money.pos { color: #2f6b3d; }
.tr-money.neg { color: #9a2c1f; }
.tr-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-lines .log-item { font-size: 12px; line-height: 1.25; }

/* SEASON CARD: the turn of the season, stamped across the stage */
.season-card {
  position: absolute;
  left: 50%;
  top: 40%;
  z-index: 5;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: rgba(20, 13, 11, 0.9);
  border: 2px solid var(--brass);
  box-shadow: inset 0 0 0 2px #3a2519;
  color: var(--brass-hi);
  font-family: var(--font-px);
  font-size: 9px;
  padding: 10px 14px;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #120b09;
}
html[data-lang="zh"] .season-card { font-size: 16px; }
.season-card.play { animation: seasoncard 2.3s ease-in-out both; }
@keyframes seasoncard {
  0% { opacity: 0; transform: translate(-50%, -40%); }
  14%, 78% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -56%); }
}

/* Landscape phones: the cabinet is a tall walk-up — ask for portrait */
.rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-hint {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
    background: #160e0c;
    color: var(--brass-hi);
    font-family: var(--font-px);
    font-size: 10px;
    text-align: center;
    padding: 24px;
    line-height: 1.6;
  }
  html[data-lang="zh"] .rotate-hint { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .turn-report, .tap-hint, .flag-badge.hot { animation: none; }
}

/* Narrow phones: the ¥ sign says "cash" on its own, so the TIN label goes first; then the season text */
@media (max-width: 370px) {
  #hud .hud-row:first-child .hud-plate:nth-child(2) .lbl { display: none; }
  .hud-tools .btn-mini { padding: 2px 4px; }
  .season-txt { font-size: 12px; }
}
@media (max-width: 330px) {
  html[data-lang="id"] .hud-tools .btn-mini, html[data-lang="en"] .hud-tools .btn-mini { font-size: 7px; }
}
