/* Writing Studio – app styles (shelf, book page, sheets, shared UI).
   Design tokens from the brief. Part 6 adds the full polish. */

/* ---------- Fonts (bundled in vendor/fonts so they also work offline) ---------- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url(../vendor/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url(../vendor/fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url(../vendor/fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 600; font-display: swap; src: url(../vendor/fonts/fraunces-latin-600-normal.woff2) format('woff2'); }

/* ---------- Tokens ---------- */
:root {
  --bg:#F6F5F1; --surface:#FFFFFF; --surface-2:#FBFAF7; --ink:#1C1B22; --muted:#5E5B66; --line:#E4E1DA;
  --brand:#1F3A5F; --brand-600:#16304F; --brand-50:#EAF0F7; --accent:#C8963E;
  --ok:#2E7D5B; --warn:#B7791F; --err:#D14343; --spell:#E5484D; --focus:#2F6FEB;
  --r-sm:8px; --r-md:12px; --r-lg:18px;
  /* Part 6: softer, layered shadows (same names as Part 1, plus a deeper --shadow-3 for hover) */
  --shadow-1:0 1px 2px rgba(28,27,34,.05),0 1px 4px rgba(28,27,34,.04);
  --shadow-2:0 2px 6px rgba(28,27,34,.05),0 14px 34px rgba(28,27,34,.09);
  --shadow-3:0 6px 14px rgba(28,27,34,.07),0 24px 52px rgba(28,27,34,.15);
  --surface-hi:inset 0 1px 0 rgba(255,255,255,.7);
  --ease-out:cubic-bezier(.16,1,.3,1);
  --dur-1:120ms; --dur-2:220ms; --dur-3:300ms;
  --skeleton:#ECE9E2; --skeleton-shine:rgba(255,255,255,.7);
  --paper-glow:rgba(255,255,255,.75);

  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --on-brand:#FFFFFF;
  --chip-ink: var(--brand-600);
  --gold:#E3C27A; --ivory:#F4ECDA;

  /* bookcase */
  --case-back:#ECE5D8; --case-back-2:#E2D8C7; --case-frame:#A97644;
  --wood-1:#CFA067; --wood-2:#AB7843; --wood-3:#7F5529;
  --topbar-bg: rgba(246,245,241,.86);
}
[data-theme=dark] {
  --bg:#111318; --surface:#1A1D24; --surface-2:#20242C; --ink:#ECEAE4; --muted:#A3A0A8; --line:#2A2E37;
  --brand:#8FB3E0; --brand-50:#1C2633; --accent:#E0B562;
  --brand-600:#B5CDEB; --on-brand:#111318; --chip-ink:#B5CDEB; --focus:#6E9BF5;
  --shadow-1:0 1px 2px rgba(0,0,0,.3);
  --shadow-2:0 2px 6px rgba(0,0,0,.3),0 12px 32px rgba(0,0,0,.45);
  --shadow-3:0 6px 16px rgba(0,0,0,.4),0 24px 52px rgba(0,0,0,.6);
  --surface-hi:inset 0 1px 0 rgba(255,255,255,.04);
  --skeleton:#252932; --skeleton-shine:rgba(255,255,255,.07);
  --paper-glow:rgba(143,179,224,.06);
  --case-back:#1D2027; --case-back-2:#171A20; --case-frame:#4E3720;
  --wood-1:#7E5937; --wood-2:#614329; --wood-3:#45301C;
  --topbar-bg: rgba(17,19,24,.86);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light; }
[data-theme=dark] { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(1100px 520px at 50% -140px, var(--paper-glow), transparent 72%) no-repeat, var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; }
svg { flex: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1:focus-visible, main:focus-visible { outline: none; }

.skip-link {
  position: absolute; left: 12px; top: 8px; z-index: 50; padding: 10px 14px;
  background: var(--surface); color: var(--ink); border-radius: var(--r-sm);
  transform: translateY(-200%); /* hidden above the screen until focused (no shadow peeking out) */
}
.skip-link:focus { transform: none; box-shadow: var(--shadow-2); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 8px clamp(12px, 4vw, 32px);
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; color: var(--ink); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; fill: var(--brand); }
.brand-mark rect:nth-child(2) { fill: var(--accent); }
.brand-name { font: 600 20px/1.1 var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 4px; flex: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--brand-50); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sun { display: none; }
[data-theme=dark] .i-sun { display: block; }
[data-theme=dark] .i-moon { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: 600 15px/1.2 var(--font-ui); text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--brand-600); }
[data-theme=dark] .btn-primary:hover { background: #A9C6EA; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }

.back-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px 0 2px; margin-left: -2px;
  color: var(--brand); font-weight: 500; text-decoration: none; background: none; border: 0; cursor: pointer;
}
.back-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Pages ---------- */
main { display: block; }
.page { max-width: 1200px; margin: 0 auto; padding: clamp(16px, 3.5vw, 36px) clamp(14px, 4vw, 32px) 56px; }
.page.narrow { max-width: 760px; }
.page-head { margin-bottom: clamp(16px, 3vw, 28px); }
.eyebrow { font: 600 12px/1.3 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.page-title { font-size: clamp(28px, 4.2vw, 42px); }
.lede { margin-top: 8px; color: var(--muted); font-size: 16px; }
.empty-state { text-align: center; padding-top: 12vh; }
.empty-state p { margin-top: 12px; }

/* ---------- Bookcase ---------- */
.bookcase {
  --cols: 6;
  --gap: clamp(10px, 2.4vw, 30px);
  --side: clamp(10px, 2.6vw, 34px);
  position: relative; display: block;
  border: clamp(6px, 1vw, 11px) solid var(--case-frame);
  border-radius: var(--r-md);
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.018) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--case-back), var(--case-back-2));
  box-shadow: var(--shadow-2), inset 0 10px 24px rgba(0,0,0,.10), inset 0 0 0 1px rgba(0,0,0,.06);
  padding-top: 4px;
}
.shelf-row { position: relative; }
.shelf-books {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap); align-items: end;
  padding: clamp(16px, 2.6vw, 30px) var(--side) 0;
}
.plank {
  position: relative; height: clamp(12px, 1.7vw, 20px);
  background: linear-gradient(180deg, var(--wood-1) 0%, var(--wood-2) 55%, var(--wood-3) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -2px 0 rgba(0,0,0,.18);
}
.plank::after { /* shadow the plank throws on the back panel */
  content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 16px;
  background: linear-gradient(180deg, rgba(0,0,0,.22), rgba(0,0,0,0));
  pointer-events: none;
}
.shelf-row:last-child .plank::after { display: none; }

/* ---------- Book cover ---------- */
.book {
  position: relative; display: block; text-decoration: none; color: inherit;
  border-radius: 3px 7px 7px 3px;
  transform-origin: 50% 100%; isolation: isolate;
}
.book::after { /* contact shadow on the plank */
  content: ''; position: absolute; left: 4%; right: 0; bottom: -5px; height: 10px; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.45), rgba(0,0,0,0) 70%);
}
.book:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 4px 8px 8px 4px; }

.book-cover {
  container-type: inline-size;
  position: relative; display: flex; flex-direction: column; align-items: stretch;
  aspect-ratio: 2 / 3; overflow: hidden;
  border-radius: 3px 7px 7px 3px;
  padding: 11% 9% 9% 15%;
  background:
    linear-gradient(90deg, rgba(0,0,0,.38) 0, rgba(0,0,0,.14) 4.5%, rgba(255,255,255,.14) 6.5%, rgba(255,255,255,0) 11%),
    linear-gradient(165deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 40%, rgba(0,0,0,.20) 100%),
    var(--book);
  box-shadow: 0 1px 1px rgba(0,0,0,.25), 0 10px 18px -8px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.07);
}
.book-cover::before { /* fine cloth texture */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
}
.book-label {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 5cqw; padding: 9cqw 6cqw 10cqw;
  background: var(--book-dark);
  border: 1px solid rgba(227,194,122,.55);
  box-shadow: 0 0 0 3px var(--book-dark), 0 0 0 4px rgba(227,194,122,.28);
  margin: 3px;
}
.book-series {
  font: 600 max(9px, 8cqw)/1.2 var(--font-ui); letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold);
}
.book-num { font: 600 max(28px, 36cqw)/0.95 var(--font-head); color: var(--gold); letter-spacing: -.02em; }
.book-rule { display: block; width: 42%; height: 1px; background: rgba(227,194,122,.75); }
.book-sub { font: 500 max(9.5px, 8.6cqw)/1.25 var(--font-ui); color: var(--ivory); }
.book-progress {
  position: relative; margin-top: auto; align-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--book-dark); border: 1px solid rgba(227,194,122,.35);
  font: 600 max(10px, 8cqw)/1.3 var(--font-ui); color: var(--ivory); white-space: nowrap;
}
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--gold); }
.dots i.on { background: var(--gold); }
@container (max-width: 132px) { .dots { display: none; } .book-progress { padding: 2px 7px; } }
/* Real cover photos (the drawn cover above stays underneath as the fallback) */
.book-cover.has-img { aspect-ratio: 360 / 482; }
.book-img, .mini-img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.book-cover.has-img .book-label, .mini-book.has-img > span { visibility: hidden; }
.book-cover.has-img::after {   /* spine shading on top of the photo */
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.32) 0, rgba(0,0,0,.1) 4.5%, rgba(255,255,255,.12) 6.5%, rgba(255,255,255,0) 11%);
}
.book-progress { z-index: 2; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mini-book { position: relative; overflow: hidden; }
.mini-book.has-img { aspect-ratio: 360 / 482; }

/* ---------- Book page ---------- */
.book-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 clamp(18px, 3vw, 28px); }
.mini-book {
  flex: none; width: 52px; aspect-ratio: 2/3; border-radius: 2px 5px 5px 2px;
  display: grid; place-items: center;
  background: linear-gradient(90deg, rgba(0,0,0,.35) 0, rgba(0,0,0,0) 14%), var(--book);
  box-shadow: 0 6px 14px -6px rgba(0,0,0,.5);
}
.mini-book span { font: 600 20px/1 var(--font-head); color: var(--gold); background: var(--book-dark); padding: 6px 6px 5px; border: 1px solid rgba(227,194,122,.5); }

.test-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(12px, 2vw, 20px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
}
.test-card {
  width: 100%; height: 100%; display: flex; flex-direction: column; gap: 12px;
  padding: 12px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); position: relative;
}
.test-card::after {   /* the deeper hover shadow fades in (opacity only) */
  content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: var(--shadow-3); opacity: 0; pointer-events: none;
}
.test-card:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.test-card:hover::after { opacity: 1; }
.test-card:focus-visible { outline-offset: 3px; border-radius: var(--r-lg); }
.thumb {
  display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden;
  background: #FFFFFF; border-radius: var(--r-md); border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
[data-theme=dark] .thumb img { filter: brightness(.9) contrast(1.05); }
.test-body { display: flex; flex-direction: column; gap: 8px; padding: 0 2px 2px; min-width: 0; }
.test-name { font: 600 21px/1.1 var(--font-head); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 9px; border-radius: 999px;
  font: 500 12.5px/1.35 var(--font-ui); color: var(--chip-ink); background: var(--brand-50);
}
.chip b { font-weight: 600; font-size: 11px; letter-spacing: .04em; opacity: .75; }
.chip--t2 { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.status i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.status--partial i { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); border-color: var(--accent); }
.status--practised i { background: var(--accent); border-color: var(--accent); }
.status--exam { color: var(--ink); }
.status--exam i { background: var(--ok); border-color: var(--ok); }
.chip--done { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 55%, transparent); }

@media (max-width: 560px) {
  .test-grid { grid-template-columns: 1fr; }
  .test-card { flex-direction: row; align-items: center; gap: 14px; padding: 10px; }
  .thumb { width: 38%; flex: none; }
  .test-name { font-size: 19px; }
}

/* ---------- Sheets (dialogs) ---------- */
html.sheet-open { overflow: hidden; }
dialog.sheet {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: calc(100% - 32px); max-width: 560px; max-height: calc(100dvh - 32px); overflow: visible;
}
dialog.sheet::backdrop { background: rgba(12,13,18,.52); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet-inner {
  display: block; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  padding: 18px clamp(16px, 3vw, 24px) 22px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
}
.sheet-grab { display: none; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 26px; }
.sheet-head .eyebrow { margin-bottom: 2px; }
.sheet-head .icon-btn { margin: -6px -8px 0 0; }

@media (max-width: 600px) {
  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 94dvh; }
  .sheet-inner { border-radius: 20px 20px 0 0; max-height: 94dvh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .sheet-grab { display: block; }
}

/* Mode choices */
.mode-step { display: flex; flex-direction: column; gap: 12px; }
.mode-choice {
  display: flex; align-items: flex-start; gap: 14px; width: 100%; text-align: left;
  padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2);
}
button.mode-choice { cursor: pointer; }
button.mode-choice:hover { border-color: var(--brand); }
.mode-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.mode-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mode-icon--practice { background: var(--brand-50); color: var(--brand); }
.mode-icon--strict { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--ink); }
.mode-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.mode-name { font: 600 19px/1.2 var(--font-head); }
.mode-desc { color: var(--muted); font-size: 15px; line-height: 1.5; }
.mode-choice .chev { width: 20px; height: 20px; margin-top: 12px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mode-choice--strict { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn-start { margin-top: 10px; align-self: flex-start; padding: 0 22px; }

.step-q { font-weight: 600; margin-top: -2px; }
.task-choice {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-height: 44px;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); text-decoration: none;
}
.task-choice:hover { border-color: var(--brand); }
.task-choice-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-choice-name { font: 600 18px/1.2 var(--font-head); }
.task-choice-meta { font-size: 13px; color: var(--muted); }
.task-choice-prompt { font-size: 14.5px; color: var(--ink); line-height: 1.5; }
.mode-step .back-link { align-self: flex-start; margin-top: -8px; }

/* Settings */
.field { display: block; border: 0; padding: 0; margin: 0 0 16px; }
.field legend, .field-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; padding: 0; }
.field input[type=text] {
  width: 100%; min-height: 44px; padding: 10px 12px; font: 400 16px var(--font-ui);
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.field input[type=text]:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.field-help { font-size: 13.5px; color: var(--muted); margin: -6px 0 18px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: 40px; border-radius: 9px; font-weight: 500; font-size: 15px; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }

/* ---------- Task prompt (used by the placeholder practice page; Part 3 builds on it) ---------- */
.prompt-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(16px, 3vw, 28px); box-shadow: var(--shadow-1); }
.prompt-card > * + * { margin-top: 14px; }
.task-tabs { display: flex; gap: 6px; margin: 10px 0 18px; }
.task-tabs a {
  display: inline-grid; place-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600;
}
.task-tabs a[aria-current=page] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.prompt-box { border: 1.5px solid var(--ink); padding: 14px 16px; border-radius: 4px; }
.prompt-box p + p { margin-top: 10px; }
.prompt-box--t2 { font-weight: 600; font-style: italic; }
.prompt-figure { margin: 0; background: #FFFFFF; border-radius: var(--r-md); border: 1px solid var(--line); padding: 8px; }
.prompt-figure img { margin: 0 auto; }
.prompt-figure img + img { margin-top: 10px; }
[data-theme=dark] .prompt-figure img { filter: brightness(.92); }
details.scan summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--brand); font-weight: 500; }
details.scan img { border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
details.scan img + img { margin-top: 10px; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--brand-50); color: var(--ink); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line));
}
.notice svg { width: 22px; height: 22px; margin-top: 1px; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notice strong { display: block; }
.placeholder-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.unsure-note { font-size: 13.5px; color: var(--muted); }

/* ---------- Utilities ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.link-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--brand); font: 500 15px/1.3 var(--font-ui); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Practice Mode ---------- */
.pr {
  --pr-gap: clamp(10px, 1.6vw, 18px);
  display: flex; flex-direction: column; gap: var(--pr-gap);
  height: calc(100vh - 60px); height: calc(100dvh - 60px);
  max-width: 1480px; margin: 0 auto; padding: 10px clamp(12px, 2vw, 24px) 14px;
}
.pr-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 18px; flex: none; }
.pr-bar-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-width: 0; }
.pr-title { font-size: clamp(19px, 2vw, 23px); white-space: nowrap; }
.pr-tasks { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.pr-tasks a {
  display: inline-grid; place-items: center; min-height: 40px; min-width: 76px; padding: 0 14px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: none;
}
.pr-tasks a[aria-current=page] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.pr-tasks a:hover:not([aria-current]) { color: var(--ink); }
.pr-bar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.pr-timer { display: flex; align-items: center; gap: 2px; }
.pr-timer-ico svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; display: block; margin-right: 4px; }
.pr-select {
  min-height: 44px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%235E5B66' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  color: var(--ink); font: 500 14.5px var(--font-ui); -webkit-appearance: none; appearance: none; cursor: pointer;
}
.pr-time { min-width: 62px; margin-left: 8px; font: 600 18px/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.pr-time.is-paused { color: var(--muted); }
.pr-time.is-done { color: var(--err); }
.pr-timer .icon-btn svg { width: 20px; height: 20px; }
.pr-helpers { display: flex; align-items: center; gap: 10px; }
.pr-helpers-label { font: 600 12px/1 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pr-helper-list { display: flex; flex-wrap: wrap; gap: 4px 14px; min-height: 44px; align-items: center; }
.hp-switch {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 6px 0 2px;
  border: 0; background: none; color: var(--ink); cursor: pointer; text-align: left; border-radius: 10px; -webkit-tap-highlight-color: transparent;
}
.hp-switch:disabled { cursor: not-allowed; color: var(--muted); }
.hp-track { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line); }
.hp-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.hp-switch[aria-checked=true] .hp-track { background: var(--brand); }
[data-theme=dark] .hp-switch[aria-checked=true] .hp-thumb { background: var(--bg); }
.hp-switch[aria-checked=true] .hp-thumb { transform: translateX(16px); }
.hp-text { display: flex; flex-direction: column; line-height: 1.2; }
.hp-name { font-weight: 600; font-size: 14.5px; }
.hp-note { font-size: 12.5px; color: var(--muted); }
.hp-note:empty { display: none; }
.hp-switch[aria-busy=true] .hp-note::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; border: 2px solid var(--muted); border-right-color: transparent; vertical-align: -1px; }

.pr-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 45fr) minmax(0, 55fr); gap: var(--pr-gap); }
.pr-q, .pr-w { min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.pr-q { overflow: auto; overscroll-behavior: contain; padding: 16px clamp(16px, 2vw, 24px) 20px; }
.pr-q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pr-q-title { font-size: 19px; }
.pr-q-title .muted { font: 500 14px/1.3 var(--font-ui); }
.pr-q-toggle, .pr-q-peek { display: none; }
.pr-q .prompt-card { border: 0; box-shadow: none; padding: 0; background: none; }
.pr-q .prompt-card > * + * { margin-top: 12px; }
.pr-rubric { color: var(--muted); font-size: 14.5px; }
.pr-q .prompt-box { border-width: 1px; border-color: var(--line); background: var(--surface-2); font-weight: 600; line-height: 1.55; }
.pr-q .prompt-box--t2 { font-style: italic; }
.prompt-figure { display: flex; flex-direction: column; gap: 10px; }
.chart-btn {
  position: relative; display: block; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: #FFFFFF; cursor: zoom-in;
}
.chart-btn img { margin: 0 auto; }
.chart-btn::after {
  content: ''; position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 8px; opacity: .85;
  background: rgba(28,27,34,.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 16px;
}
[data-theme=dark] .chart-btn img { filter: brightness(.92); }

.pr-w { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.editor-wrap { position: relative; flex: 1 1 auto; min-height: 160px; border-radius: var(--r-md); background: var(--surface-2); }
.editor {
  position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; margin: 0; resize: none;
  padding: 18px max(20px, calc((100% - 70ch) / 2));
  border: 1px solid var(--line); border-radius: var(--r-md); background: transparent; color: var(--ink);
  font: 400 17px/calc(17px * 1.7) var(--font-ui); letter-spacing: normal; word-spacing: normal; tab-size: 4;   /* line height 1.7 as an exact length, so the spelling mirror rounds lines the same way */
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; overflow-y: auto;
  caret-color: var(--brand);
}
.editor::placeholder { color: var(--muted); opacity: .85; }
.editor:focus { outline: none; }
.editor:focus-visible, .editor:focus { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }

/* Spelling guide mirror: sits behind the textarea, copies its layout; only misspelled words show */
.mirror {
  position: absolute; z-index: 0; top: 0; left: 0; margin: 0; overflow: hidden;
  color: transparent; background: transparent; pointer-events: none; -webkit-user-select: none; user-select: none;
  white-space: pre-wrap; overflow-wrap: break-word; border-style: solid; border-color: transparent;
}
.mirror .sp {
  text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: var(--spell);
  text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-skip-ink: none;
}
.mirror .mp, .mirror-end { display: block; margin: 0; padding: 0; }

.pr-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; flex: none; padding: 0 2px; font-size: 14px; color: var(--muted); }
.wc-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums;
}
.wc-tick { display: none; }
.wc-pill.is-ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); color: var(--ink); }
.wc-pill.is-ok .wc-tick { display: inline; color: var(--ok); }
[data-theme=dark] .wc-pill.is-ok .wc-tick { color: #5FD39A; }
.pr-slots { display: contents; }
.spell-count {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--spell) 45%, var(--line)); background: color-mix(in srgb, var(--spell) 9%, var(--surface));
  color: var(--ink); font: 600 13.5px var(--font-ui); cursor: pointer;
}
.spell-count:hover:not(:disabled) { background: color-mix(in srgb, var(--spell) 16%, var(--surface)); }
.spell-count.is-clear { border-color: var(--line); background: var(--surface-2); color: var(--muted); cursor: default; }
.spell-tip { display: inline-block; margin-left: 8px; font-size: 12.5px; color: var(--muted); align-self: center; }
.spell-tip[hidden] { display: none; }
.pr-saved { margin-left: auto; font-size: 13px; }
.pr-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: none; }
.pr-actions .btn { min-height: 40px; padding: 0 14px; font-size: 14.5px; }
.pr-mark[aria-pressed=true] { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }

/* Spelling fix menu (click or tap a red word; also right-click) */
.spell-menu {
  position: fixed; z-index: 450; min-width: 210px; max-width: min(320px, calc(100vw - 16px)); padding: 8px;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--spell);
  border-radius: 14px; box-shadow: var(--shadow-2), 0 10px 28px rgba(0,0,0,.18);
  font-family: var(--font-ui);
}
.spell-menu:before { content: "Tap a word to fix it"; display: none; }
.sm-title { padding: 2px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--spell); }
.sm-word { padding: 2px 10px 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); text-decoration: underline wavy var(--spell) 1.5px; text-underline-offset: 3px; }
.sm-item {
  display: flex; align-items: center; width: 100%; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font: 500 15px/1.3 var(--font-ui); text-align: left; cursor: pointer;
}
.sm-item:hover, .sm-item.is-active { background: var(--brand-50); }
.sm-first { font-weight: 700; }
.sm-empty { padding: 8px 10px; font-size: 14px; color: var(--muted); }
.sm-sep { height: 1px; margin: 5px 4px; background: var(--line); }
@media (pointer: coarse) { .sm-item { min-height: 44px; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 250; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); padding: 10px 10px 10px 16px;
  border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); font-size: 14.5px;
}
.toast-act { min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); font-weight: 700; cursor: pointer; }
.toast-act[hidden] { display: none; }

/* Zoom viewer */
dialog.zoom { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: #0C0D12; color: #fff; }
dialog.zoom::backdrop { background: rgba(12,13,18,.6); }
.zoom-bar { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; background: rgba(12,13,18,.9); }
.zoom-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoom-bar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.zoom-bar .btn-ghost:hover { background: rgba(255,255,255,.1); }
.zoom-bar .icon-btn { color: #fff; }
.zoom-bar .icon-btn:hover { background: rgba(255,255,255,.12); }
.zoom-body { height: calc(100% - 60px); overflow: auto; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.zoom-body img { max-width: 100%; max-height: calc(100dvh - 90px); width: auto; height: auto; background: #fff; border-radius: 6px; object-fit: contain; }
.zoom-body.is-actual { align-items: flex-start; }
.zoom-body.is-actual img { max-width: none; max-height: none; }
.pr-dialog .sheet-inner > p { margin-top: -4px; }

/* ---------- Word suggestions (chip bar under the writing box) ---------- */
.sg-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; flex: none; min-height: 48px; padding: 0 2px; }
.sg-hint-btn {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted); font: 600 14px/1 var(--font-ui); cursor: pointer;
}
.sg-hint-btn:hover, .sg-hint-btn[aria-expanded=true] { border-color: var(--brand); color: var(--ink); }
.sg-hint-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.sg-hint { grid-column: 1 / -1; margin: 0 2px 6px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.sg-chips {
  display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; overflow-y: hidden;
  padding: 9px 2px 3px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
}
.sg-chips::-webkit-scrollbar { display: none; }
.sg-chip {
  position: relative; flex: none; display: inline-flex; align-items: baseline; gap: 7px; min-height: 36px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink);
  font: 500 15px/1.3 var(--font-ui); cursor: pointer; -webkit-user-select: none; user-select: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  max-width: 100%;
}
.sg-chip .sg-tag { flex: none; position: relative; top: 1px; }
.sg-chip .sg-text {
  min-width: 0; white-space: normal; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.3;
}
.sg-chip:active { background: var(--brand-50); border-color: var(--brand); }
.sg-chip:hover { background: var(--surface-2); border-color: var(--brand); }
.sg-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.sg-chip.is-first { background: var(--brand-50); border-color: var(--brand); font-weight: 600; }
.sg-chip.is-first:hover { background: var(--brand-50); }
.sg-tag { font: 600 10.5px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sg-chip[data-kind=next] .sg-tag { color: var(--brand); }
.sg-lvl {          /* the level shows on hover, above the chip, without moving the other chips */
  position: absolute; top: -8px; right: 6px; padding: 1px 6px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font: 600 10.5px/1.4 var(--font-ui); opacity: 0; pointer-events: none;
}
.sg-chip:hover .sg-lvl, .sg-chip:focus-visible .sg-lvl { opacity: 1; }
.sg-ghost {        /* shimmer chip while the AI thinks (the shine is in motion.css) */
  width: 84px; min-height: 36px; padding: 0; cursor: default; border-color: transparent; overflow: hidden;
  background: var(--skeleton);
}
.sg-ghost + .sg-ghost { width: 64px; }
.sg-ghost + .sg-ghost + .sg-ghost { width: 96px; }
.sg-empty { color: var(--muted); font-size: 14px; white-space: nowrap; }
.sg-bar.is-dismissed .sg-chips { visibility: hidden; }
.sg-bar.is-floating {      /* phones, keyboard open: the bar sits right above the keyboard */
  position: fixed; left: 0; right: 0; z-index: 60; margin: 0; padding: 0 8px;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 16px rgba(20,20,30,.08);
}
@media (pointer: coarse) {
  .sg-chip { min-height: 40px; padding: 0 14px; font-size: 16px; }
  .sg-ghost { min-height: 40px; }
}

/* AI plan card (question column, closed by default) */
.sg-plan { margin: 4px 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
@media (max-width: 899.98px) { .sg-plan { margin: 8px 0 0; } }
.sg-plan > summary {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px; cursor: pointer; list-style: none; border-radius: var(--r-md);
}
.sg-plan > summary::-webkit-details-marker { display: none; }
.sg-plan > summary::after {
  content: ''; flex: none; width: 9px; height: 9px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}
.sg-plan[open] > summary::after { transform: rotate(225deg) translateY(-2px); }
.sg-plan > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.sg-plan-title { font: 600 16px/1.2 var(--font-head); }
.sg-plan-meta { color: var(--muted); font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-plan-body { padding: 2px 14px 14px; font-size: 15px; line-height: 1.55; }
.sg-plan-body > * + * { margin-top: 10px; }
.sg-plan-paras { margin: 10px 0 0; padding-left: 22px; }
.sg-plan-paras > li + li { margin-top: 8px; }
.sg-plan-paras ul, .sg-plan-list { margin: 4px 0 0; padding-left: 18px; color: var(--ink); }
.sg-plan-h { font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sg-vocab > summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; }
.sg-vocab ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 6px 14px; }
.sg-vocab li { font-size: 14.5px; }
.sg-vlvl { font: 600 10.5px/1 var(--font-ui); padding: 2px 5px; border-radius: 6px; background: var(--brand-50); color: var(--chip-ink); vertical-align: 1px; }
.sg-valts { color: var(--muted); }
.sg-vuse { display: block; color: var(--muted); font-size: 13px; }
.sg-colls { font-size: 14.5px; }
.sg-plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.sg-plan-actions .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
.sg-plan-wait { color: var(--muted); }

/* Settings: AI server */
.field-label--sub { font-weight: 500; font-size: 14px; margin: 2px 0 6px; }
.ai-url-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-url-row input { flex: 1 1 240px; min-width: 0; }
.ai-url-row .btn { flex: none; }
.field input[type=number] {
  width: 140px; min-height: 44px; padding: 10px 12px; font: 400 16px var(--font-ui);
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.field input[type=number]:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.ai-test-result { font-size: 14px; line-height: 1.45; margin: 8px 0 10px; overflow-wrap: anywhere; }
.ai-test-result:empty { display: none; }
.ai-test-result.is-ok { color: var(--ok); }
[data-theme=dark] .ai-test-result.is-ok { color: #5FD39A; }
.ai-test-result.is-bad { color: var(--err); }
[data-theme=dark] .ai-test-result.is-bad { color: #FF8A8A; }
.ai-test-result.is-busy { color: var(--muted); }
.field-ai .field-help { margin: 0 0 14px; }

/* ?debug=1 – AI call log */
.ai-debug {
  position: fixed; left: 8px; bottom: 8px; z-index: 400; width: min(380px, calc(100vw - 16px)); max-height: 42vh; overflow: auto;
  padding: 8px 10px; border-radius: 10px; background: rgba(12,13,18,.9); color: #E8E8EE; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace;
  box-shadow: var(--shadow-2);
}
.ai-debug-head { display: flex; align-items: center; gap: 8px; }
.ai-debug-sum { flex: 1; color: #A8A8B8; }
.ai-debug-x { min-width: 28px; min-height: 28px; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; background: none; color: #fff; cursor: pointer; }
.ai-debug-list { margin: 6px 0 0; padding: 0; list-style: none; }
.ai-debug-list li { padding: 2px 0; border-top: 1px solid rgba(255,255,255,.08); }
.ai-debug-list li.is-ok b { color: #7EE0A8; }
.ai-debug-list li.is-bad b { color: #FF9A9A; }
.ai-debug-list li.is-note { color: #9A9AAA; }
.ai-debug.is-min .ai-debug-list { display: none; }

/* Phones and narrow windows */
@media (max-width: 899.98px) {
  .pr { height: auto; min-height: calc(100dvh - 60px); padding-top: 6px; }
  .pr-bar { gap: 4px 10px; }
  .pr-bar-main { width: 100%; justify-content: space-between; }
  .pr-title { order: 2; flex: 1 1 auto; font-size: 18px; text-align: center; white-space: normal; }
  .pr-bar-main .back-link { order: 1; }
  .pr-tasks { order: 3; width: 100%; }
  .pr-tasks a { flex: 1; min-height: 44px; }
  .pr-bar-tools { width: 100%; justify-content: space-between; gap: 4px 10px; }
  .pr-helpers-label { display: none; }
  .pr-helper-list { gap: 0 8px; }
  .hp-name { font-size: 13.5px; }
  .pr-select { max-width: 170px; }
  .pr-grid { display: flex; flex-direction: column; flex: 1 1 auto; }
  .pr-q { flex: none; overflow: visible; padding: 10px 14px 12px; }
  .pr-q-head { margin-bottom: 2px; }
  .pr-q-toggle { display: inline-flex; min-height: 44px; padding: 0 14px; font-size: 14px; }
  .pr-q-peek { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
  .pr-q-body { display: none; }
  .pr-q.is-open .pr-q-peek { display: none; }
  .pr-q.is-open .pr-q-body { display: block; max-height: 55dvh; overflow: auto; margin-top: 6px; }
  .pr-w { flex: 1 1 auto; padding: 8px; min-height: max(300px, calc(100dvh - 330px)); }
  .editor { padding: 14px 14px; }
  .pr-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .spell-count { min-height: 44px; }
}

/* ---------- Strict Exam Mode: site-side pieces (the exam screen itself is in exam.css) ---------- */
html.is-fullscreen, html.is-fullscreen body { overflow: hidden; }
.gate-card {
  margin-top: 8px; padding: clamp(16px, 3vw, 24px); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.gate-card p { color: var(--ink); margin-bottom: 16px; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.exam-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 clamp(16px, 2.5vw, 24px);
  padding: 12px 14px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}
.exam-banner svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.exam-banner > span { flex: 1 1 200px; min-width: 0; }
.exam-banner strong { display: block; }
.last-result {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; align-self: flex-start;
  color: var(--brand); font-weight: 500; text-decoration: none;
}
.last-result svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.last-result:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Result page */
.result-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px; margin: 0 0 16px; }
.result-meta > div { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.result-meta dt { font-size: 13px; color: var(--muted); }
.result-meta dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.result-meta dd .muted { font-weight: 400; }
.ai-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 20px; }
.ai-box .btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.ai-box p { font-size: 14px; flex: 1 1 220px; }
.result-part { padding: clamp(16px, 3vw, 24px); margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.result-part-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.result-part-head h2 { font-size: 22px; }
.result-part-head h2 .muted { font: 500 15px/1.3 var(--font-ui); }
.word-pill { padding: 4px 10px; border-radius: 999px; background: var(--brand-50); color: var(--chip-ink); font-weight: 600; font-size: 14px; }
.word-pill--short { background: color-mix(in srgb, var(--err) 12%, var(--surface)); color: var(--ink); }
.result-warn { font-size: 14px; color: var(--ink); margin: -4px 0 10px; }
.answer-text {
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.7;
  padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
}
.answer-empty { padding: 8px 0; }
.result-question { margin-top: 6px; box-shadow: none; }
.result-history { margin: 8px 0 4px; }
.result-history h2 { font-size: 20px; margin-bottom: 8px; }
.result-history ul { margin: 0; padding-left: 20px; }
.result-history li { margin: 6px 0; }
.result-history a { min-height: 44px; }

/* Motion lives in css/motion.css (gated by html[data-motion] and prefers-reduced-motion). */

/* ---------- Part 5: local band score and feedback ---------- */
:root { --chart: #2E6BD8; --m-grammar: #D14343; --m-spelling: #C2410C; --m-vocab: #7C3AED; --m-cohesion: #0F766E; --m-task: #B7791F; }
[data-theme=dark] { --chart: #6390F0; --m-grammar: #FF7B7B; --m-spelling: #FB923C; --m-vocab: #B794F6; --m-cohesion: #4FD1C5; --m-task: #F6C453; }
.pr-score[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.pr-score-msg, .ai-msg { font-size: 14px; line-height: 1.45; margin: 0; }
.pr-score-msg:empty, .ai-msg:empty { display: none; }
.pr-score-msg.is-busy, .ai-msg.is-busy { color: var(--muted); }
.pr-score-msg.is-bad, .ai-msg.is-bad { color: var(--err); }
[data-theme=dark] .pr-score-msg.is-bad, [data-theme=dark] .ai-msg.is-bad { color: #FF8A8A; }
.ai-msg { flex-basis: 100%; }

.fb-page h2 { font-size: 22px; margin: 26px 0 10px; }
.fb-cache { padding: 10px 14px; border-radius: var(--r-md); background: var(--brand-50); margin: 0 0 14px; font-size: 14.5px; }
.fb-hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px 26px; padding: clamp(16px, 3vw, 24px); margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.fb-hero-text { flex: 1 1 260px; min-width: 0; }
.fb-hero-text > * + * { margin-top: 8px; }
.fb-verdict { font-size: 16px; line-height: 1.55; }
.fb-note { font-size: 13px; color: var(--muted); font-weight: 600; }
.fb-formula { font-size: 14.5px; }
.fb-ring { position: relative; flex: none; width: 148px; height: 148px; }
.fb-ring--sm { width: 92px; height: 92px; }
.fb-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.fb-ring circle { fill: none; stroke-width: 9; }
.fb-ring-track { stroke: var(--line); }
.fb-ring-bar { stroke: var(--brand); stroke-linecap: round; }
.fb-ring-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.fb-ring-num { font: 600 40px/1 var(--font-head); font-variant-numeric: tabular-nums; }
.fb-ring--sm .fb-ring-num { font-size: 24px; }
.fb-ring-cap { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 100px; line-height: 1.2; }
.fb-ring--sm .fb-ring-cap { font-size: 11px; }
.fb-delta { position: absolute; right: -6px; top: 4px; padding: 2px 8px; border-radius: 999px; font: 600 13px/1.4 var(--font-ui); background: var(--surface-2); border: 1px solid var(--line); }
.fb-delta.is-up { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); border-color: var(--ok); }
.fb-delta.is-down { background: color-mix(in srgb, var(--err) 12%, var(--surface)); border-color: var(--err); }
.fb-task { display: flex; align-items: center; gap: 16px; margin: 4px 0 14px; }
.fb-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.fb-card { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 15px; line-height: 1.5; }
.fb-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.fb-card h3 { font: 600 16px/1.3 var(--font-ui); }
.fb-card h3 .muted { font-weight: 500; font-size: 13px; }
.fb-band { flex: none; min-width: 40px; padding: 4px 10px; border-radius: 10px; text-align: center; font: 600 20px/1.1 var(--font-head); background: var(--brand-50); color: var(--chip-ink); }
.fb-card ul { margin: 2px 0 0; padding-left: 20px; }
.fb-h { font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.fb-quote { margin: 10px 0 0; padding: 6px 12px; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }

.fb-cats { margin: 18px 0 8px; }
.fb-cats h2 { margin-bottom: 8px; }
.fb-cat { padding: 12px 16px; margin: 0 0 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.fb-cat h3 { font: 600 14px/1.3 var(--font-ui); margin: 0 0 6px; }
.fb-cat ul { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.5; }
.fb-cat--grammar h3, .fb-cat--spelling h3 { color: var(--m-grammar); }
.fb-cat--vocabulary h3 { color: var(--m-vocab); }
.fb-cat--task h3 { color: var(--m-task); }
.fb-cat--coherence h3 { color: var(--m-cohesion); }
.fb-essay-help { font-size: 14px; }
.fb-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.fb-key { font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.fb-text {
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16.5px; line-height: 1.85; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.fb-mark, .fb-key { color: inherit; background: var(--surface-2); border-bottom: 2px solid var(--mc, var(--err)); }
.fb-mark { padding: 1px 1px; border-radius: 3px 3px 0 0; cursor: pointer; background: color-mix(in srgb, var(--mc) 16%, transparent); }
.fb-key { background: color-mix(in srgb, var(--mc) 16%, transparent); }
.fb-mark:hover, .fb-mark:focus-visible { background: color-mix(in srgb, var(--mc) 30%, transparent); outline: none; box-shadow: 0 0 0 2px var(--focus); }
.fb-mark--grammar { --mc: var(--m-grammar); }
.fb-mark--spelling { --mc: var(--m-spelling); border-bottom-style: dotted; border-bottom-width: 3px; }
.fb-mark--vocabulary { --mc: var(--m-vocab); }
.fb-mark--cohesion { --mc: var(--m-cohesion); border-bottom-style: dashed; }
.fb-mark--task { --mc: var(--m-task); border-bottom-style: double; border-bottom-width: 3px; }
.fb-mark.is-applied { --mc: var(--ok); text-decoration: none; }
.fb-mark.is-applied::after { content: ' ✓'; color: var(--ok); font-size: 13px; }
.fb-apply-msg { font-size: 14px; margin-top: 8px; color: var(--muted); }
.fb-apply-msg:empty { display: none; }
.fb-tip {
  position: fixed; z-index: 320; max-width: min(380px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font: 500 14.5px/1.45 var(--font-ui); box-shadow: var(--shadow-2);
}
.fb-tip-from { text-decoration: line-through; opacity: .85; }
.fb-tip-to { font-weight: 700; }
.fb-tip-type { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 5px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: color-mix(in srgb, var(--bg) 18%, transparent); }
.fb-tip .fb-apply { min-height: 32px; padding: 0 12px; margin-left: 6px; font-size: 13.5px; background: var(--bg); color: var(--ink); }
.fb-tip-done { font-weight: 700; margin-left: 6px; }
.fb-improved { margin: 0; padding: 14px 16px; border-left: 4px solid var(--ok); background: var(--surface); border-radius: 0 var(--r-md) var(--r-md) 0; line-height: 1.7; }
.fb-tips { padding-left: 22px; line-height: 1.6; }
.fb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 24px 0 8px; }
.fb-copied { font-size: 14px; color: var(--muted); }
.result-part .fb-cards { margin-top: 6px; }
.result-part .fb-essay h2, .result-part .fb-better h2 { font-size: 18px; }
@media (max-width: 600px) { .fb-ring { width: 120px; height: 120px; } .fb-ring-num { font-size: 32px; } .fb-hero { justify-content: center; } }

/* Home: band trend */
.progress-card { margin-top: clamp(18px, 3vw, 28px); padding: clamp(14px, 2.5vw, 22px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.pg-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; margin-bottom: 8px; }
.pg-head h2 { font-size: 21px; }
.pg-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.pg-stat { display: flex; flex-direction: column; font-size: 13px; }
.pg-big { font: 600 30px/1 var(--font-head); color: var(--ink); }
.pg-weak { font: 600 16px/1.3 var(--font-ui); color: var(--ink); }
.pg-svg { display: block; width: 100%; height: auto; max-height: 220px; overflow: visible; }
.pg-grid { stroke: var(--line); stroke-width: 1; }
.pg-ylab, .pg-xlab { fill: var(--muted); font: 500 11px var(--font-ui); text-anchor: end; }
.pg-xlab { text-anchor: start; }
.pg-line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pg-dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.pg-hit { fill: transparent; }
.pg-pt:hover .pg-dot, .pg-pt:focus .pg-dot { r: 6.5; }
.pg-pt:focus { outline: none; }
.pg-pt:focus-visible .pg-hit { stroke: var(--focus); stroke-width: 2; }
.pg-last { fill: var(--ink); font: 600 13px var(--font-ui); }
.pg-cap { font-size: 13.5px; margin-top: 4px; min-height: 1.4em; }
.result-pills { display: inline-flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Part 6: premium polish ---------- */
.prompt-card, .pr-q, .pr-w, .progress-card, .result-part, .fb-hero, .test-card, .gate-card { box-shadow: var(--shadow-1), var(--surface-hi); }
.sheet-inner { box-shadow: var(--shadow-3), var(--surface-hi); }
.page-title { letter-spacing: -.015em; }

/* Book hover: the deeper shadow is a pseudo-element that only fades (motion.css moves the book) */
.book::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 3px 7px 7px 3px; pointer-events: none; opacity: 0;
  box-shadow: 0 18px 28px -10px rgba(0,0,0,.55), 0 6px 10px -4px rgba(0,0,0,.35);
}
.book:hover::before, .book:focus-visible::before { opacity: 1; }

/* Buttons that are not ghost/primary still get a visible danger style */
.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
[data-theme=dark] .btn-danger { color: #FF8A8A; }

/* Settings: switch, two-field row, data actions */
.field-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; }
.field-switch .field-label { margin-bottom: 2px; }
.field-switch .field-help { margin: 0; }
.field-switch-text { display: flex; flex-direction: column; min-width: 0; }
input.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 999px;
  background: var(--line); border: 1px solid color-mix(in srgb, var(--ink) 18%, var(--line)); cursor: pointer;
}
input.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
input.switch:checked { background: var(--brand); border-color: var(--brand); }
input.switch:checked::after { transform: translateX(18px); }
[data-theme=dark] input.switch:checked::after { background: var(--bg); }
input.switch:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.field-you label { display: block; min-width: 0; }
.field-you input[type=text], .field-you input { margin-bottom: 2px; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.field-you .field-help { margin: 6px 0 12px; }
@media (max-width: 420px) { .field-pair { grid-template-columns: 1fr; } }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.data-actions .btn { min-height: 44px; padding: 0 14px; font-size: 14.5px; }
.field-data .field-help { margin: 0 0 10px; }
.settings-msg { font-size: 14px; margin: -4px 0 12px; overflow-wrap: anywhere; }
.settings-msg:empty { display: none; }

/* Tour */
.tour .sheet-inner { max-width: 520px; }
.tour .sheet-head { margin-bottom: 4px; align-items: center; }
.tour-body h2 { font-size: 26px; margin: 4px 0 8px; }
.tour-text { color: var(--ink); font-size: 16px; line-height: 1.6; }
.tour-art { display: grid; place-items: center; height: 112px; margin: 2px 0 12px; border-radius: var(--r-md); background: linear-gradient(180deg, var(--brand-50), var(--surface-2)); border: 1px solid var(--line); }
.tour-art svg { width: 170px; height: 92px; fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tour-art .t-on { fill: color-mix(in srgb, var(--accent) 35%, transparent); stroke: var(--accent); }
.tour-dots { display: flex; justify-content: center; gap: 8px; list-style: none; margin: 16px 0 12px; padding: 0; }
.tour-dots li { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tour-dots li.is-on { background: var(--brand); }
.tour-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.tour-never { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.tour-never input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.tour-btns { display: inline-flex; gap: 8px; margin-left: auto; }

/* Home footer and empty trend card */
.site-foot { margin-top: clamp(24px, 4vw, 40px); padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.site-foot p { font-size: 13.5px; color: var(--muted); }
.progress-card.is-empty h2 { font-size: 21px; margin-bottom: 4px; }

/* Skeletons (the shimmer itself is in motion.css) */
.sk { position: relative; display: block; overflow: hidden; background: var(--skeleton); border-radius: 8px; }
.sk-line { height: 12px; margin-top: 9px; border-radius: 6px; }
.sk-line--short { width: 58%; }
.sk-score { padding: 14px; margin: 2px 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.sk-score--wide { margin: -6px 0 20px; background: var(--surface); }
.sk-score-top { display: flex; align-items: center; gap: 14px; }
.sk-ring { flex: none; width: 64px; height: 64px; border-radius: 50%; }
.sk-score-lines { flex: 1; min-width: 0; }
.sk-score-lines .sk-line:first-child { margin-top: 0; width: 80%; }
.sk-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.sk-card { height: 58px; border-radius: 10px; }
/* image placeholders: the tint shows until the picture paints over it */
.thumb img, .prompt-figure img, .chart-btn img, details.scan img { background: var(--skeleton); }

/* 3-dot "thinking" indicator */
.dots3 { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.dots3 i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; }

/* Writing: the word-count pill fills like a progress bar */
.wc-pill { position: relative; overflow: hidden; isolation: isolate; }
.wc-fill { position: absolute; inset: 0; z-index: -1; transform-origin: 0 50%; transform: scaleX(0); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.wc-pill.is-ok .wc-fill { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.wc-num { display: inline-block; min-width: 1ch; }
.pr-saved { opacity: 1; }
.pr-saved.is-gone { opacity: 0; }
/* soft highlight under words inserted from a suggestion */
.flash-mirror {
  position: absolute; z-index: 0; margin: 0; overflow: hidden; color: transparent; pointer-events: none; -webkit-user-select: none; user-select: none;
  white-space: pre-wrap; overflow-wrap: break-word; border-style: solid; border-color: transparent;
}
.flash-mirror mark { color: transparent; background: color-mix(in srgb, var(--accent) 34%, transparent); border-radius: 3px; }
.flash-end { display: block; }

/* Result: personal best + confetti */
.chip--best { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--ink); font-weight: 600; }
.confetti { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 3; }
.confetti i { position: absolute; left: 0; top: 0; width: 7px; height: 11px; border-radius: 2px; opacity: 0; }


/* ---------- Writing / Reading chooser ---------- */
.skill-grid {
  list-style: none; margin: 1.5rem 0 0; padding: 0;
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.skill-card {
  position: relative;
  border-radius: 16px;
  background: var(--card, #fff);
  border: 1px solid var(--line, rgba(0,0,0,.08));
  box-shadow: 0 8px 24px -16px rgba(0,0,0,.35);
  overflow: hidden;
  min-height: 168px;
}
.skill-card-hit {
  display: flex; flex-direction: column; justify-content: flex-end; gap: .35rem;
  min-height: 168px; padding: 1.25rem 1.3rem 1.35rem;
  color: inherit; text-decoration: none;
}
.skill-kicker {
  font: 600 .72rem/1.3 var(--font-ui);
  letter-spacing: .12em; text-transform: uppercase;
  opacity: .62;
}
.skill-name {
  font: 650 1.85rem/1.05 var(--font-head);
  letter-spacing: -.02em;
}
.skill-meta { font: 500 .92rem/1.4 var(--font-ui); opacity: .75; }
.skill-card--writing { background: linear-gradient(180deg, color-mix(in srgb, var(--book, #33506B) 12%, var(--card, #fff)), var(--card, #fff)); }
.skill-card--soon { opacity: .72; }
.skill-card--soon .skill-card-hit { cursor: default; }
.skill-card:not(.skill-card--soon):hover { transform: translateY(-2px); box-shadow: 0 14px 28px -18px rgba(0,0,0,.45); }
.skill-card { transition: transform .2s var(--ease, ease), box-shadow .2s var(--ease, ease); }
html[data-motion=off] .skill-card { transition: none; }

.reading-card { display: flex; flex-direction: column; gap: .85rem; padding: 1rem 1.1rem 1.1rem; }
.reading-card .test-body { display: flex; flex-direction: column; gap: .35rem; }
.reading-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.reading-actions .btn { text-decoration: none; }

