:root {
  color-scheme: dark;
  --bg: #081426;
  --panel: #10223a;
  --text: #ecf3ff;
  --muted: #a9bcd6;
  --blue: #468fff;
  --cyan: #38bdf8;
  --amber: #f59e0b;
  --line: #203651;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 85px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px 'Segoe UI', system-ui, -apple-system, sans-serif;
}

button, select {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #89baff;
  outline-offset: 3px;
}

header {
  height: 78px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 20px;
  background: #071120;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-badge {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.06em;
  color: #fff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  letter-spacing: 0.1em;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.brand strong {
  font-size: 21px;
  letter-spacing: 0.06em;
  line-height: 1.1;
  color: var(--text);
}

.brand i {
  font-size: 10px;
  color: var(--cyan);
  margin-left: 10px;
  vertical-align: middle;
  font-style: normal;
}

nav {
  display: flex;
  align-items: center;
  gap: 30px;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

nav a {
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

nav a:hover, nav .active {
  color: var(--text);
  border-color: var(--blue);
}

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

.live {
  font-size: 10px;
  letter-spacing: 0.13em;
  color: #6ee7b7;
  font-weight: 600;
}

.btn-sync {
  background: #142c4c;
  border: 1px solid #355e8f;
  border-radius: 6px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 600;
  color: #d6e8ff;
  transition: all 0.15s;
}

.btn-sync:hover {
  background: #1f4473;
  border-color: #69a7ff;
  color: #fff;
}

.workspace {
  height: calc(100svh - 78px);
  min-height: 680px;
  display: grid;
  grid-template-columns: 335px 1fr;
}

.panel {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: #0b192c;
  padding: 20px 22px;
  scrollbar-width: thin;
  scrollbar-color: #274468 #0b192c;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #9cb9e1;
  font-weight: 600;
}

.project h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 8px 0;
}

.project h1 span {
  color: var(--blue);
}

.project p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.block {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.label span {
  color: #819bbc;
}

.presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.presets button {
  background: #0e2038;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 8px;
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  transition: all 0.15s;
}

.presets button.preset-accent {
  border-color: #2c4c72;
  color: #b9d8ff;
}

.presets button:hover, .presets button.selected {
  color: #fff;
  background: #1a3c63;
  border-color: #5599f5;
}

.explode-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 6px;
}

.explode-presets button {
  background: #0e2038;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 4px;
  font-size: 11px;
  color: var(--muted);
}

.explode-presets button:hover {
  background: #173555;
  color: #fff;
  border-color: #4383cc;
}

.step-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(8, 1fr);
  gap: 4px;
  margin-top: 8px;
}

.step-grid button {
  background: #0e2038;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 2px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.step-grid button:hover, .step-grid button.selected {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: #fff;
  font-weight: 600;
}

.step-banner {
  margin-top: 8px;
  background: #0d213a;
  border: 1px solid #244369;
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.step-banner strong {
  font-size: 11.5px;
  color: #93c5fd;
}

.step-banner span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.select-box {
  width: 100%;
  background: #0e2038;
  border: 1px solid #2b496e;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 12px;
  color: var(--text);
}

.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  cursor: pointer;
}

.toggle > span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.toggle input {
  accent-color: var(--blue);
  width: 15px;
  height: 15px;
}

.toggle i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sub-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: #0e2038;
  border: 1px solid #233e60;
  border-radius: 6px;
}

.sub-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #93c5fd;
  margin-bottom: 7px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.radio-group input {
  accent-color: var(--blue);
  margin: 0;
}

.range-label {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
}

input[type=range] {
  width: 100%;
  height: 15px;
  accent-color: var(--blue);
  cursor: ew-resize;
  margin-top: 4px;
}

.range-label button {
  background: none;
  border: 0;
  padding: 0;
  color: #89baff;
  font-size: 10.5px;
  font-weight: 600;
}

.range-label button:hover {
  text-decoration: underline;
}

.inspector {
  border: 0;
}

.select-icon {
  font-size: 22px;
  color: #89a9d0;
}

#selection p {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 6px 0 0;
}

#selection strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  color: #fff;
  display: block;
  margin-bottom: 6px;
}

#selection .badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

#selection .badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #173558;
  color: #9fd0ff;
  border: 1px solid #315c8c;
}

#selection dl {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  font-size: 11.5px;
  line-height: 1.85;
  margin: 0;
}

#selection dt {
  color: var(--muted);
}

#selection dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
  color: #f0f6ff;
}

.btn-secondary {
  margin-top: 10px;
  width: 100%;
  padding: 8px 10px;
  background: #163254;
  border: 1px solid #3c6ca3;
  border-radius: 5px;
  font-size: 11.5px;
  color: #e0eeff;
}

.btn-secondary:hover {
  background: #204775;
}

.note {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.6;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.note a {
  display: block;
  color: #89baff;
  margin-top: 4px;
}

.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #102542 0%, #071222 75%);
}

#viewer {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.stage-top {
  position: absolute;
  top: 20px;
  left: 26px;
  right: 26px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
  pointer-events: none;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.stage-top > span:first-child {
  color: #8fbaff;
}

.legend-floating {
  position: absolute;
  bottom: 48px;
  left: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 7px 12px;
  background: rgba(11, 25, 44, 0.82);
  border: 1px solid #233f63;
  border-radius: 6px;
  font-size: 11px;
  color: #cbd5e1;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.legend-floating span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-floating i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.stage-tools {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  padding: 5px;
  background: #10223ae6;
  border: 1px solid #2b4564;
  border-radius: 8px;
  gap: 5px;
}

.stage-tools button {
  border: 0;
  background: transparent;
  width: 36px;
  height: 36px;
  font-size: 20px;
  border-radius: 5px;
  color: #c1d4ef;
  transition: all 0.15s;
}

.stage-tools button:hover, .stage-tools button[aria-pressed=true] {
  background: #284a71;
  color: #fff;
}

.stage-bottom {
  position: absolute;
  bottom: 18px;
  left: 26px;
  right: 26px;
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
  gap: 20px;
  pointer-events: none;
}

.axis {
  letter-spacing: 0.12em;
  color: #8fbaff;
  font-weight: 600;
}

#loading {
  position: absolute;
  inset: 0;
  background: #081426f2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  z-index: 10;
}

#loading span {
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  height: 38px;
  width: 38px;
  border: 2.5px solid #244566;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

#error {
  position: absolute;
  inset: 0;
  padding: 100px;
  align-content: center;
  background: #081426ed;
  z-index: 11;
}

.strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
  padding: 28px 6%;
  border-block: 1px solid var(--line);
  gap: 25px;
  background: #09172b;
}

.strip > div {
  border-right: 1px solid var(--line);
}

.strip > div:last-child {
  border: 0;
}

.strip strong {
  font-size: 33px;
  letter-spacing: -0.04em;
  font-weight: 600;
  display: block;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.strip span {
  display: block;
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.13em;
  margin-top: 7px;
  font-weight: 600;
}

.strip-text {
  font-size: 23px;
  line-height: 1.3;
  align-self: center;
}

.strip-text em {
  color: var(--muted);
  font-family: inherit;
  font-weight: normal;
}

.film-section {
  padding: 80px 6%;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 60px;
  align-items: start;
}

.film-intro h2 {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.03em;
  margin: 16px 0;
}

.film-intro h2 em {
  font-family: inherit;
  font-weight: normal;
  color: #93c5fd;
}

.film-intro p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
  max-width: 420px;
}

.chapters {
  margin-top: 26px;
  display: grid;
  max-width: 440px;
}

.chapters button {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 13px 4px;
  text-align: left;
  font-size: 12px;
  transition: color 0.15s, padding-left 0.15s;
}

.chapters button:hover {
  color: #60a5fa;
  padding-left: 10px;
}

.chapters button span {
  color: #9cb9e1;
  margin-right: 14px;
  font-weight: 600;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.info-card {
  background: #0c1d34;
  border: 1px solid #223c5e;
  border-radius: 10px;
  padding: 22px;
}

.card-tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #60a5fa;
  display: block;
  margin-bottom: 10px;
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #fff;
}

.info-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.65;
}

.info-card code {
  background: #173254;
  padding: 2px 6px;
  border-radius: 4px;
  color: #93c5fd;
}

footer {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 6%;
  gap: 30px;
}

footer p {
  font-size: 11.5px;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.6;
}

footer > a {
  font-size: 12px;
  color: #89baff;
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 290px 1fr;
  }
  .film-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  header {
    padding: 0 16px;
  }
  nav {
    display: none;
  }
  .workspace {
    height: auto;
    display: flex;
    flex-direction: column-reverse;
  }
  .stage {
    height: 68svh;
    min-height: 440px;
  }
  .panel {
    border-right: 0;
  }
  .strip {
    grid-template-columns: 1fr 1fr;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
}
