@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* ============================================
   CSS VARIABLES & ROOT
   ============================================ */
:root {
  --navy:       #0B1736;
  --navy-mid:   #112152;
  --navy-light: #1A2F6F;
  --gold:       #C9A84C;
  --gold-light: #E8C96A;
  --gold-dim:   #8B6E2A;
  --white:      #FFFFFF;
  --off-white:  #F0F4FF;
  --gray:       #8892B0;
  --gray-light: #CCD6F6;
  --success:    #2ECC8A;
  --danger:     #E74C6F;
  --card-bg:    rgba(17, 33, 82, 0.85);
  --border:     rgba(201, 168, 76, 0.25);
  --shadow:     0 20px 60px rgba(0, 0, 0, 0.5);
  --radius:     16px;
  --radius-sm:  10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent horizontal overflow on all elements */
* {
  max-width: 100%;
}

html { 
  scroll-behavior: smooth;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--navy);
  color: var(--white);
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  line-height: 1.6;
  position: relative;
  width: 100%;
  max-width: 100vw;
}

/* ============================================
   ANIMATED BACKGROUND
   ============================================ */
.bg-animated {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(26, 47, 111, 0.6) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201, 168, 76, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(11, 23, 54, 0.9) 0%, transparent 60%),
    var(--navy);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(201, 168, 76, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 168, 76, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}

.floating-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: floatOrb 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.orb-1 {
  width: 400px; height: 400px;
  background: var(--gold);
  top: -100px; right: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 300px; height: 300px;
  background: #4A9EFF;
  bottom: -50px; left: -50px;
  animation-delay: 4s;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -30px) scale(1.1); }
}

/* ============================================
   PAGE WRAPPER
   ============================================ */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  padding-bottom: 60px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

/* ============================================
   HEADER / NAVBAR
   ============================================ */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(11, 23, 54, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .top-bar {
    padding: 12px 16px;
  }
}

.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 55px;
  width: auto;
  object-fit: contain;
}


.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.logo-text span {
  color: var(--gold);
}

.event-badge {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 20px;
}

/* ============================================
   CARD
   ============================================ */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 580px;
  animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  box-sizing: border-box;
}

.card-wide {
  max-width: 720px;
}

.card-full {
  max-width: 1100px;
}

@media (max-width: 768px) {
  .card, .card-wide, .card-full {
    max-width: 100%;
    width: calc(100vw - 40px);
  }
}

@media (max-width: 480px) {
  .card, .card-wide, .card-full {
    max-width: 100%;
    width: calc(100vw - 24px);
    padding: 20px 14px;
  }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================
   GOLD DIVIDER
   ============================================ */
.gold-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 2px;
  margin: 12px auto 24px;
}

.gold-divider.left { margin: 12px 0 24px; }

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3 {
  font-family: 'Playfair Display', serif;
  line-height: 1.2;
}

.page-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  color: var(--white);
  text-align: center;
}

.page-subtitle {
  font-size: 15px;
  color: var(--gray);
  text-align: center;
  margin-top: 8px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  margin-bottom: 8px;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--gray-light);
  text-transform: uppercase;
}

input, select {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  transition: var(--transition);
  outline: none;
  box-sizing: border-box;
  max-width: 100%;
}

input::placeholder { color: rgba(136, 146, 176, 0.6); }

input:focus, select:focus {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.06);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

input.error { border-color: var(--danger) !important; }

select option {
  background: var(--navy-mid);
  color: var(--white);
}

.error-msg {
  font-size: 11px;
  color: var(--danger);
  display: none;
  margin-top: 2px;
}

.error-msg.show { display: block; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition);
}

.btn:hover::after { background: rgba(255,255,255,0.08); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold), var(--gold-light));
  color: var(--navy);
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(201, 168, 76, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(201, 168, 76, 0.45);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray-light);
}

.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b, var(--danger));
  color: white;
  box-shadow: 0 8px 24px rgba(231, 76, 111, 0.3);
}

/* ============================================
   TIMER
   ============================================ */
.timer-container {
  margin-bottom: 28px;
  position: relative;
}

.timer-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.timer-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 1s linear, background 1s linear;
}

.timer-bar-fill.warning {
  background: linear-gradient(90deg, #e67e22, #f39c12);
}

.timer-bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #ff6b6b);
  animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.timer-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timer-count {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  transition: color 0.3s;
}

.timer-count.warning { color: #f39c12; }
.timer-count.danger { color: var(--danger); }

.timer-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray);
}

/* ============================================
   QUESTION PROGRESS
   ============================================ */
.q-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  justify-content: center;
}

.q-dot {
  width: 32px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.15);
  transition: var(--transition);
}

.q-dot.active { background: var(--gold); }
.q-dot.done { background: rgba(201, 168, 76, 0.4); }
.q-dot.correct { background: var(--success); }
.q-dot.wrong { background: var(--danger); }

/* ============================================
   QUESTION CARD
   ============================================ */
.q-number {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.q-text {
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 500;
  color: var(--white);
  line-height: 1.5;
  margin-bottom: 28px;
  min-height: 60px;
}

.q-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--navy);
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
}

/* ============================================
   OPTIONS
   ============================================ */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: var(--radius-sm);
  color: var(--gray-light);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  line-height: 1.4;
}

.option-letter {
  min-width: 28px; height: 28px;
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  transition: var(--transition);
  flex-shrink: 0;
}

.option-btn:hover {
  background: rgba(201, 168, 76, 0.08);
  border-color: var(--gold);
  color: var(--white);
  transform: translateY(-2px);
}

.option-btn:hover .option-letter {
  background: var(--gold);
  color: var(--navy);
}

.option-btn.selected {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--gold);
  color: var(--white);
}

.option-btn.selected .option-letter {
  background: var(--gold);
  color: var(--navy);
}

.option-btn.correct {
  background: rgba(46, 204, 138, 0.12);
  border-color: var(--success);
  color: var(--white);
}

.option-btn.correct .option-letter {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}

.option-btn.wrong {
  background: rgba(231, 76, 111, 0.12);
  border-color: var(--danger);
  color: var(--gray);
}

.option-btn.wrong .option-letter {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

.option-btn:disabled {
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   RESULT PAGE
   ============================================ */
.result-icon {
  width: 100px; height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  margin: 0 auto 24px;
  animation: iconPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes iconPop {
  from { opacity: 0; transform: scale(0.3); }
  to { opacity: 1; transform: scale(1); }
}

.result-icon.win {
  background: radial-gradient(circle, rgba(201, 168, 76, 0.2), rgba(201, 168, 76, 0.05));
  border: 2px solid var(--gold);
  box-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
}

.result-icon.lose {
  background: radial-gradient(circle, rgba(74, 158, 255, 0.2), rgba(74, 158, 255, 0.05));
  border: 2px solid #4A9EFF;
}

.score-display {
  text-align: center;
  margin: 24px 0;
}

.score-big {
  font-family: 'Playfair Display', serif;
  font-size: clamp(48px, 10vw, 72px);
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-label {
  font-size: 14px;
  color: var(--gray);
  margin-top: 4px;
}

.coupon-box {
  background: rgba(201, 168, 76, 0.08);
  border: 2px dashed var(--gold);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  margin: 24px 0;
  animation: couponReveal 0.5s ease 0.8s both;
}

@keyframes couponReveal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.coupon-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 8px;
}

.coupon-code {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 4px;
}

.success-message {
  background: rgba(46, 204, 138, 0.1);
  border: 1px solid rgba(46, 204, 138, 0.3);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: #a8f0d0;
  font-size: 15px;
  line-height: 1.6;
  margin: 20px 0;
}

.fail-message {
  background: rgba(74, 158, 255, 0.08);
  border: 1px solid rgba(74, 158, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: #a8c8f0;
  font-size: 15px;
  line-height: 1.6;
  margin: 20px 0;
}

.quote-box {
  border-left: 3px solid var(--gold);
  padding: 12px 20px;
  margin: 20px 0;
  font-style: italic;
  color: var(--gray);
  font-size: 14px;
  line-height: 1.7;
}

/* ============================================
   STATS ROW
   ============================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.stat-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
}

.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
}

.stat-label {
  font-size: 11px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ============================================
   GAME BREAKDOWN
   ============================================ */
.game-breakdown {
  margin: 24px 0;
  padding: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.game-results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: var(--transition);
}

.game-result-item.passed {
  border-color: rgba(46, 204, 138, 0.3);
  background: rgba(46, 204, 138, 0.05);
}

.game-result-item.failed {
  border-color: rgba(231, 76, 111, 0.3);
  background: rgba(231, 76, 111, 0.05);
}

.game-result-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.game-result-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-light);
}

.game-result-status {
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================
   LEADERBOARD
   ============================================ */
.leaderboard {
  margin-top: 20px;
}

.lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: var(--transition);
  animation: fadeSlide 0.4s ease both;
}

.lb-item:nth-child(1) { animation-delay: 0.1s; border-color: rgba(201,168,76,0.4); background: rgba(201,168,76,0.06); }
.lb-item:nth-child(2) { animation-delay: 0.2s; border-color: rgba(201,168,76,0.25); }
.lb-item:nth-child(3) { animation-delay: 0.3s; }
.lb-item:nth-child(4) { animation-delay: 0.35s; }
.lb-item:nth-child(5) { animation-delay: 0.4s; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.lb-rank {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  color: var(--gray);
}

.lb-item:nth-child(1) .lb-rank { background: var(--gold); color: var(--navy); }
.lb-item:nth-child(2) .lb-rank { background: #C0C0C0; color: var(--navy); }
.lb-item:nth-child(3) .lb-rank { background: #CD7F32; color: var(--white); }

.lb-name { flex: 1; font-weight: 600; font-size: 14px; }
.lb-company { font-size: 12px; color: var(--gray); }

.lb-score {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.lb-time {
  font-size: 11px;
  color: var(--gray);
  text-align: right;
}

/* ============================================
   ADMIN DASHBOARD
   ============================================ */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.admin-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.admin-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

.admin-stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--gold);
}

.admin-stat-label {
  font-size: 12px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ============================================
   GOODIE TOGGLE BUTTONS
   ============================================ */
.goodie-toggle {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.goodie-btn {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(136, 146, 176, 0.3);
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  color: var(--gray);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'DM Sans', sans-serif;
  min-width: 55px;
}

.goodie-btn:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  border-color: rgba(136, 146, 176, 0.5);
  color: var(--gray-light);
}

.goodie-btn.active {
  background: rgba(201, 168, 76, 0.15);
  color: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
}

.pagination-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--gold);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'DM Sans', sans-serif;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(201, 168, 76, 0.1);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  color: var(--gray);
}

.pagination-info {
  font-size: 13px;
  color: var(--gray-light);
}

.pagination-info strong {
  color: var(--gold);
  font-weight: 600;
}

/* ============================================
   TABLE SCROLL CONTAINER & ARROWS
   ============================================ */
.table-scroll-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.scroll-arrow-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--gold);
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  flex-shrink: 0;
}

.scroll-arrow-btn.visible {
  display: flex;
}

.scroll-arrow-btn:hover:not(:disabled) {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
  transform: scale(1.1);
}

.scroll-arrow-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex: 1;
  scroll-behavior: smooth;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: rgba(201, 168, 76, 0.08);
}

th {
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--gray-light);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-pass {
  background: rgba(46, 204, 138, 0.15);
  color: var(--success);
  border: 1px solid rgba(46, 204, 138, 0.3);
}

.badge-fail {
  background: rgba(231, 76, 111, 0.1);
  color: #ff6b8a;
  border: 1px solid rgba(231, 76, 111, 0.25);
}

/* ============================================
   ADMIN PASSWORD OVERLAY
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 20px;
}

/* ============================================
   INSTRUCTIONS PAGE
   ============================================ */
.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 24px 0;
}

.rules-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 14px;
  color: var(--gray-light);
  line-height: 1.5;
}

.rule-icon {
  width: 36px; height: 36px;
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* ============================================
   COUNTDOWN OVERLAY
   ============================================ */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(11, 23, 54, 0.97);
  backdrop-filter: blur(10px);
}

.countdown-num {
  font-family: 'Playfair Display', serif;
  font-size: clamp(80px, 20vw, 140px);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: numPop 1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  line-height: 1;
}

@keyframes numPop {
  0% { opacity: 0; transform: scale(2); }
  60% { opacity: 1; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.countdown-text {
  font-size: 14px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 16px;
}

/* ============================================
   SCROLL BAR
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: var(--navy-light); border-radius: 3px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .card { padding: 28px 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .options-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .top-bar { padding: 12px 20px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* iPhone 14 Pro Max and similar large phones */
@media (max-width: 430px) {
  html {
    height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
  }
  
  body {
    min-height: 100vh;
    height: auto;
    overflow-y: scroll !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    width: 100%;
    max-width: 100vw;
  }
  
  .page-wrapper {
    min-height: 100vh;
    height: auto;
    padding-bottom: 80px;
    justify-content: flex-start;
    padding-top: 80px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  
  .card {
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .btn {
    margin-bottom: 20px;
  }
  
  .top-bar {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
}

/* ============================================
   UTILS
   ============================================ */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-gray { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.fade-in {
  animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

.shimmer {
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.05) 50%,
    rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}


/* ============================================
   PUZZLE-SPECIFIC STYLES
   ============================================ */

/* Pattern Recognition */
.pattern-sequence {
  animation: slideIn 0.5s ease both;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Memory Match */
.memory-card:hover:not([style*="cursor: default"]) {
  transform: scale(1.05);
  border-color: var(--gold) !important;
}

.memory-card:active {
  transform: scale(0.95);
}

/* Word Scramble Input */
input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

/* CRITICAL FIX: Force text visibility ONLY for Word Scramble game inputs */
#pzArea input[type="text"] {
  color: #FFB300 !important;
  -webkit-text-fill-color: #FFB300 !important;
  -webkit-opacity: 1 !important;
  opacity: 1 !important;
}

/* Code Breaker */
.decode-area input {
  transition: all 0.3s ease;
}

.decode-area input:focus {
  transform: scale(1.02);
}

/* Puzzle animations */
.puzzle-header {
  animation: fadeSlideDown 0.4s ease both;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

#pzArea {
  animation: fadeIn 0.5s ease 0.2s both;
}

/* Timer wrapper styles */
.timer-wrapper {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 23, 54, 0.95);
  backdrop-filter: blur(20px);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.timer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  gap: 20px;
}

.timer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray);
}

.timer-val {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  min-width: 60px;
  text-align: center;
  transition: color 0.3s;
}

.timer-val.warn { color: #f39c12; }
.timer-val.crit { 
  color: var(--danger);
  animation: timerPulse 0.5s ease-in-out infinite;
}

.q-progress {
  display: flex;
  gap: 8px;
}

.q-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(201,168,76,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray);
  transition: all 0.3s;
}

.q-bubble.current {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  transform: scale(1.1);
}

.q-bubble.done {
  background: rgba(46,204,138,0.2);
  border-color: var(--success);
  color: var(--success);
}

.prog-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}

.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 1s linear, background 1s linear;
  border-radius: 2px;
}

.prog-fill.warn {
  background: linear-gradient(90deg, #e67e22, #f39c12);
}

.prog-fill.crit {
  background: linear-gradient(90deg, var(--danger), #ff6b6b);
}

/* Puzzle card styles */
.puzzle-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.puzzle-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.puzzle-q {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 600;
  color: var(--white);
  line-height: 1.4;
  margin-bottom: 8px;
}

.puzzle-hint {
  font-size: 13px;
  color: var(--gray);
  font-style: italic;
}

.puzzle-type {
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.nav-status {
  font-size: 13px;
  color: var(--success);
  font-weight: 500;
  flex: 1;
}

.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  border: none;
  border-radius: var(--radius-sm);
  color: var(--navy);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
}

.btn-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(201,168,76,0.45);
}

.btn-next:active {
  transform: translateY(0);
}

/* Rules box */
.rules-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 24px 0;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  font-size: 14px;
  color: var(--gray-light);
  line-height: 1.5;
}

.rule-item:not(:last-child) {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.rule-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* Hero section */
.hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  margin-bottom: 12px;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  color: var(--white);
  text-align: center;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 15px;
  color: var(--gray);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Page layout */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 100px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 23, 54, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
}

.brand-name span {
  color: var(--gold);
}

.brand-tag {
  font-size: 11px;
  color: var(--gray);
  letter-spacing: 1px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .timer-inner {
    flex-direction: column;
    gap: 12px;
  }
  
  .timer-left {
    width: 100%;
    justify-content: space-between;
  }
  
  .q-progress {
    width: 100%;
    justify-content: center;
  }
  
  .puzzle-header {
    flex-direction: column;
  }
  
  .puzzle-type {
    align-self: flex-start;
  }
  
  .quiz-nav {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-next {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .pattern-sequence {
    gap: 8px !important;
  }
  
  .pattern-sequence > div {
    width: 50px !important;
    height: 50px !important;
    font-size: 24px !important;
  }
}

/* ============================================================
   COMPLETE RESPONSIVE CSS
   Replace the existing @media blocks at the bottom of style.css
   Covers: 768px → 600px → 480px → 400px → 360px + Landscape
   ============================================================ */

/* ── Tablet (max 768px) ── */
@media (max-width: 768px) {

  /* Page */
  .page { padding: 90px 16px 32px; }
  .topbar { padding: 12px 20px; }
  .card { padding: 28px 20px; }

  /* Brand bar */
  .brand-name { font-size: 17px; }
  .brand-icon { width: 38px; height: 38px; font-size: 18px; }
  .brand-tag { display: none; }
  .event-badge { font-size: 10px; padding: 5px 10px; }

  /* Timer */
  .timer-wrapper { padding: 12px 16px; }
  .timer-inner { flex-direction: column; gap: 10px; }
  .timer-left { width: 100%; justify-content: space-between; }
  .timer-val { font-size: 26px; min-width: 50px; }
  .timer-lbl { font-size: 10px; }
  .q-progress { width: 100%; justify-content: center; }
  .q-bubble { width: 28px; height: 28px; font-size: 12px; }

  /* Puzzle */
  .puzzle-header { flex-direction: column; gap: 10px; }
  .puzzle-type { align-self: flex-start; }
  .puzzle-q { font-size: 17px; }
  .puzzle-hint { font-size: 12px; }

  /* Nav */
  .quiz-nav { flex-direction: column; align-items: stretch; gap: 12px; margin-top: 24px; }
  .btn-next { width: 100%; justify-content: center; }
  .nav-status { text-align: center; }

  /* Hero */
  .hero-title { font-size: clamp(22px, 5vw, 32px); }
  .hero-sub { font-size: 14px; }

  /* Result */
  .score-big { font-size: clamp(40px, 10vw, 60px); }
  .coupon-code { font-size: 22px; letter-spacing: 3px; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-value { font-size: 20px; }

  /* Leaderboard */
  .lb-score { font-size: 16px; }
  .lb-name { font-size: 13px; }

  /* Admin */
  .admin-header { flex-direction: column; gap: 12px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .admin-stat-num { font-size: 28px; }
  th, td { padding: 12px 14px; font-size: 12px; }

  /* Form */
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }

  /* Options */
  .options-grid { grid-template-columns: 1fr; }
}

/* ── Small Mobile (max 480px) ── */
@media (max-width: 480px) {

.page { padding: 82px 12px 28px; }
  .card { padding: 20px 14px; border-radius: 12px; }
  .card-wide { padding: 20px 14px; }

  /* Timer */
  .timer-wrapper { padding: 10px 14px; }
  .timer-val { font-size: 24px; min-width: 46px; }
  .q-bubble { width: 26px; height: 26px; font-size: 11px; }

  /* Puzzle text */
  .puzzle-q { font-size: 15px; }
  .puzzle-cat { font-size: 10px; }
  .puzzle-hint { font-size: 12px; }

  /* Word Scramble inputs - MOBILE FIX for text visibility */
  #pzArea input[type="text"] {
    width: 38px !important;
    height: 44px !important;
    font-size: 18px !important;
    border-radius: 8px !important;
    color: #FFB300 !important;
    -webkit-text-fill-color: #FFB300 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background: #1a2a3a !important;
    caret-color: #FFB300 !important;
    padding: 0 !important;
    line-height: 44px !important;
  }
  
  /* Ensure text is visible when typing */
  #pzArea input[type="text"]:focus {
    color: #FFB300 !important;
    -webkit-text-fill-color: #FFB300 !important;
    background: #0d2035 !important;
    padding: 0 !important;
  }

  /* Memory Match */
  #memGrid {
    gap: 7px !important;
    max-width: 300px !important;
  }

  /* Whack-a-Tick */
  #whackGrid {
    max-width: 270px !important;
    gap: 7px !important;
  }
  #wScore, #wRound, #wMiss { font-size: 1.4rem !important; }

  /* Brand Blitz blur box */
  #pzArea [style*="blur"] {
    font-size: clamp(20px, 6vw, 32px) !important;
    letter-spacing: 4px !important;
  }

  /* Brand Blitz & Impostor option buttons */
  #pzArea [style*="flex-direction:column"] button,
  #pzArea [style*="flex-direction: column"] button {
    padding: 10px 12px !important;
    font-size: 0.85rem !important;
  }

  /* Hero */
  .hero-title { font-size: clamp(20px, 6vw, 28px); }
  .hero-sub { font-size: 13px; }

  /* Result */
  .result-icon { width: 80px; height: 80px; font-size: 36px; }
  .score-big { font-size: clamp(36px, 12vw, 52px); }
  .coupon-code { font-size: 18px; letter-spacing: 2px; }
  .coupon-box { padding: 16px; }
  .stats-row { gap: 6px; }
  .stat-box { padding: 12px 8px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }

  /* Buttons */
  .btn { padding: 14px 22px; font-size: 14px; }
  .btn-next { padding: 13px 20px; font-size: 14px; }

  /* Leaderboard */
  .lb-item { padding: 10px 12px; gap: 10px; }
  .lb-rank { width: 28px; height: 28px; font-size: 12px; }
  .lb-name { font-size: 13px; }
  .lb-score { font-size: 15px; }
  .lb-time { font-size: 10px; }

  /* Admin */
  .admin-stat-num { font-size: 26px; }
  .admin-stat-card { padding: 18px; }
  th, td { padding: 10px 10px; font-size: 11px; }

  /* Rules */
  .rule-item { font-size: 13px; gap: 10px; }
  .rule-icon { font-size: 18px; }

  /* Logo img */
  .logo-img { height: 44px; }
}