/* Layout: one phone-width study column on cool "exam paper", bottom tab bar.
   Ballpoint-blue ink for actions, highlighter yellow only for what to focus on. */
:root {
  --paper: #F3F5FA;
  --surface: #FFFFFF;
  --ink: #131C33;
  --muted: #59647D;
  --line: #DCE2ED;
  --accent: #1D4FD1;
  --accent-ink: #FFFFFF;
  --accent-soft: #E5ECFC;
  --mark: #FFE45C;
  --good: #177A4D;
  --good-soft: #E2F3E9;
  --warn: #9E5C00;
  --warn-soft: #FBEFD9;
  --bad: #C2372D;
  --bad-soft: #FBE6E4;
  --font-display: "Commissioner", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1322; --surface: #151D30; --ink: #E6EBF5; --muted: #9AA5BC; --line: #27324B;
    --accent: #7AA2FF; --accent-ink: #0D1322; --accent-soft: #1C2A4D; --mark: rgba(233, 207, 69, .38);
    --good: #4BC48B; --good-soft: #13301F; --warn: #E8AB45; --warn-soft: #33270F; --bad: #F2766B; --bad-soft: #3A1A19;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D1322; --surface: #151D30; --ink: #E6EBF5; --muted: #9AA5BC; --line: #27324B;
  --accent: #7AA2FF; --accent-ink: #0D1322; --accent-soft: #1C2A4D; --mark: rgba(233, 207, 69, .38);
  --good: #4BC48B; --good-soft: #13301F; --warn: #E8AB45; --warn-soft: #33270F; --bad: #F2766B; --bad-soft: #3A1A19;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); text-wrap: balance; }
h1 { font-weight: 700; font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
mark { background: linear-gradient(transparent 55%, var(--mark) 55%); color: inherit; padding: 0 3px; }

.app {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 120px;
  display: flex; flex-direction: column; gap: 24px;
}
.app.no-tabs { padding-bottom: 40px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 14px; }
.chip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--surface); white-space: nowrap; }
.hello { display: flex; flex-direction: column; gap: 4px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-num { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12px; color: var(--muted); line-height: 1.3; }
.sample-note { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.rec { background: var(--accent-soft); border-color: transparent; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.rec-topic { font-family: var(--font-display); font-size: 23px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; min-height: 46px; border-radius: 12px; font-weight: 600; font-size: 15px; text-align: center; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: var(--bad); color: var(--surface); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 160px; }

/* Subjects */
.subjects { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.subjects::-webkit-scrollbar { display: none; }
.subj { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.subj.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.subj.is-soon { color: var(--muted); }
.subj .soon { font-size: 11px; font-weight: 500; }

/* Topic list */
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row:hover { background: var(--accent-soft); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.row-name { font-weight: 600; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.row-pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.chev { color: var(--muted); flex: 0 0 auto; width: 18px; height: 18px; }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: inherit; }
.f-strong { background: var(--good); } .f-ok { background: var(--warn); } .f-weak { background: var(--bad); } .f-new { background: var(--muted); }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.p-strong { background: var(--good-soft); color: var(--good); }
.p-ok { background: var(--warn-soft); color: var(--warn); }
.p-weak { background: var(--bad-soft); color: var(--bad); }
.p-new { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }

/* Exam card */
.exam { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* Quiz */
.qbar { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: 0 0 auto; }
.icon-btn svg { width: 18px; height: 18px; }
.qbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qbar-title b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qbar-title span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 7px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.timer.is-low { color: var(--bad); border-color: var(--bad); }
.progress { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.qcard { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.qtext { font-size: 18px; line-height: 1.45; font-weight: 500; text-wrap: pretty; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opts.tf { display: grid; grid-template-columns: 1fr 1fr; }
.opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); transition: border-color .15s, background-color .15s; }
.opt:hover:not([disabled]) { border-color: var(--accent); }
.opt[disabled] { cursor: default; }
.opt-letter { font-family: var(--font-display); font-weight: 700; width: 27px; height: 27px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; flex: 0 0 auto; font-size: 14px; line-height: 1; }
.opt-text { flex: 1; min-width: 0; padding-top: 2px; }
.opts.tf .opt { justify-content: center; font-weight: 600; padding: 16px 12px; }
.opts.tf .opt-text { flex: 0 1 auto; padding-top: 0; }
.opt.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.is-selected .opt-letter { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt.is-correct { border-color: var(--good); background: var(--good-soft); }
.opt.is-correct .opt-letter { background: var(--good); border-color: var(--good); color: var(--surface); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .opt-letter { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.opt.is-dim { opacity: .55; }
.feedback { border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.feedback.ok { background: var(--good-soft); }
.feedback.no { background: var(--bad-soft); }
.feedback-title { font-weight: 700; }
.feedback.ok .feedback-title { color: var(--good); }
.feedback.no .feedback-title { color: var(--bad); }
.confirm { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--warn-soft); border-color: transparent; }
.kbd-hint { font-size: 12px; color: var(--muted); text-align: center; }

/* Results */
.score { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-display); }
.score-big { font-size: 60px; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.score-of { font-size: 22px; color: var(--muted); font-weight: 600; }
.change { padding: 14px 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.change b { font-variant-numeric: tabular-nums; }
.mistake { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.mq { font-weight: 500; }
.ans { font-size: 14px; display: flex; gap: 6px; }
.ans .k { color: var(--muted); flex: 0 0 auto; }
.ans.your b { color: var(--bad); font-weight: 600; }
.ans.right b { color: var(--good); font-weight: 600; }
.ex { font-size: 14px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }

/* Stats */
.advice { padding: 4px 16px; }
.advice-item { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.advice-item:first-child { border-top: 0; }
.advice-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.advice-head b { font-weight: 600; min-width: 0; }
.advice-item p { font-size: 14px; color: var(--muted); }
.advice-item .btn { align-self: flex-start; min-height: 38px; padding: 7px 14px; font-size: 14px; }
.chart-card { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-track { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.bar-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { width: 100%; max-width: 34px; background: var(--accent-soft); border: 1px solid var(--accent); border-bottom: 0; border-radius: 6px 6px 0 0; }
.bar.is-today { background: var(--accent); }
.bar-day { font-size: 12px; color: var(--muted); }
.bar-day.is-today { color: var(--ink); font-weight: 600; }
.missed { padding: 4px 16px; }
.missed-item { padding: 12px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.missed-item:first-child { border-top: 0; }
.missed-item p { font-size: 14px; min-width: 0; }
.missed-count { flex: 0 0 auto; font-size: 12.5px; color: var(--bad); font-weight: 600; white-space: nowrap; }
.teacher { padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.teacher svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.foot { font-size: 12px; color: var(--muted); text-align: center; }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}
.tabs-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.badge { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.badge-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--paper); color: var(--muted); border: 1px dashed var(--muted); }
.badge-ic svg { width: 20px; height: 20px; }
.badge.is-earned .badge-ic, .new-badge .badge-ic, .badge-chip .badge-ic { background: var(--accent); color: var(--accent-ink); border: 0; }
.badge-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.badge-name { font-weight: 700; font-family: var(--font-display); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge-sub { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.badge-desc { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.badge-progress { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge .meter { margin-top: 4px; }
.f-accent { background: var(--accent); }
.badge-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.badge-strip::-webkit-scrollbar { display: none; }
.badge-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 13px; white-space: nowrap; flex: 0 0 auto; }
.badge-chip .badge-ic { width: 26px; height: 26px; }
.badge-chip .badge-ic svg { width: 14px; height: 14px; }
.new-badge { padding: 14px 16px; display: flex; gap: 12px; align-items: center; background: var(--accent-soft); border-color: transparent; }

/* Schedule and study plan */
.exam-next { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.exam-when { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.2; text-wrap: balance; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-settings { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.plan-settings .field { flex: 1 1 140px; }
.field label, .legend { font-size: 12.5px; font-weight: 600; color: var(--muted); }
select, input[type="date"], input[type="text"] { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 42px; width: 100%; }
.session { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.session-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.session-head b { font-family: var(--font-display); font-size: 16px; }
.session-dur { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.lecture-note { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); padding: 6px 10px; border-radius: 8px; }
.block { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.blocks > .block:first-child { border-top: 0; }
.block-min { flex: 0 0 64px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.block-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.block-body b { font-weight: 600; font-size: 14px; }
.block-body span { font-size: 12.5px; color: var(--muted); }
.block .btn { min-height: 34px; padding: 6px 12px; font-size: 13px; flex: 0 0 auto; }
.disclaimer { font-size: 13px; color: var(--muted); padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; }
.agenda { padding: 4px 16px; }
.day { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day-date { flex: 0 0 40px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.day-date span { font-size: 11.5px; color: var(--muted); }
.day-date b { font-family: var(--font-display); font-size: 20px; }
.day.is-today .day-date b, .day.is-today .day-date span { color: var(--accent); }
.day-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ev { font-size: 13.5px; padding: 6px 10px; border-radius: 8px; background: var(--paper); display: flex; justify-content: space-between; gap: 4px 8px; flex-wrap: wrap; }
.ev small { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ev-exam { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.ev-study { background: var(--accent-soft); }
.ev-none { font-size: 13px; color: var(--muted); padding: 6px 0; }
.form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.form-error { color: var(--bad); font-size: 13px; font-weight: 600; }

/* Demo role switch */
.app.wide { max-width: 1120px; }
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); padding: 6px 6px 6px 14px; border: 1px dashed var(--line); border-radius: 12px; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); border: 1px solid transparent; }
.seg button.is-on { background: var(--surface); color: var(--ink); border-color: var(--line); }

/* Teacher dashboard */
.kpis.k4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .kpis.k4 { grid-template-columns: repeat(2, 1fr); } }
.t-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.t-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
@media (max-width: 900px) { .t-grid { grid-template-columns: minmax(0, 1fr); } }
.hm-wrap { overflow-x: auto; padding: 8px; }
.hm { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.hm th { font-weight: 600; color: var(--muted); font-size: 11.5px; padding: 4px; text-align: center; vertical-align: bottom; line-height: 1.2; min-width: 58px; }
.hm th.hm-name, .hm td.hm-name { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 128px; white-space: nowrap; }
.hm td { text-align: center; padding: 7px 6px; border-radius: 6px; font-weight: 600; }
.hm td.hm-avg { font-weight: 700; }
.hm td.hm-last { font-weight: 500; color: var(--muted); font-size: 12px; white-space: nowrap; }
.hm tfoot td { font-weight: 700; }
.c-strong { background: var(--good-soft); color: var(--good); }
.c-ok { background: var(--warn-soft); color: var(--warn); }
.c-weak { background: var(--bad-soft); color: var(--bad); }
.c-new { background: var(--paper); color: var(--muted); }
.name-btn { font-weight: 600; color: var(--ink); }
.name-btn:hover { color: var(--accent); text-decoration: underline; }
.demo-dot { color: var(--accent); font-size: 10px; }
.legend-row { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legend-row i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.section-head select { width: auto; min-height: 36px; padding: 5px 8px; font-size: 13px; }
.row-btn { width: 100%; text-align: left; }
.row-btn:hover .lb-name b { color: var(--accent); }
.row.row-static:hover { background: transparent; }
.row-static .row-main { gap: 6px; }
.hq { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.hq:first-child { border-top: 0; }
.hq-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.hq-wrong { font-size: 13px; }
.hq-wrong b { color: var(--bad); font-weight: 600; }
.reason-list { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.back { align-self: flex-start; min-height: 38px; padding: 7px 14px; font-size: 14px; }
.assign { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.assign:first-child { border-top: 0; }
.assign-head { display: flex; gap: 12px; align-items: center; }
.badge-strip.wrap { flex-wrap: wrap; }

/* Ranking */
.rank-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.rank-big { font-family: var(--font-display); font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pbar { position: relative; height: 10px; border-radius: 99px; background: linear-gradient(90deg, var(--line), var(--accent)); margin: 10px 9px 0; }
.pbar-dot { position: absolute; top: 50%; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 4px solid var(--accent); transform: translate(-50%, -50%); }
.pbar-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.tip { font-size: 14px; background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; }
.lb { padding: 4px 16px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.lb-row:first-child { border-top: 0; }
.lb-pos { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--paper); border: 1px solid var(--line); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.lb-pos.is-top { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lb-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lb-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name span { font-size: 12.5px; color: var(--muted); }
.lb-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-more { padding: 12px 0; border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tab svg { width: 22px; height: 22px; }
.tab.is-active { color: var(--accent); }

@media (max-width: 380px) {
  .kpi-num { font-size: 20px; }
  .opts.tf { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
