/* Quizla – "warm paper, ink, orange". System fonts only; a monospace stack for numbers and labels. */

:root {
  --bg: #FBF7EF;
  --ink: #1B1A18;
  --card: #FEFDFB;
  --orange: #FF6A3D;
  --on-orange: #1B1A18;
  --blue: #2E5BFF;
  --blue-solid: #2E5BFF;
  --muted: #EFEAE1;
  --muted-ink: #6B6860;
  --line: #DCD8D0;
  --red: #D92626;
  --green: #18864A;
  --orange-soft: #FFE5DA;
  --blue-soft: #E2E9FF;
  --green-soft: #DDF2E5;
  --red-soft: #FBE0E0;
  --radius: 16px;
  --shadow: 0 1px 0 rgba(27, 26, 24, .05), 0 1px 2px rgba(27, 26, 24, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --ink: #F4F0E8;
    --card: #1F1D1A;
    --blue: #7B95FF;
    --muted: #2B2926;
    --muted-ink: #A9A49A;
    --line: #3B3833;
    --red: #FF6B6B;
    --green: #4CC585;
    --orange-soft: #47251A;
    --blue-soft: #1D2750;
    --green-soft: #173522;
    --red-soft: #481A1A;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent; overflow-wrap: break-word; min-height: 100dvh;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.35; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-ink); }
.small { font-size: .875rem; }
.tiny { font-size: .75rem; }
.strong { font-weight: 650; }
.clamp { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.center { justify-content: center; text-align: center; }
.center-text { text-align: center; align-items: center; }
.grow { flex: 1 1 0; min-width: 0; }
.label { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-ink); }
.hint { font-size: .85rem; color: var(--muted-ink); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.roomy { gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row.wrap { flex-wrap: wrap; gap: 8px; }
.row.end { justify-content: flex-end; }
.row.start { align-items: flex-start; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }

/* ---------------------------------------------------------------- icons, logo, illustrations */
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill { fill: currentColor; }
.icon.turn { width: 16px; height: 16px; transition: transform .15s; }
.open > .icon.turn { transform: rotate(180deg); }
.logo { flex: none; display: block; }
.illustration { width: 180px; max-width: 60%; height: auto; }
.i-paper { fill: var(--card); stroke: var(--line); stroke-width: 2; }
.i-line { fill: var(--line); }
.i-orange { fill: var(--orange); }
.i-blue { fill: var(--blue-solid); }
.i-ink { fill: var(--ink); }
.i-stroke-light { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.i-stroke-ink { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.ring-track { fill: none; stroke: var(--muted); }
.ring-fill { fill: none; stroke: var(--orange); stroke-linecap: round; transition: stroke-dasharray .6s ease; }

/* ---------------------------------------------------------------- shell */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot svg { animation: pop .5s ease both; }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.wordmark { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; }
.wordmark.xl { font-size: 2.2rem; }
.top-nav { display: none; gap: 4px; }
.top-link { display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 44px; border-radius: 12px; color: var(--muted-ink); font-weight: 600; }
.top-link.on { color: var(--ink); background: var(--muted); }
.view { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; color: var(--muted-ink); font-size: .72rem; font-weight: 600; border-radius: 14px; }
.tab .icon { width: 24px; height: 24px; padding: 0; }
.tab.on { color: var(--ink); }
.tab.on .icon { stroke: var(--orange); }
.tab:active { background: var(--muted); }
body.focus .tabs, body.focus .top-nav { display: none; }
body.focus .view { padding-bottom: 24px; }
@media (min-width: 760px) {
  .tabs { display: none; }
  .top-nav { display: flex; }
  .top { padding: 12px 24px; }
  .view { padding: 16px 24px 64px; }
  h1 { font-size: 1.75rem; }
}

.loader { display: flex; justify-content: center; gap: 8px; padding: 80px 0; }
.loader span { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); animation: bounce .9s infinite ease-in-out; }
.loader span:nth-child(2) { animation-delay: .12s; }
.loader span:nth-child(3) { animation-delay: .24s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } to { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes slide { from { transform: translateX(-60%); } to { transform: translateX(280%); } }

/* ---------------------------------------------------------------- buttons */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font-weight: 650; line-height: 1.2;
  text-align: center; box-shadow: var(--shadow); transition: transform .08s ease, background .12s ease; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }
.btn.secondary { background: var(--blue-solid); border-color: var(--blue-solid); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.danger-text { color: var(--red); }
.btn.big { min-height: 54px; font-size: 1.05rem; border-radius: 16px; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: .9rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy { color: transparent !important; opacity: 1; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after, .icon-btn.busy::after, .switch.busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid var(--ink); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn.secondary.busy::after, .btn.danger.busy::after { border-color: #fff; border-right-color: transparent; }
.btn.primary.busy::after { border-color: var(--on-orange); border-right-color: transparent; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 14px;
  background: transparent; color: var(--ink); transition: transform .08s ease, background .12s ease;
}
.icon-btn:hover { background: var(--muted); }
.icon-btn:active { transform: scale(.92); background: var(--muted); }
.icon-btn.active { color: var(--blue); }
.icon-btn.busy > * { visibility: hidden; }
.link-btn { border: 0; background: none; padding: 0; min-height: 44px; color: var(--blue); font-weight: 650; text-align: center; }

/* ---------------------------------------------------------------- cards, chips, notes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; display: flex; flex-direction: column; gap: 12px; background: transparent; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 2px 10px; border-radius: 999px; background: var(--muted);
  font-size: .8rem; font-weight: 600; line-height: 1.2; max-width: 100%;
}
.chip .icon { width: 14px; height: 14px; }
.chip.blue { background: var(--blue-soft); }
.chip.orange { background: var(--orange-soft); }
.chip.ok { background: var(--green-soft); }
.chip.bad { background: var(--red-soft); }
.chip.wait { background: var(--muted); color: var(--muted-ink); }
.chip.tiny { min-height: 20px; padding: 1px 8px; font-size: .7rem; margin-left: 6px; }
.badge-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 13px; background: var(--muted); color: var(--ink); }
.badge-icon.orange { background: var(--orange); color: var(--on-orange); }
.badge-icon.blue { background: var(--blue-soft); }
.badge-icon.red { background: var(--red-soft); color: var(--red); }
.badge-icon.big { width: 52px; height: 52px; border-radius: 16px; }
.badge-icon.big .icon { width: 26px; height: 26px; }
.badge-icon.huge { width: 88px; height: 88px; border-radius: 28px; }
.badge-icon.huge .icon { width: 44px; height: 44px; }
.badge-icon.pulse { animation: pulse 1.2s ease-in-out infinite; }
.badge-icon.pop { animation: pop .5s ease both; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--blue-soft); font-size: .9rem; }
.note .icon { color: var(--blue); margin-top: 1px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 28px 12px; }
.avatar { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--orange); color: var(--on-orange); font-family: var(--mono); font-weight: 700; }
.avatar.small { width: 34px; height: 34px; font-size: .9rem; }
.avatar.big { width: 60px; height: 60px; font-size: 1.5rem; }

/* ---------------------------------------------------------------- forms */
input:not([type=file]) {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  font-size: 16px; min-width: 0;
}
input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
input.mono { font-size: .85rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.search { position: relative; display: flex; align-items: center; min-width: 180px; }
.search .icon { position: absolute; left: 14px; color: var(--muted-ink); pointer-events: none; }
.search input { padding-left: 44px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--muted); }
.segmented button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; font-weight: 650; color: var(--muted-ink); }
.segmented button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.segmented.small button .icon { width: 18px; height: 18px; }
.switch { position: relative; width: 56px; height: 34px; flex: none; border: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch::before { content: ""; position: absolute; inset: -5px 0; }
.switch span { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch[aria-checked=true] { background: var(--blue-solid); }
.switch[aria-checked=true] span { transform: translateX(22px); }
.switch.busy span { opacity: .6; }
.switch.busy::after { display: none; }

/* ---------------------------------------------------------------- dialogs and toasts */
dialog.sheet {
  width: 100%; max-width: 480px; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 22px 22px 0 0;
  background: var(--bg); color: var(--ink); overflow: auto; animation: rise .2s ease both;
}
dialog.sheet.wide { max-width: 640px; }
dialog.sheet::backdrop { background: rgba(20, 18, 16, .5); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px 20px; background: var(--bg); }
.sheet-body { padding: 4px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.confirm { display: flex; gap: 14px; align-items: flex-start; }
@media (min-width: 560px) { dialog.sheet { margin: auto; border-radius: 22px; } }
.toasts { position: fixed; left: 0; right: 0; top: max(12px, env(safe-area-inset-top)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: .92rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); animation: rise .2s ease both; transition: opacity .25s, transform .25s; }
.toast .icon { color: var(--green-soft); }
.toast-error .icon { color: #FF9C8A; }
.toast-win .icon { color: var(--orange); fill: var(--orange); }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------------------------------------------------------------- bars */
.bar { height: 10px; flex: 1 1 auto; border-radius: 999px; background: var(--muted); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--orange); transition: width .3s ease; }
.bar.ok i { background: var(--green); }
.bar.bad i { background: var(--red); }
.bar.endless i { width: 35% !important; animation: slide 1.2s ease-in-out infinite; }

/* ---------------------------------------------------------------- sign in */
.auth { max-width: 440px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 32px; display: flex; flex-direction: column; gap: 24px; }
.auth-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.tagline { font-family: var(--mono); color: var(--muted-ink); letter-spacing: .02em; }
.steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; }
.step-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 20px; }
.step-icon .icon { width: 28px; height: 28px; }
.step-icon.orange { background: var(--orange); color: var(--on-orange); }
.step-icon.blue { background: var(--blue-solid); color: #fff; }
.step-icon.ink { background: var(--ink); color: var(--bg); }
.step-arrow { color: var(--line); margin-bottom: 22px; }
.auth-card { padding: 20px; }

/* ---------------------------------------------------------------- home */
.hello { font-size: 1.9rem; }
.game-strip { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.level-ring { position: relative; width: 56px; height: 56px; flex: none; display: grid; place-items: center; }
.level-ring .ring { position: absolute; inset: 0; }
.level-ring span { font-weight: 700; font-size: 1.15rem; }
.streak { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--muted); color: var(--muted-ink); font-weight: 700; min-height: 40px; }
.streak.on { background: var(--orange-soft); color: var(--ink); }
.streak.on .icon { stroke: var(--orange); }
.streak.today .icon { fill: var(--orange); }
.cta {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 84px; padding: 14px 18px; border: 0; border-radius: 22px;
  background: var(--orange); color: var(--on-orange); text-align: left; box-shadow: 0 2px 0 rgba(27, 26, 24, .18); transition: transform .08s ease;
}
.cta:active { transform: scale(.98) translateY(1px); }
.cta-icon { display: grid; place-items: center; width: 54px; height: 54px; flex: none; border-radius: 17px; background: var(--on-orange); color: var(--orange); }
.cta-icon .icon { width: 28px; height: 28px; }
.cta-title { display: block; font-weight: 700; font-size: 1.2rem; line-height: 1.2; }
.cta-sub { display: block; font-size: .9rem; opacity: .8; }
.quiz-row { display: flex; align-items: center; gap: 2px; padding: 6px 6px 6px 10px; }
.quiz-main { display: flex; align-items: center; gap: 12px; flex: 1 1 0; min-width: 0; min-height: 56px; border-radius: 12px; }
.quiz-main .grow { display: flex; flex-direction: column; }
.quiz-main:active { opacity: .7; }
.play-dot { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--orange); color: var(--on-orange); }
.play-dot .icon { width: 20px; height: 20px; fill: currentColor; }
.play-dot.done { background: var(--muted); color: var(--ink); }
.play-dot.done .icon { fill: none; }
.collection-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform .08s ease; }
.collection-card:active { transform: scale(.98); }
.cover { aspect-ratio: 4 / 3; background: var(--muted); display: grid; place-items: center; color: var(--muted-ink); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .icon { width: 36px; height: 36px; }
.collection-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.counts { display: flex; gap: 14px; font-size: .85rem; }
.counts span { display: inline-flex; align-items: center; gap: 5px; }
.counts .icon { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- collection */
.step-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.step-card.reading, .step-card.writing, .step-card.uploading, .step-card:has(.illustration) { align-items: center; text-align: center; }
.step-card .bar { width: 100%; flex: none; }
.step-card .duo { width: 100%; }
.tile-link { display: flex; flex-direction: column; gap: 4px; padding: 14px; min-height: 112px; transition: transform .08s ease; }
.tile-link .badge-icon { margin-bottom: 6px; }
a.tile-link:active { transform: scale(.97); }
.tile-link.off { opacity: .6; box-shadow: none; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.page { position: relative; aspect-ratio: 3 / 4; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--muted); transition: transform .08s ease; }
.page:active { transform: scale(.96); }
.page img { width: 100%; height: 100%; object-fit: cover; }
.page.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--line); background: transparent; color: var(--ink); font-size: .8rem; font-weight: 650; }
.page.add .icon { width: 28px; height: 28px; color: var(--orange); }
.page-no, .page-type, .page-status { position: absolute; display: grid; place-items: center; height: 26px; min-width: 26px; border-radius: 9px; background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.page-no { left: 6px; top: 6px; padding: 0 6px; font-size: .75rem; font-weight: 700; }
.page-type { left: 6px; bottom: 6px; }
.page-status { right: 6px; bottom: 6px; border-radius: 50%; }
.page-type .icon, .page-status .icon { width: 15px; height: 15px; }
.page-type.learning_objectives { background: var(--blue-solid); color: #fff; }
.page-type.reference { background: var(--ink); color: var(--bg); }
.page-status.ok { background: var(--green); color: #fff; }
.page-status.bad { background: var(--red); color: #fff; }
.page-status.wait { color: var(--muted-ink); }
.page-full { width: 100%; max-height: 56dvh; object-fit: contain; border-radius: 12px; background: var(--muted); }
.type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-pick button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 8px 4px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); font-size: .78rem; font-weight: 650; line-height: 1.2; }
.type-pick button.on { border-color: var(--orange); background: var(--orange-soft); }
.type-pick button.busy > * { visibility: hidden; }
.people { display: flex; flex-direction: column; gap: 4px; }
.people li { display: flex; align-items: center; gap: 10px; min-height: 44px; }

/* ---------------------------------------------------------------- study */
.study-card { display: flex; flex-direction: column; gap: 14px; }
.study-card h3 { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted-ink); }
.study-card h3 .icon { width: 16px; height: 16px; }
.thumb { width: 64px; height: 84px; flex: none; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.prose { display: flex; flex-direction: column; gap: 10px; line-height: 1.6; }
.prose.folded { max-height: 9.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks .icon { width: 18px; height: 18px; margin-top: 3px; color: var(--orange); }
.defs { display: flex; flex-direction: column; gap: 2px; }
.defs dt { font-weight: 650; margin-top: 6px; }
.defs dd { color: var(--muted-ink); }
.formula { padding: 10px 12px; border-radius: 12px; background: var(--muted); font-size: .88rem; overflow-x: auto; }
.topic-head { display: flex; align-items: baseline; gap: 8px; }

/* ---------------------------------------------------------------- playing */
.play { display: flex; flex-direction: column; gap: 18px; min-height: calc(100dvh - 110px); }
.play-top { display: flex; align-items: center; gap: 10px; margin-left: -8px; }
.counter { font-size: .9rem; font-weight: 700; min-width: 3.2em; text-align: right; }
.q-area { flex: 1 1 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.q-area.from-right { animation: from-right .18s ease both; }
.q-area.from-left { animation: from-left .18s ease both; }
@keyframes from-right { from { transform: translateX(24px); opacity: 0; } }
@keyframes from-left { from { transform: translateX(-24px); opacity: 0; } }
.question { font-size: 1.3rem; line-height: 1.35; }
.options { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--card); text-align: left; line-height: 1.35; box-shadow: var(--shadow); transition: transform .08s ease, border-color .1s, background .1s;
}
.option:active { transform: scale(.98); }
.letter { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 11px; background: var(--muted); font-weight: 700; }
.option.on { border-color: var(--orange); background: var(--orange-soft); }
.option.on .letter { background: var(--orange); color: var(--on-orange); }
.play-nav { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 22%); }
.wide-only { display: none; }
@media (min-width: 480px) { .wide-only { display: inline; } }

/* ---------------------------------------------------------------- result */
.result-card { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 24px 16px; }
.result-card .duo { width: 100%; }
.result-card .duo > :only-child { grid-column: 1 / -1; }
@media (max-width: 440px) { .result-card .duo { grid-template-columns: 1fr; } }
.result h1 { font-size: 1.3rem; }
.score { position: relative; display: grid; place-items: center; animation: pop .5s ease both; }
.score-text { position: absolute; display: flex; flex-direction: column; align-items: center; }
.score-num { font-size: 2.3rem; font-weight: 700; line-height: 1.1; }
.score.great .ring-fill { stroke: var(--green); }
.score.low .ring-fill { stroke: var(--blue); }
.xp { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 14px; border-radius: 999px; background: var(--orange); color: var(--on-orange); font-weight: 700; }
.xp .icon { width: 16px; height: 16px; }
.new-badges { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.new-badge { display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; border-color: var(--orange); }
.review { display: flex; flex-direction: column; gap: 12px; }
.mark { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; color: #fff; }
.mark .icon { width: 18px; height: 18px; stroke-width: 3; }
.mark.ok { background: var(--green); }
.mark.bad { background: var(--red); }
.answers { display: flex; flex-direction: column; gap: 8px; }
.answers li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; }
.answers li.ok { background: var(--green-soft); }
.answers li.bad { background: var(--red-soft); }
.answers li.ok .icon { color: var(--green); }
.answers li.bad .icon { color: var(--red); }
.answers .icon { width: 18px; height: 18px; margin-top: 3px; stroke-width: 3; }
.review .btn.small { align-self: flex-start; }
.why { display: flex; flex-direction: column; gap: 12px; animation: rise .2s ease both; }
.callout { display: flex; gap: 10px; padding: 12px; border-radius: 12px; }
.callout.red { background: var(--red-soft); }
.callout.red > .icon { color: var(--red); }
.callout.blue { background: var(--blue-soft); }
.callout.blue > .icon { color: var(--blue); }
.callout strong { font-size: .85rem; }
.pitch { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }

/* ---------------------------------------------------------------- statistics */
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; }
.stat-num { font-size: 1.45rem; font-weight: 700; line-height: 1.2; margin-top: 6px; }
.how { border-radius: 14px; background: var(--muted); padding: 0 14px; }
.how summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 650; cursor: pointer; list-style: none; }
.how summary::-webkit-details-marker { display: none; }
.how[open] { padding-bottom: 14px; }
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-label { font: 10px var(--mono); fill: var(--muted-ink); }
.chart-area { fill: var(--orange); opacity: .12; }
.chart-line { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--orange); stroke: var(--card); stroke-width: 2; }
.chart-dot.practice { fill: var(--blue); }
.legend { justify-content: center; gap: 16px; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.dot.practice { background: var(--blue); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.badge-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 112px; padding: 12px 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); text-align: center; line-height: 1.2; transition: transform .08s ease; }
.badge-tile:active { transform: scale(.96); }
.badge-tile:not(.earned) { background: transparent; border-style: dashed; color: var(--muted-ink); }
.badge-tile:not(.earned) .badge-icon { color: var(--muted-ink); }
.topic-bar { display: flex; flex-direction: column; gap: 6px; }
.topic-bar .bar { flex: none; }
.topic-bar .row .icon { width: 18px; height: 18px; color: var(--muted-ink); }
.list { padding: 4px 12px; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { display: flex; flex-direction: column; }

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