/* Steady Hand — full-bleed canvas buzz-wire. Self-contained. */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800;900&family=Geist+Mono:wght@400;500;600&display=swap");

:root{
  --ink: #f0f3ff;
  --dim: rgba(240, 243, 255, 0.55);
  --faint: rgba(240, 243, 255, 0.3);
  --bg: #04040a;
  --hot: #ff5a4d;
  --hot-lite: #ffb4a0;
  --cool: #7ad6ff;
  --line: rgba(170, 195, 255, 0.16);
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{
  height: 100%; margin: 0; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
canvas{
  display: block; width: 100%; height: 100%; touch-action: none;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}

/* ---------- HUD ---------- */
.hud{
  position: fixed; z-index: 5; pointer-events: none;
  top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 24px; align-items: flex-end;
  font-family: var(--font-mono);
  padding: 7px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(7, 8, 20, 0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hud[hidden]{ display: none; }
.hud{ flex-direction: column; gap: 7px; align-items: stretch; }
.hud__row{ display: flex; gap: 24px; align-items: flex-end; justify-content: center; }
/* how far along the wire you are, as a bar under the readouts: the wire itself
   doubles back at higher levels, so a straight gauge is the clearest answer */
.hud__bar{
  display: block; height: 3px; border-radius: 2px;
  background: rgba(160, 200, 255, 0.16); overflow: hidden;
}
.hud__fill{
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #46e0b0, #9dffd8);
  box-shadow: 0 0 10px rgba(90, 255, 200, 0.6);
  transition: width 90ms linear;
}
.hud__cell{ display: flex; flex-direction: column; align-items: center; gap: 1px; }
.hud__k{ font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); }
.hud__cell span:last-child{ font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Callout ---------- */
.callout{
  position: fixed; z-index: 6; pointer-events: none;
  left: 50%; top: 20%; transform: translate(-50%, -50%);
  font-family: var(--font-display); font-weight: 900; letter-spacing: -0.02em;
  font-size: clamp(1.3rem, 5vw, 2.3rem); line-height: 1;
  color: var(--hot-lite); text-align: center;
  text-shadow: 0 0 34px rgba(255, 138, 61, 0.5), 0 6px 30px rgba(0,0,0,0.6);
}
.callout[hidden]{ display: none; }

/* ---------- Sound ---------- */
.sound-btn{
  position: fixed; z-index: 6;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(9, 10, 22, 0.6); color: var(--ink);
  font-size: 15px; cursor: pointer; backdrop-filter: blur(8px);
  transition: transform 140ms ease, border-color 140ms ease, opacity 140ms ease;
}
.sound-btn:hover{ transform: translateY(-1px); border-color: var(--cool); }
.sound-btn[aria-pressed="false"]{ opacity: 0.45; }
.sound-btn:focus-visible{ outline: none; box-shadow: 0 0 0 3px rgba(89, 224, 255, 0.4); }

/* ---------- Overlay ---------- */
.overlay{
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: radial-gradient(90% 70% at 50% 42%, rgba(6, 7, 16, 0.74), rgba(2, 2, 6, 0.95));
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  transition: opacity 240ms ease;
}
.overlay[hidden]{ display: none; }
.overlay.is-out{ opacity: 0; pointer-events: none; }
.panel{
  max-width: 520px; text-align: center;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(8, 9, 20, 0.78);
  box-shadow: 0 30px 90px -20px rgba(0,0,0,0.85);
}
.panel__eyebrow{ margin: 0 0 6px; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--hot); }
.panel__title{ margin: 0 0 12px; font-size: clamp(2rem, 8vw, 3rem); font-weight: 900; letter-spacing: -0.02em; }
.panel__text{ margin: 0 0 22px; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.7; color: var(--dim); }
.panel__text b{ color: var(--ink); font-weight: 600; }
.play-btn{
  appearance: none; font-family: var(--font-display); font-weight: 800; font-size: 1rem;
  padding: 13px 30px; border-radius: 999px; cursor: pointer;
  border: 0; background: linear-gradient(180deg, var(--hot-lite), var(--hot));
  color: #2a1403; box-shadow: 0 10px 30px -8px rgba(255, 138, 61, 0.6);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.play-btn:hover{ transform: translateY(-2px); box-shadow: 0 16px 38px -10px rgba(255, 138, 61, 0.75); }
.play-btn:focus-visible{ outline: none; box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.45); }
.panel__keys{ margin: 16px 0 0; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.06em; color: var(--faint); }

/* ---------- Frame corners + hint ---------- */
.frame{ position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner{
  position: fixed; font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint);
}
.frame__corner--tl{ top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); }
.frame__corner--tr{ top: max(14px, env(safe-area-inset-top)); right: max(58px, calc(env(safe-area-inset-right) + 58px)); }
.frame__corner--bl{ bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); pointer-events: auto; }
.frame__corner--bl a{ color: var(--faint); text-decoration: none; }
.frame__corner--bl a:hover{ color: var(--hot); }

.hint{
  position: fixed; z-index: 4; pointer-events: none;
  bottom: max(38px, calc(env(safe-area-inset-bottom) + 28px)); left: 50%; transform: translateX(-50%);
  margin: 0; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em;
  color: var(--faint); white-space: nowrap;
  transition: opacity 500ms ease;
}
.hint.is-gone{ opacity: 0; }

@media (max-width: 620px){
  .hint{ font-size: 0.55rem; }
  /* the HUD is centred at the top and the toy name is pinned top-right; below
     this width they overlap, and the name is the one the page can spare */
  .frame__corner--tr{ display: none; }
  /* and the hint runs straight through the tickets pill, which docks at the
     bottom-left and is 32px tall — measured, not guessed */
  .hint{ bottom: max(86px, calc(env(safe-area-inset-bottom) + 76px)); }
  .hud{ gap: 18px; padding: 6px 12px; }
}
@media (max-height: 620px){
  .hud{ top: max(6px, env(safe-area-inset-top)); padding: 4px 11px; }

}
@media (prefers-reduced-motion: reduce){
  .play-btn, .sound-btn, .overlay{ transition: none; }
}
