:root {
  color-scheme: light;
  --ink: #152329;
  --muted: #6a777b;
  --paper: #eef2f0;
  --glass: rgba(239, 243, 241, 0.84);
  --line: rgba(21, 35, 41, 0.14);
  --accent: #df4f2c;
  --accent-dark: #9b2f1b;
  --cyan: #3e9e9b;
  --amber: #e6a729;
  font-family:
    "DIN Alternate", "Bahnschrift", "Aptos", "Microsoft YaHei UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 78% 12%, rgba(255, 255, 255, 0.95), transparent 34%),
    linear-gradient(180deg, #d7dfdd 0%, #eef1ee 52%, #dfe4e1 100%);
}

#scene,
#scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(238, 242, 240, 0.52), transparent 18%, transparent 78%, rgba(238, 242, 240, 0.26)),
    linear-gradient(180deg, rgba(238, 242, 240, 0.3), transparent 20%, transparent 78%, rgba(21, 35, 41, 0.16));
}

.masthead {
  position: absolute;
  top: clamp(18px, 3vw, 34px);
  left: clamp(18px, 3vw, 40px);
  display: flex;
  align-items: center;
  gap: 15px;
  pointer-events: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 5px;
  background: var(--ink);
  border-radius: 6px;
  transform: skewX(-7deg);
  box-shadow: 0 8px 20px rgba(21, 35, 41, 0.16);
}

.brand-mark span {
  align-self: end;
  background: var(--paper);
  height: 48%;
}

.brand-mark span:nth-child(2) {
  height: 72%;
  background: var(--accent);
}

.brand-mark span:nth-child(3) {
  height: 100%;
}

.title-block p,
.stage-panel p,
.stage-panel h2,
.loading p {
  margin: 0;
}

.title-block p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 27px);
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.1;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: 12px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(247, 249, 247, 0.7);
  backdrop-filter: blur(12px);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.live-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(223, 79, 44, 0.13);
}

.spec-rail {
  position: absolute;
  right: clamp(18px, 3vw, 42px);
  top: 50%;
  width: 132px;
  padding: 4px 0;
  transform: translateY(-52%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}

.spec-rail,
.stage-panel {
  display: none;
}

.spec {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: baseline;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.spec:last-child {
  border-bottom: 0;
}

.spec-index {
  color: var(--accent);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.spec strong {
  font-family: "Bahnschrift", "DIN Alternate", sans-serif;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}

.spec strong small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.spec > span:last-child {
  grid-column: 2;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.stage-panel {
  position: absolute;
  left: clamp(18px, 3vw, 40px);
  bottom: clamp(105px, 15vh, 148px);
  width: min(310px, calc(100vw - 36px));
  pointer-events: none;
}

.stage-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: -12px;
  width: 34px;
  height: 3px;
  background: var(--accent);
}

#stage-kicker {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

#stage-title {
  margin-top: 7px;
  font-size: clamp(29px, 4vw, 52px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

#stage-copy {
  max-width: 280px;
  margin-top: 10px;
  color: #46565c;
  font-size: 12px;
  line-height: 1.65;
}

.orientation {
  position: absolute;
  right: clamp(20px, 3vw, 42px);
  bottom: clamp(106px, 14vh, 138px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  pointer-events: none;
}

.orientation i {
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, var(--accent) 0 45%, var(--line) 45%);
  transform-origin: bottom;
}

.subtitle {
  position: absolute;
  left: 50%;
  bottom: 108px;
  z-index: 3;
  width: max-content;
  max-width: min(82vw, 1540px);
  padding: 10px 26px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(11, 20, 24, 0.74);
  box-shadow: 0 8px 26px rgba(11, 20, 24, 0.2);
  backdrop-filter: blur(10px);
  color: #f4f7f7;
  font-size: clamp(20px, 1.5vw, 58px);
  font-weight: 560;
  line-height: 1.42;
  letter-spacing: 0;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  opacity: 1;
  transition: opacity 220ms ease;
}

.subtitle.is-changing {
  opacity: 0;
}

.transport {
  position: absolute;
  left: clamp(18px, 3vw, 40px);
  right: clamp(18px, 3vw, 40px);
  bottom: clamp(16px, 2.4vw, 28px);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(238, 242, 240, 0.72);
  box-shadow: 0 12px 34px rgba(21, 35, 41, 0.12);
  backdrop-filter: blur(18px);
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.icon-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

#restart {
  background: rgba(21, 35, 41, 0.08);
  color: var(--ink);
}

.timeline {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
}

.timeline-track {
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.timeline-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
}

.timeline ol {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  transition: color 180ms ease;
}

.timeline li span {
  margin-right: 5px;
  color: rgba(21, 35, 41, 0.38);
  font-family: "Bahnschrift", sans-serif;
  font-size: 8px;
}

.timeline li.active {
  color: var(--ink);
}

.timeline li.active span {
  color: var(--accent);
}

#timecode {
  width: 48px;
  flex: 0 0 48px;
  color: var(--muted);
  font-family: "Bahnschrift", "DIN Alternate", monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-align: right;
}

.dimension-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid rgba(21, 35, 41, 0.18);
  border-radius: 3px;
  background: rgba(247, 249, 247, 0.86);
  box-shadow: 0 4px 14px rgba(21, 35, 41, 0.1);
  color: var(--ink);
  font-family: "Bahnschrift", "Microsoft YaHei UI", sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
}

.dimension-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.area-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-left: 2px solid var(--accent);
  background: rgba(238, 242, 240, 0.76);
  box-shadow: 0 6px 18px rgba(21, 35, 41, 0.09);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

.area-label::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.area-label-accent {
  border-left-color: var(--cyan);
}

.area-label-accent::before {
  background: var(--cyan);
}

.area-label-ink {
  border-left-color: var(--ink);
}

.area-label-ink::before {
  background: var(--ink);
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: #eef1ee;
  transition: opacity 500ms ease, visibility 500ms ease;
  z-index: 10;
}

.loading.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-mark {
  width: 42px;
  height: 12px;
  border: 2px solid var(--ink);
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.clean-mode .masthead,
.clean-mode .spec-rail,
.clean-mode .stage-panel,
.clean-mode .orientation,
.clean-mode .transport,
.clean-mode .vignette,
.clean-mode .loading {
  display: none;
}

.clean-mode .label-layer > div {
  display: none;
}

.clean-mode .label-layer > .span-label {
  display: inline-flex;
}

.clean-mode .subtitle {
  bottom: 7vh;
  max-width: 84vw;
}

.clean-mode #app,
.clean-mode #scene {
  background: #dce4e1;
}

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

@media (max-width: 760px) {
  .masthead {
    gap: 10px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .live-badge {
    display: none;
  }

  .spec-rail {
    top: 82px;
    right: 18px;
    width: 112px;
    transform: none;
    background: rgba(238, 242, 240, 0.62);
    backdrop-filter: blur(12px);
  }

  .spec {
    padding: 8px 1px;
  }

  .spec strong {
    font-size: 20px;
  }

  .spec > span:last-child {
    font-size: 8px;
  }

  .stage-panel {
    bottom: 112px;
  }

  #stage-title {
    font-size: 32px;
  }

  #stage-copy {
    max-width: 230px;
    font-size: 11px;
  }

  .orientation {
    display: none;
  }

  .subtitle {
    bottom: 108px;
    max-width: calc(100vw - 32px);
    padding: 8px 14px;
    font-size: 15px;
  }

  .transport {
    gap: 5px;
    padding: 7px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .timeline {
    padding: 0 4px;
  }

  .timeline li {
    font-size: 0;
  }

  .timeline li span {
    margin: 0;
    font-size: 9px;
  }

  #timecode {
    width: 39px;
    flex-basis: 39px;
    font-size: 9px;
  }

  .label-layer .area-label,
  .label-layer .dimension-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
