/* Motion Arcade — shared styles for the big screen (index.html) and the phone controller (play.html). */
@font-face {
  font-family: 'Fredoka';
  src: url('../vendor/fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg0: #120c33;
  --bg1: #1d1450;
  --bg2: #3a1c71;
  --ink: #ffffff;
  --muted: #c9c2ff;
  --dim: #8e86c7;
  --yellow: #ffd166;
  --pink: #ff5fa2;
  --blue: #4cc9f0;
  --mint: #3ddc97;
  --orange: #ffb347;
  --violet: #7b5cff;
  --red: #ff4d6d;
  --card: rgba(255, 255, 255, 0.07);
  --card-b: rgba(255, 255, 255, 0.13);
  --r: 26px;
  --shadow: 0 18px 50px rgba(5, 2, 25, 0.45);
  --font: 'Fredoka', 'Nunito', 'Segoe UI Rounded', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: clamp(14px, 0.75vw + 8px, 26px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 8% -10%, rgba(255, 95, 162, 0.28), transparent 60%),
    radial-gradient(1000px 700px at 110% 110%, rgba(76, 201, 240, 0.25), transparent 60%),
    linear-gradient(160deg, var(--bg1), var(--bg0) 60%, #0c0826);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
body.in-game { overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Twinkling star field */
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.7;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 70%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 15%, #ffd166 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 75% 45%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 80%, #4cc9f0 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 42% 88%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 65% 60%, #ff5fa2 50%, transparent 51%),
    radial-gradient(1px 1px at 20% 50%, #fff 50%, transparent 51%);
  animation: twinkle 6s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.8; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  border: 0; border-radius: 999px; padding: 0.75em 1.5em; font-size: 1rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; position: relative;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.2); }
.btn:active { transform: scale(0.96); }
.btn.primary { background: linear-gradient(135deg, var(--yellow), var(--orange)); color: #3a1c00; box-shadow: 0 8px 24px rgba(255, 179, 71, 0.35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.go { background: linear-gradient(135deg, #5cf2a8, var(--mint)); color: #053b24; box-shadow: 0 8px 24px rgba(61, 220, 151, 0.35); }
.btn.pink { background: linear-gradient(135deg, #ff8cc0, var(--pink)); color: #4a0024; }
.btn.blue { background: linear-gradient(135deg, #8de3ff, var(--blue)); color: #002a3a; }
.btn.big { font-size: 1.35rem; padding: 0.8em 1.8em; }
.btn.small { font-size: 0.85rem; padding: 0.5em 1em; }
.btn.icon { width: 2.6em; height: 2.6em; padding: 0; font-size: 1rem; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.pill-group { display: inline-flex; background: rgba(255, 255, 255, 0.08); border-radius: 999px; padding: 4px; gap: 4px; }
.pill-group button { border: 0; background: transparent; padding: 0.5em 1.1em; border-radius: 999px; font-size: 0.95rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.pill-group button.on { background: #fff; color: var(--bg2); }

/* Motion navigation focus (tilt / hand hover / keyboard) */
.navfocus { outline: none; box-shadow: 0 0 0 4px #fff, 0 0 0 9px rgba(255, 209, 102, 0.7), 0 0 40px rgba(255, 209, 102, 0.6) !important; transform: scale(1.04); z-index: 2; }
.nav-hold { position: absolute; inset: -10px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(var(--yellow) calc(var(--p, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px)); }
.hand-cursor { position: fixed; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; pointer-events: none; z-index: 60;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 30%, rgba(255, 95, 162, 0.6) 31% 60%, transparent 61%);
  box-shadow: 0 0 30px rgba(255, 95, 162, 0.8); transition: opacity 0.2s; }
.hand-cursor.left { background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 30%, rgba(76, 201, 240, 0.6) 31% 60%, transparent 61%); box-shadow: 0 0 30px rgba(76, 201, 240, 0.8); }

/* ------------------------------------------------------------------ home (big screen) */
#app { position: relative; z-index: 1; min-height: 100%; }
.home { display: grid; grid-template-columns: minmax(0, 1fr) clamp(260px, 24vw, 420px); grid-template-rows: auto 1fr auto; gap: 1.2rem 1.6rem;
  min-height: 100vh; padding: 1.4rem 2rem 1.2rem; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; }
.logo { display: flex; align-items: center; gap: 0.7rem; font-weight: 700; font-size: 1.9rem; letter-spacing: 0.5px; }
.logo-mark { width: 2.2em; height: 2.2em; flex: none; }
.logo small { display: block; font-size: 0.42em; font-weight: 500; color: var(--muted); letter-spacing: 0.3px; }
.topbar .spacer { flex: 1; }
.topbar .tools { display: flex; gap: 0.6rem; align-items: center; }

.shelves { display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }
.shelf h2 { margin: 0 0 0.6rem; font-size: 1.15rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 0.5em; }
.shelf h2 .tag { font-size: 0.7em; padding: 0.15em 0.7em; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(200px, 17vw, 330px), 1fr)); gap: 1.1rem; }
.card {
  position: relative; border: 0; padding: 0; text-align: left; cursor: pointer; border-radius: var(--r); overflow: visible;
  background: var(--card); box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px) scale(1.02); }
.card .art { border-radius: var(--r) var(--r) 0 0; overflow: hidden; aspect-ratio: 16 / 10; display: block; background: var(--accent, #444); }
.card .art svg { width: 100%; height: 100%; display: block; }
.card .meta { padding: 0.7rem 1rem 0.9rem; border-radius: 0 0 var(--r) var(--r); background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04)); }
.card .title { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 0.5em; }
.card .blurb { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; line-height: 1.3; }
.card .best { font-size: 0.75rem; font-weight: 600; color: var(--yellow); white-space: nowrap; }
.card::after { content: ''; position: absolute; inset: 0; border-radius: var(--r); border: 2px solid var(--card-b); pointer-events: none; }

.side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.panel { background: var(--card); border: 2px solid var(--card-b); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 0.6rem; font-size: 1.05rem; font-weight: 600; }
.connect .qr { background: #fff; border-radius: 18px; padding: 10px; width: 62%; max-width: 230px; aspect-ratio: 1; margin: 0.2rem auto 0.6rem; display: grid; place-items: center; }
.connect .qr img, .connect .qr canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.connect .code { text-align: center; font-size: 2.6rem; font-weight: 700; letter-spacing: 0.25em; padding-left: 0.25em; color: var(--yellow); line-height: 1.1; }
.connect .url { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; word-break: break-all; }
.connect .status { font-size: 0.8rem; color: var(--dim); text-align: center; margin-top: 0.3rem; }
.devices { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.8rem; }
.device { display: flex; align-items: center; gap: 0.6em; background: rgba(255, 255, 255, 0.07); border-radius: 14px; padding: 0.5em 0.8em; font-size: 0.9rem; }
.device .ico { font-size: 1.3em; }
.device .grow { flex: 1; min-width: 0; }
.device .sub { font-size: 0.75rem; color: var(--muted); }
.device .ok { color: var(--mint); font-weight: 700; }
.device .warn { color: var(--yellow); font-weight: 700; }
.local-opts { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.8rem; }
.local-opts .btn { justify-content: flex-start; font-size: 0.85rem; padding: 0.6em 1em; }
.footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; color: var(--muted); font-size: 0.85rem; }
.footer .hint { display: flex; align-items: center; gap: 0.5em; }
.kbd { display: inline-block; padding: 0.05em 0.5em; border-radius: 6px; background: rgba(255, 255, 255, 0.12); font-weight: 600; color: #fff; }

@media (max-width: 860px), (orientation: portrait) and (max-width: 1100px) {
  .home { grid-template-columns: 1fr; padding: 1rem; }
  .side { order: -1; }
  .connect { display: grid; grid-template-columns: 110px 1fr; gap: 0 1rem; align-items: center; }
  .connect h3 { grid-column: 1 / -1; }
  .connect .qr { width: 110px; margin: 0; grid-row: span 3; }
  .connect .code, .connect .url, .connect .status { text-align: left; }
  .connect .devices, .connect .local-opts { grid-column: 1 / -1; }
  .logo { font-size: 1.5rem; }
}

/* ------------------------------------------------------------------ overlays (ready / pause / results / modal) */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 2vmin;
  background: rgba(10, 6, 30, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadein 0.25s; }
@keyframes fadein { from { opacity: 0; } }
.sheet { width: min(1100px, 96vw); max-height: 96vh; overflow: auto; background: linear-gradient(160deg, #2a1a66, #1a1145); border: 2px solid var(--card-b);
  border-radius: 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); padding: 1.6rem 2rem; animation: rise 0.35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rise { from { transform: translateY(30px) scale(0.96); opacity: 0; } }
.sheet.narrow { width: min(620px, 94vw); text-align: center; }
.sheet h1 { margin: 0; font-size: 2.4rem; }
.sheet .lead { color: var(--muted); margin: 0.3rem 0 1rem; font-size: 1.05rem; }
.actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }

.ready { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.6rem; align-items: center; }
.ready .art { border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); }
.ready .art svg { display: block; width: 100%; height: auto; }
.how { list-style: none; padding: 0; margin: 0.8rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.how li { display: flex; align-items: center; gap: 0.7em; font-size: 1.1rem; background: rgba(255, 255, 255, 0.07); border-radius: 14px; padding: 0.55em 0.9em; }
.how li b { display: inline-grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--accent, var(--violet)); color: #1a1145; flex: none; }
.input-status { display: flex; align-items: center; gap: 0.8rem; background: rgba(255, 255, 255, 0.07); border-radius: 18px; padding: 0.7rem 1rem; margin-top: 0.6rem; }
.input-status .msg { flex: 1; font-size: 0.95rem; }
.input-status .msg small { display: block; color: var(--muted); font-size: 0.8rem; }
.input-status .mini-qr { width: 88px; height: 88px; background: #fff; border-radius: 10px; padding: 5px; flex: none; }
.input-status .mini-qr img, .input-status .mini-qr canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.big-meter { width: 120px; height: 120px; flex: none; position: relative; }
.pose-preview { width: 150px; height: 112px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); flex: none; }
.lean-hint { font-size: 0.85rem; color: var(--muted); text-align: center; margin-top: 0.6rem; }
@media (max-width: 760px) { .ready { grid-template-columns: 1fr; } .sheet { padding: 1.2rem; } .sheet h1 { font-size: 1.8rem; } }

.results .stars { display: flex; justify-content: center; gap: 0.6rem; margin: 0.6rem 0; }
.results .stars span { font-size: 4rem; filter: grayscale(1) brightness(0.5); transform: scale(0.6); transition: all 0.4s cubic-bezier(.2, 1.8, .4, 1); }
.results .stars span.on { filter: none; transform: scale(1); text-shadow: 0 0 30px rgba(255, 209, 102, 0.8); }
.results .score { font-size: 4.2rem; font-weight: 700; line-height: 1; color: var(--yellow); }
.results .newbest { display: inline-block; margin-top: 0.4rem; background: var(--pink); color: #fff; font-weight: 700; padding: 0.25em 0.9em; border-radius: 999px; animation: wiggle 1s ease-in-out infinite; }
@keyframes wiggle { 50% { transform: rotate(-4deg) scale(1.06); } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.6rem; margin-top: 1rem; }
.stat { background: rgba(255, 255, 255, 0.07); border-radius: 16px; padding: 0.6rem; }
.stat .v { font-size: 1.5rem; font-weight: 700; }
.stat .l { font-size: 0.8rem; color: var(--muted); }

/* ------------------------------------------------------------------ in-game */
.game-root { position: fixed; inset: 0; z-index: 20; overflow: hidden; background: #000; }
.game-root canvas { display: block; }
.hud { position: absolute; top: 14px; left: 14px; right: 90px; display: flex; gap: 10px; flex-wrap: wrap; pointer-events: none; z-index: 5; }
.hud-chip { display: flex; align-items: center; gap: 0.4em; background: rgba(15, 10, 40, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.15); border-radius: 999px; padding: 0.3em 0.9em; font-size: clamp(18px, 1.6vw, 34px); font-weight: 700; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); }
.hud-chip .hud-label { font-size: 0.55em; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.hud-chip .hud-icon:empty { display: none; }
.hud-chip.pulse { animation: chippulse 0.35s; }
.hud-chip.warn { border-color: var(--red); background: rgba(255, 77, 109, 0.35); }
@keyframes chippulse { 40% { transform: scale(1.18); } }
.game-btns { position: absolute; top: 14px; right: 14px; z-index: 6; display: flex; gap: 8px; }
.game-btns .btn { background: rgba(15, 10, 40, 0.55); backdrop-filter: blur(4px); border: 2px solid rgba(255, 255, 255, 0.15); }
.game-warn { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 6; background: rgba(15, 10, 40, 0.75); border: 2px solid var(--yellow);
  border-radius: 999px; padding: 0.5em 1.2em; font-size: clamp(14px, 1.3vw, 26px); font-weight: 600; pointer-events: none; animation: fadein 0.3s; white-space: nowrap; }

.countdown { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; z-index: 8; }
.countdown-label { font-size: clamp(22px, 3vw, 54px); font-weight: 600; text-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
.countdown-num { font-size: clamp(110px, 18vw, 320px); font-weight: 700; line-height: 1; color: #fff; text-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 60px rgba(123, 92, 255, 0.9); }
.countdown-num.go { color: var(--yellow); text-shadow: 0 8px 0 rgba(0, 0, 0, 0.25), 0 0 80px rgba(255, 209, 102, 0.9); }
.countdown-num.pop { animation: cdpop 0.8s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes cdpop { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { transform: scale(0.8); opacity: 0; } }

.toast { position: absolute; transform: translate(-50%, -50%); font-weight: 700; pointer-events: none; z-index: 7; white-space: nowrap;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 20px rgba(0, 0, 0, 0.3); animation: toastup 1.1s ease-out forwards; }
.toast.center { left: 50%; top: 40%; }
@keyframes toastup { 0% { transform: translate(-50%, -30%) scale(0.5); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  30% { transform: translate(-50%, -55%) scale(1); } 100% { transform: translate(-50%, -140%) scale(1); opacity: 0; } }
.banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; z-index: 7; animation: bannerin 0.45s cubic-bezier(.2, 1.5, .4, 1); }
.banner.out { animation: bannerout 0.4s forwards; }
.banner-title { display: inline-block; font-size: clamp(36px, 6vw, 110px); font-weight: 700; padding: 0.1em 0.7em; border-radius: 30px;
  background: linear-gradient(135deg, rgba(123, 92, 255, 0.85), rgba(255, 95, 162, 0.85)); text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.banner-sub { font-size: clamp(18px, 2vw, 40px); margin-top: 0.4em; font-weight: 600; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
@keyframes bannerin { from { transform: scale(0.4); opacity: 0; } }
@keyframes bannerout { to { transform: scale(1.2); opacity: 0; } }

.tilt-meter { position: absolute; left: 16px; bottom: 16px; width: 92px; height: 92px; border-radius: 50%; z-index: 5; pointer-events: none;
  background: rgba(15, 10, 40, 0.5); border: 2px solid rgba(255, 255, 255, 0.2); backdrop-filter: blur(4px); }
.tilt-meter .tm-ring { position: absolute; inset: 22%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.25); }
.tilt-meter .tm-cross { position: absolute; inset: 0; background: linear-gradient(transparent 49%, rgba(255,255,255,.2) 49% 51%, transparent 51%), linear-gradient(90deg, transparent 49%, rgba(255,255,255,.2) 49% 51%, transparent 51%); border-radius: 50%; }
.tilt-meter .tm-dot { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--yellow) 45%, var(--orange)); box-shadow: 0 0 14px rgba(255, 209, 102, 0.9); }
.tilt-meter.off { opacity: 0.35; }
.big-meter.tilt-meter { position: relative; left: auto; bottom: auto; width: 120px; height: 120px; }

.calib-overlay { position: absolute; inset: 0; z-index: 9; display: grid; place-content: center; text-align: center; background: rgba(10, 6, 30, 0.55); pointer-events: none; }
.calib-overlay .t { font-size: clamp(26px, 3.5vw, 64px); font-weight: 700; }
.calib-overlay .n { font-size: clamp(80px, 12vw, 220px); font-weight: 700; color: var(--yellow); line-height: 1.1; }
.calib-overlay .s { font-size: clamp(16px, 1.6vw, 30px); color: var(--muted); }

.loading { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; text-align: center; gap: 1rem; color: var(--muted); font-size: 1.2rem; }
.spinner { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; border: 6px solid rgba(255, 255, 255, 0.15); border-top-color: var(--yellow); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; text-align: left; margin-top: 1rem; }
.help-grid .panel { box-shadow: none; }
.help-grid p, .help-grid li { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.help-grid ol { padding-left: 1.2em; margin: 0.3rem 0; }
.toast-msg { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: #fff; color: var(--bg2); font-weight: 600;
  padding: 0.6em 1.3em; border-radius: 999px; box-shadow: var(--shadow); animation: fadein 0.2s; max-width: 92vw; text-align: center; }

/* ------------------------------------------------------------------ phone controller */
.ctrl { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); gap: 14px; position: relative; z-index: 1; font-size: 17px; }
.ctrl-top { display: flex; align-items: center; gap: 10px; }
.ctrl-top .logo { font-size: 1.15rem; }
.ctrl-top .logo-mark { width: 1.9em; height: 1.9em; }
.conn { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.85rem; background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 0.35em 0.8em; margin-left: auto; }
.conn i { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.conn.ok i { background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.conn.wait i { background: var(--yellow); animation: blink 1s infinite; }
.conn.bad i { background: var(--red); }
@keyframes blink { 50% { opacity: 0.3; } }
.ctrl h1 { font-size: 1.7rem; margin: 0.2rem 0; }
.ctrl p { color: var(--muted); margin: 0.2rem 0; line-height: 1.4; }
.code-input { font-family: inherit; font-size: 2.6rem; font-weight: 700; letter-spacing: 0.35em; text-align: center; text-transform: uppercase; width: 100%;
  padding: 0.35em 0 0.35em 0.35em; border-radius: 20px; border: 3px solid rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.25); color: var(--yellow); outline: none; }
.code-input:focus { border-color: var(--yellow); }
.mode-list { display: flex; flex-direction: column; gap: 12px; }
.mode { display: flex; align-items: center; gap: 14px; text-align: left; border: 2px solid var(--card-b); border-radius: 22px; padding: 14px 16px; background: var(--card); cursor: pointer; font-size: 1rem; }
.mode .ico { font-size: 2.2rem; width: 1.4em; text-align: center; }
.mode b { display: block; font-size: 1.15rem; }
.mode span { color: var(--muted); font-size: 0.85rem; }
.mode.rec { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.25); }
.mode .badge { margin-left: auto; font-size: 0.7rem; background: var(--yellow); color: #3a1c00; border-radius: 999px; padding: 0.2em 0.6em; font-weight: 700; }
.level { position: relative; width: min(74vw, 300px); aspect-ratio: 1; margin: 6px auto; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(61, 220, 151, 0.18) 0 16%, transparent 16.5%), radial-gradient(circle, #2a1d66, #170f3d);
  border: 4px solid rgba(255, 255, 255, 0.18); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5); }
.level::before, .level::after { content: ''; position: absolute; background: rgba(255, 255, 255, 0.14); }
.level::before { left: 50%; top: 6%; bottom: 6%; width: 2px; margin-left: -1px; }
.level::after { top: 50%; left: 6%; right: 6%; height: 2px; margin-top: -1px; }
.level .ring2 { position: absolute; inset: 25%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.18); }
.level .bubble { position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; margin: -11% 0 0 -11%; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle at 35% 30%, #fff, var(--yellow) 40%, var(--orange)); box-shadow: 0 0 24px rgba(255, 209, 102, 0.8); will-change: transform; }
.level .tv { position: absolute; top: -2px; left: 50%; transform: translate(-50%, -100%); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.readout { display: flex; justify-content: center; gap: 18px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.95rem; }
.readout b { color: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.setting { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.95rem; }
.setting label { flex: 1; }
.setting input[type=range] { width: 46%; accent-color: var(--yellow); }
.setting .val { width: 3.2em; text-align: right; color: var(--yellow); font-weight: 600; }
.dir-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dir-pad button { border: 0; border-radius: 12px; padding: 10px 0; background: rgba(255, 255, 255, 0.1); font-size: 1.1rem; cursor: pointer; }
.dir-pad button.on { background: var(--yellow); color: #3a1c00; }
details.box { background: var(--card); border: 2px solid var(--card-b); border-radius: 20px; padding: 6px 16px 12px; }
details.box summary { cursor: pointer; font-weight: 600; padding: 8px 0; list-style: none; }
details.box summary::-webkit-details-marker { display: none; }
details.box summary::after { content: ' ▾'; color: var(--dim); }
.tip { background: rgba(76, 201, 240, 0.12); border: 2px solid rgba(76, 201, 240, 0.3); border-radius: 18px; padding: 10px 14px; font-size: 0.9rem; color: #d9f5ff; line-height: 1.4; }
.cam-wrap { position: relative; border-radius: 22px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.cam-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); opacity: 0.55; }
.cam-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cam-wrap .badge { position: absolute; left: 10px; top: 10px; background: rgba(0, 0, 0, 0.55); border-radius: 999px; padding: 0.25em 0.8em; font-size: 0.8rem; }
.touchpad { position: relative; flex: 1; min-height: 300px; border-radius: 28px; background: radial-gradient(circle, rgba(123, 92, 255, 0.25), rgba(0, 0, 0, 0.2)); border: 3px solid var(--card-b); touch-action: none; }
.touchpad .knob { position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--yellow) 45%, var(--orange)); box-shadow: 0 0 30px rgba(255, 209, 102, 0.7); pointer-events: none; }
.remote { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.remote button { border: 0; border-radius: 16px; padding: 10px; background: rgba(255, 255, 255, 0.09); text-align: left; cursor: pointer; font-size: 0.95rem; font-weight: 600; }
.remote button small { display: block; color: var(--muted); font-weight: 500; font-size: 0.75rem; }
.ctrl-count { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; text-align: center; background: rgba(10, 6, 30, 0.9); }
.ctrl-count .n { font-size: 8rem; font-weight: 700; color: var(--yellow); line-height: 1; }
.ctrl-count .t { font-size: 1.4rem; font-weight: 600; padding: 0 20px; }
.err { color: #ffb3c1; font-weight: 600; }
.dim-screen { position: fixed; inset: 0; z-index: 70; background: #000; display: grid; place-content: center; color: #333; font-size: 1rem; text-align: center; }
