/* ───────────────────────── tokens ───────────────────────── */
:root {
  --bg: #E9EEF2;
  --ink: #0E1820;
  --ink2: #3B4954;
  --muted: #6B7A86;
  --line: rgba(14, 24, 32, .10);
  --line2: rgba(14, 24, 32, .18);
  --paper: #FCFBF8;
  --paper2: #F7F4EE;
  --glass: rgba(252, 251, 248, .66);
  --scrim: rgba(225, 231, 236, .55);
  --accent: #2D6BE0;
  --accent-soft: rgba(45, 107, 224, .09);
  --accent-line: rgba(45, 107, 224, .34);
  --gold: #B5873A;
  --know: #1E9A69;
  --know-soft: rgba(30, 154, 105, .12);
  --learn: #D5683B;
  --learn-soft: rgba(213, 104, 59, .12);
  --shadow: 0 1px 1px rgba(14, 24, 32, .04), 0 10px 24px -8px rgba(14, 24, 32, .14), 0 34px 60px -26px rgba(14, 24, 32, .22);
  --shadow-sm: 0 1px 2px rgba(14, 24, 32, .05), 0 6px 16px -8px rgba(14, 24, 32, .14);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C1116;
    --ink: #EEF2F5;
    --ink2: #C2CCD4;
    --muted: #8B99A5;
    --line: rgba(238, 242, 245, .10);
    --line2: rgba(238, 242, 245, .20);
    --paper: #161E26;
    --paper2: #1A232C;
    --glass: rgba(22, 30, 38, .66);
    --scrim: rgba(8, 12, 16, .55);
    --accent: #79A6FF;
    --accent-soft: rgba(121, 166, 255, .10);
    --accent-line: rgba(121, 166, 255, .38);
    --gold: #D9AE63;
    --know: #3CC68C;
    --know-soft: rgba(60, 198, 140, .14);
    --learn: #F08A5D;
    --learn-soft: rgba(240, 138, 93, .14);
    --shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 12px 28px -10px rgba(0, 0, 0, .55), 0 34px 60px -26px rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 16px -8px rgba(0, 0, 0, .5);
  }
}

/* ───────────────────────── base ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
a { color: inherit; }
em { font-style: italic; color: var(--accent); }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 520px at 85% -8%, rgba(45, 107, 224, .14), transparent 62%),
    radial-gradient(760px 460px at -12% 108%, rgba(181, 135, 58, .13), transparent 60%),
    var(--bg);
}
.bg::after {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 28%, #000 10%, transparent 72%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 28%, #000 10%, transparent 72%);
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

/* ───────────────────────── top bar ───────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 52px; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--serif); font-size: 22px; letter-spacing: -.01em; }
.mark { position: relative; width: 16px; height: 21px; border: 1.6px solid var(--accent); border-radius: 4px; transform: rotate(-10deg); }
.mark::after { content: ""; position: absolute; inset: -1.6px; border-radius: 4px; background: var(--ink); transform: translate(6px, 2px) rotate(18deg); }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--line); color: var(--muted);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: color .2s, background .2s, transform .15s var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(.93); }
.icon-btn[aria-pressed="true"] { color: var(--ink); }
#btn-shuffle[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
#btn-sound .ic-off { display: none; }
#btn-sound[aria-pressed="false"] .ic-on { display: none; }
#btn-sound[aria-pressed="false"] .ic-off { display: block; }
.deck[data-mode="quiz"] #btn-shuffle { visibility: hidden; }

/* ───────────────────────── gate ───────────────────────── */
body.locked { overflow: hidden; }
.deck { transition: filter .6s var(--ease), transform .6s var(--ease); }
body.locked .deck { filter: blur(7px) saturate(.9); transform: scale(.985); pointer-events: none; }

.gate {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.gate-backdrop { position: fixed; inset: 0; background: var(--scrim); animation: fade .4s var(--ease) both; }
.popup {
  position: relative; margin: auto; width: 100%; max-width: 380px;
  padding: 6px 20px 22px; border-radius: 30px; text-align: center;
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 2px 4px rgba(14, 24, 32, .05), 0 34px 90px -24px rgba(14, 24, 32, .42);
  animation: pop .6s cubic-bezier(.3, 1.3, .5, 1) both;
}
.gate.leaving .popup { animation: popout .4s var(--ease) forwards; }
.gate.leaving .gate-backdrop { animation: fadeout .42s var(--ease) forwards; }

.fan-wrap { position: relative; height: 222px; margin: 0 -20px; pointer-events: none; transition: height .5s var(--ease); }
.fan { position: absolute; inset: 0; animation: float 6s ease-in-out infinite; }
.fan-scale { position: absolute; inset: 0; transition: transform .5s var(--ease); }
.popup.is-email .fan-wrap { height: 128px; }
.popup.is-email .fan-scale { transform: scale(.6); }
.fan .card {
  inset: auto; left: 50%; top: 50%;
  width: 150px; aspect-ratio: 3 / 4; height: auto;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg)) translateX(var(--x, 0));
}

.kicker { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.kicker .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--know); box-shadow: 0 0 0 3px var(--know-soft); }
.step-email { display: flex; flex-direction: column; gap: 10px; text-align: left; animation: rise .45s var(--ease) both; }
.field-label { margin: 6px 4px 0; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.email-input {
  height: 54px; padding: 0 16px; border-radius: 16px;
  border: 1px solid var(--line2); background: var(--bg); color: var(--ink);
  font: 16px var(--sans); outline: 0; transition: border-color .2s, box-shadow .2s;
}
.email-input::placeholder { color: var(--muted); opacity: .75; }
.email-input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-email.error .email-input { border-color: var(--learn); animation: shake .4s; }
.btn-no {
  padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line2);
  font-size: 13.5px; line-height: 1.4; color: var(--muted); text-align: center;
  transition: color .2s, border-color .2s, background .2s, transform .15s var(--ease);
}
.btn-no:hover { color: var(--ink2); border-color: var(--learn); background: var(--learn-soft); }
.btn-no:active { transform: scale(.98); }
.form-note { margin: 0; font-size: 12.5px; color: var(--learn); text-align: center; }
.form-note:empty { display: none; }
.fan .f1 { --r: -2deg; z-index: 3; }
.fan .f2 { --r: -13deg; --x: -42%; z-index: 2; }
.fan .f3 { --r: 11deg; --x: 42%; z-index: 1; }
.fan .f2 .face, .fan .f3 .face { box-shadow: var(--shadow-sm); }
.fan .f2 .face-body, .fan .f3 .face-body { opacity: .5; }
.fan .tap-hint, .fan .ruler, .fan .num, .fan .pill-sub { display: none; }
.fan .face { padding: 14px 14px; border-radius: 22px; }
.fan .cm.tl, .fan .cm.tr { top: 50px; }
.fan .cm.bl, .fan .cm.br { bottom: 30px; }
.fan .face-body { gap: 10px; padding: 8px 2px; }
.fan .def, .fan .def.long { font-size: clamp(12px, 8.6cqi, 21px); line-height: 1.18; }
.fan .stat { padding: 4px 9px; font-size: clamp(9.5px, 5cqi, 12px); }
.fan .back-term { font-size: 13px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border-radius: 13px;
  font-weight: 600; font-size: 15px; letter-spacing: -.005em; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.ghost { border: 1px solid var(--line2); color: var(--ink); }
.btn-arrow { width: 18px; height: 18px; transition: transform .25s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(3px); }
.btn.loading .btn-label, .btn.loading .btn-arrow { opacity: 0; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}

.btn.big {
  width: 100%; height: auto; min-height: 56px; padding: 14px 20px; border-radius: 16px;
  font-size: 16px; line-height: 1.3; white-space: normal; text-wrap: balance;
}

/* ───────────────────────── deck chrome ───────────────────────── */
.mode-row { flex: none; display: flex; gap: 8px; margin: 4px 0 12px; }
.sex-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 88px; padding: 0 12px;
  border-radius: 14px; background: var(--glass); border: 1px solid var(--line); color: var(--ink);
  font-size: 14px; font-weight: 600; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .15s var(--ease), background .2s;
}
.sex-btn svg { width: 15px; height: 15px; color: var(--muted); }
.sex-btn:active { transform: scale(.95); }
.deck[data-page="more"] .mode-row { display: none; }
.ideal i { margin-top: 4px; font-style: normal; font-size: 12.5px; color: var(--muted); }
.ideal i em { color: inherit; }
.ideal.none span { color: var(--muted); }
.mode-switch {
  position: relative; flex: 1; display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.mode-switch button { position: relative; z-index: 1; height: 38px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); transition: color .25s; }
.mode-switch button[aria-selected="true"] { color: var(--ink); }
.mode-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-sm);
  transition: transform .4s var(--ease);
}
.deck[data-mode="quiz"] .mode-thumb { transform: translateX(100%); }

.chips {
  flex: none; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px 14px; padding: 2px 16px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--glass);
  font-size: 13.5px; font-weight: 500; color: var(--ink2);
  transition: background .25s, color .25s, border-color .25s, transform .15s var(--ease);
}
.chip:active { transform: scale(.95); }
.chip b { font-size: 10.5px; font-weight: 600; opacity: .5; font-variant-numeric: tabular-nums; }
.chip i { font-style: normal; font-size: 11.5px; opacity: .55; font-variant-numeric: tabular-nums; }
.chip[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }

.progress { flex: none; margin-bottom: 14px; }
.progress-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tally { display: flex; gap: 6px; }
.tally span { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; transition: transform .2s var(--ease); }
.tally span.bump { animation: bump .35s var(--ease); }
.t-know { color: var(--know); background: var(--know-soft); }
.t-learn { color: var(--learn); background: var(--learn-soft); }
.bar { height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #8DB4FF); transition: width .5s var(--ease); }

.deck-foot { flex: none; display: flex; justify-content: center; padding-top: 18px; }
.link-btn { font-size: 12.5px; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; padding: 6px; }

/* ───────────────────────── cards ───────────────────────── */
.study { display: flex; flex-direction: column; }
.stage { position: relative; width: 100%; max-width: 420px; margin: 0 auto; height: clamp(320px, calc(100vh - 360px), 560px); }
@supports (height: 100dvh) { .stage { height: clamp(320px, calc(100dvh - 360px), 560px); } }

.card {
  position: absolute; inset: 0 0 26px 0;
  perspective: 1600px; container-type: inline-size;
  touch-action: pan-y; -webkit-user-select: none; user-select: none;
  transform-origin: 50% 60%;
}
.card.current { z-index: 3; cursor: grab; }
.card.current:focus-visible { outline: none; }
.card.current:focus-visible .face { outline: 2px solid var(--accent); outline-offset: 3px; }
.card.dragging { cursor: grabbing; transition: none !important; }
.card.behind { pointer-events: none; transform-origin: 50% 100%; transition: transform .38s var(--ease), opacity .38s; }
.card.b1 { z-index: 2; transform: translateY(13px) scale(.95); }
.card.b2 { z-index: 1; transform: translateY(26px) scale(.9); opacity: .5; }
.card.b1.promote { transform: none; }
.card.b2.promote { transform: translateY(13px) scale(.95); opacity: 1; }
.card.deal { animation: deal .6s var(--ease) both; }

.card-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .65s cubic-bezier(.3, 1.22, .45, 1); }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; overflow: hidden;
  display: flex; flex-direction: column; padding: 18px 20px;
  border-radius: 26px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.face.back { transform: rotateY(180deg); background: var(--paper2); }
.face.back::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 70% at 50% 0%, var(--accent-soft), transparent 60%);
}

.face-top { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px 0 4px; border-radius: 99px; background: var(--bg); font-size: 12px; font-weight: 500; color: var(--ink2); white-space: nowrap; }
.pill b { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--ink); color: var(--paper); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.num i { font-style: normal; opacity: .45; margin: 0 2px; }

.face-body { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 12px 6px; min-height: 0; }
.term { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 46px; font-size: clamp(30px, 15cqi, 62px); line-height: 1; letter-spacing: -.02em; text-wrap: balance; }
.term.long { font-size: clamp(26px, 11.5cqi, 50px); }
.term.xlong { font-size: clamp(24px, 9.5cqi, 42px); }
.def { margin: 0; font-family: var(--serif); font-size: 24px; font-size: clamp(19px, 7cqi, 29px); line-height: 1.2; letter-spacing: -.005em; text-wrap: pretty; }
.def.long { font-size: clamp(17px, 6cqi, 25px); }
.stat {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.stat em { color: inherit; }
.card-img { max-width: 100%; max-height: 42%; object-fit: contain; border-radius: 14px; }

.face-foot { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 20px; font-size: 12px; color: var(--muted); }
.ruler {
  flex: 1; max-width: 132px; height: 9px;
  background:
    repeating-linear-gradient(90deg, var(--line2) 0 1px, transparent 1px 8px) left bottom / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--line2) 0 1px, transparent 1px 40px) left bottom / 100% 9px no-repeat,
    linear-gradient(var(--line2), var(--line2)) left bottom / 100% 1px no-repeat;
}
.tap-hint { display: inline-flex; align-items: center; gap: 6px; }
.tap-hint::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 2s ease-in-out infinite; }
.back-term { font-family: var(--serif); font-size: 15px; font-style: italic; color: var(--muted); }

/* scan-frame corners on the front */
.cm { position: absolute; width: 14px; height: 14px; border: 0 solid var(--accent); opacity: .5; }
.cm.tl { top: 58px; left: 18px; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: 4px; }
.cm.tr { top: 58px; right: 18px; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: 4px; }
.cm.bl { bottom: 46px; left: 18px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: 4px; }
.cm.br { bottom: 46px; right: 18px; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: 4px; }

.stamp {
  position: absolute; top: 20px; z-index: 5; pointer-events: none; opacity: 0;
  padding: 5px 11px; border: 2px solid; border-radius: 10px; background: var(--paper);
  font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.stamp.know { left: 18px; color: var(--know); transform: rotate(-11deg); }
.stamp.learn { right: 18px; color: var(--learn); transform: rotate(11deg); }

/* ───────────────────────── controls ───────────────────────── */
.hint { margin: 4px 0 12px; text-align: center; font-size: 12.5px; color: var(--muted); }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; width: 100%; max-width: 420px; margin: 0 auto; }
.ctrl {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; border-radius: 17px; border: 1px solid var(--line); background: var(--paper);
  font-size: 15px; font-weight: 600; box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), border-color .2s, background .2s, opacity .2s;
}
.ctrl svg { width: 19px; height: 19px; stroke-width: 2.4; }
.ctrl:active { transform: scale(.95); }
.ctrl.learn { color: var(--learn); }
.ctrl.know { color: var(--know); }
.ctrl.learn:hover { border-color: var(--learn); background: var(--learn-soft); }
.ctrl.know:hover { border-color: var(--know); background: var(--know-soft); }
.ctrl.icon { width: 56px; color: var(--muted); }
.ctrl.icon:disabled { opacity: .35; }
.study.is-done .hint, .study.is-done .controls { display: none; }
.study.is-done .stage { height: auto; }

/* ───────────────────────── summary ───────────────────────── */
.summary {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 26px 22px 22px; border-radius: 26px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .55s var(--ease) both;
}
.ring { position: relative; width: 132px; height: 132px; margin-bottom: 14px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring .ring-bg { stroke: var(--line); }
.ring .ring-fg { stroke: var(--know); stroke-dasharray: 326.73; stroke-dashoffset: 326.73; transition: stroke-dashoffset 1.2s var(--ease) .15s; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; }
.ring-label b { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1; }
.ring-label span { margin-top: 4px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.sum-title { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1.02; letter-spacing: -.015em; }
.sum-text { margin: 0 0 20px; color: var(--ink2); }
.sum-text b { color: var(--ink); }
.sum-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 330px; }
.sum-actions .btn { width: 100%; }

.cta {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 14px;
  width: 100%; margin-top: 18px; padding: 16px 18px; border-radius: 18px; text-align: left; text-decoration: none;
  background: var(--ink); color: var(--bg);
  transition: transform .15s var(--ease);
}
.cta:active { transform: scale(.98); }
.cta-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; opacity: .6; }
.cta-text { grid-column: 1; font-family: var(--serif); font-size: 21px; line-height: 1.15; }
.cta-text em { color: #8DB4FF; }
.cta-arrow { grid-column: 2; grid-row: 1 / span 2; width: 22px; height: 22px; }
.ig { margin-top: 12px; font-size: 13px; color: var(--muted); text-underline-offset: 3px; }

/* ───────────────────────── quiz ───────────────────────── */
.quiz { display: flex; flex-direction: column; gap: 12px; }
.quiz.anim > * { animation: rise .45s var(--ease) both; }
.quiz.anim > *:nth-child(2) { animation-delay: .05s; }
.q-card {
  position: relative; container-type: inline-size;
  padding: 18px 20px 24px; border-radius: 24px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.q-ask { margin: 20px 0 8px; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.q-card .term { text-align: center; font-size: clamp(30px, 12cqi, 52px); }
.q-card .term.long { font-size: clamp(26px, 10cqi, 44px); }
.q-card .term.xlong { font-size: clamp(24px, 8.5cqi, 38px); }
.q-options { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; text-align: left;
  border-radius: 16px; background: var(--paper); border: 1px solid var(--line);
  font-size: 14.5px; line-height: 1.42; color: var(--ink2);
  transition: transform .15s var(--ease), background .25s, border-color .25s, opacity .3s, color .25s;
}
.opt em { color: inherit; }
.opt:not(:disabled):hover { border-color: var(--line2); }
.opt:not(:disabled):active { transform: scale(.985); }
.opt-key { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-top: -1px; border-radius: 8px; border: 1px solid var(--line2); font-size: 12px; font-weight: 600; color: var(--muted); transition: background .25s, color .25s, border-color .25s; }
.opt.right { border-color: var(--know); background: var(--know-soft); color: var(--ink); }
.opt.right .opt-key { background: var(--know); border-color: var(--know); color: #fff; }
.opt.wrong { border-color: var(--learn); background: var(--learn-soft); color: var(--ink); animation: shake .4s; }
.opt.wrong .opt-key { background: var(--learn); border-color: var(--learn); color: #fff; }
.opt.dim { opacity: .42; }
.q-foot { display: flex; justify-content: center; min-height: 48px; }
.q-foot .btn { width: 100%; max-width: 330px; animation: rise .3s var(--ease) both; }

/* ───────────────────────── diagrams ───────────────────────── */
.fig { display: block; width: 100%; height: 100%; overflow: visible; }
.fig .f-fill { fill: var(--bg); stroke: none; opacity: .65; }
.fig .f-line { fill: none; stroke: var(--ink); stroke-width: 1.25; opacity: .55; }
.fig .f-soft { fill: none; stroke: var(--ink); stroke-width: 1; opacity: .22; }
.fig .f-iris { fill: none; stroke: var(--ink); stroke-width: 1; opacity: .4; }
.fig .f-jaw { fill: none; stroke: var(--ink); stroke-width: 1.1; opacity: .38; }
.fig .m { stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; fill: none; }
.fig .m.gold { stroke: var(--gold); }
.fig .m.ref { stroke-dasharray: 3 3; stroke-width: 1.2; opacity: .8; }
.fig .m.tick { stroke-width: 1.5; }
.fig .m.arc { fill: var(--accent-soft); stroke-width: 1.2; }
.fig .m-dot { fill: var(--paper); stroke: var(--accent); stroke-width: 1.6; }
.fig .m-halo { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1; opacity: .9; }
.fig .m-halo2 { fill: none; stroke: var(--accent); stroke-width: .8; opacity: .35; stroke-dasharray: 2 3; }
.fig text, .fig .f-pill rect { stroke: none; }
.fig .f-pill rect { fill: var(--accent); }
.fig .f-pill text { fill: #fff; font: 600 9px var(--sans); text-anchor: middle; font-variant-numeric: tabular-nums; }
.fig .f-pill.plain rect { fill: var(--paper); stroke: var(--accent-line); stroke-width: 1; }
.fig .f-pill.plain text { fill: var(--accent); }
@media (prefers-color-scheme: dark) { .fig .f-pill text { fill: #0C1116; } }

.face-body.has-fig { justify-content: flex-start; gap: 8px; padding: 4px 0 6px; }
.fig-wrap { position: relative; flex: 1; min-height: 0; width: 100%; }
.fig-wrap .fig { position: absolute; inset: 0; width: 100%; height: 100%; }
.term.sm { font-size: clamp(24px, 9.4cqi, 40px); line-height: 1.02; }
.term.sm.long { font-size: clamp(21px, 8cqi, 34px); }
.term.sm.xlong { font-size: clamp(19px, 6.8cqi, 29px); }
.pill-sub { font-weight: 400; color: var(--muted); }
.pill-sub::before { content: "·"; margin: 0 5px 0 1px; opacity: .6; }

.face-body.is-answer { gap: 12px; }
.ideal { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ideal span { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.ideal b { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 11cqi, 46px); line-height: 1.05; letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.ideal b em { color: var(--accent); }
.def.xlong { font-size: clamp(15.5px, 5.2cqi, 21px); }
.meaning { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); text-wrap: pretty; max-width: 34ch; }
.meaning em { color: inherit; }

.q-fig { height: 170px; margin: 4px auto 2px; max-width: 220px; }
.q-card .term.sm { font-size: clamp(22px, 8cqi, 34px); }
.q-options.is-short { display: grid; grid-template-columns: 1fr 1fr; }
.q-options.is-short .opt { flex-direction: column; gap: 6px; font-family: var(--serif); font-size: 19px; line-height: 1.15; color: var(--ink); }

/* ───────────────────────── more free stuff ───────────────────────── */
.deck[data-page="more"] .mode-switch, .deck[data-page="more"] .chips, .deck[data-page="more"] .progress,
.deck[data-page="more"] .study, .deck[data-page="more"] .quiz, .deck[data-page="more"] #btn-shuffle { display: none !important; }
.deck[data-page="more"] #btn-more { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.more { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.more.anim > * { animation: rise .5s var(--ease) both; }
.more.anim > *:nth-child(2) { animation-delay: .04s; }
.more.anim > *:nth-child(3) { animation-delay: .08s; }
.more.anim > *:nth-child(4) { animation-delay: .12s; }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); padding: 6px 2px; }
.back-link svg { width: 16px; height: 16px; }
.more-title { margin: 4px 0 6px; font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: -.02em; }
.free-list { display: flex; flex-direction: column; gap: 10px; }
.free {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 48px 18px 18px;
  border-radius: 20px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink); transition: transform .15s var(--ease), border-color .2s;
}
a.free:hover { border-color: var(--accent-line); }
a.free:active { transform: scale(.985); }
.free.soon { opacity: .6; box-shadow: none; background: transparent; border-style: dashed; }
.free-badge { align-self: flex-start; margin-bottom: 4px; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.free.soon .free-badge { background: var(--line); color: var(--muted); }
.free-title { font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.free-text { font-size: 13.5px; color: var(--ink2); }
.free-arrow { position: absolute; right: 18px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--muted); }
button.cta { border: 0; font: inherit; cursor: pointer; }
.deck[data-page="more"] .deck-foot { display: none; }
.credit { margin: 14px 4px 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }

/* ───────────────────────── toast ───────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 50;
  padding: 9px 16px; border-radius: 99px; background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 500; pointer-events: none;
  opacity: 0; transform: translate(-50%, 16px); transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ───────────────────────── motion ───────────────────────── */
.deck.entering > * { animation: rise .6s var(--ease) both; }
.deck.entering > *:nth-child(2) { animation-delay: .04s; }
.deck.entering > *:nth-child(3) { animation-delay: .08s; }
.deck.entering > *:nth-child(4) { animation-delay: .12s; }
.deck.entering > *:nth-child(5) { animation-delay: .16s; }
.deck.entering > *:nth-child(6) { animation-delay: .2s; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes deal { from { opacity: 0; translate: 0 60px; } to { opacity: 1; translate: 0 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes popout { to { opacity: 0; transform: translateY(14px) scale(.95); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes bump { 50% { transform: scale(1.18); } }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

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