:root {
  color-scheme: dark;
  --ink: #f0fdff;
  --muted: #93a7b5;
  --cyan: #62f4ff;
  --aqua: #8dffd7;
  --pink: #ff82c4;
  --gold: #ffd66b;
  --line: rgba(150, 228, 245, .2);
  --glass: rgba(5, 14, 28, .68);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #030711; }
body { color: var(--ink); isolation: isolate; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; }

#space { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.topbar, .stage, .control-rail { position: fixed; z-index: 2; }
.topbar { top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(16px + env(safe-area-inset-top)) 18px 16px; pointer-events: none; }
.brand-lockup, .telemetry { pointer-events: auto; }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(98, 244, 255, .68); border-radius: 50%; color: var(--aqua); font-family: Georgia, serif; font-size: 18px; box-shadow: 0 0 18px rgba(98, 244, 255, .17); }
.brand-lockup strong { display: block; font-size: 14px; font-weight: 650; letter-spacing: .04em; }
.brand-lockup span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; letter-spacing: .2em; }
.telemetry { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.signal-dot.active { background: var(--aqua); box-shadow: 0 0 12px var(--aqua); }

.stage { inset: 0; pointer-events: none; }
.title-stack { position: absolute; left: 18px; top: 105px; max-width: min(370px, calc(100vw - 36px)); }
.eyebrow { margin: 0 0 12px; color: var(--cyan); font-size: 9px; letter-spacing: .19em; }
h1 { margin: 0; max-width: 360px; color: rgba(240, 253, 255, .92); font-family: Georgia, "Songti SC", serif; font-size: 34px; font-weight: 400; line-height: 1.08; letter-spacing: .02em; text-shadow: 0 0 25px rgba(98, 244, 255, .24); }
.title-stack > p:last-child { margin: 11px 0 0; color: rgba(147, 167, 181, .86); font-size: 12px; line-height: 1.6; }

.camera-window, .camera-window[hidden] { position: fixed; left: -10000px; top: -10000px; width: 1px; height: 1px; overflow: hidden; visibility: hidden; opacity: 0; pointer-events: none; }
.camera-window video { width: 2px; height: 2px; object-fit: cover; transform: scaleX(-1); opacity: 0; }
.camera-label { display: none; }
.gesture-chip { position: absolute; left: 50%; bottom: 126px; display: flex; align-items: center; gap: 7px; transform: translateX(-50%); padding: 8px 12px; border: 1px solid rgba(141, 255, 215, .32); border-radius: 999px; background: rgba(5, 14, 28, .5); color: var(--aqua); font-size: 11px; white-space: nowrap; backdrop-filter: blur(8px); }
.gesture-chip span:first-child { color: var(--gold); }

.control-rail { left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 8px; width: calc(100% - 28px); max-width: 530px; transform: translateX(-50%); padding: 8px; border: 1px solid rgba(150, 228, 245, .15); border-radius: 10px; background: var(--glass); box-shadow: 0 16px 50px rgba(0, 0, 0, .34); backdrop-filter: blur(16px); }
.action-button, .icon-button, .close-button { border: 1px solid var(--line); background: rgba(12, 30, 47, .7); cursor: pointer; }
.action-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 12px; border-radius: 7px; font-size: 11px; white-space: nowrap; }
.action-button.primary { border-color: rgba(98, 244, 255, .55); color: var(--ink); background: rgba(28, 86, 102, .62); }
.action-button:active, .icon-button:active, .close-button:active { transform: translateY(1px); }
.button-icon { width: 15px; height: 15px; }
.icon-button, .close-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 7px; }
.icon-button svg, .close-button svg { width: 17px; height: 17px; }

dialog { width: min(460px, calc(100% - 30px)); max-height: min(76vh, 620px); padding: 20px; border: 1px solid rgba(98, 244, 255, .34); border-radius: 10px; background: rgba(5, 14, 28, .96); color: var(--ink); box-shadow: 0 24px 100px #000b; }
dialog::backdrop { background: rgba(0, 0, 0, .56); backdrop-filter: blur(6px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-head h2 { margin: 0; font-size: 24px; font-weight: 600; }
.close-button { width: 32px; height: 32px; background: transparent; }
.gesture-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.gesture-grid div { min-height: 74px; padding: 11px; border-left: 2px solid var(--cyan); background: rgba(22, 50, 70, .48); }
.gesture-grid b { display: block; font-size: 12px; color: var(--aqua); }
.gesture-grid span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.install-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); max-width: calc(100% - 30px); transform: translate(-50%, 12px); padding: 9px 13px; border: 1px solid rgba(255, 214, 107, .4); border-radius: 7px; background: rgba(9, 22, 38, .92); color: var(--gold); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 390px) {
  .action-button { padding: 0 9px; font-size: 10px; }
  .action-button.primary span:last-child { max-width: 74px; white-space: normal; line-height: 1.15; text-align: left; }
  h1 { font-size: 30px; }
  .gesture-grid { grid-template-columns: 1fr; }
}

@media (min-width: 700px) {
  .topbar { padding-left: 28px; padding-right: 28px; }
  .title-stack { left: 7vw; top: 20vh; }
  h1 { font-size: 48px; }
  .control-rail { bottom: 28px; }
}
