/* 前沿纪元 · warm frosted glass over a living pixel office.
   Glass is functional here: every panel floats above the room, so the office stays visible behind it. */
@font-face { font-family: "FL Sans"; font-weight: 400; font-display: swap; src: url("assets/fonts/sans-400.woff2") format("woff2"); }
@font-face { font-family: "FL Sans"; font-weight: 600 800; font-display: swap; src: url("assets/fonts/sans-700.woff2") format("woff2"); }

:root {
  --ink: #2a1e15;
  --ink-2: #5d4a3b;
  --ink-3: #8a7563;
  --paper: rgba(253, 247, 238, .78);
  --paper-solid: #fbf3e7;
  --paper-deep: rgba(246, 236, 221, .86);
  --line: rgba(110, 78, 50, .16);
  --amber: #e19a2f;
  --amber-ink: #8c5307;
  --amber-soft: #fbe7c4;
  --teal: #2a978d;
  --teal-ink: #11625b;
  --teal-soft: #d4efea;
  --coral: #d35a3f;
  --coral-ink: #9a3420;
  --coral-soft: #f8dcd3;
  --plum: #6c5ba6;
  --night: #1b1830;
  --shadow: 0 18px 40px -14px rgba(36, 18, 4, .45), 0 3px 10px -4px rgba(36, 18, 4, .25);
  --shadow-sm: 0 6px 16px -8px rgba(36, 18, 4, .45);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .7);
  --r: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(.2, .9, .25, 1);
  --sans: "FL Sans", "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --head: var(--sans);
  --mono: Menlo, Consolas, "Cascadia Mono", "Roboto Mono", ui-monospace, monospace;
  --hud-h: 64px;
  --dock-h: 76px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120e0b; }
body {
  font-family: var(--sans);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--amber-soft); color: var(--ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Icons: Phosphor SVGs used as masks so they take currentColor. */
.i { display: inline-block; width: 1.2em; height: 1.2em; flex: none; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; vertical-align: -.22em; }
.i.px { background: center / contain no-repeat; -webkit-mask: none; mask: none; image-rendering: pixelated; width: 1.35em; height: 1.35em; }

/* ---- Stage ------------------------------------------------------------- */
#stage { position: fixed; inset: 0; overflow: hidden; }
.pixel-scene, .scene-overlay { position: absolute; }
.pixel-scene { image-rendering: pixelated; image-rendering: crisp-edges; }
.scene-overlay { pointer-events: none; }
#stage::after { /* soft vignette keeps HUD readable at the edges */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 60%, rgba(12, 6, 2, .38));
}

.glass {
  background: var(--paper);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  border-radius: var(--r);
  box-shadow: var(--shadow), var(--highlight);
}

/* ---- Scene bubbles ------------------------------------------------------ */
.scene-bubble {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap;
  animation: bubble-in .35s var(--ease) both; transition: opacity .35s, transform .35s var(--ease);
}
.scene-bubble.leaving { opacity: 0; transform: translate(-50%, -130%); }
.scene-bubble.speech {
  max-width: 260px; white-space: normal; padding: 7px 12px 8px; font-family: var(--head); font-size: 15px; line-height: 1.45;
  background: var(--paper-solid); border-radius: 12px; box-shadow: var(--shadow-sm); margin-top: -10px;
}
.scene-bubble.speech::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: var(--paper-solid); transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.scene-bubble.pop { font-weight: 800; font-size: 18px; letter-spacing: .01em; text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 12px rgba(0,0,0,.25); animation: pop-up 1.6s var(--ease) both; }
.scene-bubble.pop.good { color: #b8ffcf; }
.scene-bubble.pop.research { color: #a7e6ff; }
.scene-bubble.pop.money { color: #ffe08a; }
.scene-bubble.pop.level { color: #ffd166; font-size: 16px; }
.scene-bubble.pop.bad { color: #ffb4a3; }
.scene-bubble.focus { color: var(--amber); font-size: 16px; animation: bob 0.7s ease-in-out infinite alternate; }
@keyframes bubble-in { from { opacity: 0; transform: translate(-50%, -80%) scale(.92); } }
@keyframes pop-up { 0% { opacity: 0; transform: translate(-50%, -60%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -110%) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -220%); } }
@keyframes bob { to { transform: translate(-50%, -125%); } }

/* ---- HUD ---------------------------------------------------------------- */
.hud { position: fixed; z-index: 20; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-left { top: 14px; left: 16px; display: flex; gap: 10px; align-items: flex-start; }
.hud-right { top: 14px; right: 16px; display: flex; gap: 10px; align-items: center; flex-direction: row-reverse; }
.company-plate { display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 8px; }
.company-plate .lockup { height: 62px; width: auto; margin: -10px -2px -10px -4px; filter: drop-shadow(0 3px 4px rgba(60, 30, 5, .3)); transition: transform .4s var(--ease); }
.company-plate:hover .lockup { transform: rotate(-3deg) scale(1.05); }
.company-plate .divider { width: 1px; align-self: stretch; margin: 4px 0; background: var(--line); }
.company-plate .crystal { width: 40px; height: 40px; margin: -6px -2px -6px -4px; image-rendering: pixelated; filter: drop-shadow(0 3px 4px rgba(60, 30, 5, .35)); transition: transform .4s var(--ease); }
.company-plate:hover .crystal { transform: rotate(-6deg) scale(1.08); }
.company-plate h1 { margin: 0; font-family: var(--head); font-size: 18px; line-height: 1.15; letter-spacing: .02em; }
.company-plate .when { font-size: 12.5px; color: var(--ink-2); }

.objective {
  position: fixed; z-index: 19; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; max-width: min(560px, 46vw);
  animation: slide-down .5s var(--ease) both;
}
.objective p { margin: 0; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.objective .i { color: var(--amber); }
.objective button { flex: none; }
@keyframes slide-down { from { opacity: 0; transform: translate(-50%, -12px); } }

.cash-card { padding: 9px 16px 10px; min-width: 196px; text-align: right; cursor: pointer; border: 0; }
.cash-card .amount { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.cash-card .amount { font-family: var(--mono); font-size: 25px; letter-spacing: -.03em; }
.cash-card .flow { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; font-family: var(--mono); font-size: 12px; font-weight: 700; line-height: 1.2; }
.cash-card .flow .in { color: var(--teal-ink); }
.cash-card .flow .out { color: var(--coral-ink); }
.cash-card .runway { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.cash-card.warn .runway { color: var(--coral-ink); font-weight: 600; }
.cash-card.flash-up .amount { animation: flash-up .9s ease; }
.cash-card.flash-down .amount { animation: flash-down .9s ease; }
@keyframes flash-up { 30% { color: var(--teal); transform: translateY(-2px); } }
@keyframes flash-down { 30% { color: var(--coral); } }

.icon-stack { display: flex; gap: 8px; }
.round {
  position: relative; width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--paper); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: var(--shadow-sm), var(--highlight); color: var(--ink);
  transition: transform .18s var(--ease), background .2s;
}
.round:hover { transform: translateY(-1px); background: var(--paper-solid); }
.round:active { transform: scale(.94); }
.round .i { width: 20px; height: 20px; }
.round.muted { color: var(--ink-3); }
.badge { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--paper-solid); }

/* Model card under the cash, right edge */
.compute-meter { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); font-size: 12px; font-family: var(--mono); color: var(--ink-2); cursor: pointer; }
.compute-meter .bar { display: block; height: 6px; margin-top: 4px; border-radius: 3px; background: rgba(211, 90, 63, .25); overflow: hidden; }
.compute-meter .bar i { display: block; height: 100%; background: var(--teal); }
.compute-meter.short { color: var(--coral-ink); font-weight: 700; }
.model-card { position: fixed; z-index: 18; left: 16px; top: 86px; transition: opacity .3s, transform .3s var(--ease); width: 228px; padding: 12px 14px 12px; cursor: pointer; border: 0; text-align: left; }
.model-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.model-card header img { width: 36px; height: 36px; }
.model-card h2 { margin: 0; font-family: var(--head); font-size: 18px; line-height: 1.1; }
.model-card .sub { font-size: 12px; color: var(--ink-2); }
.meter { display: grid; grid-template-columns: 52px 1fr 26px; align-items: center; gap: 8px; font-size: 12.5px; margin-top: 5px; }
.meter .bar { height: 7px; border-radius: 4px; background: rgba(110, 78, 50, .14); overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--teal)); transition: width .8s var(--ease); }
.meter b { text-align: right; font-weight: 700; }
.model-card .status { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.model-card .status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.model-card .status .dot.off { background: var(--ink-3); box-shadow: none; }

/* ---- Dock + advance ----------------------------------------------------- */
.dock {
  position: fixed; z-index: 20; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 7px;
}
.dock button {
  position: relative; width: 74px; height: 62px; border: 0; border-radius: 11px; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 13px; color: var(--ink-2);
  transition: background .2s, color .2s, transform .18s var(--ease);
}
.dock button .i { width: 24px; height: 24px; }
.dock button:hover { background: rgba(255, 255, 255, .55); color: var(--ink); transform: translateY(-2px); }
.dock button[aria-current="true"] { background: var(--paper-solid); color: var(--ink); box-shadow: var(--shadow-sm); }
.dock button[aria-current="true"]::after { content: ""; position: absolute; bottom: 5px; width: 16px; height: 3px; border-radius: 2px; background: var(--amber); }
.dock button.nudge::before { content: ""; position: absolute; top: 7px; right: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px var(--paper-solid); }

.advance-wrap { position: fixed; z-index: 20; right: 16px; bottom: 14px; display: flex; flex-direction: column; align-items: stretch; gap: 0; width: 228px; }
.advance {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border: 0; border-radius: var(--r); cursor: pointer; overflow: hidden; text-align: left;
  background: linear-gradient(180deg, #f4b555, #e0932a); color: #3a2205; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 245, 220, .8), inset 0 -2px 0 rgba(140, 80, 10, .25);
  transition: transform .18s var(--ease), filter .2s;
}
.advance:hover { filter: brightness(1.04); transform: translateY(-1px); }
.advance:active { transform: translateY(1px) scale(.99); }
.advance:disabled { cursor: default; filter: saturate(.4) brightness(.95); }
.advance strong { font-size: 18px; letter-spacing: .04em; font-family: var(--head); }
.advance small { display: block; font-size: 12px; opacity: .8; }
.advance .i { width: 26px; height: 26px; }
.advance .progress { position: absolute; left: 0; bottom: 0; height: 4px; background: rgba(60, 30, 0, .35); width: var(--p, 0%); transition: width .8s var(--ease); }
.advance.attention { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: var(--shadow), inset 0 1px 0 rgba(255,245,220,.8), 0 0 0 6px rgba(240, 170, 60, .25); } }
.advance.event { background: linear-gradient(180deg, #fbf3e7, #efe1cb); color: var(--ink); }

/* ---- Dialogue box (Animal Crossing–style speaker with portrait) -------- */
.dialogue {
  position: fixed; z-index: 30; left: 16px; bottom: 100px; width: min(660px, calc(100vw - 300px)); min-width: 420px;
  display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 14px 16px 14px 12px;
  animation: rise .45s var(--ease) both;
}
.dialogue.compact { width: min(460px, calc(100vw - 520px)); }
.dialogue .portrait { position: relative; align-self: end; height: 120px; display: flex; align-items: flex-end; justify-content: center; }
.dialogue .portrait img { height: 136px; width: 136px; object-fit: contain; object-position: bottom; image-rendering: pixelated; filter: drop-shadow(0 6px 8px rgba(40, 20, 5, .3)); margin-top: -26px; }
.dialogue .who { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.dialogue .who b { font-family: var(--head); font-size: 17px; color: var(--amber-ink); }
.dialogue .who span { font-size: 12.5px; color: var(--ink-3); }
.dialogue h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.dialogue .line { margin: 0; font-family: var(--head); font-size: 17px; line-height: 1.6; min-height: 2.2em; }
.dialogue .line .caret { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 2px; background: var(--amber); animation: blink 1s steps(1) infinite; }
.dialogue .news { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; align-items: baseline; }
.dialogue .news a { color: var(--teal-ink); text-underline-offset: 3px; }
.dialogue .choices { display: grid; gap: 7px; margin-top: 10px; }
.dialogue .controls { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes blink { 50% { opacity: 0; } }

.choice {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  padding: 9px 12px; border: 0; border-radius: var(--r-sm); background: rgba(255, 255, 255, .62); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, transform .18s var(--ease), box-shadow .2s;
}
.choice:hover { background: #fff; transform: translateX(3px); box-shadow: inset 0 0 0 1px rgba(225, 154, 47, .55), var(--shadow-sm); }
.choice:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.choice > span:first-child { font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.chip { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: rgba(110, 78, 50, .1); color: var(--ink-2); white-space: nowrap; font-weight: 600; }
.chip.up { background: var(--teal-soft); color: var(--teal-ink); }
.chip.down { background: var(--coral-soft); color: var(--coral-ink); }
.chip.cost { background: var(--amber-soft); color: var(--amber-ink); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 650; font-size: 14px;
  background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, transform .15s var(--ease), box-shadow .2s;
}
.btn:hover { background: #fff; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(180deg, #f2b04f, #df9228); color: #36200a; box-shadow: inset 0 1px 0 rgba(255, 245, 220, .8), inset 0 -2px 0 rgba(140, 80, 10, .2), var(--shadow-sm); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.teal { background: var(--teal); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), var(--shadow-sm); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.pwr { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 1px 9px 1px 7px; border-radius: 999px; }
.pwr i, .pwr-btn i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pwr.on { color: #17673c; background: #d9f2df; }
.pwr.on i { background: #2fc463; box-shadow: 0 0 0 2px rgba(47, 196, 99, .25), 0 0 8px #2fc463; }
.pwr.off { color: #9a2a1d; background: #f8dcd6; }
.pwr.off i { background: #e0402c; box-shadow: 0 0 0 2px rgba(224, 64, 44, .2); }
.btn.pwr-btn { display: inline-flex; align-items: center; gap: 7px; }
.btn.pwr-btn.off { background: #2fa85a; color: #fff; }
.btn.pwr-btn.off i { background: #eafff0; }
.btn.pwr-btn.on { background: #fff1ee; color: #a3301f; box-shadow: inset 0 0 0 1px rgba(200, 60, 40, .35); }
.btn.pwr-btn.on i { background: #e0402c; }
.btn.ghost:hover { background: rgba(255, 255, 255, .5); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 11px 14px; font-size: 15px; }
.btn .i { width: 18px; height: 18px; }

/* ---- Sheet (side panel) ------------------------------------------------- */
.sheet {
  position: fixed; z-index: 25; top: 88px; bottom: 100px; right: 12px; width: min(620px, 52vw);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(calc(100% + 24px)); opacity: 0; transition: transform .45s var(--ease), opacity .3s;
  background: var(--paper-deep);
}
.sheet.open { transform: none; opacity: 1; }
.sheet > header { display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px 20px; }
.sheet > header h2 { margin: 0; font-family: var(--head); font-size: 22px; letter-spacing: .02em; flex: 1; display: flex; align-items: center; gap: 10px; }
.sheet > header h2 .i { color: var(--amber); width: 24px; height: 24px; }
.sheet .tabs { display: flex; gap: 4px; padding: 3px; margin: 0 20px 6px; border-radius: 11px; background: rgba(110, 78, 50, .09); width: max-content; max-width: calc(100% - 40px); overflow-x: auto; }
.sheet .tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink-2); white-space: nowrap; transition: background .2s, color .2s; }
.sheet .tabs button[aria-selected="true"] { background: var(--paper-solid); color: var(--ink); font-weight: 650; box-shadow: var(--shadow-sm); }
.sheet .body { flex: 1; overflow-y: auto; padding: 8px 20px 20px; scrollbar-width: thin; scrollbar-color: rgba(110, 78, 50, .3) transparent; }
.sheet .body::-webkit-scrollbar { width: 8px; }
.sheet .body::-webkit-scrollbar-thumb { background: rgba(110, 78, 50, .28); border-radius: 4px; }
.sheet .foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: space-between; background: rgba(255, 252, 246, .5); }
.sheet .foot .cost { font-size: 13px; color: var(--ink-2); }
.sheet .foot .cost b { color: var(--ink); font-size: 15px; }

.section { margin: 14px 0 6px; }
.section > h3 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.section > h3 small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.lead { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; }
.note { font-size: 12.5px; color: var(--ink-3); margin: 6px 0 0; }
.warn-text { color: var(--coral-ink); }
.good-text { color: var(--teal-ink); }

.tile {
  border-radius: 12px; background: rgba(255, 255, 255, .58); box-shadow: inset 0 0 0 1px var(--line); padding: 12px 14px;
  transition: background .2s, box-shadow .2s, transform .18s var(--ease);
}
button.tile b, button.tile .note, button.tile .gains { display: block; }
.tile .gains { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
button.tile { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; }
button.tile:hover { background: #fff; transform: translateY(-1px); }
.tile.selected { background: #fff; box-shadow: inset 0 0 0 2px var(--amber), var(--shadow-sm); }
.tile.locked { opacity: .55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stat-line { display: flex; justify-content: space-between; font-size: 13.5px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.stat-line:last-child { border-bottom: 0; }
.stat-line span { color: var(--ink-2); }
.big-number { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px var(--line); }
.kpi b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.kpi span { font-size: 12.5px; color: var(--ink-2); }

/* Research tree */
.tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tree .col h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.tree .col h4::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.tree .col { display: grid; gap: 8px; align-content: start; }
.tree .tile { padding: 10px 12px; }
.tree .tile b { display: block; font-size: 14px; line-height: 1.35; }
.tree .tile .gains { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.mastery { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: 1px; }
.mastery i { width: 6px; height: 6px; border-radius: 1px; background: rgba(110, 78, 50, .2); }
.mastery i.on { background: var(--amber); }
.progress-track { display: block; height: 10px; border-radius: 6px; background: rgba(110, 78, 50, .14); overflow: hidden; }
.progress-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #47c2b3); border-radius: inherit; transition: width .8s var(--ease); }
.route { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.route .step { padding: 5px 10px; border-radius: 999px; font-size: 13px; background: rgba(110, 78, 50, .1); color: var(--ink-3); }
.route .step.done { background: var(--teal-soft); color: var(--teal-ink); }
.route .step.now { background: var(--amber-soft); color: var(--amber-ink); font-weight: 700; }
.route .sep { color: var(--ink-3); font-size: 12px; }

/* Team */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.roster button { position: relative; padding: 8px 6px 8px; text-align: center; }
.roster img { height: 48px; image-rendering: pixelated; display: block; margin: 0 auto 4px; }
.roster b { display: block; font-size: 13.5px; }
.roster small { font-size: 11.5px; color: var(--ink-3); }
.roster .lv { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 700; color: var(--amber-ink); }
.roster .tired { position: absolute; top: 6px; left: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.person-head { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: end; }
.person-head img { width: 120px; image-rendering: pixelated; }
.person-head h3 { margin: 0; font-family: var(--head); font-size: 22px; }
.person-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }
.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.dim { display: grid; grid-template-columns: 34px 1fr 28px; align-items: center; gap: 8px; font-size: 13px; }
.dim .bar { height: 8px; border-radius: 4px; background: rgba(110, 78, 50, .14); overflow: hidden; }
.dim .bar i { display: block; height: 100%; background: var(--amber); border-radius: inherit; }
.dim.main .bar i { background: var(--teal); }
.dim b { text-align: right; }
.jobs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.jobs button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px; font-size: 13px; }
.jobs button .i { width: 22px; height: 22px; color: var(--ink-2); }
.jobs button.selected .i { color: var(--amber-ink); }
.wish { padding: 10px 12px; border-radius: 12px; background: rgba(251, 231, 196, .55); }
.wish b { font-family: var(--head); font-size: 15px; }

/* Resources */
.slots { display: flex; gap: 4px; flex-wrap: wrap; }
.slot { width: 22px; height: 22px; border-radius: 5px; border: 0; cursor: pointer; background: rgba(110, 78, 50, .12); transition: transform .12s, background .2s; }
.slot:hover { transform: translateY(-1px); }
.slot.on { background: var(--c); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); }
.slot.owned { background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255,255,255,.35) 4px 6px); }
.room-cam-wrap { margin: 0 0 12px; border-radius: var(--r-sm); overflow: hidden; background: #120e0b; box-shadow: inset 0 0 0 1px var(--line); }
.room-cam { display: block; width: 100%; image-rendering: pixelated; }
@media (max-height: 500px) { .room-cam-wrap { max-height: 38vh; } .room-cam { height: calc(38vh - 26px); object-fit: cover; } }
.room-cam-wrap figcaption { padding: 6px 10px; font-size: 12px; color: #f3e6d2; background: rgba(18, 14, 11, .85); }
.cap-card { padding: 10px 12px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 10px; }
.cap-card.short { box-shadow: inset 0 0 0 1.5px rgba(211, 90, 63, .55); background: rgba(248, 220, 211, .45); }
.cap-card b { font-family: var(--mono); font-size: 14px; }
.cap-bar { position: relative; display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: rgba(110, 78, 50, .12); margin-top: 6px; }
.cap-bar.total span { background: var(--c); box-shadow: inset -1px 0 0 rgba(255, 255, 255, .6); }
.cap-bar.pool { height: 18px; margin: 0; }
.cap-bar.pool .own { background: var(--c); background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255, 255, 255, .38) 4px 6px); }
.cap-bar.pool .cloud { background: var(--c); opacity: .78; }
.cap-bar.pool .idle { background: repeating-linear-gradient(135deg, rgba(110, 78, 50, .25) 0 4px, transparent 4px 6px); }
.cap-bar.demand { overflow: visible; }
.cap-bar.demand span { background: var(--teal); border-radius: 7px; }
.cap-card.short .cap-bar.demand span { background: var(--coral); }
.cap-bar.demand em { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.cap-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); font-family: var(--mono); }
.cap-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; background: var(--c); vertical-align: -1px; }
.cap-legend i.free { background: rgba(110, 78, 50, .2); }
.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stepper b { min-width: 30px; text-align: center; font-family: var(--mono); }
.stepper .btn { width: 28px; padding: 2px 0; justify-content: center; font-weight: 800; }
.alloc-row { display: grid; grid-template-columns: 112px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.alloc-row:last-child { border-bottom: 0; }
.alloc-row b { display: block; font-size: 14px; }
.alloc-row small { font-size: 12px; color: var(--ink-3); }
.shop { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.shop .tile { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; }
.shop img { width: 64px; height: 66px; object-fit: none; object-position: left bottom; image-rendering: pixelated; }

/* Ledger chart */
.chart { width: 100%; height: 140px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: 3px; margin-right: 5px; background: var(--c); }

/* Feed */
.post { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.post .avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--c, var(--plum)); }
.post .meta { font-size: 12.5px; color: var(--ink-3); }
.post .meta b { color: var(--ink); font-size: 14px; margin-right: 6px; }
.post p { margin: 3px 0 0; font-size: 14.5px; }
.post .reply { margin-top: 7px; display: flex; gap: 8px; align-items: flex-start; font-family: var(--head); font-size: 14.5px; color: var(--ink-2); }
.post .reply img { width: 26px; height: 26px; object-fit: cover; object-position: top; image-rendering: pixelated; border-radius: 6px; background: var(--amber-soft); }
.post a { color: var(--teal-ink); font-size: 12.5px; }

/* ---- Week report ------------------------------------------------------- */
.report { position: fixed; z-index: 22; right: 16px; bottom: 112px; width: 300px; padding: 14px 16px 12px; animation: rise .45s var(--ease) both; }
.report header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.report header b { font-family: var(--head); font-size: 17px; }
.report header span { font-size: 12.5px; color: var(--ink-3); }
.report .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.report .nums div { padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .55); }
.report .nums b { display: block; font-size: 16px; }
.report .nums span { font-size: 11.5px; color: var(--ink-2); }
.report .quote { margin: 10px 0 0; display: flex; gap: 8px; font-family: var(--head); font-size: 14.5px; color: var(--ink-2); }
.report .quote img { width: 28px; height: 28px; object-fit: cover; object-position: top; image-rendering: pixelated; border-radius: 6px; background: var(--amber-soft); }
.report.leaving { opacity: 0; transform: translateY(8px); transition: .35s; }

/* ---- Toast -------------------------------------------------------------- */
/* Week notices: what is new on X and in the news, top left under the company plate. */
.notices { position: fixed; z-index: 30; right: 16px; top: 108px; display: flex; flex-direction: column; gap: 8px; width: 320px; pointer-events: none; }
.notice { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 12px; border: 0; cursor: pointer; animation: notice-in .4s var(--ease) both; border-left: 3px solid var(--plum); }
body.sheet-open .notices { opacity: 0; pointer-events: none; }
.notice.pos { border-left-color: var(--teal); }
.notice.neg { border-left-color: var(--coral); }
.notice .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--c, var(--plum)); font-size: 14px; }
.notice .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notice .body b { font-size: 13.5px; }
.notice .body span { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.notice .body small { font-size: 12px; color: var(--amber-ink); font-weight: 700; }
.notice.leaving { animation: notice-out .35s ease both; }
@keyframes notice-in { from { opacity: 0; transform: translateX(24px); } }
@keyframes notice-out { to { opacity: 0; transform: translateX(24px); } }
.cloud-badge { position: fixed; z-index: 40; right: 16px; bottom: 104px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px; color: var(--teal-ink); animation: notice-in .4s var(--ease) both; }
.cloud-badge.bad { color: var(--coral-ink); }
.cloud-badge.leaving { animation: notice-out .35s ease both; }
.cloud-code { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.cloud-code b { font-family: var(--mono); font-size: 20px; letter-spacing: .06em; padding: 6px 12px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px var(--line); user-select: all; }
.tip-bubble { position: fixed; z-index: 60; max-width: 300px; padding: 8px 12px; border-radius: 10px; background: rgba(36, 26, 18, .94); color: #fbf3e7; font-size: 13px; line-height: 1.55; box-shadow: var(--shadow-sm); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.tip-bubble.on { opacity: 1; transform: none; }
.toast { position: fixed; z-index: 40; left: 50%; top: 64px; transform: translateX(-50%); padding: 9px 16px; font-size: 14px; animation: slide-down .35s var(--ease) both; max-width: 520px; display: flex; gap: 8px; align-items: center; }
.toast.bad { color: var(--coral-ink); }
.toast.bad .i { color: var(--coral); }
.toast.good .i { color: var(--teal); }

/* ---- Overlay screens (start, settings, modal) -------------------------- */
.screen { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(18, 10, 4, .32); animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 22px 24px; background: var(--paper-deep); }
.modal h2 { margin: 0 0 6px; font-family: var(--head); font-size: 24px; }

.start { width: min(980px, 100%); display: grid; grid-template-columns: 1.05fr 1fr; gap: 0; overflow: hidden; padding: 0; background: var(--paper-deep); max-height: calc(100vh - 48px); }
.start .hero { position: relative; padding: 28px 28px 24px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(180deg, rgba(27, 24, 48, .78), rgba(27, 24, 48, .55)); color: #f8efe2; }
.start .hero .hero-logo { width: 112px; height: 112px; margin: -6px 0 10px -8px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .45)); animation: logo-float 4s ease-in-out infinite; }
@keyframes logo-float { 50% { transform: translateY(-4px); } }
.start .hero .hero-lockup { margin: -8px 0 0 -10px; line-height: 0; }
.start .hero .hero-lockup img { width: min(400px, 100%); height: auto; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45)); animation: logo-float 4s ease-in-out infinite; }
.start .hero h1 { margin: 0; font-family: var(--head); font-size: 54px; line-height: 1; letter-spacing: .04em; }
.start .hero .en { margin-top: 8px; font-size: 13px; letter-spacing: .32em; text-transform: uppercase; opacity: .7; }
.start .hero p { font-family: var(--head); font-size: 18px; line-height: 1.7; max-width: 30ch; margin: 22px 0 0; opacity: .92; }
.start .hero .cast { display: flex; gap: 4px; align-items: flex-end; margin-top: 18px; }
.start .hero .cast img { height: 58px; image-rendering: pixelated; filter: drop-shadow(0 4px 4px rgba(0,0,0,.4)); }
.start form { padding: 22px 24px; overflow-y: auto; }
.start label { display: block; font-size: 13px; color: var(--ink-2); margin: 12px 0 5px; font-weight: 600; }
.start input[type=text] { width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .8); box-shadow: inset 0 0 0 1px var(--line); font: inherit; font-size: 15px; color: var(--ink); }
.start input[type=text]:focus { outline: none; box-shadow: inset 0 0 0 2px var(--amber); }
.looks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.looks button { padding: 6px; height: 86px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.looks img { height: 76px; image-rendering: pixelated; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { padding: 8px 6px; font-size: 13.5px; text-align: center; }
.seg button small { display: block; font-size: 11.5px; color: var(--ink-3); }
.start .actions { display: flex; gap: 10px; margin-top: 18px; }

.field { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.field label { flex: 1; font-size: 14px; }
input[type=range] { accent-color: var(--amber); width: 180px; }

/* ---- Small screens ------------------------------------------------------ */
@media (max-width: 1100px) {
  .sheet { width: calc(100vw - 24px); bottom: 98px; }
  .dialogue, .dialogue.compact { width: min(620px, calc(100vw - 32px)); min-width: 0; bottom: 100px; }
  .model-card { display: none; }
  .objective { max-width: calc(100vw - 420px); }
}
@media (max-width: 760px) and (orientation: portrait) {
  body { font-size: 14px; }
  .hud-left, .objective, .model-card { display: none; }
  .hud-right { left: 12px; right: 12px; top: 10px; justify-content: space-between; }
  .cash-card { min-width: 0; flex: 1; }
  .cash-card .amount { font-size: 22px; }
  .round { width: 38px; height: 38px; }
  .dock { left: 12px; right: 12px; bottom: 10px; transform: none; justify-content: space-between; padding: 5px; }
  .dock button { width: auto; flex: 1; height: 56px; font-size: 11.5px; }
  .advance-wrap { left: 12px; right: 12px; bottom: 84px; width: auto; }
  .advance { padding: 10px 14px; }
  .sheet { top: 64px; left: 10px; right: 10px; width: auto; bottom: 82px; }
  body.sheet-open .advance-wrap, body.sheet-open .dialogue, body.sheet-open .report { display: none !important; }
  .dialogue, .dialogue.compact { left: 12px; right: 12px; width: auto; min-width: 0; bottom: 156px; grid-template-columns: 72px 1fr; gap: 10px; padding: 12px; }
  .dialogue .portrait { height: 80px; }
  .dialogue .portrait img { width: 84px; height: 84px; margin-top: -10px; }
  .dialogue .line { font-size: 15.5px; }
  .choice { flex-direction: column; align-items: flex-start; }
  .chips { justify-content: flex-start; }
  .report { left: 12px; right: 12px; width: auto; top: 64px; bottom: auto; }
  .grid2, .tree, .shop, .dims { grid-template-columns: 1fr; }
  .grid3 { gap: 6px; }
  .kpi b { font-size: 17px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .person-head { grid-template-columns: 84px 1fr; }
  .person-head img { width: 84px; }
  .jobs button { font-size: 12px; padding: 7px 2px; }
  .alloc-row { grid-template-columns: 1fr auto; }
  .alloc-row .slots { grid-column: 1 / -1; }
  .start { grid-template-columns: 1fr; }
  .start .hero { padding: 14px 18px 0; background: none; }
  .start .hero p, .start .hero .cast { display: none; }
  .start .hero .hero-lockup img { width: 220px; }
  .looks button { height: 72px; }
  .toast { max-width: calc(100vw - 24px); top: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body.sheet-open .model-card { opacity: 0; transform: translateX(-20px); pointer-events: none; }
.kpi .progress-track { height: 6px; margin-top: 6px; }

.post.mine { background: rgba(251, 231, 196, .35); border-radius: 10px; padding-left: 6px; padding-right: 6px; }
.post .avatar.small { width: 22px; height: 22px; font-size: 11px; flex: none; }
.post .reply { align-items: center; }

/* ---- Pixel harmony (round 17): chunkier frames and buttons that sit with the pixel scene ---- */
:root { --r: 12px; --r-sm: 9px; --pixel-line: rgba(58, 36, 18, .42); }
.glass { box-shadow: var(--shadow), inset 0 0 0 2px var(--pixel-line), inset 0 3px 0 rgba(255, 255, 255, .55); }
.round { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--pixel-line), inset 0 2px 0 rgba(255, 255, 255, .6); }
.round .i.px { width: 26px; height: 26px; }
.dock button .i.px { width: 32px; height: 32px; }
.dock button[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--pixel-line), inset 0 -3px 0 rgba(58, 36, 18, .12); }
.sheet > header h2 .i.px { width: 30px; height: 30px; }
.tile { box-shadow: inset 0 0 0 2px rgba(110, 78, 50, .16); }
.tile.selected { box-shadow: inset 0 0 0 2px var(--amber), inset 0 -3px 0 rgba(140, 80, 10, .18); }
.btn { box-shadow: inset 0 0 0 2px rgba(110, 78, 50, .2), inset 0 -2px 0 rgba(58, 36, 18, .12); }
.btn.primary { box-shadow: inset 0 0 0 2px rgba(120, 64, 6, .7), inset 0 2px 0 rgba(255, 245, 220, .8), inset 0 -3px 0 rgba(140, 80, 10, .35); }
.btn.primary:active, .advance:active { box-shadow: inset 0 0 0 2px rgba(120, 64, 6, .7), inset 0 3px 0 rgba(140, 80, 10, .35); }
.advance { box-shadow: var(--shadow), inset 0 0 0 2px rgba(120, 64, 6, .75), inset 0 3px 0 rgba(255, 245, 220, .8), inset 0 -4px 0 rgba(140, 80, 10, .35); }
.advance .i.px { width: 34px; height: 34px; }
.objective .i.px { width: 24px; height: 24px; }
.chip { box-shadow: inset 0 0 0 1px rgba(58, 36, 18, .08); border-radius: 6px; }
.meter .bar, .dim .bar, .progress-track { border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(58, 36, 18, .18); }
.meter .bar i, .dim .bar i, .progress-track i { border-radius: 0; background-image: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255, 255, 255, .22) 6px 8px); }
.slot { border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(58, 36, 18, .18); }
.sheet .tabs button[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--pixel-line); }
.scene-bubble.speech { box-shadow: var(--shadow-sm), 0 0 0 2px var(--pixel-line); }

/* ---- Round 18: model card, radar, tech tree, leaderboard ---- */
.model-card { width: 244px; padding: 10px 12px 10px; }
.model-card header { align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.model-card .mr { flex: none; width: 76px; height: 76px; margin: -2px 0 -4px -4px; }
.model-card h2 { font-size: 17px; }
.model-card .tags { margin-top: 5px; }
.model-card .paths .meter { grid-template-columns: 58px 1fr 34px; margin-top: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11.5px; line-height: 1; padding: 4px 6px 4px; border-radius: 5px; background: rgba(110, 78, 50, .12); color: var(--ink-2); font-weight: 700; box-shadow: inset 0 0 0 1px rgba(58, 36, 18, .12); white-space: nowrap; }
.tag.gold { background: linear-gradient(180deg, #ffe08a, #f2b04f); color: #5a3404; box-shadow: inset 0 0 0 1px rgba(120, 64, 6, .45); }
.tag.teal { background: var(--teal-soft); color: var(--teal-ink); }
.tag.plum { background: #e6e0f5; color: #4b3d85; }
.model-hero { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.model-hero .radar { display: block; margin: -6px auto 0; }
.model-hero .model-name { margin: 4px 0 6px; font-family: var(--head); font-size: 22px; }
.model-hero .model-name small { font-family: var(--sans); font-size: 13px; color: var(--ink-3); font-weight: 400; }
.model-hero .legend { flex-wrap: wrap; justify-content: center; gap: 8px 12px; }
.goal { margin-bottom: 10px; }
.goal .progress-track { margin: 6px 0; }
.agi-dims { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 6px; }
.agi-dims .dim { grid-template-columns: 52px 1fr 28px; }
.techtree { display: grid; gap: 8px; }
.stage { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: stretch; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .35); box-shadow: inset 0 0 0 1px rgba(110, 78, 50, .12); }
.stage-head { display: flex; flex-direction: column; justify-content: center; padding-right: 6px; border-right: 2px dashed rgba(110, 78, 50, .2); }
.stage-head b { font-family: var(--head); font-size: 16px; }
.stage-head span { font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em; }
.tiers { display: flex; align-items: center; gap: 0; overflow-x: auto; }
.tier { display: flex; flex-direction: column; gap: 6px; flex: 1 1 0; min-width: 132px; }
.link { flex: none; width: 14px; height: 2px; background: rgba(110, 78, 50, .35); position: relative; }
.link::after { content: ""; position: absolute; right: -2px; top: -3px; border: 4px solid transparent; border-left-color: rgba(110, 78, 50, .45); }
.node { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; padding: 7px 9px 8px; border-radius: 8px; background: rgba(255, 255, 255, .75); box-shadow: inset 0 0 0 2px rgba(110, 78, 50, .16), inset 0 -2px 0 rgba(58, 36, 18, .08); transition: transform .15s var(--ease), background .2s; font: inherit; color: inherit; }
.node:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.node:disabled { cursor: default; }
.node.selected { box-shadow: inset 0 0 0 2px var(--amber), inset 0 -3px 0 rgba(140, 80, 10, .18); background: #fff; }
.node.done { background: rgba(212, 239, 234, .75); }
.node.locked { opacity: .55; cursor: not-allowed; background: rgba(255, 255, 255, .35); }
.node b { display: flex; align-items: center; gap: 4px; font-size: 13px; line-height: 1.3; }
.node .en { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.node .gains { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.node .chip { font-size: 10.5px; padding: 0 5px; }
.pick-detail { margin-bottom: 8px; }
.leaderboard { display: grid; gap: 4px; }
.lb-row { display: grid; grid-template-columns: 28px 34px 22px 1fr 52px; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px rgba(110, 78, 50, .12); }
.lb-row .rk { font-weight: 800; font-size: 16px; text-align: center; color: var(--ink-2); }
.lb-row:nth-child(1) .rk { color: #c08a12; }
.lb-row .dot { width: 10px; height: 10px; border-radius: 2px; justify-self: center; }
.lb-row .nm b { display: block; font-size: 14px; }
.lb-row .nm small { font-size: 11.5px; color: var(--ink-3); }
.lb-row .sc { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-row.me { background: linear-gradient(90deg, rgba(251, 231, 196, .95), rgba(255, 255, 255, .7)); box-shadow: inset 0 0 0 2px var(--amber); }
.lb-gap { text-align: center; color: var(--ink-3); line-height: 1; }
.mv { font-size: 11px; font-weight: 700; color: var(--ink-3); text-align: center; }
.mv.up { color: var(--teal-ink); }
.mv.down { color: var(--coral-ink); }
.mv.new { color: #8c5307; }
.labs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lab { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px rgba(110, 78, 50, .12); }
.lab.pending { opacity: .6; }
.lab .logo { width: 36px; height: 36px; display: grid; place-items: center; flex: none; }
.lab-ico { image-rendering: pixelated; flex: none; display: block; }
.lab small { color: var(--ink-3); }
.lab .note { margin: 2px 0 0; }
.report .rival { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.report .rival .i { flex: none; margin-top: 1px; }
.report { width: 320px; }
.dialogue[data-ui="dialogue-box"] { cursor: pointer; }
.next-btn { padding: 8px 16px 8px 18px; font-size: 15px; font-weight: 700; background: linear-gradient(180deg, #fff6e4, #f6e2bf); box-shadow: inset 0 0 0 2px rgba(120, 64, 6, .55), inset 0 -3px 0 rgba(140, 80, 10, .25); color: #5a3404; }
.next-btn .caret { display: inline-block; font-size: 11px; margin-left: 4px; color: var(--amber-ink); animation: bob-caret .8s ease-in-out infinite alternate; }
@keyframes bob-caret { to { transform: translateY(3px); } }
@media (max-width: 760px) and (orientation: portrait) {
  .model-hero { grid-template-columns: 1fr; }
  .labs { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr; }
  .stage-head { border-right: 0; border-bottom: 2px dashed rgba(110, 78, 50, .2); padding: 0 0 4px; flex-direction: row; gap: 8px; align-items: baseline; }
  .tiers { flex-direction: column; align-items: stretch; }
  .link { width: 2px; height: 10px; margin: 0 auto; }
  .link::after { display: none; }
  .tier { min-width: 0; }
  .dock button { font-size: 10.5px; }
}

.chapter-card { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(27, 24, 48, .55), rgba(27, 24, 48, .82)); animation: fade .5s ease both; cursor: pointer; }
.chapter-card .inner { text-align: center; color: #fbf3e7; animation: rise .7s var(--ease) both; }
.chapter-card small { letter-spacing: .5em; font-size: 13px; opacity: .7; }
.chapter-card h2 { margin: 10px 0 8px; font-family: var(--head); font-size: clamp(30px, 8vw, 44px); letter-spacing: .06em; text-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.chapter-card p { margin: 0 auto; max-width: min(560px, calc(100vw - 48px)); font-family: var(--head); font-size: clamp(15px, 4vw, 18px); line-height: 1.6; opacity: .9; }
.chapter-card .hint { display: inline-block; margin-top: 26px; font-size: 12px; opacity: .55; animation: blink 1.4s steps(1) infinite; }
.chapter-card.leaving { opacity: 0; transition: opacity .45s; }

.item-ic { display: grid; place-items: center; width: 64px; height: 56px; }
.item-ic .i.px { width: 44px; height: 44px; }

/* market mood note in the finance panel */
.market-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin: 0 0 12px; border-radius: 12px; background: rgba(255, 248, 232, .7); border: 1px solid rgba(140, 104, 60, .18); }
.market-note .i { flex: none; margin-top: 2px; }
.market-note b { display: block; font-size: 13.5px; color: var(--ink); }
.market-note span { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.market-note .gains { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.market-note .gains .chip { display: inline-block; }
.investors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.investor { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 252, 245, .75); border: 1px solid rgba(140, 104, 60, .16); }
.investor .gains { display: flex; flex-wrap: wrap; gap: 4px; }
.investor .btn { align-self: flex-start; margin-top: 2px; }
@media (max-width: 760px) and (orientation: portrait) { .investors { grid-template-columns: 1fr; } }
.start .version { text-align: center; margin: 6px 0 0; font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; }
.dc-card { display: grid; grid-template-columns: 168px 1fr; gap: 12px; align-items: center; margin: 8px 0; }
.dc-card img { width: 168px; height: 95px; object-fit: cover; border-radius: 10px; image-rendering: pixelated; box-shadow: 0 0 0 2px rgba(59, 42, 30, .25); }
.dc-card b { font-size: 14px; }
.round-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed rgba(110, 78, 50, .18); }
.round-row b { display: block; font-size: 13.5px; }
.round-row .note { display: block; }
@media (max-width: 760px) and (orientation: portrait) { .dc-card { grid-template-columns: 1fr; } .dc-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; } }
.chapter-card.ending { background: radial-gradient(ellipse at center, rgba(70, 48, 20, .55), rgba(27, 20, 12, .86)); }
.chapter-card.ending h2 { color: #ffd98a; }
/* lab logo picker and HUD mark */
.start .logos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.start .logos .tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; }
.start .logos img { width: 40px; height: 40px; image-rendering: pixelated; }
.start .logos small { font-size: 11px; color: var(--ink-3); }
#company .lab-logo { width: 34px; height: 34px; image-rendering: pixelated; flex: none; margin-right: 2px; }
.who small.en { margin-left: 6px; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }

/* Phones play in landscape only. Portrait phones get a rotate prompt; short landscape screens scale the glass UI
   down so the desktop layout fits (the pixel scene keeps its full size). */
@media (max-width: 760px) and (orientation: portrait) {
  body::after { content: '请把手机横过来玩  ⟳'; position: fixed; inset: 0; z-index: 999; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 18px; color: #fbf3e7; background: rgba(27, 20, 12, .94); letter-spacing: .1em; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .hud-left, .hud-right, .objective, .model-card, .dock, .advance-wrap, .dialogue, .report, .sheet, .toast, .notices, .start, .chapter-card .inner, .recap, .poster-studio, .final, .lang-pick { zoom: .66; }
  .screen { padding: 8px; overflow: auto; align-items: start; }
  .start { max-height: none; overflow: visible; }
  .start form { max-height: none; overflow: visible; }
}
@media (max-height: 420px) and (orientation: landscape) {
  .hud-left, .hud-right, .objective, .model-card, .dock, .advance-wrap, .dialogue, .report, .sheet, .toast, .notices, .start, .chapter-card .inner, .recap, .poster-studio, .final, .lang-pick { zoom: .58; }
}
/* final settlement */
.final { width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 26px 30px; background: var(--paper-deep); }
.final small { letter-spacing: .4em; font-size: 12px; color: var(--ink-3); }
.final h2 { margin: 6px 0 10px; font-family: var(--head); font-size: 34px; }
.final .story { font-size: 16px; line-height: 1.75; color: var(--ink); }
.final h3 { margin: 16px 0 6px; font-size: 14px; color: var(--ink-2); }
.final ul { margin: 0; padding-left: 18px; line-height: 1.7; font-size: 13.5px; }
.final .kpis { margin-top: 14px; }
.final .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Language picker on first launch. */
.lang-pick { width: min(520px, 100%); padding: 28px; display: grid; gap: 18px; justify-items: center; text-align: center; background: var(--paper-deep); }
.lang-pick img { width: min(360px, 90%); }
.lang-pick .seg { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.lang-pick .tile { padding: 18px 12px; display: grid; gap: 4px; }
.lang-pick .tile b { font-size: 22px; }

/* English layout: text runs longer than the Chinese the screens were tuned for. Scoped to lang=en; Chinese is untouched. */
/* Noto CJK draws curly quotes and apostrophes full-width; take them from the system Latin font instead. */
@font-face { font-family: "FL Punct"; src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("Segoe UI"), local("Roboto"), local("Noto Sans"), local("DejaVu Sans"), local("Liberation Sans"); unicode-range: U+2018-201D; }
/* The CJK subset draws curly quotes full-width. In English, the same font without them, so quotes fall through to a Latin face. */
@font-face { font-family: "FL Sans EN"; font-weight: 400; font-display: swap; src: url("assets/fonts/sans-400.woff2") format("woff2"); unicode-range: U+0000-2017, U+201E-FFFF; }
@font-face { font-family: "FL Sans EN"; font-weight: 600 800; font-display: swap; src: url("assets/fonts/sans-700.woff2") format("woff2"); unicode-range: U+0000-2017, U+201E-FFFF; }
:root[lang=en] { --sans: "FL Punct", "FL Sans EN", Arial, "Helvetica Neue", Helvetica, "Segoe UI", Roboto, "Noto Sans", "DejaVu Sans", "Liberation Sans", "FL Sans", "PingFang SC", "Microsoft YaHei", sans-serif; }
:root[lang=en] body { font-synthesis: none; }
:root[lang=en] .dock button { width: 82px; font-size: 12px; }
:root[lang=en] .objective { max-width: max(300px, min(640px, calc(100vw - 830px))); }
:root[lang=en] .objective p { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13.5px; line-height: 1.35; }
:root[lang=en] .advance strong { letter-spacing: 0; font-size: 17px; }
:root[lang=en] .advance small { line-height: 1.25; }
:root[lang=en] .start .hero p { max-width: 44ch; font-size: 17px; line-height: 1.6; }
:root[lang=en] .start .hero .en { display: none; }
:root[lang=en] .sheet .tabs button { padding: 6px 10px; }
:root[lang=en] .tier .tile b, :root[lang=en] .node, :root[lang=en] .tree .tile b { overflow-wrap: anywhere; }
:root[lang=en] .model-card .paths .meter { grid-template-columns: 104px 1fr 30px; }
:root[lang=en] .cash-card { min-width: 210px; max-width: 320px; }
:root[lang=en] .cash-card .runway { white-space: normal; line-height: 1.3; }
@media (min-width: 761px) { :root[lang=en] .dialogue .choice > span:first-child { flex: 0 0 34%; } }
/* Long English effect chips wrap inside the choice instead of running past it. */
.dialogue .choice .chips { min-width: 0; flex: 1 1 auto; }
:root[lang=en] .dialogue .choice .chip { white-space: normal; text-align: right; }
:root[lang=en] .cash-card .flow { gap: 8px; font-size: 11.5px; }
:root[lang=en] .compute-meter { line-height: 1.35; font-size: 11px; }
:root[lang=en] .dialogue .line { line-height: 1.5; }
:root[lang=en] .dialogue .who b { letter-spacing: 0; }
:root[lang=en] .chapter-card h2 { letter-spacing: .02em; }
:root[lang=en] .chapter-card small { letter-spacing: .3em; }
:root[lang=en] .final small { letter-spacing: .2em; }
:root[lang=en] .report .nums span { font-size: 11px; }
:root[lang=en] .start .grid2 .seg .tile { padding-inline: 4px; font-size: 13px; }
:root[lang=en] body::after { content: 'Please rotate your phone to landscape  ⟳'; letter-spacing: .02em; }
@media (min-width: 761px) and (max-width: 1320px) {
  :root[lang=en] .objective { left: 424px; transform: none; max-width: calc(100vw - 424px - 480px); animation: none; }
  :root[lang=en] .objective p { -webkit-line-clamp: 3; }
}

:root[lang=en] .dim { grid-template-columns: 78px 1fr 28px; }
:root[lang=en] .agi-dims .dim { grid-template-columns: 84px 1fr 28px; }
:root[lang=en] .sheet .tabs { flex-wrap: wrap; width: auto; }
:root[lang=en] .sheet .tabs button { padding: 6px 10px; }
:root[lang=en] .objective p { -webkit-line-clamp: 3; font-size: 13px; }

/* Same question, before and after (release panel). */
.same-q { margin-top: 10px; border-radius: 10px; background: rgba(110, 78, 50, .07); padding: 8px 12px; }
.same-q summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.same-q .q { margin: 8px 0 6px; font-size: 13.5px; }
.same-q small { color: var(--ink-3, var(--ink-2)); }
.same-q .grid2 p { margin: 2px 0 0; font-size: 13.5px; }

.advance[hidden] { display: none; }

.choice > span:first-child small { display: block; font-weight: 500; font-size: 12px; margin-top: 2px; }

/* Nothing from the office shows through the ending page. */
body.final-open .scene-bubble { display: none; }

/* ---- Round 28: chapter settlement, final outcome, poster studio ---- */
.recap { width: min(1040px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 26px 30px 22px; background: var(--paper-deep); animation: rise .5s var(--ease) both; }
.recap header h2 { margin: 0; font-family: var(--head); font-size: 28px; letter-spacing: .01em; }
.recap header .span { margin: 4px 0 0; color: var(--ink-3); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.recap .verdict { margin: 16px 0 18px; font-size: 20px; font-weight: 650; line-height: 1.45; color: var(--ink); max-width: 46ch; }
.recap-cols { display: grid; grid-template-columns: 1.05fr 1fr; gap: 30px; }
.recap h3 { margin: 0 0 8px; font-size: 15px; color: var(--amber-ink); }
.recap h4 { margin: 16px 0 6px; font-size: 13px; color: var(--ink-2); font-weight: 650; }
.ledger { margin: 0; display: grid; }
.ledger div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ledger dt { color: var(--ink-2); font-size: 14px; }
.ledger dd { margin: 0; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; text-align: right; }
.ledger em, .recap em { font-style: normal; font-size: 12.5px; font-weight: 650; margin-left: 8px; }
.ledger em.up { color: var(--teal-ink); }
.ledger em.down { color: var(--coral-ink); }
.moments, .releases { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 14px; }
.moments li { display: flex; gap: 9px; align-items: baseline; }
.moments li::before { content: ""; flex: none; width: 7px; height: 7px; background: var(--amber); transform: translateY(-1px); }
.releases li { color: var(--ink); }
.releases time { display: inline-block; min-width: 96px; margin-right: 6px; color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.releases small { margin-left: 6px; color: var(--teal-ink); font-size: 12px; }
.race { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.race li { display: grid; grid-template-columns: 26px 12px 1fr; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; }
.race li.me { background: var(--amber-soft); box-shadow: inset 0 0 0 2px rgba(225, 154, 47, .55); }
.race b { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.race li.me b { color: var(--amber-ink); }
.race i { width: 12px; height: 12px; display: block; }
.race span { font-weight: 650; font-size: 14.5px; display: flex; flex-direction: column; }
.race small { font-weight: 500; font-size: 12.5px; color: var(--ink-3); }
.recap footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.final .world { margin: -4px 0 10px; color: var(--ink-2); font-size: 15px; }
.final .world b { color: var(--amber-ink); }
.final .actions { flex-wrap: wrap; }
.poster-screen { z-index: 70; }
.poster-studio { width: min(1080px, 100%); max-height: calc(100vh - 32px); display: grid; grid-template-columns: auto minmax(300px, 360px); gap: 22px; padding: 20px; background: var(--paper-deep); overflow: auto; }
.poster-preview { display: grid; place-items: center; }
.poster-preview canvas { height: min(calc(100vh - 80px), 820px); width: auto; aspect-ratio: 4 / 5; border-radius: 10px; box-shadow: var(--shadow); background: var(--night); }
.poster-side h2 { margin: 0; font-size: 22px; font-family: var(--head); }
.poster-side h3 { margin: 16px 0 8px; font-size: 13px; color: var(--ink-2); }
.poster-layouts { display: flex; flex-wrap: wrap; gap: 6px; }
.poster-layouts .tile { padding: 7px 12px; font-size: 14px; font-weight: 650; }
.poster-bgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.poster-bgs button { aspect-ratio: 4 / 5; border: 0; border-radius: 8px; background: var(--night) center / cover no-repeat; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(58, 36, 18, .25); image-rendering: pixelated; transition: transform .2s var(--ease); }
.poster-bgs button:hover { transform: translateY(-2px); }
.poster-bgs button.selected { box-shadow: 0 0 0 3px var(--amber), var(--shadow-sm); }
.poster-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.poster-side .note { margin-top: 10px; }
@media (max-width: 760px) {
  .recap { padding: 18px 16px; }
  .recap-cols { grid-template-columns: 1fr; gap: 18px; }
  .recap .verdict { font-size: 17px; }
  .poster-studio { grid-template-columns: 1fr; padding: 14px; }
  .poster-preview canvas { height: auto; width: 100%; }
}
.poster-layouts .tile { width: auto; display: inline-flex; }

@media (max-width: 760px) and (orientation: portrait) { :root[lang=en] body::after { content: 'Turn your phone sideways to play  ⟳'; letter-spacing: .02em; } }
@media (max-height: 500px) and (orientation: landscape) {
  .poster-studio { grid-template-columns: auto minmax(280px, 1fr); max-height: none; }
  .poster-preview canvas { height: calc(100vh - 40px); }
  .poster-bgs { grid-template-columns: repeat(6, 1fr); }
}
