:root {
  color-scheme: dark;
  --ink: #061014;
  --ink-soft: #0a171d;
  --panel: #0d1b21;
  --panel-2: #10242b;
  --line: #284149;
  --line-soft: #1c3037;
  --text: #edf6f3;
  --muted: #80979a;
  --acid: #d7ff3f;
  --cyan: #53e1d2;
  --amber: #ffbe64;
  --danger: #ff655d;
}

* { box-sizing: border-box; }

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

body {
  min-width: 320px;
  color: var(--text);
  font-family: "PingFang TC", "Microsoft JhengHei UI", "Noto Sans TC", "Bahnschrift", "DIN Alternate", sans-serif;
  background:
    radial-gradient(circle at 88% -12%, rgba(35, 100, 95, .34), transparent 34%),
    radial-gradient(circle at -5% 74%, rgba(44, 67, 57, .25), transparent 30%),
    linear-gradient(145deg, #050d11, #0a151b 58%, #061015);
}

button, video { font: inherit; }
button { color: inherit; }

.grid-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .2;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

.shell {
  position: relative;
  width: min(100%, 1920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 20px 12px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid var(--acid);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 4px;
  padding: 8px;
  transform: skewX(-7deg);
  box-shadow: 0 0 26px rgba(215, 255, 63, .09);
}
.brand-mark i { display: block; background: var(--acid); }
.brand-mark i:nth-child(1) { height: 43%; }
.brand-mark i:nth-child(2) { height: 78%; }
.brand-mark i:nth-child(3) { height: 58%; }
.brand small {
  display: block;
  color: var(--acid);
  font: 700 9px "Bahnschrift", monospace;
  letter-spacing: .21em;
  margin-bottom: 3px;
}
.brand strong { display: block; font-size: 18px; letter-spacing: .07em; }
.brand strong span { display: block; }
.brand strong em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font: 700 6.5px "Bahnschrift", monospace;
  font-style: normal;
  letter-spacing: .15em;
}

.top-actions { display: flex; align-items: center; gap: 8px; }
.system-pill, .ghost-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: rgba(12, 27, 33, .78);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .04em;
}
.system-pill b { display: flex; flex-direction: column; line-height: 1.05; }
.system-pill b small { margin-top: 2px; color: var(--muted); font: 700 6.5px "Bahnschrift", monospace; letter-spacing: .08em; }
.system-pill i, .scene-state i, .page-foot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.system-pill.online i, .scene-card.ready .scene-state i, .page-foot i {
  background: var(--acid);
  box-shadow: 0 0 0 5px rgba(215, 255, 63, .08), 0 0 13px rgba(215, 255, 63, .35);
}
.mono { font-family: "Cascadia Mono", "Consolas", monospace; }
.ghost-button { min-width: 82px; flex-direction: column; justify-content: center; gap: 1px; cursor: pointer; transition: .2s ease; }
.ghost-button small { color: var(--muted); font: 700 6.5px "Bahnschrift", monospace; letter-spacing: .09em; }
.ghost-button.accent small { color: rgba(215, 255, 63, .72); }
.ghost-button:hover, .ghost-button:focus-visible { border-color: var(--cyan); color: var(--cyan); outline: none; }
.ghost-button.accent { border-color: rgba(215, 255, 63, .55); color: var(--acid); }

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: rgba(8, 20, 25, .78);
}
.overview article {
  min-height: 57px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-right: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.overview article:last-child { border-right: 0; }
.overview article::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 34%;
  height: 2px;
  background: var(--cyan);
}
.overview article:nth-child(1)::after, .overview article:nth-child(4)::after { background: var(--acid); }
.overview article > span {
  color: var(--muted);
  font: 700 9px "Bahnschrift", monospace;
  letter-spacing: .15em;
}
.overview article div { display: flex; align-items: baseline; gap: 7px; }
.overview b { font: 800 25px "Bahnschrift", monospace; }
.overview b.word { color: var(--acid); font-size: 19px; letter-spacing: .08em; }
.overview em { color: var(--muted); font-size: 10px; font-style: normal; line-height: 1.05; }
.overview em span, .overview em small { display: block; }
.overview em small { margin-top: 2px; color: #617b7f; font: 700 6px "Bahnschrift", monospace; letter-spacing: .06em; }

.dashboard {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 10px;
}

.scene-stack {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(285px, 1fr));
  gap: 10px;
}

.scene-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(16, 35, 42, .96), rgba(7, 17, 22, .96));
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  overflow: hidden;
  animation: card-in .55s both;
}
.scene-card:nth-child(2) { animation-delay: .11s; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }

.scene-head {
  min-height: 48px;
  display: grid;
  grid-template-columns: 34px minmax(250px, auto) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 25, 31, .9);
}
.scene-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--acid);
  font: 700 11px "Cascadia Mono", monospace;
}
.scene-title span {
  display: block;
  color: var(--cyan);
  font: 700 8px "Bahnschrift", monospace;
  letter-spacing: .16em;
}
.scene-title h1 { margin: 2px 0 0; font-size: 15px; letter-spacing: .04em; }
.scene-description { color: var(--muted); font-size: 10px; line-height: 1.1; }
.scene-description span, .scene-description small { display: block; }
.scene-description small { margin-top: 3px; color: #5f797d; font: 700 6.5px "Bahnschrift", monospace; letter-spacing: .05em; }
.scene-actions { display: flex; align-items: center; gap: 9px; }
.scene-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.scene-state b { display: flex; flex-direction: column; line-height: 1.05; }
.scene-state b small { margin-top: 2px; color: #617b7f; font: 700 6px "Bahnschrift", monospace; letter-spacing: .06em; }
.scene-card.ready .scene-state { color: var(--text); }
.play-toggle {
  min-width: 76px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}
.play-toggle span, .play-toggle small { display: block; }
.play-toggle small { margin-top: 3px; color: var(--muted); font: 700 6.5px "Bahnschrift", monospace; letter-spacing: .09em; }
.play-toggle:hover, .play-toggle:focus-visible { border-color: var(--acid); color: var(--acid); outline: none; }
.play-toggle:hover small, .play-toggle:focus-visible small { color: var(--acid); }

.feed-pair { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.feed { min-width: 0; min-height: 0; margin: 0; background: #03080b; display: grid; grid-template-rows: 28px minmax(0, 1fr); }
.feed figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 11px;
  background: #0a171d;
  color: var(--muted);
  font: 700 9px "Bahnschrift", monospace;
  letter-spacing: .1em;
}
.feed figcaption b { color: var(--text); font-size: 11px; letter-spacing: .03em; }
.ai-feed figcaption b, .ai-feed figcaption span { color: var(--acid); }
.video-stage { position: relative; min-height: 0; overflow: hidden; background: #020608; }
.video-stage::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(222, 251, 244, .1);
  pointer-events: none;
}
.video-stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  cursor: pointer;
  filter: saturate(.92) contrast(1.03);
}
.feed-corner {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 15px;
  border-left: 2px solid var(--cyan);
  background: rgba(3, 10, 13, .82);
  padding: 5px 8px;
  color: #d8e7e5;
  font: 700 8px "Cascadia Mono", monospace;
  letter-spacing: .1em;
  pointer-events: none;
}
.feed-corner.ai { border-left-color: var(--acid); color: var(--acid); }

.telemetry {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(140px, 1.6fr) repeat(4, minmax(92px, auto));
  border-top: 1px solid var(--line);
  background: #09151a;
}
.telemetry > div { padding: 7px 10px; border-right: 1px solid var(--line-soft); min-width: 0; }
.telemetry > div:last-child { border-right: 0; }
.telemetry small { display: block; color: var(--muted); font-size: 8px; margin-bottom: 2px; line-height: 1.05; }
.telemetry small span, .telemetry small em { display: block; }
.telemetry small em { margin-top: 2px; color: #5f777b; font: 700 6px "Bahnschrift", monospace; font-style: normal; letter-spacing: .05em; }
.telemetry b { display: block; font: 700 10px "Bahnschrift", monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline { align-self: stretch; display: grid; place-items: center; }
.timeline input {
  --progress: 0%;
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}
.timeline input:focus-visible { outline: 1px solid var(--acid); outline-offset: 3px; }
.timeline input::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 0;
  background: linear-gradient(90deg, var(--acid) 0 var(--progress), #24383e var(--progress) 100%);
  box-shadow: 0 0 10px rgba(215, 255, 63, .12);
}
.timeline input::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid #09151a;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 1px var(--acid), 0 0 12px rgba(215, 255, 63, .5);
}
.timeline input::-moz-range-track { height: 3px; border: 0; background: #24383e; }
.timeline input::-moz-range-progress { height: 3px; background: var(--acid); box-shadow: 0 0 10px rgba(215, 255, 63, .35); }
.timeline input::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #09151a; border-radius: 50%; background: var(--acid); box-shadow: 0 0 0 1px var(--acid); }

.insight-rail {
  min-height: 0;
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(16, 35, 42, .98), rgba(6, 15, 19, .98));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: card-in .55s .2s both;
}
.rail-head {
  min-height: 58px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.rail-head > div > span, .rail-note > span {
  color: var(--cyan);
  font: 700 8px "Bahnschrift", monospace;
  letter-spacing: .15em;
}
.rail-head h2 { margin: 3px 0 0; font-size: 15px; letter-spacing: .04em; }
.rail-head strong { color: var(--acid); font-size: 9px; white-space: nowrap; }
.rail-head strong { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 5px; line-height: 1.05; }
.rail-head strong i { display: inline-block; grid-row: 1 / 3; width: 6px; height: 6px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 12px rgba(215, 255, 63, .45); }
.rail-head strong small { grid-column: 2; margin-top: 2px; color: rgba(215, 255, 63, .62); font: 700 6px "Bahnschrift", monospace; letter-spacing: .07em; }
.rail-total { padding: 14px 14px 13px; border-bottom: 1px solid var(--line); background: rgba(5, 14, 18, .48); }
.rail-total small { color: var(--muted); font: 700 8px "Bahnschrift", monospace; letter-spacing: .12em; }
.rail-total > div { display: flex; align-items: baseline; gap: 9px; margin: 5px 0; }
.rail-total b { color: var(--acid); font: 800 32px "Bahnschrift", monospace; }
.rail-total em { display: flex; flex-direction: column; color: var(--muted); font-size: 10px; font-style: normal; line-height: 1.05; }
.rail-total em small { margin-top: 2px; color: #5f777b; font: 700 6px "Bahnschrift", monospace; letter-spacing: .06em; }
.rail-total p, .rail-note p { margin: 0; color: #91a7a9; font-size: 10px; line-height: 1.55; }
.dual-copy > span, .dual-copy > small { display: block; }
.dual-copy > small { margin-top: 4px; color: #688185; font: 500 7px/1.4 "Bahnschrift", sans-serif; letter-spacing: .025em; }
.rail-section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rail-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.rail-section-head b { display: flex; flex-direction: column; font-size: 11px; line-height: 1.05; }
.rail-section-head b small { margin-top: 3px; color: var(--muted); font: 700 6.5px "Bahnschrift", monospace; letter-spacing: .06em; }
.rail-section-head > span { color: var(--acid); font: 700 12px "Cascadia Mono", monospace; }
.bar-row { margin: 7px 0; }
.bar-row label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; color: #b8c9c8; font-size: 9px; }
.bar-row label > span { display: flex; align-items: baseline; gap: 5px; }
.bar-row label > span small { color: #667f82; font: 700 6.5px "Bahnschrift", monospace; letter-spacing: .04em; }
.bar-row label b { color: var(--text); font: 700 9px "Cascadia Mono", monospace; }
.bar-row > i { display: block; height: 3px; background: #263b40; overflow: hidden; }
.bar-row > i em { display: block; height: 100%; background: var(--cyan); }
.surface-bars .bar-row > i em { background: var(--acid); }
.rail-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; color: var(--muted); font-size: 7px; }
.rail-note { padding: 13px 14px; margin-top: auto; }
.rail-note h3 { margin: 4px 0 6px; font-size: 12px; }
.rail-note h3 small { margin-left: 6px; color: var(--muted); font: 700 6.5px "Bahnschrift", monospace; letter-spacing: .07em; }
.rail-foot { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px; border-top: 1px solid var(--line); color: #658084; font: 700 8px "Cascadia Mono", monospace; letter-spacing: .07em; }

.page-foot {
  min-height: 21px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: #6f898d;
  font-size: 9px;
  letter-spacing: .04em;
}
.page-foot > span:first-child { display: flex; align-items: center; gap: 8px; color: #9cafae; }
.page-foot b { display: block; font-weight: 400; }
.page-foot b > span, .page-foot b > small, .page-foot > span:last-child > span, .page-foot > span:last-child > small { display: block; }
.page-foot small { margin-top: 2px; color: #597276; font: 700 6px "Bahnschrift", monospace; letter-spacing: .055em; }
.page-foot > span:last-child { text-align: right; }

.start-hint {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 8, 11, .82);
  backdrop-filter: blur(9px);
}
.start-hint[hidden] { display: none; }
.start-hint button {
  width: min(430px, 94vw);
  border: 1px solid var(--acid);
  background: #0d1b20;
  color: var(--text);
  padding: 24px;
  cursor: pointer;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5), 0 0 35px rgba(215, 255, 63, .08);
}
.start-hint b { display: block; color: var(--acid); font-size: 22px; margin-bottom: 7px; }
.start-hint b span, .start-hint b small { display: block; }
.start-hint b > span { color: var(--acid); font-size: 22px; }
.start-hint b small { margin-top: 4px; color: rgba(215, 255, 63, .7); font: 700 8px "Bahnschrift", monospace; letter-spacing: .12em; }
.start-hint span { color: var(--muted); font-size: 12px; }

@media (max-width: 1400px) {
  .scene-head { grid-template-columns: 34px minmax(250px, 1fr) auto; }
  .scene-description { display: none; }
  .rail-total { padding: 10px 12px 9px; }
  .rail-total b { font-size: 28px; }
  .rail-section { padding: 9px 12px; }
  .rail-section-head { margin-bottom: 6px; }
  .bar-row { margin: 5px 0; }
  .rail-meta { margin-top: 6px; }
  .rail-note { padding: 10px 12px; }
}

@media (max-height: 900px) and (min-width: 1180px) {
  .rail-total p { font-size: 8px; line-height: 1.35; }
  .dual-copy > small { margin-top: 3px; font-size: 6px; line-height: 1.3; }
  .rail-section { padding-top: 7px; padding-bottom: 7px; }
  .bar-row { margin: 3px 0; }
  .rail-note p { font-size: 8px; line-height: 1.35; }
  .rail-foot { min-height: 25px; }
}

@media (min-width: 1180px) and (min-height: 720px) {
  body { overflow: hidden; }
  .shell { height: 100vh; }
}

@media (max-width: 1179px) {
  .shell { display: block; padding: 12px; }
  .topbar, .overview, .dashboard, .page-foot { margin-bottom: 10px; }
  .topbar { align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .overview { grid-template-columns: repeat(2, 1fr); }
  .overview article:nth-child(2) { border-right: 0; }
  .overview article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard { display: block; }
  .scene-stack { display: block; }
  .scene-card { margin-bottom: 10px; }
  .insight-rail { margin-bottom: 10px; }
  .video-stage { aspect-ratio: 16 / 9; }
  .telemetry { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .telemetry .timeline { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line-soft); }
}

@media (max-width: 700px) {
  .brand strong { font-size: 15px; }
  .brand small { display: none; }
  .system-pill.online, #syncAll { display: none; }
  .scene-head { grid-template-columns: 32px 1fr auto; }
  .scene-description { display: none; }
  .scene-state { display: none; }
  .feed-pair { grid-template-columns: 1fr; }
  .telemetry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry > div:nth-child(3), .telemetry > div:nth-child(5) { border-right: 0; }
  .telemetry > div:nth-child(2), .telemetry > div:nth-child(3) { border-bottom: 1px solid var(--line-soft); }
  .page-foot { display: block; line-height: 1.7; }
  .page-foot span { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

