/* ============================================================
   GAMEPLAY SCREEN
   ============================================================ */

.gameplay-inner {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 560px;
  padding: var(--space-md) var(--space-lg);
  overflow: hidden;
}

#screen-gameplay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  z-index: 100;
  background: var(--bg-primary);
  display: none;
}

#screen-gameplay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---- Quiz top bar ---- */
.gameplay-topbar {
  flex: 0.5;
  display: flex;
  flex-direction: column;
}

.gameplay-topbar-row {
  display: flex;
  align-items: center;
}

/* Left slot now occupied by .gameplay-input-btn — no pseudo spacer needed */

.gameplay-topbar-spacer {
  flex: 1;
}

.gameplay-progress {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
}

.quiz-timer-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.quiz-time-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.quiz-time-display.warning {
  background: linear-gradient(135deg, var(--warning), var(--error));
  -webkit-background-clip: text;
  background-clip: text;
}

.gameplay-timer-wrap {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.gameplay-timer-bar {
  height: 100%;
  width: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.3s linear;
}

.gameplay-timer-bar.warning {
  background: linear-gradient(90deg, var(--warning), var(--error));
}

.gameplay-timer-text {
  display: none;
}

/* ---- BTC top bar ---- */
.btc-topbar {
  text-align: center;
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.btc-pause-btn {
  position: absolute;
  top: 0;
  right: 0;
}

.btc-timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.btc-time-remaining {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.btc-time-remaining.danger {
  background: linear-gradient(135deg, var(--warning), var(--error));
  -webkit-background-clip: text;
  background-clip: text;
}

.btc-timer-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.btc-survived-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.btc-time-survived {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btc-survived-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.btc-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.btc-bar {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  transition: width 0.1s linear, background 0.5s ease;
}

.btc-bar.danger {
  background: linear-gradient(90deg, var(--error), var(--warning));
}

/* Win progress bar — clip-path reveal keeps gradient full-width so colour stops appear
   at their true positions as you progress; no compression like scaleX would cause. */
.btc-win-bar {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    var(--accent-secondary) 0%,
    hsl(145, 70%, 50%) 30%,
    hsl(55, 88%, 52%) 65%,
    hsl(30, 95%, 55%) 100%
  );
  border-radius: 3px;
  clip-path: inset(0 100% 0 0 round 3px);
  transition: clip-path 0.15s linear;
  z-index: 1;
}

/* ---- Win overlay (Beat the Clock victory screen) ---- */
.btc-win-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: revealFadeIn 0.3s ease;
}

.btc-win-card {
  text-align: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-3xl);
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: winCardIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes winCardIn {
  from { opacity: 0; transform: scale(0.8) translateY(30px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.btc-win-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 3.5rem;
  margin-bottom: var(--space-lg);
  line-height: 1;
}

.btc-win-clock {
  display: inline-block;
  animation: clockShatter 0.6s 0.15s ease both;
}

@keyframes clockShatter {
  0%   { transform: scale(1) rotate(0deg); }
  30%  { transform: scale(1.2) rotate(-15deg); }
  60%  { transform: scale(0.85) rotate(10deg); }
  80%  { transform: scale(1.1) rotate(-5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.btc-win-bat {
  display: inline-block;
  animation: batSwing 0.5s 0.1s ease both;
}

@keyframes batSwing {
  0%   { transform: rotate(-40deg); }
  50%  { transform: rotate(15deg); }
  100% { transform: rotate(-10deg); }
}

.btc-win-title {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, hsl(175, 72%, 46%), hsl(145, 70%, 50%), hsl(55, 88%, 52%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
}

.btc-win-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.btc-win-btn {
  min-width: 160px;
}

/* ---- Answer Reveal Popup (shared by Quiz & BTC) ---- */
.answer-reveal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: revealFadeIn 0.25s ease;
}

@keyframes revealFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reveal-card {
  text-align: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-3xl);
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: revealSlideUp 0.3s ease;
}

@keyframes revealSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.reveal-label {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.reveal-question {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.3rem, 6vw, 1.8rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.reveal-is {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.reveal-answer {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-lg);
}

/* Type-in section */
.reveal-typein {
  margin-bottom: var(--space-md);
}

.reveal-typein-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.reveal-input-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.reveal-neg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--accent-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  touch-action: manipulation;
  user-select: none;
}

@media (hover: hover) {
  .reveal-neg-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-secondary);
  }
}

.reveal-neg-btn:active {
  transform: scale(0.95);
  background: var(--bg-elevated);
}

.reveal-input {
  width: 160px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.reveal-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px hsla(265, 90%, 65%, 0.2);
}

.reveal-input.correct {
  border-color: var(--success);
  box-shadow: 0 0 0 3px hsla(145, 70%, 50%, 0.2);
}

.reveal-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px hsla(0, 80%, 60%, 0.2);
  animation: inputShake 0.35s ease;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* On touch: prevent iOS from focusing the input and triggering the native keyboard,
   which causes a viewport/coordinate shift that breaks subsequent numpad hit-testing. */
@media (pointer: coarse) {
  .reveal-input {
    pointer-events: none;
    caret-color: transparent;
  }
}

.reveal-input-error {
  font-size: 0.78rem;
  color: var(--error);
  margin-top: var(--space-xs);
  min-height: 1.2em;
}

.reveal-continue-btn {
  margin-bottom: var(--space-md);
  transition: all var(--transition-fast);
}

.reveal-continue-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.reveal-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ---- Pause button (lives inside each topbar) ---- */
.gameplay-pause-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

@media (hover: hover) {
  .gameplay-pause-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    color: var(--text-primary);
  }
}

.gameplay-pause-btn:active {
  transform: scale(0.92);
}

/* ---- Input mode toggle button (mirrors pause button, top-left) ---- */
.gameplay-input-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

@media (hover: hover) {
  .gameplay-input-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    color: var(--text-primary);
  }
}

.gameplay-input-btn:active {
  transform: scale(0.92);
}

.gameplay-input-btn.voice-active {
  border-color: var(--accent-primary);
  background: var(--accent-primary-dim);
  color: var(--accent-primary);
}

/* BTC input button — absolute, mirroring btc-pause-btn on the left */
.btc-input-btn {
  position: absolute;
  top: 0;
  left: 0;
}

/* ---- Voice input area ---- */
.voice-input-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg) 0;
  gap: var(--space-md);
}

.voice-eq-ring {
  width: 100%;
  max-width: 320px;
  height: 170px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
  background: var(--bg-secondary);
}

.voice-eq-ring.listening {
  border-color: var(--accent-primary);
  box-shadow:
    0 0 0 3px hsla(265, 90%, 65%, 0.15),
    0 0 28px hsla(265, 90%, 65%, 0.35),
    inset 0 0 24px hsla(265, 90%, 65%, 0.08);
  animation: eqRingPulse 2.2s ease-in-out infinite;
}

@keyframes eqRingPulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px hsla(265, 90%, 65%, 0.15),
      0 0 28px hsla(265, 90%, 65%, 0.35),
      inset 0 0 24px hsla(265, 90%, 65%, 0.08);
  }
  50% {
    box-shadow:
      0 0 0 5px hsla(265, 90%, 65%, 0.25),
      0 0 44px hsla(265, 90%, 65%, 0.55),
      inset 0 0 36px hsla(265, 90%, 65%, 0.14);
  }
}

.voice-eq-bars {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 60px;
}

.eq-bar {
  width: 6px;
  border-radius: 3px;
  background: var(--accent-gradient);
  height: 4px;
  transition: height 0.06s ease;
  flex-shrink: 0;
  opacity: 0.7;
}

.voice-eq-ring.listening .eq-bar {
  opacity: 1;
}

/* CSS-only animated fallback when AudioContext is unavailable */
@keyframes eqA { 0%, 100% { height: 6px; } 50% { height: 42px; } }
@keyframes eqB { 0%, 100% { height: 22px; } 50% { height: 8px; } }
@keyframes eqC { 0%, 100% { height: 10px; } 50% { height: 48px; } }
@keyframes eqD { 0%, 100% { height: 34px; } 50% { height: 12px; } }
@keyframes eqE { 0%, 100% { height: 14px; } 50% { height: 36px; } }
@keyframes eqF { 0%, 100% { height: 40px; } 50% { height: 16px; } }

.eq-bar.eq-bar-animate:nth-child(1)  { animation: eqA 0.85s ease-in-out infinite; }
.eq-bar.eq-bar-animate:nth-child(2)  { animation: eqB 0.65s ease-in-out infinite 0.1s; }
.eq-bar.eq-bar-animate:nth-child(3)  { animation: eqC 0.75s ease-in-out infinite 0.2s; }
.eq-bar.eq-bar-animate:nth-child(4)  { animation: eqD 0.55s ease-in-out infinite 0.05s; }
.eq-bar.eq-bar-animate:nth-child(5)  { animation: eqE 0.90s ease-in-out infinite 0.15s; }
.eq-bar.eq-bar-animate:nth-child(6)  { animation: eqA 0.70s ease-in-out infinite 0.25s; }
.eq-bar.eq-bar-animate:nth-child(7)  { animation: eqF 0.60s ease-in-out infinite 0.08s; }
.eq-bar.eq-bar-animate:nth-child(8)  { animation: eqC 0.80s ease-in-out infinite 0.18s; }
.eq-bar.eq-bar-animate:nth-child(9)  { animation: eqB 0.72s ease-in-out infinite 0.30s; }
.eq-bar.eq-bar-animate:nth-child(10) { animation: eqD 0.68s ease-in-out infinite 0.12s; }
.eq-bar.eq-bar-animate:nth-child(11) { animation: eqE 0.82s ease-in-out infinite 0.22s; }

.voice-hint-text {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-align: center;
  min-height: 1.2em;
}

/* ---- Game pause overlay card ---- */
.game-pause-card {
  padding: var(--space-2xl) var(--space-3xl);
}

.game-pause-title {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
}

.game-pause-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.game-pause-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: var(--space-md);
}

.game-pause-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

/* ---- Question area ---- */
.question-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  overflow: visible;
}

/* ---- Question stage: bat + card side by side ---- */
.question-stage {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.bat-wrapper {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: -10px; /* pull up so the handle (bat centre, right edge) sits at the card's top */
}

/* Invisible right-side counterweight so the card stays centred */
.question-stage::after {
  content: '';
  flex-shrink: 0;
  width: 80px;
}

.gameplay-bat {
  display: block;
  transform: rotate(-38deg);
  transform-origin: 100% 50%;
}


.gameplay-bat.bat-theme-classic .bat-body,
.gameplay-bat.bat-theme-classic .bat-knob {
  fill: var(--border-medium);
  stroke: var(--border-medium);
}
.gameplay-bat.bat-theme-classic .bat-grain { stroke: transparent; }

.gameplay-bat.bat-swing-correct {
  animation: batSwingCorrect 0.3s linear;
}

.gameplay-bat.bat-swing-incorrect {
  animation: batSwingBounce 0.25s linear;
}

@keyframes batSwingCorrect {
  0%   { transform: rotate(-38deg); }
  100% { transform: rotate(-398deg); }
}

@keyframes batSwingBounce {
  0%   { transform: rotate(-38deg); }
  45%  { transform: rotate(-165deg); }
  70%  { transform: rotate(-22deg); }
  100% { transform: rotate(-38deg); }
}

.question-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  font-family: 'JetBrains Mono', monospace;
  user-select: none;
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-sm);
  width: 280px;
  transition: border-color 0.1s, box-shadow 0.1s;
}

.q-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.question-display.card-hit-correct {
  border-color: var(--success);
  box-shadow: 0 0 0 3px hsla(145, 70%, 50%, 0.25), 0 0 32px hsla(145, 70%, 50%, 0.55);
  animation: cardFlyOff 0.3s linear forwards;
}

.question-display.card-hit-incorrect {
  animation: cardShakeRed 0.25s linear 112ms, cardGlowRed 0.25s linear 112ms;
}

@keyframes cardGlowRed {
  0% {
    border-color: var(--error);
    box-shadow: 0 0 0 3px hsla(0, 80%, 60%, 0.25), 0 0 24px hsla(0, 80%, 60%, 0.45);
  }
  100% {
    border-color: var(--error);
    box-shadow: 0 0 0 3px hsla(0, 80%, 60%, 0.25), 0 0 24px hsla(0, 80%, 60%, 0.45);
  }
}

@keyframes cardFlyOff {
  0%   { transform: translateX(0) rotate(0deg); opacity: 1; }
  100% { transform: translateX(400px) rotate(60deg); opacity: 0; }
}

@keyframes cardShakeRed {
  0%, 100% { transform: translateX(0); }
  12%  { transform: translateX(-10px); }
  28%  { transform: translateX(10px); }
  44%  { transform: translateX(-7px); }
  60%  { transform: translateX(7px); }
  76%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
}

.q-operand {
  font-size: clamp(1.8rem, 8vw, 3rem);
  font-weight: 700;
  color: var(--text-primary);
}

.q-operator {
  font-size: clamp(1.3rem, 5.5vw, 2rem);
  font-weight: 600;
  color: var(--accent-secondary);
}

.q-equals {
  font-size: clamp(1.5rem, 7vw, 2.5rem);
  font-weight: 600;
  color: var(--text-tertiary);
}

.q-answer-preview {
  font-size: clamp(1.8rem, 8vw, 3rem);
  font-weight: 700;
  color: var(--accent-primary);
  text-align: center;
}

/* ---- Input area ---- */
.input-area {
  flex-shrink: 0;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  max-width: 320px;
  margin: 0 auto;
}

.numpad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  min-height: 56px;
}

@media (hover: hover) {
  .numpad-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    transform: scale(1.04);
  }
}

.numpad-btn:active,
.numpad-btn.pressed {
  transform: scale(0.96);
  background: var(--bg-elevated);
}

.numpad-neg {
  color: var(--accent-secondary);
  font-weight: 700;
}

.numpad-del {
  color: var(--error);
}

.numpad-submit {
  grid-column: 1 / -1;
  background: var(--accent-gradient);
  border: none;
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  gap: var(--space-sm);
  box-shadow: var(--shadow-glow-primary);
}

@media (hover: hover) {
  .numpad-submit:hover {
    box-shadow: 0 0 30px hsla(265, 90%, 65%, 0.45);
    transform: scale(1.02);
  }
}

/* ============================================================
   RESULTS SCREEN
   ============================================================ */

.results-inner {
  text-align: center;
  max-width: 640px;
}

.results-header {
  margin-bottom: var(--space-xl);
}

.results-header h2 {
  font-size: 1.75rem;
  margin-bottom: var(--space-xs);
}

/* Params card */
.results-params-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 10px var(--space-lg);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--space-sm);
  overflow-x: auto;
}

.param-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.param-chip-label {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.param-chip-value {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}

.param-sep {
  width: 1px;
  height: 30px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.plug-gaps-confirm-params {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.plug-gaps-confirm-actions {
  display: flex;
  gap: var(--space-md);
}

/* Score card */
.results-score-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  margin-bottom: var(--space-xl);
  display: flex;
  justify-content: center;
  gap: var(--space-2xl);
  flex-wrap: wrap;
}

.score-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.score-metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.score-metric-value.success-color {
  background: linear-gradient(135deg, var(--success), hsl(170, 70%, 50%));
  -webkit-background-clip: text;
  background-clip: text;
}

.score-metric-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}


/* Question details */
.results-questions {
  text-align: left;
  margin-bottom: var(--space-xl);
}

.results-questions h3 {
  margin-bottom: var(--space-md);
}

.results-questions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.rq-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  border-left: 3px solid transparent;
}

.rq-item.correct {
  border-left-color: var(--success);
}

.rq-item.incorrect {
  border-left-color: var(--error);
}

.rq-item .rq-num {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  min-width: 24px;
}

.rq-item .rq-question {
  flex: 1;
  color: var(--text-secondary);
}

.rq-item .rq-answer {
  font-weight: 600;
}

.rq-item.correct .rq-answer {
  color: var(--success);
}

.rq-item.incorrect .rq-answer {
  color: var(--error);
}

.rq-item .rq-correct-answer {
  color: var(--success);
  font-size: 0.75rem;
}

.rq-item .rq-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Rank progress section */
.results-rank-progress {
  text-align: left;
  margin-bottom: var(--space-xl);
}

.results-rank-progress h3 {
  margin-bottom: var(--space-md);
}

.rrp-grid {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.rrp-grid .triumph-op-section {
  flex: 1;
  min-width: 0;
}

/* Dual-fill progress bar (replaces single triumph-progress-bar inside rrp cards) */
.rrp-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

.rrp-bar-base {
  height: 100%;
  background: var(--accent-primary-dim);
  flex-shrink: 0;
}

.rrp-bar-session {
  height: 100%;
  background: var(--accent-gradient);
  flex-shrink: 0;
}

.rrp-bar-marker {
  position: absolute;
  top: 0;
  height: 100%;
  width: 2px;
  background: rgba(255, 255, 255, 0.7);
  transform: translateX(-50%);
}

.rrp-delta {
  color: var(--accent-secondary);
  font-size: inherit;
  font-family: inherit;
}

.rrp-new-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 1.5px solid var(--bg-elevated);
  box-shadow: 0 0 6px var(--accent-primary);
  animation: rrp-badge-pulse 2s ease-in-out infinite;
  z-index: 1;
}

@keyframes rrp-badge-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--accent-primary); }
  50%       { box-shadow: 0 0 10px var(--accent-primary); }
}

@media (max-width: 420px) {
  .rrp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Actions */
.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
  align-items: center;
}

/* Icon-only secondary buttons with hover tooltip */
.results-icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-icon-btn::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

@media (hover: hover) {
  .results-icon-btn:hover::after {
    opacity: 1;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .gameplay-inner {
    padding-left: var(--space-md) !important;
    padding-right: var(--space-md) !important;
  }
  .question-display { width: 240px; }
  .numpad { max-width: none !important; width: 100% !important; }
  .numpad-btn { font-size: 1.1rem; min-height: 48px; padding: var(--space-sm); }
  .btc-time-remaining { font-size: 2.5rem; }
  .results-score-card { gap: var(--space-lg); }
  .score-metric-value { font-size: 2rem; }
  .results-actions { flex-wrap: nowrap; gap: var(--space-sm); }
  .results-icon-btn { width: 38px; height: 38px; }
  #btn-results-plug-gaps { flex: 1; min-width: 0; padding-left: var(--space-sm); padding-right: var(--space-sm); font-size: 0.875rem; }
  .gameplay-bat { width: 64px; height: 16px; }
  .bat-wrapper { margin-top: -8px; }
  .question-stage { gap: var(--space-sm); }
  .question-stage::after { width: 64px; }
  .voice-eq-ring { height: 140px; }
}

/* Short viewport: compact everything to prevent overflow */
@media (max-height: 650px) {
  .gameplay-inner { padding: var(--space-xs) var(--space-lg); }
  .gameplay-topbar { flex: 0 0 auto; margin-bottom: var(--space-sm); }
  .gameplay-topbar-spacer { display: none; }
  .btc-topbar { margin-bottom: var(--space-xs); }
  .gameplay-pause-btn { width: 32px; height: 32px; }
  .btc-time-remaining { font-size: 2.2rem; }
  .btc-survived-display { margin-bottom: var(--space-xs); }
  .numpad { gap: var(--space-xs); }
  .numpad-btn { min-height: 38px; padding: var(--space-xs); font-size: 1rem; }
  .gameplay-bat { width: 64px; height: 16px; }
  .bat-wrapper { margin-top: -8px; }
  .question-stage::after { width: 64px; }
  .question-display { width: 240px; padding: var(--space-md) var(--space-xs); }
  .voice-eq-ring { height: 130px; }
  .gameplay-input-btn { width: 32px; height: 32px; }
}

@media (max-width: 480px) {
  .reveal-card {
    padding: var(--space-lg) var(--space-md);
    width: 94vw;
    border-radius: var(--radius-lg);
  }
}
