/* Trivia Squares — Expo Gradient Glass Morphism Theme */
/* Designed for 9:16 portrait mobile aspect ratio */

/* ====== 1. RESET & ROOT VARIABLES ====== */
:root {
  --primary: #1A3A8A;
  --primary-light: #2563EB;
  --primary-dark: #0F2460;
  --accent: #7C52FB;
  --accent-light: #9F7AEA;
  --accent-dim: rgba(124, 82, 251, 0.3);
  --gold: #D4AF37;
  --gold-light: #F0D060;
  --gold-dim: rgba(212, 175, 55, 0.3);
  --bg: #0A0A1A;
  --bg-light: #111827;
  --surface: rgba(124, 82, 251, 0.08);
  --surface-solid: rgba(12, 12, 24, 0.95);
  --text: #F1F5F9;
  --text-dim: #94A3B8;
  --text-muted: #64748B;
  --green: #22C55E;
  --green-light: #86EFAC;
  --red: #EF4444;
  --red-light: #FCA5A5;
  --orange: #F97316;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --glass-blur: 20px;
  --glass-border: rgba(124, 82, 251, 0.15);
  --glass-border-bright: rgba(124, 82, 251, 0.35);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --card-bg: rgba(22, 22, 40, 0.65);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 1px rgba(124, 82, 251, 0.1);
  --btn-glow: 0 0 20px rgba(124, 82, 251, 0.15);
  --transition-fast: 0.15s ease;
  --transition: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Category colors */
  --cat-world: #2563EB;
  --cat-popculture: #E91E63;
  --cat-entertainment: #9333EA;
  --cat-politics: #DC2626;
  --cat-history: #EA580C;
  --cat-science: #16A34A;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
}

/* ====== 1b. TOKEN ICON ====== */
.token-icon {
  font-size: 1em;
  vertical-align: middle;
  line-height: 1;
  color: var(--gold);
  filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.3));
}

.token-amount {
  vertical-align: middle;
}

/* ====== 2. ASPECT RATIO CONTAINER ====== */
#game-root {
  width: 100%;
  height: 100dvh;
  max-width: calc(100dvh * 9 / 16);
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  padding-top: var(--sat, env(safe-area-inset-top, 0px));
  padding-bottom: var(--sab, env(safe-area-inset-bottom, 0px));
}

/* Animated radial gradient background */
#game-root::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(124, 82, 251, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(37, 99, 235, 0.08) 0%, transparent 55%);
  animation: bgPulse 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes bgPulse {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}

/* Ensure content above bg */
#game-root > * {
  position: relative;
  z-index: 1;
}

/* Wide screen centering */
@media (min-aspect-ratio: 9/16) {
  #game-root {
    border-left: 1px solid rgba(124, 82, 251, 0.12);
    border-right: 1px solid rgba(124, 82, 251, 0.12);
    box-shadow: 0 0 60px rgba(124, 82, 251, 0.05);
  }
}


/* ====== 3. GLASS BUTTON SYSTEM ====== */
.btn-glass {
  position: relative;
  background: rgba(124, 82, 251, 0.12);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: #fff;
  font-weight: 700;
  border: 1px solid rgba(159, 122, 234, 0.4);
  border-top-color: rgba(199, 172, 255, 0.5);
  border-radius: 14px;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition), background var(--transition);
  box-shadow:
    0 6px 24px rgba(124, 82, 251, 0.35),
    0 0 40px rgba(124, 82, 251, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Inner glass shine */
.btn-glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 14px 14px 0 0;
}

/* Bottom edge glow */
.btn-glass::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 122, 234, 0.6), transparent);
  pointer-events: none;
}

.btn-glass:active {
  transform: scale(0.96);
  background: rgba(124, 82, 251, 0.22);
  box-shadow:
    0 2px 12px rgba(124, 82, 251, 0.5),
    0 0 30px rgba(124, 82, 251, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Gold variant */
.btn-gold {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.2), rgba(212, 175, 55, 0.12), rgba(240, 208, 96, 0.08));
  border-color: var(--gold);
  border-top-color: rgba(240, 208, 96, 0.5);
  color: var(--gold-light);
  box-shadow:
    0 6px 24px rgba(212, 175, 55, 0.2),
    0 0 30px rgba(212, 175, 55, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-gold:active {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.3), rgba(212, 175, 55, 0.2));
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.4);
}

/* Gradient text utility */
.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-gold {
  background: linear-gradient(135deg, #D4AF37, #F0D060, #B8860B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.3));
}


/* ====== 4. TITLE SCREEN ====== */
.title-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 0;
  animation: fadeIn 0.5s ease;
}

.title-glow {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  background:
    radial-gradient(circle, rgba(124, 82, 251, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 60% 40%, rgba(212, 175, 55, 0.08) 0%, transparent 40%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  0% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.title-content {
  text-align: center;
  z-index: 1;
}

.title-logo {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1.1;
  color: var(--text);
  text-shadow: 0 2px 20px rgba(124, 82, 251, 0.2);
}

.title-accent {
  display: block;
  font-size: 52px;
  background: linear-gradient(135deg, #D4AF37, #F0D060, #B8860B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 16px rgba(212, 175, 55, 0.35));
}

.title-subtitle {
  margin-top: 16px;
  font-size: 15px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.title-categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 28px 0;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.cat-pill-icon {
  font-size: 13px;
}

.title-info {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 32px;
  letter-spacing: 0.5px;
}

.title-info strong {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-info .token-icon {
  font-size: 16px;
  margin-right: 2px;
}

.stat-label .token-icon {
  font-size: 16px;
  margin-right: 4px;
}

.btn-start {
  font-size: 18px;
  padding: 16px 56px;
}

@keyframes btn-bounce {
  0%   { transform: scale(1); }
  25%  { transform: scale(0.90); }
  55%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}


/* ====== 5. BOARD SCREEN ====== */
.board-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 0;
  animation: fadeIn 0.4s ease;
  overflow: hidden;
}

.board-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(15, 15, 28, 0.85);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  margin-bottom: 0;
  flex-shrink: 0;
}

.board-tokens {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-dim);
}

.board-tokens .token-icon {
  font-size: 18px;
}

.board-tokens strong {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 16px;
}

.board-answered {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.btn-finish {
  position: relative;
  background: rgba(212, 175, 55, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-top-color: rgba(240, 208, 96, 0.45);
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-finish::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 10px 10px 0 0;
}

.btn-finish:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.board-progress {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 2px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(124, 82, 251, 0.3);
}

.progress-text {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.board-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

/* ---- Category Headers (4 columns) ---- */
.board-headers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.board-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px 8px;
  text-align: center;
  border-radius: var(--radius) var(--radius) 0 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 25%, transparent), color-mix(in srgb, var(--cat) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--cat) 40%, transparent);
  border-bottom: 2px solid var(--cat);
  box-shadow:
    0 4px 16px color-mix(in srgb, var(--cat) 15%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.board-header-icon {
  font-size: 18px;
  color: var(--cat);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--cat) 50%, transparent));
}

.board-header-name {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
}

/* ---- Board Cells Grid (4 columns) ---- */
.board-cells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex: 1;
  min-height: 0;
}

/* ---- Individual Cell Tile ---- */
.board-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--cat) 12%, rgba(22, 22, 40, 0.8)),
    color-mix(in srgb, var(--cat) 4%, rgba(12, 12, 28, 0.9))
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid color-mix(in srgb, var(--cat) 30%, transparent);
  border-top-color: color-mix(in srgb, var(--cat) 45%, transparent);
  border-radius: var(--radius);
  padding: 6px 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Category-tinted inner glow */
.board-cell:not(.answered)::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--cat) 10%, transparent) 0%,
    transparent 100%
  );
  pointer-events: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Bottom edge glow line */
.board-cell:not(.answered)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat), transparent);
  opacity: 0.4;
  pointer-events: none;
}

.board-cell:not(.answered):active {
  transform: scale(0.93);
  border-color: var(--cat);
  box-shadow:
    0 0 20px color-mix(in srgb, var(--cat) 30%, transparent),
    inset 0 0 16px color-mix(in srgb, var(--cat) 12%, transparent);
}

/* ---- Cell Inner Content ---- */
.cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 1;
}

.cell-reward-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.cell-reward-row .token-icon {
  font-size: 16px;
}

.cell-reward-num {
  font-size: 18px;
  font-weight: 900;
  color: var(--gold-light);
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.cell-diff-label {
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ---- Difficulty tier color accents ---- */
.board-cell.diff-easy { --diff-accent: #22C55E; }
.board-cell.diff-medium { --diff-accent: #3B82F6; }
.board-cell.diff-hard { --diff-accent: #A855F7; }
.board-cell.diff-expert { --diff-accent: #F97316; }
.board-cell.diff-master { --diff-accent: #EF4444; }

/* ---- Answered cell states ---- */
.board-cell.answered {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.04);
  cursor: default;
  box-shadow: none;
}

.board-cell.answered::before,
.board-cell.answered::after {
  display: none;
}

.cell-answered-icon {
  font-size: 22px;
  opacity: 0.5;
}

.board-cell.was-correct .cell-answered-icon {
  color: var(--green);
  opacity: 0.6;
}

.board-cell.was-wrong .cell-answered-icon {
  color: var(--red);
  opacity: 0.4;
}


/* ====== 6. QUESTION SCREEN ====== */
.question-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.35s ease;
}

.question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.question-category {
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.question-value {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-light);
}

.question-value .token-icon {
  font-size: 22px;
}

.question-reward {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.question-timer {
  position: relative;
  height: 36px;
  background: rgba(15, 15, 28, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.timer-bar {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary-light));
  border-radius: var(--radius);
  transition: width 1s linear;
  box-shadow: 0 0 16px rgba(124, 82, 251, 0.25);
}

.timer-bar.timer-warning {
  background: linear-gradient(90deg, var(--red), #B91C1C);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
}

.timer-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 800;
  z-index: 1;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
}

.question-clue {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
}

.question-clue p {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.question-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.choice-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

/* Inner shine */
.choice-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
  pointer-events: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.choice-btn:active {
  transform: scale(0.97);
  background: rgba(124, 82, 251, 0.15);
  border-color: var(--glass-border-bright);
  box-shadow: 0 0 20px rgba(124, 82, 251, 0.2), inset 0 0 12px rgba(124, 82, 251, 0.06);
}

.choice-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(124, 82, 251, 0.15);
  border: 1px solid rgba(124, 82, 251, 0.25);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--accent-light);
}

.choice-text {
  flex: 1;
  line-height: 1.35;
}


/* ====== 7. RESULT SCREEN ====== */
.result-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.35s ease;
}

.result-header {
  text-align: center;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.result-correct {
  background: linear-gradient(135deg, #22C55E, #86EFAC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(34, 197, 94, 0.35));
}

.result-wrong {
  background: linear-gradient(135deg, #EF4444, #FCA5A5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(239, 68, 68, 0.35));
}

.result-reward {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gold-light);
}

.result-reward .token-icon {
  font-size: 20px;
}

.result-category {
  align-self: center;
  padding: 6px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-clue {
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
  padding: 0 12px;
}

.result-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.choice-result {
  opacity: 0.35;
  cursor: default;
}

.choice-result.correct {
  opacity: 1;
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.1), inset 0 0 8px rgba(34, 197, 94, 0.05);
}

.choice-result.correct .choice-letter {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}

.choice-result.wrong {
  opacity: 1;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.1), inset 0 0 8px rgba(239, 68, 68, 0.05);
}

.choice-result.wrong .choice-letter {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-continue {
  position: relative;
  background: rgba(124, 82, 251, 0.12);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: #fff;
  border: 1px solid rgba(159, 122, 234, 0.4);
  border-top-color: rgba(199, 172, 255, 0.5);
  padding: 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition);
  margin-top: auto;
  overflow: hidden;
  box-shadow:
    0 6px 24px rgba(124, 82, 251, 0.3),
    0 0 30px rgba(124, 82, 251, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-continue::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 14px 14px 0 0;
}

.btn-continue::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 122, 234, 0.5), transparent);
  pointer-events: none;
}

.btn-continue:active {
  transform: scale(0.96);
  background: rgba(124, 82, 251, 0.22);
}


/* ====== 8. FINAL RESULTS SCREEN ====== */
.final-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  animation: fadeIn 0.5s ease;
}

.final-glow {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  background:
    radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 40% 60%, rgba(124, 82, 251, 0.08) 0%, transparent 50%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite alternate;
}

.final-content {
  text-align: center;
  z-index: 1;
  width: 100%;
  max-width: 340px;
}

.final-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 4px;
  margin-bottom: 16px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--text), var(--text-dim));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.final-grade {
  font-size: 72px;
  font-weight: 900;
  margin-bottom: 24px;
  line-height: 1;
}

.grade-S {
  background: linear-gradient(135deg, #D4AF37, #F0D060, #B8860B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.4));
}

.grade-A {
  background: linear-gradient(135deg, #22C55E, #86EFAC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(34, 197, 94, 0.3));
}

.grade-B {
  background: linear-gradient(135deg, #2563EB, #93C5FD);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(37, 99, 235, 0.3));
}

.grade-C {
  background: linear-gradient(135deg, #F97316, #FDBA74);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(249, 115, 22, 0.3));
}

.grade-D {
  background: linear-gradient(135deg, #EF4444, #FCA5A5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 24px rgba(239, 68, 68, 0.3));
}

.grade-F {
  color: var(--text-muted);
  filter: drop-shadow(0 0 16px rgba(100, 116, 139, 0.2));
}

.final-stats {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 32px;
  box-shadow: var(--card-shadow);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid rgba(124, 82, 251, 0.08);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row.highlight {
  padding: 14px 0;
}

.stat-row.highlight .stat-value {
  font-size: 20px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.3px;
}

.stat-value {
  font-weight: 700;
  font-size: 16px;
}

.final-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.btn-play-again {
  font-size: 16px;
  padding: 16px;
}

.btn-exit {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition);
  overflow: hidden;
}

.btn-exit:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.08);
}


/* ====== 9. ANIMATIONS ====== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes cellEntrance {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes choiceSlideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes goldShimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.08); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes correctPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 30px 8px rgba(34, 197, 94, 0.15); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes gradeReveal {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  80% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes titleSlideDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes specularSweep {
  0% { transform: translateX(-100%) rotate(25deg); }
  100% { transform: translateX(200%) rotate(25deg); }
}


/* ====== 10. NOISE TEXTURE OVERLAY ====== */
#game-root::after {
  content: '';
  position: absolute;
  inset: 0;
  filter: url(#noise);
  opacity: 0.03;
  pointer-events: none;
  z-index: 999;
  mix-blend-mode: overlay;
}

/* ====== 11. SHIMMER ON TOKEN REWARDS ====== */
.cell-reward-num {
  background: linear-gradient(
    90deg,
    var(--gold) 0%,
    var(--gold-light) 25%,
    #FFF8DC 50%,
    var(--gold-light) 75%,
    var(--gold) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: goldShimmer 3s ease-in-out infinite;
}

/* ====== 12. STAGGERED BOARD CELL ENTRANCE (4 cols x 5 rows = 20 cells) ====== */
.board-cell {
  animation: cellEntrance 0.35s ease backwards;
}
/* Row 1 */
.board-cell:nth-child(1) { animation-delay: 0.03s; }
.board-cell:nth-child(2) { animation-delay: 0.06s; }
.board-cell:nth-child(3) { animation-delay: 0.09s; }
.board-cell:nth-child(4) { animation-delay: 0.12s; }
/* Row 2 */
.board-cell:nth-child(5) { animation-delay: 0.12s; }
.board-cell:nth-child(6) { animation-delay: 0.15s; }
.board-cell:nth-child(7) { animation-delay: 0.18s; }
.board-cell:nth-child(8) { animation-delay: 0.21s; }
/* Row 3 */
.board-cell:nth-child(9) { animation-delay: 0.21s; }
.board-cell:nth-child(10) { animation-delay: 0.24s; }
.board-cell:nth-child(11) { animation-delay: 0.27s; }
.board-cell:nth-child(12) { animation-delay: 0.30s; }
/* Row 4 */
.board-cell:nth-child(13) { animation-delay: 0.30s; }
.board-cell:nth-child(14) { animation-delay: 0.33s; }
.board-cell:nth-child(15) { animation-delay: 0.36s; }
.board-cell:nth-child(16) { animation-delay: 0.39s; }
/* Row 5 */
.board-cell:nth-child(17) { animation-delay: 0.39s; }
.board-cell:nth-child(18) { animation-delay: 0.42s; }
.board-cell:nth-child(19) { animation-delay: 0.45s; }
.board-cell:nth-child(20) { animation-delay: 0.48s; }

/* ====== 13. CHOICE BUTTON ENTRANCE ====== */
.choice-btn {
  animation: choiceSlideIn 0.3s ease backwards;
}
.choice-btn:nth-child(1) { animation-delay: 0.05s; }
.choice-btn:nth-child(2) { animation-delay: 0.12s; }
.choice-btn:nth-child(3) { animation-delay: 0.19s; }
.choice-btn:nth-child(4) { animation-delay: 0.26s; }

/* ====== 14. BUTTON BOUNCE ON TAP ====== */
.btn-glass:active,
.btn-finish:active,
.btn-continue:active,
.btn-exit:active {
  animation: btn-bounce 0.35s ease;
}

/* ====== 15. SPECULAR GLASS SWEEP ====== */
.btn-gold::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transform: rotate(25deg);
  animation: specularSweep 4s ease-in-out infinite;
  pointer-events: none;
}

/* ====== 16. TITLE STAGGERED ENTRANCE ====== */
.title-logo {
  animation: titleSlideDown 0.6s ease backwards;
}
.title-subtitle {
  animation: titleFadeUp 0.5s ease 0.15s backwards;
}
.title-categories {
  animation: titleFadeUp 0.5s ease 0.25s backwards;
}
.title-info {
  animation: titleFadeUp 0.5s ease 0.35s backwards;
}
.btn-start {
  animation: titleFadeUp 0.5s ease 0.45s backwards;
}

/* ====== 17. CORRECT ANSWER PULSE ====== */
.choice-result.correct {
  animation: correctPulse 1.2s ease;
}

/* ====== 18. RESULT HEADER BOUNCE IN ====== */
.result-header {
  animation: bounceIn 0.5s ease;
}

/* ====== 19. FINAL GRADE REVEAL ====== */
.final-grade {
  animation: gradeReveal 0.6s ease 0.2s backwards;
}

/* ====== 20. CONFETTI CONTAINER ====== */
.confetti-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

/* ====== 21. CATEGORY PILL HOVER GLOW ====== */
.cat-pill {
  transition: transform var(--transition-fast), box-shadow var(--transition);
}

.cat-pill:active {
  transform: scale(0.92);
}

/* ====== 22. BOARD CELL HOVER GLOW ====== */
@media (hover: hover) {
  .board-cell:not(.answered):hover {
    border-color: var(--cat);
    box-shadow:
      0 0 16px color-mix(in srgb, var(--cat) 25%, transparent),
      inset 0 0 12px color-mix(in srgb, var(--cat) 10%, transparent);
    transform: translateY(-2px);
  }

  .choice-btn:hover {
    border-color: var(--glass-border-bright);
    box-shadow: 0 0 16px rgba(124, 82, 251, 0.12);
    transform: translateY(-1px);
  }
}

/* ====== 23. PROGRESS BAR GLOW ====== */
.progress-fill {
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 8px var(--gold), 0 0 16px rgba(212, 175, 55, 0.3);
}

/* ====== 24. SCROLLBAR ====== */
.question-screen::-webkit-scrollbar,
.result-screen::-webkit-scrollbar {
  width: 3px;
}

.question-screen::-webkit-scrollbar-track,
.result-screen::-webkit-scrollbar-track {
  background: transparent;
}

.question-screen::-webkit-scrollbar-thumb,
.result-screen::-webkit-scrollbar-thumb {
  background: rgba(124, 82, 251, 0.15);
  border-radius: 2px;
}
