:root {
  color-scheme: dark;
  --bg: #04060c;
  --bg-soft: #090d18;
  --ink: #f7f0ec;
  --muted: rgba(236, 225, 232, 0.56);
  --faint: rgba(236, 225, 232, 0.32);
  --line: rgba(255, 236, 244, 0.13);
  --line-strong: rgba(255, 236, 244, 0.24);
  --rose: #ff7fae;
  --rose-hot: #ff5d9b;
  --gold: #ffd4a1;
  --violet: #b9a1ff;
  --teal: #78e4d3;
  --danger: #ff9b9b;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --font-sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas,
    monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  min-height: 100svh;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button {
  margin: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 1.5px solid var(--gold);
  outline-offset: 4px;
}

::selection {
  color: #140910;
  background: var(--rose);
}

[hidden] {
  display: none !important;
}

.app {
  position: fixed;
  inset: 0;
  isolation: isolate;
  min-height: 100svh;
}

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

.stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 58% 36%, #10142a 0%, #080b16 45%, #03050a 100%);
}

.stage canvas#scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.camera-bg {
  position: absolute;
  inset: -4%;
  z-index: 1;
  width: 108%;
  height: 108%;
  object-fit: cover;
  opacity: 0;
  filter: blur(38px) saturate(0.62) brightness(0.48);
  transform: scaleX(-1);
  mix-blend-mode: screen;
  transition: opacity 1.4s var(--ease-out);
  pointer-events: none;
}

.app[data-camera="on"] .camera-bg {
  opacity: 0.19;
}

.starfield {
  position: absolute;
  inset: -12%;
  z-index: 2;
  opacity: 0.65;
  background-image:
    radial-gradient(1.3px 1.3px at 12% 26%, rgba(255, 255, 255, 0.74), transparent 100%),
    radial-gradient(1px 1px at 28% 72%, rgba(206, 220, 255, 0.65), transparent 100%),
    radial-gradient(1.6px 1.6px at 41% 15%, rgba(255, 227, 205, 0.55), transparent 100%),
    radial-gradient(1px 1px at 58% 82%, rgba(255, 255, 255, 0.6), transparent 100%),
    radial-gradient(1.2px 1.2px at 72% 31%, rgba(220, 202, 255, 0.52), transparent 100%),
    radial-gradient(1px 1px at 84% 64%, rgba(255, 255, 255, 0.5), transparent 100%),
    radial-gradient(1.4px 1.4px at 92% 18%, rgba(255, 231, 211, 0.55), transparent 100%),
    radial-gradient(1px 1px at 34% 42%, rgba(255, 255, 255, 0.35), transparent 100%),
    radial-gradient(1px 1px at 66% 55%, rgba(255, 255, 255, 0.28), transparent 100%),
    radial-gradient(1px 1px at 7% 58%, rgba(255, 255, 255, 0.3), transparent 100%);
  animation: stars-drift 80s ease-in-out infinite alternate;
}

.starfield::before,
.starfield::after {
  position: absolute;
  top: 18%;
  left: 82%;
  width: 140px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 238, 224, 0.82),
    rgba(255, 255, 255, 0.95),
    transparent
  );
  box-shadow: 0 0 7px rgba(255, 225, 215, 0.55);
  content: "";
  opacity: 0;
  transform: rotate(-32deg);
  transform-origin: 100% 50%;
  animation: shooting-star 17s 3s ease-in infinite;
}

.starfield::after {
  top: 39%;
  left: 96%;
  width: 84px;
  animation-duration: 25s;
  animation-delay: 9s;
}

@keyframes shooting-star {
  0%,
  86% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(-32deg) scaleX(0.25);
  }
  88% {
    opacity: 0.86;
  }
  91% {
    opacity: 0.42;
  }
  96%,
  100% {
    opacity: 0;
    transform: translate3d(-62vw, 33vh, 0) rotate(-32deg) scaleX(1);
  }
}

.atmosphere {
  position: absolute;
  inset: -10%;
  z-index: 2;
  opacity: 0.8;
  background:
    radial-gradient(ellipse 36% 42% at 68% 36%, rgba(255, 95, 157, 0.18), transparent 70%),
    radial-gradient(ellipse 34% 38% at 44% 65%, rgba(111, 107, 255, 0.16), transparent 72%),
    radial-gradient(ellipse 26% 30% at 58% 78%, rgba(255, 185, 112, 0.08), transparent 70%);
  filter: blur(22px);
  mix-blend-mode: screen;
  animation: atmosphere-breathe 14s ease-in-out infinite alternate;
  pointer-events: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(ellipse 76% 64% at 52% 43%, transparent 20%, rgba(2, 4, 10, 0.34) 68%, rgba(2, 4, 10, 0.9) 100%),
    linear-gradient(180deg, rgba(2, 4, 10, 0.38) 0%, transparent 22%, transparent 68%, rgba(2, 4, 10, 0.72) 100%);
  pointer-events: none;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0.055;
  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='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.frame-line {
  position: absolute;
  inset: 18px;
  z-index: 5;
  border: 1px solid rgba(255, 241, 248, 0.06);
  pointer-events: none;
}

/* ------------------------------------------------------------------------- */
/* Typography helpers                                                        */
/* ------------------------------------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.24em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow i {
  color: rgba(255, 209, 225, 0.46);
  font-style: normal;
  letter-spacing: 0.12em;
}

.eyebrow-line {
  display: inline-block;
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, var(--rose), transparent);
}

@keyframes stars-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-1.4%, 1%, 0) scale(1.03); }
}

@keyframes atmosphere-breathe {
  from { opacity: 0.52; transform: scale(0.98) rotate(-1deg); }
  to { opacity: 0.96; transform: scale(1.05) rotate(1.5deg); }
}

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

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

.topbar {
  position: relative;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding:
    max(22px, env(safe-area-inset-top))
    clamp(20px, 3.2vw, 46px)
    0;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  opacity: 1;
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.brand-mark {
  width: 38px;
  height: 38px;
  color: var(--gold);
  filter: drop-shadow(0 0 12px rgba(255, 174, 200, 0.2));
}

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

.brand-en {
  color: rgba(247, 230, 238, 0.5);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.24em;
  line-height: 1;
  white-space: nowrap;
}

.brand-en i {
  color: rgba(255, 170, 201, 0.45);
  font-style: normal;
}

.brand-cn {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1.25;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.top-actions {
  display: none;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  pointer-events: auto;
}

.app[data-state="live"] .top-actions {
  display: flex;
  opacity: 1;
  transform: none;
}

.sound-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 6px 12px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.42);
  color: rgba(244, 234, 239, 0.58);
  text-align: left;
  backdrop-filter: blur(14px);
  transition:
    color 0.25s,
    border-color 0.25s,
    background 0.25s,
    transform 0.25s;
}

.sound-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(25, 22, 38, 0.72);
  transform: translateY(-1px);
}

.sound-btn.is-on {
  border-color: rgba(255, 209, 167, 0.3);
  background:
    linear-gradient(110deg, rgba(255, 211, 176, 0.085), rgba(255, 127, 174, 0.055)),
    rgba(7, 10, 18, 0.46);
  color: rgba(255, 229, 204, 0.92);
}

.sound-btn.is-waiting {
  border-color: rgba(255, 210, 174, 0.36);
  animation: sound-wait 2.2s ease-in-out infinite;
}

@keyframes sound-wait {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 196, 152, 0);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(255, 196, 152, 0.09);
  }
}

.sound-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.sound-btn__bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 13px;
  height: 13px;
}

.sound-btn__bars i {
  display: block;
  width: 2px;
  border-radius: 99px;
  background: currentColor;
  opacity: 0.42;
  transform-origin: 50% 100%;
  transition: opacity 0.25s, background 0.25s;
}

.sound-btn__bars i:nth-child(1) {
  height: 5px;
  animation: equalize 0.9s -0.4s ease-in-out infinite;
}

.sound-btn__bars i:nth-child(2) {
  height: 10px;
  animation: equalize 0.72s -0.15s ease-in-out infinite;
}

.sound-btn__bars i:nth-child(3) {
  height: 13px;
  animation: equalize 1.05s -0.55s ease-in-out infinite;
}

.sound-btn__bars i:nth-child(4) {
  height: 7px;
  animation: equalize 0.8s -0.28s ease-in-out infinite;
}

.sound-btn.is-on .sound-btn__bars i {
  background: var(--gold);
  opacity: 1;
}

.sound-btn:not(.is-on) .sound-btn__bars i {
  animation: none;
  transform: scaleY(0.58);
}

.sound-btn__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1;
}

.sound-btn__label {
  color: rgba(255, 205, 224, 0.44);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.18em;
  line-height: 1;
  white-space: nowrap;
}

.sound-btn.is-on .sound-btn__label {
  color: rgba(255, 217, 173, 0.66);
}

.sound-btn__title {
  color: rgba(247, 232, 239, 0.64);
  font-size: 8px;
  letter-spacing: 0.035em;
  line-height: 1;
  white-space: nowrap;
}

.sound-btn__mobile {
  display: none;
  color: rgba(255, 232, 242, 0.7);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.sound-btn.is-on .sound-btn__title {
  color: rgba(255, 243, 233, 0.86);
}

.sound-btn.is-on .sound-btn__mobile {
  color: rgba(255, 222, 178, 0.92);
}

@keyframes equalize {
  0%,
  100% {
    transform: scaleY(0.55);
  }
  50% {
    transform: scaleY(1);
  }
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.42);
  color: rgba(244, 234, 239, 0.7);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
  white-space: nowrap;
}

.live-status__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 0 0 transparent;
  transition: background 0.3s, box-shadow 0.3s;
}

.live-status[data-state="live"] .live-status__dot {
  background: var(--teal);
  box-shadow: 0 0 12px rgba(120, 228, 211, 0.9);
  animation: status-pulse 2s ease-in-out infinite;
}

.live-status[data-state="demo"] .live-status__dot {
  background: var(--gold);
  box-shadow: 0 0 11px rgba(255, 212, 161, 0.75);
}

.live-status[data-state="error"] .live-status__dot {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 120, 120, 0.6);
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}

.icon-btn {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(7, 10, 18, 0.42);
  color: rgba(244, 234, 239, 0.66);
  backdrop-filter: blur(14px);
  transition: color 0.25s, border-color 0.25s, background 0.25s;
  place-items: center;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(25, 22, 38, 0.7);
}

.mode-btn {
  min-height: 34px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 196, 218, 0.24);
  border-radius: 999px;
  background: rgba(255, 157, 191, 0.08);
  color: rgba(255, 220, 231, 0.86);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  backdrop-filter: blur(14px);
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}

.mode-btn:hover {
  background: rgba(255, 157, 191, 0.16);
  border-color: rgba(255, 196, 218, 0.44);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------------- */
/* Interface / telemetry                                                     */
/* ------------------------------------------------------------------------- */

.interface {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.telemetry {
  position: absolute;
  bottom: calc(clamp(20px, 3.2vw, 40px) + env(safe-area-inset-bottom));
  left: clamp(18px, 3.2vw, 46px);
  width: min(322px, calc(100vw - 36px));
  padding: 17px 18px 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(110% 80% at 10% 0%, rgba(255, 157, 191, 0.075), transparent 54%),
    linear-gradient(145deg, rgba(15, 18, 31, 0.84), rgba(5, 7, 14, 0.62));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.7s 0.15s var(--ease-out),
    transform 0.7s 0.15s var(--ease-out);
  backdrop-filter: blur(24px) saturate(1.25);
  pointer-events: auto;
}

.telemetry::after {
  position: absolute;
  top: 0;
  left: 22px;
  width: 78px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 194, 215, 0.65), transparent);
  content: "";
}

.app[data-state="live"] .telemetry {
  opacity: 1;
  transform: none;
}

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

.mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.mini-chip__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.3s, box-shadow 0.3s;
}

.mini-chip[data-state="tracking"] {
  color: rgba(199, 255, 244, 0.7);
}

.mini-chip[data-state="tracking"] .mini-chip__dot {
  background: var(--teal);
  box-shadow: 0 0 9px var(--teal);
}

.mini-chip[data-state="demo"] {
  color: rgba(255, 227, 191, 0.7);
}

.mini-chip[data-state="demo"] .mini-chip__dot {
  background: var(--gold);
  box-shadow: 0 0 9px rgba(255, 212, 161, 0.8);
}

.telemetry__main {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  margin-top: 13px;
}

.gauge {
  position: relative;
  display: grid;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.06), transparent 62%);
  place-items: center;
}

.gauge::before {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: conic-gradient(
    from 220deg,
    rgba(255, 241, 245, 0.075) 0deg 280deg,
    transparent 280deg 360deg
  );
  content: "";
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0);
}

.gauge__ticks {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 220deg,
    rgba(255, 255, 255, 0.18) 0deg 0.7deg,
    transparent 0.7deg 14deg
  );
  opacity: 0.55;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px) calc(100% - 3px), transparent 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px) calc(100% - 3px), transparent 0);
}

.gauge__ticks span {
  display: none;
}

.gauge__arc {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: conic-gradient(
    from 220deg,
    var(--gold) 0deg,
    var(--rose) calc(var(--tension) * 140deg),
    var(--violet) calc(var(--tension) * 280deg),
    transparent calc(var(--tension) * 280deg) 360deg
  );
  filter: drop-shadow(0 0 7px rgba(255, 133, 179, 0.38));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 0);
  transition: filter 0.3s;
}

.gauge__core {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
  background: rgba(5, 7, 13, 0.56);
  box-shadow: inset 0 0 18px rgba(255, 167, 199, 0.035);
  line-height: 1;
}

.gauge__value {
  display: inline-block;
  min-width: 38px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  text-align: right;
}

.gauge__unit {
  margin-left: 2px;
  margin-top: 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  align-self: center;
}

.readout {
  min-width: 0;
}

.readout__state {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.16;
}

.readout__en {
  margin: 3px 0 0;
  color: rgba(255, 165, 197, 0.6);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.2em;
  line-height: 1.3;
}

.readout__desc {
  max-width: 18em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.threshold {
  margin-top: 14px;
}

.threshold__track {
  position: relative;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.075);
}

.threshold__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--rose) 54%, var(--violet));
  box-shadow: 0 0 10px rgba(255, 127, 174, 0.38);
  transition: width 0.08s linear;
}

.threshold__mark {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 8px;
  background: rgba(255, 255, 255, 0.26);
}

.threshold__head {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(255, 247, 250, 0.8);
  border-radius: 50%;
  background: var(--rose-hot);
  box-shadow: 0 0 8px rgba(255, 93, 155, 0.8);
  transform: translate(-50%, -50%);
  transition: left 0.08s linear;
}

.threshold__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.07em;
}

.formula {
  margin: 11px 0 0;
  overflow: hidden;
  color: rgba(239, 219, 229, 0.34);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.015em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula span {
  color: rgba(255, 203, 220, 0.46);
}

/* ------------------------------------------------------------------------- */
/* Gesture guide                                                             */
/* ------------------------------------------------------------------------- */

.gesture-guide {
  position: absolute;
  bottom: calc(clamp(20px, 3.2vw, 40px) + env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 241, 246, 0.1);
  border-radius: 16px;
  background: rgba(6, 9, 16, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.7s 0.28s var(--ease-out),
    transform 0.7s 0.28s var(--ease-out);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.app[data-state="live"] .gesture-guide {
  opacity: 1;
  transform: translate(-50%, 0);
}

.guide-note {
  max-width: 76px;
  color: rgba(255, 217, 230, 0.32);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.18em;
  line-height: 1.5;
}

.guide-step {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.guide-step b {
  color: rgba(249, 239, 242, 0.84);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.guide-step em {
  color: var(--faint);
  font-size: 9px;
  font-style: normal;
}

.gesture-icon {
  display: grid;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 238, 244, 0.1);
  border-radius: 50%;
  color: rgba(255, 206, 224, 0.72);
  background: rgba(255, 255, 255, 0.025);
  place-items: center;
}

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

.gesture-icon--bloom {
  color: rgba(255, 214, 168, 0.8);
}

.guide-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.08);
}

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

.camera-card {
  position: absolute;
  right: clamp(18px, 3.2vw, 46px);
  bottom: calc(clamp(20px, 3.2vw, 40px) + env(safe-area-inset-bottom));
  width: clamp(226px, 20.5vw, 286px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(17, 20, 31, 0.82), rgba(5, 7, 13, 0.68));
  box-shadow:
    0 20px 56px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.7s 0.22s var(--ease-out),
    transform 0.7s 0.22s var(--ease-out);
  backdrop-filter: blur(20px) saturate(1.15);
  pointer-events: auto;
}

.app[data-state="live"] .camera-card:not([hidden]) {
  opacity: 1;
  transform: none;
}

.camera-card__head,
.camera-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(240, 229, 235, 0.38);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.13em;
  line-height: 1.3;
}

.camera-card__head {
  padding: 0 2px 8px;
}

.camera-card__head span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 215, 228, 0.56);
}

.rec-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rose-hot);
  box-shadow: 0 0 7px rgba(255, 93, 155, 0.8);
  animation: rec-blink 2.4s ease-in-out infinite;
}

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

.camera-card__stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 10px;
  background: #060912;
}

.camera-card__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanline {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 20%;
  background: linear-gradient(180deg, transparent, rgba(255, 178, 206, 0.055), transparent);
  animation: scan 5.4s linear infinite;
  pointer-events: none;
}

@keyframes scan {
  from { transform: translateY(0); }
  to { transform: translateY(620%); }
}

.corner {
  position: absolute;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-color: rgba(255, 234, 242, 0.52);
  border-style: solid;
  pointer-events: none;
}

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

.camera-card__foot {
  padding: 8px 2px 0;
}

.camera-card__foot span:first-child {
  color: rgba(255, 208, 225, 0.5);
  letter-spacing: 0.08em;
}

/* ------------------------------------------------------------------------- */
/* Fingertip glow                                                            */
/* ------------------------------------------------------------------------- */

.finger-glow {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s ease;
  mix-blend-mode: screen;
  pointer-events: none;
}

.finger-glow.is-visible {
  opacity: 1;
}

.finger-glow__core {
  position: absolute;
  inset: 36px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 247, 226, 0.9) 0%, rgba(255, 150, 192, 0.35) 38%, transparent 72%);
  filter: blur(1px);
}

.finger-glow__ring {
  position: absolute;
  inset: 27px;
  border: 1px solid rgba(255, 206, 225, 0.34);
  border-radius: 50%;
  animation: fingertip-pulse 2.2s ease-out infinite;
}

@keyframes fingertip-pulse {
  0% { transform: scale(0.7); opacity: 0; }
  32% { opacity: 0.8; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* ------------------------------------------------------------------------- */
/* Intro                                                                     */
/* ------------------------------------------------------------------------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.85s var(--ease-out),
    visibility 0.85s,
    transform 1.2s var(--ease-out);
  pointer-events: none;
}

.app[data-state="live"] .intro {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.025);
  pointer-events: none;
}

.intro__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 5, 11, 0.975) 0%, rgba(3, 5, 11, 0.94) 30%, rgba(3, 5, 11, 0.62) 50%, rgba(3, 5, 11, 0.08) 76%, rgba(3, 5, 11, 0.45) 100%),
    linear-gradient(0deg, rgba(3, 5, 11, 0.82) 0%, transparent 28%, transparent 74%, rgba(3, 5, 11, 0.52) 100%);
  pointer-events: none;
}

.intro__copy {
  position: relative;
  z-index: 2;
  width: min(670px, calc(100vw - 48px));
  margin-left: clamp(24px, 7.6vw, 124px);
  padding-top: 5vh;
  padding-bottom: 6vh;
}

.intro__eyebrow {
  color: rgba(255, 223, 234, 0.48);
  opacity: 0;
  transform: translateY(14px);
  animation: intro-rise 1s 0.15s var(--ease-out) forwards;
}

.intro__title {
  margin: 22px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(3.7rem, 7.6vw, 7.8rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.96;
  text-wrap: balance;
  opacity: 0;
  transform: translateY(22px);
  animation: intro-rise 1.2s 0.24s var(--ease-out) forwards;
}

.intro__title em {
  color: transparent;
  font-style: normal;
  background: linear-gradient(108deg, #ffe3c0 0%, #ff9dc4 35%, #ff7fae 58%, #bca5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 34px rgba(255, 125, 174, 0.16));
}

.intro__lede {
  max-width: 32em;
  margin: 24px 0 0;
  color: rgba(240, 227, 233, 0.62);
  font-size: clamp(12px, 1.12vw, 14px);
  font-weight: 300;
  letter-spacing: 0.035em;
  line-height: 2;
  opacity: 0;
  transform: translateY(16px);
  animation: intro-rise 1s 0.46s var(--ease-out) forwards;
}

.intro__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  opacity: 0;
  transform: translateY(16px);
  animation: intro-rise 1s 0.6s var(--ease-out) forwards;
  pointer-events: auto;
}

.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 15px;
  min-height: 48px;
  padding: 8px 9px 8px 22px;
  border: 1px solid rgba(255, 238, 244, 0.7);
  border-radius: 999px;
  background: linear-gradient(102deg, #f9e8dc 0%, #f7d4df 52%, #e5c7ed 100%);
  box-shadow:
    0 15px 42px rgba(255, 117, 168, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  color: #140b12;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out),
    filter 0.35s;
  pointer-events: auto;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 20px 55px rgba(255, 117, 168, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  filter: brightness(1.035);
}

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

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.78;
  transform: none;
}

.primary-btn__icon {
  display: grid;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: #130b13;
  color: #fff4ee;
  place-items: center;
}

.primary-btn__icon svg {
  width: 17px;
  height: 17px;
}

.primary-btn.is-loading .primary-btn__icon svg {
  display: none;
}

.primary-btn.is-loading .primary-btn__icon::after {
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  content: "";
}

.secondary-btn {
  min-height: 46px;
  padding: 8px 19px;
  border: 1px solid rgba(255, 236, 244, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(247, 235, 240, 0.66);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  transition:
    color 0.25s,
    border-color 0.25s,
    background 0.25s;
  pointer-events: auto;
}

.secondary-btn:hover {
  color: var(--ink);
  border-color: rgba(255, 236, 244, 0.34);
  background: rgba(255, 255, 255, 0.055);
}

.secondary-btn:disabled {
  cursor: wait;
  opacity: 0.4;
}

.intro__hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 36em;
  margin: 21px 0 0;
  color: rgba(236, 222, 229, 0.38);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  line-height: 1.7;
  opacity: 0;
  transform: translateY(12px);
  animation: intro-rise 1s 0.72s var(--ease-out) forwards;
}

.intro__hint svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: rgba(130, 228, 211, 0.6);
}

.intro__hint[data-tone="error"] {
  color: #ffb6b6;
}

.intro__hint[data-tone="error"] svg {
  color: #ff9b9b;
}

.intro__hint[data-tone="success"] {
  color: rgba(162, 239, 220, 0.75);
}

.intro__meta {
  position: absolute;
  top: 50%;
  right: clamp(28px, 5.4vw, 92px);
  z-index: 2;
  display: grid;
  gap: 24px;
  text-align: right;
  transform: translateY(-50%);
  opacity: 0;
  animation: intro-fade 1.4s 0.9s var(--ease-out) forwards;
}

.intro__meta div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.intro__meta b {
  color: rgba(255, 237, 243, 0.72);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.intro__meta span {
  color: rgba(236, 220, 229, 0.28);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.2em;
}

.intro__foot {
  position: absolute;
  right: clamp(24px, 4.5vw, 72px);
  bottom: max(20px, env(safe-area-inset-bottom));
  left: clamp(24px, 4.5vw, 72px);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: rgba(236, 222, 229, 0.23);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.2em;
  opacity: 0;
  animation: intro-fade 1.4s 1s var(--ease-out) forwards;
}

@keyframes intro-rise {
  to { opacity: 1; transform: none; }
}

@keyframes intro-fade {
  to { opacity: 1; }
}

/* ------------------------------------------------------------------------- */
/* Dialog                                                                    */
/* ------------------------------------------------------------------------- */

.info-dialog {
  width: min(690px, calc(100vw - 28px));
  max-height: 88svh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 232, 241, 0.16);
  border-radius: 26px;
  background:
    radial-gradient(120% 70% at 8% 0%, rgba(255, 139, 181, 0.1), transparent 50%),
    linear-gradient(150deg, #12131f 0%, #070910 72%);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.68);
  color: var(--ink);
}

.info-dialog::backdrop {
  background: rgba(2, 4, 9, 0.72);
  backdrop-filter: blur(14px);
}

.info-dialog__inner {
  position: relative;
  max-height: 88svh;
  padding: clamp(26px, 4.4vw, 46px);
  overflow: auto;
  overscroll-behavior: contain;
}

.info-dialog__inner::-webkit-scrollbar {
  width: 6px;
}

.info-dialog__inner::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(255, 213, 228, 0.18);
}

.dialog-close {
  position: absolute;
  top: 17px;
  right: 17px;
  display: grid;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: rgba(244, 232, 238, 0.55);
  transition: color 0.2s, background 0.2s;
  place-items: center;
}

.dialog-close svg {
  width: 16px;
  height: 16px;
}

.dialog-close:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.info-dialog h2 {
  max-width: 11em;
  margin: 17px 0 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.info-dialog__lede {
  max-width: 44em;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.9;
}

.formula-card {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid rgba(255, 239, 245, 0.1);
  border-radius: 15px;
  background: rgba(4, 6, 12, 0.54);
}

.formula-card__label {
  color: rgba(255, 194, 215, 0.42);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.22em;
}

.formula-card code {
  overflow-wrap: anywhere;
  color: rgba(255, 225, 235, 0.78);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.7;
}

.formula-card code sub {
  font-size: 0.7em;
}

.formula-card p {
  margin: 3px 0 0;
  color: rgba(234, 220, 227, 0.43);
  font-size: 10px;
  line-height: 1.75;
}

.formula-card em {
  color: rgba(255, 208, 224, 0.7);
  font-style: normal;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 24px;
  border: 1px solid rgba(255, 239, 245, 0.09);
  border-radius: 15px;
  background: rgba(255, 239, 245, 0.09);
  overflow: hidden;
}

.info-grid > div {
  padding: 16px;
  background: rgba(7, 9, 16, 0.94);
}

.info-grid__num {
  display: block;
  color: rgba(255, 187, 213, 0.55);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.info-grid b {
  display: block;
  margin-top: 9px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
}

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

.info-dialog__foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 26px;
  padding-top: 21px;
  border-top: 1px solid rgba(255, 238, 245, 0.08);
}

.info-dialog__foot h3 {
  margin: 0 0 5px;
  color: rgba(255, 220, 232, 0.72);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.info-dialog__foot p {
  margin: 0;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.8;
}

kbd {
  display: inline-block;
  min-width: 17px;
  margin: 0 2px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 238, 245, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 227, 236, 0.7);
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.5;
  text-align: center;
}

/* ------------------------------------------------------------------------- */
/* Toast / fatal                                                             */
/* ------------------------------------------------------------------------- */

.toast {
  position: fixed;
  top: 82px;
  left: 50%;
  z-index: 70;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid rgba(255, 238, 245, 0.14);
  border-radius: 999px;
  background: rgba(8, 11, 19, 0.82);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  color: rgba(250, 234, 240, 0.82);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.28s, transform 0.28s;
  backdrop-filter: blur(18px);
  pointer-events: none;
}

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

.fatal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 24px;
  background: rgba(2, 4, 9, 0.9);
  backdrop-filter: blur(18px);
  place-items: center;
}

.fatal__card {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(150deg, #11131f, #070910);
  text-align: left;
}

.fatal__card h2 {
  margin: 15px 0 10px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
}

.fatal__card p:not(.eyebrow) {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  padding: 32px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  place-items: center;
}

/* ------------------------------------------------------------------------- */
/* Interface visibility / interaction                                        */
/* ------------------------------------------------------------------------- */

.app[data-state="intro"] .telemetry,
.app[data-state="intro"] .gesture-guide,
.app[data-state="intro"] .camera-card {
  opacity: 0;
  pointer-events: none;
}

.app.ui-hidden .topbar,
.app.ui-hidden .interface {
  visibility: hidden;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.35s ease;
}

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

@media (max-width: 1180px) {
  .gesture-guide {
    display: none;
  }
}

/* Mobile camera inference and the particle shader share one GPU. Remove the
   full-screen blurred video and the most expensive backdrop blurs to keep the
   hand signal responsive. */
@media (max-width: 720px), (pointer: coarse) {
  .camera-bg {
    opacity: 0 !important;
    filter: none;
  }

  .atmosphere {
    filter: none;
    opacity: 0.7;
  }

  .telemetry,
  .camera-card {
    backdrop-filter: blur(10px) saturate(1.12);
  }
}

@media (max-width: 900px) {
  .topbar {
    padding:
      max(16px, env(safe-area-inset-top))
      18px
      0;
  }

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

  .brand-cn {
    font-size: 15px;
  }

  .intro__copy {
    width: min(590px, calc(100vw - 44px));
    margin-left: 24px;
  }

  .intro__title {
    font-size: clamp(3.2rem, 9.4vw, 6rem);
  }

  .intro__meta {
    display: none;
  }

  .telemetry {
    width: 292px;
  }

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

@media (max-width: 720px) {
  .frame-line {
    inset: 10px;
  }

  .brand-en {
    display: none;
  }

  .brand {
    gap: 9px;
  }

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

  .brand-cn {
    font-size: 14px;
    letter-spacing: 0.12em;
  }

  .topbar-right {
    gap: 7px;
  }

  .top-actions {
    gap: 6px;
  }

  .sound-btn {
    min-height: 30px;
    padding: 5px 10px 5px 9px;
  }

  .sound-btn__title {
    font-size: 7.5px;
  }

  .live-status {
    min-height: 30px;
    padding: 7px 9px;
    font-size: 7px;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
  }

  .mode-btn {
    min-height: 30px;
    padding: 7px 9px;
    font-size: 7px;
  }

  .intro__veil {
    background:
      linear-gradient(180deg, rgba(3, 5, 11, 0.76) 0%, rgba(3, 5, 11, 0.62) 34%, rgba(3, 5, 11, 0.82) 100%),
      linear-gradient(90deg, rgba(3, 5, 11, 0.7), rgba(3, 5, 11, 0.18));
  }

  .intro {
    align-items: end;
  }

  .intro__copy {
    width: calc(100vw - 38px);
    margin: 0 auto;
    padding-top: 11vh;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .intro__eyebrow {
    font-size: 7.5px;
    letter-spacing: 0.18em;
  }

  .intro__eyebrow .eyebrow-line {
    width: 22px;
  }

  .intro__title {
    margin-top: 17px;
    font-size: clamp(3.15rem, 15vw, 5.2rem);
    line-height: 0.94;
  }

  .intro__lede {
    max-width: 23em;
    margin-top: 18px;
    font-size: 11.5px;
    line-height: 1.9;
  }

  .intro__actions {
    gap: 9px;
    margin-top: 24px;
  }

  .primary-btn {
    min-height: 45px;
    padding-left: 18px;
    font-size: 10.5px;
  }

  .primary-btn__icon {
    width: 28px;
    height: 28px;
  }

  .secondary-btn {
    min-height: 43px;
    padding: 7px 14px;
    font-size: 9.5px;
  }

  .intro__hint {
    margin-top: 16px;
    font-size: 8.5px;
  }

  .intro__foot {
    display: none;
  }

  .telemetry {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 14px;
    width: auto;
    padding: 13px 14px 11px;
    border-radius: 18px;
  }

  .telemetry__main {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 13px;
    margin-top: 9px;
  }

  .gauge {
    width: 74px;
    height: 74px;
  }

  .gauge__core {
    width: 52px;
    height: 52px;
  }

  .gauge__value {
    min-width: 28px;
    font-size: 22px;
  }

  .gauge__unit {
    font-size: 7px;
  }

  .readout__state {
    font-size: 20px;
  }

  .readout__desc {
    display: none;
  }

  .threshold {
    margin-top: 10px;
  }

  .formula {
    display: none;
  }

  .camera-card {
    top: calc(66px + env(safe-area-inset-top));
    right: 14px;
    bottom: auto;
    width: 146px;
    padding: 7px;
    border-radius: 14px;
  }

  .camera-card__head {
    padding-bottom: 6px;
    font-size: 6px;
  }

  .camera-card__foot {
    padding-top: 6px;
    font-size: 5.8px;
  }

  .camera-card__foot span:last-child {
    display: none;
  }

  .corner {
    width: 9px;
    height: 9px;
  }

  .corner--tl { top: 5px; left: 5px; }
  .corner--tr { top: 5px; right: 5px; }
  .corner--bl { bottom: 5px; left: 5px; }
  .corner--br { right: 5px; bottom: 5px; }

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

  .info-dialog {
    width: calc(100vw - 20px);
    max-height: 90svh;
    border-radius: 20px;
  }

  .info-dialog__inner {
    max-height: 90svh;
    padding: 26px 20px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-dialog__foot {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .info-dialog h2 {
    font-size: 30px;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding-right: 14px;
    padding-left: 14px;
    gap: 12px;
  }

  .app[data-state="live"] .live-status {
    display: none;
  }

  .app[data-state="live"] .sound-btn {
    width: auto;
    min-width: 58px;
    padding: 0 9px;
    gap: 6px;
    justify-content: center;
  }

  .app[data-state="live"] .sound-btn__copy {
    display: none;
  }

  .app[data-state="live"] .sound-btn__mobile {
    display: inline;
  }
}

@media (max-width: 390px) {
  .live-status {
    padding: 6px 8px;
    letter-spacing: 0.1em;
  }

  .mode-btn {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .intro__title {
    font-size: clamp(2.85rem, 14.4vw, 4.5rem);
  }

  .intro__lede {
    font-size: 10.8px;
  }

  .secondary-btn {
    padding-right: 12px;
    padding-left: 12px;
  }

  .readout__en {
    letter-spacing: 0.13em;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .intro__copy {
    padding-top: 10vh;
    padding-bottom: 8vh;
  }

  .intro__title {
    margin-top: 10px;
    font-size: clamp(2.5rem, 7.4vw, 4.8rem);
  }

  .intro__lede {
    max-width: 30em;
    margin-top: 12px;
    font-size: 10px;
    line-height: 1.7;
  }

  .intro__actions {
    margin-top: 16px;
  }

  .intro__hint {
    margin-top: 12px;
  }

  .intro__meta {
    display: none;
  }

  .telemetry {
    right: auto;
    bottom: 12px;
    left: 12px;
    width: 260px;
  }

  .camera-card {
    top: auto;
    right: 12px;
    bottom: 12px;
    width: 164px;
  }

  .gesture-guide {
    display: none;
  }
}

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