/* ===========================================================
   K53 Learners Testing — design system
   Sophisticated emerald + gold palette, serif display headings.
   =========================================================== */
:root {
  --bg: #0b0b0d;            /* near-black */
  --bg-2: #141418;
  --card: #17171c;          /* dark card */
  --ink: #f4f3ef;           /* off-white text */
  --muted: #9a9a94;
  --line: #29292f;
  --line-strong: #3a3a42;

  --brand: #e3a72c;         /* K53 gold */
  --brand-2: #c68d1a;       /* deeper gold */
  --brand-ink: #10100c;     /* near-black text on gold */
  --brand-soft: #221b0c;    /* dark gold tint */

  --gold: #e3a72c;          /* gold accent */
  --gold-soft: #221b0c;

  --ok: #35c17a;
  --ok-bg: #11291c;
  --bad: #e2695e;
  --bad-bg: #2c1411;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow: 0 6px 22px rgba(0,0,0,.5);
  --shadow-lg: 0 18px 44px rgba(0,0,0,.6);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0e1614;
  --bg-2: #121c19;
  --card: #16211e;
  --ink: #e9efec;
  --muted: #9aaaa4;
  --line: #243330;
  --line-strong: #2e403c;
  --brand: #18b89f;
  --brand-2: #0f8e7b;
  --brand-soft: #142a26;
  --gold: #d2a861;
  --gold-soft: #2a2418;
  --ok-bg: #11301f;
  --bad-bg: #331a18;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 6px 22px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 44px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  background-image: radial-gradient(70% 55% at 50% -8%, rgba(227,167,44,.13), transparent 62%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px;
  background: #0e0e12;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 8px 24px rgba(0,0,0,.5);
  border-bottom: 1px solid var(--line);
}
/* K53FREE logo (image); the K53/FREE spans stay as hidden text for SEO + a11y */
.brandlink {
  display: block; width: 116px; height: 35px; text-decoration: none;
  background: url('logo.png') no-repeat left center / contain;
  font-size: 0; color: transparent;
}
.logo-k53, .logo-free { display: none; }  /* text kept in DOM for a11y/SEO but the logo image is shown instead */
.brandlink::after { content: none; }
/* legacy emblem/wordmark (kept for any old markup) */
.emblem { font-family: var(--sans); font-weight: 800; font-style: italic; font-size: 22px; color: var(--brand); }
.wordmark { font-family: var(--sans); font-weight: 800; font-style: italic; font-size: 22px; color: #fff; }
.badge {
  background: rgba(227,167,44,.12); padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .3px;
  color: var(--brand); border: 1px solid rgba(227,167,44,.38);
}

main { max-width: 740px; margin: 0 auto; padding: 22px 18px 8px; }
.screen { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Typography ---------- */
h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.15; margin: 2px 0 6px; letter-spacing: .2px; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 23px; line-height: 1.2; margin: 6px 0 16px; }
h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); font-weight: 700; margin: 26px 0 10px; }
.muted { color: var(--muted); }
small { color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}
.hero p { color: var(--muted); margin: 4px 0 18px; font-size: 15px; }

.codepick label { display: block; font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; }
.seg { display: flex; gap: 6px; background: var(--bg); padding: 5px; border-radius: 13px; border: 1px solid var(--line); }
.seg button {
  flex: 1; padding: 11px 8px; border: 1px solid transparent; background: transparent;
  border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: all .16s ease; font-size: 14px;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--brand); border-color: var(--line); box-shadow: var(--shadow-sm); }
.codepick small { display: block; margin-top: 10px; }

/* ---------- Tiles ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.tile {
  text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; cursor: pointer; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 5px; color: var(--ink);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.tile:active { transform: translateY(-1px); }
.tile b { font-size: 16px; font-weight: 600; }
.tile span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.tile.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--brand-ink); border-color: transparent; grid-column: 1 / -1;
  box-shadow: 0 10px 26px rgba(227,167,44,.28);
}
.tile.primary::after {
  content: "›"; position: absolute; right: 20px; font-size: 26px; opacity: .55; font-weight: 400;
}
.tile.primary { position: relative; }
.tile.primary b { font-size: 18px; }
.tile.primary span { color: rgba(16,16,12,.72); }
.tile.primary:hover { box-shadow: 0 16px 36px rgba(227,167,44,.4); }

.lastrun { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.pass { color: var(--ok); font-weight: 700; }
.fail { color: var(--bad); font-weight: 700; }

/* ---------- Buttons ---------- */
button { font: inherit; }
.primary, .ghost, .back { border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; transition: all .16s ease; }
.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); border: none;
  padding: 13px 18px; font-weight: 700; letter-spacing: .2px;
  box-shadow: 0 6px 16px rgba(227,167,44,.24);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(227,167,44,.34); }
.primary:active { transform: translateY(0); }
.primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }
.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); padding: 12px 18px; font-weight: 600; }
.ghost:hover { border-color: var(--brand); color: var(--brand); }
.big { display: block; width: 100%; margin-top: 14px; padding: 15px; font-size: 16px; }
.back { background: none; border: none; color: var(--brand); font-weight: 600; padding: 6px 0; margin-bottom: 6px; font-size: 14.5px; }
.back:hover { opacity: .75; }

/* Guide/FAQ pages: the CTA banner is gold, so force dark text for contrast */
.guide-cta, .guide-cta h3, .guide-cta p { color: var(--brand-ink) !important; }

/* ---------- Form fields ---------- */
.fld { display: block; margin: 16px 0; font-weight: 600; font-size: 14px; }
.fld select, .fld input {
  display: block; width: 100%; margin-top: 8px; padding: 12px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fld select:focus, .fld input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.row { display: flex; align-items: center; gap: 11px; margin: 16px 0; font-weight: 600; }
.row input { width: 19px; height: 19px; accent-color: var(--brand); }

/* ---------- List rows ---------- */
.rowbtn {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 15px 16px; margin-bottom: 9px; cursor: pointer; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.rowbtn:hover { transform: translateX(3px); border-color: var(--brand); box-shadow: var(--shadow); }
.rowbtn span { font-weight: 600; }
.rowbtn small { background: var(--bg); padding: 3px 11px; border-radius: 999px; font-weight: 600; }

/* ---------- Question / flash / review cards ---------- */
.qcard, .flash, .reviewcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.sign { display: flex; justify-content: center; margin-bottom: 18px; }
.sign svg { width: auto; height: 140px; max-width: 100%; }
.sign .signimg {
  height: 140px; width: auto; max-width: 100%; object-fit: contain;
  padding: 12px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm);
}
.reviewcard .sign .signimg { height: 92px; }
.opt .optsign { height: 62px; width: auto; max-width: 100%; }
.yours .optsign, .answer .optsign { height: 50px; width: auto; vertical-align: middle; background:#fff; border-radius:8px; padding:4px; }
.qprompt { font-size: 19px; font-weight: 600; margin-bottom: 16px; line-height: 1.4; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; font-style: italic; }
.options { display: flex; flex-direction: column; gap: 11px; }
.opt {
  display: flex; align-items: center; gap: 13px; text-align: left;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .1s ease;
}
.opt:hover:not(:disabled) { border-color: var(--brand); }
.opt:active:not(:disabled) { transform: scale(.992); }
.opt .dot { flex: 0 0 19px; width: 19px; height: 19px; border-radius: 50%; border: 2px solid var(--line-strong); transition: all .14s ease; }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px var(--card); }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .dot { border-color: var(--ok); background: var(--ok); box-shadow: inset 0 0 0 3px var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .dot { border-color: var(--bad); background: var(--bad); box-shadow: inset 0 0 0 3px var(--bad-bg); }
.opt:disabled { cursor: default; }

.feedback { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.feedback.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.feedback.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.feedback strong { font-family: var(--serif); }
.feedback p { margin: 6px 0 0; color: var(--ink); font-size: 14px; }

/* ---------- Flashcards ---------- */
.flash .answer { margin: 12px 0; padding: 12px 14px; background: var(--brand-soft); border-radius: var(--radius-sm); font-size: 15px; }
.navrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.navrow #counter { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Exam ---------- */
.examhead { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.progbar { flex: 1; height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.06); }
.progbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold)); width: 0; transition: width .25s ease; border-radius: 999px; }
#timer, #pc { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
#timer.low { color: var(--bad); }
.pager { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.pg { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; transition: all .12s ease; }
.pg:hover { border-color: var(--brand); }
.pg.done { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.pg.cur { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: var(--shadow-sm); }
.pg.flag { box-shadow: inset 0 0 0 2px var(--gold); }
#flag.on { border-color: var(--gold); color: var(--gold); }

/* ---------- Section banner & briefing ---------- */
.secbanner {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  color: var(--ink); border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px;
  font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  box-shadow: var(--shadow-sm);
}
.secbanner b { font-weight: 600; }
.secbanner .sb-pos { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.brief { list-style: none; padding: 0; margin: 16px 0; }
.brief li { padding: 12px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 9px; background: var(--card); font-size: 14px; box-shadow: var(--shadow-sm); }
.brief li b { color: var(--brand); }

/* ---------- Tables ---------- */
.spec { width: 100%; border-collapse: collapse; margin: 14px 0; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.spec th, .spec td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.spec th { background: var(--bg); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.spec tr:last-child td { border-bottom: none; }
.spec tr.totrow td { background: var(--gold-soft); }
.spec tr.rp td { background: var(--ok-bg); }
.spec tr.rf td { background: var(--bad-bg); }

/* ---------- Results ---------- */
.result { text-align: center; }
.verdict {
  font-family: var(--serif); font-size: 46px; font-weight: 700; letter-spacing: 2px; margin: 14px 0 6px;
  display: inline-block;
}
.verdict.pass { color: var(--ok); }
.verdict.fail { color: var(--bad); }
.verdict-msg { font-weight: 600; font-size: 16px; margin: 6px 0 14px; }
.bigscore { font-family: var(--serif); font-size: 52px; font-weight: 700; color: var(--brand); }
.spec { text-align: left; }
.allright { color: var(--ok); font-weight: 600; }
.reviewcard { margin-bottom: 12px; text-align: left; }
.reviewcard .sign svg { width: 92px; height: 92px; }
.yours { padding: 9px 12px; border-radius: 9px; margin: 7px 0; font-size: 14px; }
.yours.ok { background: var(--ok-bg); }
.yours.bad { background: var(--bad-bg); }

/* ---------- Topic progress ---------- */
.tprog { display: grid; grid-template-columns: 1fr 110px 46px; align-items: center; gap: 12px; margin: 10px 0; font-size: 14px; }
.tprog .bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.tprog .bar i { display: block; height: 100%; border-radius: 999px; transition: width .3s ease; }
.tprog .bar i.low { background: var(--bad); }
.tprog .bar i.mid { background: var(--gold); }
.tprog .bar i.hi { background: var(--ok); }
.tprog b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Ads ---------- */
.adbox { display: block; width: 100%; margin: 20px 0; min-height: 90px; border-radius: var(--radius-sm); }
.adbox.placeholder {
  display: flex; align-items: center; justify-content: center; min-height: 100px;
  background: var(--bg); border: 1px dashed var(--line-strong); color: var(--muted);
}
.adbox.placeholder span {
  background: var(--card); padding: 5px 14px; border-radius: 999px;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase; box-shadow: var(--shadow-sm);
}

/* ---------- Section test tiles ---------- */
.sectiles { display: flex; flex-direction: column; gap: 11px; margin: 16px 0; }
.sectile { padding: 17px 16px; }
.examtitle { font-weight: 700; color: var(--muted); font-size: 14px; }

/* ---------- Footer ---------- */
footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 30px 18px; line-height: 1.7; }
footer a { color: var(--brand); font-weight: 600; }
.seoline { max-width: 620px; margin: 0 auto 14px; font-size: 13px; line-height: 1.6; }
.seoline strong { color: var(--ink); }

/* ---------- Home action buttons (install / share) ---------- */
.homeactions { display: flex; gap: 10px; margin: 12px 0 2px; }
.actbtn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s; font-size: 14px;
}
.actbtn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.actbtn.install { background: linear-gradient(135deg, var(--gold), #c79a4e); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(176,134,67,.25); }
.actbtn.share { border-color: var(--brand); color: var(--brand); }
.actbtn.share:hover { background: var(--brand-soft); }
@media (max-width: 460px) { .homeactions { flex-direction: column; } }

/* Modal (install instructions) */
.modalback { position: fixed; inset: 0; background: rgba(10,20,18,.55); display: flex; align-items: center; justify-content: center; z-index: 1100; padding: 18px; animation: fade .2s ease; }
.modal { background: var(--card); border-radius: var(--radius); padding: 22px; max-width: 420px; width: 100%; box-shadow: var(--shadow-lg); }
.modaltitle { font-family: var(--serif); font-size: 20px; margin: 0 0 10px; }
.modalbody { font-size: 14.5px; color: var(--ink); }
.modalbody ol { margin: 0 0 6px; padding-left: 20px; }
.modalbody li { margin: 8px 0; }
.sharemodal { text-align: center; max-width: 380px; }
.shareimg { width: 100%; max-width: 300px; border-radius: 14px; margin: 4px auto 14px; display: block; box-shadow: var(--shadow); }
.sharemodal .big { margin-top: 8px; }

/* ---------- Driving Schools directory ---------- */
.dscontrols { display: flex; gap: 10px; align-items: flex-end; margin: 12px 0 8px; }
.dslist { display: flex; flex-direction: column; gap: 11px; margin-bottom: 8px; }
.dscard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; position: relative;
}
.dscard b { font-size: 16px; }
.dsarea { color: var(--muted); font-size: 13px; }
.dscard.feat { border-color: var(--gold); box-shadow: 0 6px 18px rgba(176,134,67,.18); background: linear-gradient(180deg, var(--gold-soft), var(--card) 60%); }
.dsbadge { position: absolute; top: 12px; right: 14px; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .3px; }
.dsactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dsbtn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; border: 1px solid var(--line-strong); color: var(--ink); background: var(--card); }
.dsbtn:hover { border-color: var(--brand); color: var(--brand); }
.dsbtn.call { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.dscta { margin: 22px 0 8px; padding: 18px; text-align: center; background: var(--brand-soft); border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: var(--radius); }
.dscta b { font-family: var(--serif); font-size: 17px; }
.dscta p { color: var(--muted); margin: 6px 0 12px; font-size: 14px; }
.dscta .primary { max-width: 320px; margin: 0 auto; }

/* Sponsored driving-school card (results screen) */
.sponsorcard { position: relative; display: block; width: 100%; text-align: left; margin: 14px 0; padding: 16px; border-radius: var(--radius); border: 1px solid var(--gold); background: linear-gradient(180deg, var(--gold-soft), var(--card) 70%); box-shadow: var(--shadow-sm); color: var(--ink); }
.sponsorcard b { display: block; font-size: 16px; }
.sponsorlabel { display: block; color: var(--gold); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 2px; }
.sponsorcard.cta { cursor: pointer; text-align: center; border-style: dashed; transition: transform .15s, box-shadow .15s; }
.sponsorcard.cta:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.sponsorcard.cta small { color: var(--muted); }

/* ---------- Gamification ---------- */
.statstrip {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; width: 100%;
  margin: 14px 0 2px; padding: 12px 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); color: var(--ink); transition: box-shadow .15s, transform .15s;
}
.statstrip:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.statstrip .stat { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.statstrip .stat + .stat { border-left: 1px solid var(--line); padding-left: 12px; align-items: center; }
.stat-top { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.xpbar { width: 100%; height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 2px 0; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold)); border-radius: 999px; transition: width .4s ease; }
.xpbar.big { height: 11px; }

.xpchip {
  display: inline-block; margin: 6px auto 4px; padding: 4px 14px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold); font-weight: 700; font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
}

/* Achievements screen */
.achead { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; margin: 8px 0 6px; }
@media (max-width: 520px) { .achead { grid-template-columns: 1fr; } }
.lvlbig { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.lvlnum { font-family: var(--serif); font-size: 28px; font-weight: 700; line-height: 1; }
.lvlrank { color: rgba(255,255,255,.85); font-weight: 600; margin: 2px 0 12px; }
.lvlbig .xpbar { background: rgba(255,255,255,.25); }
.lvlbig .xpbar i { background: var(--gold); }
.lvlbig small { color: rgba(255,255,255,.8); display: block; margin-top: 8px; }
.acstats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acstat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; box-shadow: var(--shadow-sm); }
.acstat b { display: block; font-family: var(--serif); font-size: 22px; }
.acstat span { font-size: 12px; color: var(--muted); }

.badgegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; margin: 8px 0 20px; }
.achbadge { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 12px; text-align: center; box-shadow: var(--shadow-sm); transition: transform .15s; }
.achbadge.on { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.achbadge.on:hover { transform: translateY(-3px); }
.achbadge.off { opacity: .55; filter: grayscale(0.9); }
.b-icon { font-size: 34px; display: block; margin-bottom: 6px; }
.achbadge b { display: block; font-size: 14px; }
.achbadge small { color: var(--muted); font-size: 11.5px; line-height: 1.3; display: block; margin-top: 3px; }

/* Toasts */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 11px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px;
  padding: 11px 16px; box-shadow: var(--shadow-lg); min-width: 230px; max-width: 90vw;
  opacity: 0; transform: translateY(-14px); transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast .t-icon { font-size: 26px; }
.toast small { color: var(--muted); }

/* Star rating */
.ratebox { margin: 18px 0 6px; }
.rate-prompt { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.stars { display: inline-flex; gap: 4px; }
.star { background: none; border: none; cursor: pointer; font-size: 30px; line-height: 1; padding: 0 2px; color: var(--line-strong); transition: color .1s ease, transform .1s ease; }
.star:hover { transform: scale(1.12); }
.star.on { color: var(--gold); }
.rated { font-weight: 600; color: var(--gold); font-size: 15px; }
