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

  :root {
    --bg:        #0b0c0c;
    --bg2:       #111315;
    --bg3:       #181b1d;
    --bg-card:   #1c1f21;
    --bg-card2:  #21252a;
    --cyan:      #00d4d4;
    --blue:      #1d70b8;
    --gold:      #c8a84b;
    --gold-dim:  rgba(200,168,75,0.12);
    --gold-mid:  #d4b05a;
    --gold-brt:  #e8c870;
    --green:     #00703c;
    --green-mid: #2ea86b;
    --red:       #d4351c;
    --red-dim:   rgba(212,53,28,0.12);
    --text:      #f3f2f1;
    --text2:     #b8bcc2;
    --muted:     #8d9199;
    --muted2:    #5f6470;
    --border:    rgba(255,255,255,0.07);
    --border2:   rgba(255,255,255,0.13);
  }

  html { scroll-behavior: smooth; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.6; font-size: 16px;
  }
  a { color: var(--gold-mid); text-decoration: none; }
  a:hover { text-decoration: underline; }

  /* ── HEADER ─────────────────────────────── */
  .page-header {
    background: rgba(11,12,12,0.97);
    border-bottom: 1px solid var(--border2);
    padding: 14px 6%;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
  }
  .wt-back {
    display: inline-flex; align-items: center; gap: 10px;
    text-decoration: none !important; opacity: 1; transition: opacity .15s;
    font-size: 0.82rem; color: var(--muted); font-weight: 600;
    letter-spacing: 0.04em;
  }
  .wt-back:hover { opacity: .72; color: var(--text); text-decoration: none !important; }
  .wt-back svg { width: 18px; height: 18px; flex-shrink: 0; }
  .header-badge {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--gold-dim); border: 1px solid rgba(200,168,75,0.3);
    color: var(--gold-mid); padding: 5px 13px; border-radius: 100px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  }
  .header-badge .dot {
    width: 6px; height: 6px; background: var(--gold-mid); border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
  }
  @keyframes blink {
    0%,100% { opacity:1; box-shadow: 0 0 0 0 rgba(200,168,75,.5); }
    50%      { opacity:.4; box-shadow: 0 0 0 3px rgba(200,168,75,0); }
  }

  /* ── PROFILE SWITCHER ────────────────────── */
  .profile-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--bg2); border-bottom: 1px solid var(--border);
    padding: 10px 6%;
  }
  .profile-bar-label {
    font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); flex-shrink: 0;
  }
  .profile-chips { display: flex; gap: 8px; flex-wrap: wrap; }
  .profile-chip {
    padding: 6px 16px; border-radius: 100px; font-size: .82rem; font-weight: 700;
    border: 1px solid var(--border2); background: var(--bg-card); color: var(--text2);
    cursor: pointer; transition: all .18s;
  }
  .profile-chip:hover { border-color: rgba(200,168,75,.4); color: var(--text); }
  .profile-chip.active {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-brt) 100%);
    border-color: transparent; color: #1a1506;
    box-shadow: 0 4px 14px rgba(200,168,75,.35);
  }

  /* ── HERO ────────────────────────────────── */
  .hero {
    background: linear-gradient(160deg, #0e0d05 0%, #0c0b04 55%, #090802 100%);
    padding: 48px 6% 40px; text-align: center; position: relative; overflow: hidden;
  }
  .hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(ellipse 55% 65% at 50% 20%, rgba(200,168,75,0.14) 0%, transparent 68%);
  }
  .hero-inner { max-width: 680px; margin: 0 auto; position: relative; }
  .hero-tag {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--gold-dim); border: 1px solid rgba(200,168,75,0.25);
    color: var(--gold-mid); padding: 5px 14px; border-radius: 100px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; margin-bottom: 20px;
  }
  .hero h1 {
    font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; line-height: 1.18;
    margin-bottom: 16px; color: var(--text);
  }
  .hero h1 span {
    background: linear-gradient(92deg, #c8a84b 0%, #e8c870 50%, #c8a84b 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    animation: gradShift 5s ease infinite;
  }
  @keyframes gradShift { 0%,100% { background-position:0% 50%; } 50% { background-position:100% 50%; } }
  .hero p { color: var(--text2); font-size: 1rem; max-width: 520px; margin: 0 auto; }

  /* ── MODE TABS ───────────────────────────── */
  .main { max-width: 720px; margin: 0 auto; padding: 36px 6% 80px; }

  .mode-tabs {
    display: flex; gap: 10px; margin-bottom: 28px; background: var(--bg2);
    border: 1px solid var(--border2); border-radius: 10px; padding: 5px;
  }
  .tab-btn {
    flex: 1; padding: 10px 16px; border: none; border-radius: 7px;
    background: transparent; color: var(--muted); font-size: 0.88rem; font-weight: 600;
    cursor: pointer; transition: background .2s, color .2s;
    display: flex; align-items: center; justify-content: center; gap: 7px;
  }
  .tab-btn.active { background: var(--gold-dim); color: var(--gold-brt); border: 1px solid rgba(200,168,75,0.25); }
  .tab-btn:not(.active):hover { background: rgba(255,255,255,0.04); color: var(--text2); }

  /* ── TOPIC SELECTOR ──────────────────────── */
  .topic-bar {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px;
  }
  .topic-chip {
    padding: 6px 14px; border-radius: 100px; font-size: 0.78rem; font-weight: 600;
    border: 1px solid var(--border2); background: var(--bg-card); color: var(--muted);
    cursor: pointer; transition: all .18s;
  }
  .topic-chip:hover { border-color: rgba(200,168,75,.4); color: var(--gold-mid); }
  .topic-chip.active { background: var(--gold-dim); border-color: rgba(200,168,75,.5); color: var(--gold-brt); }

  /* ── STATS BAR ───────────────────────────── */
  .stats-bar {
    display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
  }
  .stat-pill {
    background: var(--bg-card); border: 1px solid var(--border2);
    border-radius: 8px; padding: 8px 16px; font-size: 0.78rem;
    display: flex; align-items: center; gap: 7px; color: var(--text2);
  }
  .stat-pill strong { color: var(--text); font-size: 1.05rem; }
  .stat-pill.correct strong { color: var(--green-mid); }
  .stat-pill.wrong strong { color: #e05545; }

  /* ── PROGRESS BAR ────────────────────────── */
  .progress-wrap { margin-bottom: 22px; }
  .progress-meta { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--muted); margin-bottom: 7px; }
  .progress-track { height: 3px; background: var(--bg-card2); border-radius: 2px; overflow: hidden; }
  .progress-fill {
    height: 100%; background: linear-gradient(90deg, #c8a84b 0%, #e8c870 100%);
    border-radius: 2px; transition: width .4s cubic-bezier(.4,0,.2,1); width: 0%;
  }

  /* ── FLASHCARD ───────────────────────────── */
  .flashcard-wrap {
    perspective: 1200px; margin-bottom: 24px; cursor: pointer;
  }
  .flashcard {
    width: 100%; min-height: 220px;
    position: relative; transform-style: preserve-3d;
    transition: transform .55s cubic-bezier(.4,0,.2,1);
    border-radius: 14px;
  }
  .flashcard.flipped { transform: rotateY(180deg); }

  .fc-face {
    position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
    border-radius: 14px; padding: 32px 32px 28px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center;
  }
  .fc-front {
    background: var(--bg-card); border: 1px solid rgba(200,168,75,0.25);
    border-top: 3px solid var(--gold);
  }
  .fc-back {
    background: var(--bg-card2); border: 1px solid rgba(200,168,75,0.35);
    border-top: 3px solid var(--gold-brt);
    transform: rotateY(180deg);
  }
  .fc-label {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--gold-mid); margin-bottom: 16px;
  }
  .fc-text {
    font-size: clamp(1rem, 2.5vw, 1.3rem); font-weight: 700; color: var(--text);
    line-height: 1.4; max-width: 560px;
  }
  .fc-hint {
    margin-top: 14px; font-size: 0.78rem; color: var(--muted); font-style: italic;
  }
  .fc-back .fc-text { color: var(--gold-brt); }

  .fc-actions {
    display: flex; gap: 10px; margin-bottom: 28px;
  }
  .fc-btn {
    flex: 1; padding: 12px 10px; border-radius: 10px; border: 1px solid var(--border2);
    background: var(--bg-card); color: var(--text2); font-size: 0.88rem; font-weight: 600;
    cursor: pointer; transition: all .18s; display: flex; align-items: center; justify-content: center; gap: 6px;
  }
  .fc-btn.got-it { border-color: rgba(0,112,60,.4); }
  .fc-btn.got-it:hover { background: rgba(0,112,60,.12); color: var(--green-mid); }
  .fc-btn.missed { border-color: rgba(212,53,28,.35); }
  .fc-btn.missed:hover { background: var(--red-dim); color: #e05545; }
  .fc-btn.next-fc { border-color: rgba(200,168,75,.35); }
  .fc-btn.next-fc:hover { background: var(--gold-dim); color: var(--gold-brt); }

  /* ── QUIZ MODE ───────────────────────────── */
  .quiz-card {
    background: var(--bg-card); border: 1px solid var(--border2);
    border-radius: 14px; padding: 32px 28px 28px;
    border-top: 3px solid var(--gold);
  }
  .quiz-q {
    font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.35;
  }
  .quiz-hint { font-size: 0.82rem; color: var(--muted); margin-bottom: 24px; }
  .quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
  .q-opt {
    width: 100%; text-align: left; padding: 14px 18px;
    background: var(--bg2); border: 2px solid var(--border2);
    border-radius: 10px; cursor: pointer; color: var(--text);
    font-size: 0.93rem; transition: border-color .18s, background .18s, transform .12s;
    display: flex; align-items: flex-start; gap: 12px;
  }
  .q-opt:hover:not(:disabled) { border-color: rgba(200,168,75,.45); background: var(--gold-dim); transform: translateY(-1px); }
  .q-opt .opt-key {
    width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border2);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; flex-shrink: 0; margin-top: 1px;
    color: var(--muted);
  }
  .q-opt.correct { border-color: rgba(0,112,60,.6); background: rgba(0,112,60,.1); }
  .q-opt.correct .opt-key { background: rgba(0,112,60,.25); border-color: var(--green-mid); color: var(--green-mid); }
  .q-opt.wrong   { border-color: rgba(212,53,28,.6); background: var(--red-dim); }
  .q-opt.wrong .opt-key { background: var(--red-dim); border-color: #e05545; color: #e05545; }
  .q-opt:disabled { cursor: default; transform: none; }

  .quiz-feedback {
    padding: 14px 18px; border-radius: 10px; font-size: 0.88rem; font-weight: 600;
    margin-bottom: 20px; display: none;
  }
  .quiz-feedback.correct { background: rgba(0,112,60,.1); border: 1px solid rgba(0,112,60,.3); color: var(--green-mid); }
  .quiz-feedback.wrong   { background: var(--red-dim); border: 1px solid rgba(212,53,28,.3); color: #e05545; }
  .quiz-feedback .fb-head { font-size: 1.05rem; font-weight: 800; letter-spacing: .01em; }
  .quiz-feedback .expl { font-weight: 400; color: var(--text2); margin-top: 4px; font-size: 0.82rem; }

  .quiz-next-btn {
    width: 100%; padding: 13px; border-radius: 10px;
    background: var(--gold-dim); border: 1px solid rgba(200,168,75,.35);
    color: var(--gold-brt); font-size: 0.93rem; font-weight: 700;
    cursor: pointer; transition: background .18s, box-shadow .18s; display: none;
  }
  .quiz-next-btn:hover { background: rgba(200,168,75,.22); box-shadow: 0 0 18px rgba(200,168,75,.15); }

  /* ── RESULTS ─────────────────────────────── */
  .results-card {
    background: var(--bg-card); border: 1px solid rgba(200,168,75,.3);
    border-top: 3px solid var(--gold); border-radius: 14px;
    padding: 40px 32px; text-align: center;
  }
  .results-score {
    font-size: 4rem; font-weight: 900; line-height: 1;
    background: linear-gradient(92deg, #c8a84b 0%, #e8c870 60%, #c8a84b 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    animation: gradShift 4s ease infinite; margin-bottom: 8px;
  }
  .results-label { font-size: 0.88rem; color: var(--muted); margin-bottom: 28px; }
  .results-breakdown {
    display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 32px;
  }
  .rb-pill {
    padding: 10px 20px; border-radius: 10px; border: 1px solid var(--border2);
    background: var(--bg2); font-size: 0.82rem; color: var(--text2);
  }
  .rb-pill strong { display: block; font-size: 1.4rem; margin-bottom: 2px; }
  .rb-pill.c strong { color: var(--green-mid); }
  .rb-pill.w strong { color: #e05545; }
  .results-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
  .res-btn {
    padding: 12px 24px; border-radius: 10px; font-size: 0.9rem; font-weight: 700;
    cursor: pointer; transition: all .18s; border: 1px solid var(--border2);
    background: var(--bg-card2); color: var(--text2);
  }
  .res-btn.primary {
    background: var(--gold-dim); border-color: rgba(200,168,75,.4); color: var(--gold-brt);
  }
  .res-btn:hover { opacity: .82; transform: translateY(-1px); }

  /* ── EMPTY STATE ─────────────────────────── */
  .empty-state {
    text-align: center; padding: 60px 20px; color: var(--muted);
  }
  .empty-state .big { font-size: 2.5rem; margin-bottom: 12px; }
  .empty-state p { font-size: 0.9rem; }

  /* ── ADD CARD PANEL ──────────────────────── */
  .add-panel {
    background: var(--bg-card); border: 1px solid var(--border2);
    border-radius: 14px; padding: 28px; margin-top: 28px;
  }
  .add-panel h3 { font-size: 1rem; margin-bottom: 20px; color: var(--text2); }
  .field-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
  .field-row label { font-size: 0.78rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
  .field-row input, .field-row textarea, .field-row select {
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 8px; padding: 10px 14px; color: var(--text);
    font-size: 0.9rem; font-family: inherit; resize: vertical;
    transition: border-color .18s;
  }
  .field-row input:focus, .field-row textarea:focus, .field-row select:focus {
    outline: none; border-color: rgba(200,168,75,.5);
  }
  .field-row textarea { min-height: 80px; }
  .options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .add-actions { display: flex; gap: 10px; margin-top: 6px; }
  .add-btn {
    padding: 11px 22px; border-radius: 8px; font-size: 0.88rem; font-weight: 700;
    cursor: pointer; transition: all .18s;
  }
  .add-btn.save { background: var(--gold-dim); border: 1px solid rgba(200,168,75,.4); color: var(--gold-brt); }
  .add-btn.save:hover { background: rgba(200,168,75,.22); }
  .add-btn.cancel { background: transparent; border: 1px solid var(--border2); color: var(--muted); }
  .add-btn.cancel:hover { color: var(--text2); border-color: var(--border2); }

  /* ── MANAGE TOOLBAR ──────────────────────── */
  .tool-bar {
    display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; align-items: center;
  }
  .tool-bar-btn {
    padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border2);
    background: var(--bg-card); color: var(--text2); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: all .18s; display: flex; align-items: center; gap: 6px;
  }
  .tool-bar-btn:hover { border-color: rgba(200,168,75,.4); color: var(--gold-mid); }
  .tool-bar-btn.danger:hover { border-color: rgba(212,53,28,.4); color: #e05545; }
  .spacer { flex: 1; }

  /* ── FOOTER ──────────────────────────────── */
  .page-footer {
    border-top: 1px solid var(--border); padding: 28px 6%;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    font-size: 0.78rem; color: var(--muted);
  }
  .page-footer a { color: var(--gold-mid); }

  @media (max-width: 600px) {
    .fc-actions { flex-wrap: wrap; }
    .options-grid { grid-template-columns: 1fr; }
    .results-breakdown { gap: 10px; }
    .stats-bar { gap: 10px; }
  }

/* ── V2: HERO IMAGE ──────────────────────── */
.hero-img {
  background: linear-gradient(160deg, rgba(11,12,12,.82) 0%, rgba(9,8,2,.6) 60%, rgba(9,8,2,.88) 100%),
              url('../assets/hero.jpg') center 38% / cover no-repeat;
  padding: 84px 6% 72px;
}
.hero-img h1 { text-shadow: 0 2px 24px rgba(0,0,0,.8); }
.hero-img p { text-shadow: 0 1px 12px rgba(0,0,0,.9); }

/* ── V2: PWA / OFFLINE UI ────────────────── */
.header-actions { display: flex; align-items: center; gap: 12px; }
.install-btn {
  background: var(--gold-dim); border: 1px solid rgba(200,168,75,.5);
  color: var(--gold-brt); font-weight: 700; font-size: .76rem;
  padding: 6px 14px; border-radius: 8px; cursor: pointer; transition: background .2s;
}
.install-btn:hover { background: rgba(200,168,75,.22); }
.install-btn:disabled { opacity: .6; cursor: default; }
.offline-badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  color: #e8c870; background: var(--gold-dim);
  border: 1px solid rgba(200,168,75,.4); border-radius: 20px; padding: 4px 12px;
}
@media (max-width: 560px) {
  .offline-badge { font-size: .62rem; padding: 3px 8px; }
  .install-btn { font-size: .7rem; padding: 5px 10px; }
}

/* ── V2: TWO-PANE LAYOUT ─────────────────────────────────────────
   Mobile keeps the original single column (pick, then scroll to work).
   From 1000px the picker becomes a sticky left rail so it stays in view
   while you answer — making it obvious that changing a topic on the left
   re-deals the quiz on the right. */
.app-layout { display: block; }

@media (min-width: 1000px) {
  .main { max-width: 1240px; }
  .app-layout {
    display: grid;
    grid-template-columns: minmax(300px, 360px) 1fr;
    gap: 30px;
    align-items: start;
  }
  .pane-left {
    position: sticky; top: 16px;
    max-height: calc(100vh - 32px); overflow-y: auto;
    padding-right: 4px;
  }
  .pane-left::-webkit-scrollbar { width: 6px; }
  .pane-left::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
  .pane-right { min-width: 0; }

  /* Compact cards in the rail — two up, shorter, smaller type. */
  .pane-left .course-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
  .pane-left .gcse-grid { grid-template-columns: 1fr; }
  .pane-left .course-card { aspect-ratio: 3 / 2.1; border-radius: 11px; }
  .pane-left .course-card .course-name { font-size: .8rem; }
  .pane-left .course-card .course-sub { font-size: .63rem; padding-bottom: 10px; }
  .pane-left .path-toggle { flex-wrap: wrap; gap: 8px; }
  .pane-left .path-btn { font-size: .8rem; padding: 8px 10px; }
  .pane-left .study-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Wide desktop: let the whole app use the screen rather than a narrow column. */
@media (min-width: 1500px) {
  .main { max-width: 1560px; }
}

/* ── V2: COURSE SECTIONS ─────────────────── */
.course-section-head {
  font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold-mid); margin: 4px 0 12px; display: flex; align-items: baseline;
  gap: 10px; flex-wrap: wrap; animation: fadeUp .45s ease both;
}
.course-section-head span {
  font-size: .72rem; font-weight: 500; letter-spacing: .02em; text-transform: none;
  color: var(--muted);
}
.course-section-head.pro { color: #7fd8ff; margin-top: 26px; }
.group-toggle {
  cursor: pointer; user-select: none; width: 100%;
  background: none; border: none; padding: 0; font: inherit; text-align: left;
}
.group-toggle .chevron {
  margin-left: auto; font-size: 1rem; color: var(--muted); flex-shrink: 0;
  transition: transform .2s ease;
}
.group-toggle[aria-expanded="false"] .chevron { transform: rotate(-90deg); }
.course-grid.collapsed { display: none; }
.gcse-grid { grid-template-columns: repeat(3, 1fr); }
.gcse-grid .course-card { grid-column: span 1; }
@media (max-width: 700px) { .gcse-grid { grid-template-columns: 1fr; } }
.course-card.c-pro1 { background-image: url('../assets/card-pro1.jpg'); }
.course-card.c-pro2 { background-image: url('../assets/card-pro2.jpg'); }
.course-card.c-pro1.active, .course-card.c-pro2.active { border-color: rgba(127,216,255,.7); }
.course-card.c-pro1.active .course-name, .course-card.c-pro2.active .course-name { color: #9fe4ff; }

/* ── V2: SUBJECT MULTI-SELECT ────────────── */
.deck-hint {
  font-size: .78rem; color: var(--muted); margin: -6px 0 16px; padding-left: 2px;
}
/* Says out loud what the chips actually do — the connection isn't obvious
   otherwise, especially on mobile where the quiz is further down the page. */
.deck-note {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: .8rem; color: var(--text2); line-height: 1.45;
  background: var(--gold-dim); border: 1px solid rgba(200,168,75,.3);
  border-radius: 10px; padding: 9px 13px; margin: 0 0 12px;
}
.deck-note strong { color: var(--gold-brt); }
.deck-note .dn-icon { color: var(--gold-mid); font-size: .95rem; line-height: 1.3; flex-shrink: 0; }
.deck-note .dn-desktop { display: none; }
@media (min-width: 1000px) {
  .deck-note .dn-mobile { display: none; }
  .deck-note .dn-desktop { display: inline; }
  .deck-note .dn-icon { transform: rotate(-90deg); }
}
.topic-chip.multi.active {
  background: var(--gold-dim); border-color: rgba(200,168,75,.55); color: var(--gold-brt);
}

/* ── V2: STUDY BANNER ────────────────────── */
.study-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  background: var(--gold-dim); border: 1px solid rgba(200,168,75,.32);
  border-radius: 12px; padding: 12px 18px; margin-bottom: 22px;
  animation: fadeUp .5s ease both;
}
.sb-text { font-size: .84rem; color: var(--text2); }
.sb-text strong { color: var(--gold-brt); }
.sb-links { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.sb-links a {
  font-size: .78rem; font-weight: 700; padding: 6px 12px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border2); color: var(--gold-mid);
  transition: border-color .2s, color .2s;
}
.sb-links a:hover { border-color: rgba(200,168,75,.55); color: var(--gold-brt); text-decoration: none; }
@media (max-width: 640px) { .sb-links { margin-left: 0; } }

/* ── V2: ABOUT BOX ───────────────────────── */
.about-box {
  background: var(--bg-card); border: 1px solid var(--border2); border-radius: 12px;
  margin-bottom: 22px; animation: fadeUp .4s ease both;
}
.about-box summary {
  cursor: pointer; list-style: none; padding: 14px 18px; font-weight: 700;
  font-size: .9rem; color: var(--gold-mid); display: flex; align-items: center;
  gap: 8px; user-select: none;
}
.about-box summary::-webkit-details-marker { display: none; }
.about-box summary::after {
  content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s;
}
.about-box[open] summary::after { transform: rotate(-180deg); }
.about-body { padding: 0 18px 18px; color: var(--text2); font-size: .86rem; }
.about-body p { margin-bottom: 10px; }
.about-body ul { margin: 0 0 10px 18px; }
.about-body li { margin-bottom: 6px; }
.about-body strong { color: var(--text); }

/* ── V2: PATH TOGGLE ─────────────────────── */
.path-toggle {
  display: flex; align-items: stretch; gap: 10px; margin-bottom: 22px;
  animation: fadeUp .5s ease both;
}
.path-label {
  align-self: center; font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-right: 2px;
}
.path-btn {
  flex: 1; padding: 10px 14px; border-radius: 10px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border2); color: var(--text2);
  font-size: .88rem; font-weight: 700; transition: all .2s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.path-btn small { font-size: .68rem; font-weight: 500; color: var(--muted); }
.path-btn:hover { border-color: rgba(200,168,75,.4); transform: translateY(-1px); }
.path-btn.active {
  background: var(--gold-dim); border-color: rgba(200,168,75,.55); color: var(--gold-brt);
  box-shadow: 0 0 18px rgba(200,168,75,.12);
}
.path-btn.active small { color: var(--gold-mid); }

/* ── V2: COURSE GRID ─────────────────────── */
.course-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 30px;
}
.course-card {
  position: relative; border-radius: 14px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border2); aspect-ratio: 3 / 2.6; padding: 0;
  background: var(--bg-card) center / cover no-repeat;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  transition: transform .25s cubic-bezier(.4,0,.2,1), border-color .25s, box-shadow .25s;
  animation: fadeUp .6s ease both;
}
.course-card:nth-child(2) { animation-delay: .07s; }
.course-card:nth-child(3) { animation-delay: .14s; }
.course-card:nth-child(4) { animation-delay: .21s; }
.course-card:nth-child(5) { animation-delay: .28s; }
.course-card:nth-child(6) { animation-delay: .35s; }
.course-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(5,5,3,.92) 100%);
  transition: background .25s;
}
.course-card:hover {
  transform: translateY(-4px) scale(1.015);
  border-color: rgba(200,168,75,.55);
  box-shadow: 0 12px 32px rgba(0,0,0,.5), 0 0 22px rgba(200,168,75,.14);
}
.course-card.active {
  border-color: rgba(200,168,75,.75);
  box-shadow: 0 0 0 1px rgba(200,168,75,.5), 0 0 26px rgba(200,168,75,.22);
}
.course-card .course-name, .course-card .course-sub {
  position: relative; z-index: 1; text-align: left; padding: 0 14px;
}
.course-card .course-name { font-size: .92rem; font-weight: 800; color: var(--text); }
.course-card .course-sub { font-size: .7rem; color: var(--muted); padding-bottom: 13px; margin-top: 2px; }
.course-card.active .course-name { color: var(--gold-brt); }

/* ── V2: ANIMATION POLISH ────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(.96) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.flashcard-wrap, .quiz-card { animation: popIn .35s cubic-bezier(.4,0,.2,1) both; }
.results-card { animation: popIn .45s cubic-bezier(.34,1.4,.4,1) both; }
.q-opt { animation: fadeUp .3s ease both; }
.q-opt:nth-child(2) { animation-delay: .05s; }
.q-opt:nth-child(3) { animation-delay: .1s; }
.q-opt:nth-child(4) { animation-delay: .15s; }
.topic-chip, .mode-tabs, .stats-bar { animation: fadeUp .45s ease both; }
.fc-text, .quiz-q { white-space: pre-wrap; }     /* code snippets keep line breaks */
.fc-text { font-family: inherit; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 700px) {
  .course-grid { grid-template-columns: repeat(2, 1fr); }
  .path-toggle { flex-wrap: wrap; }
}

.course-card.c-gcse { background-image: url('../assets/card-gcse.jpg'); }
.course-card.c-py1  { background-image: url('../assets/card-py1.jpg'); }
.course-card.c-py2  { background-image: url('../assets/card-py2.jpg'); }
.course-card.c-py3  { background-image: url('../assets/card-py3.jpg'); }
.course-card.c-ai1  { background-image: url('../assets/card-ai1.jpg'); }
.course-card.c-ai2  { background-image: url('../assets/card-ai2.jpg'); }

/* ── V2: HERO VIDEO ──────────────────────── */
.hero-img { position: relative; }
.hero-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 38%; z-index: 0;
}
.hero-img::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(160deg, rgba(11,12,12,.78) 0%, rgba(9,8,2,.5) 60%, rgba(9,8,2,.9) 100%);
}
.hero-img .hero-inner { position: relative; z-index: 2; }
@media (prefers-reduced-motion: reduce) {
  .hero-video { display: none; }   /* poster/CSS background still shows */
}

/* ══ V3: DASHBOARD, TAB BAR, STATS / PROFILE / SETTINGS SCREENS ══════════ */

body { padding-bottom: 76px; } /* clears the fixed tab bar */

/* ── Dashboard (Home) ────────────────────── */
.dash { max-width: 720px; margin: 0 auto; padding: 18px 6% 0; }
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dash-greeting { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.dash-top-right { display: flex; align-items: center; gap: 10px; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--gold-dim); border: 1px solid rgba(200,168,75,.3);
  color: var(--gold-brt); padding: 6px 12px; border-radius: 100px;
  font-size: .82rem; font-weight: 800;
}
.dash-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-card2); border: 1px solid var(--border2); color: var(--gold-brt);
  font-size: 1rem; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dash-avatar:hover { border-color: rgba(200,168,75,.5); }

.xp-card {
  background: var(--bg-card); border: 1px solid var(--border2); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 14px;
}
.xp-card-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .85rem; font-weight: 700; color: var(--text); margin-bottom: 10px;
}
.xp-card-head span:last-child { color: var(--text2); font-weight: 600; }
.xp-to-next { font-size: .74rem; color: var(--muted); margin-top: 8px; }

.resume-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--bg-card); border: 1px solid var(--border2); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 22px; cursor: pointer; color: inherit;
  font: inherit; transition: border-color .18s;
}
.resume-card:hover { border-color: rgba(200,168,75,.4); }
.resume-thumb {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background-size: cover; background-position: center; background-color: var(--bg-card2);
}
.resume-body { flex: 1; min-width: 0; }
.resume-label { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-mid); margin-bottom: 2px; }
.resume-title { font-size: .92rem; font-weight: 700; color: var(--text); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track.thin { height: 4px; margin-bottom: 4px; }
.resume-meta { font-size: .72rem; color: var(--muted); }

/* ── Tab bar ─────────────────────────────── */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(11,12,12,0.97); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border2);
  padding: 8px 6% calc(8px + env(safe-area-inset-bottom));
}
.tab-bar-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .64rem; font-weight: 700; padding: 4px 10px; flex: 1;
}
.tab-bar-btn .tbi { font-size: 1.15rem; }
.tab-bar-btn.active { color: var(--gold-brt); }
.tab-bar-daily {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; margin: -22px 4px 0;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-brt) 100%);
  border: 3px solid var(--bg); color: #1a1506; font-size: 1.3rem; cursor: pointer;
  box-shadow: 0 6px 20px rgba(200,168,75,.4);
  display: flex; align-items: center; justify-content: center;
}

/* ── Screens (Stats / Profile / Settings) ─── */
.screen { max-width: 720px; margin: 0 auto; min-height: calc(100vh - 76px); }
.screen-header {
  display: flex; align-items: center; gap: 12px; padding: 18px 6%;
  border-bottom: 1px solid var(--border);
}
.screen-header h1 { font-size: 1.2rem; font-weight: 800; flex: 1; }
.screen-back, .screen-gear {
  background: none; border: none; color: var(--text2); font-size: 1.1rem; cursor: pointer;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}
.screen-back:hover, .screen-gear:hover { color: var(--gold-brt); }
.screen-body { padding: 20px 6% 40px; }

/* ── Streak / Stats ──────────────────────── */
.streak-hero { text-align: center; padding: 20px 0 8px; }
.streak-flame { font-size: 3rem; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 4px 16px rgba(224,85,69,.4)); }
.streak-days { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.streak-risk-banner {
  margin: 14px auto 0; max-width: 420px; background: var(--red-dim);
  border: 1px solid rgba(212,53,28,.35); color: #ff9c8a; border-radius: 10px;
  padding: 10px 14px; font-size: .82rem; font-weight: 600;
}
.stats-3up {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 26px;
}
.stat-tile {
  background: var(--bg-card); border: 1px solid var(--border2); border-radius: 12px;
  padding: 14px 8px; text-align: center;
}
.stat-tile span { display: block; font-size: .68rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-tile strong { font-size: 1.3rem; color: var(--gold-brt); }
.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 8px;
  font-size: .68rem; color: var(--muted); text-align: center; font-weight: 700;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--bg-card); border: 1px solid var(--border);
  font-size: .8rem; color: var(--muted2); position: relative;
}
.cal-day.pad { background: none; border: none; }
.cal-day.kept { background: rgba(224,85,69,.12); border-color: rgba(224,85,69,.3); color: var(--text); }
.cal-day.today { box-shadow: 0 0 0 2px var(--gold-mid) inset; color: var(--text); font-weight: 800; }

/* ── Profile ─────────────────────────────── */
.profile-identity { text-align: center; padding: 12px 0 6px; }
.profile-avatar-lg {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--bg-card2); border: 2px solid rgba(200,168,75,.4);
  color: var(--gold-brt); font-size: 1.8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(200,168,75,.25);
}
.profile-name { font-size: 1.2rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.profile-meta { font-size: .82rem; color: var(--muted); }
.badge-gallery-head {
  font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold-mid); margin: 8px 0 12px;
}
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-tile {
  background: var(--bg-card); border: 1px solid var(--border2); border-radius: 14px;
  padding: 16px 8px; text-align: center;
}
.badge-tile .b-icon { font-size: 1.8rem; margin-bottom: 8px; }
.badge-tile .b-title { font-size: .74rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.badge-tile .b-desc { font-size: .64rem; color: var(--muted); line-height: 1.3; }
.badge-tile.locked { opacity: .5; }
.badge-tile.locked .b-icon { filter: grayscale(1); }

/* ── Settings ────────────────────────────── */
.settings-group { margin-bottom: 24px; }
.settings-group-title {
  font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; padding: 0 2px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: var(--bg-card); border: 1px solid var(--border2); color: var(--text);
  padding: 13px 16px; font-size: .88rem; font-weight: 600; text-decoration: none !important;
  cursor: pointer; text-align: left;
}
.settings-row:first-child { border-radius: 12px 12px 0 0; }
.settings-row:last-child { border-radius: 0 0 12px 12px; }
.settings-row:only-child { border-radius: 12px; }
.settings-row + .settings-row { border-top: none; }
.settings-row:hover { background: var(--bg-card2); }
.settings-row.danger-row { color: #ff8a75; }
.settings-profile-chips { padding: 2px; }
.settings-version span { color: var(--muted); }

/* Checkbox-as-toggle-switch */
.settings-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 42px; height: 25px; border-radius: 100px;
  background: var(--bg-card2); border: 1px solid var(--border2); position: relative; cursor: pointer;
  flex-shrink: 0; transition: background .18s;
}
.settings-row input[type="checkbox"]::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--text2); transition: transform .18s, background .18s;
}
.settings-row input[type="checkbox"]:checked { background: var(--gold-dim); border-color: rgba(200,168,75,.5); }
.settings-row input[type="checkbox"]:checked::before { transform: translateX(17px); background: var(--gold-brt); }

.reset-confirm {
  background: var(--red-dim); border: 1px solid rgba(212,53,28,.35); border-radius: 12px;
  padding: 16px; margin-top: 2px;
}
.reset-confirm p { font-size: .84rem; color: var(--text2); margin-bottom: 14px; line-height: 1.5; }
.reset-confirm-actions { display: flex; gap: 10px; }
.reset-confirm-actions .res-btn { flex: 1; }
.res-btn.danger { background: var(--red); color: #fff; border-color: transparent; }
.res-btn.danger:hover { background: #b82e17; }

.settings-signout {
  width: 100%; margin-top: 6px; background: none; border: 1px solid rgba(212,53,28,.4);
  color: #ff8a75; border-radius: 12px; padding: 14px; font-size: .88rem; font-weight: 700;
  cursor: pointer;
}
.settings-signout:hover { background: var(--red-dim); }

/* ── Achievement modal ───────────────────── */
.achv-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.achv-card {
  background: var(--bg-card); border: 1px solid rgba(200,168,75,.35); border-radius: 20px;
  padding: 32px 26px; max-width: 320px; width: 100%; text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  animation: popIn .35s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(.85) translateY(12px); } to { opacity: 1; transform: none; } }
.achv-badge-ring {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 18px;
  background: radial-gradient(circle, rgba(200,168,75,.28) 0%, transparent 70%);
  display: flex; align-items: center; justify-content: center;
  animation: glow 1.6s ease-in-out infinite;
}
@keyframes glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(200,168,75,.35); }
  50%      { box-shadow: 0 0 0 14px rgba(200,168,75,0); }
}
.achv-badge {
  width: 76px; height: 76px; border-radius: 50%; font-size: 2.1rem;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-brt) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(200,168,75,.4);
}
.achv-title { font-size: 1.15rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.achv-desc { font-size: .84rem; color: var(--text2); margin-bottom: 22px; line-height: 1.5; }
.achv-claim {
  width: 100%; padding: 13px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-brt) 100%);
  color: #1a1506; font-size: .9rem; font-weight: 800;
  box-shadow: 0 6px 20px rgba(200,168,75,.4);
}

@media (min-width: 720px) {
  .dash, .screen { max-width: 900px; }
}

.results-xp { font-size: .85rem; font-weight: 800; color: var(--gold-brt); margin: -6px 0 14px; }
