/* ==========================================================================
   MyKamus Cabaran Kuiz Mingguan & Arena Papan Pendahulu (Quiz Arena)
   ========================================================================== */

:root {
  --quiz-primary: #2563eb;
  --quiz-primary-dark: #1d4ed8;
  --quiz-accent: #38bdf8;
  --quiz-success: #10b981;
  --quiz-danger: #ef4444;
  --quiz-warning: #f59e0b;
  --quiz-bg: #f8fafc;
  --quiz-card-bg: #ffffff;
  --quiz-border: #e2e8f0;
  --quiz-text-main: #0f172a;
  --quiz-text-muted: #64748b;
  --quiz-radius: 16px;
  --quiz-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
}

.quiz-page {
  background: #f1f5f9;
  color: var(--quiz-text-main);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.quiz-main {
  width: min(100% - 2rem, 920px);
  margin: 1.5rem auto 4rem;
  flex: 1;
}

/* Hero Section */
.quiz-hero-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0369a1 100%);
  border-radius: var(--quiz-radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  color: #ffffff;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.25);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
}

.quiz-hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18) 0%, rgba(56, 189, 248, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.quiz-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.85rem;
}

.quiz-hero-title {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
}

.quiz-hero-desc {
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  color: #cbd5e1;
  max-width: 620px;
  margin: 0 0 1.5rem;
  line-height: 1.55;
}

/* Season Info Banner inside Hero */
.quiz-season-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
}

.quiz-season-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.season-tag {
  background: #2563eb;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.season-timer-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: #e2e8f0;
}

.season-timer-wrap strong {
  color: #38bdf8;
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

/* User Profile Strip */
.quiz-profile-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--quiz-card-bg);
  border: 1px solid var(--quiz-border);
  border-radius: var(--quiz-radius);
  padding: 1rem 1.4rem;
  margin-bottom: 2rem;
  box-shadow: var(--quiz-shadow);
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.profile-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--quiz-text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.profile-location {
  font-size: 0.84rem;
  color: var(--quiz-text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-edit-profile {
  background: #f1f5f9;
  border: 1px solid var(--quiz-border);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-edit-profile:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Skill Selection Card */
.quiz-tiers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.tier-card {
  background: var(--quiz-card-bg);
  border: 2px solid var(--quiz-border);
  border-radius: 14px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tier-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
}

.tier-card.is-selected {
  border-color: var(--quiz-primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tier-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.tier-badge.beginner { background: #dcfce7; color: #166534; }
.tier-badge.intermediate { background: #dbeafe; color: #1e40af; }
.tier-badge.advanced { background: #f3e8ff; color: #6b21a8; }

.tier-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}

.tier-desc {
  font-size: 0.84rem;
  color: var(--quiz-text-muted);
  margin: 0;
  line-height: 1.4;
}

.btn-start-arena {
  width: 100%;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 1.1rem 2rem;
  font-size: 1.12rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 10px 24px -4px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-start-arena:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -4px rgba(37, 99, 235, 0.5);
}

/* ==========================================================================
   ACTIVE QUIZ SCREEN
   ========================================================================== */
.quiz-active-card {
  background: var(--quiz-card-bg);
  border: 1px solid var(--quiz-border);
  border-radius: var(--quiz-radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: var(--quiz-shadow);
  margin-bottom: 2rem;
}

.quiz-header-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.quiz-progress-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--quiz-text-muted);
}

.quiz-score-pill {
  background: #f8fafc;
  border: 1px solid var(--quiz-border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
}

.quiz-score-pill span {
  color: var(--quiz-primary);
}

/* Timer Bar */
.quiz-timer-wrap {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.75rem;
}

.quiz-timer-bar {
  height: 100%;
  width: 100%;
  background: #10b981;
  transition: width 0.1s linear, background-color 0.3s ease;
}

.quiz-timer-bar.is-warning { background: #f59e0b; }
.quiz-timer-bar.is-danger { background: #ef4444; }

.quiz-question-box {
  margin-bottom: 2rem;
}

.question-type-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.6rem;
}

.question-prompt {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  margin: 0;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--quiz-primary);
  background: #f8fafc;
  transform: translateX(4px);
}

.option-key {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f1f5f9;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #475569;
  flex-shrink: 0;
}

.option-btn.is-correct {
  background: #f0fdf4 !important;
  border-color: #22c55e !important;
  color: #15803d !important;
}
.option-btn.is-correct .option-key {
  background: #22c55e;
  color: #ffffff;
}

.option-btn.is-incorrect {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
.option-btn.is-incorrect .option-key {
  background: #ef4444;
  color: #ffffff;
}

/* Question Explanation Banner */
.feedback-box {
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: fadeIn 0.2s ease-out;
}

.feedback-box.is-correct {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.feedback-box.is-incorrect {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.btn-next-question {
  width: 100%;
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-next-question:hover {
  background: #1e293b;
}

/* ==========================================================================
   RESULTS / SCORECARD MODAL / VIEW
   ========================================================================== */
.results-card {
  background: #ffffff;
  border: 1px solid var(--quiz-border);
  border-radius: var(--quiz-radius);
  padding: clamp(1.5rem, 5vw, 2.75rem);
  text-align: center;
  box-shadow: var(--quiz-shadow);
  margin-bottom: 2rem;
}

.results-score-display {
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 800;
  color: var(--quiz-primary);
  line-height: 1;
  margin: 0.5rem 0;
}

.results-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.stat-box {
  background: #f8fafc;
  border: 1px solid var(--quiz-border);
  border-radius: 12px;
  padding: 1rem;
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
}

.stat-lbl {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--quiz-text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.badges-earned-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.badge-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #92400e;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
}

/* ==========================================================================
   LEADERBOARD SECTION
   ========================================================================== */
.leaderboard-section {
  background: var(--quiz-card-bg);
  border: 1px solid var(--quiz-border);
  border-radius: var(--quiz-radius);
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: var(--quiz-shadow);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--quiz-border);
}

.leaderboard-tabs {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 0.25rem;
  gap: 0.25rem;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--quiz-text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.filter-select {
  border: 1px solid var(--quiz-border);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  background: #ffffff;
  cursor: pointer;
  outline: none;
}

/* Leaderboard Table / Rows */
.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-row {
  display: grid;
  grid-template-columns: 50px 1fr 90px 100px;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  transition: background 0.15s ease;
}

.lb-row:hover {
  background: #f8fafc;
}

.lb-row.is-user {
  background: #eff6ff !important;
  border: 1.5px solid #bfdbfe;
}

.lb-rank {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--quiz-text-muted);
}

.lb-rank.rank-1 { color: #eab308; font-size: 1.3rem; }
.lb-rank.rank-2 { color: #94a3b8; font-size: 1.2rem; }
.lb-rank.rank-3 { color: #d97706; font-size: 1.15rem; }

.lb-identity {
  display: flex;
  flex-direction: column;
}

.lb-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.lb-sub {
  font-size: 0.78rem;
  color: var(--quiz-text-muted);
}

.lb-acc {
  font-size: 0.88rem;
  font-weight: 700;
  color: #10b981;
}

.lb-score {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  text-align: right;
}

/* Modal for editing profile */
.quiz-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 1rem;
}

.quiz-modal-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 1.75rem 2rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

@media (max-width: 640px) {
  .quiz-tiers-grid {
    grid-template-columns: 1fr;
  }
  .lb-row {
    grid-template-columns: 40px 1fr 85px;
  }
  .lb-acc {
    display: none;
  }
}
