:root {
  --bg-deep: #0c0c10;
  --surface: #15151c;
  --surface-strong: rgba(10, 10, 16, 0.88);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 212, 121, 0.08);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f2f2f2;
  --text-soft: rgba(255, 255, 255, 0.64);
  --text-faint: rgba(255, 255, 255, 0.38);
  --gold: #ffd479;
  --pink: #ff4d8f;
  --mint: #5eead4;
  --danger: #ff8e9c;
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --board-scale: 1;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-deep);
}

body {
  color: var(--text);
  font-family: var(--font-serif);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

#game-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg-deep);
}

.scene-background {
  position: absolute;
  inset: 0;
  background-image: url("../../资料库/06_美术Prompt与画风/男主立绘定稿_素材/宫斗-皇帝-立绘1.jpg");
  background-position: 74% 34%;
  background-size: cover;
  filter: saturate(.76) brightness(.58);
  transform: scale(1.025);
  transition: background-image .7s var(--ease), background-position .7s var(--ease), filter .7s var(--ease);
}

#game-container[data-chapter="1"] .scene-background { background-image: url("../../资料库/06_美术Prompt与画风/男主立绘定稿_素材/宫斗-皇帝-立绘1.jpg"); }
#game-container[data-chapter="2"] .scene-background { background-image: url("../../资料库/06_美术Prompt与画风/男主立绘定稿_素材/宫斗-皇帝-立绘3.jpg"); background-position: 72% 43%; }
#game-container[data-chapter="3"] .scene-background { background-image: url("../../资料库/06_美术Prompt与画风/男主立绘定稿_素材/宫斗-国师-立绘.jpg"); background-position: 76% 30%; }
#game-container[data-chapter="4"] .scene-background { background-image: url("../../资料库/06_美术Prompt与画风/男主立绘定稿_素材/宫斗-女主-全身图.jpg"); background-position: 72% 37%; }
#game-container[data-chapter="5"] .scene-background { background-image: url("../../资料库/06_美术Prompt与画风/男主立绘定稿_素材/宫斗-国师-立绘-星盘.jpg"); background-position: 74% 42%; }
#game-container[data-chapter="6"] .scene-background { background-image: url("../../资料库/06_美术Prompt与画风/男主立绘定稿_素材/宫斗-国师-立绘-星盘.jpg"); background-position: 78% 36%; }

.scene-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 6, 10, .94), rgba(9, 9, 14, .65) 47%, rgba(8, 8, 12, .26));
  pointer-events: none;
}

.gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .42), transparent 28%, rgba(0, 0, 0, .62));
  pointer-events: none;
}

.view {
  position: absolute;
  inset: 0;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s var(--ease), visibility 0s;
}

.view.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .2s var(--ease), visibility 0s;
}

.is-hidden { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }

.eyebrow,
.brief-label,
.section-label,
.result-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Persistent product shell */
.status-hud {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 60;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 14px;
  padding: 8px 68px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .72), rgba(0, 0, 0, .18), transparent);
  pointer-events: none;
  transition: opacity .25s var(--ease);
}

.hud-time { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.hud-time span { color: var(--text); font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.hud-time strong { padding: 3px 10px; border: 1px solid rgba(255, 212, 121, .42); border-radius: 12px; color: var(--gold); font-size: 9px; font-weight: 400; letter-spacing: 1px; }

.hud-values {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
}

.hud-values span { color: var(--text-faint); font-family: var(--font-sans); font-size: 9px; white-space: nowrap; }
.hud-values b { margin-left: 4px; color: var(--gold); font-family: ui-monospace, monospace; font-size: 12px; }

.ui-icon {
  position: absolute;
  z-index: 70;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  opacity: .78;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}

.ui-icon svg { width: 28px; height: 28px; }
.ui-icon:hover { opacity: 1; }
.ui-icon:active { transform: scale(.92); }
.global-back { top: 3px; left: 14px; }
.archive-button { top: 3px; right: 14px; }
.play-tools {
  position: absolute;
  top: 0;
  right: 52px;
  z-index: 72;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
}
.tool-icon { position: relative; display: grid; width: 44px; height: 44px; place-items: center; color: var(--text-soft); opacity: .82; transition: color .18s var(--ease), opacity .18s var(--ease), transform .18s var(--ease); }
.tool-icon svg { width: 28px; height: 28px; }
.tool-icon:hover { color: var(--gold); opacity: 1; }
.tool-icon:active { transform: scale(.92); }
.tool-tooltip {
  position: absolute;
  top: 48px;
  left: 50%;
  width: max-content;
  max-width: 120px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-soft);
  background: rgba(8, 8, 12, .94);
  font-family: var(--font-sans);
  font-size: 9px;
  line-height: 1.3;
  letter-spacing: 0;
  opacity: 0;
  transform: translate(-50%, -3px);
  pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.tool-icon:hover .tool-tooltip,
.tool-icon:focus-visible .tool-tooltip { opacity: 1; transform: translate(-50%, 0); }
.mobile-brief-button { display: grid; }

/* Stage overview */
.hub-view { display: flex; align-items: stretch; padding: 68px clamp(26px, 5vw, 82px) 34px; gap: clamp(26px, 5vw, 78px); }
.hub-copy { width: min(38vw, 470px); align-self: center; }
.hub-copy h1 { margin: 9px 0 14px; font-size: clamp(48px, 7vw, 92px); font-weight: 700; letter-spacing: 12px; }
.hub-lead { margin: 0; color: var(--text-soft); font-family: var(--font-sans); font-size: clamp(13px, 1.4vw, 17px); font-weight: 300; line-height: 1.9; }
.hub-progress { display: flex; align-items: baseline; gap: 12px; margin-top: 28px; color: var(--text-faint); font-size: 10px; letter-spacing: 2px; }
.hub-progress strong { color: var(--gold); font-size: 17px; }

.chapter-list {
  width: min(56vw, 720px);
  margin: auto 0 auto auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chapter-entry {
  position: relative;
  display: grid;
  min-height: 118px;
  grid-template-columns: 42px 1fr;
  align-content: center;
  gap: 4px 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text-soft);
  text-align: left;
  background: rgba(12, 12, 18, .82);
  backdrop-filter: blur(8px);
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}

.chapter-entry:hover { border-color: rgba(255, 212, 121, .7); background: rgba(30, 26, 16, .9); }
.chapter-entry:active { transform: scale(.98); }
.chapter-entry.is-current { border-color: rgba(255, 212, 121, .72); box-shadow: inset 3px 0 0 var(--gold); }
.chapter-entry.is-complete { border-color: rgba(94, 234, 212, .38); }
.chapter-entry:last-child { grid-column: 2; }
.chapter-number { grid-row: 1 / 3; color: var(--gold); font-size: 27px; font-weight: 700; }
.chapter-name { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.chapter-name small { display: block; margin-top: 6px; color: var(--text-faint); font-family: var(--font-sans); font-size: 9px; font-weight: 400; }
.chapter-state { align-self: end; color: var(--text-faint); font-family: var(--font-sans); font-size: 9px; }
.chapter-entry.is-current .chapter-state { color: var(--gold); }
.chapter-entry.is-complete .chapter-state { color: var(--mint); }

/* Chapter transition */
#game-container[data-view="intro"] { background: #000; }
#game-container[data-view="intro"] .scene-background,
#game-container[data-view="intro"] .scene-vignette,
#game-container[data-view="intro"] .gradient-overlay,
#game-container[data-view="intro"] .global-back,
#game-container[data-view="intro"] .status-hud,
#game-container[data-view="intro"] .archive-button { opacity: 0; pointer-events: none; }

.intro-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #000;
}

.intro-copy {
  width: min(620px, 82vw);
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  box-shadow: none;
  pointer-events: none;
  animation: intro-title-in .72s var(--ease) both;
}

.intro-en {
  margin: 0 0 22px;
  color: rgba(255, 255, 255, .34);
  font-family: var(--font-sans);
  font-size: clamp(8px, .72vw, 11px);
  font-weight: 500;
  letter-spacing: .62em;
  line-height: 1;
}

.intro-copy h2 {
  margin: 0;
  color: rgba(255, 255, 255, .96);
  font-size: clamp(34px, 3.45vw, 54px);
  font-weight: 500;
  letter-spacing: .24em;
  line-height: 1.15;
  text-indent: .24em;
}

.intro-title {
  margin: 24px 0 0;
  color: rgba(255, 255, 255, .48);
  font-size: clamp(12px, 1.12vw, 17px);
  font-weight: 400;
  letter-spacing: .24em;
  line-height: 1.45;
  text-indent: .24em;
}

.intro-setting,
.intro-body,
.intro-objective { display: none; }

.intro-start {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.intro-start:focus-visible { outline: 0; }

@keyframes intro-title-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.text-command {
  min-height: 40px;
  padding: 9px 24px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.text-command:hover { border-color: var(--gold); color: var(--gold); background: rgba(255, 212, 121, .06); }
.text-command:active { transform: scale(.98); }

/* ADV */
.story-objective {
  position: absolute;
  top: 62px;
  left: 18px;
  max-width: 370px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 212, 121, .35);
  border-radius: 10px;
  background: rgba(0, 0, 0, .38);
}
.story-objective span { color: var(--gold); font-size: 8px; letter-spacing: 2px; }
.story-objective p { margin: 4px 0 0; color: var(--text-soft); font-size: 10px; }
.dialogue-wrap { position: absolute; right: 0; bottom: 0; left: 0; padding: 0 16px 12px; }
.dialogue-name { display: inline-block; margin: 0 0 0 10px; padding: 5px 16px; border-radius: 7px 7px 0 0; color: #111; background: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: 2px; }
.dialogue-box {
  position: relative;
  display: block;
  width: 100%;
  min-height: 104px;
  padding: 16px 20px 25px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-strong);
  backdrop-filter: blur(10px);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.9;
  text-align: left;
}
.dialogue-box small { position: absolute; right: 15px; bottom: 8px; color: var(--text-faint); font-size: 9px; }

/* Full-screen gameplay layer */
.play-view { background: rgba(8, 8, 12, .76); backdrop-filter: blur(7px); }
.play-header { position: absolute; top: 58px; left: 20px; z-index: 12; max-width: calc(100vw - 420px); }
.play-header h2 { display: inline-block; margin: 4px 0 0; font-size: 23px; line-height: 1.2; letter-spacing: 3px; }
#game-subtitle { display: inline-block; margin: 0 0 0 16px; color: var(--text-faint); font-family: var(--font-sans); font-size: 10px; }

.mission-brief {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 82;
  display: none;
  width: min(1120px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 30px 62px 28px 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #15151c;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 100vmax #08080c, 0 20px 70px rgba(0,0,0,.58);
}
.mission-brief.is-mobile-open { display: block; animation: brief-fade .18s var(--ease); }
.mission-brief-close { position: absolute; top: 8px; right: 10px; display: grid; width: 44px; height: 44px; place-items: center; color: var(--text-soft); font-size: 27px; }
.brief-title { margin: 0 0 18px; color: var(--text); font-size: 24px; line-height: 1.2; letter-spacing: 4px; }
.brief-copy { margin: 12px 0 18px; color: var(--text-soft); font-family: var(--font-sans); font-size: 12px; line-height: 1.75; }
.brief-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.brief-rules p { position: relative; margin: 0; padding: 8px 9px 8px 28px; border: 1px solid rgba(255,255,255,.08); border-radius: 7px; color: var(--text-faint); font-family: var(--font-sans); font-size: 10px; line-height: 1.45; background: rgba(255,255,255,.025); }
.brief-rules p::before { position: absolute; top: 9px; left: 9px; content: "◇"; color: var(--text-faint); }
.brief-rules p.is-met { border-color: rgba(94, 234, 212, .38); color: var(--mint); background: rgba(94, 234, 212, .045); }
.brief-rules p.is-met::before { content: "✓"; color: var(--mint); }
.brief-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.brief-enter { min-width: 148px; min-height: 44px; padding: 9px 22px; border: 1px solid rgba(255,212,121,.58); border-radius: 9px; color: var(--gold); background: rgba(255,212,121,.08); font-size: 12px; letter-spacing: 2px; }
.brief-enter:hover { border-color: var(--gold); background: rgba(255,212,121,.14); }
.brief-enter span { margin-left: 5px; }

.game-screen {
  position: absolute;
  top: 116px;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 8;
  display: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 15, 22, .9);
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .25);
}
.game-screen.is-active { display: flex; align-items: center; justify-content: center; }
.game-screen.has-submit { padding-bottom: 60px; }
#game-container.brief-open .game-screen,
#game-container.brief-open .play-header,
#game-container.brief-open .play-tools,
#game-container.brief-open .global-back,
#game-container.brief-open .archive-button { pointer-events: none; }
#game-container.brief-open .game-screen,
#game-container.brief-open .play-header,
#game-container.brief-open .play-tools,
#game-container.brief-open .global-back,
#game-container.brief-open .archive-button,
#game-container.brief-open .status-hud {
  visibility: hidden;
  opacity: 0;
}
.section-label { margin-bottom: 12px; color: var(--text-faint); font-size: 9px; }
.section-label.centered { text-align: center; }

.ritual-board,
.trace-board,
.dispatch-board { width: min(760px, 92%); max-height: 100%; overflow-y: auto; padding: 4px; }
.sequence-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.sequence-slot { min-height: 62px; padding: 9px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--text-faint); font-size: 10px; line-height: 1.5; }
.sequence-slot::before { display: block; margin-bottom: 3px; content: attr(data-number); color: var(--gold); font-size: 9px; }
.sequence-slot.is-filled { border-style: solid; border-color: rgba(255,212,121,.5); color: var(--text); background: rgba(255,212,121,.06); }
.law-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-bottom: 14px; }
.choice-line { min-height: 48px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--text-soft); font-family: var(--font-sans); font-size: 10px; line-height: 1.5; text-align: left; background: var(--surface-soft); }
.choice-line:hover { border-color: var(--gold); background: var(--surface-hover); }
.choice-line.is-used { opacity: .28; pointer-events: none; }

/* Banquet placement */
.banquet-stage,
.route-board { position: absolute; width: 1120px; height: 650px; transform: scale(var(--board-scale)); transform-origin: center; }
.person-pool { position: absolute; top: 15px; left: 50%; z-index: 3; display: flex; gap: 7px; transform: translateX(-50%); }
.person-choice,
.trace-token { min-width: 92px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-soft); background: rgba(255,255,255,.035); font-size: 12px; }
.person-choice.is-selected,
.trace-token:hover { border-color: var(--gold); color: var(--gold); background: var(--surface-hover); }
.person-choice.is-used,
.trace-token.is-used { opacity: .28; }
.banquet-table { position: absolute; top: 122px; left: 490px; display: flex; width: 250px; height: 395px; align-items: center; justify-content: center; border: 1px solid rgba(255,212,121,.3); border-radius: 50%; color: var(--gold); background: radial-gradient(circle, rgba(255,212,121,.06), transparent 70%); font-size: 24px; letter-spacing: 8px; }
.banquet-table small { position: absolute; bottom: 24px; color: var(--text-faint); font-size: 10px; letter-spacing: 3px; }
.seat-node { position: absolute; z-index: 3; width: 150px; min-height: 44px; padding: 8px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--text-faint); background: rgba(12,12,18,.8); font-size: 12px; }
.seat-node.is-filled { border-style: solid; border-color: rgba(255,212,121,.5); color: var(--text); }
.seat-node.is-fixed { border-color: rgba(255,77,143,.55); color: var(--pink); }
.game-submit {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 8;
  min-width: 142px;
  min-height: 44px;
  border-color: rgba(255, 212, 121, .55);
  color: var(--gold);
  background: rgba(255, 212, 121, .08);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .28);
}
.game-submit:hover { border-color: var(--gold); background: rgba(255, 212, 121, .14); }
.game-submit:disabled { border-color: var(--line); color: var(--text-faint); background: rgba(255,255,255,.025); box-shadow: none; cursor: default; opacity: .62; }

/* Trace */
.trace-chain { display: flex; align-items: center; gap: 18px; margin: 18px 0; }
.trace-step { position: relative; flex: 1; min-height: 66px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--text-faint); font-size: 11px; }
.trace-step:not(:last-child)::after { position: absolute; top: 50%; right: -15px; content: "→"; color: var(--text-faint); transform: translateY(-50%); }
.trace-step.is-filled { border-style: solid; color: var(--text); background: var(--surface-soft); }
.trace-step.is-fixed { border-style: solid; border-color: rgba(255,212,121,.4); color: var(--gold); }
.trace-step.is-suspect { border-color: var(--pink); color: var(--pink); box-shadow: 0 0 18px rgba(255,77,143,.16); }
.trace-pool { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.trace-hint { color: var(--mint); font-family: var(--font-sans); font-size: 10px; text-align: center; }

/* Dispatch */
.dispatch-board { display: grid; grid-template-columns: 230px 1fr; gap: 14px; }
.dispatch-board > .section-label,
.dispatch-board > .text-command { grid-column: 1 / -1; }
.attendant-list,
.task-list { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 8px; align-self: stretch; }
.attendant-choice { position: relative; min-height: 72px; padding: 11px 82px 11px 11px; border: 1px solid var(--line); border-radius: 9px; text-align: left; background: var(--surface-soft); }
.attendant-choice strong { display: block; color: var(--text); font-size: 12px; }
.attendant-choice small { display: block; margin-top: 5px; color: var(--text-faint); font-family: var(--font-sans); font-size: 9px; line-height: 1.5; }
.attendant-choice::after { position: absolute; top: 50%; right: 11px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--text-faint); font-family: var(--font-sans); font-size: 8px; content: "可选择"; transform: translateY(-50%); }
.attendant-choice.is-selected { border-color: var(--gold); background: rgba(255,212,121,.07); }
.attendant-choice.is-selected::after { border-color: rgba(255,212,121,.5); color: var(--gold); content: "待安排"; }
.attendant-choice.is-used { border-color: rgba(94,234,212,.32); background: rgba(94,234,212,.045); }
.attendant-choice.is-used::after { border-color: rgba(94,234,212,.42); color: var(--mint); content: "已安排 ✓"; }
.task-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 98px; align-items: center; min-height: 72px; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; text-align: left; background: var(--surface-soft); }
.task-row:hover { border-color: var(--gold); }
.task-row.is-assigned { border-color: rgba(94,234,212,.28); background: rgba(94,234,212,.035); }
.task-name { color: var(--text); font-size: 11px; font-weight: 700; }
.task-detail { color: var(--text-faint); font-family: var(--font-sans); font-size: 9px; line-height: 1.45; }
.task-assignee { display: flex; min-height: 38px; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--text-faint); font-family: var(--font-sans); font-size: 9px; text-align: left; }
.task-assignee.is-assigned { justify-content: flex-start; border-style: solid; border-color: rgba(94,234,212,.48); color: var(--mint); background: rgba(94,234,212,.07); }
.task-assignee small { display: block; color: var(--text-faint); font-size: 7px; line-height: 1; }
.task-assignee strong { display: block; margin-top: 3px; color: var(--mint); font-family: var(--font-serif); font-size: 10px; line-height: 1; }
.assignee-check { display: grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; border-radius: 50%; color: #091411; background: var(--mint); font-size: 11px; font-weight: 700; }
.assignee-empty { color: var(--text-faint); font-size: 13px; }

/* Route */
.route-lines { position: absolute; inset: 0; width: 1120px; height: 650px; }
.route-line { stroke: rgba(255,255,255,.14); stroke-width: 2; stroke-dasharray: 6 7; }
.route-line.is-travelled { stroke: var(--gold); stroke-dasharray: none; }
.route-node { position: absolute; z-index: 3; width: 150px; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; color: var(--text-faint); background: rgba(12,12,18,.86); font-size: 12px; }
.route-node.is-available { border-color: rgba(255,212,121,.5); color: var(--text); }
.route-node.is-current { border-color: var(--pink); color: var(--pink); box-shadow: 0 0 18px rgba(255,77,143,.18); }
.route-node.is-visited { color: var(--mint); }
.route-log { position: absolute; bottom: 18px; left: 50%; margin: 0; padding: 7px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--text-soft); background: rgba(0,0,0,.42); font-size: 10px; transform: translateX(-50%); }

/* Palace lantern cipher */
.lantern-game {
  position: relative;
  display: grid;
  width: min(1080px, 94%);
  height: min(520px, 94%);
  grid-template-rows: auto 1fr auto auto;
  padding: 0 24px 18px;
  overflow: hidden;
  border: 1px solid rgba(255,212,121,.16);
  border-radius: 14px;
  background: #090a10;
}
.lantern-status { display: grid; min-height: 62px; grid-template-columns: 150px 1fr 60px; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.lantern-status div:first-child span { display: block; color: var(--text-faint); font-family: var(--font-sans); font-size: 8px; }
.lantern-status div:first-child strong { display: block; margin-top: 4px; color: var(--gold); font-size: 11px; font-weight: 400; }
.lantern-status p { margin: 0; color: var(--text-soft); font-family: var(--font-sans); font-size: 10px; text-align: center; }
.lantern-lives { display: flex; justify-content: flex-end; gap: 6px; }
.lantern-lives i { width: 12px; height: 12px; border: 1px solid var(--gold); transform: rotate(45deg); transition: opacity .2s; }
.lantern-lives i.is-lost { opacity: .16; }
.lantern-sky { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; gap: 18px; padding: 18px 3%; }
.lantern-sky::before { position: absolute; top: 16%; right: 2%; left: 2%; height: 1px; content: ""; background: rgba(255,255,255,.1); }
.lantern {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 170px;
  place-items: center;
  opacity: .48;
  transition: opacity .18s, transform .18s;
}
.lantern::before { position: absolute; top: 0; width: 1px; height: 34px; content: ""; background: rgba(255,255,255,.22); }
.lantern i { position: relative; display: block; width: 72px; height: 92px; margin-top: 22px; border: 1px solid rgba(255,212,121,.36); border-radius: 36px 36px 22px 22px; background: rgba(70,42,18,.24); box-shadow: inset 0 0 18px rgba(255,212,121,.05); }
.lantern i::before,
.lantern i::after { position: absolute; right: 10px; left: 10px; height: 1px; content: ""; background: rgba(255,212,121,.22); }
.lantern i::before { top: 13px; }
.lantern i::after { bottom: 13px; }
.lantern span { position: absolute; bottom: 4px; color: var(--text-faint); font-size: 9px; }
.lantern:not(:disabled):hover { opacity: .78; transform: translateY(-3px); }
.lantern.is-lit,
.lantern.is-correct { opacity: 1; transform: translateY(-5px); }
.lantern.is-lit i,
.lantern.is-correct i { border-color: var(--gold); background: rgba(255,171,55,.48); box-shadow: 0 0 18px rgba(255,174,63,.8), 0 0 54px rgba(255,174,63,.42), inset 0 0 22px rgba(255,244,193,.55); }
.lantern.is-wrong i { border-color: var(--danger); background: rgba(255,80,95,.34); box-shadow: 0 0 28px rgba(255,80,95,.6); }
.decoy-lantern.is-decoy-lit { opacity: 1; transform: rotate(3deg); }
.decoy-lantern.is-decoy-lit i { border-color: rgba(180,218,255,.7); background: rgba(120,180,255,.35); box-shadow: 0 0 22px rgba(120,180,255,.65); }
.lantern-sequence { display: flex; min-height: 30px; align-items: center; justify-content: center; gap: 8px; }
.lantern-sequence i { width: 24px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.12); }
.lantern-sequence i.is-filled { background: var(--gold); }
.lantern-play { justify-self: center; min-width: 150px; color: var(--gold); border-color: rgba(255,212,121,.5); }
.lantern-play:disabled { opacity: .44; pointer-events: none; }

@keyframes watch-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes sleeve-ready { 50% { box-shadow: 0 0 22px rgba(255,212,121,.12); } }
@keyframes current-action { 50% { box-shadow: 0 0 0 2px rgba(94,234,212,.18), 0 0 30px rgba(94,234,212,.18); } }

/* Result and settlement */
.result-layer,
.archive-layer {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(5,5,8,.68);
  backdrop-filter: blur(8px);
  transition: opacity .25s var(--ease), visibility 0s .25s;
}
.result-layer.is-visible,
.archive-layer.is-visible { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .25s var(--ease), visibility 0s; }
.result-copy {
  width: min(620px, 92vw);
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 20px 70px rgba(0,0,0,.5);
  animation: rise .3s var(--ease);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.result-copy h2 { margin: 7px 0 11px; font-size: 25px; letter-spacing: 2px; }
.result-copy > p:not(.result-kicker) { color: var(--text-soft); font-family: var(--font-sans); font-size: 12px; line-height: 1.8; }
.result-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.result-actions button { min-height: 44px; padding: 8px 18px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text-soft); font-size: 11px; }
#result-next { border-color: var(--gold); color: #111; background: var(--gold); }

.settlement-view { display: flex; align-items: center; justify-content: center; padding: 70px 20px 24px; background: rgba(8,8,12,.84); backdrop-filter: blur(8px); }
.settlement-copy {
  display: grid;
  width: min(760px, 94vw);
  grid-template-columns: 180px 1fr;
  gap: 8px 22px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.settlement-copy > .eyebrow { grid-column: 1; }
.settlement-copy h2 { grid-column: 1; grid-row: 2 / 5; margin: 0; font-size: 30px; line-height: 1.35; letter-spacing: 2px; }
.settlement-copy > p:not(.eyebrow) { grid-column: 2; margin: 0; color: var(--text-soft); font-family: var(--font-sans); font-size: 11px; line-height: 1.75; }
.settlement-deltas { grid-column: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.settlement-deltas span { padding: 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--text-faint); font-size: 9px; text-align: center; }
.settlement-deltas b { display: block; margin-top: 3px; color: var(--gold); font-family: ui-monospace, monospace; font-size: 15px; }
.settlement-copy blockquote { grid-column: 2; margin: 0; padding: 9px 11px; border-left: 3px solid var(--pink); color: var(--text-soft); background: rgba(255,77,143,.055); font-size: 11px; line-height: 1.7; }
.settlement-actions { grid-column: 2; display: flex; justify-content: flex-end; gap: 8px; margin-top: 5px; }

/* Relationship archive */
.archive-layer { display: block; padding: 72px clamp(22px, 8vw, 110px) 30px; overflow-y: auto; background: rgba(8,8,12,.94); }
.archive-layer > .eyebrow,
.archive-layer > h2,
.archive-layer > .relationship-list,
.archive-layer > .archive-note { max-width: 880px; margin-right: auto; margin-left: auto; }
.archive-layer h2 { margin-top: 6px; font-size: 28px; letter-spacing: 3px; }
.archive-close { position: fixed; top: 18px; right: 24px; z-index: 2; color: var(--text-soft); font-size: 30px; }
.relationship-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.relationship-item { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.relationship-item header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.relationship-item h3 { margin: 0; font-size: 15px; }
.relationship-item header span { padding: 2px 7px; border: 1px solid rgba(255,77,143,.5); border-radius: 3px; color: var(--pink); font-size: 8px; }
.relationship-item p { color: var(--text-soft); font-family: var(--font-sans); font-size: 10px; line-height: 1.7; }
.archive-note { color: var(--text-faint); font-size: 9px; text-align: center; }

.toast { position: absolute; top: 50px; right: 16px; z-index: 110; display: flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid rgba(255,212,121,.45); border-radius: 12px; color: var(--gold); background: rgba(0,0,0,.7); font-size: 10px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s var(--ease); }
.toast svg { width: 15px; height: 15px; }
.toast.is-visible { opacity: 1; transform: none; }

@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes brief-fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 900px), (max-height: 560px) {
  .status-hud {
    min-height: 44px;
    padding: 5px max(54px, calc(env(safe-area-inset-right) + 46px)) 5px max(54px, calc(env(safe-area-inset-left) + 46px));
  }
  .hud-values { gap: 8px; padding: 4px 8px; }
  .hud-values span:nth-child(4) { display: none; }
  .ui-icon { width: 44px; height: 44px; }
  .global-back { left: max(4px, env(safe-area-inset-left)); }
  .archive-button { top: max(0px, env(safe-area-inset-top)); right: max(0px, env(safe-area-inset-right)); }
  .hub-view { padding: 52px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); gap: 12px; }
  .hub-copy { width: 32vw; }
  .hub-copy h1 { font-size: 42px; letter-spacing: 7px; }
  .hub-lead { font-size: 11px; line-height: 1.7; }
  .hub-progress { margin-top: 14px; }
  .chapter-list { width: 60vw; gap: 6px; }
  .chapter-entry { min-height: 70px; padding: 8px 9px; grid-template-columns: 28px 1fr; }
  .chapter-number { font-size: 18px; }
  .chapter-name { font-size: 13px; }
  .chapter-name small { margin-top: 3px; font-size: 8px; }
  .chapter-state { font-size: 8px; }
  .play-header { top: 54px; left: max(14px, env(safe-area-inset-left)); max-width: calc(100vw - 190px); }
  .play-header h2 { font-size: 18px; }
  #game-subtitle { display: none; }
  .play-tools {
    top: max(0px, env(safe-area-inset-top));
    right: max(52px, calc(env(safe-area-inset-right) + 52px));
    gap: 8px;
  }
  .mobile-brief-button {
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--text-soft);
    background: transparent;
  }
  .mission-brief {
    top: 50%;
    right: max(12px, env(safe-area-inset-right));
    bottom: auto;
    left: max(12px, env(safe-area-inset-left));
    z-index: 82;
    display: none;
    width: auto;
    max-height: calc(100vh - 32px);
    padding: 18px 48px 18px 18px;
    transform: translateY(-50%);
    box-shadow: 0 0 0 100vmax #08080c, 0 20px 70px rgba(0,0,0,.58);
  }
  .mission-brief-close { position: absolute; top: 2px; right: 8px; display: grid; width: 44px; height: 44px; place-items: center; color: var(--text-soft); font-size: 27px; }
  .brief-title { margin-bottom: 9px; font-size: 18px; }
  .brief-copy { margin: 9px 0 12px; font-size: 12px; }
  .brief-rules { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
  .brief-rules p { min-height: 44px; padding: 8px 8px 8px 28px; font-size: 10px; }
  .brief-rules p::before { top: 9px; left: 9px; }
  .brief-actions { margin-top: 10px; }
  .brief-enter { min-width: 132px; min-height: 44px; padding: 8px 16px; font-size: 10px; }
  .game-screen { top: 100px; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); left: max(10px, env(safe-area-inset-left)); overflow: auto; }
  .game-screen.has-submit { padding-bottom: 54px; }
  .law-actions { gap: 4px; }
  .choice-line { min-height: 44px; padding: 7px 9px; font-size: 10px; }
  .ritual-board > .section-label { display: none; }
  .sequence-slots { margin-bottom: 6px; }
  .sequence-slot { min-height: 44px; padding: 6px 8px; font-size: 9px; }
  .sequence-slot::before { margin-bottom: 1px; }
  .law-actions { margin-bottom: 0; }
  .text-command { min-height: 44px; padding: 8px 16px; font-size: 10px; }
  .game-submit { right: 10px; bottom: 8px; min-width: 128px; }
  .person-choice,
  .trace-token { min-height: 44px; font-size: 11px; }
  .ritual-board,
  .trace-board,
  .dispatch-board { max-height: calc(100% - 8px); padding: 8px; }
  .dispatch-board { grid-template-columns: 170px 1fr; row-gap: 6px; overflow: visible; }
  .dispatch-board > .section-label { margin-bottom: 0; }
  .attendant-list,
  .task-list { gap: 6px; }
  .attendant-choice,
  .task-row { min-height: 54px; }
  .attendant-choice { padding: 7px 38px 7px 8px; }
  .attendant-choice::after { right: 7px; display: grid; width: 24px; height: 24px; padding: 0; place-items: center; border-radius: 50%; font-size: 0; content: ""; }
  .attendant-choice.is-selected::after { font-size: 10px; content: "…"; }
  .attendant-choice.is-used::after { color: #091411; background: var(--mint); font-size: 11px; font-weight: 700; content: "✓"; }
  .attendant-choice small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .task-row { grid-template-columns: 65px minmax(0, 1fr) 82px; padding: 6px; }
  .task-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .task-assignee { min-height: 36px; padding: 5px; }
  .lantern-game { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .lantern-game { grid-template-rows: 42px 1fr 20px 44px; padding: 0 12px 4px; }
  .lantern-status { min-height: 42px; grid-template-columns: 105px 1fr 45px; }
  .lantern-status div:first-child span { font-size: 7px; }
  .lantern-status div:first-child strong,
  .lantern-status p { font-size: 8px; }
  .lantern-lives i { width: 9px; height: 9px; }
  .lantern-sky { gap: 6px; padding: 4px 3%; }
  .lantern { min-height: 112px; }
  .lantern::before { height: 19px; }
  .lantern i { width: 42px; height: 56px; margin-top: 14px; }
  .lantern span { bottom: 0; font-size: 7px; }
  .lantern-sequence { min-height: 20px; gap: 5px; }
  .lantern-sequence i { width: 18px; }
  .lantern-play { align-self: center; min-width: 128px; min-height: 38px; }
  .settlement-copy { grid-template-columns: 145px 1fr; }
  .result-actions button { min-height: 44px; }
  .archive-layer { padding: 54px max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .relationship-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-close { top: max(2px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 44px; height: 44px; }

  /* Space-based games use dedicated phone coordinates instead of scaled desktop boards. */
  .banquet-stage,
  .route-board { position: absolute; inset: 0; width: 100%; height: 100%; transform: none; }
  .game-screen.has-submit .banquet-stage { bottom: 54px; height: auto; }
  .person-pool { top: 6px; gap: 5px; }
  .banquet-stage > .section-label { display: none; }
  .person-choice { min-width: 74px; padding: 7px 9px; }
  .banquet-table { top: 33%; left: 40%; width: 20%; height: 46%; font-size: 17px; }
  .seat-node { width: 12%; min-width: 78px; min-height: 44px; font-size: 10px; }
  .seat-node[data-seat="emperor"] { top: 22% !important; left: 44% !important; }
  .seat-node[data-seat="r1"] { top: 27% !important; left: 72% !important; }
  .seat-node[data-seat="r2"] { top: 50% !important; left: 80% !important; }
  .seat-node[data-seat="r3"] { top: 62% !important; left: 69% !important; }
  .seat-node[data-seat="south"] { top: 78% !important; left: 44% !important; }
  .seat-node[data-seat="l2"] { top: 50% !important; left: 7% !important; }
  .route-lines { display: none; }
  .route-node { width: 82px; min-height: 44px; font-size: 10px; }
  .route-node[data-route-node="start"] { top: 72% !important; left: 2% !important; }
  .route-node[data-route-node="corridor"] { top: 42% !important; left: 18% !important; }
  .route-node[data-route-node="garden"] { top: 74% !important; left: 21% !important; }
  .route-node[data-route-node="medicine"] { top: 16% !important; left: 40% !important; }
  .route-node[data-route-node="star"] { top: 58% !important; left: 42% !important; }
  .route-node[data-route-node="cold"] { top: 30% !important; left: 64% !important; }
  .route-node[data-route-node="west"] { top: 72% !important; left: 66% !important; }
  .route-node[data-route-node="gate"] { top: 48% !important; left: 84% !important; }
  .route-log { bottom: 4px; max-width: 52%; min-height: 34px; display: flex; align-items: center; font-size: 9px; }
}

@media (max-width: 680px) {
  .status-hud { min-height: 38px; padding: 5px 46px; }
  .hud-values span:nth-child(4) { display: none; }
  .global-back { top: -2px; }
  .archive-button { top: max(0px, env(safe-area-inset-top)); }
  .hub-copy { display: none; }
  .chapter-list { width: 100%; grid-template-columns: repeat(2, 1fr); }
  .play-header { max-width: 75vw; }
  #game-subtitle { display: none; }
  .story-objective { top: 45px; }
  .dialogue-box { min-height: 88px; padding: 12px 15px 20px; font-size: 12px; }
  .relationship-list { grid-template-columns: 1fr; }
  .settlement-copy { display: block; max-height: calc(100vh - 70px); overflow-y: auto; }
  .settlement-copy h2 { margin: 6px 0 10px; font-size: 22px; }
  .settlement-deltas { margin: 10px 0; }
  .settlement-copy blockquote { margin: 10px 0; }
  .intro-copy { width: 88vw; transform: translateY(-2px); }
  .intro-en { margin-bottom: 16px; font-size: 8px; letter-spacing: .5em; }
  .intro-copy h2 { font-size: clamp(30px, 8vw, 38px); }
  .intro-title { margin-top: 17px; font-size: clamp(11px, 3.2vw, 14px); }
}

@media (max-width: 780px) {
  .hub-copy { display: none; }
  .chapter-list { width: 100%; grid-template-columns: repeat(2, 1fr); }
}

@media (max-height: 370px) {
  .play-header .eyebrow,
  #game-subtitle { display: none; }
  .play-header { top: 48px; }
  .play-header h2 { margin-top: 0; font-size: 16px; }
  .game-screen { top: 78px; }
  .ritual-board > .section-label { display: none; }
  .chapter-entry { min-height: 62px; }
  .intro-copy { padding: 0; transform: translateY(-1px); }
  .intro-en { margin-bottom: 13px; }
  .intro-copy h2 { font-size: 29px; }
  .intro-title { margin-top: 14px; font-size: 11px; }
}
