/* ============================================================
   Lab Rapid-Fire — game-specific styles
   Layers on ../../css/theme.css (tokens, buttons) and
   ../../css/game-shell.css (topbar, HUD, overlays, choices).

   Local token: --hue is set on the question card per topic.
   ============================================================ */

/* ------------------------------------------------------------ shell */

.app {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
  padding: clamp(10px, 1.6vw, 20px);
  gap: clamp(10px, 1.4vw, 18px);
}

.stage {
  display: grid;
  place-items: start center;
  padding-top: clamp(0px, 4vh, 48px);
}

.choices--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.hud__lives { color: var(--bad); letter-spacing: 0.08em; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  font: 600 0.72rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgb(255 255 255 / 0.04);
}

.panel__hint { margin: 16px 0 0; font-size: 0.76rem; color: var(--ink-3); }

/* ------------------------------------------------------------ question card */

.qcard {
  --hue: 205;
  position: relative;
  width: min(760px, 100%);
  padding: clamp(18px, 3vw, 34px);
  background:
    radial-gradient(70% 60% at 50% 0%, hsl(var(--hue) 80% 45% / 0.12), transparent 70%),
    linear-gradient(180deg, rgb(255 255 255 / 0.055), rgb(255 255 255 / 0.015));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: background 400ms;
}
.qcard.is-entering { animation: rise 380ms var(--ease); }

.qcard__head { display: flex; align-items: center; gap: 10px; min-height: 26px; }

.qcard__topic {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 4px 10px;
  border-radius: 999px;
  color: hsl(var(--hue) 80% 78%);
  background: hsl(var(--hue) 70% 50% / 0.16);
  border: 1px solid hsl(var(--hue) 70% 60% / 0.3);
}
.qcard__topic:empty { display: none; }

.qcard__mult {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  color: #241a00;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  box-shadow: 0 6px 16px -8px hsl(43 96% 48% / 0.8);
}
.qcard__mult.is-bumped { animation: bump 420ms var(--ease); }

.qcard__clock {
  margin-left: auto;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.qcard__clock.is-low { color: var(--bad); }

/* Shrinking timer bar; width is driven from JS each frame. */
.timer {
  height: 6px;
  margin: 14px 0 22px;
  border-radius: 999px;
  overflow: hidden;
  background: rgb(255 255 255 / 0.06);
}
.timer__bar {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), hsl(var(--hue) 80% 60%));
  transform-origin: left center;
}
.timer.is-low .timer__bar { background: linear-gradient(90deg, #ff4d6a, var(--bad)); }
.timer.is-off { visibility: hidden; }

.qcard__q {
  margin: 0 0 22px;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* ------------------------------------------------------------ options */

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.option {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.93rem;
  line-height: 1.4;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.035);
  cursor: pointer;
  transition: border-color 160ms, background 160ms, transform 160ms var(--ease), opacity 260ms;
  animation: rise 360ms var(--ease) backwards;
  animation-delay: var(--delay, 0ms);
  -webkit-tap-highlight-color: transparent;
}
.option:hover:not(:disabled) {
  border-color: hsl(var(--hue) 70% 58% / 0.8);
  background: hsl(var(--hue) 70% 50% / 0.1);
  transform: translateY(-2px);
}
.option:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.option:disabled { cursor: default; }

.option__key {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-3);
  background: rgb(255 255 255 / 0.05);
  border: 1px solid var(--line-soft);
}

.option.is-correct {
  border-color: hsl(150 70% 50% / 0.9);
  background: hsl(150 60% 40% / 0.16);
  box-shadow: 0 0 24px -8px hsl(150 80% 50% / 0.6);
}
.option.is-correct .option__key { color: #04140c; background: hsl(150 70% 55%); border-color: transparent; }

.option.is-wrong {
  border-color: hsl(350 80% 60% / 0.9);
  background: hsl(350 70% 45% / 0.16);
  animation: wrong 460ms var(--ease);
}
.option.is-wrong .option__key { color: #fff; background: var(--bad); border-color: transparent; }

.option.is-dim { opacity: 0.45; }

@keyframes wrong {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  42% { transform: translateX(6px); }
  68% { transform: translateX(-3px); }
}

/* ------------------------------------------------------------ feedback */

.feedback {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  animation: rise 320ms var(--ease);
}
.feedback__verdict { margin: 0 0 6px; font-weight: 700; font-size: 1rem; }
.feedback__verdict.is-good { color: hsl(150 70% 62%); }
.feedback__verdict.is-bad { color: var(--bad); }
.feedback__verdict small { margin-left: 8px; font-weight: 600; font-size: 0.82rem; color: var(--gold); }
.feedback__why { margin: 0 0 16px; font-size: 0.88rem; line-height: 1.62; color: var(--ink-2); }
.feedback__row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.feedback__key { font-size: 0.76rem; color: var(--ink-3); }

/* ------------------------------------------------------------ review list */

.review { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.review li {
  padding: 11px 14px;
  border-radius: 10px;
  border-left: 3px solid hsl(var(--hue, 200) 70% 55%);
  background: rgb(0 0 0 / 0.26);
  font-size: 0.8rem;
  line-height: 1.5;
}
.review__q { display: block; font-weight: 600; color: var(--ink); }
.review__a { display: block; margin-top: 3px; color: hsl(150 60% 66%); }
.review__a::before { content: "✓ "; }
.review__why { display: block; margin-top: 4px; color: var(--ink-3); }

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

@media (max-width: 720px) {
  .choices--three { grid-template-columns: minmax(0, 1fr); }
  .options { grid-template-columns: minmax(0, 1fr); }
  .option { min-height: 54px; padding: 11px 13px; }
  .feedback__key { display: none; }
  .panel__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
