:root {
  --bg: #030507;
  --ink: #eef8fb;
  --muted: rgba(226, 241, 246, 0.5);
  --faint: rgba(226, 241, 246, 0.28);
  --line: rgba(216, 240, 247, 0.12);
  --line-soft: rgba(216, 240, 247, 0.07);
  --accent: #67e8ff;
  --accent-rgb: 103, 232, 255;
  --sans: "Bahnschrift", "Segoe UI Variable Display", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

html {
  background: var(--bg);
}

body {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

::selection {
  background: rgba(var(--accent-rgb), 0.3);
  color: #fff;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* Scene atmosphere                                                    */
/* ------------------------------------------------------------------ */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75% 70% at 58% 42%, rgba(9, 24, 31, 0.7), transparent 70%),
    radial-gradient(ellipse 60% 70% at 78% 74%, rgba(27, 12, 31, 0.45), transparent 72%),
    #030507;
}

#scene {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  transition: transform 1.4s var(--ease), filter 1.2s ease;
}

body:not(.is-entered) #scene {
  transform: translateX(4.5vw) scale(1.035);
}

body.is-entered #scene {
  pointer-events: auto;
  cursor: grab;
}

body.is-entered #scene:active {
  cursor: grabbing;
}

.aurora {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  will-change: transform;
}

.aurora-a {
  top: -30%;
  right: -14%;
  width: 78vw;
  height: 78vw;
  background: radial-gradient(circle, rgba(28, 172, 198, 0.13), transparent 66%);
  animation: drift-a 22s ease-in-out infinite alternate;
}

.aurora-b {
  left: -26%;
  bottom: -38%;
  width: 80vw;
  height: 80vw;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.12), transparent 64%);
  animation: drift-b 26s ease-in-out infinite alternate;
  transition: background 1.2s ease;
}

.horizon {
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: -42%;
  width: 130vw;
  height: 75vh;
  transform: translateX(-50%);
  border-radius: 50%;
  border-top: 1px solid rgba(var(--accent-rgb), 0.09);
  background: radial-gradient(ellipse at center top, rgba(var(--accent-rgb), 0.045), transparent 55%);
  filter: blur(1px);
  transition: border-color 1.2s ease;
}

.grain {
  position: absolute;
  inset: -50%;
  z-index: 4;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
  pointer-events: none;
  animation: grain-shift 0.7s steps(2) infinite;
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0.18;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    rgba(210, 245, 255, 0.014) 3px,
    transparent 4px
  );
  pointer-events: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  background:
    radial-gradient(ellipse at center, transparent 38%, rgba(1, 3, 5, 0.3) 74%, rgba(1, 3, 5, 0.78) 100%),
    linear-gradient(180deg, rgba(1, 3, 5, 0.4), transparent 18%, transparent 76%, rgba(1, 3, 5, 0.55));
  pointer-events: none;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-5vw, 4vh, 0) scale(1.08); }
}

@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.04); }
  to { transform: translate3d(6vw, -5vh, 0) scale(0.94); }
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(2%, 2%); }
  100% { transform: translate(-1%, -1%); }
}

/* ------------------------------------------------------------------ */
/* Top bar                                                             */
/* ------------------------------------------------------------------ */

.topbar {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 24px;
  padding: 30px 38px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

body.is-entered .topbar {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.5s;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(226, 246, 250, 0.42);
  border-radius: 50%;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.8);
  transition: background 0.8s ease, box-shadow 0.8s ease;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: -5px;
  right: -5px;
  top: 50%;
  height: 9px;
  margin-top: -4.5px;
  border: 1px solid rgba(226, 246, 250, 0.4);
  border-radius: 50%;
  transform: rotate(-24deg);
}

.brand-mark i {
  position: absolute;
  left: -4px;
  top: 50%;
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.9);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-copy b {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.28em;
  line-height: 1;
}

.brand-copy small,
.start-brand-copy small {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.22em;
  color: var(--muted);
  white-space: nowrap;
}

.chapter {
  min-width: 220px;
  text-align: center;
  opacity: 0.92;
}

.chapter-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.chapter-slash {
  color: var(--faint);
}

.chapter-name {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-top: 5px;
}

.chapter-name span:first-child {
  font-size: 21px;
  font-weight: 300;
  letter-spacing: 0.14em;
}

.chapter-name span:last-child {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.24em;
  color: var(--accent);
  transition: color 0.7s ease;
}

.chapter-hint {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.chapter.is-changing .chapter-name span:first-child {
  animation: chapter-swap 0.5s var(--ease);
}

.chapter.is-changing .chapter-name span:last-child {
  animation: chapter-swap 0.5s var(--ease) 0.04s;
}

@keyframes chapter-swap {
  0% { opacity: 0; transform: translateY(7px); filter: blur(4px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.track-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(3, 8, 11, 0.34);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
  color: rgba(232, 248, 252, 0.65);
}

.status-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(220, 240, 246, 0.35);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.track-pill[data-state="live"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.9);
  animation: status-blink 2.2s ease-in-out infinite;
}

.track-pill[data-state="loading"] .status-dot {
  background: #f3b76a;
  box-shadow: 0 0 8px rgba(243, 183, 106, 0.7);
  animation: status-blink 1s ease-in-out infinite;
}

.track-pill[data-state="error"] .status-dot {
  background: #ff7f9f;
  box-shadow: 0 0 8px rgba(255, 127, 159, 0.7);
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.fps-meter {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--mono);
}

.fps-meter span {
  font-size: 12px;
  color: rgba(232, 248, 252, 0.72);
}

.fps-meter small {
  font-size: 6px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

/* ------------------------------------------------------------------ */
/* Shape selector                                                      */
/* ------------------------------------------------------------------ */

.forms {
  position: fixed;
  z-index: 30;
  top: 50%;
  right: 36px;
  width: 174px;
  opacity: 0;
  transform: translate(10px, -50%);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

body.is-entered .forms {
  opacity: 1;
  transform: translate(0, -50%);
  transition-delay: 0.72s;
}

.forms-head,
.forms-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.18em;
  color: var(--faint);
}

.forms-head {
  padding-bottom: 9px;
}

.forms-foot {
  padding-top: 10px;
}

.form-list {
  border-top: 1px solid var(--line);
}

.form {
  position: relative;
  display: grid;
  grid-template-columns: 23px 1fr;
  gap: 8px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: rgba(228, 244, 248, 0.42);
  transition: color 0.35s ease, padding 0.45s var(--ease), background 0.35s ease;
}

.form:hover {
  padding-left: 6px;
  color: rgba(240, 252, 255, 0.88);
}

.form.is-active {
  color: #f4fdff;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.055), transparent 80%);
}

.form-no {
  padding-top: 2px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  color: var(--faint);
  transition: color 0.35s ease;
}

.form.is-active .form-no {
  color: var(--accent);
}

.form-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.form-cn {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.1;
}

.form-en {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.22em;
  color: rgba(228, 244, 248, 0.28);
  transition: color 0.35s ease;
}

.form.is-active .form-en {
  color: rgba(var(--accent-rgb), 0.85);
}

.form-line {
  position: absolute;
  right: 0;
  top: 50%;
  width: 0;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.75);
  transition: width 0.5s var(--ease);
}

.form.is-active .form-line {
  width: 19px;
}

/* ------------------------------------------------------------------ */
/* Camera card                                                         */
/* ------------------------------------------------------------------ */

.camera-card {
  position: fixed;
  z-index: 30;
  left: 38px;
  bottom: 34px;
  width: 226px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

body.is-entered .camera-card {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.82s;
}

.cam-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(220, 244, 250, 0.14);
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 45%, rgba(var(--accent-rgb), 0.075), transparent 62%),
    #020507;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
}

.cam-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.cam-frame video,
.cam-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.cam-frame video {
  filter: saturate(0.7) contrast(1.06) brightness(0.78);
}

.cam-frame canvas {
  z-index: 2;
  pointer-events: none;
}

.camera-card[data-state="live"] .cam-frame video,
.camera-card[data-state="live"] .cam-frame canvas {
  opacity: 1;
}

.camera-card[data-state="loading"] .cam-frame video {
  opacity: 0.22;
}

.cam-placeholder {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: radial-gradient(circle at 16% 48%, rgba(var(--accent-rgb), 0.1), transparent 55%);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.camera-card[data-state="live"] .cam-placeholder,
.camera-card[data-state="loading"] .cam-placeholder {
  opacity: 0;
  visibility: hidden;
}

.cam-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: rgba(232, 248, 252, 0.6);
}

.cam-icon svg {
  width: 16px;
  height: 16px;
}

.cam-placeholder-copy {
  flex: 1;
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  color: rgba(238, 250, 253, 0.68);
}

.cam-placeholder-copy small {
  font-size: 7.5px;
  color: var(--faint);
}

.cam-enable {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 2px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.cam-enable:hover {
  background: rgba(var(--accent-rgb), 0.17);
  border-color: rgba(var(--accent-rgb), 0.55);
}

.cam-enable:disabled {
  opacity: 0.4;
  cursor: wait;
}

.cam-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: rgba(2, 6, 9, 0.62);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.13em;
  color: rgba(232, 248, 252, 0.62);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.camera-card[data-state="loading"] .cam-loading {
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 11px;
  height: 11px;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.cam-scan {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: -20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.75), transparent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.35);
  opacity: 0;
}

.camera-card[data-state="live"] .cam-scan {
  opacity: 1;
  animation: cam-scan 4.5s ease-in-out infinite;
}

@keyframes cam-scan {
  0%, 12% { top: 8%; opacity: 0; }
  25% { opacity: 0.8; }
  58% { opacity: 0.4; }
  75% { top: 92%; opacity: 0; }
  100% { top: 92%; opacity: 0; }
}

.cam-tag {
  position: absolute;
  z-index: 5;
  top: 7px;
  left: 8px;
  padding: 3px 5px;
  background: rgba(2, 6, 9, 0.55);
  backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: 5.5px;
  letter-spacing: 0.16em;
  color: rgba(238, 250, 253, 0.55);
}

.cam-corner {
  position: absolute;
  z-index: 5;
  width: 8px;
  height: 8px;
  border-color: rgba(var(--accent-rgb), 0.6);
  border-style: solid;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.camera-card[data-state="live"] .cam-corner {
  opacity: 1;
}

.cam-corner.tl { top: 5px; left: 5px; border-width: 1px 0 0 1px; }
.cam-corner.tr { top: 5px; right: 5px; border-width: 1px 1px 0 0; }
.cam-corner.bl { bottom: 5px; left: 5px; border-width: 0 0 1px 1px; }
.cam-corner.br { bottom: 5px; right: 5px; border-width: 0 1px 1px 0; }

.cam-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.14em;
  color: rgba(230, 247, 251, 0.38);
}

.cam-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.live-dot {
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(230, 247, 251, 0.28);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.camera-card[data-state="live"] .live-dot {
  background: var(--accent);
  box-shadow: 0 0 7px rgba(var(--accent-rgb), 0.85);
}

.camera-card[data-state="error"] .live-dot {
  background: #ff7f9f;
}

#camState {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Gesture panel + telemetry                                           */
/* ------------------------------------------------------------------ */

.gesture-panel {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 330px;
  padding: 10px 14px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(3, 8, 11, 0.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  pointer-events: none;
}

body.is-entered .gesture-panel {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0.95s;
}

.gesture-orb {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(226, 246, 250, 0.17);
  border-radius: 50%;
}

.gesture-orb::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(var(--accent-rgb), 0.32);
  border-radius: 50%;
  animation: orb-spin 12s linear infinite;
}

.gesture-orb i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(226, 246, 250, 0.35);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.45);
  transition: background 0.5s ease, box-shadow 0.5s ease;
}

.gesture-panel[data-mode="solo"] .gesture-orb i,
.gesture-panel[data-mode="dual"] .gesture-orb i {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.95);
  animation: orb-breathe 1.8s ease-in-out infinite;
}

.gesture-panel[data-mode="dual"] .gesture-orb::before {
  border-style: solid;
  border-color: rgba(var(--accent-rgb), 0.42);
  animation-duration: 6s;
}

.gesture-panel.is-pulsing .gesture-orb {
  animation: panel-tap 0.55s var(--ease);
}

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

@keyframes orb-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}

@keyframes panel-tap {
  0% { transform: scale(0.88); border-color: var(--accent); }
  100% { transform: scale(1); border-color: rgba(226, 246, 250, 0.17); }
}

.gesture-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

#gestureMode {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  color: var(--accent);
  transition: color 0.7s ease;
}

#gestureDetail {
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: rgba(234, 248, 252, 0.48);
  white-space: nowrap;
}

.gesture-key {
  margin-left: auto;
  padding-left: 13px;
  border-left: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.17em;
  color: var(--faint);
}

.telemetry {
  position: fixed;
  z-index: 30;
  right: 38px;
  bottom: 34px;
  width: 168px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

body.is-entered .telemetry {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.9s;
}

.readout {
  margin-top: 10px;
}

.readout-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.readout-top span {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
  white-space: nowrap;
}

.readout-top strong {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: rgba(241, 252, 255, 0.86);
  font-variant-numeric: tabular-nums;
}

.meter {
  height: 1px;
  margin-top: 6px;
  overflow: hidden;
  background: rgba(223, 246, 251, 0.12);
}

.meter span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.7);
  transform: scaleX(0.36);
  transform-origin: left center;
  transition: background 0.7s ease;
}

/* ------------------------------------------------------------------ */
/* Toast + error                                                       */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 105px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 15px;
  border-left: 2px solid var(--accent);
  background: rgba(3, 8, 12, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.32);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: rgba(240, 252, 255, 0.75);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.35s ease, transform 0.35s var(--ease);
  pointer-events: none;
}

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

.webgl-error {
  position: fixed;
  z-index: 200;
  left: 50%;
  top: 50%;
  width: min(420px, calc(100vw - 36px));
  padding: 30px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 11, 0.94);
  transform: translate(-50%, -50%);
  text-align: center;
}

.webgl-error-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0 auto 16px;
  border: 1px solid #ff7f9f;
  border-radius: 50%;
  font-family: var(--mono);
  color: #ff9db5;
}

.webgl-error h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 400;
}

.webgl-error p {
  margin: 0;
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Start screen                                                        */
/* ------------------------------------------------------------------ */

.start-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    linear-gradient(90deg, rgba(2, 4, 7, 0.94) 0%, rgba(2, 5, 8, 0.66) 38%, rgba(2, 5, 8, 0.12) 68%, rgba(2, 5, 8, 0.48) 100%),
    radial-gradient(ellipse at 66% 48%, rgba(3, 12, 16, 0.03), rgba(2, 5, 8, 0.54) 72%);
  transition: opacity 0.85s var(--ease), visibility 0.85s ease;
}

.start-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 54%, rgba(1, 3, 5, 0.42) 72%, rgba(1, 3, 5, 0.26) 100%),
    linear-gradient(180deg, rgba(1, 3, 5, 0.6), transparent 22%, transparent 78%, rgba(1, 3, 5, 0.64)),
    radial-gradient(ellipse at 62% 45%, transparent 0%, transparent 48%, rgba(1, 3, 5, 0.26) 100%);
}

.start-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-wash {
  position: absolute;
  top: 8%;
  left: 38%;
  width: 44vw;
  height: 44vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.055), transparent 66%);
  filter: blur(50px);
  animation: wash-drift 10s ease-in-out infinite alternate;
}

@keyframes wash-drift {
  from { transform: translate3d(-3vw, 2vh, 0) scale(0.94); }
  to { transform: translate3d(3vw, -2vh, 0) scale(1.06); }
}

.start-brand {
  position: absolute;
  z-index: 2;
  top: 34px;
  left: 42px;
  display: flex;
  align-items: center;
  gap: 13px;
  animation: reveal-fade 1s var(--ease) both 0.1s;
}

.start-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.start-brand-copy b {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.start-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(280px, 0.62fr);
  align-items: center;
  gap: 7vw;
  width: 100%;
  max-width: 1540px;
  min-height: 100%;
  margin: 0 auto;
  padding: 114px 7vw 92px;
  transition: transform 0.9s var(--ease), opacity 0.7s ease;
}

.start-screen.is-hidden .start-inner {
  transform: translateY(-16px);
  opacity: 0;
}

.start-lead {
  max-width: 760px;
  animation: reveal-up 1.2s var(--ease) both 0.18s;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.24em;
  color: rgba(228, 246, 251, 0.48);
}

.kicker i {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8);
  transition: background 0.7s ease;
}

h1 {
  margin: 22px 0 24px;
  font-size: clamp(62px, 7.7vw, 120px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.075em;
  text-shadow: 0 20px 80px rgba(0, 0, 0, 0.32);
}

h1 em {
  position: relative;
  display: inline-block;
  font-style: normal;
  background: linear-gradient(96deg, #f6fdff 4%, var(--accent) 48%, #b99bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h1 em::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 2%;
  bottom: -0.08em;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.7), transparent);
  opacity: 0.55;
}

.start-desc {
  max-width: 420px;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.95;
  letter-spacing: 0.045em;
  color: rgba(228, 244, 248, 0.53);
}

.start-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 34px;
}

.start-primary {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  height: 52px;
  padding: 0 22px 0 24px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--accent);
  color: #031014;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow: 0 0 32px rgba(var(--accent-rgb), 0.16);
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, background 0.7s ease;
}

.start-primary svg {
  width: 18px;
  height: 18px;
  transition: transform 0.35s var(--ease);
}

.start-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 46px rgba(var(--accent-rgb), 0.28);
}

.start-primary:hover svg {
  transform: translateX(4px);
}

.start-primary:active {
  transform: translateY(0);
}

.start-secondary {
  padding: 8px 1px;
  border: 0;
  border-bottom: 1px solid rgba(228, 244, 248, 0.22);
  background: transparent;
  color: rgba(228, 244, 248, 0.6);
  font-size: 10px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.start-secondary:hover {
  color: #fff;
  border-color: var(--accent);
}

.start-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 21px 0 0;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.13em;
  color: rgba(228, 244, 248, 0.28);
}

.start-note i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.55);
}

.start-guide {
  align-self: center;
  min-width: 280px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  animation: reveal-up 1.2s var(--ease) both 0.4s;
}

.guide-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 15px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.18em;
  color: rgba(228, 244, 248, 0.44);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}

.guide-row {
  display: grid;
  grid-template-columns: 28px 1fr 26px;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}

.guide-no {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  color: var(--accent);
  transition: color 0.7s ease;
}

.guide-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guide-copy b {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(248, 253, 255, 0.9);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.95);
}

.guide-copy small {
  font-size: 9px;
  letter-spacing: 0.03em;
  color: rgba(228, 244, 248, 0.45);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95);
}

.guide-rule {
  justify-self: end;
  width: 18px;
  height: 1px;
  background: rgba(228, 244, 248, 0.17);
  transition: width 0.4s var(--ease), background 0.4s ease;
}

.guide-row:hover .guide-rule {
  width: 26px;
  background: var(--accent);
}

.start-foot {
  position: absolute;
  z-index: 2;
  left: 42px;
  right: 42px;
  bottom: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.2em;
  color: rgba(228, 244, 248, 0.23);
  animation: reveal-fade 1s var(--ease) both 0.7s;
}

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes reveal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1200px) {
  .topbar {
    padding: 26px 28px;
  }

  .forms {
    right: 28px;
    width: 154px;
  }

  .camera-card {
    left: 28px;
    bottom: 28px;
    width: 205px;
  }

  .telemetry {
    right: 28px;
    bottom: 28px;
    width: 150px;
  }

  .gesture-panel {
    bottom: 28px;
    min-width: 300px;
  }

  .gesture-key {
    display: none;
  }

  .start-inner {
    gap: 5vw;
    padding-left: 6vw;
    padding-right: 6vw;
  }

  .start-brand,
  .start-foot {
    left: 32px;
    right: 32px;
  }
}

@media (max-width: 1020px) {
  .chapter {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .start-inner {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.56fr);
    gap: 44px;
  }

  h1 {
    font-size: clamp(54px, 8.6vw, 92px);
  }

  .start-guide {
    min-width: 230px;
  }

  .guide-copy b {
    font-size: 12px;
  }
}

@media (max-width: 820px) and (min-width: 761px) {
  .start-inner {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 110px;
  }

  .start-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
  }

  .guide-head {
    grid-column: 1 / -1;
  }

  .start-foot {
    display: none;
  }

  .start-desc {
    max-width: 520px;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 18px 18px;
    align-items: center;
    gap: 12px;
  }

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

  .brand-mark::before {
    inset: 6px;
  }

  .brand-mark::after {
    left: -4px;
    right: -4px;
    height: 7px;
    margin-top: -3.5px;
  }

  .brand-copy b {
    font-size: 11px;
  }

  .brand-copy small {
    display: none;
  }

  .top-right {
    gap: 10px;
  }

  .track-pill {
    height: 24px;
    padding: 0 8px;
    font-size: 5.5px;
    letter-spacing: 0.1em;
  }

  .fps-meter {
    display: none;
  }

  .forms {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: auto;
    padding: 10px 12px calc(9px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(2, 5, 7, 0.92) 38%, rgba(2, 5, 7, 0.98));
    transform: translateY(8px);
  }

  body.is-entered .forms {
    transform: translateY(0);
    transition-delay: 0.7s;
  }

  .forms-head,
  .forms-foot {
    display: none;
  }

  .form-list {
    display: flex;
    gap: 1px;
    padding-top: 2px;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .form-list::-webkit-scrollbar {
    display: none;
  }

  .form {
    display: flex;
    flex: 1 0 58px;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 3px 6px;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid transparent;
    text-align: center;
  }

  .form:hover {
    padding-left: 3px;
  }

  .form.is-active {
    border-bottom-color: var(--accent);
    background: linear-gradient(180deg, transparent, rgba(var(--accent-rgb), 0.065));
  }

  .form-no {
    padding-top: 0;
    font-size: 5.5px;
  }

  .form-cn {
    font-size: 10.5px;
  }

  .form-en {
    font-size: 5.5px;
    letter-spacing: 0.14em;
  }

  .form-line {
    display: none;
  }

  .camera-card {
    left: 13px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: 152px;
  }

  .cam-placeholder {
    gap: 7px;
    padding: 8px;
  }

  .cam-icon {
    width: 25px;
    height: 25px;
  }

  .cam-icon svg {
    width: 13px;
    height: 13px;
  }

  .cam-placeholder-copy {
    font-size: 7px;
  }

  .cam-placeholder-copy small {
    display: none;
  }

  .cam-enable {
    padding: 4px 6px;
    font-size: 5.5px;
  }

  .cam-tag {
    font-size: 4.5px;
  }

  .cam-meta {
    padding-top: 6px;
    font-size: 5.5px;
    letter-spacing: 0.1em;
  }

  .telemetry {
    right: 13px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: 102px;
  }

  .readout {
    margin-top: 5px;
  }

  .readout-top span {
    font-size: 5px;
    letter-spacing: 0.08em;
  }

  .readout-top strong {
    font-size: 14px;
  }

  .readout:nth-child(2) {
    display: none;
  }

  .gesture-panel {
    display: none;
  }

  .toast {
    bottom: calc(170px + env(safe-area-inset-bottom));
    font-size: 9px;
  }

  .start-brand {
    top: 20px;
    left: 20px;
  }

  .start-inner {
    display: block;
    padding: 92px 22px calc(44px + env(safe-area-inset-bottom));
  }

  .start-lead {
    max-width: none;
  }

  .kicker {
    font-size: 6px;
    letter-spacing: 0.17em;
  }

  h1 {
    margin-top: 17px;
    font-size: clamp(46px, 13.6vw, 72px);
    line-height: 1.02;
    letter-spacing: -0.065em;
  }

  .start-desc {
    font-size: 11.5px;
    line-height: 1.85;
  }

  .start-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 26px;
  }

  .start-primary {
    justify-content: space-between;
    width: 100%;
  }

  .start-secondary {
    align-self: flex-start;
  }

  .start-note {
    line-height: 1.6;
  }

  .start-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
    margin-top: 38px;
    min-width: 0;
  }

  .guide-head {
    grid-column: 1 / -1;
  }

  .guide-row {
    grid-template-columns: 20px 1fr;
    gap: 8px;
    padding: 12px 0;
  }

  .guide-rule {
    display: none;
  }

  .guide-copy b {
    font-size: 11px;
  }

  .guide-copy small {
    font-size: 8px;
  }

  .start-foot {
    display: none;
  }
}

@media (max-width: 380px) {
  .camera-card {
    width: 132px;
  }

  .telemetry {
    width: 88px;
  }

  .form {
    flex-basis: 52px;
  }

  h1 {
    font-size: 44px;
  }
}

@media (max-height: 700px) and (min-width: 761px) {
  .start-inner {
    padding-top: 92px;
    padding-bottom: 68px;
    align-items: start;
  }

  .start-brand {
    top: 22px;
  }

  h1 {
    font-size: clamp(52px, 6.7vw, 90px);
    margin-top: 16px;
    margin-bottom: 18px;
  }

  .start-actions {
    margin-top: 24px;
  }

  .start-note {
    margin-top: 14px;
  }

  .guide-row {
    padding: 12px 0;
  }

  .start-foot {
    bottom: 18px;
  }

  .forms {
    width: 148px;
  }

  .form {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .camera-card {
    width: 195px;
  }
}

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

  .grain,
  .aurora,
  .start-wash {
    animation: none !important;
  }
}
