:root {
  --ink: #071016;
  --panel: rgba(9, 18, 25, 0.72);
  --panel-strong: rgba(13, 24, 31, 0.9);
  --line: rgba(231, 244, 246, 0.16);
  --text: #f3f8f6;
  --muted: #aab8b9;
  --ice: #c9f3f1;
  --amber: #f0b45d;
  --red: #e96d5c;
  --green: #83d18c;
  --violet: #b7a8ff;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

button:hover {
  border-color: rgba(240, 180, 93, 0.85);
  background: rgba(240, 180, 93, 0.14);
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.title-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.title-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.title-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.7) contrast(1.1) brightness(0.5);
}

.title-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 8, 12, 0.6) 0%, rgba(3, 8, 12, 0.3) 40%, rgba(3, 8, 12, 0.85) 100%),
    radial-gradient(circle at center, transparent 0 35%, rgba(0, 0, 0, 0.6) 75%);
}

.title-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.game-title {
  font-size: 52px;
  font-weight: 900;
  color: var(--ice);
  text-shadow: 0 0 40px rgba(201, 243, 241, 0.35), 0 4px 20px rgba(0, 0, 0, 0.8);
  letter-spacing: 6px;
  margin: 0;
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from { text-shadow: 0 0 40px rgba(201, 243, 241, 0.25), 0 4px 20px rgba(0, 0, 0, 0.8); }
  to { text-shadow: 0 0 60px rgba(201, 243, 241, 0.5), 0 4px 20px rgba(0, 0, 0, 0.8); }
}

.game-subtitle {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 8px;
  text-transform: uppercase;
  margin: 0;
}

.title-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
  min-width: 260px;
}

.title-btn {
  padding: 14px 28px;
  font-size: 17px;
  font-weight: 700;
  border: 1px solid rgba(201, 243, 241, 0.35);
  background: rgba(5, 9, 12, 0.72);
  backdrop-filter: blur(12px);
  color: var(--text);
  transition: all 0.3s ease;
  letter-spacing: 2px;
}

.title-btn:hover {
  border-color: var(--amber);
  background: rgba(240, 180, 93, 0.18);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(240, 180, 93, 0.2);
}

.title-btn.primary {
  background: linear-gradient(135deg, rgba(201, 243, 241, 0.22), rgba(240, 180, 93, 0.18));
  border-color: rgba(201, 243, 241, 0.55);
  color: var(--ice);
}

.title-btn.primary:hover {
  background: linear-gradient(135deg, rgba(201, 243, 241, 0.32), rgba(240, 180, 93, 0.28));
  box-shadow: 0 8px 30px rgba(201, 243, 241, 0.25);
}

.opening-cinematic,
.scene-cinematic,
.branch-cinematic {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
}

.opening-cinematic.active,
.scene-cinematic.active,
.branch-cinematic.active {
  display: flex;
}

.cinematic-video,
.scene-cinematic-video,
.branch-cinematic-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cinematic-overlay,
.scene-cinematic-overlay,
.branch-cinematic-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 8, 12, 0.25) 0%, transparent 40%, rgba(3, 8, 12, 0.85) 100%);
  pointer-events: none;
}

.subtitle-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 28px 48px 36px;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid rgba(201, 243, 241, 0.06);
  font-size: 22px;
  line-height: 1.7;
  color: var(--ice);
  text-align: center;
  letter-spacing: 1px;
  min-height: 64px;
  white-space: pre-line;
  transition: opacity 0.4s ease;
  will-change: opacity;
}

.game-subtitle-overlay {
  position: absolute;
  left: 24px;
  bottom: 160px;
  z-index: 3;
  max-width: min(700px, calc(100% - 48px));
  padding: 14px 22px;
  border-left: 3px solid var(--amber);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  text-align: left;
  min-height: 52px;
  white-space: pre-line;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.game-subtitle-overlay.show {
  opacity: 1;
}

/* 角色名标签（在字幕上方对齐） */
.game-speaker-tag {
  position: absolute;
  left: 24px;
  bottom: 218px;
  z-index: 4;
  padding: 3px 12px;
  border-left: 3px solid var(--ice);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  color: var(--ice);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  display: none;
  pointer-events: none;
}

.dialogue-subtitle {
  position: absolute;
  left: 24px;
  bottom: 180px;
  z-index: 3;
  max-width: min(720px, calc(100% - 48px));
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.dialogue-subtitle.show {
  opacity: 1;
}

.dialogue-subtitle .speaker-tag {
  display: inline-block;
  padding: 4px 10px;
  margin-bottom: 6px;
  border-left: 3px solid var(--ice);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  color: var(--ice);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.dialogue-subtitle .dialogue-text {
  display: block;
  padding: 12px 18px;
  border-left: 3px solid var(--amber);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  font-size: 20px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-line;
}

.hero-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid rgba(201, 243, 241, 0.35);
  background: rgba(5, 9, 12, 0.65);
  backdrop-filter: blur(10px);
}

.hero-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 243, 241, 0.55);
  background: linear-gradient(145deg, rgba(201, 243, 241, 0.14), rgba(240, 180, 93, 0.16));
  color: var(--amber);
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hero-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ice);
  letter-spacing: 1px;
}

.hero-title {
  font-size: 11px;
  color: var(--muted);
}

.film-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.world-bg,
.screen-shade,
.weather {
  position: fixed;
  inset: 0;
}

.world-bg {
  z-index: -4;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen-shade {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(3, 8, 12, 0.96), rgba(3, 8, 12, 0.36) 48%, rgba(3, 8, 12, 0.88)),
    linear-gradient(180deg, rgba(3, 8, 12, 0.78), rgba(3, 8, 12, 0.24) 42%, rgba(3, 8, 12, 0.96));
}

.weather {
  z-index: -3;
  opacity: 0.28;
  background-image:
    linear-gradient(115deg, transparent 0 45%, rgba(255, 255, 255, 0.55) 46%, transparent 47%),
    linear-gradient(115deg, transparent 0 62%, rgba(201, 243, 241, 0.42) 63%, transparent 64%);
  background-size: 220px 220px, 360px 360px;
  animation: drift 11s linear infinite;
  will-change: background-position;
}

@keyframes drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: -360px 520px, -540px 720px; }
}

.command-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(270px, 390px) 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 9, 13, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
}

.brand-mark,
.portrait {
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 243, 241, 0.55);
  background: linear-gradient(145deg, rgba(201, 243, 241, 0.14), rgba(240, 180, 93, 0.16));
}

.brand-mark {
  width: 42px;
  height: 42px;
  color: var(--amber);
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand small,
.eyebrow,
.rail-title,
.section-head span {
  color: var(--muted);
  font-size: 12px;
}

.segment-nav {
  display: inline-flex;
  justify-content: center;
  gap: 8px;
}

.segment-nav button,
.panel-tabs button {
  min-width: 92px;
  padding: 10px 14px;
}

.segment-nav .active,
.panel-tabs .active {
  color: #11100b;
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 900;
}

.quick-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  min-height: calc(100vh - 71px);
  padding: 18px 22px 22px;
}

.status-rail,
.film-console,
.war-room,
.task-board,
.node-browser,
.node-editor,
.ops-panel,
.side-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.status-rail {
  display: none;
  align-self: start;
  gap: 16px;
  padding: 16px;
}

.identity {
  display: flex;
  gap: 14px;
  align-items: center;
}

.portrait {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
}

.portrait span {
  font-size: 30px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin-bottom: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.22;
}

h2 {
  font-size: 19px;
}

.stat-stack,
#relations,
#tasks,
#nodeList,
#shop,
.metric-grid {
  display: grid;
  gap: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: 56px 1fr 42px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar {
  height: 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ice), var(--amber));
  transition: width 0.45s ease;
}

.relation,
.task,
.node-card,
.panel-card,
.metric,
.shop-item,
.api-row {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.relation {
  padding: 10px;
}

.relation strong,
.task strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.mini-ledger {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-ledger div {
  padding: 11px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.mini-ledger b {
  display: block;
  color: var(--amber);
  font-size: 24px;
}

.mini-ledger span {
  color: var(--muted);
  font-size: 12px;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
}

.film-console {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 10;
  display: none;
}

.view-play.active .film-console {
  display: block;
}

.section-head,
.panel-head,
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.basic-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.basic-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.basic-chip b {
  color: var(--amber);
  min-width: 22px;
  text-align: right;
}

.basic-chip-bar {
  width: 36px;
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.basic-chip-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ice), var(--amber));
  transition: width 0.45s ease;
  border-radius: 2px;
}

.video-window {
  position: absolute;
  inset: 0;
  background: #03070a;
  overflow: hidden;
}

.scene-visual {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.96) contrast(1.06);
  transform: scale(1.01);
}

.video-window.playing .scene-visual {
  animation: kenburns 9s ease-in-out forwards;
}

@keyframes kenburns {
  0% { transform: scale(1.01) translate3d(0, 0, 0); }
  45% { transform: scale(1.065) translate3d(-1.5%, -1%, 0); }
  100% { transform: scale(1.1) translate3d(1.2%, -1.4%, 0); }
}

.scanlines {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: linear-gradient(rgba(255, 255, 255, 0.11) 1px, transparent 1px);
  background-size: 100% 6px;
  pointer-events: none;
  z-index: 1;
}

.video-window::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 7, 10, 0.45) 0%, rgba(3, 7, 10, 0.05) 30%, rgba(3, 7, 10, 0.75) 80%, rgba(3, 7, 10, 0.92) 100%),
    radial-gradient(circle at center, transparent 0 42%, rgba(0, 0, 0, 0.4) 78%);
  pointer-events: none;
  z-index: 1;
}

/* 顶部导航 HUD */
.hud-nav-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(200px, 320px) 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 9, 13, 0.55);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.hud-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.hud-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(201, 243, 241, 0.55);
  background: linear-gradient(145deg, rgba(201, 243, 241, 0.14), rgba(240, 180, 93, 0.16));
  color: var(--amber);
  font-size: 18px;
  font-weight: 900;
}

.hud-brand-text {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.hud-nav-segment {
  display: inline-flex;
  justify-content: center;
  gap: 8px;
}

.hud-nav-segment button {
  min-width: 80px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.hud-nav-segment button:hover {
  border-color: rgba(240, 180, 93, 0.85);
  background: rgba(240, 180, 93, 0.14);
}

.hud-nav-segment button.active {
  color: #11100b;
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 900;
}

.hud-nav-actions {
  display: flex;
  gap: 8px;
}

/* 顶部 HUD 覆盖层 */
.hud-top-bar {
  position: absolute;
  top: 71px;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(3, 8, 12, 0.65) 0%, rgba(3, 8, 12, 0.2) 70%, transparent 100%);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.hud-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.episode-tag {
  color: var(--muted);
  font-size: 13px;
}

.risk-tag {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: rgba(5, 9, 12, 0.55);
}

/* 左上角状态标签 */
.hud-status-badge {
  position: absolute;
  top: 128px;
  left: 18px;
  z-index: 4;
  padding: 10px 14px;
  border: 1px solid rgba(201, 243, 241, 0.35);
  background: rgba(5, 9, 12, 0.65);
  color: var(--ice);
  font-size: 13px;
  letter-spacing: 1px;
}

/* 右上角状态区 */
.hud-right-panel {
  position: absolute;
  top: 128px;
  right: 18px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 160px;
  pointer-events: auto;
}

.frost-meter {
  padding: 12px 14px;
  border: 1px solid rgba(233, 109, 92, 0.45);
  background: rgba(5, 9, 12, 0.64);
}

.frost-meter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.frost-meter strong {
  color: var(--red);
  font-size: 22px;
}

.hud-status-box {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(5, 9, 12, 0.58);
}

.hud-status-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}

.hud-status-value {
  display: block;
  color: var(--ice);
  font-size: 14px;
  font-weight: 700;
}

.scene-card {
  margin-bottom: 10px;
  color: var(--ice);
  font-size: 15px;
  line-height: 1.55;
}

.dialogue-dock {
  position: absolute;
  left: 24px;
  right: 200px;
  bottom: 24px;
  z-index: 4;
  padding: 22px;
  border-left: 4px solid var(--ice);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  max-width: calc(100% - 240px);
  transition: opacity 0.3s ease;
}

.dialogue-dock p {
  min-height: 0;
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.58;
  white-space: pre-line;
}

.choice-grid {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: min(720px, calc(100% - 48px));
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.video-window.playing .choice-grid {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -44%);
}

.video-window.awaiting .choice-grid {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -44%);
}

.choice-grid button {
  position: relative;
  min-height: 74px;
  padding: 16px 18px;
  text-align: center;
  border-left: 4px solid var(--amber);
  background: rgba(5, 9, 12, 0.55);
  backdrop-filter: blur(8px);
  font-size: 18px;
  font-weight: 800;
  transition: background 0.2s ease, transform 0.2s ease;
}

.choice-grid button:hover {
  background: rgba(240, 180, 93, 0.18);
  transform: translateY(-2px);
}

.choice-grid button[data-locked="true"] {
  border-left-color: var(--violet);
}

.shelter-layout,
.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.85fr);
  gap: 18px;
}

.war-room,
.task-board,
.node-browser,
.node-editor,
.ops-panel {
  padding: 18px;
}

.base-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.module {
  min-height: 130px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.module strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ice);
}

.module .level {
  color: var(--amber);
}

.task {
  padding: 13px;
}

.task p,
.module p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.node-browser {
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.node-card {
  width: 100%;
  padding: 12px;
  text-align: left;
}

.node-card.active {
  border-color: var(--amber);
  background: rgba(240, 180, 93, 0.14);
}

.node-editor {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(0, 0, 0, 0.34);
  padding: 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.form-actions {
  justify-content: flex-end;
}

.primary,
.form-actions button,
.section-head button {
  padding: 11px 16px;
}

.primary {
  background: var(--amber);
  color: #14100b;
  border-color: var(--amber);
  font-weight: 900;
}

.ops-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.ops-panel.wide {
  grid-column: 1 / -1;
}

.panel-card,
.shop-item,
.metric {
  padding: 12px;
}

.shop-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.metric strong {
  display: block;
  color: var(--amber);
  font-size: 25px;
}

pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  color: var(--ice);
  font-size: 13px;
  line-height: 1.65;
}

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(460px, 94vw);
  height: 100vh;
  padding: 18px;
  transform: translateX(105%);
  transition: transform 0.25s ease;
  overflow: auto;
}

.side-panel.open {
  transform: translateX(0);
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 18px 0;
}

.panel-tabs button {
  min-width: 0;
  padding: 9px 7px;
}

.panel-body {
  display: grid;
  gap: 10px;
}

.panel-card {
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  transform: translate(-50%, 18px);
  opacity: 0;
  max-width: min(640px, 90vw);
  padding: 12px 16px;
  border: 1px solid rgba(240, 180, 93, 0.72);
  background: rgba(8, 13, 18, 0.94);
  box-shadow: var(--shadow);
  transition: 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pulse {
  animation: pulse 0.6s ease;
}

@keyframes pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.025); filter: brightness(1.25); }
  100% { transform: scale(1); }
}

/* Loading 指示器 */
.loading-indicator {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ice);
  font-size: 14px;
  letter-spacing: 2px;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.loading-indicator.fade-out {
  opacity: 0;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(201, 243, 241, 0.2);
  border-top-color: var(--ice);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1120px) {
  .command-bar,
  .workspace,
  .shelter-layout,
  .studio-layout,
  .ops-layout {
    grid-template-columns: 1fr;
  }

  .segment-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .status-rail {
    grid-template-columns: 1fr 1fr;
  }

  .stat-stack,
  .mini-ledger {
    grid-column: 1 / -1;
  }

  /* 平板及以下：dialogue-dock 释放右侧空间 */
  .dialogue-dock {
    right: 24px;
    max-width: calc(100% - 48px);
  }
}

@media (max-width: 720px) {
  .command-bar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .segment-nav {
    grid-column: 1 / -1;
  }

  .quick-actions {
    justify-content: flex-end;
  }

  .workspace {
    padding: 10px 12px 12px;
  }

  .status-rail,
  .base-map,
  .choice-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .brand strong {
    font-size: 16px;
  }

  .segment-nav button {
    min-width: 78px;
  }

  .video-window {
    min-height: 360px;
  }

  .dialogue-dock {
    left: 14px;
    right: 14px;
    bottom: 10px;
    padding: 14px;
    max-width: calc(100% - 28px);
  }

  .scene-card {
    font-size: 13px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
    top: 38%;
  }

  .dialogue-dock p {
    font-size: 16px;
  }

  .film-head {
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
  }

  .basic-stats {
    justify-content: flex-start;
  }

  .frost-meter {
    top: 14px;
    right: 14px;
    padding: 9px 10px;
  }

  .pause-badge {
    top: 14px;
    left: 14px;
  }

  .video-controls {
    top: 52px;
    left: 14px;
  }
}

/* ===================== 属性变化浮动动画提示 ===================== */
.stat-floater-container {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 7;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.stat-floater {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 6px;
  background: rgba(5, 9, 12, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(231, 244, 246, 0.12);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  animation: floaterFloat 1.8s ease forwards;
  white-space: nowrap;
}

.stat-floater-name {
  color: var(--text);
}

.stat-floater-value {
  font-size: 18px;
  font-weight: 900;
}

.stat-floater-value.up {
  color: var(--green);
  text-shadow: 0 0 12px rgba(144, 215, 157, 0.45);
}

.stat-floater-value.down {
  color: var(--red);
  text-shadow: 0 0 12px rgba(233, 109, 92, 0.45);
}

@keyframes floaterFloat {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  15% {
    opacity: 1;
    transform: translateY(0) scale(1.05);
  }
  30% {
    transform: translateY(-4px) scale(1);
  }
  70% {
    opacity: 1;
    transform: translateY(-30px);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px);
  }
}
