﻿/* =============================================================
   LAYOUT.CSS — Page layouts, nav, grid, containers
   قدها وقدود — Arabic RTL Game Show Platform
   ============================================================= */

/* ══════════════════════════════════════════════════════════════
   CONTAINERS
   ══════════════════════════════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.container-sm  { max-width: 720px;  margin-inline: auto; padding-inline: var(--space-6); }
.container-md  { max-width: 960px;  margin-inline: auto; padding-inline: var(--space-6); }
.container-lg  { max-width: 1120px; margin-inline: auto; padding-inline: var(--space-6); }

/* ══════════════════════════════════════════════════════════════
   TOPBAR / NAVIGATION
   ══════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 16px rgba(60,40,120,0.08);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  max-width: 1280px;
  margin-inline: auto;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}
.topbar-logo {
  width: 54px;
  height: 54px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  flex-shrink: 0;
  overflow: visible;
}
.topbar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.topbar-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.topbar-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

/* Brand name beside the logo in the topbar */
.topbar-brand-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  background: linear-gradient(90deg, var(--brand-gold-deep), var(--brand-teal-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .topbar-brand-name { font-size: var(--text-base); }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--gold-gradient);
  border: 2px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-black);
  font-size: var(--text-base);
  color: var(--text-primary);
  flex-shrink: 0;
}
.user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════════
   AUTH LAYOUT
   ══════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  position: relative;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface-primary);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: fade-scale var(--t-slower) var(--ease-spring) both;
  position: relative;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--brand-gradient);
}

.auth-header {
  padding: var(--space-8) var(--space-8) var(--space-6);
  text-align: center;
}
.auth-logo {
  width: 190px;
  height: auto;
  max-height: 150px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  animation: float 4s ease-in-out infinite;
  background: transparent;
}
.auth-logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(230,169,43,0.28));
}
.auth-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

/* Tab switcher (login / register) */
.auth-tabs {
  display: flex;
  background: var(--purple-50);
  border-radius: var(--radius-full);
  padding: 4px;
  margin: 0 var(--space-8) var(--space-2);
}
.auth-tab {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-normal) var(--ease-smooth);
  text-align: center;
  border: none;
  background: none;
}
.auth-tab.active {
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-form-wrap {
  padding: var(--space-6) var(--space-8) var(--space-8);
}

/* ══════════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
   ══════════════════════════════════════════════════════════════ */
.dashboard-page {
  min-height: 100vh;
}

.dashboard-hero {
  padding: var(--space-8) var(--space-6) var(--space-10);
  text-align: center;
  max-width: 760px;
  margin-inline: auto;
  position: relative;
}
/* Half-circle backdrop descending from the topbar strip */
.dashboard-hero::after {
  content: '';
  position: absolute;
  top: -72px;                    /* bites deeper into the topbar */
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, 94vw);
  height: min(500px, 60vw);
  background: radial-gradient(
    ellipse at top,
    rgba(255,200,87,0.55) 0%,
    rgba(46,230,197,0.40) 50%,
    rgba(46,230,197,0.18) 75%,
    transparent 92%);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}
.dashboard-hero > * { position: relative; z-index: 1; }

.dashboard-hero-logo {
  width: min(500px, 78vw);
  height: auto;
  max-height: 300px;
  object-fit: contain;
  display: block;
  margin: 0 auto var(--space-4);
  filter: drop-shadow(0 12px 32px rgba(46,230,197,0.28))
          drop-shadow(0 -6px 22px rgba(255,200,87,0.25));
  animation: float 5s ease-in-out infinite;
}
.dashboard-greeting {
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.dashboard-subtitle {
  font-size: var(--text-lg);
  color: var(--text-muted);
  margin-bottom: var(--space-8);
}

.dashboard-cta {
  margin-bottom: var(--space-12);
}

.dashboard-sections {
  max-width: 1100px;
  margin-inline: auto;
  padding: 0 var(--space-6) var(--space-12);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.info-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.info-card-icon {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
  display: block;
}
.info-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}
.info-card-body {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-loose);
}
.info-card-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.info-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.info-step-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--gold-gradient);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: var(--weight-black);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: var(--shadow-xs);
}
.info-step-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-snug);
}

/* ══════════════════════════════════════════════════════════════
   GAME SETUP LAYOUT
   ══════════════════════════════════════════════════════════════ */
.setup-page {
  min-height: 100vh;
  padding-bottom: var(--space-12);
  position: relative;
}
/* Decorative brand color blobs to bring the page to life */
.setup-page::before,
.setup-page::after {
  content: '';
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  animation: setup-blob 10s ease-in-out infinite;
}
.setup-page::before { top: -120px;    right: -80px; background: #FFC857; }
.setup-page::after  { bottom: -140px; left:  -90px; background: #2EE6C5; animation-delay: -5s; }
@keyframes setup-blob {
  0%, 100% { transform: translate(0,0)   scale(1);    }
  50%      { transform: translate(40px,30px) scale(1.08); }
}
.setup-page > * { position: relative; z-index: 1; }

/* Combined game-name + team-names section */
.setup-header-combo {
  max-width: 820px;
  margin: 0 auto var(--space-6);
}
.setup-combo-game-name {
  text-align: center;
  margin: 0 auto var(--space-4);
  max-width: 520px;
}
.setup-combo-game-name .form-label {
  text-align: center;
  justify-content: center;
  display: flex;
  margin-bottom: var(--space-2);
}
.setup-game-name-input {
  text-align: center;
  font-size: var(--text-xl) !important;
  font-weight: var(--weight-bold);
  padding: var(--space-3) var(--space-4) !important;
}
.setup-combo-teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  max-width: 640px;
  margin: 0 auto;
}
.setup-header {
  padding: var(--space-8) var(--space-6) var(--space-6);
  max-width: 1100px;
  margin-inline: auto;
}
.setup-teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  max-width: 640px;
  margin: 0 auto var(--space-8);
}
.setup-section-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.category-counter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.counter-dots {
  display: flex;
  gap: 6px;
}
.counter-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--streak-empty);
  border: 1.5px solid var(--border-medium);
  transition: background 0.3s var(--ease-spring), transform 0.3s var(--ease-spring);
}
.counter-dot.filled {
  background: var(--gold-gradient);
  border-color: var(--gold-400);
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(200,164,40,0.40);
}
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
}

.setup-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-light);
  padding: var(--space-4) var(--space-6);
  z-index: var(--z-raised);
}
.setup-footer-inner {
  max-width: 1100px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* ══════════════════════════════════════════════════════════════
   GAME BOARD LAYOUT
   ══════════════════════════════════════════════════════════════ */
.game-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    145deg,
    #1A0E38 0%,
    #240E50 30%,
    #1E0A40 60%,
    #160830 100%
  );
  background-attachment: fixed;
}

.game-topbar {
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.game-title-display {
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.04em;
}

.game-board-area {
  flex: 1;
  padding: var(--space-4) var(--space-4) var(--space-2);
  overflow-x: auto;
}
.game-board {
  display: flex;
  gap: 8px;
  min-width: 0;
  max-width: 1100px;
  margin-inline: auto;
  height: 100%;
}

/* Dark-mode board column */
.game-page .board-column-header {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 2px 12px rgba(0,0,0,0.30);
}
.game-page .board-column-name { color: rgba(255,255,255,0.88); }
.game-page .question-cell {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.10);
}
.game-page .question-cell[data-difficulty="easy"] {
  background: linear-gradient(135deg, rgba(255,248,224,0.12) 0%, rgba(240,220,180,0.08) 100%);
}
.game-page .question-cell[data-difficulty="medium"] {
  background: linear-gradient(135deg, rgba(220,200,255,0.12) 0%, rgba(200,170,255,0.08) 100%);
}
.game-page .question-cell[data-difficulty="hard"] {
  background: linear-gradient(135deg, rgba(255,200,200,0.12) 0%, rgba(240,160,160,0.08) 100%);
}
.game-page .question-cell:hover:not(.used):not(.locked) {
  background: rgba(255,255,255,0.15);
  border-color: var(--gold-400);
}

.game-bottom {
  padding: var(--space-4) var(--space-6) var(--space-6);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
}
.game-center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

/* Dark-mode team panel */
.game-page .team-panel {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.12);
}
.game-page .team-panel.active-turn {
  background: rgba(248,220,100,0.10);
  border-color: var(--gold-400);
}
.game-page .team-panel-name { color: rgba(255,255,255,0.90); }
.game-page .team-panel-score { color: var(--gold-300); }

/* ══════════════════════════════════════════════════════════════
   QUESTION OVERLAY LAYOUT
   ══════════════════════════════════════════════════════════════ */
.question-overlay {
  max-width: 680px;
}
.question-modal-header {
  background: linear-gradient(135deg, var(--purple-600) 0%, var(--purple-500) 100%);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.question-difficulty-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.30);
  color: rgba(255,255,255,0.90);
}
.question-category-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.70);
  font-weight: var(--weight-medium);
}
.question-points-label {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  color: var(--gold-200);
  letter-spacing: -0.02em;
}

.question-text-area {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-snug);
  text-align: center;
  padding: var(--space-6);
}

.question-image-wrap {
  margin: 0 var(--space-6) var(--space-4);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  cursor: zoom-in;
  position: relative;
  max-height: 240px;
}
.question-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease-smooth);
}
.question-image-wrap:hover img { transform: scale(1.03); }
.question-image-zoom-hint {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  background: rgba(0,0,0,0.60);
  color: #fff;
  font-size: var(--text-xs);
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
}

/* Timer display */
.timer-display {
  font-size: var(--text-5xl);
  font-weight: var(--weight-black);
  color: var(--purple-400);
  text-align: center;
  line-height: 1;
  letter-spacing: -0.03em;
  transition: color 0.3s;
}
.timer-display.warning { color: #E09020; animation: timer-warning 0.8s ease-in-out infinite; }
.timer-display.negative { color: #D02040; animation: timer-warning 0.5s ease-in-out infinite; font-size: var(--text-4xl); }
.timer-ring {
  position: relative;
  width: 90px;
  height: 90px;
  margin-inline: auto;
}
.timer-ring svg {
  transform: rotate(-90deg);
}
.timer-ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Answer side */
.answer-text-area {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--purple-500);
  text-align: center;
  padding: var(--space-8) var(--space-6) var(--space-4);
  line-height: var(--leading-snug);
}

.team-selection-area {
  padding: var(--space-4) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.team-select-label {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
}
.team-select-btns {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  width: 100%;
}
.team-select-btn {
  flex: 1;
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--text-base);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  background: var(--gold-gradient-btn);
  border: 2px solid var(--gold-400);
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast) var(--ease-spring);
  box-shadow: var(--shadow-gold);
}
.team-select-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 28px rgba(200,164,40,0.45);
}
.team-select-btn:active { transform: scale(0.97); }
.team-select-none {
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  font-family: var(--font-primary);
  font-weight: var(--weight-medium);
  transition: color var(--t-fast);
}
.team-select-none:hover { color: var(--text-error); }

/* ══════════════════════════════════════════════════════════════
   WINNER PAGE
   ══════════════════════════════════════════════════════════════ */
.winner-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
}
.winner-rays {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.winner-card {
  position: relative;
  z-index: 1;
  background: var(--surface-primary);
  border-radius: var(--radius-2xl);
  border: 2px solid var(--border-gold);
  padding: var(--space-12) var(--space-12) var(--space-10);
  text-align: center;
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-xl), var(--shadow-gold);
  animation: winner-reveal 0.8s var(--ease-spring) both;
}
.winner-crown {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: var(--space-4);
  display: block;
  animation: crown-bounce 2s ease-in-out infinite;
}
.winner-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.winner-name {
  font-size: var(--text-5xl);
  font-weight: var(--weight-black);
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}
.winner-message {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}
.final-scores {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
  margin-bottom: var(--space-8);
}
.final-score-item {
  text-align: center;
}
.final-score-team {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-1);
}
.final-score-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  color: var(--text-gold);
}
.final-score-item.winner-score .final-score-value {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Confetti container */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  top: -20px;
  border-radius: 2px;
  animation: confetti-fall linear infinite;
}

/* ══════════════════════════════════════════════════════════════
   PAYMENT PAGE
   ══════════════════════════════════════════════════════════════ */
.payment-page {
  min-height: 100vh;
  padding: var(--space-8) var(--space-6);
}
.payment-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: var(--space-8);
  max-width: 900px;
  margin-inline: auto;
  align-items: start;
}
.payment-summary-card {
  position: sticky;
  top: 100px;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE (tablet / large phone)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .payment-layout {
    grid-template-columns: 1fr;
  }
  .payment-summary-card { position: static; }
  .setup-teams {
    grid-template-columns: 1fr;
  }
  .game-board {
    gap: 5px;
  }
  .question-cell { height: 44px; }
  .question-cell-value { font-size: var(--text-sm); }
  .game-bottom {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 700px) {
  .topbar-title { font-size: var(--text-lg); }
  .topbar-subtitle { display: none; }
  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .dashboard-sections {
    grid-template-columns: 1fr;
  }
  .final-scores { gap: var(--space-4); }
  .winner-name { font-size: var(--text-4xl); }
}

/* ══════════════════════════════════════════════════════════════
   GAME HEADER STRIP
   ══════════════════════════════════════════════════════════════ */
.game-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
  min-height: 72px;
}

.game-header-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-width: 140px;
  padding: var(--space-1) var(--space-2);
}

.hdr-team-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: rgba(255,255,255,0.80);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.hdr-score-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.hdr-score {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  color: var(--gold-300);
  min-width: 52px;
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1;
}

.adj-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 1.5px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background var(--t-fast), transform var(--t-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.adj-btn:hover   { background: rgba(255,255,255,0.18); transform: scale(1.1); }
.adj-btn:active  { transform: scale(0.92); }
.adj-plus  { color: #6EE89A; border-color: rgba(110,232,154,0.35); }
.adj-minus { color: #FF8080; border-color: rgba(255,128,128,0.35); }

/* Center: title + turn + buttons */
.game-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  flex: 1;
}

.game-main-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  color: rgba(255,255,255,0.90);
  letter-spacing: 0.03em;
  line-height: 1;
}

.turn-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.turn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.20);
  border: 1.5px solid rgba(255,255,255,0.25);
  transition: background 0.3s, transform 0.3s;
  flex-shrink: 0;
}
.turn-dot.active-dot {
  background: var(--gold-400);
  border-color: var(--gold-300);
  box-shadow: 0 0 8px rgba(200,164,40,0.70);
  transform: scale(1.3);
}
.turn-dot.inactive-dot {
  background: rgba(255,255,255,0.12);
}

.turn-text {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: rgba(255,255,255,0.70);
  white-space: nowrap;
}

.hdr-btn-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.hdr-switch-btn,
.hdr-end-btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  font-family: var(--font-primary);
  cursor: pointer;
  border: 1.5px solid;
  transition: all var(--t-fast) var(--ease-spring);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.hdr-switch-btn {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.22);
}
.hdr-switch-btn:hover {
  background: rgba(255,255,255,0.18);
  transform: scale(1.03);
}

.hdr-end-btn {
  background: rgba(220,40,60,0.15);
  color: #FF8090;
  border-color: rgba(220,40,60,0.35);
}
.hdr-end-btn:hover {
  background: rgba(220,40,60,0.28);
  transform: scale(1.03);
}
.hdr-switch-btn:active,
.hdr-end-btn:active {
  transform: scale(0.95);
}

/* ══════════════════════════════════════════════════════════════
   GAME FOOTER
   ══════════════════════════════════════════════════════════════ */
.game-footer {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(0,0,0,0.25);
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  min-height: 90px;
}

/* Character avatar */
.team-char-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.team-char-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.char-placeholder {
  font-size: 1.5rem;
  color: rgba(255,255,255,0.35);
}

.bonus-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  background: var(--gold-gradient);
  color: var(--text-primary);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
  animation: pulse-soft 1.5s ease-in-out infinite;
}

/* Sponsor / Aids zone — center of footer */
.sponsor-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
}

.aids-trigger-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4);
  color: rgba(255,255,255,0.70);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--t-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.aids-trigger-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.90);
}

.aids-arrow-icon {
  font-size: var(--text-sm);
  transition: transform 0.3s var(--ease-smooth);
}

.sponsor-frame {
  width: 100%;
  max-width: 260px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.sponsor-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
}

.sponsor-logo-placeholder {
  font-size: 2rem;
  flex-shrink: 0;
}

.sponsor-text-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sponsor-title-text {
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.04em;
}

.sponsor-sub-text {
  font-size: 10px;
  color: rgba(255,255,255,0.40);
  font-weight: var(--weight-medium);
}

/* ══════════════════════════════════════════════════════════════
   AIDS PANEL (slides up over footer)
   ══════════════════════════════════════════════════════════════ */
.aids-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, #1E0A40 0%, #160830 100%);
  border-top: 1.5px solid rgba(200,164,40,0.30);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-4) var(--space-6) var(--space-6);
  z-index: var(--z-raised);
  transform: translateY(110%);
  transition: transform 0.4s var(--ease-spring);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.50);
}
.aids-panel.open {
  transform: translateY(0);
}

.aids-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.aids-panel-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
  color: rgba(255,255,255,0.90);
}

.aids-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.70);
  font-size: var(--text-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  touch-action: manipulation;
}
.aids-close-btn:hover {
  background: rgba(255,80,80,0.20);
  color: #FF8080;
}

.aids-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.aid-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.aid-card:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(200,164,40,0.35);
}

.aid-icon {
  font-size: 2rem;
  line-height: 1;
}
.aid-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: rgba(255,255,255,0.85);
}
.aid-desc {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  font-weight: var(--weight-medium);
  line-height: 1.4;
}
.aid-use-btn {
  font-size: var(--text-xs) !important;
  padding: var(--space-1) var(--space-3) !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.aid-use-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════════
   QUESTION OVERLAY — new "q-" class names
   ══════════════════════════════════════════════════════════════ */
.q-overlay {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: min(680px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  z-index: calc(var(--z-modal) + 1);
  animation: modal-card-in var(--t-slow) var(--ease-spring) both;
}

.q-modal-header {
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.q-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.q-category-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.70);
  font-weight: var(--weight-medium);
}

.q-difficulty-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.30);
  color: rgba(255,255,255,0.90);
  background: rgba(255,255,255,0.10);
  width: fit-content;
}

.q-points-label {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  color: var(--gold-200);
  letter-spacing: -0.02em;
}

.q-timer-area {
  display: flex;
  justify-content: center;
  padding: var(--space-4) var(--space-4) 0;
}

.q-text-area {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: var(--leading-snug);
  text-align: center;
  padding: var(--space-4) var(--space-6) var(--space-2);
}

.q-image-wrap,
.q-answer-image-wrap {
  margin: 0 var(--space-6) var(--space-3);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid rgba(155,89,182,0.35);
  cursor: zoom-in;
  position: relative;
  max-height: 240px;
  background: #0a0e1a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.q-image-wrap img,
.q-answer-image-wrap img {
  width: 100%;
  max-height: 236px;
  object-fit: contain;
  transition: transform 0.3s;
}
.q-image-wrap:hover img,
.q-answer-image-wrap:hover img { transform: scale(1.04); }

.q-zoom-hint {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  background: rgba(0,0,0,0.60);
  color: #fff;
  font-size: var(--text-xs);
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
}

.q-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6) var(--space-5);
  gap: var(--space-3);
}

.q-back-btn  { flex-shrink: 0; }
.q-flip-btn  { flex: 1; }

.q-answer-text {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--purple-500);
  text-align: center;
  padding: var(--space-6) var(--space-6) var(--space-3);
  line-height: var(--leading-snug);
}

/* Team select area */
.team-select-area {
  padding: var(--space-2) var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.team-select-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  text-align: center;
}

.team-select-btns {
  display: flex;
  gap: var(--space-3);
  width: 100%;
}

.team-select-btn {
  flex: 1;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-xl);
  font-size: var(--text-base);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  background: var(--gold-gradient-btn);
  border: 2px solid var(--gold-400);
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast) var(--ease-spring);
  box-shadow: var(--shadow-gold);
  font-family: var(--font-primary);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.team-select-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 28px rgba(200,164,40,0.45);
}
.team-select-btn:active { transform: scale(0.97); }

.no-answer-btn {
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  font-family: var(--font-primary);
  font-weight: var(--weight-medium);
  transition: color var(--t-fast);
  touch-action: manipulation;
  padding: var(--space-1) var(--space-2);
}
.no-answer-btn:hover { color: var(--text-error); }

/* Flag / Report button */
.flag-report-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  color: rgba(255,255,255,0.80);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--t-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.flag-report-btn:hover {
  background: rgba(255,80,80,0.22);
  border-color: rgba(255,80,80,0.45);
  color: #FF9090;
}
.flag-report-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ══════════════════════════════════════════════════════════════
   FLIP CARD
   ══════════════════════════════════════════════════════════════ */
.flip-card-scene {
  perspective: 1200px;
}

.flip-card {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.flip-card.flipped {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  width: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-card-back {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotateY(180deg);
  background: var(--surface-primary);
  border-radius: var(--radius-2xl);
}

/* Score pop animation */
.score-pop {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 99;
  animation: score-fly-up 1.2s var(--ease-out) both;
  white-space: nowrap;
}

/* Board column image */
.board-col-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-1);
}

/* ══════════════════════════════════════════════════════════════
   CHARACTER SELECTION (setup-game)
   ══════════════════════════════════════════════════════════════ */
.char-selection-row {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: var(--space-5);
  align-items: start;
}

.team-char-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-primary);
  border-radius: var(--radius-xl);
  border: 2px solid rgba(255,200,87,0.35);
  box-shadow: var(--shadow-sm);
}

.team-char-label {
  font-size: var(--text-base);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  text-align: center;
}

.selected-char-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

/* Class name retained for backward compatibility; now renders as a
   rounded SQUARE that matches the character cards in the grid. */
.char-preview-circle {
  width: 112px;
  height: 112px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--border-medium);
  background: var(--surface-primary);
}
.char-preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.char-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.char-turn-indicator {
  text-align: center;
  padding: var(--space-2) var(--space-4);
  background: var(--surface-glass);
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-gold);
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
}

.char-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-light);
  background: var(--surface-secondary);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-spring);
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.char-card:hover {
  border-color: var(--char-color, var(--purple-400));
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.char-card:active { transform: scale(0.96); }

/* Team 1 = Gold (matches in-game team panel 1) */
.char-card.selected-t1 {
  border-color: var(--brand-gold-deep, #E6A92B);
  background: rgba(255,200,87,0.12);
  box-shadow: 0 0 0 2px rgba(230,169,43,0.35);
}
/* Team 2 = Teal (matches in-game team panel 2) */
.char-card.selected-t2 {
  border-color: var(--brand-teal-deep, #1FA88C);
  background: rgba(46,230,197,0.12);
  box-shadow: 0 0 0 2px rgba(31,168,140,0.35);
}

/* Avatar is now a rounded SQUARE (per user request). */
.char-card-avatar {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-primary);
}
.char-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Character already taken by the other team — fade + lock pointer */
.char-card.taken-other {
  opacity: 0.45;
  filter: saturate(0.75);
  cursor: not-allowed;
}
.char-card.taken-other:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-light);
}

.char-card-name {
  font-size: 13px;
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
}

.char-card-team-indicator {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: var(--weight-extrabold);
  color: #fff;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
  z-index: 2;
}

/* Locked character — season-pass reward */
.char-card.locked {
  cursor: not-allowed;
  opacity: 0.65;
  filter: grayscale(0.75);
  pointer-events: auto;
}
.char-card.locked:hover {
  transform: none;
  box-shadow: none;
}
.char-locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(60, 40, 20, 0.55);
  backdrop-filter: blur(2px);
  border-radius: inherit;
  color: #FFF;
  z-index: 3;
}
.char-locked-ico { font-size: 1.6rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.char-locked-text { font-size: 11px; font-weight: 800; }

/* ══════════════════════════════════════════════════════════════
   TOUCH OPTIMIZATIONS
   ══════════════════════════════════════════════════════════════ */
@media (hover: none) {
  .btn:hover::after       { transform: none; }
  .question-cell:hover    { transform: none; }
  .char-card:hover        { transform: none; box-shadow: none; }
  .team-select-btn:hover  { transform: none; box-shadow: var(--shadow-gold); }
  .adj-btn:hover          { transform: none; }
}

/* Landscape tablets / iPad / desktop */
@media (min-width: 768px) and (orientation: landscape) {
  .game-header {
    padding: var(--space-2) var(--space-6);
    min-height: 68px;
  }
  .game-footer {
    min-height: 86px;
    padding: var(--space-2) var(--space-6);
  }
  .aids-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .team-char-avatar {
    width: 64px;
    height: 64px;
  }
  .hdr-score {
    font-size: var(--text-3xl);
    min-width: 64px;
  }
}

/* Portrait / small screens */
@media (max-width: 640px) {
  .game-header {
    padding: var(--space-1) var(--space-2);
    min-height: 64px;
  }
  .game-header-team { min-width: 110px; }
  .hdr-team-name { font-size: var(--text-xs); max-width: 110px; }
  .hdr-score { font-size: var(--text-xl); }
  .game-main-title { font-size: var(--text-base); }
  .hdr-switch-btn, .hdr-end-btn { font-size: 11px; padding: 4px var(--space-2); }
  .game-footer { padding: var(--space-1) var(--space-2); min-height: 80px; }
  .team-char-avatar { width: 46px; height: 46px; }
  .aids-grid { grid-template-columns: repeat(2, 1fr); }
  .sponsor-frame { display: none; }
  .char-selection-row {
    grid-template-columns: 1fr;
  }
  .char-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }
  .q-text-area { font-size: var(--text-lg); }
  .q-answer-text { font-size: var(--text-xl); }
}

/* ══════════════════════════════════════════════════════════════
   NEW GAME PAGE — Fixed Viewport Layout (.gp-* prefix)
   Light colors matching the app palette.
   Teams on left/right sides, board fills center.
   ══════════════════════════════════════════════════════════════ */

/* Root — fills screen exactly, no scroll */
.gp-root {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--gradient-main);
  overflow: hidden;
  font-family: var(--font-primary);
}

/* ── TOP BAR ── */
.gp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3);
  height: 52px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.70);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  gap: var(--space-2);
}

.gp-end-btn {
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  color: #C02040;
  background: rgba(200,32,64,0.08);
  border: 1.5px solid rgba(200,32,64,0.25);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-fast);
  touch-action: manipulation;
  min-width: 110px;
}
.gp-end-btn:hover   { background: rgba(200,32,64,0.15); transform: scale(1.03); }
.gp-end-btn:active  { transform: scale(0.96); }

.gp-title-block {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.gp-game-name {
  font-size: var(--text-base);
  font-weight: var(--weight-black);
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.1;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gp-turn-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.gp-switch-btn {
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  color: var(--purple-500);
  background: rgba(124,80,216,0.08);
  border: 1.5px solid rgba(124,80,216,0.25);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-fast);
  touch-action: manipulation;
  min-width: 110px;
}
.gp-switch-btn:hover  { background: rgba(124,80,216,0.16); transform: scale(1.03); }
.gp-switch-btn:active { transform: scale(0.96); }

/* ── MAIN AREA ── */
.gp-main {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* ── SIDE PANELS ── */
.gp-side-panel {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2) var(--space-1) var(--space-2);
  gap: var(--space-1);
  background: rgba(255,255,255,0.72);
  border: 1.5px solid var(--border-light);
  transition: border-color 0.4s, background 0.4s, box-shadow 0.4s;
  overflow: hidden;
  position: relative;
}

.gp-panel-2 {
  border-left: none;
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}
.gp-panel-1 {
  border-right: none;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

/* Active turn highlight */
.gp-side-panel.active-turn {
  background: rgba(248,240,200,0.80);
  border-color: var(--gold-400);
  box-shadow: 0 0 0 2px rgba(200,164,40,0.20), var(--shadow-md);
}

/* On-fire effect when streak is full */
.gp-side-panel.on-fire {
  animation: fire-glow 1.8s ease-in-out infinite;
  border-color: rgba(255,100,0,0.75) !important;
  background: rgba(255,240,200,0.80) !important;
}
.gp-side-panel.on-fire .gp-panel-name {
  animation: fire-text 1.8s ease-in-out infinite;
  color: #C04010 !important;
}
.gp-side-panel.on-fire .gp-panel-score {
  animation: fire-score 1.8s ease-in-out infinite;
}

/* ── CHARACTER AVATAR ── */
.gp-char-frame {
  position: relative;
  flex-shrink: 0;
}

.gp-char-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border-medium);
  background: var(--purple-50);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: border-color 0.4s;
}
.active-turn .gp-char-avatar {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(200,164,40,0.25);
}
.on-fire .gp-char-avatar {
  border-color: rgba(255,100,0,0.80);
  box-shadow: 0 0 16px rgba(255,80,0,0.55);
}

.gp-char-glow {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(circle, rgba(255,120,0,0.35) 0%, transparent 70%);
}
.on-fire .gp-char-glow { opacity: 1; animation: fire-glow 1.8s ease-in-out infinite; }

.gp-char-placeholder {
  font-size: 1.8rem;
  color: var(--text-muted);
}

/* ── PANEL NAME + SCORE ── */
.gp-panel-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  max-width: 110px;
  word-break: break-word;
  hyphens: auto;
  transition: color 0.4s;
}

.gp-panel-score {
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  color: var(--text-gold);
  letter-spacing: -0.03em;
  line-height: 1;
  transition: color 0.4s;
}

/* ── SCORE ADJUSTMENT ── */
.gp-adj-row {
  display: flex;
  gap: var(--space-2);
}

.gp-adj-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-medium);
  background: var(--surface-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all var(--t-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.gp-adj-btn:active { transform: scale(0.88); }
.gp-adj-plus  { color: var(--text-success); border-color: rgba(26,120,64,0.30); }
.gp-adj-minus { color: var(--text-error);   border-color: rgba(208,32,64,0.30); }
.gp-adj-plus:hover  { background: rgba(26,120,64,0.08); }
.gp-adj-minus:hover { background: rgba(208,32,64,0.08); }

/* ── VERTICAL STREAK BAR ── */
.gp-streak-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  min-height: 0;
  justify-content: flex-end;
  padding-bottom: var(--space-1);
}

.gp-streak-label {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.gp-streak-bar {
  display: flex;
  flex-direction: column-reverse; /* segments grow from bottom */
  gap: 3px;
  width: 18px;
  align-items: center;
}

.gp-streak-seg {
  width: 16px;
  border-radius: var(--radius-full);
  background: var(--streak-empty);
  border: 1px solid rgba(160,140,200,0.25);
  transition: background 0.35s var(--ease-spring), transform 0.35s var(--ease-spring),
              box-shadow 0.35s;
  flex-shrink: 0;
}
.gp-streak-seg.filled {
  background: var(--seg-color, var(--gold-300));
  border-color: var(--seg-color, var(--gold-400));
  transform: scaleX(1.2);
  box-shadow: 0 0 5px var(--seg-color, rgba(200,164,40,0.5));
}
/* Full bar pulsing */
.gp-streak-bar.streak-full .gp-streak-seg.filled {
  animation: fire-score 1.5s ease-in-out infinite;
}

.gp-bonus-badge {
  font-size: 10px;
  font-weight: var(--weight-extrabold);
  background: var(--gold-gradient);
  color: var(--text-primary);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
  animation: pulse-soft 1.4s ease-in-out infinite;
}

/* ── CENTER BOARD ── */
.gp-board-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: var(--space-2) var(--space-1);
  display: flex;
  flex-direction: column;
}

/* The board: 6 columns, fills full height */
.gp-board {
  display: flex;
  gap: 4px;
  height: 100%;
  min-height: 0;
}

/* Each column is a flex column — header + cells fill height */
.gp-board .board-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gp-board .board-column-header {
  flex-shrink: 0;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.gp-board .board-column-emoji { font-size: 1.3rem; line-height: 1; }
.gp-board .board-col-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.gp-board .board-column-name {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Question cells — fill remaining height equally */
.gp-board .question-cell {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-spring),
              box-shadow var(--t-fast),
              border-color var(--t-fast),
              background var(--t-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* Colors by difficulty — light app palette */
.gp-board .question-cell[data-difficulty="easy"] {
  background: linear-gradient(135deg, #EDE4FF 0%, #D8C8FF 100%);
  border-color: rgba(124,80,216,0.20);
}
.gp-board .question-cell[data-difficulty="medium"] {
  background: linear-gradient(135deg, #C8A4F8 0%, #9B60E8 100%);
  border-color: rgba(124,80,216,0.35);
}
.gp-board .question-cell[data-difficulty="hard"] {
  background: linear-gradient(135deg, #7C40C8 0%, #501890 100%);
  border-color: rgba(80,24,144,0.50);
}

.gp-board .question-cell.available:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(80,30,160,0.30);
  border-color: var(--gold-400) !important;
  z-index: 2;
}
.gp-board .question-cell.available:active { transform: scale(0.95); }

.gp-board .question-cell.used {
  background: rgba(160,140,200,0.10) !important;
  border-color: rgba(160,140,200,0.15) !important;
  cursor: default;
  opacity: 0.4;
}
.gp-board .question-cell.locked {
  background: rgba(160,140,200,0.08) !important;
  border-color: rgba(160,140,200,0.12) !important;
  cursor: not-allowed;
  opacity: 0.35;
}

.gp-board .question-cell-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-black);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
  letter-spacing: -0.02em;
  line-height: 1;
}
.gp-board .question-cell[data-difficulty="easy"] .question-cell-value {
  color: var(--purple-600);
  text-shadow: 0 1px 2px rgba(80,24,144,0.20);
}

/* Score pop on panels */
.gp-score-pop {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 99;
  animation: score-fly-up 1.3s var(--ease-out) both;
  white-space: nowrap;
  color: var(--gold-400);
}

/* ── BOTTOM STRIP (sponsor + aids) ── */
.gp-bottom-strip {
  flex-shrink: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: rgba(255,255,255,0.60);
  border-top: 1px solid var(--border-light);
  gap: var(--space-3);
}

.gp-aids-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--font-primary);
  white-space: nowrap;
  touch-action: manipulation;
}
.gp-aids-btn:hover { background: var(--surface-primary); border-color: var(--border-medium); }

.gp-sponsor-mini {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(255,255,255,0.60);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
}

.gp-sponsor-text {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── QUESTION OVERLAY — larger ── */
.q-overlay {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  z-index: calc(var(--z-modal) + 1);
  animation: modal-card-in var(--t-slow) var(--ease-spring) both;
}

/* Timer display — large centered number */
.timer-display {
  font-size: var(--text-4xl) !important;
  font-weight: var(--weight-black) !important;
  color: var(--purple-500);
  text-align: center;
  line-height: 1;
  letter-spacing: -0.03em;
}
.timer-display.warning  { color: #D08020 !important; }
.timer-display.negative { color: #D02040 !important; font-size: var(--text-3xl) !important; }

/* ── HISTORY PAGE ── */
.history-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.history-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.history-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.history-game-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
}

.history-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.history-teams-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.history-team {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-xl);
  background: var(--surface-ivory);
  border: 1.5px solid var(--border-light);
  position: relative;
}
.history-team.history-winner {
  background: var(--gold-100);
  border-color: var(--border-gold);
  box-shadow: var(--shadow-gold);
}

.history-team-info {
  flex: 1;
  min-width: 0;
}
.history-team-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-team-score {
  font-size: var(--text-base);
  font-weight: var(--weight-black);
  color: var(--text-gold);
}

.history-crown {
  font-size: 1.4rem;
  animation: crown-bounce 2s ease-in-out infinite;
  flex-shrink: 0;
}

.history-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.history-vs-text {
  font-size: var(--text-xs);
  font-weight: var(--weight-black);
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.history-result-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.history-categories {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.history-cat-chip {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  background: var(--purple-50);
  border: 1px solid var(--purple-100);
  border-radius: var(--radius-full);
  padding: 3px var(--space-3);
  white-space: nowrap;
}

.history-card-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
}
.history-replay-btn { min-width: 130px; }

/* ── RESPONSIVE (phone portrait) ── */
@media (max-width: 480px) {
  .gp-topbar { height: 46px; padding: 0 var(--space-2); }
  .gp-end-btn, .gp-switch-btn { font-size: 11px; padding: var(--space-1) var(--space-2); min-width: 80px; }
  .gp-game-name { font-size: var(--text-sm); max-width: 140px; }
  .gp-side-panel { width: 70px; padding: var(--space-1); gap: 3px; }
  .gp-char-avatar { width: 50px; height: 50px; }
  .gp-panel-name { font-size: 9px; }
  .gp-panel-score { font-size: var(--text-xl); }
  .gp-adj-btn { width: 22px; height: 22px; font-size: var(--text-sm); }
  .gp-streak-bar { width: 12px; }
  .gp-streak-seg { width: 10px; }
  .gp-board-wrap { padding: var(--space-1) 2px; }
  .gp-board { gap: 2px; }
  .gp-board .board-column { gap: 2px; }
  .gp-board .board-column-emoji { font-size: 1rem; }
  .gp-board .board-column-name { font-size: 8px; }
  .gp-board .question-cell-value { font-size: 11px; }
  .gp-bottom-strip { height: 34px; }
  .history-teams-row { flex-direction: column; }
}

@media (max-width: 360px) {
  .gp-side-panel { width: 56px; }
  .gp-char-avatar { width: 40px; height: 40px; }
  .gp-streak-bar { display: none; }
}
