/* Manabi — base styles (mobile first). Tokens live in themes.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  /* Subtle seigaiha-like dot texture. */
  background-image: radial-gradient(var(--bg-pattern) 1px, transparent 1.4px);
  background-size: 18px 18px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.has-tabbar { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
[lang="ja"] { font-family: var(--font-jp); }
h1, h2, h3 { line-height: 1.25; margin: 0; color: var(--text); }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
ul, ol { margin: 0; padding: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--navy); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.text-danger { color: var(--bad); }

/* ---------------------------------------------------------------- Layout */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 32px; display: flex; flex-direction: column; gap: 20px; outline: none; }
.main--focus { max-width: 680px; }
.main--auth { max-width: 440px; justify-content: center; min-height: 100vh; padding-top: 24px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: 0.02em; min-height: 44px; }
.brand__mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--navy); color: var(--bg); font-size: 18px; position: relative; }
.brand__mark::after { content: ""; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.topbar__title { flex: 1; min-width: 0; font-weight: 600; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.topbar__user { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar__name { color: var(--text-muted); font-size: 0.9rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 18px rgba(31, 42, 68, 0.05);
}
.tabbar__link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; text-decoration: none; color: var(--text-muted); font-size: 0.75rem; font-weight: 600; }
.tabbar__icon { font-size: 1.15rem; line-height: 1; }
.tabbar__link.is-active { color: var(--accent); }
.tabbar__link.is-active .tabbar__icon { transform: translateY(-1px); }

/* ---------------------------------------------------------------- Components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card--inset { box-shadow: none; background: var(--surface-2); }
.panel { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.panel__title { font-size: 1.05rem; }
.panel__sub { font-size: 0.95rem; margin-top: 8px; }
.page-title { font-size: 1.5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.page-title__jp { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }
.section-title { font-size: 1.05rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 4px; height: 1em; border-radius: 2px; background: var(--accent); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head .section-title { margin-bottom: 0; }
.link-more { font-weight: 600; font-size: 0.9rem; min-height: 44px; display: inline-flex; align-items: center; }
.crumbs { font-size: 0.9rem; color: var(--text-muted); }
.crumbs a { color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease), border-color .15s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); color: var(--on-accent); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn--soft { background: var(--navy-soft); color: var(--navy); }
.btn--soft:hover { filter: brightness(0.97); color: var(--navy); }
.btn--danger { background: var(--bad); color: #fff; }
.btn--danger:hover { filter: brightness(1.08); color: #fff; }
.btn--sm { min-height: 44px; padding: 0 14px; font-size: 0.9rem; }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: 0.8rem; font-weight: 600; width: fit-content; }
.chip--accent { background: var(--accent-soft); color: var(--accent); }
.chip--muted { background: transparent; border: 1px dashed var(--border); }
.chip--warn { background: var(--warn-soft); color: var(--warn); margin-left: 8px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--bad { background: var(--bad-soft); color: var(--bad); }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy), var(--accent)); transition: width .35s var(--ease); }

.banner { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.92rem; }
.banner--warn { background: var(--warn-soft); color: var(--warn); }
.banner--error { background: var(--bad-soft); color: var(--bad); }
.main > .banner, .app > .banner { margin: 0 16px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form--inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.form--inline .field { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-weight: 600; font-size: 0.92rem; }
.field__control { position: relative; display: flex; }
.field__control .input { flex: 1; }
.field__toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 40px; min-width: 56px; border: 0; background: transparent; color: var(--accent); font-weight: 600; cursor: pointer; border-radius: 8px; }
.field__hint { font-size: 0.82rem; color: var(--text-muted); }
.field__error { font-size: 0.85rem; color: var(--bad); min-height: 0; }
.field__error:empty { display: none; }
.form-error { color: var(--bad); font-weight: 600; }
.form-error:empty { display: none; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input--sm { min-height: 44px; padding: 8px 10px; }
.field__control .input[type="password"], .field__control .input[type="text"] { padding-right: 68px; }
input[type="file"].input { padding: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }

/* Loading / empty / toast / dialog */
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 100vh; color: var(--text-muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 28px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty__mark { font-family: var(--font-mincho); font-size: 2.4rem; color: var(--border); line-height: 1; }
.empty__title { font-size: 1.05rem; }
.empty .btn { margin-top: 8px; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--navy); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 0.92rem; animation: toast-in .25s var(--ease); pointer-events: auto; }
.toast--success .toast__icon { background: var(--ok); }
.toast--error { background: var(--bad); color: #fff; }
.toast__icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--bg) 25%, transparent); color: #fff; font-weight: 700; font-size: 0.8rem; }
.toast--out { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.dialog { border: 0; border-radius: var(--radius-lg); padding: 22px; width: min(92vw, 440px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(18, 21, 28, 0.45); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop .2s var(--ease); }
.dialog__title { font-size: 1.15rem; margin-bottom: 8px; }
.dialog__body { color: var(--text-muted); display: flex; flex-direction: column; gap: 8px; }
.dialog__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }

/* ---------------------------------------------------------------- Auth */
.auth { display: flex; flex-direction: column; gap: 20px; }
.auth__hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.auth__kanji { font-family: var(--font-mincho); font-size: 3.4rem; line-height: 1.1; color: var(--navy); position: relative; }
.auth__kanji::before { content: ""; position: absolute; inset: 50% auto auto 50%; width: 84px; height: 84px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--accent-soft); z-index: -1; }
.auth__kana { letter-spacing: .5em; color: var(--text-muted); font-size: 0.9rem; padding-left: .5em; }
.auth__card { padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; }
.auth__title { font-size: 1.4rem; }
.auth__subtitle { color: var(--text-muted); margin-top: -8px; }
.auth__footer { display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; text-align: center; border-top: 1px solid var(--border); padding-top: 14px; }
.auth__note { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; }

/* ---------------------------------------------------------------- Dashboard */
.hero { display: flex; flex-direction: column; gap: 4px; }
.hero__greet { color: var(--accent); font-weight: 600; }
.hero__title { font-size: 1.7rem; margin-bottom: 12px; }
.continue { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(135deg, var(--navy) 0%, color-mix(in srgb, var(--navy) 80%, var(--accent)) 140%); border: 0; color: var(--bg); }
.continue__label { font-weight: 700; font-size: 1.05rem; }
.continue__detail { opacity: .85; font-size: 0.9rem; }
.continue__actions { display: flex; gap: 8px; flex: none; }
.continue .btn--ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.continue .btn--ghost:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); color: var(--bg); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.stat__value { font-size: 1.5rem; font-weight: 750; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat__label { font-weight: 600; font-size: 0.85rem; }
.stat__sub { color: var(--text-muted); font-size: 0.78rem; }

.cats, .modules { list-style: none; display: grid; gap: 10px; }
.cat, .module { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: var(--text); transition: transform .15s var(--ease), box-shadow .15s var(--ease); min-height: 76px; }
a.cat:hover, a.module:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.cat__jp, .module__jp { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 1.25rem; background: var(--navy-soft); color: var(--navy); font-family: var(--font-jp); }
.cats li:first-child .cat__jp { background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; }
.cat__body, .module__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cat__title, .module__title { font-weight: 700; font-size: 1.05rem; display: flex; align-items: baseline; gap: 8px; }
.cat__sub { font-weight: 500; font-size: 0.82rem; color: var(--text-muted); }
.cat__chev { color: var(--text-muted); font-size: 1.6rem; line-height: 1; }
.cat--disabled, .module--disabled { opacity: .62; box-shadow: none; }
.cat--disabled .cat__jp { background: var(--surface-2); color: var(--text-muted); }
.module__desc { color: var(--text-muted); font-size: 0.9rem; }

.activity { list-style: none; padding: 4px 0; }
.activity__item + .activity__item { border-top: 1px solid var(--border); }
.activity__link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--text); min-height: 60px; }
.activity__link:hover { background: var(--surface-2); color: var(--text); }
.activity__badge { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--navy-soft); color: var(--navy); font-weight: 700; font-size: 0.85rem; }
.activity__badge--katakana { background: var(--accent-soft); color: var(--accent); }
.activity__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.activity__title { font-weight: 650; }
.activity__meta { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity__score { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-size: 0.85rem; }

/* ---------------------------------------------------------------- Practice */
.setup { padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.setup__jp { position: absolute; right: -6px; top: -18px; font-size: 7rem; font-family: var(--font-mincho); color: var(--accent-soft); line-height: 1; pointer-events: none; z-index: 0; }
.setup > * { position: relative; }
.setup__count { font-size: 0.9rem; color: var(--text-muted); }
.setup__group { display: flex; flex-direction: column; gap: 8px; }
.setup__label { font-weight: 650; font-size: 0.9rem; }
.setup__actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.setup__actions .btn--primary { flex: 1; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: 14px; width: fit-content; max-width: 100%; }
.segmented__opt { min-height: 44px; min-width: 56px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; font-weight: 650; color: var(--text-muted); cursor: pointer; }
.segmented__opt[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.practice { display: flex; flex-direction: column; gap: 16px; }
.practice__top { display: flex; flex-direction: column; gap: 10px; }
.practice__meta { display: flex; align-items: center; gap: 10px; }
.practice__counter { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.practice__counter strong { color: var(--text); font-size: 1.15rem; }
.practice__score { display: flex; gap: 6px; margin-right: auto; }
.practice__stage { display: flex; flex-direction: column; gap: 14px; animation: rise .25s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.qcard { padding: 22px 18px 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; position: relative; }
.qcard::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 48px; height: 4px; border-radius: 0 0 4px 4px; background: var(--accent); }
.qcard__instr { color: var(--text-muted); font-size: 0.92rem; }
.prompt { font-size: clamp(2.2rem, 11vw, 3.4rem); font-weight: 700; line-height: 1.25; letter-spacing: 0.04em; word-break: break-word; color: var(--text); }
.prompt--kanji { font-family: var(--font-mincho); font-size: clamp(4rem, 26vw, 6.5rem); font-weight: 600; line-height: 1.1; }
.prompt--sentence { font-size: clamp(1.45rem, 6.4vw, 2rem); letter-spacing: 0.03em; line-height: 1.6; }
.qcard__assisted { margin: 0; }
.help-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.help { width: 100%; padding: 14px; border-radius: var(--radius-sm); background: var(--info-soft); display: flex; flex-direction: column; align-items: center; gap: 10px; animation: rise .2s var(--ease); }
.help__list, .feedback__list { margin: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.help__list div, .feedback__list div { display: flex; gap: 10px; justify-content: center; align-items: baseline; flex-wrap: wrap; }
dt { color: var(--text-muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
dd { margin: 0; }
.help__reading, .feedback__reading { font-size: 1.35rem; font-weight: 700; }

.answer-form { display: flex; flex-direction: column; gap: 6px; }
.input--answer { min-height: 56px; font-size: 1.35rem; text-align: center; font-family: var(--font-jp); letter-spacing: 0.04em; }
.answer-form .field__hint { text-align: center; }

.options { list-style: none; display: grid; gap: 10px; }
.option {
  width: 100%; min-height: 60px; display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  text-align: left; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color .15s, background-color .15s, transform .1s var(--ease);
}
.option:hover:not(:disabled) { border-color: var(--navy); transform: translateY(-1px); }
.option:active:not(:disabled) { transform: scale(.99); }
.option:disabled { cursor: default; }
.option__key { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); font-size: 0.85rem; font-weight: 700; }
.option__text { display: flex; flex-direction: column; min-width: 0; }
.option__label { font-size: 1.25rem; font-weight: 650; line-height: 1.4; word-break: break-word; }
.option__sub { font-size: 0.85rem; color: var(--text-muted); }
.option.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.option.is-correct .option__key { background: var(--ok); color: #fff; }
.option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.is-wrong .option__key { background: var(--bad); color: #fff; }
.option.is-dim { opacity: .55; }

.feedback { padding: 14px 16px; border-radius: var(--radius); border: 1.5px solid; display: flex; flex-direction: column; gap: 8px; text-align: center; animation: rise .2s var(--ease); }
.feedback--ok { border-color: var(--ok); background: var(--ok-soft); }
.feedback--bad { border-color: var(--bad); background: var(--bad-soft); }
.feedback--info { border-color: var(--border); background: var(--info-soft); }
.feedback__head { font-weight: 750; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
.feedback--ok .feedback__head { color: var(--ok); }
.feedback--bad .feedback__head { color: var(--bad); }
.feedback__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: currentColor; }
.feedback__icon { color: inherit; }
.feedback--ok .feedback__icon, .feedback--bad .feedback__icon { color: #fff; background: var(--ok); }
.feedback--bad .feedback__icon { background: var(--bad); }
.feedback--info .feedback__icon { background: var(--surface); }

.practice__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.practice__actions .btn { flex: 1 1 120px; }
.practice__actions .btn--primary { flex: 2 1 160px; }

/* ---------------------------------------------------------------- Summary */
.summary { padding: 24px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.summary__eyebrow { color: var(--text-muted); font-size: 0.88rem; font-weight: 600; }
.summary__title { font-size: 1.3rem; }
.ring { --deg: 0deg; width: 148px; height: 148px; border-radius: 50%; display: grid; place-content: center; margin: 6px 0;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%), conic-gradient(var(--accent) var(--deg), var(--surface-2) 0); }
.ring__value { font-size: 2rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.ring__label { font-size: 0.8rem; color: var(--text-muted); }
.summary__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: 100%; margin: 8px 0 0; }
.summary__cell { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column-reverse; gap: 2px; }
.summary__cell dd { font-size: 1.2rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.summary__cell dt { text-transform: none; letter-spacing: 0; font-size: 0.78rem; }
.summary__actions { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.summary__actions .btn { flex: 1; }

.review { list-style: none; }
.review__item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; }
.review__item + .review__item { border-top: 1px solid var(--border); }
.review__icon { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; background: var(--surface-2); color: var(--text-muted); margin-top: 2px; }
.review__item--correct .review__icon { background: var(--ok); color: #fff; }
.review__item--incorrect .review__icon { background: var(--bad); color: #fff; }
.review__body { flex: 1; min-width: 0; }
.review__prompt { font-weight: 650; font-size: 1.05rem; word-break: break-word; }
.review__answer { color: var(--text-muted); font-size: 0.9rem; word-break: break-word; }
.review__yours { color: var(--bad); font-size: 0.85rem; }
.review__tag { flex: none; font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.review__tag--correct { background: var(--ok-soft); color: var(--ok); }
.review__tag--incorrect { background: var(--bad-soft); color: var(--bad); }

/* ---------------------------------------------------------------- History */
.filters { padding: 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; font-weight: 600; min-width: 0; }
.filter--static { grid-column: 1 / -1; flex-direction: row; gap: 8px; align-items: baseline; }
.filter__value { font-weight: 500; color: var(--text-muted); }
.table-wrap { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.78rem; color: var(--text-muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table--compact td, .table--compact th { padding: 6px 8px; }
.status { font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.status--completed { background: var(--ok-soft); color: var(--ok); }
.status--ended_early { background: var(--warn-soft); color: var(--warn); }
.status--interrupted { background: var(--bad-soft); color: var(--bad); }

/* Responsive table → stacked cards on phones. */
@media (max-width: 639px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 2px 0; }
  .table td::before { content: attr(data-label); display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
  .table td:first-child { grid-column: 1 / -1; font-weight: 650; }
}

/* ---------------------------------------------------------------- Progress */
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.stack__seg--ok { background: var(--ok); }
.stack__seg--help { background: var(--help); }
.stack__seg--bad { background: var(--bad); }
.stack__seg--skip { background: var(--text-muted); }
.legend { list-style: none; display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 0.88rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 120px; align-items: end; }
.bars__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars__bar { width: 100%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 2px 2px; background: var(--navy); opacity: .85; }
.bars__day { font-size: 0.65rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.catprog { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.catprog__head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.catprog__name { font-weight: 650; }
.weak { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.weak__item { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; }
.weak__prompt { font-weight: 700; font-size: 1.1rem; word-break: break-word; }

/* ---------------------------------------------------------------- Settings */
.export-list, .source-list { list-style: none; display: flex; flex-direction: column; }
.export-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.source-list li + li { border-top: 1px solid var(--border); }
.source-list summary { cursor: pointer; padding: 10px 0; min-height: 44px; font-size: 0.92rem; }
.issues { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); max-height: 260px; overflow: auto; }
.preview { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.preview__title { font-size: 0.98rem; }
.import-preview:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
