:root {
  --bg: #0b0f0d;
  --bg-elevated: rgba(17, 22, 20, 0.9);
  --bg-panel: rgba(18, 24, 22, 0.74);
  --bg-panel-solid: #121916;
  --bg-soft: rgba(38, 48, 43, 0.5);
  --bg-quiet: rgba(255, 255, 255, 0.028);
  --ink: #edf4ef;
  --ink-strong: #ffffff;
  --muted: #a2aea8;
  --muted-2: #758079;
  --line: rgba(180, 198, 187, 0.13);
  --line-strong: rgba(180, 198, 187, 0.28);
  --accent: #29d3a0;
  --accent-strong: #64e3bd;
  --accent-soft: rgba(41, 211, 160, 0.13);
  --amber: #e2b15d;
  --amber-soft: rgba(226, 177, 93, 0.12);
  --blue: #82b6ff;
  --blue-soft: rgba(130, 182, 255, 0.12);
  --good: #35d18f;
  --warn: #e4aa48;
  --bad: #f16f6f;
  --focus: #64e3bd;
  --shadow: rgba(0, 0, 0, 0.2);
  --shadow-strong: rgba(0, 0, 0, 0.34);
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --header-h: 74px;
}

body.theme-light {
  --bg: #f5f2ec;
  --bg-elevated: rgba(255, 253, 247, 0.92);
  --bg-panel: rgba(255, 252, 244, 0.78);
  --bg-panel-solid: #fffaf0;
  --bg-soft: rgba(235, 229, 216, 0.58);
  --bg-quiet: rgba(255, 255, 255, 0.45);
  --ink: #28231f;
  --ink-strong: #17120f;
  --muted: #756b5e;
  --muted-2: #9a8d7c;
  --line: rgba(113, 93, 68, 0.18);
  --line-strong: rgba(113, 93, 68, 0.34);
  --accent: #b54539;
  --accent-strong: #8d3128;
  --accent-soft: rgba(181, 69, 57, 0.1);
  --amber: #a66a1f;
  --amber-soft: rgba(166, 106, 31, 0.12);
  --blue: #2b6f91;
  --blue-soft: rgba(43, 111, 145, 0.1);
  --good: #257c61;
  --warn: #a66a1f;
  --bad: #ad3936;
  --focus: #b54539;
  --shadow: rgba(86, 67, 42, 0.08);
  --shadow-strong: rgba(86, 67, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(5, 8, 7, 0.68), rgba(11, 15, 13, 0.94)),
    linear-gradient(125deg, rgba(41, 211, 160, 0.08), transparent 36%, rgba(226, 177, 93, 0.04) 72%, transparent),
    url("./cyber_ink_bg.png") center / cover fixed;
  font-family:
    "Inter",
    "Noto Sans SC",
    -apple-system,
    BlinkMacSystemFont,
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
}

body.theme-light {
  background:
    linear-gradient(180deg, rgba(247, 244, 237, 0.9), rgba(245, 242, 236, 0.97)),
    url("./light_parchment_bg.png") center / cover fixed;
}

body.regression-mode {
  background: #0d1110;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(154, 170, 160, 0.28);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.hidden {
  display: none !important;
}

.screen-effects-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.055;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 120px, #000 calc(100% - 120px), transparent 100%);
}

body.theme-light .screen-effects-overlay {
  opacity: 0.12;
}

.effects-container {
  position: fixed;
  inset: 0;
  z-index: 7000;
  pointer-events: none;
}

.app-shell {
  width: min(1480px, 100%);
  min-width: 0;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 22px 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(340px, 0.72fr) minmax(0, 2fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}

.title-block,
.topbar-controls,
.session-panel,
.panel,
.stage-panel,
.bottom-panel,
.completion-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: 0 12px 34px var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.title-block {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: var(--header-h);
  padding: 4px 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.eyebrow,
.label,
.hint,
.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.eyebrow,
.label,
.section-label {
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(27px, 2.8vw, 36px);
  line-height: 1.08;
  letter-spacing: 0;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

h2 {
  margin: 0 0 8px;
  color: var(--ink-strong);
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.16;
}

h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
  line-height: 1.25;
}

.build-pill {
  width: fit-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--accent-strong);
  background: rgba(41, 211, 160, 0.11);
  font-size: 12px;
  font-weight: 750;
}

.topbar-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  gap: 8px 12px;
  min-height: 78px;
  padding: 10px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.045), transparent 58%),
    var(--bg-panel);
}

.topbar-controls-row {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1;
  gap: 8px;
  align-items: center;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 3px;
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.12);
}

body.theme-light .mode-switch {
  background: rgba(255, 255, 255, 0.52);
}

.theme-toggle-btn,
.settings-toggle-btn,
.mode-button,
.quiet-button,
.action-button,
.tag-chip,
.inventory-token,
.zone-item,
.settings-zone-btn,
.danger-button,
.prologue-btn,
.wishlist-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

body.theme-light .theme-toggle-btn,
body.theme-light .settings-toggle-btn,
body.theme-light .mode-button,
body.theme-light .quiet-button,
body.theme-light .action-button,
body.theme-light .tag-chip,
body.theme-light .inventory-token,
body.theme-light .zone-item,
body.theme-light .settings-zone-btn {
  background: rgba(255, 255, 255, 0.6);
}

.theme-toggle-btn,
.settings-toggle-btn,
.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  white-space: nowrap;
  font-size: 13px;
}

.mode-button {
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.mode-button.active,
.mode-button:hover,
.theme-toggle-btn:hover,
.settings-toggle-btn:hover,
.quiet-button:hover,
.zone-item:hover,
.action-button:hover,
.tag-chip:hover,
.inventory-token:hover,
.settings-zone-btn:hover {
  border-color: var(--accent);
  color: var(--ink-strong);
  background: var(--accent-soft);
}

.mode-button.active {
  color: #07110e;
  background: var(--accent);
}

body.theme-light .mode-button.active {
  color: #fffaf0;
}

.status-strip {
  display: grid;
  grid-column: 2;
  grid-row: 1 / span 2;
  grid-template-columns: repeat(4, minmax(64px, 1fr));
  gap: 6px;
  min-width: 318px;
}

.status-card {
  position: relative;
  overflow: hidden;
  min-height: 46px;
  padding: 8px 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.038);
}

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.status-card strong {
  display: block;
  margin-top: 3px;
  color: var(--ink-strong);
  font-size: 19px;
  line-height: 1;
}

.status-meter {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.status-meter b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.ink-card .status-meter b { width: var(--ink-pct); background: var(--accent); }
.inventory-card .status-meter b { width: var(--inventory-pct); background: var(--blue); }
.zone-card .status-meter b { width: var(--zone-pct); background: var(--amber); }
.time-card .status-meter b { width: var(--time-pct); background: var(--bad); }

.session-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
  padding: 8px;
  background: rgba(18, 24, 22, 0.52);
  box-shadow: none;
}

.session-status {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(86px, 0.55fr) minmax(96px, 0.55fr) minmax(220px, 1.5fr);
  gap: 8px;
  min-width: 0;
}

.session-chip,
.decision-chip,
.metric {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-quiet);
}

body.theme-light .session-chip,
body.theme-light .decision-chip,
body.theme-light .metric {
  background: rgba(255, 255, 255, 0.62);
}

.session-chip span,
.decision-chip span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.session-chip strong,
.decision-chip strong,
.metric strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: 13px;
  line-height: 1.3;
}

.session-actions,
.tool-row,
.completion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 314px;
  gap: 10px;
  align-items: stretch;
  min-width: 0;
}

.panel {
  min-width: 0;
  min-height: 620px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 72%),
    rgba(18, 24, 22, 0.46);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.close-btn {
  display: none;
}

.zone-list {
  display: grid;
  gap: 8px;
}

.zone-item {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  overflow: hidden;
  text-align: left;
}

.zone-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--muted-2);
}

.zone-item i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--zone-item-pct);
  height: 3px;
  background: var(--accent);
  opacity: 0.6;
}

.zone-item strong {
  display: block;
  color: var(--ink-strong);
  font-size: 14px;
}

.zone-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.zone-item.active {
  border-color: var(--accent);
  background:
    linear-gradient(90deg, rgba(41, 211, 160, 0.16), rgba(41, 211, 160, 0.05));
}

.zone-item.active::before {
  background: var(--accent);
}

.zone-item.complete {
  border-color: rgba(53, 209, 143, 0.42);
}

.stage-panel {
  display: grid;
  grid-template-columns: minmax(286px, 0.68fr) minmax(360px, 1.32fr);
  gap: 0;
  min-width: 0;
  min-height: 620px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(41, 211, 160, 0.045), transparent 34%),
    rgba(18, 24, 22, 0.64);
}

.tactical-deck {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.05);
}

body.theme-light .tactical-deck {
  background: rgba(255, 255, 255, 0.32);
}

.stage-header {
  order: 1;
  display: grid;
  gap: 7px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.objective {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
}

.guidance-strip,
.result-pulse {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.guidance-strip {
  order: 2;
}

.result-pulse {
  order: 3;
}

.guidance-strip .label,
.result-pulse span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
}

.guidance-strip strong,
.result-pulse strong {
  min-width: 0;
  color: var(--ink-strong);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.result-pulse small {
  grid-column: 2;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.result-pulse.good { border-color: rgba(53, 209, 143, 0.46); background: rgba(53, 209, 143, 0.1); }
.result-pulse.warn { border-color: rgba(228, 170, 72, 0.54); background: var(--amber-soft); }
.result-pulse.bad { border-color: rgba(241, 111, 111, 0.54); background: rgba(241, 111, 111, 0.11); }
.result-pulse.warn span { color: var(--warn); background: var(--amber-soft); }
.result-pulse.bad span { color: var(--bad); background: rgba(241, 111, 111, 0.12); }

.decision-strip {
  order: 6;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.step-list {
  order: 7;
  display: grid;
  gap: 7px;
}

.step-item {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.step-item strong {
  color: var(--muted);
}

.step-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.step-item.active strong {
  color: var(--accent-strong);
}

.step-item.done {
  border-color: rgba(53, 209, 143, 0.32);
  color: var(--ink);
}

.context-actions {
  order: 4;
  display: grid;
  gap: 7px;
  min-height: 72px;
}

.action-group {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.026);
}

.action-group.has-ready {
  border-color: rgba(53, 209, 143, 0.35);
}

.action-group-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.action-button {
  min-width: 0;
  min-height: 38px;
  padding: 0 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.action-button.ready {
  border-color: var(--line-strong);
  color: var(--ink-strong);
}

.action-button.primary.ready,
.action-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #07110e;
}

body.theme-light .action-button.primary.ready,
body.theme-light .action-button.primary {
  color: #fffaf0;
}

.action-button.danger {
  border-color: rgba(241, 111, 111, 0.4);
  background: rgba(241, 111, 111, 0.1);
}

.action-button:disabled {
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.025);
  opacity: 0.66;
}

.action-help {
  order: 5;
  min-height: 22px;
  color: var(--muted);
  font-size: 12px;
}

.scene-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding: 18px;
  overflow: auto;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 54px 54px;
}

.object-token {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 154px;
  padding: 14px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02) 58%),
    rgba(34, 44, 39, 0.68);
}

.object-token::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--muted-2);
}

.object-token:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 16px 28px var(--shadow);
}

.object-token.selected {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(32, 201, 151, 0.16), rgba(255, 255, 255, 0.035)),
    rgba(18, 28, 24, 0.9);
}

.object-token.selected::before {
  background: var(--accent);
}

.object-token.recommended {
  border-color: rgba(226, 177, 93, 0.55);
}

.object-token.recommended::before {
  background: var(--amber);
}

.object-token.compatible {
  border-color: rgba(122, 167, 255, 0.5);
}

.object-token.write-blocked::before {
  background: var(--bad);
}

.object-token.defeated,
.object-token.destroyed {
  opacity: 0.52;
}

.object-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.type-badge,
.object-state,
.slot-chip,
.mini-tag-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
}

.object-state {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.object-token strong {
  position: relative;
  z-index: 1;
  display: block;
  max-width: calc(100% - 44px);
  color: var(--ink-strong);
  font-size: 17px;
  line-height: 1.25;
}

.object-token small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.glyph {
  position: absolute;
  right: 10px;
  bottom: -10px;
  color: rgba(255, 255, 255, 0.065);
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

body.theme-light .glyph {
  color: rgba(86, 67, 42, 0.1);
}

.mini-tags,
.tag-list,
.slot-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-dot {
  width: 13px;
  height: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.tag-dot.unknown {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 3px, transparent 3px 6px),
    rgba(255, 255, 255, 0.04);
}

body.theme-light .tag-dot.unknown {
  background:
    repeating-linear-gradient(45deg, rgba(86, 67, 42, 0.18) 0 3px, transparent 3px 6px),
    rgba(255, 255, 255, 0.5);
}

.mini-tag-label i,
.tag-chip span,
.inventory-token span {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.hp-bar,
.boss-gauge {
  position: relative;
  z-index: 1;
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.hp-bar span,
.boss-gauge span {
  display: block;
  height: 100%;
  background: var(--bad);
}

.shield-pips {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 4px;
  margin-top: 7px;
}

.shield-pips i {
  width: 19px;
  height: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.shield-pips i.on {
  background: var(--blue);
}

.inspector-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.zone-panel,
.inspector-panel {
  border-color: rgba(180, 198, 187, 0.11);
}

#inspector,
.inventory-list,
.event-log,
.reflection-box,
.metrics-box,
.preview-box,
.scan-gate,
.boss-phase-plan,
.zone-summary-table {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.032);
}

#inspector {
  min-height: 244px;
  padding: 14px;
}

.inspector-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.object-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.scan-section {
  margin-top: 14px;
}

.section-label {
  display: block;
  margin-bottom: 6px;
}

.tag-chip,
.inventory-token {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  text-align: left;
  column-gap: 5px;
}

.tag-chip strong,
.inventory-token strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: 13px;
}

.tag-chip small,
.inventory-token small {
  grid-column: 2 / 4;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tag-chip.selected,
.inventory-token.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chip-cost {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.slot-chip.locked {
  border-color: rgba(241, 111, 111, 0.42);
  color: var(--bad);
  background: rgba(241, 111, 111, 0.1);
}

.scan-note {
  margin: 10px 0 0;
  color: var(--muted);
}

.scan-gate,
.preview-box {
  padding: 12px;
}

.scan-gate strong,
.preview-title {
  display: block;
  color: var(--ink-strong);
  font-weight: 800;
}

.scan-gate span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.preview-box {
  margin-top: 14px;
}

.preview-box ul,
.completion-audit ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.replacement-flow,
.reaction-callout {
  color: var(--accent-strong);
  font-weight: 800;
}

.boss-gauge {
  height: 26px;
  margin: 10px 0 12px;
}

.boss-gauge span {
  background: var(--blue);
}

.boss-gauge strong {
  position: absolute;
  inset: 3px auto auto 9px;
  color: var(--ink-strong);
  font-size: 12px;
}

.boss-phase-plan {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.boss-phase-plan span {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.inventory {
  padding-top: 2px;
}

.inventory-list {
  display: grid;
  gap: 8px;
  min-height: 110px;
  padding: 10px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 88px;
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.bottom-panel {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1.1fr;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  background: rgba(18, 24, 22, 0.62);
}

.bottom-panel > div {
  min-width: 0;
}

.event-log,
.reflection-box,
.metrics-box {
  min-height: 142px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
}

.event-line {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.event-line:last-child {
  border-bottom: 0;
}

.event-line span {
  color: var(--muted);
  font-size: 11px;
}

.event-line strong {
  color: var(--ink);
  font-size: 13px;
}

.event-line.warn strong { color: var(--warn); }
.event-line.bad strong { color: var(--bad); }
.event-line.good strong { color: var(--good); }

.metrics-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.completion-panel {
  margin-top: 12px;
  padding: 18px;
}

.completion-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.completion-report,
.completion-verdict,
.completion-audit,
.completion-badges-section,
.pitch-container {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.completion-verdict.good { border-color: rgba(53, 209, 143, 0.38); }
.completion-verdict.warn { border-color: rgba(228, 170, 72, 0.44); }
.completion-verdict.bad { border-color: rgba(241, 111, 111, 0.44); }
.completion-verdict strong,
.completion-verdict span {
  display: block;
}

.completion-audit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.playtest-review li {
  margin-bottom: 9px;
}

.playtest-review li strong,
.playtest-review li span {
  display: block;
}

.playtest-review li span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.reaction-ledger,
.ending-badge-list {
  display: grid;
  gap: 8px;
}

.reaction-ledger span,
.ending-badge {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.ending-badge {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.ending-badge .icon {
  font-size: 20px;
}

.ending-badge .name {
  color: var(--ink-strong);
  font-weight: 800;
}

.ending-badge .desc {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.wishlist-btn,
.danger-button {
  min-height: 40px;
  padding: 0 14px;
}

.wishlist-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #07110e;
}

.danger-button {
  border-color: rgba(241, 111, 111, 0.5);
  background: rgba(241, 111, 111, 0.12);
}

.zone-summary-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  overflow: hidden;
}

.zone-summary-table th,
.zone-summary-table td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.duration-cell {
  position: relative;
  display: block;
  min-height: 24px;
}

.duration-cell i {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.duration-cell b {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding-left: 8px;
}

.settings-panel,
.prologue-overlay,
.reaction-ripple-overlay {
  position: fixed;
  inset: 0;
}

.settings-panel,
.prologue-overlay {
  z-index: 8000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 7, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.settings-box,
.prologue-box {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-solid);
  box-shadow: 0 24px 70px var(--shadow-strong);
}

.settings-box {
  width: min(560px, 100%);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.settings-header h3 {
  margin: 0;
}

.close-settings-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
}

.settings-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.setting-item {
  display: grid;
  gap: 8px;
}

.setting-item h4 {
  margin: 0;
}

.slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.settings-zone-select {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.settings-zone-btn {
  padding: 8px 10px;
  text-align: left;
}

.settings-zone-btn.locked {
  opacity: 0.5;
}

.settings-zone-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.prologue-box {
  padding: 24px;
}

.prologue-glitch-title {
  color: var(--accent-strong);
  font-size: clamp(34px, 7vw, 68px);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: 0;
}

.prologue-tagline {
  margin: 8px 0 18px;
  color: var(--muted);
  font-weight: 700;
}

.prologue-content {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.prologue-line {
  margin: 0;
  color: var(--ink);
}

.prologue-btn {
  width: 100%;
  margin-top: 18px;
  min-height: 48px;
  border-color: var(--accent);
  background: var(--accent);
  color: #07110e;
  font-size: 16px;
}

.prologue-overlay.hidden {
  display: none;
}

.reaction-ripple-overlay {
  z-index: 6000;
  pointer-events: none;
}

.ripple-circle {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 50%;
  animation: ripple 620ms ease-out both;
}

.ripple-circle.fire { border-color: var(--bad); }
.ripple-circle.ice { border-color: var(--blue); }
.ripple-circle.force { border-color: var(--accent); }

.floating-damage {
  position: fixed;
  z-index: 6500;
  color: var(--bad);
  font-size: 22px;
  font-weight: 900;
  pointer-events: none;
  animation: float-damage 820ms ease-out both;
}

.floating-damage.critical {
  color: var(--amber);
  font-size: 28px;
}

.floating-damage.parry-text {
  color: var(--blue);
}

@keyframes ripple {
  from { transform: scale(0.2); opacity: 0.8; }
  to { transform: scale(1.8); opacity: 0; }
}

@keyframes float-damage {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-42px); opacity: 0; }
}

@keyframes shake-medium {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, -2px); }
  80% { transform: translate(1px, 2px); }
}

@keyframes shake-heavy {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -4px); }
  80% { transform: translate(3px, 4px); }
}

.screen-shake-medium {
  animation: shake-medium 0.32s ease both;
}

.screen-shake-heavy {
  animation: shake-heavy 0.42s ease both;
}

body:not(.regression-mode) .bottom-panel {
  position: fixed;
  z-index: 5000;
  left: 14px;
  top: 14px;
  bottom: 14px;
  width: min(460px, calc(100vw - 28px));
  transform: translateX(calc(-100% - 20px));
  display: grid;
  grid-template-columns: 1fr;
  overflow: auto;
  margin: 0;
  transition: transform 220ms ease;
}

body:not(.regression-mode) .bottom-panel.open {
  transform: translateX(0);
}

body:not(.regression-mode) .bottom-panel::before {
  content: "事件与指标";
  display: block;
  margin-bottom: 4px;
  color: var(--ink-strong);
  font-size: 18px;
  font-weight: 850;
}

body.regression-mode .bottom-panel {
  position: static;
}

body.regression-mode .close-btn {
  display: none;
}

@media (max-width: 1240px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .status-strip {
    grid-column: 1;
    grid-row: auto;
    grid-template-columns: repeat(4, minmax(88px, 1fr));
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .zone-panel,
  .inspector-panel {
    position: fixed;
    top: 12px;
    bottom: 12px;
    z-index: 4500;
    width: min(360px, calc(100vw - 24px));
    min-height: 0;
    overflow: auto;
    transition: transform 220ms ease;
  }

  .zone-panel {
    left: 12px;
    transform: translateX(calc(-100% - 18px));
  }

  .inspector-panel {
    right: 12px;
    transform: translateX(calc(100% + 18px));
  }

  .zone-panel.open,
  .inspector-panel.open {
    transform: translateX(0);
  }

  .close-btn {
    display: inline-flex;
  }

  .stage-panel {
    min-height: 660px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 8px;
  }

  .topbar,
  .session-panel {
    gap: 8px;
    margin-bottom: 8px;
  }

  .title-block,
  .topbar-controls,
  .session-panel,
  .panel,
  .stage-panel,
  .completion-panel {
    border-radius: var(--radius-md);
  }

  .title-block {
    min-height: auto;
    padding: 12px;
  }

  h1 {
    font-size: 28px;
  }

  .topbar-controls {
    display: grid;
    min-height: auto;
    padding: 10px;
  }

  .topbar-controls-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .theme-toggle-btn,
  .settings-toggle-btn {
    padding: 0 8px;
    font-size: 12px;
  }

  .mode-switch {
    grid-column: 1 / -1;
  }

  .status-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
  }

  .status-card {
    min-height: 52px;
    padding: 8px 7px 10px;
  }

  .status-card span {
    font-size: 10px;
  }

  .status-card strong {
    font-size: 18px;
  }

  .session-panel {
    display: none;
  }

  .stage-panel {
    display: flex;
    flex-direction: column;
    min-height: auto;
    overflow: visible;
  }

  .tactical-deck {
    display: contents;
  }

  .stage-header,
  .guidance-strip,
  .result-pulse,
  .context-actions,
  .action-help,
  .decision-strip,
  .step-list {
    margin: 12px 12px 0;
  }

  .stage-header {
    padding: 0 0 12px;
  }

  .decision-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scene-map {
    order: 5;
    grid-template-columns: 1fr;
    padding: 12px;
    overflow: visible;
  }

  .context-actions {
    order: 4;
    display: flex;
    gap: 8px;
    min-height: 46px;
    margin: 8px 12px 0;
    padding: 0 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .context-actions .action-group {
    display: contents;
  }

  .context-actions .action-group-label {
    display: none;
  }

  .context-actions .action-button {
    flex: 0 0 auto;
    min-width: 112px;
  }

  .action-help {
    order: 6;
  }

  .decision-strip {
    order: 7;
  }

  .step-list {
    order: 8;
  }

  .object-token {
    min-height: 152px;
  }

  .bottom-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 13px;
  }

  .app-shell {
    padding: 8px;
  }

  h1 {
    font-size: 27px;
  }

  h2 {
    font-size: 23px;
  }

  .eyebrow {
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .topbar-controls-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .session-status,
  .decision-strip {
    grid-template-columns: 1fr;
  }

  .session-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-header,
  .guidance-strip,
  .result-pulse,
  .action-group {
    grid-template-columns: 1fr;
  }

  .result-pulse small {
    grid-column: 1;
  }

  .action-button {
    white-space: normal;
  }

  .object-card-top,
  .object-title-row,
  .panel-heading,
  .completion-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-panel,
  .prologue-overlay {
    padding: 10px;
  }

  .prologue-box {
    padding: 18px;
  }
}
