/* =============================
   QUIZ CHAMPION — STYLES
   ============================= */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg1: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --glass: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.12);
  --text: #ffffff;
  --muted: rgba(255,255,255,0.55);
  --gold: #ffd200;
  --pink: #f093fb;
  --red:  #f5576c;
  --green: #43e97b;
  --cyan:  #4facfe;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 50%, var(--bg3) 100%);
  min-height: 100vh;
  color: var(--text);
  overflow-x: hidden;
}

/* ── Screens ── */
.screen { display: none; min-height: 100vh; padding: 20px 16px 40px; animation: fadeUp .4s ease; }
.screen.active { display: block; }

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

/* ── Buttons ── */
.btn-main {
  display: block;
  width: 100%; max-width: 320px;
  margin: 10px auto;
  padding: 15px 30px;
  border: none; border-radius: 50px;
  background: linear-gradient(135deg, var(--pink), var(--red));
  color: white; font-family: 'Nunito', sans-serif;
  font-size: 18px; font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(240,147,251,.35);
  transition: transform .2s, box-shadow .2s;
}
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(240,147,251,.45); }

.btn-soft {
  display: block;
  width: 100%; max-width: 320px;
  margin: 10px auto;
  padding: 12px 28px;
  border: 2px solid var(--border); border-radius: 50px;
  background: var(--glass); color: white;
  font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: background .2s;
}
.btn-soft:hover { background: rgba(255,255,255,.14); }

/* ── Card ── */
.card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  margin-top: 20px;
  text-align: center;
}
.card h2 { font-size: 20px; font-weight: 800; margin-bottom: 20px; }

/* ── Form fields ── */
.field { margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input,
.field select {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--border); border-radius: 12px;
  background: rgba(255,255,255,.08); color: white;
  font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 600;
  transition: border-color .2s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--pink); background: rgba(255,255,255,.12); }
.field input::placeholder { color: rgba(255,255,255,.3); }
.field select option { background: var(--bg1); color: white; }

/* =====================
   WELCOME SCREEN
   ===================== */
.welcome-wrap { max-width: 480px; margin: 0 auto; }

.logo-area { text-align: center; padding: 32px 0 16px; }
.ellora-logo {
  width: 200px;
  height: auto;
  display: block;
  margin: 0 auto 6px;
  animation: float 2.5s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(240,147,251,.4));
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}
.logo-area h1 {
  font-size: 40px; font-weight: 900; margin: 10px 0 6px;
  background: linear-gradient(135deg, var(--pink), var(--red), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.tagline { font-size: 14px; color: var(--muted); }

.btn-share {
  display: block;
  width: 100%; max-width: 320px;
  margin: 6px auto;
  padding: 13px 28px;
  border: 2px solid rgba(79,172,254,.5); border-radius: 50px;
  background: rgba(79,172,254,.1); color: white;
  font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 800;
  cursor: pointer; transition: all .2s;
}
.btn-share:hover { background: rgba(79,172,254,.25); border-color: var(--cyan); }

.share-toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: #43e97b; color: #0f1b2d;
  padding: 12px 28px; border-radius: 30px;
  font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  animation: toastIn .3s ease;
  z-index: 9998;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.brand-block {
  margin-top: 16px;
}
.brand-title {
  font-size: 15px; font-weight: 700;
  color: rgba(255,255,255,.65);
  margin-bottom: 12px;
  letter-spacing: .3px;
}
.brand-ellora {
  background: linear-gradient(135deg, var(--pink), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  font-weight: 900; font-size: 17px;
}
.crew-row {
  display: flex; flex-wrap: wrap;
  justify-content: center; gap: 8px;
}
.crew-chip {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 30px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; gap: 4px;
}
.crew-role {
  font-size: 11px; font-weight: 600;
  color: var(--muted);
}

.brand-footer {
  text-align: center;
  padding: 18px 20px 30px;
  font-size: 13px; font-weight: 700;
  color: rgba(255,255,255,.35);
}
.brand-footer strong {
  background: linear-gradient(135deg, var(--pink), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* =====================
   SUBJECTS SCREEN
   ===================== */
.subjects-wrap { max-width: 680px; margin: 0 auto; }
.subjects-wrap h1 { font-size: 32px; font-weight: 900; text-align: center; margin-top: 28px; }
.sub-hint { text-align: center; font-size: 15px; color: var(--muted); margin: 8px 0 14px; }

.sel-count {
  text-align: center; margin: 0 auto 14px;
  display: inline-block; background: var(--glass);
  border: 2px solid var(--border); border-radius: 20px;
  padding: 7px 20px; font-weight: 700; font-size: 14px;
  position: relative; left: 50%; transform: translateX(-50%);
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 10px;
}
@media (min-width: 480px) { .subjects-grid { grid-template-columns: repeat(4, 1fr); } }

.subj-card {
  border-radius: 20px; padding: 22px 10px;
  text-align: center; cursor: pointer;
  border: 3px solid transparent;
  transition: transform .2s, box-shadow .2s;
  position: relative; user-select: none;
  animation: popIn .35s ease;
}
@keyframes popIn {
  from { transform: scale(.8); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}
.subj-card:hover { transform: scale(1.06); }

.subj-card.selected {
  border-color: white;
  transform: scale(1.07);
  box-shadow: 0 0 28px rgba(255,255,255,.4);
}
.subj-card.selected::after {
  content: '✓';
  position: absolute; top: -10px; right: -10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: white; color: var(--bg1);
  font-size: 15px; font-weight: 900; line-height: 26px; text-align: center;
  display: block;
}

.subj-emoji { font-size: 38px; display: block; margin-bottom: 6px; }
.subj-name  { font-size: 13px; font-weight: 800; letter-spacing: .3px; }

/* Per-subject colour gradients */
.sc-math    { background: linear-gradient(135deg, #667eea, #764ba2); }
.sc-english { background: linear-gradient(135deg, #f093fb, #f5576c); }
.sc-science { background: linear-gradient(135deg, #4facfe, #00f2fe); color: #0f1b2d; }
.sc-history { background: linear-gradient(135deg, #43e97b, #38f9d7); color: #0f1b2d; }
.sc-hindi   { background: linear-gradient(135deg, #fa709a, #fee140); color: #0f1b2d; }
.sc-marathi { background: linear-gradient(135deg, #a18cd1, #fbc2eb); color: #0f1b2d; }
.sc-gk      { background: linear-gradient(135deg, #00b4db, #0083b0); }
.sc-books   { background: linear-gradient(135deg, #f7971e, #ffd200); color: #0f1b2d; }

.sub-footer { text-align: center; padding: 10px 0 0; }

/* =====================
   QUIZ SCREEN
   ===================== */
.quiz-wrap { max-width: 600px; margin: 0 auto; padding-top: 18px; }

.quiz-top {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.quiz-progress { display: flex; align-items: center; gap: 8px; flex: 1; }
.quiz-progress span { font-weight: 800; font-size: 13px; white-space: nowrap; }

.pbar-track {
  flex: 1; height: 10px; border-radius: 10px;
  background: rgba(255,255,255,.18); overflow: hidden;
}
.pbar-fill {
  height: 100%; width: 0%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--pink), var(--red));
  transition: width .4s ease;
}

.xp-live { font-size: 18px; font-weight: 900; color: var(--gold); white-space: nowrap; }
.xp-live span { transition: transform .3s; display: inline-block; }

/* ── Timer ── */
.timer-wrap {
  position: relative;
  width: 52px; height: 52px;
  flex-shrink: 0;
}
.timer-svg {
  width: 52px; height: 52px;
  transform: rotate(-90deg);
}
.timer-track {
  fill: none;
  stroke: rgba(255,255,255,0.15);
  stroke-width: 5;
}
.timer-arc {
  fill: none;
  stroke: #43e97b;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 163.4;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-arc.warn  { stroke: #ffd200; }
.timer-arc.danger { stroke: #f5576c; }
.timer-num {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900;
  color: white;
}
.timer-wrap.pulse .timer-num {
  animation: timer-pulse 0.5s ease infinite;
}
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); color: #f5576c; }
}
.time-up-msg {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #f5576c;
  padding: 12px;
  animation: fadeUp .3s ease;
}

.quiz-nav {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.subj-badge {
  display: inline-block;
  padding: 5px 18px; border-radius: 20px;
  background: var(--glass); font-weight: 800; font-size: 14px;
}
.btn-back-sub {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border); border-radius: 20px;
  color: rgba(255,255,255,.65);
  font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 700;
  padding: 5px 14px; cursor: pointer;
  transition: background .2s;
}
.btn-back-sub:hover { background: rgba(255,255,255,.15); color: white; }

.q-card {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 22px; padding: 28px 24px;
  margin-bottom: 18px; min-height: 110px;
  display: flex; align-items: center; justify-content: center;
}
.q-text { font-size: 20px; font-weight: 700; text-align: center; line-height: 1.55; }

.opts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.opt-btn {
  background: var(--glass); border: 2px solid var(--border);
  border-radius: 16px; padding: 16px 12px;
  color: white; font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 700; cursor: pointer;
  text-align: left; min-height: 68px;
  display: flex; align-items: center; gap: 8px;
  transition: background .15s, transform .15s;
}
.opt-btn:hover:not(:disabled) { background: rgba(255,255,255,.14); transform: scale(1.02); }
.opt-btn:disabled { cursor: default; }

.opt-lbl { font-size: 18px; font-weight: 900; opacity: .7; }

.opt-btn.correct {
  background: linear-gradient(135deg, var(--green), #38f9d7);
  border-color: transparent; color: #0f1b2d;
  animation: pulse .45s ease;
}
.opt-btn.wrong {
  background: linear-gradient(135deg, var(--red), var(--pink));
  border-color: transparent;
  animation: shake .4s ease;
}

@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

/* =====================
   RESULTS SCREEN
   ===================== */
.results-wrap { max-width: 580px; margin: 0 auto; text-align: center; padding-top: 20px; }
.res-top { padding: 20px 0 10px; }
.res-emoji { font-size: 74px; display: block; animation: float 2s infinite; }
.results-wrap h1 { font-size: 34px; font-weight: 900; margin: 10px 0; }

.xp-big { margin: 16px 0 8px; }
.xp-big span:first-child {
  font-size: 70px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 30px rgba(255,210,0,.55);
}
.xp-unit { font-size: 22px; font-weight: 800; color: var(--gold); margin-left: 4px; }

.level-pill {
  display: inline-block; padding: 9px 24px; border-radius: 30px;
  background: linear-gradient(135deg, var(--pink), var(--red));
  font-size: 17px; font-weight: 800;
  box-shadow: 0 5px 18px rgba(240,147,251,.35);
}

.score-breakdown {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: 22px; padding: 20px 22px;
  margin: 18px 0; text-align: left;
}
.score-breakdown h3 { font-size: 17px; margin-bottom: 14px; text-align: center; }

.score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; gap: 8px;
}
.score-row:last-child { border-bottom: none; }
.score-stars { flex-shrink: 0; letter-spacing: 1px; }
.score-val { color: var(--gold); white-space: nowrap; }

.res-footer { display: flex; flex-direction: column; align-items: center; }

/* =====================
   LEADERBOARD SCREEN
   ===================== */
.lb-wrap { max-width: 580px; margin: 0 auto; }
.lb-top { text-align: center; padding: 28px 0 16px; }
.lb-top h1 { font-size: 34px; font-weight: 900; margin-bottom: 18px; }

.lb-tabs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lb-tab {
  padding: 9px 18px; border-radius: 30px;
  border: 2px solid var(--border); background: transparent;
  color: white; font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: all .2s;
}
.lb-tab.active { background: linear-gradient(135deg, var(--pink), var(--red)); border-color: transparent; }

.lb-list { background: rgba(255,255,255,.04); border-radius: 22px; overflow: hidden; }

.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(255,255,255,.05); }
.lb-row.me { background: rgba(240,147,251,.12); }

.lb-rank { font-size: 22px; font-weight: 900; min-width: 34px; text-align: center; }
.lb-info { flex: 1; }
.lb-name { font-size: 16px; font-weight: 800; }
.lb-meta { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.lb-score { text-align: right; }
.lb-xp-num { font-size: 20px; font-weight: 900; color: var(--gold); display: block; }
.lb-xp-lbl { font-size: 11px; color: var(--muted); font-weight: 600; }

.lb-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 16px; font-weight: 700; }

/* =====================
   CONFETTI
   ===================== */
#confetti {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999; overflow: hidden;
}
.cf {
  position: absolute; width: 11px; height: 11px; top: -20px;
  animation: cfFall linear forwards;
}
@keyframes cfFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ✨ Cute bouncy buttons */
button {
    border-radius: 16px;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
button:hover {
    transform: scale(1.07) !important;
}
button:active {
    transform: scale(0.93) !important;
}
/* bouncy-buttons */
