@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;900&display=swap');

:root {
  --gold:    #d9ad27;
  --gold-dk: #b8901e;
  --black:   #000000;
  --white:   #ffffff;
  --card:    #0d0d0d;
  --card2:   #161616;
  --card3:   #1e1e1e;
  --border:  #2c2c2c;
  --grey:    #666;
  --grey2:   #999;
  --success: #22c55e;
  --warning: #f59e0b;
  --error:   #ef4444;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Montserrat', sans-serif;
  background: #050505;
  color: var(--white);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
.hidden { display: none !important; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--card); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-body { padding-top: 72px; padding-bottom: 3rem; }

/* ── Navigation ─────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: 64px; background: #000;
  border-bottom: 2px solid var(--gold);
  display: flex; align-items: center;
}
.nav-inner {
  max-width: 1200px; width: 100%; margin: 0 auto; padding: 0 1.25rem;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
}
.nav-logo { display: flex; align-items: center; gap: 0.6rem; }
.nav-logo img { height: 34px; }
.nav-logo-text { font-weight: 900; font-size: 1rem; color: var(--gold); letter-spacing: 0.04em; white-space: nowrap; }

/* Timer always-visible in nav center */
.nav-timer-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(217,173,39,0.08); border: 1px solid rgba(217,173,39,0.25);
  border-radius: 8px; padding: 0.2rem 1.2rem; min-width: 110px;
}
.nav-timer-label { font-size: 0.55rem; font-weight: 700; color: var(--gold); letter-spacing: 0.15em; text-transform: uppercase; line-height: 1; }
#hub-timer, #admin-timer { font-family: 'Courier New', monospace; font-weight: 900; font-size: 1.6rem; letter-spacing: 0.08em; line-height: 1.1; }
#hub-timer.warning, #admin-timer.warning { color: var(--warning); }
#hub-timer.danger,  #admin-timer.danger  { color: var(--error); animation: pulseRed 0.8s infinite; }
@keyframes pulseRed { 0%,100%{opacity:1} 50%{opacity:0.4} }

.nav-right { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; }
.nav-racer { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.9rem; }
.avatar-badge { font-size: 1.4rem; line-height: 1; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.6rem 1.25rem; border-radius: 6px; font-family: inherit;
  font-weight: 700; font-size: 0.88rem; cursor: pointer; border: none;
  transition: opacity 0.15s, transform 0.1s; white-space: nowrap;
}
.btn:hover:not(:disabled) { opacity: 0.85; transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); opacity: 1; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gold);    color: var(--black); }
.btn-dark    { background: var(--card3);   color: var(--white); border: 1px solid var(--border); }
.btn-danger  { background: var(--error);   color: var(--white); }
.btn-sm  { padding: 0.38rem 0.85rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-done { opacity: 0.4; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; }
.card-gold { border-color: var(--gold); }
.card-title { font-weight: 900; font-size: 0.75rem; color: var(--gold); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* ── Typography helpers ──────────────────────────────────── */
.gold-text { color: var(--gold); }
.grey-text { color: var(--grey); }

/* ── STATUS BANNER ───────────────────────────────────────── */
.status-banner {
  background: linear-gradient(90deg, rgba(217,173,39,0.12) 0%, rgba(217,173,39,0.06) 100%);
  border: 1px solid rgba(217,173,39,0.2); border-radius: 8px;
  padding: 0.7rem 1.25rem; margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.status-indicator { width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex-shrink: 0; }
.status-indicator.active { background: var(--success); animation: statusPulse 2s infinite; }
.status-indicator.racing { background: var(--gold); animation: statusPulse 1s infinite; }
@keyframes statusPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.6;transform:scale(0.85)} }
#game-status-text { font-weight: 700; font-size: 0.95rem; }

/* ── SECTION HEADINGS ────────────────────────────────────── */
.section-heading {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 900; font-size: 1rem; color: var(--white);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
}
.section-heading::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ══ HUB LAYOUT ══════════════════════════════════════════════ */

/* ── LEG GRID (3-3-1) ────────────────────────────────────── */
.legs-section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
.leg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  max-width: 580px;
  margin: 0 auto;
}
.leg-grid .leg-box:nth-child(7) { grid-column: 2; }

/* ── LEG FLIP CARDS ──────────────────────────────────────── */
.leg-box { perspective: 900px; cursor: default; }
.leg-box-inner {
  width: 100%; padding-top: 100%; /* square */
  position: relative; transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.175,0.885,0.32,1.275);
}
.leg-box.revealed .leg-box-inner { transform: rotateY(180deg); }
.leg-box-front, .leg-box-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.3rem;
  border: 1px solid var(--border); padding: 0.5rem;
}
.leg-box-front { background: var(--card2); }
.leg-box-back  { background: linear-gradient(135deg, var(--gold) 0%, #a07a10 100%); color: var(--black); transform: rotateY(180deg); text-align: center; }
.leg-num  { font-size: 0.65rem; font-weight: 700; color: var(--grey2); text-transform: uppercase; letter-spacing: 0.06em; }
.leg-box-back .leg-num { color: rgba(0,0,0,0.5); }
.leg-flag-img { width: 52px; height: 52px; object-fit: contain; }
.leg-q { font-size: 1.6rem; color: #333; }
/* Flag emoji in revealed back face */
.leg-flag-emoji {
  font-size: 2.6rem; line-height: 1; margin: 0.15rem 0;
  animation: none;
}
.leg-box.revealed .leg-flag-emoji {
  animation: flagPop 0.45s cubic-bezier(0.175,0.885,0.32,1.275) 0.45s both;
}
@keyframes flagPop {
  0%  { transform: scale(0) rotate(-15deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(3deg); }
  100%{ transform: scale(1) rotate(0deg); opacity: 1; }
}

.leg-country-name { font-size: 0.82rem; font-weight: 900; line-height: 1.25; text-align: center; }

/* LIVE indicator on active leg box */
.live-badge {
  display: none;
  position: absolute; top: 5px; right: 5px;
  background: var(--error); color: var(--white);
  font-size: 0.48rem; font-weight: 900; letter-spacing: 0.1em;
  padding: 2px 5px; border-radius: 3px;
  animation: livePulse 1s infinite;
}
.leg-box.active-leg .live-badge { display: block; }

/* Active leg: gold glow pulse */
.leg-box.active-leg .leg-box-back {
  box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(217,173,39,0.6);
  animation: goldGlow 2s ease-in-out infinite;
}
@keyframes goldGlow {
  0%,100% { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(217,173,39,0.5); }
  50%     { box-shadow: 0 0 0 2px var(--gold), 0 0 38px rgba(217,173,39,0.9); }
}

/* Completed/revealed (non-active) leg: subtle gold border */
.leg-box.revealed:not(.active-leg) .leg-box-back {
  box-shadow: 0 0 0 1px rgba(217,173,39,0.3);
}

@keyframes livePulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* ── COUNTDOWN OVERLAY ───────────────────────────────────── */
.countdown-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
.countdown-content { padding: 2rem; }
.countdown-country-display {
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  font-weight: 900; color: var(--white); margin-bottom: 0.4rem;
  line-height: 1.2;
}
.countdown-label {
  font-size: 0.85rem; color: var(--grey2); margin-bottom: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.14em;
}
.countdown-number {
  font-size: clamp(7rem, 20vw, 12rem);
  font-weight: 900; color: var(--gold); line-height: 1;
  text-shadow: 0 0 80px rgba(217,173,39,0.85);
}
.countdown-number.pop {
  animation: cdPop 0.7s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes cdPop {
  0%   { transform: scale(1.7); opacity: 0; filter: blur(6px); }
  55%  { transform: scale(0.95); opacity: 1; filter: blur(0); }
  100% { transform: scale(1); }
}

/* ── HUB 2-COL GRID ──────────────────────────────────────── */
.hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 780px) { .hub-grid { grid-template-columns: 1fr; } }

/* ── LEADERBOARD ─────────────────────────────────────────── */
.lb-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.lb-table th { text-align: left; padding: 0.45rem 0.7rem; font-size: 0.7rem; color: var(--grey); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.05em; }
.lb-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid rgba(44,44,44,0.5); }
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-row.me td { background: rgba(217,173,39,0.08); }
.lb-rank { font-weight: 900; color: var(--gold); min-width: 30px; }
.lb-rank-1 { color: #FFD700; font-size: 1.05rem; }
.lb-rank-2 { color: #C0C0C0; }
.lb-rank-3 { color: #CD7F32; }
.lb-score { font-weight: 700; color: var(--gold); text-align: right; }
.lb-placeholder { text-align: center; padding: 2rem 1rem; }
.lb-placeholder-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.lb-placeholder-text { color: var(--grey2); font-weight: 600; font-size: 0.9rem; }

/* ── PUZZLE BOARD ────────────────────────────────────────── */
.puzzle-wrap { max-width: 480px; margin: 0 auto; }

/* 3 × 2 grid — one cell per leg (legs 1-6) */
.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.puzzle-cell {
  aspect-ratio: 1;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.4s, box-shadow 0.4s;
}
/* Piece revealed by any racer — grey border */
.puzzle-cell.revealed {
  background: #000;
  border-color: rgba(255,255,255,0.18);
  box-shadow: none;
}
/* Piece personally earned by THIS racer — gold border + glow */
.puzzle-cell.mine {
  border-color: var(--gold) !important;
  box-shadow: 0 0 16px rgba(217,173,39,0.45) !important;
}

/* The actual puzzle-piece image */
.puzzle-piece-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Empty-slot placeholder — lock icon only, no text */
.piece-placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.piece-lock { font-size: 1.5rem; color: #444; user-select: none; }

.puzzle-cell.animate-in { animation: pieceReveal 0.8s ease forwards; }
@keyframes pieceReveal { 0%{opacity:0;filter:brightness(3) scale(0.7)} 60%{filter:brightness(1.4) scale(1.05)} 100%{opacity:1;filter:brightness(1) scale(1)} }

/* ── MODAL OVERLAY ───────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.97); display: flex; flex-direction: column; overflow-y: auto; }
.modal-header  { background: #000; border-bottom: 3px solid var(--gold); padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; gap: 1rem; }
.modal-title   { font-weight: 900; font-size: 1.1rem; color: var(--gold); }
.modal-timer-bar .timer-display { font-family: 'Courier New', monospace; font-weight: 900; font-size: 1.5rem; letter-spacing: 0.08em; }
.modal-body    { max-width: 720px; width: 100%; margin: 0 auto; padding: 2rem 1.5rem; flex: 1; }

/* ── STEP DOTS ───────────────────────────────────────────── */
.step-indicator { display: flex; gap: 0.4rem; padding: 0.65rem 1.5rem; background: var(--card2); border-bottom: 1px solid var(--border); overflow-x: auto; }
.step-dot { min-width: 38px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 700; background: var(--border); color: var(--grey); transition: all 0.2s; flex-shrink: 0; }
.step-dot.active { background: var(--gold); color: var(--black); }
.step-dot.done   { background: var(--success); color: var(--black); }

/* ── QUIZ QUESTION ───────────────────────────────────────── */
.question-image-wrap { margin-bottom: 1.25rem; border-radius: 10px; overflow: hidden; max-height: 300px; }
.question-image { width: 100%; height: 300px; object-fit: cover; }
.question-text { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; line-height: 1.55; }
.answer-options { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 1rem; }
.answer-option { display: flex; align-items: center; gap: 0.7rem; padding: 0.8rem 1rem; border-radius: 8px; background: var(--card2); border: 2px solid var(--border); color: var(--white); font-family: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; transition: border-color 0.15s; width: 100%; }
.answer-option:hover:not(:disabled) { border-color: var(--gold); }
.answer-option.correct { border-color: var(--success); background: rgba(34,197,94,0.1); }
.answer-option.wrong   { border-color: var(--error);   background: rgba(239,68,68,0.08); }
.opt-label { min-width: 24px; height: 24px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.75rem; flex-shrink: 0; }
.fill-answer { display: flex; flex-direction: column; gap: 0.7rem; }
.fill-input { width: 100%; padding: 0.8rem 1rem; border-radius: 8px; background: var(--card2); border: 2px solid var(--border); color: var(--white); font-family: inherit; font-size: 1rem; }
.fill-input:focus { outline: none; border-color: var(--gold); }
.fill-hint { color: var(--grey2); font-size: 0.82rem; }
.feedback { padding: 0.7rem 1rem; border-radius: 8px; font-weight: 700; margin-top: 0.75rem; }
.feedback.correct { background: rgba(34,197,94,0.1); color: var(--success); }
.feedback.wrong   { background: rgba(239,68,68,0.08); color: var(--error); }
.feedback.winner-flash { background: rgba(217,173,39,0.15); color: var(--gold); font-size: 1.2rem; text-align: center; padding: 1.5rem; border: 1px solid var(--gold); border-radius: 10px; }
.lockout-timer { text-align: center; padding: 0.7rem; color: var(--error); font-weight: 700; font-size: 1.1rem; }

/* ── True / False quiz buttons ─── */
.tf-buttons { display: flex; gap: 1rem; margin-top: 1.25rem; }
.tf-btn {
  flex: 1; padding: 1.5rem 1rem; font-size: 1.25rem; font-weight: 900;
  border-radius: 12px; border: 3px solid transparent; cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
  font-family: 'Montserrat', sans-serif; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tf-btn:not(:disabled):hover { transform: scale(1.04); }
.tf-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.tf-true  { background: rgba(34,197,94,0.12); color: #22c55e; border-color: #22c55e; }
.tf-false { background: rgba(239,68,68,0.12); color: #ef4444; border-color: #ef4444; }
.tf-btn.correct { background: rgba(34,197,94,0.35); }
.tf-btn.wrong   { background: rgba(239,68,68,0.2); }

.photo-challenge { text-align: center; padding: 1rem 0; }
.photo-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.photo-instruction { color: #ccc; margin: 1rem 0; line-height: 1.7; }
.photo-upload { color: var(--gold); font-weight: 700; margin-bottom: 1.5rem; }
.photo-checkbox-label { display: flex; align-items: center; gap: 0.75rem; background: var(--card2); border: 2px solid var(--border); border-radius: 8px; padding: 0.9rem 1rem; cursor: pointer; margin: 0 auto 1.5rem; max-width: 440px; font-weight: 700; }
.photo-checkbox-label input { width: 18px; height: 18px; cursor: pointer; }
.final-image-wrap { margin-bottom: 1.25rem; border-radius: 10px; overflow: hidden; }
.final-image { width: 100%; max-height: 260px; object-fit: cover; }
.final-caption { background: rgba(217,173,39,0.08); border-left: 4px solid var(--gold); padding: 0.9rem; font-size: 0.86rem; line-height: 1.7; color: #ccc; }
.final-q-text { font-size: 1.15rem; font-weight: 700; margin: 1.2rem 0; line-height: 1.5; }
.final-options { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 1.2rem; }
.final-option { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.8rem 1rem; border-radius: 8px; background: var(--card2); border: 2px solid var(--border); cursor: pointer; font-size: 0.9rem; line-height: 1.5; transition: border-color 0.15s; }
.final-option:hover { border-color: var(--gold); }
.final-option input { margin-top: 2px; flex-shrink: 0; }

/* ── WINNER BANNER ───────────────────────────────────────── */
#winner-banner { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.96); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; }
.winner-announce { font-size: clamp(1.5rem,4.5vw,2.8rem); font-weight: 900; color: var(--gold); line-height: 1.3; position: relative; z-index: 2; text-shadow: 0 0 50px rgba(217,173,39,0.8); }
.confetti-container { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -12px; animation: confettiFall linear infinite; }
@keyframes confettiFall { 0%{transform:translateY(-12px) rotate(0deg);opacity:1} 100%{transform:translateY(110vh) rotate(720deg);opacity:0} }

/* ══ ADMIN ════════════════════════════════════════════════════ */
.admin-banner {
  background: linear-gradient(90deg, var(--gold) 0%, #b8901e 100%);
  color: var(--black); padding: 0.7rem 1.5rem;
  font-weight: 900; font-size: 0.9rem; text-align: center; letter-spacing: 0.06em;
  border-radius: 8px; margin-bottom: 1.5rem;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.admin-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 960px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-sidebar { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 80px; }
.control-group { display: flex; flex-direction: column; gap: 0.4rem; }
.ctrl-label { font-size: 0.65rem; color: var(--grey); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; margin-top: 0.4rem; }
.timer-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.timer-row .btn { flex: 1; }

/* Admin racer status table */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th { text-align: left; padding: 0.45rem 0.7rem; color: var(--grey); font-size: 0.68rem; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.admin-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid rgba(44,44,44,0.4); white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.status-badge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 600; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--black); padding: 2rem; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { height: 60px; margin: 0 auto 2rem; }
.login-title { text-align: center; color: var(--gold); font-weight: 900; font-size: 1.4rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--grey2); text-transform: uppercase; letter-spacing: 0.06em; }
.form-input { width: 100%; padding: 0.8rem 1rem; border-radius: 8px; background: var(--card2); border: 2px solid var(--border); color: var(--white); font-family: inherit; font-size: 1rem; }
.form-input:focus { outline: none; border-color: var(--gold); }
.login-error { background: rgba(239,68,68,0.08); border: 1px solid var(--error); border-radius: 6px; padding: 0.7rem 1rem; color: var(--error); font-size: 0.88rem; margin-bottom: 1rem; }
.login-btn { width: 100%; margin-top: 0.5rem; }

/* ── LANDING PAGE ────────────────────────────────────────── */
.hero-section { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: url('../hero.jpg') center/cover no-repeat; position: relative; text-align: center; padding: 2rem; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom,rgba(0,0,0,0.6),rgba(0,0,0,0.88)); }
.hero-content { position: relative; z-index: 2; max-width: 800px; }
.hero-logo { height: 80px; margin: 0 auto 2rem; }
.hero-headline { font-weight: 900; font-size: clamp(2rem,5vw,3.5rem); color: var(--gold); line-height: 1.1; margin-bottom: 1rem; }
.hero-sub { font-size: 1.3rem; font-weight: 700; margin-bottom: 1rem; }
.hero-intro { color: #ccc; font-size: 1rem; max-width: 580px; margin: 0 auto 2rem; line-height: 1.7; }
.section-landing { padding: 4rem 0; background: #060606; }
.section-title { text-align: center; margin-bottom: 2rem; }
.section-title h2 { font-weight: 900; font-size: 1.6rem; color: var(--gold); }
.leg-preview-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.landing-leg-box { width: 130px; height: 130px; perspective: 800px; }
.landing-leg-box .leg-box-inner { width: 100%; height: 100%; }

/* ══ WINNER'S MAT CALLOUT ════════════════════════════════════ */
.winners-mat-screen {
  position: relative; min-height: 100vh;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
}
.wm-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(217,173,39,0.18) 0%, transparent 70%);
  animation: wmGlowPulse 2s ease-in-out infinite;
}
@keyframes wmGlowPulse {
  0%,100% { opacity: 0.7; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.08); }
}
.wm-content {
  position: relative; z-index: 2;
  padding: 3rem 2rem; max-width: 680px; width: 100%;
  animation: fadeIn 0.5s ease;
}
.wm-flag {
  font-size: clamp(4rem, 12vw, 7rem); line-height: 1;
  margin-bottom: 1.5rem;
  animation: wmFlagWave 0.8s ease-in-out infinite alternate;
}
@keyframes wmFlagWave { 0%{transform:rotate(-8deg) scale(1)} 100%{transform:rotate(8deg) scale(1.1)} }
.wm-headline {
  font-weight: 900; font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--gold); line-height: 1.15; margin-bottom: 1.5rem;
  text-shadow: 0 0 60px rgba(217,173,39,0.7);
  letter-spacing: 0.02em;
}
.wm-body {
  font-size: clamp(1rem, 2.5vw, 1.25rem); color: #ddd;
  line-height: 1.7; margin-bottom: 1.5rem;
}
.wm-gold { color: var(--gold); font-weight: 900; }
.wm-cta {
  font-size: clamp(1.1rem, 3vw, 1.5rem); font-weight: 700;
  color: var(--white); margin-bottom: 2rem;
}
.wm-countdown-wrap {
  display: flex; align-items: center; justify-content: center;
}
.wm-countdown {
  font-size: clamp(4rem, 14vw, 8rem); font-weight: 900;
  color: var(--gold); line-height: 1;
  text-shadow: 0 0 80px rgba(217,173,39,0.9);
  transition: transform 0.15s;
}
.wm-tick {
  animation: wmTick 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes wmTick {
  0%   { transform: scale(1.5); opacity: 0.4; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ══ FINAL CHALLENGE SCREEN ══════════════════════════════════ */
.final-challenge-wrap {
  min-height: 100vh; background: #000;
  display: flex; flex-direction: column;
}
.fc-header {
  background: linear-gradient(90deg, #000 0%, rgba(217,173,39,0.12) 50%, #000 100%);
  border-bottom: 3px solid var(--gold);
  padding: 1.25rem 2rem; text-align: center;
  font-weight: 900; font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  color: var(--gold); letter-spacing: 0.06em;
  text-shadow: 0 0 40px rgba(217,173,39,0.6);
  position: sticky; top: 0; z-index: 10;
  animation: fadeIn 0.4s ease;
}
.fc-body {
  max-width: 760px; width: 100%; margin: 0 auto;
  padding: 2rem 1.5rem 3rem; flex: 1;
  animation: fadeIn 0.5s ease;
}
.fc-image-wrap {
  border-radius: 12px; overflow: hidden;
  margin-bottom: 1.25rem;
  border: 2px solid rgba(217,173,39,0.3);
  box-shadow: 0 0 40px rgba(217,173,39,0.2);
}
.fc-image {
  width: 100%; max-height: 340px; object-fit: cover; display: block;
}
.fc-caption {
  background: rgba(217,173,39,0.07);
  border-left: 4px solid var(--gold);
  padding: 0.9rem 1.1rem; border-radius: 0 6px 6px 0;
  font-size: 0.92rem; line-height: 1.7; color: #ccc;
  margin-bottom: 1.5rem;
}
.fc-question {
  font-weight: 900; font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--white); margin-bottom: 1.5rem; line-height: 1.4;
}
.fc-options {
  display: flex; flex-direction: column; gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.fc-answer-btn {
  width: 100%; padding: 1rem 1.25rem;
  background: var(--card2); border: 2px solid var(--border);
  border-radius: 10px; color: var(--white);
  font-family: 'Montserrat', sans-serif; font-size: 0.95rem; font-weight: 600;
  text-align: left; cursor: pointer; line-height: 1.5;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.fc-answer-btn:hover:not(:disabled) {
  border-color: var(--gold); background: rgba(217,173,39,0.07);
  transform: translateX(4px);
}
.fc-answer-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.fc-answer-btn.fc-btn-wrong {
  border-color: var(--error); background: rgba(239,68,68,0.1);
}
.fc-msg {
  padding: 0.8rem 1rem; border-radius: 8px;
  font-weight: 700; font-size: 1rem; margin-top: 0.5rem;
}
.fc-msg-wrong { background: rgba(239,68,68,0.1); color: var(--error); }
.fc-lockout-display {
  text-align: center; padding: 1rem;
  font-size: clamp(2rem, 8vw, 4rem); font-weight: 900;
  color: var(--error); line-height: 1;
  text-shadow: 0 0 30px rgba(239,68,68,0.5);
}

/* Already-won screen */
.fc-already-won {
  min-height: 100vh; background: #000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 3rem 2rem;
  animation: fadeIn 0.5s ease;
}
.fc-aw-flag { font-size: clamp(4rem,12vw,7rem); margin-bottom: 1.5rem; }
.fc-aw-name {
  font-weight: 900; font-size: clamp(1.4rem,4vw,2.2rem);
  color: var(--gold); line-height: 1.35; margin-bottom: 1rem;
  text-shadow: 0 0 40px rgba(217,173,39,0.6);
}
.fc-aw-sub {
  font-size: 1.1rem; color: #ccc; line-height: 1.7;
}

/* ══ WIN CELEBRATION (inside modal) ══════════════════════════ */
.win-celebration {
  position: relative; min-height: 100vh;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
}
.wc-confetti-wrap {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
.wc-content {
  position: relative; z-index: 2;
  padding: 3rem 2rem; max-width: 680px; width: 100%;
  animation: wcEntrance 0.6s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes wcEntrance {
  0%   { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}
.wc-trophy {
  font-size: clamp(5rem,15vw,9rem); line-height: 1;
  margin-bottom: 1rem;
  animation: wcTrophySpin 1.2s cubic-bezier(0.175,0.885,0.32,1.275) 0.3s both;
}
@keyframes wcTrophySpin {
  0%   { transform: rotate(-30deg) scale(0); opacity: 0; }
  70%  { transform: rotate(10deg)  scale(1.15); opacity: 1; }
  100% { transform: rotate(0deg)   scale(1); }
}
.wc-headline {
  font-weight: 900; font-size: clamp(1.6rem,5vw,3rem);
  color: var(--gold); line-height: 1.2; margin-bottom: 1rem;
  text-shadow: 0 0 80px rgba(217,173,39,0.9);
  letter-spacing: 0.03em;
  animation: wcFlash 1.5s ease 0.6s infinite alternate;
}
@keyframes wcFlash {
  0%   { text-shadow: 0 0 40px rgba(217,173,39,0.7); }
  100% { text-shadow: 0 0 120px rgba(217,173,39,1), 0 0 40px #fff3; }
}
.wc-sub {
  font-weight: 900; font-size: clamp(1rem,2.8vw,1.5rem);
  color: var(--white); letter-spacing: 0.06em; margin: 0.5rem 0;
  text-transform: uppercase;
}
.wc-trophy2 {
  font-size: clamp(3rem,10vw,6rem); margin-top: 1rem;
  animation: wcTrophySpin 1.2s cubic-bezier(0.175,0.885,0.32,1.275) 0.6s both;
}

/* ── PUZZLE FINAL PIECE (full-puzzle-reveal, shown at Leg 7 start) ── */
.puzzle-final-row {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 0.9rem; gap: 0.4rem;
}
.puzzle-final-slot {
  width: 300px; height: 170px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; transition: border-color 0.4s, box-shadow 0.4s;
}
.puzzle-final-slot.revealed {
  border: 2px solid var(--gold);
  background: #000;
  box-shadow: 0 0 30px rgba(217,173,39,0.5);
}
/* full-puzzle-reveal.png rendered as an <img> tag by puzzle.js */
.puzzle-final-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.puzzle-final-label {
  font-size: 0.6rem; font-weight: 700; color: #444;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.puzzle-final-slot.animate-in { animation: pieceReveal 1.2s ease forwards; }

/* ── VIDEO EMBED ─────────────────────────────────────────── */
.video-embed-wrap {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
  border-radius: 10px; margin-bottom: 1rem;
  border: 2px solid var(--border);
}
.video-embed-wrap iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.video-instruction {
  text-align: center; color: var(--gold); font-weight: 700;
  font-size: 0.9rem; margin-bottom: 1rem;
}

/* ── QM VIDEO BADGE ──────────────────────────────────────── */
.qm-type-video { background: rgba(239,68,68,0.18); color: #f87171; }

/* ── MISC ────────────────────────────────────────────────── */
@keyframes bounce { 0%{transform:translateY(0)} 100%{transform:translateY(-16px)} }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn 0.35s ease; }
