/* ==========================================================================
   GAMMA ACADEMY — playful edtech design system.
   Rounded shapes · tactile 3D buttons · vibrant subjects · gamification.
   Nunito throughout. Navy + gold brand, vivid subject colours.
   ========================================================================== */

:root {
  /* Charcoal + ivory + muted copper — shared with the landing page. */
  --navy-900:#16140f; --navy-800:#211d15; --navy-700:#2e2920; --navy-ink:#1b1812;

  --gold:#b08d57; --gold-600:#97774a; --gold-700:#75592f; --gold-soft:#f1e9da;

  --bg:#f4efe6;           /* ivory */
  --surface:#fbf8f1;
  --surface-2:#f6f1e7;
  --ink:#16140f;
  --ink-soft:#5c5648;
  --muted:#8a8276;
  --line:#e7e0d1;
  --line-2:#d6ccb7;

  /* functional only — green = correct, red = wrong (universal) */
  --ok:#2e7d52; --ok-soft:#e9f2ec;
  --bad:#b4453a; --bad-soft:#f6eae8;
  --warn:#9c7416;

  --r:16px; --r-sm:11px; --r-lg:22px;
  --shadow:0 1px 2px rgba(22,20,15,.05), 0 6px 16px rgba(22,20,15,.07);
  --shadow-lg:0 12px 30px rgba(22,20,15,.14);
  --sidebar-w:248px;

  --sans:"Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display:"Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust:100%; overflow-x:hidden; }
body { margin:0; font-family:var(--sans); color:var(--ink); background:var(--bg); line-height:1.55; -webkit-font-smoothing:antialiased; font-weight:450; max-width:100%; overflow-x:hidden; }
a { color:var(--gold-700); text-decoration:none; font-weight:600; }
a:hover { color:var(--gold-600); }
h1,h2,h3,h4 { font-family:var(--display); margin:0; font-weight:700; line-height:1.2; color:var(--ink); letter-spacing:-.012em; }

/* ============================== App shell =============================== */
.shell { display:flex; min-height:100vh; }
.sidebar {
  width:var(--sidebar-w); flex:none; position:sticky; top:0; height:100vh;
  background:var(--surface); border-right:1px solid var(--line);
  display:flex; flex-direction:column; padding:18px 14px;
}
.sidebar-brand { display:flex; align-items:center; gap:11px; padding:8px 10px 16px; }
.sidebar-badge { width:46px; height:46px; border-radius:50%; flex:none; object-fit:cover; border:3px solid var(--gold); }
.sidebar-name { display:flex; flex-direction:column; line-height:1.05; }
.sidebar-name b { font-weight:700; font-size:19px; color:var(--navy-800); }
.sidebar-name span { font-size:10px; letter-spacing:.2em; text-transform:uppercase; color:var(--gold-600); margin-top:3px; font-weight:600; }

.side-label { font-size:11px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); padding:14px 12px 8px; font-weight:600; }
.nav { display:flex; flex-direction:column; gap:5px; }
.nav a {
  display:flex; align-items:center; gap:13px; padding:11px 13px; border-radius:14px;
  color:var(--ink-soft); font-size:15px; font-weight:600; transition:all .14s;
}
.nav a svg { width:20px; height:20px; flex:none; }
.nav a:hover { background:var(--surface-2); color:var(--ink); }
.nav a.active { background:var(--gold-soft); color:var(--gold-700); }
.nav a.active svg { color:var(--gold-600); }

.sidebar-foot { margin-top:auto; }
.side-user { display:flex; align-items:center; gap:11px; padding:10px; border-radius:16px; background:var(--surface-2); border:1px solid var(--line); }
.side-user:hover { background:#eef1f8; }
.side-avatar { width:38px; height:38px; border-radius:50%; flex:none; display:grid; place-items:center; background:var(--gold); color:var(--navy-900); font-weight:700; font-size:14px; }
.side-user .meta { line-height:1.2; min-width:0; }
.side-user .meta b { display:block; color:var(--ink); font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.side-user .meta span { font-size:12px; color:var(--gold-700); font-weight:600; }

.main { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar { height:70px; display:flex; align-items:center; gap:16px; padding:0 40px; background:rgba(244,241,234,.92); backdrop-filter:saturate(140%) blur(8px); position:sticky; top:0; z-index:20; }
.topbar::after { content:""; position:absolute; left:40px; right:40px; bottom:0; height:1px; background:var(--line); }
.topbar h1 { font-size:22px; }
.topbar .spacer { margin-left:auto; }
.page { padding:26px 40px 64px; max-width:none; width:100%; }
.menu-btn { display:none; }
.sb-backdrop { display:none; }
@media (max-width:820px){
  .sidebar{ position:fixed; z-index:60; transform:translateX(-100%); transition:transform .2s; box-shadow:0 0 40px rgba(10,20,40,.25); }
  .sidebar.open{ transform:none; }
  .sb-backdrop.show{ display:block; position:fixed; inset:0; background:rgba(10,20,40,.45); z-index:55; }
  .menu-btn{ display:inline-flex; }
  .page,.topbar{ padding-left:18px; padding-right:18px; }
  .topbar::after{ left:18px; right:18px; }
}

/* ============================== Typography ============================= */
.page-title { font-size:30px; letter-spacing:-.02em; }
.page-sub { color:var(--muted); margin-top:6px; font-size:15px; max-width:60ch; font-weight:600; }
.section-title { font-size:20px; margin-bottom:16px; }
.kicker { text-transform:uppercase; letter-spacing:.1em; font-size:11px; font-weight:700; color:var(--gold-600); }
.muted { color:var(--muted); }
.center { text-align:center; }

/* ============================== Tactile buttons ======================== */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:9px;
  font-family:var(--sans); font-size:15px; font-weight:600; cursor:pointer;
  padding:12px 22px; border-radius:14px; border:none; transition:transform .04s, filter .15s, background .15s;
  position:relative; top:0;
}
.btn:active { top:3px; }
.btn-sm { padding:8px 15px; font-size:13.5px; border-radius:11px; }
.btn-lg { padding:15px 28px; font-size:16.5px; }
.btn-block { width:100%; }
.btn:disabled { background:var(--line-2); color:var(--muted); box-shadow:0 4px 0 #c4cad8; cursor:not-allowed; }
.btn:disabled:active { top:0; box-shadow:0 4px 0 #c4cad8; }
.btn-gold   { background:var(--gold);   color:var(--navy-900); box-shadow:0 4px 0 var(--gold-600); }
.btn-gold:active { box-shadow:0 1px 0 var(--gold-600); }
.btn-gold:hover { filter:brightness(1.03); color:var(--navy-900); }
.btn-primary{ background:var(--navy-800); color:#fff; box-shadow:0 4px 0 var(--navy-900); }
.btn-primary:active{ box-shadow:0 1px 0 var(--navy-900); }
.btn-primary:hover{ color:#fff; filter:brightness(1.08); }
.btn-ghost  { background:var(--surface); color:var(--ink-soft); box-shadow:0 0 0 2px var(--line-2) inset, 0 4px 0 var(--line-2); }
.btn-ghost:active{ box-shadow:0 0 0 2px var(--line-2) inset, 0 1px 0 var(--line-2); }
.btn-ghost:hover{ color:var(--ink); }

/* ============================== Cards / surfaces ====================== */
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
.card-pad { padding:22px; }
.grid { display:grid; gap:16px; }
.grid-2 { grid-template-columns:repeat(2,1fr); }
.grid-3 { grid-template-columns:repeat(3,1fr); }
.grid-4 { grid-template-columns:repeat(4,1fr); }
@media (max-width:900px){ .grid-3,.grid-4{ grid-template-columns:repeat(2,1fr);} }
@media (max-width:560px){ .grid-2,.grid-3,.grid-4{ grid-template-columns:1fr;} }

/* ============================== Gamified header ======================= */
.home-head {
  display:flex; align-items:center; gap:18px; flex-wrap:wrap;
  background:
    radial-gradient(120% 160% at 0% 0%, #6e5230 0%, rgba(110,82,48,0) 55%),
    linear-gradient(135deg, var(--navy-800), var(--navy-900));
  color:#fff; border-radius:var(--r-lg); padding:24px 26px; position:relative; overflow:hidden;
}
.home-head h1 { color:#fff; font-size:27px; }
.home-head .hello-sub { color:#aeb9d8; font-weight:700; margin-top:3px; }
.home-head .mascot { width:74px; height:74px; border-radius:50%; border:3px solid var(--gold); flex:none; box-shadow:0 0 0 6px rgba(176,141,87,.16); }
.gstats { display:flex; gap:10px; margin-left:auto; flex-wrap:wrap; }
.gpill { display:flex; align-items:center; gap:9px; background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.16); border-radius:16px; padding:10px 15px; }
.gpill .ic { font-size:20px; line-height:1; }
.gpill .v { font-weight:700; font-size:18px; color:#fff; line-height:1; }
.gpill .l { font-size:11px; color:#aeb9d8; font-weight:600; text-transform:uppercase; letter-spacing:.05em; }

/* ============================== Subject tiles ========================= */
.subjects { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
@media (max-width:900px){ .subjects{ grid-template-columns:repeat(2,1fr);} }
@media (max-width:520px){ .subjects{ grid-template-columns:1fr;} }
.subj {
  --c:#6366f1; display:flex; flex-direction:column; gap:14px; padding:20px;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r);
  box-shadow:0 4px 0 color-mix(in srgb, var(--c) 22%, var(--line)); transition:transform .12s, box-shadow .12s; position:relative; top:0;
}
.subj:hover { transform:translateY(-2px); box-shadow:0 8px 0 color-mix(in srgb, var(--c) 28%, var(--line)); }
.subj-ic { width:52px; height:52px; border-radius:16px; display:grid; place-items:center; font-size:25px; color:#fff; background:var(--c); }
.subj-name { font-weight:700; font-size:17px; }
.subj-meta { color:var(--muted); font-size:13px; font-weight:700; margin-top:-8px; }
.subj-bar { height:8px; background:var(--line); border-radius:999px; overflow:hidden; }
.subj-bar > span { display:block; height:100%; border-radius:999px; background:var(--c); }
.subj-go { margin-top:auto; font-weight:700; font-size:14px; color:var(--c); display:inline-flex; align-items:center; gap:6px; }

/* ============================== Goal ring ============================= */
.ring { --p:0; --c:var(--gold); width:120px; height:120px; border-radius:50%; display:grid; place-items:center;
  background:conic-gradient(var(--c) calc(var(--p)*1%), var(--line) 0); flex:none; }
.ring > div { width:96px; height:96px; border-radius:50%; background:var(--surface); display:grid; place-items:center; text-align:center; }
.ring b { font-size:26px; font-weight:700; color:var(--ink); display:block; line-height:1; }
.ring small { font-size:11px; color:var(--muted); font-weight:600; }

/* ============================== Stat pills ============================ */
.statpill { display:flex; align-items:center; gap:13px; padding:16px 18px; }
.statpill .em { width:46px; height:46px; border-radius:14px; display:grid; place-items:center; font-size:22px; background:var(--surface-2); flex:none; }
.statpill .v { font-size:24px; font-weight:700; line-height:1; color:var(--ink); }
.statpill .l { font-size:12.5px; color:var(--muted); font-weight:700; margin-top:3px; }

/* ============================== Badges =============================== */
.badges { display:flex; gap:14px; flex-wrap:wrap; }
.badge { display:flex; flex-direction:column; align-items:center; gap:7px; width:84px; text-align:center; }
.badge .disc { width:60px; height:60px; border-radius:50%; display:grid; place-items:center; font-size:27px; background:var(--gold-soft); border:2px solid var(--gold); }
.badge.locked .disc { background:var(--surface-2); border-color:var(--line-2); filter:grayscale(1); opacity:.5; }
.badge small { font-size:11.5px; color:var(--ink-soft); font-weight:600; line-height:1.2; }

/* progress bar */
.progress { height:10px; background:var(--line); border-radius:999px; overflow:hidden; }
.progress > span { display:block; height:100%; background:linear-gradient(90deg, var(--gold), var(--gold-600)); border-radius:999px; }

.chip { display:inline-flex; align-items:center; gap:6px; padding:4px 11px; border-radius:999px; font-size:12.5px; font-weight:600; background:var(--surface-2); border:1px solid var(--line); color:var(--ink-soft); }
.subject-tag { display:inline-flex; align-items:center; gap:7px; font-size:13px; font-weight:600; }
.subject-dot { width:10px; height:10px; border-radius:50%; display:inline-block; }

.stat-value { font-size:30px; font-weight:700; color:var(--ink); }
.stat-label { color:var(--muted); font-size:13px; margin-top:3px; font-weight:700; }

/* ============================== Quiz config ========================== */
.steps { display:grid; gap:26px; }
.step-head { display:flex; align-items:center; gap:12px; margin-bottom:16px; }
.step-num { font-weight:700; color:var(--navy-900); font-size:15px; background:var(--gold-soft); border:2px solid var(--gold); width:32px; height:32px; border-radius:50%; display:grid; place-items:center; }
.option-grid { display:grid; gap:12px; }
.tile-select { display:flex; gap:13px; align-items:flex-start; padding:17px; border:2px solid var(--line); border-radius:var(--r); background:var(--surface); cursor:pointer; transition:all .14s; }
.tile-select:hover { border-color:var(--gold); }
.tile-select.selected { border-color:var(--gold); background:var(--gold-soft); }
.tile-select input { position:absolute; opacity:0; pointer-events:none; }
.tile-title { display:block; font-weight:700; font-size:15px; }
.tile-desc { display:block; color:var(--muted); font-size:13px; margin-top:2px; font-weight:700; }
.tile-icon { width:44px; height:44px; border-radius:14px; display:grid; place-items:center; color:#fff; flex:none; font-weight:700; font-size:20px; }
.chip-toggle { border:2px solid var(--line); background:var(--surface); color:var(--ink-soft); padding:9px 18px; border-radius:999px; cursor:pointer; font-weight:600; font-size:14px; transition:all .14s; }
.chip-toggle:hover { border-color:var(--gold); }
.chip-toggle.selected { background:var(--navy-800); border-color:var(--navy-800); color:#fff; }
.years-row { display:flex; flex-wrap:wrap; gap:10px; }
.startbar { position:sticky; bottom:18px; margin-top:30px; }

/* ============================== Question card ======================== */
.qmeta { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:18px; }
.qmeta .sep { color:var(--line-2); }
.qstem { font-size:20px; line-height:1.55; color:var(--ink); font-weight:700; }
.qstem .figure, .figure { display:block; max-width:100%; margin:16px auto; border:1px solid var(--line); border-radius:var(--r-sm); background:#fff; padding:8px; }
.answers { display:grid; gap:11px; margin-top:22px; }
.answer { display:flex; align-items:center; gap:14px; width:100%; text-align:left; padding:15px 17px; border:2px solid var(--line); border-radius:var(--r); background:var(--surface); cursor:pointer; font-size:16px; color:var(--ink); font-family:var(--sans); font-weight:700; transition:all .12s; }
.answer:hover { border-color:var(--gold); }
.answer .key { flex:none; width:33px; height:33px; border-radius:10px; display:grid; place-items:center; border:2px solid var(--line-2); font-weight:700; font-size:14px; color:var(--ink-soft); background:var(--surface-2); }
.answer.selected { border-color:var(--navy-700); background:#eef2fb; }
.answer.selected .key { background:var(--navy-800); color:#fff; border-color:var(--navy-800); }
.answer.correct { border-color:var(--ok); background:var(--ok-soft); }
.answer.correct .key { background:var(--ok); color:#fff; border-color:var(--ok); }
.answer.wrong { border-color:var(--bad); background:var(--bad-soft); }
.answer.wrong .key { background:var(--bad); color:#fff; border-color:var(--bad); }
.answer .content { flex:1; }
.answer.disabled { cursor:default; }
.explain { margin-top:20px; border-left:4px solid var(--gold); background:var(--gold-soft); padding:17px 19px; border-radius:0 var(--r-sm) var(--r-sm) 0; }
.explain h4 { font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--gold-700); margin:0 0 8px; }
.explain .body { font-size:15.5px; color:var(--ink-soft); line-height:1.6; font-weight:600; }

/* ============================== Runner =============================== */
.runner-top { position:sticky; top:0; z-index:30; background:var(--navy-900); }
.runner-top-inner { max-width:1140px; margin:0 auto; padding:13px 24px; display:flex; align-items:center; gap:16px; }
.runner-progress { flex:1; height:9px; background:rgba(255,255,255,.16); border-radius:999px; overflow:hidden; }
.runner-progress > span { display:block; height:100%; background:linear-gradient(90deg, var(--gold), var(--gold-600)); transition:width .25s; }
.runner-top .muted { color:#aab2cc; }
.timer { font-variant-numeric:tabular-nums; font-weight:700; color:var(--gold); font-size:15px; }
.timer.danger { color:#ff9b8a; }
.qnav { display:flex; flex-wrap:wrap; gap:7px; margin-top:24px; justify-content:center; }
.qnav button { width:38px; height:38px; border-radius:11px; border:2px solid var(--line); background:var(--surface); color:var(--ink-soft); font-weight:600; cursor:pointer; font-size:13.5px; }
.qnav button.answered { border-color:var(--navy-700); color:var(--navy-800); background:#eef2fb; }
.qnav button.current { background:var(--navy-800); border-color:var(--navy-800); color:#fff; }
.qnav button.flagged { box-shadow:0 0 0 2px var(--warn) inset; }
.runner-actions { display:flex; gap:12px; margin-top:24px; }
.iconbtn { display:inline-flex; align-items:center; gap:7px; padding:9px 15px; cursor:pointer; border:2px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink-soft); font-weight:600; font-size:14px; }
.iconbtn:hover { border-color:var(--gold); color:var(--navy-800); }
.iconbtn.active { color:var(--gold-700); border-color:var(--gold); background:var(--gold-soft); }

/* ============================== Results ============================= */
.score-hero { text-align:center; padding:36px 22px; }
.score-ring { --p:0; width:160px; height:160px; border-radius:50%; margin:0 auto 18px; display:grid; place-items:center; background:conic-gradient(var(--gold) calc(var(--p)*1%), var(--line) 0); }
.score-ring > div { width:128px; height:128px; border-radius:50%; background:var(--surface); display:grid; place-items:center; }
.score-ring b { font-size:38px; font-weight:700; color:var(--navy-800); }
.review-item { padding:24px; }
.review-item + .review-item { border-top:1px solid var(--line); }

.row-list { display:grid; gap:12px; }
.row-card { display:block; padding:17px 19px; }
.row-card:hover { border-color:var(--gold); }
.bar-row { display:grid; grid-template-columns:160px 1fr 56px; align-items:center; gap:14px; margin-bottom:12px; }
.bar-track { height:11px; background:var(--line); border-radius:999px; overflow:hidden; }
.bar-fill { height:100%; border-radius:999px; }
.bar-val { text-align:right; font-weight:700; font-variant-numeric:tabular-nums; font-size:14px; }
.empty { text-align:center; padding:48px 20px; color:var(--muted); }
.empty svg { color:var(--line-2); margin-bottom:12px; }

/* ============================== Auth =============================== */
.auth-split { min-height:100vh; display:grid; grid-template-columns:1.05fr 1fr; }
@media (max-width:880px){ .auth-split{ grid-template-columns:1fr; } .auth-aside{ display:none; } }
.auth-aside { position:relative; color:#fff; padding:48px; display:flex; flex-direction:column; justify-content:space-between;
  background:radial-gradient(120% 80% at 80% 10%, #6e5230 0%, rgba(110,82,48,0) 55%), linear-gradient(160deg, var(--navy-800), var(--navy-900)); }
.auth-aside .badge-lg { width:128px; height:128px; border-radius:50%; border:4px solid var(--gold); box-shadow:0 0 0 8px rgba(176,141,87,.15); }
.auth-aside h2 { color:#fff; font-size:36px; line-height:1.12; max-width:14ch; }
.auth-aside p { color:#c8bda6; max-width:40ch; font-weight:600; }
.auth-feat { display:flex; align-items:center; gap:10px; color:#ddd3bf; font-size:14.5px; margin-top:11px; font-weight:700; }
.auth-feat .em { width:30px; height:30px; border-radius:50%; background:rgba(176,141,87,.18); display:grid; place-items:center; flex:none; }
.auth-feat svg { color:var(--gold); width:16px; height:16px; }
.auth-main { display:grid; place-items:center; padding:32px 24px; background:var(--bg); }
.auth-card { width:100%; max-width:400px; }
.field { margin-bottom:16px; }
.field label { display:block; font-size:13.5px; font-weight:600; color:var(--ink-soft); margin-bottom:6px; }
.input { width:100%; padding:13px 15px; font-size:15px; font-family:var(--sans); font-weight:700; border:2px solid var(--line-2); border-radius:13px; background:var(--surface); color:var(--ink); transition:all .14s; }
.input:focus { outline:none; border-color:var(--gold); box-shadow:0 0 0 4px var(--gold-soft); }
.form-error { background:var(--bad-soft); color:var(--bad); border:1px solid #f3c9c9; padding:11px 14px; border-radius:13px; font-size:14px; margin-bottom:16px; font-weight:700; }
.flash { padding:12px 16px; border-radius:13px; margin-bottom:18px; font-size:14.5px; font-weight:700; }
.flash-ok { background:var(--ok-soft); color:var(--ok); border:1px solid #bfe6cb; }
.brand-inline { display:flex; align-items:center; gap:11px; margin-bottom:22px; }
.brand-inline img { width:46px; height:46px; border-radius:50%; border:3px solid var(--gold); }
.brand-inline b { font-size:20px; font-weight:700; }

/* responsive helper: hero/goal two-column that stacks on phones */
.cols-hero { grid-template-columns:1.6fr 1fr; }
.head-cta { margin-left:auto; }

/* ============================== Mobile ================================ */
.main { overflow-x:hidden; }
.topbar h1 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }
@media (max-width:760px){
  .cols-hero { grid-template-columns:1fr; }
}
@media (max-width:640px){
  .topbar { height:60px; padding:0 16px; gap:10px; }
  .topbar::after { left:16px; right:16px; }
  .topbar h1 { font-size:18px; }
  .topbar .btn-gold { display:none; }          /* CTA available via sidebar */
  .page { padding:18px 16px 56px; }
  .page-title { font-size:23px; }
  .section-title { font-size:18px; }

  .home-head { flex-direction:column; align-items:flex-start; padding:20px; gap:14px; }
  .home-head h1 { font-size:21px; }
  .home-head .mascot { width:58px; height:58px; }
  .gstats { margin-left:0; width:100%; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
  .gstats .gpill { flex-direction:column; align-items:center; text-align:center; gap:5px; padding:10px 6px; }
  .gstats .gpill .l { font-size:10px; }
  .head-cta { margin-left:0; width:100%; }
  .head-cta .btn { width:100%; }

  .runner-top-inner { padding:10px 14px; gap:10px; }
  .qstem { font-size:18px; }
  .answer { font-size:15px; padding:13px 14px; }
  .review-item, .card-pad { padding:18px; }
  .bar-row { grid-template-columns:110px 1fr 44px; gap:10px; }
}

/* ============================== Icon sizing / refined accents ========= */
.subj-ic svg { width:26px; height:26px; }
.gpill .ic svg { width:18px; height:18px; color:var(--gold); }
.statpill .em { background:var(--gold-soft); color:var(--navy-800); }
.statpill .em svg { width:22px; height:22px; }
.badge .disc svg { width:24px; height:24px; color:var(--gold-700); }
.badge.locked .disc svg { color:var(--muted); }
.ring { --c:var(--gold); }
.home-head .mascot { box-shadow:0 0 0 5px rgba(176,141,87,.14); }
.subj-go svg { width:15px; height:15px; }
