/* PLAY IT NOW — THE LOOK, carried over from the 3D Studio order.
   Palette #0A0A0B/#131316/#1A1A1E/#26262B · text #FAFAFA/#A1A1AA/#52525B ·
   accent #8B5CF6 on active elements only · every measurement a multiple of 4 ·
   sizes from the 32/24/18/15/13/11 scale · radius never above 12. */
:root {
  --bg: #0A0A0B; --surface: #131316; --raised: #1A1A1E; --border: #26262B;
  --text: #FAFAFA; --text-2: #A1A1AA; --text-3: #52525B;
  --accent: #8B5CF6; --accent-glow: rgba(139, 92, 246, 0.2);
  --r: 8px; --micro: 120ms ease-out; --panel: 240ms cubic-bezier(.32,.72,0,1);
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.5 Inter, system-ui, sans-serif; }
/* The whole page refuses gesture zoom: Safari ignores user-scalable=no,
   and one accidental pinch slid the HUD and the stick off-screen (the
   owner's phone, 16 Aug 2026). Nothing on this page scrolls or zooms. */
html, body { touch-action: none; overscroll-behavior: none; overflow: hidden; position: fixed; inset: 0; width: 100%; height: 100%; }
#pv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#stick, #touchBtns button, .hud-btn, #hud { touch-action: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ── HUD ─────────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.hud-top {
  position: absolute; top: 0; left: 0; right: 0; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px;
}
.hud-btn {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; min-width: 40px; justify-content: center; padding: 8px 12px;
  background: rgba(19, 19, 22, 0.8); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 13px; font-weight: 500;
  text-decoration: none; transition: border-color var(--micro), transform var(--micro);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hud-btn:hover { border-color: var(--text-3); transform: translateY(-1px); }
.hud-btn:active { transform: translateY(0); }
.hud-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.hud-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.hud-btn.rec-live { border-color: var(--accent); color: var(--accent); }
.hud-name { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.hud-actions { display: flex; gap: 8px; margin-left: auto; }
#recLabel { font-family: var(--mono); font-size: 13px; }
#recLabel:empty { display: none; }

#orbitTools {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; pointer-events: auto;
  padding: 8px 12px; background: rgba(19, 19, 22, 0.8); border: 1px solid var(--border);
  border-radius: var(--r); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#orbitTools[hidden] { display: none; }
.hud-scale { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
#scaleRange { width: 120px; accent-color: var(--accent); }

/* Touch controls — only shown on coarse pointers. 56px targets, reachable
   thumb zones at 390, 414 and 768px. */
#stick, #touchBtns { display: none; }
@media (pointer: coarse) {
  #stick {
    display: block; position: absolute; left: 24px; bottom: calc(24px + env(safe-area-inset-bottom));
    width: 120px; height: 120px; border-radius: 60px; pointer-events: auto;
    background: rgba(19, 19, 22, 0.5); border: 1px solid var(--border);
  }
  #stickNub {
    position: absolute; left: 40px; top: 40px; width: 40px; height: 40px;
    border-radius: 20px; background: rgba(250, 250, 250, 0.25); border: 1px solid var(--text-3);
  }
  #touchBtns {
    display: flex; flex-direction: column; gap: 12px; position: absolute;
    right: 24px; bottom: calc(24px + env(safe-area-inset-bottom)); pointer-events: auto;
  }
  #touchBtns button {
    width: 64px; height: 64px; border-radius: 32px; font-size: 13px; font-weight: 500;
    background: rgba(19, 19, 22, 0.6); border: 1px solid var(--border); color: var(--text-2);
  }
  #touchBtns button:active, #touchBtns button.held { border-color: var(--accent); color: var(--accent); background: rgba(139, 92, 246, 0.12); }
}

#hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--text-2); background: rgba(10, 10, 11, 0.6);
  padding: 8px 16px; border-radius: var(--r); white-space: nowrap;
  opacity: 0; transition: opacity var(--panel);
}
#hint.on { opacity: 1; }
/* The pick-up question. Sits above the thumbs, never under them. */
#ask {
  position: absolute; left: 50%; bottom: 180px; transform: translateX(-50%);
  pointer-events: auto; z-index: 8; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; text-align: center; min-width: 220px;
}
#ask[hidden] { display: none; }
#askMsg { font-size: 16px; font-weight: 500; }
.ask-row { display: flex; gap: 12px; justify-content: center; }
.ask-row .hud-btn { min-height: 48px; min-width: 88px; font-size: 16px; }
.ask-yes { border-color: var(--accent); color: var(--accent); }
#toast {
  position: absolute; top: 72px; left: 50%; transform: translateX(-50%);
  font-size: 13px; background: var(--raised); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: var(--r); z-index: 6;
}

/* ── The visual question ─────────────────────────────────────────────── */
#scenePick { position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; background: rgba(10, 10, 11, 0.7); }
#scenePick[hidden] { display: none; }
.sp-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 480px; width: calc(100% - 32px); }
.sp-card h2 { font: 600 18px "Space Grotesk", Inter, sans-serif; margin-bottom: 16px; }
.sp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sp-opt { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--raised); border: 1px solid var(--border); border-radius: var(--r); transition: border-color var(--micro), transform var(--micro); }
.sp-opt:hover { border-color: var(--accent); transform: translateY(-1px); }
.sp-opt:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.sp-opt img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; background: var(--bg); }
.sp-opt span { font-size: 13px; color: var(--text-2); }
/* Seven type cards: a drawn icon, the name, one quiet hint. */
.sp-opt svg { width: 34px; height: 34px; margin: 6px auto 0; color: var(--text-2); }
.sp-opt:hover svg { color: var(--accent); }
.sp-opt small { font-size: 11px; color: var(--text-3, var(--text-2)); line-height: 1.35; }
.sp-grid { max-height: 62vh; overflow-y: auto; }

/* ── The loading screen ──────────────────────────────────────────────── */
#loader { position: fixed; inset: 0; z-index: 7; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; }
#loader.off { display: none; }
.ld-top {
  padding: 24px; padding-top: calc(24px + env(safe-area-inset-top));
  background: linear-gradient(rgba(10, 10, 11, 0.85), transparent);
}
.ld-brand { font: 600 11px "Space Grotesk", sans-serif; letter-spacing: 0.08em; color: var(--text-3); }
.ld-top h1 { font: 600 24px/1.2 "Space Grotesk", Inter, sans-serif; margin-top: 4px; }
.ld-bottom {
  padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(10, 10, 11, 0.85));
  display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center;
}
#ldStage { font-size: 15px; color: var(--text-2); min-height: 24px; }
.ld-bar { width: min(320px, 80vw); height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
#ldFill { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--accent); transition: width 200ms linear; }
#ldKeys { font-size: 13px; color: var(--text-3); }
#ldKeys em { font-style: normal; color: var(--text-3); padding: 0 4px; }
#ldKeys kbd {
  font-family: var(--mono); font-size: 11px; padding: 2px 6px; margin: 0 2px;
  background: var(--raised); border: 1px solid var(--border); border-radius: 4px; color: var(--text-2);
}
.ld-keys-touch { display: none; }
@media (pointer: coarse) { .ld-keys-desktop { display: none; } .ld-keys-touch { display: inline; } }

/* ── Share-visitor footer + fatal card ───────────────────────────────── */
#madeWith {
  position: fixed; bottom: 24px; right: 24px; z-index: 5;
  font-size: 13px; color: var(--text-2); text-decoration: none;
  background: rgba(19, 19, 22, 0.8); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: var(--r); backdrop-filter: blur(8px);
}
#madeWith b { color: var(--text); font-weight: 600; }
#madeWith:hover { border-color: var(--accent); }
#fatal { position: fixed; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; background: var(--bg); }
#fatal[hidden] { display: none; }
.ft-card { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 24px; }
.ft-card h2 { font: 600 24px "Space Grotesk", sans-serif; }
.ft-card p { color: var(--text-2); max-width: 360px; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
