/* Studyfern. Fonts: Literata (reading) and Atkinson Hyperlegible Next (interface), self-hosted, OFL; Japanese uses the system's own fonts. */
@font-face { font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap; src: url(/fonts/literata.woff2) format("woff2"); }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 200 900; font-display: swap; src: url(/fonts/literata-italic.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/fonts/atkinson-hyperlegible-next.woff2) format("woff2"); }
:root {
  --bg: #fbf8f2;
  --card: #ffffff;
  --text: #2a2a28;
  --muted: #5b5a55;
  --line: #e6e1d6;
  --soft: #f2eee5;
  --accent: #1f6a46;
  --accent-soft: #e2efe6;
  --accent-text: #ffffff;
  --hero: linear-gradient(135deg, #e7f1e9 0%, #f6efdc 100%);
  --note-bg: #fdf3d6;
  --note-line: #d9b04a;
  --ex-bg: #eaf1f8;
  --ex-line: #8eb0d6;
  --warn-bg: #fbece4;
  --warn-line: #d98c62;
  --todo-bg: #ffe5e5;
  --todo-line: #c0392b;
  --shadow: 0 1px 2px rgba(40, 35, 20, .06), 0 4px 14px rgba(40, 35, 20, .06);
  --body-weight: 400;
  --radius: 14px;
  --btn-radius: 999px;
  --motion: 1;
  --accent-2: #1f6a46;
  --accent-3: #1f6a46;
  --jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", "Noto Sans CJK JP", Meiryo;
  --ui: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, Arial, var(--jp), sans-serif;
  --serif: Literata, Georgia, "Times New Roman", var(--jp), serif;
  --read: var(--serif);
  --scale: 1;
  --lh: 1.65;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sc: var(--accent);
  color-scheme: light;
}
:root[data-theme="sepia"] {
  --bg: #f4ecd8;
  --card: #fbf5e6;
  --text: #3b3024;
  --muted: #6a5a45;
  --line: #e3d6b8;
  --soft: #efe4c8;
  --accent: #2f6a3f;
  --accent-soft: #e3e8cf;
  --accent-text: #ffffff;
  --hero: linear-gradient(135deg, #ece3c6 0%, #f3e6c9 100%);
  --note-bg: #fdf3d6;
  --note-line: #d9b04a;
  --ex-bg: #eee6d2;
  --ex-line: #b9a37a;
  --warn-bg: #fbece4;
  --warn-line: #d98c62;
  --todo-bg: #ffe5e5;
  --todo-line: #c0392b;
  --shadow: 0 1px 2px rgba(40, 35, 20, .06), 0 4px 14px rgba(40, 35, 20, .06);
  --body-weight: 400;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]):not([data-theme="sepia"]) {
  --bg: #1c1c1e;
  --card: #252528;
  --text: #e6e3dc;
  --muted: #a9a59c;
  --line: #37373b;
  --soft: #2c2c30;
  --accent: #8fd0ad;
  --accent-soft: #24372c;
  --accent-text: #10201a;
  --hero: linear-gradient(135deg, #1f2a23 0%, #2a2721 100%);
  --note-bg: #2e2a1c;
  --note-line: #8f7834;
  --ex-bg: #1d2633;
  --ex-line: #4a6c96;
  --warn-bg: #33241c;
  --warn-line: #a8653f;
  --todo-bg: #3a1c1c;
  --todo-line: #e07a6e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --body-weight: 370;
  color-scheme: dark;
}
}
:root[data-theme="dark"] {
  --bg: #1c1c1e;
  --card: #252528;
  --text: #e6e3dc;
  --muted: #a9a59c;
  --line: #37373b;
  --soft: #2c2c30;
  --accent: #8fd0ad;
  --accent-soft: #24372c;
  --accent-text: #10201a;
  --hero: linear-gradient(135deg, #1f2a23 0%, #2a2721 100%);
  --note-bg: #2e2a1c;
  --note-line: #8f7834;
  --ex-bg: #1d2633;
  --ex-line: #4a6c96;
  --warn-bg: #33241c;
  --warn-line: #a8653f;
  --todo-bg: #3a1c1c;
  --todo-line: #e07a6e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --body-weight: 370;
  color-scheme: dark;
}
.mood-playful {
  --accent: #6d28d9;
  --accent-soft: #efe8fd;
  --accent-2: #0f766e;
  --accent-3: #db2777;
  --hero: linear-gradient(135deg, #efe8fd 0%, #e3f5f2 55%, #fde7f1 100%);
  --radius: 18px;
  --btn-radius: 999px;
  --motion: 1;
}
.mood-calm {
  --accent: #1d5c3f;
  --accent-soft: #e6efe9;
  --accent-2: #1d5c3f;
  --accent-3: #1d5c3f;
  --hero: none;
  --radius: 6px;
  --btn-radius: 6px;
  --motion: 0;
  --bg: #fcfcfa;
  --card: #ffffff;
  --text: #24262a;
  --line: #e3e4e1;
}
:root[data-theme="sepia"] .mood-calm {
  --bg: #f4ecd8;
  --card: #fbf5e6;
  --text: #3b3024;
  --line: #e3d6b8;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]):not([data-theme="sepia"]) .mood-playful {
  --accent: #c4b0ff;
  --accent-soft: #2e2547;
  --accent-2: #5fd3c6;
  --accent-3: #f59ac2;
  --accent-text: #1a1030;
  --hero: linear-gradient(135deg, #2a2340 0%, #1d3230 55%, #3a2230 100%);
}
}
:root[data-theme="dark"] .mood-playful {
  --accent: #c4b0ff;
  --accent-soft: #2e2547;
  --accent-2: #5fd3c6;
  --accent-3: #f59ac2;
  --accent-text: #1a1030;
  --hero: linear-gradient(135deg, #2a2340 0%, #1d3230 55%, #3a2230 100%);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]):not([data-theme="sepia"]) .mood-calm {
  --accent: #8fd0ad;
  --accent-soft: #22332a;
  --hero: none;
  --bg: #1c1c1e;
  --card: #232326;
  --text: #e4e3df;
  --line: #36363a;
}
}
:root[data-theme="dark"] .mood-calm {
  --accent: #8fd0ad;
  --accent-soft: #22332a;
  --hero: none;
  --bg: #1c1c1e;
  --card: #232326;
  --text: #e4e3df;
  --line: #36363a;
}
:root[data-read="sans"] {
  --read: var(--ui);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 12px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--ui); font-size: calc(17px * var(--scale)); line-height: var(--lh);
  font-weight: var(--body-weight); overflow-wrap: break-word; }
@media (min-width: 760px) { body { font-size: calc(18px * var(--scale)); } }
.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }
/* Reading areas: the comfortable serif, 60-72 characters a line, never justified */
.lesson-body section, .prose, .lede, .rev, .objectives { font-family: var(--read); }
.lesson-body section p, .lesson-body section li, .prose p, .prose li { max-width: 66ch; text-align: left; }
.lesson-body .tool, .lesson-body .tool p, .lesson-body .tool li, .lesson-body .session { font-family: var(--ui); }
:lang(ja) { font-family: var(--jp), sans-serif; }
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--ui); line-height: 1.22; margin: 1.7em 0 .55em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 5vw, 2.35rem); margin-top: .4em; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 750; }
h3 { font-size: 1.12rem; }
p, ul, ol, table, figure { margin: 0 0 1.05em; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: .3em; }
code { font-family: var(--mono); font-size: .92em; background: var(--soft); padding: .1em .3em; border-radius: 4px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 6px 10px; z-index: 2; }
.lede { font-size: 1.15rem; color: var(--muted); }
.sub, .count, .hint { color: var(--muted); }
.count { font-size: .9rem; margin: 0; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--sc); margin: 1rem 0 0; }

/* Header and footer */
.site-head { background: var(--card); border-bottom: 1px solid var(--line); }
.head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; margin-right: auto; }
.brand svg, .foot-brand svg { width: 28px; height: 28px; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 360px) { .site-head nav a { padding: 4px 7px; } }
.site-head nav a { color: var(--muted); text-decoration: none; padding: 4px 10px; border-radius: 999px; font-size: .97rem; }
.site-head nav a:hover { background: var(--soft); color: var(--text); }
.site-head nav a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.site-head .search { flex: 1 1 100%; }
@media (min-width: 760px) { .site-head .search { flex: 0 1 220px; } }
.site-foot { border-top: 1px solid var(--line); margin-top: 4rem; padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: .92rem; background: var(--card); }
.site-foot a { color: var(--muted); }
.site-foot p { margin: 0 0 .5em; }
.foot-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); }
.foot-brand svg { width: 22px; height: 22px; }

/* Search */
.search { display: flex; align-items: center; background: var(--bg); border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 14px; }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .97rem; padding: 6px 0; outline: none; }
.search button { border: 0; background: var(--accent); color: var(--accent-text); border-radius: 999px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; flex: none; }
.search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.search.big, .search.big-home, .search.big-index, .search.big-404 { background: var(--card); padding: 4px 5px 4px 18px; margin: 1.2rem 0; box-shadow: var(--shadow); }
.search.big input, .search.big-home input, .search.big-index input, .search.big-404 input { font-size: 1.08rem; padding: 9px 0; }
.search.big button, .search.big-home button, .search.big-index button, .search.big-404 button { width: 42px; height: 42px; }
.results { list-style: none; padding: 0; }
.results li { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 10px; padding: .7em 1em; margin-bottom: 10px; }
.results a { font-weight: 700; display: block; }
.results p { margin: .2em 0 0; color: var(--muted); font-size: .95rem; }
.kind { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sc); }

/* Hero, chips, badges */
.hero { background: var(--hero); border-radius: 0 0 22px 22px; margin: 0 -16px; padding: 1.6rem 16px 1.2rem; }
@media (min-width: 760px) { .hero { border-radius: 22px; margin: 1.2rem 0 0; padding: 2.2rem 2rem 1.6rem; } }
.hero h1 { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: .6em 0 1em; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--btn-radius); padding: 3px 12px; font-size: .88rem; color: var(--muted); text-decoration: none; }
a.chip:hover { border-color: var(--sc); }
.chip.subj { color: var(--sc); font-weight: 650; }
.badge { flex: none; display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--sc); color: var(--card); font-weight: 800; font-size: 1.35rem; line-height: 1; }
.badge.sm { width: 22px; height: 22px; border-radius: 6px; font-size: .8rem; }
.badge.lg { width: 60px; height: 60px; border-radius: 16px; font-size: 1.8rem; }
h2 .badge.sm { vertical-align: -3px; margin-right: 8px; }

/* Cards */
.cards { list-style: none; padding: 0; display: grid; gap: 12px; }
@media (min-width: 600px) { .cards.grid { grid-template-columns: 1fr 1fr; } }
.card { position: relative; display: flex; gap: 14px; align-items: flex-start; margin: 0; background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--sc); border-radius: var(--radius); padding: 1em 1.1em; box-shadow: var(--shadow); transition: transform .12s ease; }
.card:hover { transform: translateY(-2px); }
.card-link { font-weight: 750; font-size: 1.12rem; color: var(--text); text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card:hover .card-link { color: var(--sc); }
.card p { margin: .25em 0 0; color: var(--muted); font-size: .95rem; }
.how { list-style: none; padding: 0; display: grid; gap: 10px; counter-reset: how; }
@media (min-width: 600px) { .how { grid-template-columns: 1fr 1fr; } }
.how li { counter-increment: how; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8em 1em .8em 3.2em; position: relative; margin: 0; }
.how li::before { content: counter(how); position: absolute; left: .9em; top: .8em; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.how b, .how span { display: block; }
.how span { color: var(--muted); font-size: .93rem; }

/* Ordered lesson lists */
.steps { list-style: none; padding: 0; counter-reset: step; margin-bottom: 1.5em; }
.steps li { counter-increment: step; position: relative; padding: .8em 1em .8em 3.4em; margin: 0 0 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.steps li::before { content: counter(step); position: absolute; left: .9em; top: .85em; width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--sc); color: var(--card); font-weight: 800; font-size: .88rem; display: grid; place-items: center; }
.steps a { font-weight: 700; }
.steps .mins { font-size: .8rem; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 8px; margin-left: 4px; white-space: nowrap; }
.steps p { margin: .15em 0 0; color: var(--muted); font-size: .95rem; }
.index-group { margin-top: 1rem; }
.index-group h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; }
.index-group h2 .count { font-weight: 400; margin-left: 8px; }

/* Subject and lesson heads */
.subject-head, .lesson-head { border-bottom: 1px solid var(--line); padding-bottom: .4rem; margin-bottom: 1.2rem; }
.title-row { display: flex; align-items: center; gap: 16px; margin-top: .8rem; }
.title-row h1 { margin: 0; }
.crumbs { font-size: .9rem; color: var(--muted); margin: 1.2rem 0 0; }
.crumbs a { color: var(--muted); }
.lesson-head h1 { margin-bottom: .2em; }
.lesson-head .lede { margin-bottom: .4em; }

/* Banners and notes */
.preview-bar { background: var(--todo-bg); border-bottom: 2px solid var(--todo-line); font-size: .9rem; padding: 6px 16px; text-align: center; }
.todo { background: var(--todo-bg); border: 2px dashed var(--todo-line); padding: 0 .3em; border-radius: 4px; font-weight: 700; }
.notice { background: var(--note-bg); border-left: 4px solid var(--note-line); border-radius: 8px; padding: .6em .9em; margin: 0 0 1.2em; font-size: .95rem; }

/* Lesson parts */
.lesson-tools { display: grid; gap: 12px; margin-bottom: 1.2em; }
@media (min-width: 640px) { .lesson-tools { grid-template-columns: 1fr 1fr; } }
.pairs, .toc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7em 1em; font-size: .93rem; margin: 0; }
.pairs b, .toc b { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.toc ol { margin: .2em 0 0; padding-left: 1.2em; columns: 2; column-gap: 1.2em; }
.toc li { margin: 0 0 .1em; }
section h2 { scroll-margin-top: 12px; }
.sec-example, .sec-mistake, .check { border-radius: var(--radius); padding: .2em 1.1em .4em; margin: 1.6em 0; }
.sec-example { background: var(--ex-bg); border: 1px solid var(--ex-line); }
.sec-mistake { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.sec-example h2, .sec-mistake h2, .check h2 { margin-top: .8em; }
.sec-mistake h2::before { content: "⚠ "; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
table { border-collapse: collapse; min-width: 50%; background: var(--card); }
th, td { border: 1px solid var(--line); padding: .35em .7em; text-align: left; }
th { background: var(--soft); }
blockquote { margin: 0 0 1em; padding-left: 1em; border-left: 3px solid var(--line); color: var(--muted); }
.check { background: var(--card); border: 2px solid var(--accent); }
.check .hint { font-size: .92rem; margin-top: -.3em; }
.check ol { padding-left: 1.4em; }
.check li { margin-bottom: 1em; }
.check li p { margin-bottom: .3em; font-weight: 600; }
.check summary { cursor: pointer; color: var(--accent); font-size: .95rem; display: inline-block; border: 1px solid var(--accent); border-radius: 999px; padding: 2px 12px; }
.check details[open] summary { background: var(--accent-soft); }
.check details p { margin: .5em 0 0; background: var(--soft); padding: .5em .8em; border-radius: 8px; font-weight: 400; }
.audio { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7em 1em; }
.audio figcaption { font-size: .9rem; color: var(--muted); margin-bottom: .3em; }
.audio audio { width: 100%; }
.audio.slot { border-style: dashed; color: var(--muted); font-size: .92rem; }
.pager { display: grid; gap: 10px; margin-top: 2rem; }
@media (min-width: 560px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7em 1em; text-decoration: none; font-weight: 700; }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-weight: 400; }
.pager .next { grid-column: -2; text-align: right; }
@media (max-width: 559px) { .pager .next { grid-column: auto; text-align: left; } }
.prose { max-width: 40rem; }

/* Practice tools */
.practice { margin: 1.6em 0; }
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .4em 1.1em 1em; margin: 0 0 1.2em; box-shadow: var(--shadow); }
.tool h3 { margin: .7em 0 .1em; }
.tool-hint { color: var(--muted); font-size: .88rem; margin: 0 0 .7em; }
.btn { font: inherit; font-size: .95rem; border: 1.5px solid var(--accent); background: var(--card); color: var(--accent); border-radius: var(--btn-radius); padding: 7px 16px; cursor: pointer; min-height: 40px; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.ghost { border-color: var(--line); color: var(--muted); }
.fc-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 170px; font: inherit; color: var(--text); background: var(--accent-soft); border: 2px solid var(--accent); border-radius: var(--radius); cursor: pointer; padding: 1em; margin-bottom: 10px; }
.fc-card.back { background: var(--ex-bg); border-color: var(--ex-line); }
.fc-card.done { background: var(--soft); }
.fc-side { font-size: 2.4rem; font-weight: 700; line-height: 1.6; }
.fc-side rt { font-size: .4em; }
.fc-tip { font-size: .82rem; color: var(--muted); }
.fc-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.fc-bar .btn.primary { margin-right: auto; order: 2; }
.fc-bar .btn:first-child { order: 1; }
.fc-bar .ghost { order: 3; }
.fc-count { font-size: .88rem; color: var(--muted); margin: 0 0 .5em; }
.quiz { padding-left: 1.3em; margin: 0; }
.quiz > li { margin-bottom: 1.1em; }
.quiz > li > p:first-child { font-weight: 600; margin-bottom: .4em; }
.opts { list-style: none; padding: 0; display: grid; gap: 8px; margin: 0 0 .4em; }
.opt { width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; min-height: 44px; }
.tool:not(.js) .opt { cursor: default; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; opacity: .75; }
.opt.right { border-color: var(--accent); background: var(--accent-soft); opacity: 1; font-weight: 650; }
.opt.right::after { content: "  ✓"; }
.opt.wrong { border-color: var(--warn-line); background: var(--warn-bg); opacity: 1; }
.opt.wrong::after { content: "  ✗"; }
.tool.js .quiz-ans { display: none; }
.quiz-ans summary { cursor: pointer; color: var(--accent); font-size: .92rem; }
.feedback { margin: 0; font-size: .95rem; }
.feedback.good, .feedback.bad { padding: .45em .8em; border-radius: 8px; }
.feedback.good { background: var(--accent-soft); }
.feedback.bad { background: var(--warn-bg); }
.score { font-weight: 700; margin: .4em 0 0; }
.score .btn { margin-left: 8px; }
.calc-fields { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; align-items: end; }
.calc-fields label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.calc-fields input { font: inherit; font-size: 1.05rem; color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 44px; width: 100%; }
.calc-fields input:focus { border-color: var(--accent); outline: none; }
.calc-out { display: block; margin: 1em 0 .6em; }
.calc-out dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; margin: 0; background: var(--accent-soft); border-radius: 10px; padding: .7em 1em; }
.calc-out dt { color: var(--muted); }
.calc-out dd { margin: 0; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }

/* Start here, progress, exam prep */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: .8em 0 1em; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; font-weight: 650; }
.start-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .95rem; margin: 0 0 .6em; }
.feature { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--sc); border-radius: var(--radius); padding: .3em 1.2em .6em; margin: 2em 0; box-shadow: var(--shadow); }
.feature h2 { margin-top: .2em; }
.progress { display: flex; align-items: center; gap: 10px; margin: .4em 0 1.2em; font-size: .9rem; color: var(--muted); }
.progress .bar { flex: 1; max-width: 260px; height: 10px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--sc); transition: width .3s; }
.done-box { text-align: center; background: var(--accent-soft); border-radius: var(--radius); padding: .8em 1em 1em; margin: 2rem 0 0; }
.done-box p { margin: 0 0 .6em; }
li.done > a::after { content: " ✓"; color: var(--accent); font-weight: 800; }
.steps li.done::before { content: "✓"; }
.place-result { background: var(--accent-soft); border: 2px solid var(--accent); border-radius: var(--radius); padding: .6em 1em; margin: 0 0 1.5em; font-size: 1.05rem; }
.place-result p { margin: 0; }
/* The leaf map: a stem with one leaf per lesson, growing up through the levels */
.leafmap { position: relative; padding-left: 26px; margin: 1em 0 1.5em; }
.leafmap::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: linear-gradient(var(--sc), #8a6b45); opacity: .55; }
.lvl h3 { margin: .9em 0 .4em; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sc); position: relative; }
.lvl h3::before { content: ""; position: absolute; left: -23px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--sc); border: 3px solid var(--bg); }
.leaves { list-style: none; padding: 0; margin: 0; }
.leaves li { position: relative; margin: 0 0 6px; padding: .45em .8em .45em 1.6em; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.leaves li::before { content: ""; position: absolute; left: -22px; top: .7em; width: 20px; height: 13px; border-radius: 0 100% 0 100%; border: 2px solid var(--sc); background: var(--card); transform: rotate(-12deg); }
.leaves li.done::before { background: var(--sc); }
.leaves a { font-weight: 650; }
.leaves .mins { font-size: .78rem; color: var(--muted); }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .5em 1em; margin: 0 0 .8em; }
.plan summary { cursor: pointer; font-weight: 750; padding: .2em 0; }
.plan table { width: 100%; font-size: .93rem; }
.plan td:first-child { white-space: nowrap; text-align: center; font-weight: 700; color: var(--muted); }
.timed-stage { margin-top: .6em; }
.timed-top { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin: 0 0 .5em; }
.clock { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); background: var(--soft); border-radius: 999px; padding: 1px 10px; }
.clock.low { color: var(--warn-line); }
.timed-q { font-weight: 650; font-size: 1.08rem; }
.misses li { margin-bottom: .8em; }
.misses p { margin: 0 0 .2em; }
.rev { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 12px; padding: .1em 1em .3em; margin: 0 0 12px; }
.rev h2 { font-size: 1.1rem; margin: .7em 0 .3em; }
.rev-warn { font-size: .93rem; background: var(--warn-bg); border-radius: 8px; padding: .4em .7em; }

/* Exercise engine */
.big-btn { font-size: 1.05rem; padding: 10px 20px; min-height: 48px; }
.speak-prompt { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .95rem; background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius); padding: .8em 1em; margin: .6em 0; }
.speak-actions { margin: 0 0 .8em; }
.copy-done { color: var(--muted); font-size: .88rem; margin-left: .5em; }
.speak-note { font-size: .92rem; }
.btn.small { min-height: 32px; padding: 3px 12px; font-size: .88rem; }
.objectives { background: var(--accent-soft); border-radius: var(--radius); padding: .6em 1em; margin: 0 0 1.2em; }
.objectives b { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.objectives ul { margin: .3em 0 0; }
.testout { background: var(--card); border: 1px dashed var(--accent); border-radius: var(--radius); padding: .5em 1em; margin: 0 0 1.2em; }
.testout summary { cursor: pointer; }
.testout .tool { box-shadow: none; border: 0; padding: 0; margin: .5em 0 0; }
details.more { border-left: 3px solid var(--line); padding: .1em 0 .1em .9em; margin: 0 0 1em; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 650; }
dl.terms { display: grid; grid-template-columns: max-content 1fr; gap: .3em 1em; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7em 1em; }
dl.terms dt { font-weight: 750; }
dl.terms dd { margin: 0; color: var(--muted); }
@media (max-width: 480px) { dl.terms { grid-template-columns: 1fr; } dl.terms dd { margin-bottom: .4em; } }
.sec-summary ul { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7em 1em .7em 2em; }
.diff { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.diff-basic { color: var(--accent); } .diff-intermediate { color: var(--ex-line); } .diff-challenge { color: var(--warn-line); }
.problems > li { margin-bottom: .8em; }
.problems details summary { cursor: pointer; color: var(--accent); font-size: .93rem; }
.see { white-space: nowrap; font-weight: 650; }
.opts.spot .opt { font-family: var(--mono); font-size: .92rem; }
.answer-row { min-height: 52px; border: 2px dashed var(--line); border-radius: 12px; padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; margin: .4em 0; }
.tile-bank { display: flex; flex-wrap: wrap; gap: 6px; margin: .4em 0; }
.tile { font: inherit; font-size: 1.1rem; min-height: 44px; padding: 6px 14px; border-radius: 10px; border: 1.5px solid var(--accent); background: var(--card); color: var(--text); cursor: pointer; }
.answer-row .tile { background: var(--accent-soft); }
.steplist { padding-left: 1.3em; }
.steplist > li { margin-bottom: .8em; }
.steplist label { display: flex; flex-direction: column; gap: 4px; margin-bottom: .3em; }
.steplist input { font: inherit; max-width: 12em; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--bg); color: var(--text); min-height: 44px; }
.steplist li.locked { opacity: .45; pointer-events: none; }
.steplist li.solved input { border-color: var(--accent); }
.steplist .btn { margin-right: 8px; }
.sortlist { padding-left: 1.3em; }
.sortlist > li { margin-bottom: 1em; }
.sort-item { font-weight: 650; }
.bins { display: flex; flex-wrap: wrap; gap: 6px; }
.bins .opt { width: auto; }
.big { display: block; font-size: 2.6rem; font-weight: 700; margin: .2em 0; }
.big-text { display: block; font-size: 1.05rem; font-weight: 400; margin: .4em 0; padding: .5em .8em; background: var(--soft); border-radius: 8px; }
.tap-ruby rt { visibility: hidden; }
.tap-ruby ruby { cursor: pointer; border-bottom: 1px dotted var(--accent); }
.tap-ruby ruby.shown rt { visibility: visible; }
.calc.sliders .pair { display: flex; flex-direction: column; gap: 6px; }
.calc input[type=range] { width: 100%; accent-color: var(--accent); min-height: 28px; }
.session-stage { margin-top: .6em; }
.report { border-top: 1px solid var(--line); padding-top: .6em; }
.report-head { font-size: 1.15rem; font-weight: 750; margin: 0 0 .2em; }
.report h4 { margin: 1em 0 .3em; }
.weak > li { margin-bottom: .8em; }
.fix { display: inline-block; margin-top: .3em; }
.next-step { background: var(--accent-soft); border-radius: 10px; padding: .6em .9em; }
.tag { display: inline-block; font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.tag-strong { background: var(--accent-soft); color: var(--accent); }
.tag-shaky { background: var(--note-bg); color: #8a6a12; }
.tag-weak { background: var(--warn-bg); color: #a2471f; }
.tag-new { background: var(--soft); color: var(--muted); }
@media (prefers-color-scheme: dark) { .tag-shaky { color: #e8c96a; } .tag-weak { color: #f0a07a; } }
.skills { list-style: none; padding: 0; }
.sk { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .5em .8em; margin-bottom: 6px; }
.sk .bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.sk .bar span { display: block; height: 100%; background: var(--sc); }
.sk-weak .bar span { background: var(--warn-line); } .sk-shaky .bar span { background: var(--note-line); }
.sk-pct { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
.sk-name { font-weight: 650; }
.lvl-test { display: inline-block; margin: .2em 0 .6em; font-size: .9rem; font-weight: 650; }
.chip.on, .today-subj.on { border-color: var(--sc); background: var(--accent-soft); color: var(--text); }
button.chip { font: inherit; font-size: .88rem; cursor: pointer; }
.today-plan ol { padding-left: 1.3em; }
.planner { display: grid; gap: 10px; }
@media (min-width: 600px) { .planner { grid-template-columns: repeat(3, 1fr) auto; align-items: end; } }
.planner label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.planner input, .planner select { font: inherit; color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; }


/* Moods. Playful (languages): brighter, rounder, a little bounce. Calm (finance, psychology, professional exams): quiet and exam-like. */
.mood-playful .hero, .mood-playful .subject-head { background: var(--hero); border-radius: var(--radius); padding: .4em 1em 1em; margin-top: 1rem; }
.mood-playful .kicker { color: var(--accent-3); }
.mood-playful .btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-3)); border-color: transparent; }
.mood-playful .opt.right { background: #ddf5ef; border-color: var(--accent-2); }
.mood-playful .card, .mood-playful .tool { border-radius: var(--radius); }
.mood-playful .fc-card.flip { animation: fc-flip .32s ease; }
@keyframes fc-flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg) scale(1.03); } 100% { transform: rotateY(0); } }
.mood-playful .feedback.good { animation: pop .25s ease; }
@keyframes pop { 0% { transform: scale(.96); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
.mood-calm .hero { background: none; padding-left: 0; padding-right: 0; }
.mood-calm .card:hover { transform: none; }
.mood-calm .card { box-shadow: none; border-top-width: 2px; }
.mood-calm .tool, .mood-calm .sec-example, .mood-calm .sec-mistake, .mood-calm .check { box-shadow: none; border-radius: var(--radius); }
.mood-calm .chip, .mood-calm .btn, .mood-calm .opt, .mood-calm .tile, .mood-calm .search { border-radius: var(--radius); }
.mood-calm .steps li, .mood-calm .leaves li, .mood-calm .sk { border-radius: 4px; }
.mood-calm .badge { border-radius: 4px; }
.mood-calm * { transition: none !important; animation: none !important; }
/* Exam mode in calm subjects looks like a real paper: lettered options, plain timer, no colour until the end. */
.mood-calm .session[data-mode="timed"] .timed-top, .mood-calm .session[data-mode="level"] .timed-top { font-family: var(--mono); border-bottom: 1px solid var(--line); padding-bottom: .4em; }
.mood-calm .session[data-mode="timed"] .opts, .mood-calm .session[data-mode="level"] .opts { counter-reset: opt; }
.mood-calm .session[data-mode="timed"] .opt::before, .mood-calm .session[data-mode="level"] .opt::before { counter-increment: opt; content: counter(opt, upper-alpha) ".  "; font-weight: 700; color: var(--muted); }
.mood-calm .session[data-mode="timed"] .opt, .mood-calm .session[data-mode="level"] .opt { background: var(--card); }
.mood-calm .clock { font-family: var(--mono); background: none; border: 1px solid var(--line); border-radius: 4px; }
/* A small celebration (playful subjects only) */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .fc-card.flip, .feedback.good { animation: none !important; } }

/* Reader controls: the "Aa" menu */
.aa { position: relative; order: 0; }
.site-head nav { order: 1; }
.site-head .search { order: 2; }
.aa > summary { list-style: none; cursor: pointer; font-weight: 800; font-family: var(--serif); padding: 3px 10px; border: 1.5px solid var(--line); border-radius: var(--btn-radius); color: var(--text); }
.aa > summary::-webkit-details-marker { display: none; }
.aa-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(300px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.15); padding: .7em .9em; font-size: .95rem; }
.aa-panel fieldset { border: 0; padding: 0; margin: 0 0 .7em; }
.aa-panel legend { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: .3em; }
.aa-panel .seg { display: flex; flex-wrap: wrap; gap: 4px; }
.aa-panel .seg button { font: inherit; font-size: .88rem; flex: 1; min-height: 36px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px; cursor: pointer; padding: 2px 6px; }
.aa-panel .seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.aa-panel label.switch { display: flex; align-items: center; gap: 8px; margin: .3em 0; }
:root[data-focus] .site-head nav, :root[data-focus] .site-head .search, :root[data-focus] .site-foot, :root[data-focus] .crumbs,
:root[data-focus] .toc, :root[data-focus] .preview-bar, :root[data-focus] .pager, :root[data-focus] .lesson-head .chips { display: none !important; }
.focus-exit { position: fixed; bottom: 14px; right: 14px; z-index: 30; }
.resume, .nudge { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 40; width: min(440px, calc(100vw - 24px));
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: .7em .9em; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .95rem; }
.resume p, .nudge p { margin: 0; flex: 1 1 200px; }

/* Try first: guess before you read */
.tryfirst { background: var(--accent-soft); border-radius: var(--radius); padding: .3em 1em .8em; margin: 0 0 1.2em; }
.tryfirst h2 { margin-top: .6em; font-size: 1.15rem; }
.tryfirst .tool { box-shadow: none; border: 0; background: transparent; padding: 0; }
/* Module outline: you are here */
.outline { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .5em 1em; margin: 0 0 1.2em; font-size: .93rem; }
.outline summary { cursor: pointer; font-weight: 700; }
.outline ol { margin: .4em 0 .2em; padding-left: 1.3em; }
.outline .mod { list-style: none; margin-left: -1.3em; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: .5em; }
.outline li[aria-current] { font-weight: 800; }
.outline li[aria-current]::after { content: "  ← you are here"; color: var(--accent); font-weight: 650; font-size: .85em; }
/* Illustrations (lazy-loaded WebP; only shown when the file exists) */
.art { margin: 0 0 1.2em; }
.art img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.spot-art { width: 140px; height: auto; display: block; margin: 0 auto .5em; }

/* Diagrams: inline SVG that follows the theme */
.diagram { margin: 1.2em 0 1.4em; }
.dg { display: block; width: 100%; height: auto; max-width: 560px; font-family: var(--ui); overflow: visible; }
.dg-strokes { max-width: 380px; }
.dg-t { fill: var(--text); }
.dg-small { fill: var(--muted); }
.dg-strong { font-weight: 700; }
.dg-big { font-weight: 800; }
.dg-axis, .dg-line { stroke: var(--muted); stroke-width: 2; fill: none; }
.dg-grid, .dg-guide { stroke: var(--line); stroke-width: 1; fill: none; }
.dg-guide { stroke-dasharray: 3 4; }
.dg-ahead { fill: var(--muted); }
.dg-arrow { stroke-width: 4; }
.dg-in { stroke: var(--accent); } .dg-in-t { fill: var(--accent); }
.dg-out { stroke: var(--warn-line); } .dg-out-t { fill: var(--warn-line); }
.dg-box { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.dg-a, .dg-in-box { fill: var(--accent-soft); stroke: var(--accent); }
.dg-l, .dg-out-box { fill: var(--warn-bg); stroke: var(--warn-line); }
.dg-e { fill: var(--ex-bg); stroke: var(--ex-line); }
.dg-word { fill: var(--accent-soft); stroke: var(--accent); }
.dg-endbox { fill: var(--accent-soft); stroke: var(--accent); }
.dg-ending { fill: var(--accent); text-decoration: underline; }
.dg-cell { fill: var(--card); stroke: var(--line); }
.dg-stroke { stroke: var(--muted); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.dg-stroke.dg-now { stroke: var(--text); opacity: 1; stroke-width: 4; }
.dg-start { fill: var(--accent); }
.dg-dot { fill: var(--card); stroke: var(--accent); stroke-width: 3; }
.dg-now-dot { fill: var(--accent); }
.dg-series { fill: none; stroke-width: 3.5; stroke-linejoin: round; }
.dg-s1 { stroke: var(--accent); }
.dg-s2 { stroke: var(--muted); stroke-dasharray: 7 6; }
.dg-l1 { fill: var(--accent); }
.dg-bar { fill: var(--line); }
.dg-bar-hi { fill: var(--accent); }
.dg-jp { font-family: var(--jp), sans-serif; fill: var(--text); }
.diagram figcaption { font-size: .9rem; color: var(--muted); margin-top: .3em; }
.dg-credit, .dg-note { font-size: .82rem; color: var(--muted); margin: .3em 0 0; }
.dg-desc summary { cursor: pointer; font-size: .85rem; color: var(--accent); }
.dg-desc p { font-size: .9rem; color: var(--muted); }
.dg-control { margin: .4em 0 0; font-size: .95rem; }
.dg-control input { width: 100%; max-width: 420px; accent-color: var(--accent); display: block; min-height: 28px; }
.picture { margin: 1.2em 0; }
.pic-wrap { position: relative; }
.pic-wrap .pic-img { margin: 0; }
.pic-label { position: absolute; transform: translate(-50%, -50%); background: var(--card); color: var(--text); border: 1.5px solid var(--accent);
  border-radius: 8px; padding: 2px 8px; font-size: .9rem; font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; }

.status { font-weight: 700; }
.status-draft { border-color: var(--todo-line); color: var(--todo-line); }
.status-checked { border-color: var(--note-line); }
.status-approved { border-color: var(--accent); color: var(--accent); }

/* Header: Subjects menu */
.site-head nav { align-items: center; }
.nav-subjects { position: relative; }
.nav-subjects > summary { list-style: none; cursor: pointer; color: var(--muted); padding: 4px 10px; border-radius: var(--btn-radius); font-size: .97rem; }
.nav-subjects > summary::-webkit-details-marker { display: none; }
.nav-subjects > summary::after { content: " ▾"; font-size: .8em; }
.nav-subjects > summary[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-subjects[open] > summary { background: var(--soft); color: var(--text); }
.nav-subjects .menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 25; width: min(320px, calc(100vw - 32px)); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.15); padding: 6px; }
.nav-subjects .menu a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav-subjects .menu a:hover, .nav-subjects .menu a[aria-current] { background: var(--soft); }
.nav-subjects .menu a span { display: flex; flex-direction: column; }
.nav-subjects .menu small { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.nav-subjects .menu .menu-all { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; font-size: .9rem; color: var(--accent); }
.nav-subjects .badge.sm { width: 28px; height: 28px; font-size: 1rem; }
.head-row { position: relative; }
@media (max-width: 560px) { .nav-subjects { position: static; } .nav-subjects .menu { left: 16px; right: 16px; width: auto; top: auto; margin-top: 6px; } }

/* Home as a landing page */
.landing h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.1; }
.landing .continue p { margin: .2em 0 1em; }
.doors { list-style: none; padding: 0; display: grid; gap: 14px; }
@media (min-width: 620px) { .doors { grid-template-columns: 1fr 1fr; } }
.door { position: relative; display: flex; flex-direction: column; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .12s ease; }
.door:hover { transform: translateY(-3px); }
.door .door-art { margin: 0; } .door .door-art img { border-radius: 0; aspect-ratio: 3 / 1; object-fit: cover; }
.door-badge { background: linear-gradient(135deg, var(--soft), var(--card)); padding: 18px 18px 0; }
.door-body { padding: .8em 1.1em 1em; }
.door h3 { margin: 0 0 .2em; font-size: 1.3rem; }
.door p { margin: 0 0 .3em; color: var(--muted); }
.door-go { font-weight: 750; color: var(--sc); }
.door .card-link::after { content: ""; position: absolute; inset: 0; }
.why-list { list-style: none; padding: 0; display: grid; gap: 12px; }
@media (min-width: 620px) { .why-list { grid-template-columns: 1fr 1fr; } }
.why-list li { display: grid; grid-template-columns: 44px 1fr; gap: 2px 12px; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8em 1em; }
.why-list li > span:last-child { grid-column: 2; color: var(--muted); font-size: .95rem; }
.why-icon { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; }
.why-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cta-band { text-align: center; background: var(--hero); border-radius: var(--radius); padding: 1em 1.2em 1.4em; margin: 2.5em 0 0; }
.cta-band h2 { margin-top: .4em; }
.cta-band .actions { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .door, .door:hover { transition: none; transform: none; } }

/* Landing refinements: tinted subject rows and sample practice cards */
.grad { background: linear-gradient(90deg, var(--accent), var(--accent-3, var(--accent)) 60%, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.door { background: color-mix(in srgb, var(--sc) 7%, var(--card)); border-color: color-mix(in srgb, var(--sc) 30%, var(--line)); box-shadow: none; flex-direction: row; align-items: center; }
.door .door-badge { background: none; padding: 0 0 0 16px; }
.door .door-art { display: none; }
.door-body { padding: .9em 1.1em; }
.door h3 { font-size: 1.15rem; }
.doors { grid-template-columns: 1fr !important; gap: 10px; }
.subjects-split { display: grid; gap: 18px; align-items: start; }
@media (min-width: 900px) { .is-home .wrap { max-width: 62rem; } .subjects-split { grid-template-columns: 1fr 1fr; gap: 36px; } }
.samples { display: grid; gap: 14px; }
@media (min-width: 900px) { .samples { padding-top: 3.2rem; } .sample:nth-child(1) { transform: rotate(-1.2deg); } .sample:nth-child(2) { transform: rotate(1deg) translateX(14px); } .sample:nth-child(3) { transform: rotate(-.6deg); } }
.sample { display: block; text-decoration: none; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9em 1em; box-shadow: 0 6px 24px rgba(40, 35, 20, .10); transition: transform .15s ease; }
.sample:hover { transform: translateY(-3px) rotate(0); }
.sample .chip { margin-bottom: .5em; }
.sample-q { display: block; font-weight: 700; margin: .1em 0 .5em; }
.sample-q .big { font-size: 2rem; display: inline; margin-left: .3em; }
.sample ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sample li { margin: 0; padding: .4em .7em; border: 1.5px solid var(--line); border-radius: 10px; font-size: .95rem; background: var(--bg); }
.sample li b { color: var(--muted); margin-right: .4em; }
.sample li.ok { border-color: var(--accent); background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) { .sample, .sample:hover { transform: none !important; transition: none; } }

/* Japanese */
:lang(ja) { line-break: strict; }
ruby { ruby-position: over; }
rt { font-size: .55em; color: var(--muted); }
li:has(ruby), p:has(ruby) { line-height: 2.0; }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

/* Print: a clean page, answers shown, links spelled out. */
@media print {
  .aa, .resume, .nudge, .focus-exit, .tryfirst, .outline { display: none !important; }
  :root { --bg: #fff; --card: #fff; --text: #000; --muted: #333; --line: #999; --soft: #fff; --accent: #000; --sc: #000; --ex-bg: #fff; --warn-bg: #fff; --shadow: none; }
  body { font-size: 11.5pt; line-height: 1.45; }
  .wrap { max-width: none; padding: 0; }
  .site-head nav, .site-head .search, .skip, .pager, .preview-bar, .audio, .check summary, .toc, .crumbs, .chips a.chip, .site-foot p:last-child { display: none; }
  .site-head, .site-foot { border: 0; background: none; }
  .lesson-tools { display: block; }
  .rev, .leaves li { border: 0; padding-left: 0; }
  .rev { break-inside: avoid; border-bottom: 1px solid #999; border-radius: 0; }
  .notice { border: 1px solid #000; background: none; }
  .sec-example, .sec-mistake, .check { border: 1px solid #999; }
  h2, h3 { break-after: avoid; }
  li, table, .pairs, figure { break-inside: avoid; }
  .testout, .mastery, .session, .ex-order, .ex-steps .btn, .ex-sort, .ex-drill, .tile-bank, .answer-row, .done-box, .speak-actions, .actions, .progress, .place-result, .timed, .start-row, .feature .btn, .calc, [data-tool="quiz"], [data-tool="placement"], .fc-card, .fc-bar, .fc-count, .tool-hint { display: none !important; }
  .tool { box-shadow: none; border: 0; padding: 0; }
  .fc-list[hidden] { display: table; }
  .check details p { padding: 0; }
  .check details p::before { content: "Answer: "; font-weight: 700; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; word-break: break-all; }
  .site-foot { margin-top: 1.5rem; font-size: 9pt; }
  @page { margin: 16mm; }
}
