/* =====================================================================
   Bits & Pretzels quiz — Eteia light theme.
   Background layers and the .glass primitive are ported from
   MVPApplication (global.css lines 48-86, shell.css lines 11-18).
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color-scheme: var(--native-scheme);
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

button, input { font: inherit; color: inherit; }

/* A class that sets `display` beats the UA's `[hidden] { display: none }`,
   so pin it — .freebie and friends are toggled via the hidden attribute. */
[hidden] { display: none !important; }

/* ------------------------------------------------- atmosphere: blooms + grain */

.shell-blooms {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bloom {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  mix-blend-mode: var(--atmosphere-blend);
  animation: drift 26s ease-in-out infinite;
}
.bloom.b1 {
  width: 50vw; height: 50vw; left: -10vw; top: 10vh;
  background: radial-gradient(circle, var(--lavender-deep), transparent 65%);
}
.bloom.b2 {
  width: 45vw; height: 45vw; right: -8vw; top: 0;
  background: radial-gradient(circle, var(--rose-deep), transparent 65%);
  animation-delay: -8s;
}
.bloom.b3 {
  width: 55vw; height: 55vw; left: 25vw; bottom: -20vh;
  background: radial-gradient(circle, var(--sage-deep), transparent 65%);
  animation-delay: -15s;
  opacity: 0.4;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(6%, -5%) scale(1.12); }
  66%      { transform: translate(-5%, 4%) scale(0.94); }
}

.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(6) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -2%); }
  80%  { transform: translate(3%, 3%); }
}

/* ------------------------------------------------------------------ layout */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  padding-bottom: max(clamp(1.25rem, 4vw, 2.5rem), env(safe-area-inset-bottom));
}

body.is-attract .masthead,
body.is-attract .stage { visibility: hidden; }

.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.brandmark {
  height: 34px;
  width: auto;
  display: block;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* --------------------------------------------------------- the glass card */

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--line);
  border-radius: 28px;
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow-card);
}

.screen {
  display: none;
  width: 100%;
  max-width: 34rem;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  flex-direction: column;
  gap: 1.1rem;
}
.screen.is-active {
  display: flex;
  animation: rise 0.5s var(--ease-out) both;
}
.screen--wide { max-width: 42rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------- typography */

.kicker {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.display-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.lede {
  margin: 0;
  color: var(--fg-soft);
  font-size: 0.95rem;
}

.fineprint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--fg-faint);
}

/* ------------------------------------------------------------------- forms */

.form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.3rem;
}

.field { display: flex; flex-direction: column; gap: 0.4rem; }

.field-label {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-soft);
}

.input {
  background: rgba(var(--tint-rgb), 0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  transition: border-color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}
.input:focus {
  outline: none;
  border-color: rgba(183, 174, 224, 0.55);
  background: rgba(var(--tint-rgb), 0.08);
}

.form-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--quiz-wrong);
}
.form-error strong { font-weight: 500; }

/* ----------------------------------------------------------------- buttons */

.btn {
  border: none;
  border-radius: 100px;
  padding: 0.9rem 1.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out),
              background 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
              opacity 0.3s;
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -16px rgba(var(--fg-rgb), 0.3);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-soft);
}
.btn-ghost:hover:not(:disabled) {
  border-color: rgba(var(--fg-rgb), 0.35);
  background: rgba(var(--tint-rgb), 0.04);
}

.btn:disabled { opacity: 0.5; cursor: default; }

/* Panels are disabled the moment one is picked, so their feedback states must
   opt out of the disabled dimming — otherwise the smash renders at half
   strength and fails contrast. (This bit us in the first build.) */
.panel:disabled { opacity: 0.5; cursor: default; }
.panel.is-correct:disabled,
.panel.is-destroyed:disabled { opacity: 1; }

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

/* ================================================================== attract */

/* Full-bleed arcade attract mode. Deliberately escapes the cream Eteia shell:
   this is the shop window, and it has to carry across a noisy hall. */
.attract {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  max-width: none;
  padding: 0;
  border-radius: 0;
  background: var(--cab-bg);
  color: var(--cab-fg);
  overflow: hidden;
}
.attract.is-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Reserve the lower third for the swing, so the copy sits above it. */
  padding-bottom: 20vh;
  animation: none;            /* the card `rise` would fight the full-bleed */
}

/* A slow lime/magenta wash so the black never reads as dead. */
.attract::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(38% 42% at 22% 26%, rgba(var(--quiz-right-rgb), 0.16), transparent 70%),
    radial-gradient(36% 40% at 78% 72%, rgba(var(--quiz-wrong-rgb), 0.16), transparent 70%);
  animation: wash 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes wash {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(3%, -3%) scale(1.12); }
}

.attract-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.9rem, 2vh, 1.6rem);
  text-align: center;
  padding: clamp(1.25rem, 4vw, 3rem);
  max-width: 60rem;
}

.attract-eyebrow {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: clamp(0.68rem, 1.4vw, 0.85rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cab-fg-soft);
}
.attract-mark { height: 1.7em; width: auto; display: block; }

.attract-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.92;
  text-transform: uppercase;
}
.attract-line-1 {
  font-size: clamp(1.6rem, 5.2vw, 4.2rem);
  font-weight: 300;
  color: var(--cab-fg);
}
.attract-line-2 {
  font-size: clamp(2.9rem, 11vw, 9rem);
  color: var(--quiz-right);
  text-shadow: 0 0 60px rgba(var(--quiz-right-rgb), 0.35);
}
.attract-line-2 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--quiz-wrong);
}

.attract-sub {
  margin: 0;
  font-size: clamp(0.92rem, 2vw, 1.35rem);
  line-height: 1.45;
  color: var(--cab-fg-soft);
}

.attract-cta {
  margin-top: clamp(0.3rem, 1.5vh, 1rem);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 3vw, 2.1rem);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  padding: clamp(0.7rem, 1.8vh, 1.1rem) clamp(1.8rem, 5vw, 3.4rem);
  border: none;
  border-radius: 100px;
  background: var(--quiz-right);
  color: #0a0a0f;
  cursor: pointer;
  animation: throb 1.9s var(--ease-soft) infinite;
}
.attract-cta:hover  { transform: scale(1.04); animation-play-state: paused; }
.attract-cta:focus-visible { outline: 4px solid var(--quiz-wrong); outline-offset: 5px; }

@keyframes throb {
  0%, 100% { transform: scale(1);
             box-shadow: 0 0 0 0 rgba(var(--quiz-right-rgb), 0.45),
                         0 14px 40px -10px rgba(var(--quiz-right-rgb), 0.5); }
  50%      { transform: scale(1.045);
             box-shadow: 0 0 0 22px rgba(var(--quiz-right-rgb), 0),
                         0 20px 54px -10px rgba(var(--quiz-right-rgb), 0.65); }
}

.attract-hint {
  margin: 0;
  font-size: clamp(0.66rem, 1.3vw, 0.8rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cab-fg-soft);
  animation: nudge 1.8s ease-in-out infinite;
}
.attract kbd {
  border-color: var(--cab-line);
  background: rgba(244, 239, 231, 0.12);
  color: var(--cab-fg);
}

/* ------------------------------------------- the sweeping ball + its victims */

/* Pivot sits above the viewport, so the arc crossing the screen is wide and
   shallow rather than a tight little swing. */
.attract-rig {
  /* Long arm = wide, shallow arc. Capped against viewport WIDTH too, or on a
     tall phone the ball would swing clean off the sides. */
  --arm: min(128vh, 104vw);
  --ball: clamp(62px, 8.5vw, 128px);
  --arc-y: 78vh;                 /* where the ball hangs at rest */

  position: absolute;
  left: 50%;
  top: calc(var(--arc-y) - var(--arm));   /* pivot, far above the viewport */
  width: 0;
  height: 0;
  z-index: 1;
  pointer-events: none;
}

.attract-arm {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 0;
  animation: sweep 3.6s ease-in-out infinite alternate;
}

/* Same sign convention as the playfield: the arm hangs downward, so positive
   rotation swings the bob left. */
@keyframes sweep {
  from { transform: rotate(26deg); }
  to   { transform: rotate(-26deg); }
}

.attract-chain {
  position: absolute;
  left: -3px;
  top: 0;
  width: 6px;
  height: var(--arm);
  background: repeating-linear-gradient(
    180deg, var(--steel) 0 6px, var(--steel-dark) 6px 12px);
  border-radius: 3px;
  opacity: 0.85;
  /* Fades out toward the pivot so the cable doesn't slice through the
     headline on its way off the top of the screen. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 55%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 55%);
}

.attract-ball {
  position: absolute;
  top: var(--arm);
  left: 50%;
  width: var(--ball);
  height: var(--ball);
  margin-left: calc(var(--ball) / -2);
  margin-top: calc(var(--ball) / -2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%,
      #ffffff 0%, var(--steel) 24%, var(--steel-dark) 60%, #2c2f38 100%);
  box-shadow: inset -8px -10px 20px rgba(0, 0, 0, 0.6),
              0 18px 50px rgba(0, 0, 0, 0.7);
}

/* Pretzels are laid out along the ball's own arc by JS, so every one of them
   is genuinely in the path rather than only the middle few. */
.pretzel-row { position: absolute; left: 0; top: 0; }

.pretzel-row .victim {
  position: absolute;
  line-height: 1;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  transition: transform 0.45s var(--spring), opacity 0.3s var(--ease-out);
}
.pretzel-row .victim.smashed {
  animation: pulverise 0.55s var(--ease-out) forwards;
}

@keyframes pulverise {
  0%   { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(1);   opacity: 1; }
  22%  { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(1.35); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(calc(var(--r, 0deg) + 90deg)) scale(0);
         opacity: 0; }
}

/* Popping back in after a beat, so the loop never runs out of pretzels. */
.pretzel-row .victim.respawn { animation: repop 0.5s var(--spring) both; }

@keyframes repop {
  0%   { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(0); opacity: 0; }
  100% { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(1); opacity: 1; }
}

.crumbs { position: absolute; left: 0; top: 0; }

/* ================================================================== pretzels */

/* The pretzel is the 🥨 emoji, rendered by the OS emoji font — no external
   request, and it carries its own colour. Sized with font-size, not width. */
.pz {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1;
  font-style: normal;
  display: inline-block;
}

/* Scattered background pretzels. Bob gently; frozen during a question. */
.pretzel-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.pretzel-field .drifter {
  position: absolute;
  line-height: 1;
  opacity: 0.22;
  animation: bob 9s ease-in-out infinite;
}
.pretzel-field.is-frozen .drifter { animation-play-state: paused; }

@keyframes bob {
  0%, 100% { transform: translateY(0)    rotate(var(--r, 0deg)); }
  50%      { transform: translateY(-14px) rotate(calc(var(--r, 0deg) + 8deg)); }
}

/* Win confetti — pretzels flung from the centre of the board. */
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
}
/* A hard, fast downpour — pretzels fall from above the fold, not drifting. */
.confetti-layer .drop {
  position: absolute;
  top: -12vh;
  left: var(--x);
  font-size: var(--size, 30px);
  line-height: 1;
  animation: rain var(--dur, 1.5s) linear var(--delay, 0s) both;
}

@keyframes rain {
  0%   { transform: translateY(0)     rotate(0deg);        opacity: 0; }
  8%   { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(118vh) rotate(var(--rot));  opacity: 0; }
}

/* ================================================================ playfield */

/* The arcade cabinet: dark, chunky, hard-shadowed — sitting inside the
   cream Eteia room rather than replacing it. */
.playfield {
  background: var(--cab-bg);
  color: var(--cab-fg);
  border: 3px solid var(--fg);
  border-radius: 26px;
  box-shadow: 10px 10px 0 rgba(var(--fg-rgb), 0.88);
  padding: clamp(1.2rem, 3vw, 2.2rem);
  gap: 1rem;
  /* Deliberately dominant — this is the thing people watch from across the
     stand, so it claims roughly half the screen. */
  width: min(94vw, 62rem);
  max-width: none;
  min-height: 58vh;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hud-count {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--quiz-right);
}

.playfield .pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(244, 239, 231, 0.18);
  transition: background 0.4s var(--ease-out), transform 0.4s var(--spring);
}
.playfield .pip.is-current { background: var(--cab-fg); transform: scale(1.3); }
.playfield .pip.is-done    { background: var(--quiz-right); }
.playfield .pip.is-failed  { background: var(--quiz-wrong); }

.statement {
  margin: 0.2rem 0 0.1rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.22;
  min-height: 2.6em;
  color: var(--cab-fg);
}

/* ------------------------------------------------------------------ arena */

.arena {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  gap: clamp(64px, 13vw, 104px);   /* the corridor the ball hangs in */
  padding-top: 26px;               /* room for the rig beam */
}

/* --- the crane --- */

.rig {
  position: absolute;
  left: 50%;
  top: 0;
  width: 0;
  z-index: 3;
  pointer-events: none;
}

.rig-beam {
  position: absolute;
  left: 50%;
  top: 0;
  width: clamp(88px, 13vw, 150px);
  height: 12px;
  margin-left: calc(clamp(88px, 13vw, 150px) / -2);
  border-radius: 3px;
  background: repeating-linear-gradient(
    90deg, var(--steel-dark) 0 7px, var(--steel) 7px 14px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.crane-arm {
  position: absolute;
  left: 0;
  top: 8px;
  transform-origin: 50% 0;
  animation: sway 2.8s ease-in-out infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(8deg); }
}

.chain {
  position: absolute;
  left: -2.5px;
  top: 0;
  width: 5px;
  height: clamp(76px, 12vh, 132px);
  background: repeating-linear-gradient(
    180deg, var(--steel) 0 5px, var(--steel-dark) 5px 10px);
  border-radius: 2px;
}

.ball {
  position: absolute;
  top: clamp(76px, 12vh, 132px);
  left: 50%;
  width: clamp(50px, 6.5vw, 80px);
  height: clamp(50px, 6.5vw, 80px);
  margin-left: calc(clamp(50px, 6.5vw, 80px) / -2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%,
      #ffffff 0%, var(--steel) 26%, var(--steel-dark) 62%, #3a3d47 100%);
  box-shadow: inset -5px -6px 12px rgba(0, 0, 0, 0.55),
              0 8px 20px rgba(0, 0, 0, 0.55);
}

/* Swing states — the ball travels to whichever panel is WRONG. */
.arena.swing-left  .crane-arm { animation: swing-left  0.42s var(--spring) forwards; }
.arena.swing-right .crane-arm { animation: swing-right 0.42s var(--spring) forwards; }

/* The arm hangs DOWNWARD from its pivot, so the signs are inverted relative
   to intuition: rotating clockwise (+) swings the bob to the LEFT, the way a
   clock hand at 6 o'clock moves toward 7. */
@keyframes swing-left  { to { transform: rotate(44deg); } }
@keyframes swing-right { to { transform: rotate(-44deg); } }

/* --- the answer panels --- */

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: clamp(120px, 22vh, 180px);
  padding: 1rem 0.6rem;
  border: 3px solid var(--cab-fg);
  border-radius: 16px;
  background: var(--cab-bg-2);
  color: var(--cab-fg);
  box-shadow: 6px 6px 0 rgba(244, 239, 231, 0.9);
  cursor: pointer;
  font: inherit;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out),
              background 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
.panel:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 9px 9px 0 rgba(244, 239, 231, 0.9);
}
.panel:focus-visible { outline: 3px solid var(--quiz-right); outline-offset: 4px; }

.panel-word {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

/* MYTHOS/FAKT run longer than MYTH/FACT; shrink the clamp a touch so they
   never crowd the panel at kiosk width. */
html[lang="de"] .panel-word {
  font-size: clamp(1.25rem, 4.4vw, 2.2rem);
}

.panel-key {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cab-fg-soft);
}

.panel-mark {
  font-size: 1.5rem;
  line-height: 1;
  height: 1.5rem;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s var(--ease-out), transform 0.4s var(--spring);
}
.panel.is-correct .panel-mark,
.panel.is-destroyed .panel-mark { opacity: 1; transform: scale(1); }

/* The panel that survives, i.e. the true answer. */
.panel.is-correct {
  background: var(--quiz-right);
  border-color: var(--quiz-right);
  color: #0a0a0f;
  box-shadow: 6px 6px 0 rgba(var(--quiz-right-rgb), 0.35),
              0 0 42px rgba(var(--quiz-right-rgb), 0.5);
}
.panel.is-correct .panel-key { color: rgba(10, 10, 15, 0.62); }

/* The panel the ball demolishes — always the wrong one. */
.panel.is-destroyed {
  background: var(--quiz-wrong);
  border-color: var(--quiz-wrong);
  /* Near-black, not white: white on this magenta is only 3.08:1. Ink gives
     6.3:1 and matches the lime panel's dark-on-bright treatment. */
  color: #0a0a0f;
  animation: demolish 0.5s var(--ease-out) 0.06s forwards;
}
.panel.is-destroyed .panel-key { color: rgba(10, 10, 15, 0.66); }

@keyframes demolish {
  0%   { transform: scale(1)    rotate(0deg);   filter: blur(0); }
  30%  { transform: scale(1.04) rotate(-1.5deg); }
  100% { transform: scale(0.84) rotate(3deg);   filter: blur(2px); opacity: 0.34; }
}

/* Debris thrown out of the struck panel. */
.shard {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--s, 12px);
  height: var(--s, 12px);
  background: var(--quiz-wrong);
  border-radius: 2px;
  pointer-events: none;
  animation: shard-fly 0.75s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}

@keyframes shard-fly {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* Impact shake on the whole cabinet. */
.playfield.is-hit { animation: shake 0.4s ease-in-out; }

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-7px, 3px); }
  30% { transform: translate(6px, -3px); }
  45% { transform: translate(-5px, -2px); }
  60% { transform: translate(4px, 2px); }
  80% { transform: translate(-2px, 1px); }
}

/* ----------------------------------------------------------------- reveal */

.reveal {
  min-height: 5.4em;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.verdict {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.verdict.is-right { color: var(--quiz-right); }
.verdict.is-wrong { color: var(--quiz-wrong); }

.explanation {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--cab-fg-soft);
}

.continue-hint {
  margin: 0.15rem 0 0;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cab-fg-soft);
  animation: nudge 1.6s ease-in-out infinite;
}

@keyframes nudge {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ------------------------------------------------------------------ timer */

.timerbar {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--cab-line);
}

.timer {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 200;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--cab-fg);
}
.timer::before { content: "⏱ "; font-size: 0.8em; opacity: 0.6; }
.timer.is-paused { color: var(--quiz-right); }

.timer-state {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--quiz-right);
}

/* --------------------------------------------------- register screen extras */

/* Booth kiosk: everything on the entry card reads centred. */
#screen-register { text-align: center; align-items: center; }
#screen-register .form { width: 100%; }
#screen-register .field-label { text-align: center; }
#screen-register .input { text-align: center; }
#screen-register .how-to { justify-content: center; }


.game-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 11vw, 4.6rem);
  letter-spacing: -0.045em;
  line-height: 0.9;
  text-transform: uppercase;
}
.title-swings {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.how-to {
  list-style: none;
  margin: 0.1rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  font-size: 0.82rem;
  color: var(--fg-soft);
}
.how-to li { display: flex; align-items: center; gap: 0.45rem; }

kbd {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.16rem 0.46rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(var(--tint-rgb), 0.06);
  color: var(--fg);
}
.playfield kbd,
.reveal kbd {
  border-color: var(--cab-line);
  background: rgba(244, 239, 231, 0.1);
  color: var(--cab-fg);
}

/* ------------------------------------------------- leaderboard banners */

.run-summary {
  margin: 0;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(var(--tint-rgb), 0.04);
  font-size: 0.9rem;
  color: var(--fg-soft);
}
.run-summary strong { color: var(--fg); font-weight: 500; }

/* ------------------------------------------------------------- leaderboard */

.table-scroll {
  overflow-x: auto;
  margin-top: 0.3rem;
  -webkit-overflow-scrolling: touch;
}

.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  white-space: nowrap;
}

.leaderboard th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--fg-faint);
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

.leaderboard td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.leaderboard tbody tr:last-child td { border-bottom: none; }

.col-rank { width: 2.5rem; }
.col-num  { text-align: right; }
.leaderboard td.col-num { text-align: right; font-variant-numeric: tabular-nums; }

.lb-rank { color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.lb-name { white-space: normal; }

/* The player's own email can be long; keep the table phone-width. */
.lb-email,
.lb-sub {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-soft);
}
/* Phone-only second line under the name; see the 520px query below. */
.lb-sub {
  display: none;
  font-size: 0.78rem;
  font-weight: 400;
  margin-top: 0.15rem;
}

/* Another player's name or email. The filler letters are made up in the
   browser -- the real value is never sent -- and blurred so the row reads
   as a person without being a readable string. */
.lb-blur {
  filter: blur(5px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  color: var(--fg-soft);
}

/* Rows skipped between the top list and the player's own lower rank. */
.lb-gap td {
  text-align: center;
  color: var(--fg-faint);
  letter-spacing: 0.3em;
  padding: 0.3rem 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lb-winner {
  margin-left: 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ok);
}

/* The player's own run. */
.lb-row--me td {
  background: rgba(var(--accent-rgb), 0.12);
  font-weight: 500;
}
.lb-row--me td:first-child {
  border-radius: 10px 0 0 10px;
  box-shadow: inset 3px 0 0 var(--accent);
}
.lb-row--me td:last-child { border-radius: 0 10px 10px 0; }

.lb-you {
  margin-left: 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.empty-note {
  margin: 0;
  color: var(--fg-faint);
  font-size: 0.9rem;
}

/* ------------------------------------------------------- freebie banner */

.freebie {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1.25rem;
  border: 2px solid var(--accent);
  border-radius: 18px;
  background: rgba(var(--accent-rgb), 0.08);
  text-align: center;
  animation: pop 0.55s var(--spring) both;
}

@keyframes pop {
  0%   { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

.freebie-title {
  margin: 0;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--accent);
}

/* Swap the placeholder span for an <img> when the artwork is ready. */
.freebie-art { display: grid; place-items: center; }

.freebie-emoji {
  font-size: 4.6rem;
  line-height: 1;
  animation: cheer 1.6s var(--ease-out) infinite;
}

@keyframes cheer {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50%      { transform: rotate(8deg)  scale(1.1); }
}

/* -------------------------------------------------------------- top bar */

/* Home, language and sound live in one fixed bar, outside .stage in the
   markup because .stage is hidden entirely on the attract screen (see the
   is-attract rule near the top) -- and the attract screen is exactly where
   this bar still needs to appear (a staffer turning sound down, or a player
   choosing German before they've even started).

   z-index sits above the attract screen (50) and the confetti layer (60),
   and below the grain (9999), which ignores pointer events anyway. */
.top-bar {
  position: fixed;
  top: max(0.9rem, env(safe-area-inset-top));
  right: max(0.9rem, env(safe-area-inset-right));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Shared circular icon-button look, used by Home and the sound toggle. */
.icon-btn {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  padding: 0;

  font-size: 1.05rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;

  color: var(--fg-soft);
  background: var(--chrome-bg);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: opacity 180ms var(--ease-soft), transform 180ms var(--spring);

  /* Present but unobtrusive: this is staff furniture, not part of the game. */
  opacity: 0.45;
}

.icon-btn:hover         { opacity: 1; transform: scale(1.08); }
.icon-btn:focus-visible { opacity: 1; outline: 3px solid var(--accent); outline-offset: 3px; }
.sound-toggle.is-muted  { opacity: 0.85; }

/* Home only makes sense once you've left attract -- hidden there, and
   consequently only ever seen over the light "stage" screens, so (unlike
   the sound toggle) it needs no separate dark-cabinet colours. */
body.is-attract .home-toggle { display: none; }

/* The attract screen is the dark cabinet; the cream chrome would glare. */
body.is-attract .sound-toggle {
  color: var(--cab-fg-soft);
  background: rgba(244, 239, 231, 0.10);
  border-color: var(--cab-line);
}

/* ----------------------------------------------------------- language toggle */

/* Always visible and always interactive: language can be switched from any
   screen at any time, including mid-run (see i18n.js and the lang handling
   in app.py's /api/next). Unlike Home, it is relevant on every screen,
   attract included, so it needs both light and dark colour variants like
   the sound toggle. */
.lang-toggle {
  display: flex;
  gap: 2px;
  padding: 2px;

  border-radius: 100px;
  background: var(--chrome-bg);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);

  /* Unlike the sound toggle, this IS part of the game -- a visitor has to
     spot it across a noisy hall before they start typing. */
  opacity: 0.9;
}

body.is-attract .lang-toggle {
  background: rgba(244, 239, 231, 0.10);
  border-color: var(--cab-line);
}

.lang-opt {
  min-width: 2.75rem;
  height: 2.6rem;
  border: 0;
  border-radius: 100px;
  background: transparent;
  cursor: pointer;

  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--fg-soft);
}

body.is-attract .lang-opt { color: var(--cab-fg-soft); }

.lang-opt.is-active {
  background: var(--quiz-right);
  color: #0a0a0f;
}

.lang-opt:focus-visible { outline: 3px solid var(--quiz-right); outline-offset: 3px; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 520px) {
  .stage { justify-content: flex-start; padding-top: 1.25rem; }
  /* Panels stay side by side — the words are short and the ball needs a
     left/right corridor to swing through. */
  .arena { gap: clamp(52px, 15vw, 70px); }
  .statement { min-height: 3.4em; }
  .playfield { box-shadow: 6px 6px 0 rgba(var(--fg-rgb), 0.88); }
  .leaderboard td, .leaderboard th { padding-left: 0.45rem; padding-right: 0.45rem; }
  .col-email, .lb-email { display: none; }
  .lb-sub { display: block; max-width: 7.5rem; }
  .col-rank { width: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .bloom,
  .pretzel-field .drifter,
  .crane-arm,
  .freebie-emoji,
  .continue-hint,
  .attract::before,
  .attract-arm,
  .attract-cta,
  .attract-hint { animation: none !important; }
  .attract-cta { box-shadow: 0 14px 40px -10px rgba(var(--quiz-right-rgb), 0.5); }

  /* Keep the outcome, drop the theatrics: no swing, no shatter, no shake,
     no confetti flight. The game stays completable. */
  .arena.swing-left .crane-arm,
  .arena.swing-right .crane-arm,
  .panel.is-destroyed,
  .playfield.is-hit,
  .screen.is-active,
  .freebie { animation: none !important; }
  .shard, .confetti-layer { display: none !important; }
  .panel.is-destroyed { opacity: 0.4; }
  * { transition-duration: 0.01ms !important; }
}
