/* Time Warp Scan — "neon night lab".
   The camera screen and the picture always sit in a dark #0A0B1A frame; the
   landing page and the sheets follow the theme (light paper / deep ink).
   Titles and numbers in a crisp monospace, text in a geometric sans; cards
   16 px round, buttons 12 px, chips pills; the red bar is the one hot colour.
   Motion: transform/opacity only, springs for things that arrive, quick
   fades for things that leave; reduced motion turns travel into crossfades. */

:root {
  --red: #ff2d55;
  --cyan: #00e5ff;
  --violet: #b14dff;
  --night: #0a0b1a;
  --night-2: #14162b;
  --night-3: #1d2040;
  --night-text: #e8eaff;
  --night-muted: #8d90b8;
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #f1eef6;
  --text: #2a1745;
  --muted: #6b5a80;
  --line: rgba(42, 23, 69, 0.12);
  --red-text: #c8103a;
  --cyan-text: #006d7d;
  --ca-accent: #d8123f; /* the catalogue red, deepened for white text (5:1) — the SDK's buttons */
  --shadow: 0 18px 50px -24px rgba(42, 23, 69, 0.45), 0 2px 8px -4px rgba(42, 23, 69, 0.18);
  --card-edge: 0 0 0 1px rgba(42, 23, 69, 0.06);
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: "Avenir Next", Avenir, Montserrat, "Segoe UI", "Helvetica Neue", system-ui, -apple-system, Roboto, sans-serif;
  --spring: cubic-bezier(0.2, 1.35, 0.35, 1);
  --ease: cubic-bezier(0.22, 0.8, 0.26, 1);
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
  color-scheme: light;
}
html.dark {
  --bg: #0a0b1a;
  --surface: #14162b;
  --surface-2: #1b1e3a;
  --text: #e8eaff;
  --muted: #8d90b8;
  --line: rgba(177, 77, 255, 0.2);
  --red-text: #ff4d6d;
  --cyan-text: #00e5ff;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
  --card-edge: 0 0 0 1px rgba(177, 77, 255, 0.2);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not(.light) {
    --bg: #0a0b1a;
    --surface: #14162b;
    --surface-2: #1b1e3a;
    --text: #e8eaff;
    --muted: #8d90b8;
    --line: rgba(177, 77, 255, 0.2);
    --red-text: #ff4d6d;
    --cyan-text: #00e5ff;
    --card-edge: 0 0 0 1px rgba(177, 77, 255, 0.2);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* no double-tap zoom on iOS: js/touch-guard.js adds the same rule plus a JS
   fallback; this copy covers Safari before 16.4 under the strict CSP */
:where(html, body, body *) { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
html.in { background: var(--night); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
html.in body { background: var(--night); overflow: hidden; }
input, textarea, select, [contenteditable], .sh-text, .faq p, .sh-note { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2.5px solid var(--cyan); outline-offset: 2px; }
html.light :focus-visible { outline-color: #006d7d; }

/* ---- buttons ------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 0; cursor: pointer;
  font-weight: 650; letter-spacing: 0.01em; text-decoration: none;
  transition: transform 0.2s var(--spring), background-color 0.2s, box-shadow 0.2s;
}
.btn.primary, .btn.cta { background: var(--ca-accent); color: #fff; box-shadow: 0 10px 26px -12px rgba(255, 45, 85, 0.75); }
.btn.primary:hover, .btn.cta:hover { background: #e3164a; }
.btn.ghost { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: color-mix(in srgb, var(--surface-2) 80%, var(--violet)); }
.btn.danger { background: #b3122f; color: #fff; }
.btn.danger-text { color: var(--red-text); }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.btn .ico { width: 18px; height: 18px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-grid; place-items: center;
  background: transparent; color: inherit; cursor: pointer; position: relative;
  transition: transform 0.2s var(--spring), background-color 0.2s;
}
.icon-btn:hover { background: rgba(127, 127, 160, 0.14); }
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.dot::after { content: ""; position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--night); }
.pressed { transform: scale(0.94) !important; transition-duration: 0.08s !important; }
.springback { animation: springback 0.26s var(--spring); }
@keyframes springback { 0% { transform: scale(0.94); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
.select { min-height: 40px; padding: 0 30px 0 12px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); font: inherit; font-weight: 600; cursor: pointer; }
.select.small { min-height: 38px; font-size: 14px; padding-right: 26px; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; font: 700 11px/1.6 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; background: rgba(0, 229, 255, 0.16); color: var(--cyan); }
.tag.hot { background: rgba(255, 45, 85, 0.2); color: #ff6a86; }
.tag.streak { background: rgba(255, 170, 60, 0.18); color: #ffb35c; }
.tag .ico { width: 12px; height: 12px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.25; }
.dots i.on { opacity: 1; background: var(--red); }

/* ---- landing ------------------------------------------------------------------------------------- */
html.in .landing { display: none; }
html:not(.in) .app { display: none; }
.landing {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 28px;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 18px) calc(var(--sab) + 30px) calc(var(--sal) + 18px);
  background:
    radial-gradient(60% 40% at 15% 8%, rgba(177, 77, 255, 0.16), transparent 70%),
    radial-gradient(50% 35% at 90% 30%, rgba(0, 229, 255, 0.12), transparent 70%),
    radial-gradient(70% 40% at 50% 100%, rgba(255, 45, 85, 0.1), transparent 70%), var(--bg);
}
.lp-top { width: min(100%, 1080px); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lp-brand { display: inline-flex; align-items: center; gap: 8px; font: 600 13px/1 var(--mono); color: var(--muted); letter-spacing: 0.04em; }
.lp-brand img { border-radius: 8px; }
.lp-tools { display: inline-flex; align-items: center; gap: 6px; }
.lp-hero { width: min(100%, 1080px); display: grid; gap: 26px; justify-items: center; }
.lp-phone {
  width: min(64vw, 300px); aspect-ratio: 9 / 16; border-radius: 28px; overflow: hidden; background: var(--night);
  box-shadow: 0 0 0 7px #16182f, 0 0 0 8px rgba(177, 77, 255, 0.35), 0 40px 90px -30px rgba(255, 45, 85, 0.55), 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}
.lp-phone.small { width: min(56vw, 250px); }
.lp-phone canvas { width: 100%; height: 100%; display: block; }
#lp-demo { cursor: ns-resize; touch-action: none; }
.lp-copy { display: grid; gap: 14px; justify-items: center; text-align: center; max-width: 520px; }
.lp-copy h1 { margin: 6px 0 0; font: 800 clamp(34px, 9vw, 58px)/1 var(--mono); letter-spacing: -0.03em; }
.lp-copy h1::after { content: ""; display: block; height: 4px; margin: 12px auto 0; width: 64px; border-radius: 4px; background: var(--red); box-shadow: 0 0 18px var(--red); }
.lp-tag { margin: 0; font-size: clamp(17px, 4.6vw, 21px); color: var(--text); }
.lp-points { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.lp-points li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--card-edge), var(--shadow); font-weight: 650; font-size: 15px; }
.lp-points .ico { color: var(--red-text); width: 20px; height: 20px; }
.btn.cta { min-height: 58px; padding: 0 34px; font-size: 18px; border-radius: 14px; }
.lp-offline { margin: 0; color: var(--red-text); font-weight: 600; }
.lp-account { margin: 0; color: var(--muted); font-size: 14px; max-width: 40ch; }
.lp-demo { width: min(100%, 860px); display: grid; gap: 16px; justify-items: center; text-align: center; padding: 22px 16px; border-radius: 22px; background: var(--surface); box-shadow: var(--card-edge), var(--shadow); }
.lp-demo h2 { margin: 0; font: 800 22px/1.15 var(--mono); letter-spacing: -0.02em; }
.lp-demo p { margin: 6px 0 0; color: var(--muted); max-width: 36ch; }
.lp-privacy { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.lp-privacy .ico { color: var(--cyan-text); }
@media (min-width: 820px) {
  .lp-hero { grid-template-columns: auto 1fr; align-items: center; gap: 56px; padding-top: 12px; }
  .lp-copy { justify-items: start; text-align: left; }
  .lp-copy h1::after { margin-left: 0; }
  .lp-points { justify-content: flex-start; }
  .lp-demo { grid-template-columns: 1fr auto; text-align: left; justify-items: start; padding: 28px 36px; }
}

/* ---- the camera screen ---------------------------------------------------------------------------- */
.app {
  position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--night); color: var(--night-text);
  padding: var(--sat) var(--sar) 0 var(--sal);
}
.bar { height: 54px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 12px; position: relative; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; margin-right: auto; }
.brand img { border-radius: 9px; flex: none; }
.brand-txt { display: grid; min-width: 0; }
.brand-title { font: 800 15px/1.1 var(--mono); letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--night-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-tools { display: inline-flex; align-items: center; gap: 2px; }
.chip-slot { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 4px 0 9px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(232, 234, 255, 0.08); color: var(--night-muted); font: 700 13px/1 var(--mono);
}
.pill .ico { width: 16px; height: 16px; }
.pill.lit { color: #ffb35c; }
.pill-lv { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: linear-gradient(135deg, var(--violet), #5a1fb8); color: #fff; }
@media (max-width: 420px) { .brand-txt { display: none; } }
@media (max-width: 349px) { .pill { display: none; } .bar { padding-left: 8px; } }

.cam { flex: 1; min-height: 0; position: relative; display: grid; }
.view-wrap { position: absolute; inset: 0 0 var(--sab) 0; display: grid; place-items: center; }
.view {
  position: relative; width: var(--vw, 100%); height: var(--vh, 100%); border-radius: 18px; overflow: hidden; background: #05060f;
  box-shadow: 0 0 0 1px rgba(177, 77, 255, 0.22), 0 30px 80px -30px rgba(0, 0, 0, 0.9);
  contain: layout paint;
}
.view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fx { pointer-events: none; }
.grid { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
.view.grid-on .grid { opacity: 1; }
.grid i { position: absolute; background: rgba(255, 255, 255, 0.15); }
.grid i:nth-child(1) { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.grid i:nth-child(2) { left: 66.666%; top: 0; bottom: 0; width: 1px; }
.grid i:nth-child(3) { top: 33.333%; left: 0; right: 0; height: 1px; }
.grid i:nth-child(4) { top: 66.666%; left: 0; right: 0; height: 1px; }
html.scanning .grid { opacity: 0; }
.arrow { position: absolute; width: 34px; height: 34px; display: grid; place-items: center; color: var(--red); pointer-events: none; filter: drop-shadow(0 0 6px rgba(255, 45, 85, 0.8)); transition: opacity 0.3s; }
.arrow .ico { width: 26px; height: 26px; transform: rotate(var(--rot, 0deg)); transition: transform 0.18s var(--ease); }
.arrow[data-dir="down"] { top: 10px; left: calc(50% - 17px); }
.arrow[data-dir="up"] { bottom: 10px; left: calc(50% - 17px); }
.arrow[data-dir="right"] { left: 10px; top: calc(50% - 17px); }
.arrow[data-dir="left"] { right: 10px; top: calc(50% - 17px); }
.arrow[data-dir="ring"] { left: calc(50% - 17px); top: calc(50% - 17px); }
html.portrait .arrow[data-dir="down"] { top: 128px; }
html.busy .arrow { opacity: 0; }
.level { position: absolute; left: 50%; top: 50%; width: 46%; height: 0; pointer-events: none; transform: translate(-50%, -50%); }
.level-line { position: absolute; inset: -1px 0; height: 2px; background: rgba(255, 255, 255, 0.85); border-radius: 2px; transform: rotate(var(--tilt, 0deg)); transition: transform 0.12s linear, background-color 0.2s; }
.level span { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font: 700 12px/1 var(--mono); color: #fff; text-shadow: 0 1px 3px #000; }
.level.ok .level-line { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.level.ok span { color: var(--cyan); }
.count {
  position: absolute; left: 0; right: 0; top: 50%; text-align: center; transform: translateY(-62%); pointer-events: none;
  font: 800 120px/1 var(--mono); color: #fff; text-shadow: 0 0 30px rgba(255, 45, 85, 0.9), 0 0 2px #000; opacity: 0;
}
.count.go { animation: count 1s var(--spring) forwards; }
@keyframes count {
  0% { opacity: 0; transform: translateY(-62%) scale(1.4); }
  18% { opacity: 1; }
  45% { transform: translateY(-62%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-62%) scale(0.96); }
}
.scanny-slot { position: absolute; left: 50%; top: 50%; transform: translate(-50%, 70px) scale(0.6); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.35s var(--spring); }
.view.counting .scanny-slot, .view.processing .scanny-slot { opacity: 1; transform: translate(-50%, 70px) scale(1); }
.view.processing .scanny-slot { transform: translate(-50%, -50%) scale(1); }
.scanny { display: block; image-rendering: pixelated; overflow: visible; }
.scanny .sc-eyes { transform-origin: 8px 6.5px; transition: transform 0.08s; }
.scanny.blink .sc-eyes { transform: scaleY(0.12); }
.scanny[data-state="error"] .sc-body { transform: rotate(-12deg); transform-origin: 8px 12px; }
.scanny[data-state="wave"] .sc-extra { animation: wave 0.9s ease-in-out infinite; transform-origin: 14px 9px; }
.scanny[data-state="wow"] .sc-extra { animation: twinkle 0.7s steps(2) infinite; }
.scanny[data-state="idle"] { animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-1.5px); } }
@keyframes wave { 50% { transform: rotate(-18deg); } }
@keyframes twinkle { 50% { opacity: 0.35; } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.view.flash .flash { animation: flash 0.2s ease-out; }
@keyframes flash { from { opacity: 0.4; } to { opacity: 0; } }
.view.shake { animation: shake 0.12s linear; }
@keyframes shake { 25% { transform: translate(-4px, 2px); } 50% { transform: translate(4px, -2px); } 75% { transform: translate(-2px, -3px); } }
.demo-badge { position: absolute; left: 12px; bottom: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(177, 77, 255, 0.85); color: #fff; font: 700 12px/1.5 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
html.portrait .demo-badge { bottom: auto; top: 128px; left: 12px; }
.processing { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 11, 26, 0.35); }
.spinner { width: 92px; height: 92px; border-radius: 50%; border: 3px solid rgba(232, 234, 255, 0.15); border-top-color: var(--red); border-right-color: var(--violet); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.view-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 40%, rgba(177, 77, 255, 0.2), transparent 60%), rgba(10, 11, 26, 0.92); overflow: auto; }
.msg-card { width: min(100%, 360px); display: grid; justify-items: center; gap: 10px; text-align: center; padding: 22px 18px; border-radius: 16px; background: var(--night-2); box-shadow: 0 0 0 1px rgba(177, 77, 255, 0.25); }
.msg-card h2 { margin: 6px 0 0; font: 800 20px/1.2 var(--mono); }
.msg-card p { margin: 0; color: var(--night-muted); }
.msg-steps { margin: 2px 0 4px; padding-left: 22px; text-align: left; color: var(--night-text); font-size: 14.5px; display: grid; gap: 4px; }
.msg-actions { display: grid; gap: 8px; width: 100%; margin-top: 6px; }
.msg-card .btn.ghost { background: rgba(232, 234, 255, 0.08); color: var(--night-text); box-shadow: inset 0 0 0 1px rgba(177, 77, 255, 0.3); }

/* controls over the picture */
.top-ctl { position: absolute; z-index: 3; left: 0; right: 0; top: 0; display: grid; justify-items: center; gap: 8px; padding: 8px 12px 26px; pointer-events: none; background: linear-gradient(rgba(10, 11, 26, 0.65), rgba(10, 11, 26, 0)); }
.top-ctl > * { pointer-events: auto; }
.mode { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px; background: rgba(20, 22, 43, 0.82); box-shadow: inset 0 0 0 1px rgba(177, 77, 255, 0.28); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.mode button { position: relative; z-index: 1; min-height: 38px; min-width: 112px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--night-muted); font: 700 14px/1 var(--sans); cursor: pointer; transition: color 0.2s; }
.mode button[aria-checked="true"] { color: #fff; }
.mode-knob { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: linear-gradient(135deg, var(--ca-accent), #a3127f); box-shadow: 0 6px 18px -6px rgba(255, 45, 85, 0.8); transition: transform 0.42s var(--spring); }
.mode[data-on="studio"] .mode-knob { transform: translateX(100%); background: linear-gradient(135deg, #6a2fd0, #0b8aa3); box-shadow: 0 6px 18px -6px rgba(0, 229, 255, 0.6); }
.card-chip {
  display: flex; align-items: center; gap: 10px; width: min(100%, 420px); min-height: 52px; padding: 7px 8px 7px 10px; border: 0; border-radius: 16px; cursor: pointer; text-align: left;
  background: rgba(20, 22, 43, 0.82); color: var(--night-text); box-shadow: inset 0 0 0 1px rgba(177, 77, 255, 0.25); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.chip-ico { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(255, 45, 85, 0.25), rgba(177, 77, 255, 0.25)); color: #ff8aa2; }
.chip-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.chip-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.chip-name { flex: 0 1 auto; max-width: 100%; font-weight: 750; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip-goal { font-size: 12.5px; color: var(--night-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border-radius: 999px; background: rgba(232, 234, 255, 0.07); color: var(--night-muted); font: 700 12px/1 var(--mono); }
.combo .ico { width: 14px; height: 14px; }
.combo.hot { color: #ffb35c; background: rgba(255, 170, 60, 0.16); animation: hot 1.4s ease-in-out infinite; }
@keyframes hot { 50% { box-shadow: 0 0 14px rgba(255, 170, 60, 0.45); } }
.code-chip { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 999px; background: rgba(0, 229, 255, 0.16); color: var(--cyan); font-weight: 650; box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.35); }
.code-chip b { font-family: var(--mono); letter-spacing: 0.12em; color: #fff; }
.code-chip .ico { width: 16px; height: 16px; }
.filter-chips { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 2px 4px; scroll-snap-type: x proximity; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer; background: rgba(20, 22, 43, 0.82); color: var(--night-muted); font-weight: 650; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(177, 77, 255, 0.25); scroll-snap-align: center; transition: color 0.2s, background-color 0.2s, transform 0.2s var(--spring); }
.chip.on { color: #fff; background: linear-gradient(135deg, #6a2fd0, #0b8aa3); box-shadow: 0 6px 16px -8px rgba(0, 229, 255, 0.7); }

.rail { position: absolute; z-index: 3; right: 10px; top: 50%; transform: translateY(-50%); display: grid; gap: 10px; transition: opacity 0.3s; }
.rail-btn {
  position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: rgba(20, 22, 43, 0.72); color: var(--night-text); box-shadow: inset 0 0 0 1px rgba(177, 77, 255, 0.28); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s var(--spring), background-color 0.2s, color 0.2s;
}
.rail-btn:hover { background: rgba(40, 44, 84, 0.85); }
.rail-btn .turn { transform: rotate(var(--rot, 0deg)); transition: transform 0.18s var(--ease); }
.ico-slot { display: grid; place-items: center; }
.rail-btn.on { color: #ffe066; box-shadow: inset 0 0 0 1px rgba(255, 224, 102, 0.6), 0 0 16px rgba(255, 224, 102, 0.35); }
.lock-dot { position: absolute; right: -1px; top: -1px; width: 16px; height: 16px; border-radius: 50%; background: var(--night-2); box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.5); display: none; }
.lock-dot::after { content: ""; position: absolute; inset: 4px 5px 4px; border-radius: 2px; background: var(--cyan); }
.rail-btn.locked .lock-dot { display: block; }
.rail-btn.locked { color: var(--night-muted); }
#b-filter[data-filter="neon"] { color: #ff6ad5; }
#b-filter[data-filter="thermal"] { color: #ffb35c; }
#b-filter[data-filter="film"] { color: #ffd9a8; }
#b-filter[data-filter="hologram"] { color: var(--cyan); }
html.scanning .rail, html.busy .top-ctl, html.busy .rail { opacity: 0.4; }
html.busy .thumb, html.busy .speed { opacity: 0.4; }

.dock {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px;
  padding: 26px 16px calc(var(--sab) + 18px); background: linear-gradient(rgba(10, 11, 26, 0), rgba(10, 11, 26, 0.7) 45%);
}
.thumb {
  justify-self: end; position: relative; width: 44px; height: 44px; border-radius: 12px; border: 0; padding: 0; overflow: hidden; cursor: pointer;
  background: rgba(20, 22, 43, 0.72); color: var(--night-muted); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(177, 77, 255, 0.3);
  transition: transform 0.2s var(--spring);
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.thumb.has img { display: block; }
.thumb.has .ico { display: none; }
.start { position: relative; width: 72px; height: 72px; border-radius: 50%; border: 0; padding: 0; background: transparent; cursor: pointer; display: grid; place-items: center; transition: transform 0.2s var(--spring); }
.start:disabled { cursor: default; opacity: 0.55; }
.start .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(232, 234, 255, 0.85); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--red); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: calc(100 - var(--p, 0) * 100); opacity: 0; }
.start[data-state="stop"] .ring-bg { stroke: rgba(232, 234, 255, 0.25); }
.start[data-state="stop"] .ring-fg { opacity: 1; }
.core { width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff7d97, var(--red) 55%, #c40f3c); box-shadow: 0 0 22px rgba(255, 45, 85, 0.65); transition: transform 0.3s var(--spring), border-radius 0.3s var(--ease); }
.start:hover .core { box-shadow: 0 0 34px rgba(255, 45, 85, 0.9); }
.start[data-state="stop"] .core { transform: scale(0.46); border-radius: 9px; }
.start[data-state="cancel"] .core { transform: scale(0.82); background: rgba(232, 234, 255, 0.12); box-shadow: none; }
.start .x { position: absolute; width: 24px; height: 24px; opacity: 0; transition: opacity 0.2s; }
.start .x::before, .start .x::after { content: ""; position: absolute; left: 11px; top: 0; width: 2.5px; height: 24px; border-radius: 2px; background: #fff; transform: rotate(45deg); }
.start .x::after { transform: rotate(-45deg); }
.start[data-state="cancel"] .x { opacity: 1; }
.speed {
  justify-self: start; position: relative; width: 52px; height: 120px; border-radius: 16px; display: grid; grid-template-rows: 1fr auto 1fr; place-items: center; cursor: ns-resize;
  background: rgba(20, 22, 43, 0.6); box-shadow: inset 0 0 0 1px rgba(177, 77, 255, 0.25); touch-action: none; overflow: hidden;
}
.speed.locked { cursor: default; color: var(--night-muted); }
.speed-val { font: 800 18px/1 var(--mono); color: #fff; }
.speed-val.roll-up { animation: roll-up 0.28s var(--spring); }
.speed-val.roll-down { animation: roll-down 0.28s var(--spring); }
@keyframes roll-up { from { transform: translateY(14px) scale(1.25); opacity: 0.2; } }
@keyframes roll-down { from { transform: translateY(-14px) scale(1.25); opacity: 0.2; } }
.speed-up, .speed-down { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; opacity: 0.5; }
.speed-up { border-bottom: 7px solid var(--night-muted); }
.speed-down { border-top: 7px solid var(--night-muted); }

.tips { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(10, 11, 26, 0.55); cursor: pointer; padding: 20px; }
.tips-card { width: min(100% - 112px, 290px); display: grid; gap: 8px; justify-items: center; text-align: center; padding: 18px; border-radius: 16px; background: var(--night-2); box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.35), 0 20px 50px -20px #000; }
.tips.pop .tips-card { animation: rise 0.42s var(--spring); }
.tips-card p { margin: 0; font-size: 18px; font-weight: 700; }
.tips-n { font: 700 12px/1 var(--mono); color: var(--cyan); letter-spacing: 0.1em; }
.tips .btn.ghost { background: rgba(232, 234, 255, 0.08); color: var(--night-text); box-shadow: none; }
.tips[data-step="1"] { place-items: end center; padding-bottom: 150px; }

/* landscape and wide screens: picture in the middle, choices on the left, the rail and the button on the right */
html.landscape .cam { grid-template-columns: minmax(200px, 300px) minmax(0, 1fr) 64px 104px; gap: 0 10px; padding: 0 calc(10px) var(--sab) 14px; }
html.landscape .top-ctl { position: static; grid-column: 1; align-content: center; justify-items: stretch; padding: 0; background: none; }
html.landscape .mode { justify-self: center; }
html.landscape .mode button { min-width: 0; }
html.landscape .card-chip { width: 100%; }
html.landscape .filter-chips { flex-wrap: wrap; justify-content: center; overflow: visible; }
html.landscape .view-wrap { position: relative; inset: auto; grid-column: 2; padding: 6px 0 10px; }
html.landscape .rail { position: static; grid-column: 3; transform: none; align-self: center; justify-items: center; }
html.landscape .dock { position: static; grid-column: 4; grid-template-columns: none; grid-template-rows: auto auto auto; justify-items: center; align-content: center; gap: 14px; padding: 0; background: none; }
html.landscape .thumb { justify-self: center; order: 3; }
html.landscape .start { order: 2; }
html.landscape .speed { justify-self: center; order: 1; height: 104px; }
html.landscape .arrow[data-dir="down"] { top: 10px; }
html.landscape .demo-badge { top: auto; bottom: 12px; }
@media (max-height: 420px) {
  html.landscape .bar { height: 46px; }
  html.landscape .rail { gap: 6px; }
  html.landscape .rail-btn { width: 44px; height: 44px; }
  html.landscape .speed { height: 84px; }
  html.landscape .thumb { display: none; }
  html.landscape .card-chip .chip-goal { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* ---- the result ----------------------------------------------------------------------------------- */
.result {
  position: fixed; inset: 0; z-index: 20; display: grid; grid-template-rows: minmax(0, 62fr) minmax(0, 38fr); background: var(--night);
  padding-top: var(--sat); opacity: 0; transform: translateY(var(--drag, 0px));
  transition: opacity 0.2s ease, transform 0.3s var(--ease);
}
.result.in { opacity: 1; }
.result.dragging { transition: none; }
.result.out { opacity: 0; transform: translateY(100%); transition: opacity 0.3s ease, transform 0.3s var(--ease); }
.res-pic { position: relative; display: grid; place-items: center; padding: 10px 12px 6px; min-height: 0; overflow: hidden; touch-action: none; }
#res-gl { width: var(--w, 100%); height: var(--h, 100%); border-radius: 14px; box-shadow: 0 0 0 1px rgba(177, 77, 255, 0.3), 0 30px 70px -30px rgba(255, 45, 85, 0.5); }
.res-pic.fade #res-gl { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.res-back { position: absolute; left: 12px; top: 10px; background: rgba(20, 22, 43, 0.7); color: var(--night-text); }
.code-pill { position: absolute; right: 12px; top: 14px; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 0; cursor: pointer; background: rgba(20, 22, 43, 0.75); color: var(--night-muted); font-size: 12px; font-weight: 650; box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.3); }
.code-pill b { font: 800 15px/1 var(--mono); letter-spacing: 0.14em; color: var(--cyan); }
.res-pic .tag { position: absolute; left: 64px; top: 20px; }
.levelup { position: absolute; left: 50%; bottom: 16px; width: min(86%, 340px); display: grid; gap: 2px; justify-items: center; padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(0, 229, 255, 0.95), rgba(177, 77, 255, 0.95)); color: #0a0b1a; text-align: center; transform: translate(-50%, 140%); opacity: 0; transition: transform 0.45s var(--spring), opacity 0.25s; box-shadow: 0 20px 50px -20px rgba(0, 229, 255, 0.8); }
.levelup.in { transform: translate(-50%, 0); opacity: 1; }
.levelup b { font: 800 22px/1.1 var(--mono); }
.levelup span { font-weight: 650; font-size: 14px; }
.res-panel { position: relative; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--surface); color: var(--text); border-radius: 22px 22px 0 0; box-shadow: 0 -20px 50px -30px rgba(0, 0, 0, 0.6); }
.grab { position: absolute; left: 50%; top: 7px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line); }
.res-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 12px; display: grid; gap: 12px; align-content: start; }
.res-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.res-score-wrap { display: grid; justify-items: center; gap: 2px; }
.res-stars { display: flex; gap: 6px; }
.star { display: grid; place-items: center; color: var(--line); }
.star .ico { width: 34px; height: 34px; fill: currentColor; stroke: none; }
.star.on { color: #ffc93c; filter: drop-shadow(0 0 8px rgba(255, 201, 60, 0.55)); }
.res-stars.fresh .star.on { transform: scale(0); }
.res-stars.fresh .star.on.pop { animation: pop 0.42s var(--spring) forwards; }
.res-stars.fresh .star.on.pop-calm { transform: none; animation: fade 0.2s ease; }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.res-score { display: flex; align-items: baseline; gap: 6px; }
.res-score b { font: 800 34px/1 var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.res-score small { color: var(--muted); font-weight: 650; }
.res-card { font-size: 12.5px; color: var(--muted); text-align: right; max-width: 9em; }
.result[data-kind="studio"] .res-head { grid-template-columns: auto 1fr; }
.result[data-kind="studio"] .res-card { max-width: none; text-align: left; font-size: 14px; font-weight: 650; }
.result[data-kind="studio"] .res-score-wrap, .result[data-kind="studio"] .res-break, .result[data-kind="studio"] .res-xp, .result[data-kind="studio"] .res-badges { display: none; }
.res-break { margin: 0; display: grid; gap: 7px; }
.res-break > div { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: baseline; }
.res-break dt { font-size: 13.5px; font-weight: 650; }
.res-break dd { margin: 0; font: 700 13px/1 var(--mono); color: var(--muted); }
.mbar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; position: relative; }
.mbar::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--f, 0)); border-radius: 3px; transition: transform 0.8s var(--ease) 0.4s; }
#res-T-bar::after { background: linear-gradient(90deg, var(--red), #ff7d97); }
#res-M-bar::after { background: linear-gradient(90deg, #0ab3cc, var(--cyan)); }
#res-E-bar::after { background: linear-gradient(90deg, #7a2fe0, var(--violet)); }
.res-badges { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: rgba(0, 200, 140, 0.15); color: #0a8a5f; }
html.dark .badge.ok { color: #39e0a4; }
.badge.hot { background: rgba(255, 45, 85, 0.13); color: var(--red-text); }
.res-line { margin: 0; font: 750 18px/1.3 var(--sans); text-align: center; }
.res-xp { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px; }
.res-level { font: 800 13px/1 var(--mono); }
.res-xp-text { font: 600 12px/1 var(--mono); color: var(--muted); }
.res-xp-gain { grid-column: 1 / -1; justify-self: end; font: 700 12px/1 var(--mono); color: var(--cyan-text); }
.xp { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: block; }
.xp > i, .xp .xp-fill { position: absolute; inset: 0; border-radius: 4px; background: linear-gradient(90deg, var(--violet), var(--cyan)); transform-origin: left; transform: scaleX(var(--f, 0)); }
.xp .xp-fill { transform: scaleX(var(--f, 0)); }
#res-xp-bar { --f: 0; }
#res-xp-bar .xp-fill { transform: scaleX(var(--f)); }
#res-xp-bar.grow .xp-fill { transition: transform 0.5s var(--ease); }
#res-xp-bar.flash { box-shadow: 0 0 0 2px var(--cyan), 0 0 18px var(--cyan); }
.res-actions { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; padding: 10px 16px calc(var(--sab) + 12px); border-top: 1px solid var(--line); background: var(--surface); }
.res-actions .btn { padding: 0 10px; min-width: 0; }
.res-actions .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-friends h3 { margin: 6px 0 8px; font: 800 15px/1.2 var(--mono); }
.board-host { min-height: 120px; margin-top: 8px; }
html.landscape .result { grid-template-rows: none; grid-template-columns: minmax(0, 62fr) minmax(300px, 38fr); }
html.landscape .res-panel { border-radius: 22px 0 0 22px; }
html.landscape .grab { display: none; }

/* ---- first run, toasts ---------------------------------------------------------------------------- */
.privacy { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px 16px calc(var(--sab) + 16px); background: rgba(10, 11, 26, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.privacy-card { width: min(100%, 420px); display: grid; gap: 12px; justify-items: center; text-align: center; padding: 24px 20px 20px; border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); transform: translateY(30px); opacity: 0; transition: transform 0.45s var(--spring), opacity 0.25s; }
.privacy.in .privacy-card { transform: none; opacity: 1; }
.privacy-card h2 { margin: 0; font: 800 22px/1.2 var(--mono); }
.privacy-card p { margin: 0; color: var(--muted); font-size: 16px; }
.toasts { position: fixed; z-index: 40; left: 0; right: 0; bottom: calc(var(--sab) + 130px); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
html.landscape .toasts { bottom: calc(var(--sab) + 24px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: min(100%, 440px); padding: 11px 12px 11px 16px; border-radius: 14px; background: rgba(20, 22, 43, 0.95); color: var(--night-text); font-weight: 650; font-size: 15px; box-shadow: 0 0 0 1px rgba(177, 77, 255, 0.3), 0 16px 40px -16px #000; transform: translateY(16px); opacity: 0; transition: transform 0.35s var(--spring), opacity 0.2s; }
.toast.in { transform: none; opacity: 1; }
.toast.mini { padding: 8px 16px; font: 700 14px/1.2 var(--mono); }
.toast-act { border: 0; background: rgba(0, 229, 255, 0.16); color: var(--cyan); font-weight: 750; min-height: 36px; padding: 0 12px; border-radius: 10px; cursor: pointer; }

/* ---- sheets ------------------------------------------------------------------------------------------ */
dialog.sheet { border: 0; padding: 0; margin: 0; max-width: none; max-height: none; width: 100%; height: 100%; background: transparent; color: var(--text); display: grid; align-items: end; justify-items: center; overflow: hidden; }
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(10, 11, 26, 0); transition: background-color 0.25s; }
dialog.sheet.in::backdrop { background: rgba(10, 11, 26, 0.5); }
.sh-card {
  width: 100%; max-height: min(90dvh, 900px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface);
  border-radius: 22px 22px 0 0; box-shadow: var(--card-edge), var(--shadow); transform: translateY(100%); transition: transform 0.42s var(--spring);
  padding-bottom: var(--sab);
}
dialog.sheet.in .sh-card { transform: none; }
.sh-head { display: flex; align-items: center; gap: 6px; padding: 12px 8px 4px 18px; }
.sh-head h2 { flex: 1; margin: 0; font: 800 19px/1.25 var(--mono); letter-spacing: -0.01em; }
.sh-head .sh-back { margin-left: -10px; }
.sh-x { margin-left: auto; color: var(--muted); }
.sh-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 18px 16px; display: grid; gap: 10px; align-content: start; }
.sh-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.sh-foot .btn { flex: 1 1 auto; }
.sh-sub { margin: 10px 0 0; font: 800 12px/1.2 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sh-text { margin: 0; font-size: 16px; }
.sh-note { margin: 0; font-size: 13.5px; color: var(--muted); }
.sh-info { display: flex; gap: 10px; margin: 4px 0 0; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.sh-info .ico { color: var(--cyan-text); width: 18px; height: 18px; margin-top: 1px; }
@media (min-width: 720px) {
  dialog.sheet { align-items: center; padding: 24px; }
  .sh-card { width: min(100%, 520px); border-radius: 22px; transform: translateY(24px) scale(0.98); opacity: 0; transition: transform 0.38s var(--spring), opacity 0.2s; padding-bottom: 0; }
  dialog.sheet.wide .sh-card { width: min(100%, 880px); }
  dialog.sheet.small .sh-card { width: min(100%, 420px); }
  dialog.sheet.in .sh-card { opacity: 1; }
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row label { display: grid; flex: 1; cursor: pointer; }
.row.col { display: grid; justify-content: stretch; gap: 8px; padding: 10px 0; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; }
.row-label { font-weight: 650; }
.row-note { color: var(--muted); font-size: 13px; }
.row-val { font: 700 14px/1 var(--mono); color: var(--muted); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; margin: 0; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); position: relative; cursor: pointer; transition: background-color 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--spring); }
.switch:checked { background: var(--ca-accent); }
.switch:checked::after { transform: translateX(20px); }
.range { width: 100%; accent-color: var(--ca-accent); height: 32px; }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; transition: background-color 0.2s, color 0.2s; white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px -3px rgba(0, 0, 0, 0.35); }
.seg button:disabled { opacity: 0.4; cursor: default; }
.seg.small button { min-height: 34px; font-size: 13.5px; }
.btn-row { display: flex; gap: 8px; }
.btn-row.wrap { flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.tab { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px -3px rgba(0, 0, 0, 0.35); }
.empty { display: grid; justify-items: center; gap: 10px; padding: 28px 10px; text-align: center; color: var(--muted); }
.empty p { margin: 0; font-weight: 650; }

/* help */
.how-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.how { display: grid; gap: 4px; align-content: start; padding: 10px; border-radius: 16px; background: var(--surface-2); text-align: center; }
.how h4 { margin: 4px 0 0; font: 800 14px/1.2 var(--mono); }
.how p { margin: 0; font-size: 12.5px; color: var(--muted); }
.how-art { position: relative; height: 84px; border-radius: 12px; background: var(--night); overflow: hidden; }
.how-bar { position: absolute; left: 0; right: 0; height: 4px; top: 10%; background: var(--red); box-shadow: 0 0 12px var(--red); animation: how-scan 2.6s var(--ease) infinite; }
.how-fig { position: absolute; left: 44%; top: 30%; width: 20px; height: 40px; border-radius: 10px 10px 4px 4px; background: linear-gradient(var(--cyan), var(--violet)); animation: how-fig 0.8s ease-in-out infinite alternate; }
.how-btn { position: absolute; left: calc(50% - 12px); bottom: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8); animation: how-tap 1.6s ease-in-out infinite; }
.how-start .how-bar, .how-start .how-fig { display: none; }
.how-move .how-btn, .how-share .how-btn, .how-share .how-bar { display: none; }
.how-share .how-fig { left: 30%; width: 40%; height: 54%; top: 14%; border-radius: 6px; background: linear-gradient(135deg, var(--red), var(--violet) 60%, var(--cyan)); animation: how-share 1.8s var(--spring) infinite; }
@keyframes how-scan { from { transform: translateY(0); } to { transform: translateY(68px); } }
@keyframes how-fig { from { transform: translateX(-14px) skewX(-8deg); } to { transform: translateX(14px) skewX(8deg); } }
@keyframes how-tap { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(0.82); } }
@keyframes how-share { 0% { transform: translateY(8px) scale(0.9); opacity: 0.5; } 40%, 100% { transform: none; opacity: 1; } }
.score-chart { display: grid; gap: 12px; }
.sc-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; }
.sc-col { display: grid; gap: 6px; align-content: end; text-align: center; }
.sc-col h4 { margin: 0; font: 800 13.5px/1.2 var(--mono); }
.sc-col p { margin: 0; font-size: 12.5px; color: var(--muted); }
.sc-bar { position: relative; display: grid; place-items: end center; border-radius: 10px 10px 4px 4px; overflow: hidden; }
.sc-T .sc-bar { height: 100px; background: linear-gradient(var(--red), #b30f3a); }
.sc-M .sc-bar { height: 75px; background: linear-gradient(var(--cyan), #0b7f93); }
.sc-E .sc-bar { height: 75px; background: linear-gradient(var(--violet), #5a1fb8); }
.sc-bar b { padding: 6px; color: #fff; font: 800 18px/1 var(--mono); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.sc-art { position: relative; height: 36px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.sc-art i { position: absolute; display: block; }
.art-warp i { left: 30%; width: 40%; height: 22%; background: var(--red); }
.art-warp i:nth-child(1) { top: 12%; transform: translateX(-30%); }
.art-warp i:nth-child(2) { top: 40%; }
.art-warp i:nth-child(3) { top: 68%; transform: translateX(30%); }
.art-move i { top: 30%; width: 14%; height: 40%; border-radius: 4px; background: var(--cyan); }
.art-move i:nth-child(1) { left: 14%; opacity: 0.35; }
.art-move i:nth-child(2) { left: 40%; opacity: 0.65; }
.art-move i:nth-child(3) { left: 66%; }
.art-bal i { top: 20%; height: 60%; width: 30%; border-radius: 4px; background: var(--violet); }
.art-bal i:nth-child(1) { left: 12%; }
.art-bal i:nth-child(2) { left: 58%; }
.art-bal i:nth-child(3) { left: 49.5%; width: 1px; top: 0; height: 100%; background: var(--muted); }
.mults { list-style: none; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); display: grid; gap: 4px; font-size: 14px; }
.mults b { font-family: var(--mono); color: var(--red-text); }
.faqs { display: grid; gap: 6px; }
.faq { border-radius: 12px; background: var(--surface-2); padding: 0 14px; }
.faq summary { min-height: 48px; display: flex; align-items: center; font-weight: 700; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font: 700 18px/1 var(--mono); color: var(--muted); transition: transform 0.25s var(--spring); }
.faq[open] summary::after { transform: rotate(45deg); }
.faq p { margin: 0 0 12px; color: var(--muted); }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.key-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
kbd { min-width: 34px; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--line), 0 0 0 1px var(--line); font: 700 12px/1.4 var(--mono); text-align: center; }

/* cards */
.prog { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: linear-gradient(135deg, rgba(177, 77, 255, 0.14), rgba(0, 229, 255, 0.1)); }
.prog-level { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), #5a1fb8); color: #fff; }
.prog-level b { font: 800 21px/1 var(--mono); }
.prog-level small { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-top: -10px; }
.prog-main { display: grid; gap: 6px; }
.prog-main small { font: 600 12px/1 var(--mono); color: var(--muted); }
.prog-side { display: grid; gap: 4px; justify-items: end; font: 700 13px/1.2 var(--mono); }
.flame { display: inline-flex; align-items: center; color: #e07a00; }
html.dark .flame { color: #ffb35c; }
.flame .ico { width: 16px; height: 16px; }
.card-list { display: grid; gap: 6px; }
.card-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 0; border-radius: 16px; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; transition: transform 0.2s var(--spring), box-shadow 0.2s; }
.card-row:hover { box-shadow: inset 0 0 0 1px var(--violet); }
.card-row.on { box-shadow: inset 0 0 0 2px var(--ca-accent); }
.card-row.hero { background: linear-gradient(135deg, rgba(255, 45, 85, 0.16), rgba(177, 77, 255, 0.16)); padding: 14px; }
.card-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--red-text); box-shadow: var(--card-edge); }
.card-row.hero .card-ico { width: 52px; height: 52px; }
.card-main { display: grid; gap: 2px; min-width: 0; }
.card-name { display: flex; align-items: center; gap: 6px; font-weight: 750; }
.card-name .tag { background: var(--ca-accent); color: #fff; }
.card-tip { font-size: 13.5px; }
.card-goal { font: 600 12px/1.35 var(--mono); color: var(--muted); }
.card-lock { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--cyan-text); }
.card-lock .ico { width: 12px; height: 12px; }
.card-side { display: grid; gap: 6px; justify-items: end; color: var(--muted); }
.mini-stars { display: inline-flex; gap: 1px; color: var(--line); }
.mini-stars .ico { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.mini-stars i.on { color: #f0a800; }
html.dark .mini-stars i.on { color: #ffc93c; }

/* code */
.code-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-width: 360px; width: 100%; justify-self: center; }
.code-box { width: 100%; aspect-ratio: 0.85; min-height: 48px; border: 0; border-radius: 12px; text-align: center; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); font: 800 24px/1 var(--mono); text-transform: uppercase; caret-color: var(--red); }
.code-box:focus { box-shadow: inset 0 0 0 2px var(--ca-accent); outline: none; }
.code-boxes.shake { animation: shake-x 0.4s ease; }
@keyframes shake-x { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.code-msg { margin: 0; min-height: 1.4em; text-align: center; color: var(--red-text); font-weight: 700; }
.code-dl, .facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; }
.code-dl dt, .facts dt { color: var(--muted); font-weight: 650; }
.code-dl dd, .facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* compare */
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 559px) { .cmp.wide-pics { grid-template-columns: 1fr; } }
.cmp-side { display: grid; gap: 8px; justify-items: center; text-align: center; }
.cmp-side h3 { margin: 0; font: 800 15px/1.2 var(--mono); }
.cmp-pic { width: 100%; max-width: 300px; aspect-ratio: 9 / 16; max-height: 56dvh; border-radius: 14px; overflow: hidden; background: var(--night); display: grid; place-items: center; }
.cmp-pic img { width: 100%; height: 100%; object-fit: contain; }
.cmp.wide-pics .cmp-pic { aspect-ratio: 16 / 9; max-width: 480px; }
.cmp-empty { display: grid; gap: 8px; justify-items: center; color: var(--night-muted); padding: 12px; }
.cmp-score { display: flex; align-items: center; gap: 8px; }
.cmp-score b { font: 800 24px/1 var(--mono); }
.cmp-verdict { margin: 0; text-align: center; font-weight: 800; font-size: 17px; }

/* variants, cameras, speed */
.var-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.var { display: grid; gap: 6px; justify-items: center; padding: 12px 8px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 700; font-size: 14px; }
.var.on { box-shadow: inset 0 0 0 2px var(--ca-accent); }
.var:disabled { cursor: default; color: var(--muted); }
.var-lock { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.var-lock .ico { width: 12px; height: 12px; }
.var-ico { width: 48px; height: 48px; border-radius: 10px; background: var(--night); position: relative; overflow: hidden; }
.var-ico::before { content: ""; position: absolute; left: 0; right: 0; top: 46%; height: 4px; background: var(--red); box-shadow: 0 0 8px var(--red); }
.v-diagonal::before { transform: rotate(45deg) scaleX(1.5); }
.v-double::before { top: 26%; box-shadow: 0 14px 0 var(--red), 0 0 8px var(--red); }
.v-stairs::before { height: 3px; width: 50%; top: 32%; box-shadow: 24px 14px 0 var(--red); }
.v-ring::before, .v-ellipse::before, .v-square::before, .v-spiral::before { left: 9px; right: 9px; top: 9px; bottom: 9px; height: auto; background: none; border: 3px solid var(--red); border-radius: 50%; }
.v-ellipse::before { left: 14px; right: 14px; top: 5px; bottom: 5px; }
.v-square::before { border-radius: 3px; }
.v-spiral::before { border-right-color: transparent; border-bottom-color: rgba(255, 45, 85, 0.45); }
.v-wave::before, .v-zigzag::before, .v-wavefast::before, .v-wavebig::before { height: 12px; top: 40%; background: none; border-top: 3px solid var(--red); border-radius: 50% 50% 0 0; box-shadow: none; }
.v-zigzag::before { border-radius: 0; transform: skewX(30deg); }
.v-wavefast::before { border-radius: 30%; }
.v-wavebig::before { height: 22px; top: 30%; }
.cam-list, .lim-list { display: grid; gap: 6px; }
.cam-item, .lim-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text); font-weight: 650; text-align: left; cursor: pointer; }
.cam-item.on { box-shadow: inset 0 0 0 2px var(--ca-accent); }
.lim-item b { font-family: var(--mono); letter-spacing: 0.1em; }
.lim-item span { color: var(--muted); font-size: 14px; }
.speed-out { justify-self: center; font: 800 44px/1 var(--mono); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* gallery and friends */
.gal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 720px) { .gal-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { position: relative; aspect-ratio: 9 / 16; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--night); cursor: pointer; transition: transform 0.2s var(--spring); content-visibility: auto; contain-intrinsic-size: 100px 178px; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-tag { position: absolute; left: 4px; top: 4px; padding: 1px 6px; border-radius: 6px; background: rgba(10, 11, 26, 0.8); color: var(--night-text); font-size: 10.5px; font-weight: 700; }
.tile-fav, .tile-shared { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(10, 11, 26, 0.75); color: var(--red); }
.tile-shared { top: 30px; color: var(--cyan); }
.tile-fav .ico { fill: currentColor; stroke: none; }
.tile-stars { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 6px 4px; background: linear-gradient(transparent, rgba(10, 11, 26, 0.85)); color: #ffc93c; font-size: 12px; text-align: left; }
.tile-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 5px; background: linear-gradient(transparent, rgba(10, 11, 26, 0.9)); color: #fff; font-size: 12px; font-weight: 700; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot-pic { display: grid; place-items: center; border-radius: 14px; background: var(--night); padding: 8px; }
.shot-pic img { max-width: 100%; max-height: 52dvh; width: auto; height: auto; border-radius: 10px; }
.share-top { position: relative; display: grid; place-items: center; padding: 8px; border-radius: 14px; background: var(--night); }
.share-prev { max-width: 100%; max-height: 30dvh; width: auto; height: auto; border-radius: 8px; }
.make { position: absolute; left: 16px; right: 16px; bottom: 16px; height: 34px; border-radius: 10px; overflow: hidden; background: rgba(20, 22, 43, 0.85); display: grid; place-items: center; }
.make-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--f, 0)); background: linear-gradient(90deg, rgba(255, 45, 85, 0.7), rgba(177, 77, 255, 0.7)); }
.make-text { position: relative; color: #fff; font-weight: 700; font-size: 14px; }
.frames { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: thin; }
.frame-chip { flex: none; display: grid; justify-items: center; gap: 4px; width: 84px; padding: 8px 4px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; }
.frame-chip.on { box-shadow: inset 0 0 0 2px var(--ca-accent); }
.frame-chip:disabled { color: var(--muted); cursor: default; }
.frame-chip small { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; }
.fr-swatch { width: 40px; height: 40px; border-radius: 8px; background: var(--night); box-shadow: inset 0 0 0 3px #3a3d66; }
.fr-neon { box-shadow: inset 0 0 0 3px var(--cyan), inset 0 0 0 6px var(--night), inset 0 0 0 8px var(--red); }
.fr-polaroid { box-shadow: inset 0 0 0 4px #fbfaf6, inset 0 -12px 0 #fbfaf6; }
.fr-vhs { background: repeating-linear-gradient(var(--night) 0 3px, #2a2d55 3px 4px); }
.fr-filmstrip { box-shadow: inset 8px 0 0 #000, inset -8px 0 0 #000; background: var(--night-3); }
.fr-glitch { box-shadow: inset 0 0 0 3px #fff, inset 3px 0 0 3px var(--red); }
.fr-pixel { box-shadow: inset 0 0 0 4px var(--violet), inset 0 0 0 8px var(--cyan); }
.fr-holo { box-shadow: inset 0 0 0 4px #b14dff, inset 0 0 0 6px #00e5ff; }
.fr-cassette { box-shadow: inset 0 -14px 0 #f5e6c8; }
.fr-arcade { box-shadow: inset 0 0 0 4px #ffe066; }
.fr-master { box-shadow: inset 0 0 0 3px #ffe066, inset 0 0 0 6px var(--red), 0 0 10px rgba(255, 224, 102, 0.6); }
.share-btns { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; }
@media (min-width: 420px) { .share-btns { grid-template-columns: 1fr 1fr 1fr; } }
.share-btns .btn { padding: 0 10px; }
.offline-note { width: 100%; color: var(--muted); text-align: center; }
.fr-list { display: grid; gap: 4px; max-height: 40dvh; overflow-y: auto; }
.fr-list.all { opacity: 0.55; }
.fr-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 10px; border-radius: 12px; cursor: pointer; }
.fr-item:hover { background: var(--surface-2); }
.check { width: 22px; height: 22px; accent-color: var(--ca-accent); }
.fr-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--violet), var(--red)); color: #fff; font-weight: 800; }
.fr-name { flex: 1; font-weight: 650; }
.fr-on { width: 9px; height: 9px; border-radius: 50%; background: #2bd47d; }
.fr-pane { display: grid; gap: 10px; }
.own { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.own-cell { display: grid; gap: 2px; padding: 10px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.own-cell.on { box-shadow: inset 0 0 0 2px var(--violet); }
.own-cell small { color: var(--muted); font-weight: 650; }
.own-cell b { font: 800 17px/1.2 var(--mono); }

/* ---- the platform's friends' board, in this game's look ---------------------------------------- */
.board-host .ca-board { font-family: var(--sans); }

/* ---- motion off ------------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.12s !important; transition-property: opacity, background-color, color !important; }
  .count.go { animation: fade-count 1s linear forwards !important; animation-duration: 1s !important; }
  @keyframes fade-count { 0% { opacity: 0; transform: translateY(-62%); } 15%, 80% { opacity: 1; transform: translateY(-62%); } 100% { opacity: 0; transform: translateY(-62%); } }
  .view.shake { animation: none !important; }
  .view.flash .flash { animation: none !important; }
}
html.calm .view.shake, html.calm .view.flash .flash { animation: none; }
