:root {
  --bg: #0c0a1f;
  --bg-2: #14102e;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-solid: #1a1538;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f4f2ff;
  --muted: #a8a2c8;
  --brand: #ff2e93;
  --brand-2: #7b2bff;
  --accent: #18e0c8;
  --gold: #ffcf3f;
  --silver: #cdd6e3;
  --bronze: #e08b4c;
  --good: #2ee08a;
  --bad: #ff5470;
  --radius: 18px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Ambient glow anchored to the viewport (not the document) so it stays a soft, even wash
   on tall/mobile pages instead of banding into a hard-edged blob mid-page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 760px at 12% -8%, rgba(123, 43, 255, 0.28), transparent 60%),
    radial-gradient(1000px 720px at 100% 0%, rgba(255, 46, 147, 0.20), transparent 58%),
    radial-gradient(900px 720px at 50% 108%, rgba(24, 224, 200, 0.12), transparent 60%);
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 4px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.02em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  /* same barbell icon as the favicon, so the header logo matches the browser tab */
  background: #0a0a12 url("favicon.svg?v=1") center / 100% 100% no-repeat;
  box-shadow: 0 0 22px rgba(123, 43, 255, 0.5);
  display: inline-block;
}
.brand-text { font-size: 18px; }
.topbar-conf {
  font-size: 13px; color: var(--muted); font-weight: 600;
  border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px;
}
.topbar-conf.has-picker {
  position: relative; display: inline-flex; align-items: center; padding: 0;
  background: var(--panel); transition: border-color 0.15s ease, background 0.15s ease;
}
.topbar-conf.has-picker:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.06); }
.conf-select {
  appearance: none; -webkit-appearance: none; background: transparent; border: none; outline: none;
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--text);
  padding: 7px 30px 7px 14px; cursor: pointer; border-radius: 999px;
}
.conf-select option { background: var(--panel-solid); color: var(--text); font-weight: 600; }
.conf-caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--accent); font-size: 11px; }

/* ── Screen / layout ────────────────────────────────── */
.screen { flex: 1; display: flex; flex-direction: column; padding: 8px 0 36px; }
.footer { padding: 14px 4px 26px; color: var(--muted); font-size: 12.5px; text-align: center; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.fade-in { animation: fade 0.35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Home ───────────────────────────────────────────── */
.home { text-align: center; padding-top: 14px; }
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; margin-bottom: 18px;
}
.home h1 {
  font-size: clamp(30px, 6vw, 52px); line-height: 1.02; margin: 0 0 14px;
  letter-spacing: -0.03em; font-weight: 800;
}
.home h1 .grad {
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 55%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.home .sub { color: var(--muted); font-size: 16px; max-width: 540px; margin: 0 auto 30px; line-height: 1.5; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.mode {
  text-align: left; cursor: pointer; padding: 20px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  position: relative; overflow: hidden;
}
.mode:hover { transform: translateY(-4px); border-color: var(--border-strong); background: rgba(255,255,255,0.06); }
.mode .mode-count { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.mode .mode-name { font-size: 15px; font-weight: 700; margin-top: 2px; }
.mode .mode-level { font-weight: 600; color: var(--muted); font-size: 12px; }
.mode .mode-desc { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.mode .mode-badge { position: absolute; top: 14px; right: 14px; font-size: 18px; }
.mode.q { box-shadow: inset 0 0 0 1px rgba(46,224,138,0.0); }
.mode.q:hover { box-shadow: inset 0 0 0 1px rgba(46,224,138,0.35); }
.mode.t:hover { box-shadow: inset 0 0 0 1px rgba(255,207,63,0.35); }
.mode.g:hover { box-shadow: inset 0 0 0 1px rgba(255,46,147,0.45); }

.roster-note { color: var(--muted); font-size: 13px; }
.roster-note b { color: var(--text); }

/* ── Quiz ───────────────────────────────────────────── */
.quiz-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.progress { flex: 1; height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.3s ease; }
.quiz-meta { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.quiz-meta b { color: var(--text); }
.btn-quit { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-family: inherit; }
.btn-quit:hover { color: var(--text); }

.qcard { padding: 26px; }
.qtype { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.qprompt { font-size: clamp(19px, 3.4vw, 24px); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; margin-bottom: 22px; }
.qprompt .hl { color: var(--brand); }

/* avatar */
.avatar-wrap { display: flex; justify-content: center; margin-bottom: 22px; }
.avatar {
  width: 150px; height: 150px; border-radius: 24px; overflow: hidden;
  border: 2px solid var(--border-strong); box-shadow: var(--shadow);
}
.avatar img, .avatar svg { width: 100%; height: 100%; display: block; object-fit: cover; }

/* options */
.options { display: grid; gap: 12px; }
.opt {
  text-align: left; padding: 16px 18px; border-radius: 14px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  font-size: 16px; font-weight: 600; font-family: inherit;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
  display: flex; align-items: center; gap: 12px;
}
.opt:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(255,255,255,0.06); }
.opt:active:not(:disabled) { transform: scale(0.99); }
.opt .key {
  width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: rgba(255,255,255,0.08); color: var(--muted);
}
.opt.correct { border-color: var(--good); background: rgba(46,224,138,0.14); }
.opt.correct .key { background: var(--good); color: #07210f; }
.opt.wrong { border-color: var(--bad); background: rgba(255,84,112,0.14); }
.opt.wrong .key { background: var(--bad); color: #2b0710; }
.opt.dim { opacity: 0.5; }

.feedback { margin-top: 18px; min-height: 22px; font-weight: 700; font-size: 14px; }
.feedback.ok { color: var(--good); }
.feedback.no { color: var(--bad); }
.feedback .small { display:block; color: var(--muted); font-weight: 500; font-size: 13px; margin-top: 4px; }

.next-row { margin-top: 20px; display: flex; justify-content: flex-end; }

/* buttons */
.btn {
  font-family: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  padding: 13px 24px; border-radius: 13px; border: 1px solid transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 30px -12px rgba(255, 46, 147, 0.7);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: var(--panel); border-color: var(--border); box-shadow: none; color: var(--text); }
.btn.ghost:hover { border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; filter: none; }

/* ── Results ────────────────────────────────────────── */
.results { text-align: center; }
.result-score { font-size: 15px; color: var(--muted); font-weight: 600; }
.result-pct { font-size: clamp(56px, 14vw, 92px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 6px 0 4px; }
.result-line { color: var(--muted); margin-bottom: 26px; }
.pill-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.tier-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; font-size: 13px; padding: 8px 16px; border-radius: 999px; }
.tier-gold { color: #4a3a00; background: linear-gradient(135deg,#ffe07a,#ffcf3f); }
.tier-silver { color: #2c3340; background: linear-gradient(135deg,#eef3fa,#cdd6e3); }
.tier-bronze { color: #3a1f0c; background: linear-gradient(135deg,#f0ad6f,#e08b4c); }
.tier-none { color: var(--muted); background: var(--panel); border:1px solid var(--border); }
.lvl-beginner { color: #052e2a; background: linear-gradient(135deg,#5cf0dc,#18e0c8); }
.lvl-intermediate { color: #fff; background: linear-gradient(135deg,#c07bff,#7b2bff); }
.lvl-gold { color: #4a3a00; background: linear-gradient(135deg,#ffe07a,#ff9d2e); }

.photo-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.photo-btn { font-size: 14px; padding: 11px 18px; }
.photo-remove { font-size: 14px; padding: 11px 16px; }

.badge-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; margin: 22px 0 8px; }
.badge-preview { width: min(420px, 92%); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.badge-preview img { width: 100%; display: block; }

.name-row { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 6px 0 18px; }
.name-row label { font-size: 13px; color: var(--muted); font-weight: 600; }
.name-input {
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text);
  background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 11px 14px; min-width: 220px; outline: none;
}
.name-input:focus { border-color: var(--brand); }

.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

.breakdown { margin: 26px auto 0; max-width: 520px; text-align: left; }
.breakdown summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.breakdown ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.breakdown li { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); }
.breakdown li .mk { flex: none; font-weight: 800; }
.breakdown li.r-ok .mk { color: var(--good); }
.breakdown li.r-no .mk { color: var(--bad); }
.breakdown li .ans { color: var(--muted); margin-left: auto; text-align: right; }

/* ── Wrap report ────────────────────────────────────── */
.wrap-report { margin: 30px auto 0; max-width: 640px; text-align: left; }
.wrap-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 4px; }
.wrap-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.5; }
.wrap-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wrap-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.wrap-review { border-color: rgba(255,159,67,0.35); background: rgba(255,159,67,0.06); }
.wrap-mastered { border-color: rgba(46,224,138,0.30); background: rgba(46,224,138,0.05); }
.wrap-col-head { font-weight: 800; font-size: 13px; letter-spacing: 0.02em; text-transform: uppercase; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.wrap-review .wrap-col-head { color: #ffc78a; }
.wrap-mastered .wrap-col-head { color: #8bf0bd; }
.wrap-count { margin-left: auto; background: rgba(255,255,255,0.10); color: var(--text); border-radius: 999px; font-size: 12px; padding: 2px 9px; font-weight: 700; }
.wrap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; max-height: 320px; overflow-y: auto; }
.wrap-link { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--text);
  padding: 9px 11px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid transparent; transition: border-color 0.12s ease, background 0.12s ease; }
.wrap-link:hover { background: rgba(255,255,255,0.08); border-color: var(--border-strong); }
.wrap-name { font-weight: 700; font-size: 14px; }
.wrap-role { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap-in { margin-left: auto; flex: none; color: #6aa0ff; font-weight: 700; font-size: 12px; }
.wrap-empty { color: var(--muted); font-size: 13px; padding: 8px 4px; }

/* ── Promo banner ───────────────────────────────────── */
.promo-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  text-decoration: none; color: #fff; font-weight: 700; font-size: 16px; text-align: center;
  padding: 14px 22px; border-radius: 14px; margin: 0 0 26px;
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 68%, var(--accent));
  box-shadow: 0 14px 34px -14px rgba(255, 46, 147, 0.7);
  transition: transform 0.14s ease, filter 0.14s ease;
}
.promo-banner:hover { transform: translateY(-2px); filter: brightness(1.07); }
.promo-main { display: inline-flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.promo-emoji { font-size: 20px; }
.promo-main b { background: rgba(255, 255, 255, 0.22); padding: 2px 10px; border-radius: 999px; font-weight: 800; }
.promo-cta { flex: none; background: #fff; color: var(--brand-2); font-weight: 800; font-size: 14px; padding: 8px 16px; border-radius: 999px; white-space: nowrap; }

/* ── Leaderboards ───────────────────────────────────── */
.leaderboards { margin: 34px 0 4px; }
.lb-heading { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 14px; text-align: center; }
.lb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lb-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px 8px; }
.lb-card-head { font-weight: 800; font-size: 14px; letter-spacing: 0.01em; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.lb-card-head span { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,0.08); padding: 2px 8px; border-radius: 999px; }
.lb-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; font-size: 13.5px; border-radius: 8px; }
.lb-row + .lb-row { border-top: 1px solid rgba(255,255,255,0.05); }
.lb-rank { flex: none; width: 22px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-row.r1 .lb-rank { color: var(--gold); }
.lb-row.r2 .lb-rank { color: var(--silver); }
.lb-row.r3 .lb-rank { color: var(--bronze); }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.lb-me { background: rgba(255,46,147,0.14); outline: 1px solid rgba(255,46,147,0.4); }
.lb-me .lb-name::after { content: " · you"; color: var(--brand); font-weight: 700; }
.lb-empty { color: var(--muted); font-size: 13px; padding: 10px 4px 14px; }

/* results leaderboard panel */
.lb-result { margin: 30px auto 0; max-width: 460px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 10px; text-align: left; }
.lb-result .lb-heading { font-size: 16px; margin-bottom: 12px; }
.lb-top10 { color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 10px; text-align: center; }
.lb-submit { display: flex; gap: 10px; margin-bottom: 14px; }
.lb-submit .name-input { flex: 1; min-width: 0; }
.lb-submit .btn { flex: none; padding: 11px 18px; }

@media (max-width: 560px) {
  .modes { grid-template-columns: 1fr; }
  .qcard { padding: 20px; }
  .wrap-cols { grid-template-columns: 1fr; }
  .lb-grid { grid-template-columns: 1fr; }
  .promo-banner { font-size: 14px; padding: 12px 16px; gap: 10px; margin-bottom: 20px; }
  .promo-cta { font-size: 13px; padding: 7px 13px; }
  /* keep the topbar (brand + conference picker) on one row without overflowing */
  .topbar { gap: 8px; padding: 16px 0 10px; }
  .brand { min-width: 0; gap: 9px; }
  .brand-mark { flex: none; }
  .brand-text { font-size: 14.5px; line-height: 1.12; }
  .topbar-conf { flex: 0 1 auto; min-width: 0; }
  .conf-select { font-size: 12px; padding: 6px 24px 6px 11px; max-width: 100%; }
  .conf-caret { right: 9px; font-size: 10px; }
}
@media (max-width: 340px) {
  /* genuinely tiny screens: brand mark only, give the picker full room */
  .brand-text { display: none; }
}
