:root {
  color-scheme: light;
  --ink: #172c2b;
  --muted-ink: #61726e;
  --paper: #f5f6f1;
  --card: #ffffff;
  --line: #dce5dd;
  --green: #28634f;
  --green-dark: #204f40;
  --mint: #eaf4ee;
  --gold: #e9b765;
  --vote-up: #1e8c6e;
  --vote-down: #d9622b;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4eee9;
  --muted-ink: #a5b7ae;
  --paper: #111b18;
  --card: #1b2824;
  --line: #354740;
  --green: #83c9a8;
  --green-dark: #a0d9bd;
  --mint: #263d33;
  --gold: #f0c477;
  --vote-up: #2fa883;
  --vote-down: #e06a35;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  /* Its own stacking context, so the light below sits over the body's colour and under its content. */
  isolation: isolate;
}
/* The warm light at the top of every page. It is a layer of a fixed size, not part of the body's
   background: a gradient sized by the body changes shape whenever the page grows, and repainting
   the whole page then freezes every animation for a frame or more (an answer's turn, its confetti,
   the XP flying to the badge). */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 70rem;
  background: radial-gradient(ellipse 32rem 70rem at 5% 0%, rgba(233, 183, 101, .13), transparent);
  pointer-events: none;
}
body, input, select, textarea, button { font-family: inherit; }
p, label, .choice-option { color: var(--ink); }
a { color: var(--green); }
.theme-toggle, .tools-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
}
.theme-toggle, .tools-toggle { margin: 0; padding: 0; }
.theme-toggle:hover, .tools-toggle:hover { border-color: var(--green); }
.theme-toggle:focus-visible, .tools-toggle:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.tools-toggle[aria-pressed="false"] { opacity: .45; }
:root[data-admin-tools="hidden"] .admin-only { display: none !important; }
.page-shell { width: min(100% - 36px, 1080px); margin: 0 auto; }
.site-nav {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 44, 43, .1);
}
.brand { flex: none; display: inline-flex; gap: 10px; align-items: center; font-weight: 750; text-decoration: none; color: var(--ink); }
.brand-words { display: grid; line-height: 1.1; white-space: nowrap; }
.brand-slogan { color: var(--muted-ink); font-size: .74rem; font-weight: 650; font-style: italic; letter-spacing: .01em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: var(--green); color: white; font-size: 20px; }
.nav-links { flex: 1; min-width: 0; display: flex; gap: 16px; align-items: center; margin-left: 40px; }
.nav-links a { color: var(--muted-ink); font-size: .94rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.nav-links a:hover { color: var(--green); }
.nav-account { flex: none; display: flex; gap: 10px; align-items: center; margin: 0 0 0 auto; white-space: nowrap; }
.nav-user { flex: none; max-width: 140px; overflow: hidden; color: var(--ink); font-size: .94rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.nav-xp { flex: none; padding: 4px 10px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-account button.nav-sign-out, .nav-links a.nav-sign-in { flex: none; width: auto; margin: 0; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted-ink); font-size: .86rem; font-weight: 650; white-space: nowrap; cursor: pointer; }
.nav-account button.nav-sign-out:hover, .nav-links a.nav-sign-in:hover { border-color: var(--green); color: var(--green); }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; margin-bottom: 34px; }
.sign-in-link { font-weight: 750; text-decoration: none; }
.generation-count { margin: -10px 0 0; color: var(--muted-ink); font-size: .9rem; }
.eyebrow, .section-label { color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.card-heading h2, .story-title, .story-panel h4 { color: var(--ink); }
.generator-card, .story-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(37, 62, 50, .07);
}
.generator-card { padding: clamp(22px, 4vw, 42px); }
.card-heading { margin-bottom: 26px; }
.card-heading h2 { margin: 6px 0; font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -.035em; }
.card-heading p { margin: 0; color: var(--muted-ink); }
.language-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.language-field label, .field-label { display: block; margin: 0 0 8px; font-size: .88rem; font-weight: 700; }
.language-select { display: grid; grid-template-columns: 1fr 42px; align-items: center; gap: 10px; }
.language-flag { display: grid; place-items: center; width: 42px; height: 42px; font-size: 1.55rem; }
.generator-card select, .generator-card textarea, .generator-card input {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfa;
  color: var(--ink);
  box-shadow: none;
}
.generator-card textarea { min-height: 105px; resize: vertical; }
.generator-card select:focus, .generator-card textarea:focus, .generator-card input:focus { border-color: var(--green); outline: 3px solid rgba(40, 99, 79, .13); }
.form-row { margin-top: 20px; }
.continuation-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 18px; padding: 12px 16px; border: 1px solid var(--green); border-radius: 14px; background: var(--mint); color: var(--ink); font-size: .92rem; }
.continuation-banner + .generation-count { margin: 0 0 14px; }
.continuation-label { color: var(--green-dark); font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.continuation-link { color: var(--ink); font-weight: 750; text-decoration: none; }
.continuation-link:hover { color: var(--green); text-decoration: underline; }
.continuation-clear { margin-left: auto; color: var(--muted-ink); font-size: .82rem; font-weight: 700; text-decoration: none; }
.continuation-clear:hover { color: var(--green); }
.companion-picker { margin: 20px 0 0; padding: 0; border: 0; }
.companion-picker legend { float: none; margin: 0 0 10px; padding: 0; }
.companion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 10px; }
label.companion-option { position: relative; display: flex; flex-direction: column; gap: 3px; width: 100%; height: 100%; min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfa; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.generator-card input.companion-checkbox { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
label.companion-option:not(:has(input:disabled)):hover { border-color: var(--green); }
label.companion-option:has(input:focus-visible) { outline: 3px solid var(--green); outline-offset: 2px; }
label.companion-option:has(input:checked) { border-color: var(--green); background: var(--mint); box-shadow: inset 0 0 0 1px var(--green); }
label.companion-option:has(input:disabled) { opacity: .48; cursor: not-allowed; }
.companion-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.companion-name { color: var(--ink); font-size: .92rem; font-weight: 750; line-height: 1.2; }
label.companion-option:has(input:checked) .companion-name::before { content: "✓ "; color: var(--green); }
.companion-realm { flex: none; padding: 2px 7px; border-radius: 999px; background: var(--paper); color: var(--muted-ink); font-size: .66rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
label.companion-option:has(input:checked) .companion-realm { background: var(--card); color: var(--green-dark); }
.companion-species { color: var(--muted-ink); font-size: .78rem; line-height: 1.3; overflow-wrap: break-word; }
.generate-button, .continue-button {
  width: 100%;
  min-height: 52px;
  margin-top: 22px;
  border: 0;
  border-radius: 13px;
  background: var(--green);
  color: #fff;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(40, 99, 79, .16);
  transition: background .15s ease, transform .15s ease;
}
.generate-button:hover, .continue-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.loading-panel { display: none; max-width: 560px; margin: 22px auto; padding: 20px; border-radius: 16px; background: var(--mint); color: var(--green-dark); text-align: center; }
.loading-panel p { margin: 8px 0 0; }
.loading-panel progress { width: min(100%, 320px); }
.creating-hero { padding-bottom: 18px; }
.creating-card { max-width: 680px; margin: 0 auto 44px; }
.creating-status-card { display: grid; justify-items: center; gap: 14px; text-align: center; }
.creating-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--mint); color: var(--green); font-size: 1.8rem; animation: creating-pulse 2.2s ease-in-out infinite; }
@keyframes creating-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .82; } }
.creating-status-card h2 { margin: 0; color: var(--ink); font-size: clamp(1.4rem, 3vw, 1.85rem); letter-spacing: -.03em; }
.creating-status-card p { max-width: 500px; margin: 0; color: var(--muted-ink); line-height: 1.6; }
.creating-progress { width: min(100%, 360px); height: 10px; margin: 4px 0; }
.creating-meta { margin: 2px 0 0; }
.creating-elapsed { font-variant-numeric: tabular-nums; }
.creating-reassurance { padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); font-size: .9rem; }
.creating-actions { justify-content: center; margin: 8px 0 0; }
.creating-error-card h2, .creating-notice-card h2 { margin: 0 0 8px; color: inherit; font-size: clamp(1.35rem, 3vw, 1.7rem); letter-spacing: -.025em; }
.creating-error-card p { margin: 0 0 10px; color: inherit; line-height: 1.6; overflow-wrap: anywhere; }
.creating-failure-note { opacity: .85; font-size: .92rem; }
.creating-error-card .cta-row, .creating-notice-card .cta-row { margin: 18px 0 0; }
.creating-notice-card h2 { color: var(--ink); }
.creating-notice-card p { margin: 0; color: var(--muted-ink); line-height: 1.6; }
@media (prefers-reduced-motion: reduce) { .creating-mark { animation: none; } }
.language-list { margin: 26px 0 0; color: var(--muted-ink); }
.language-list summary { cursor: pointer; font-weight: 700; }
.language-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.language-pill { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fbfcfa; font-size: .8rem; }
#story-result { padding: 34px 0 58px; }
#story-result:empty { padding: 0; }
.story-panel { overflow: hidden; padding: clamp(20px, 4vw, 42px); }
.story-title { margin: 0; font-size: clamp(1.75rem, 4vw, 2.7rem); text-align: center; letter-spacing: -.04em; }
.story-title-translation { margin: 5px 0 22px; color: var(--muted-ink); font-size: clamp(1.4rem, 3.2vw, 2.1rem); text-align: center; }
.story-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-bottom: 20px; }
.meta-pill { padding: 7px 12px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .83rem; font-weight: 700; }
.scene-nav { display: grid; grid-template-columns: minmax(96px, auto) 1fr minmax(96px, auto); align-items: center; gap: 12px; margin: 22px 0; }
.scene-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.scene-step { width: 36px; height: 36px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--muted-ink); font-size: .86rem; font-weight: 750; cursor: pointer; }
.scene-step.visited { border-color: var(--green); background: var(--mint); color: var(--green-dark); }
.scene-step.current { border-color: var(--green); background: var(--green); color: #fff; box-shadow: 0 0 0 3px rgba(40, 99, 79, .16); }
.scene-turn { margin: 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--green); font-size: .86rem; font-weight: 750; cursor: pointer; white-space: nowrap; }
.scene-nav .scene-turn:last-child { justify-self: end; }
.scene-nav .scene-turn:first-child { justify-self: start; }
.scene-step:hover, .scene-turn:hover { border-color: var(--green); }
.scene-step:focus-visible, .scene-turn:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.scene-image { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 200px; margin: 22px 0; overflow: hidden; border-radius: 18px; background: linear-gradient(135deg, #edf4ee, #f8f1e4); color: var(--muted-ink); text-align: center; }
.scene-image img { display: block; width: min(100%, 760px); max-height: 480px; object-fit: cover; border-radius: 18px; }
.scene-image p { max-width: 340px; padding: 24px; }
.picture-frame { position: relative; width: min(100%, 760px); }
.picture-frame img { width: 100%; }
.prompt-info { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(16, 32, 26, .7); color: #fff; font: italic 700 .95rem Georgia, serif; cursor: help; }
.prompt-info:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.prompt-tip { display: none; position: absolute; top: 46px; right: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 58px); overflow: auto; padding: 12px 14px; border-radius: 12px; background: rgba(16, 32, 26, .92); color: #fff; font-size: .82rem; line-height: 1.5; text-align: left; }
.prompt-info:hover + .prompt-tip, .prompt-info:focus + .prompt-tip, .prompt-tip:hover { display: block; }
.audio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin: 16px 0 28px; }
.audio-card { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfa; }
.audio-card p { margin: 0 0 9px; font-size: .87rem; font-weight: 700; }
.audio-card audio { display: block; width: 100%; max-width: 100%; }
.audio-card .media-retry p { font-weight: 400; }
.audio-card .media-retry small { display: block; color: var(--muted-ink); font-size: .8rem; }
.narration-player { display: flex; align-items: center; gap: 12px; }
.narration-player audio { flex: 1; min-width: 0; }
.play-track, .play-buttons { display: none; align-items: center; }
.has-js .narration-player { flex-direction: column; align-items: stretch; gap: 8px; }
.has-js .play-track { display: flex; }
.has-js .play-buttons { display: grid; }
.has-js .narration-player audio { display: none; }
.play-track { gap: 10px; }
.play-buttons { grid-template-columns: minmax(0, 1fr) auto auto auto minmax(max-content, 1fr); gap: 8px; }
.play-buttons > :first-child { grid-column: 2; }
.play-speed { justify-self: end; min-width: 44px; height: 36px; margin: 0; padding: 0 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--green-dark); font-size: .82rem; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; touch-action: manipulation; box-shadow: none; transition: background-color .15s ease, border-color .15s ease; }
.play-skip { flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--green-dark); font-size: .82rem; font-weight: 750; font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; box-shadow: none; transition: background-color .15s ease, border-color .15s ease; }
.play-button { flex: none; display: grid; place-items: center; width: 46px; height: 46px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--green); color: var(--card); font-size: 1.15rem; line-height: 1; cursor: pointer; touch-action: manipulation; box-shadow: none; transition: background-color .15s ease; }
.play-button:hover { background: var(--green-dark); }
.play-skip:hover, .play-speed:hover { border-color: var(--green); background: var(--mint); }
.play-button:focus, .play-skip:focus, .play-speed:focus { box-shadow: none; }
.play-button:focus-visible, .play-skip:focus-visible, .play-speed:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.play-button .play-icon { margin-left: 3px; }
.play-button .pause-icon, .play-button.playing .play-icon { display: none; }
.play-button.playing .pause-icon { display: inline; font-size: .92rem; letter-spacing: -2px; }
.play-seek { flex: 1; min-width: 0; margin: 0; --pico-range-thumb-color: var(--green); --pico-range-thumb-active-color: var(--green-dark); --pico-range-border-color: var(--line); --pico-range-active-border-color: var(--line); }
.play-time { flex: none; color: var(--muted-ink); font-size: .82rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sentence-pairs { border: 1px solid var(--line); border-radius: 16px; background: #fbfcfa; overflow: hidden; }
.sentence-pair { display: grid; grid-template-columns: 1fr 1fr; transition: background-color .3s ease; }
.sentence-pair + .sentence-pair { border-top: 1px solid var(--line); }
.sentence-pair > * { margin: 0; padding: 14px 20px; line-height: 1.65; }
.sentence-pair > * + * { border-left: 1px solid var(--line); }
.sentence-heads { background: var(--mint); }
.sentence-heads > .sentence-head { padding-top: 10px; padding-bottom: 12px; }
.sentence-language { display: block; margin-bottom: 3px; color: var(--green-dark); font-size: .72rem; font-weight: 700; letter-spacing: .06em; line-height: 1.4; text-transform: uppercase; opacity: .75; }
.sentence-language .fi { margin-right: .2em; }
/* Above the sentences, on the right: "Show" and a flag for each language, in the order of the columns. */
.language-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; margin: 0 0 10px; }
.language-bar-label { color: var(--muted-ink); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.language-toggles { display: inline-flex; border: 1px solid var(--green); border-radius: 999px; background: var(--card); overflow: hidden; }
button.language-toggle { display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 32px; margin: 0; padding: 0 15px; border: 0; border-radius: 0; background: var(--green); color: #fff; font-size: .95rem; line-height: 1; cursor: pointer; box-shadow: none; }
button.language-toggle + button.language-toggle { border-left: 1px solid rgba(255, 255, 255, .45); }
button.language-toggle:focus { box-shadow: none; }
button.language-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
button.language-toggle:disabled { opacity: 1; cursor: default; }
/* A hidden language's flag goes pale; its column goes, header and all, and the other takes its room. */
:root[data-hide-original] [data-language-toggle="original"],
:root[data-hide-translation] [data-language-toggle="translation"] { background: var(--card); color: var(--muted-ink); }
:root[data-hide-original] [data-language-toggle="original"] .fi,
:root[data-hide-translation] [data-language-toggle="translation"] .fi { opacity: .45; filter: grayscale(1); }
:root[data-hide-original] .language-toggle + .language-toggle,
:root[data-hide-translation] .language-toggle + .language-toggle { border-left-color: var(--green); }
:root[data-hide-original] .sentence-pair > [data-language="original"],
:root[data-hide-translation] .sentence-pair > [data-language="translation"] { display: none; }
:root[data-hide-original] .sentence-pair,
:root[data-hide-translation] .sentence-pair { grid-template-columns: minmax(0, 1fr); }
:root[data-hide-original] .sentence-pairs .sentence-pair > *,
:root[data-hide-translation] .sentence-pairs .sentence-pair > * { border-left: 0; }
.scene-title { margin: 0; color: var(--green-dark); font-size: 1.15rem; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
button.sentence-cell { appearance: none; display: block; width: 100%; min-width: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 400; text-align: left; cursor: pointer; touch-action: manipulation; box-shadow: none; transition: background .3s ease, box-shadow .3s ease, color .3s ease; }
/* The reader's own language sits on a faint grey and the one being learned on white, so a column
   left alone when the other is hidden still says which it is. The grey is see-through, so a row lit
   while it is read shows through it. */
.sentence-pairs [data-language="original"] { background-color: rgba(23, 44, 43, .045); }
.sentence-pair > button.sentence-cell + button.sentence-cell { border-left: 1px solid var(--line); }
button.sentence-cell:disabled { opacity: 1; cursor: default; }
button.sentence-cell:not(:disabled):hover { background: rgba(40, 99, 79, .05); }
button.sentence-cell:focus { box-shadow: none; }
button.sentence-cell:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; box-shadow: none; }
.sentence-pair.sentence-row-active { background: var(--mint); }
button.sentence-cell.sentence-active { background: radial-gradient(ellipse at 35% 50%, rgba(40, 99, 79, .10), rgba(40, 99, 79, .02) 75%); box-shadow: inset 4px 0 0 var(--green); color: #10241d; }
.ai-disclaimer { margin: 10px 4px 0; color: var(--muted-ink); font-size: .85rem; font-style: italic; text-align: center; }
.ai-disclaimer-mark { font-style: normal; }
.vocabulary-card, .choices-card, .ending-card { margin-top: 28px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: #fffdf8; }
.vocabulary-card h4, .choices-card h4, .ending-card h4 { margin: 0 0 14px; }
.vocabulary-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.vocabulary-item { padding: 12px; border-radius: 12px; background: white; }
.vocabulary-item small { display: block; margin-top: 4px; color: var(--muted-ink); }
/* Answers are cards, one a row, with the play button beside each; picking one shows what is
   behind it (see the scene chapter). The question's data-answer-look picks how a card looks,
   and its data-answer-reveal how it shows its back: flip, or double (two halves part in the
   middle and swing in). */
.choice-list { display: flex; flex-direction: column; gap: 14px; }
.choice-entry { display: flex; align-items: center; gap: 12px; min-width: 0; }
label.choice-card { position: relative; display: block; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border-radius: 16px; cursor: pointer; perspective: 900px; -webkit-tap-highlight-color: transparent; }
label.choice-card input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
label.choice-card:has(input:focus-visible) { outline: 3px solid var(--green); outline-offset: 5px; }
.choice-card-inner { display: grid; height: 100%; min-height: 84px; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); }
.choice-face { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 16px; border-radius: 16px; text-align: center; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.choice-front { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 16px 18px; text-align: left; }
.choice-card-mark { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--mint); color: var(--green); font-weight: 800; line-height: 1; }
.choice-title { color: var(--ink); font-weight: 750; line-height: 1.3; overflow-wrap: break-word; }
.choice-back { flex-flow: row wrap; align-content: center; gap: 2px 10px; font-weight: 800; }
.choice-back small { flex-basis: 100%; font-size: .85rem; font-weight: 600; opacity: .8; overflow-wrap: break-word; }
.choice-card[data-correct="true"] .choice-back { border: 2px solid #f8d27a; background: linear-gradient(145deg, #ffe39a, #f2b84b 55%, #e09a2a); color: #4d3100; box-shadow: 0 12px 30px -10px rgba(224, 154, 42, .8); }
.choice-card[data-correct="true"] .choice-back .choice-card-mark { width: auto; height: auto; background: none; color: #fff; font-size: 1.3rem; text-shadow: 0 0 12px rgba(255, 241, 184, .9); }
.choice-card[data-correct="false"] .choice-back { border: 1px solid #ddd6ca; background: #f3f1ec; color: #6b6458; }
.choice-card[data-correct="false"] .choice-back .choice-card-mark { background: #e6e1d8; color: #8a8276; }

/* The two halves a "double" reveal parts, each carrying its half of the answer's sign.
   Everywhere else they are not drawn, and the answer is the card's own title. */
.door-leaf { display: none; }
[data-answer-reveal="double"] .choice-front { position: relative; background: none; border-color: transparent; }
[data-answer-reveal="double"] .choice-front .choice-card-mark { display: none; }
[data-answer-reveal="double"] .choice-front .choice-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[data-answer-reveal="double"] .door-leaf { display: block; position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; transition: transform .9s cubic-bezier(.3, .9, .3, 1), filter .2s ease; }
[data-answer-reveal="double"] .door-leaf-left { left: 0; transform-origin: 0 50%; }
[data-answer-reveal="double"] .door-leaf-right { right: 0; transform-origin: 100% 50%; }
/* A sign 168% of a half is 84% of the card. Each copy starts 8% in from the card's edge, so the
   two meet at the seam and the sign sits centred across the closed pair. */
.door-sign { position: absolute; top: 44%; width: 168%; padding: 8px 6px; color: var(--ink); font-size: 1rem; font-weight: 750; line-height: 1.3; text-align: center; overflow-wrap: break-word; translate: 0 -50%; }
.door-leaf-left .door-sign { left: 16%; }
.door-leaf-right .door-sign { left: -84%; }

/* The button look: a raised key with a thick edge that sinks when pressed. */
[data-answer-look="button"] .choice-card-inner { margin-bottom: 7px; }
[data-answer-look="button"] .choice-front { border: 1px solid #c9ddd0; background: linear-gradient(180deg, #ffffff, #eef6f0); box-shadow: 0 7px 0 #b5cfbf, 0 14px 22px -10px rgba(23, 44, 43, .45); transition: transform .7s cubic-bezier(.3, 1.2, .5, 1), translate .12s ease, box-shadow .12s ease, border-color .2s ease; }
[data-answer-look="button"] label.choice-card:hover .choice-front { translate: 0 -2px; border-color: var(--green); box-shadow: 0 9px 0 #a9c7b5, 0 18px 26px -12px rgba(23, 44, 43, .5); }
[data-answer-look="button"] label.choice-card:active .choice-front { translate: 0 6px; box-shadow: 0 1px 0 #b5cfbf, 0 4px 8px -6px rgba(23, 44, 43, .4); transition-duration: .7s, .05s, .05s, .2s; }
[data-answer-look="button"] .choice-card[data-correct="true"] .choice-back { box-shadow: 0 7px 0 #b97a17, 0 14px 30px -10px rgba(224, 154, 42, .8); }
[data-answer-look="button"] .choice-card[data-correct="false"] .choice-back { box-shadow: 0 7px 0 #d3cbbd; }
[data-answer-look="button"][data-answer-reveal="double"] .choice-front { background: none; border-color: transparent; }
[data-answer-look="button"][data-answer-reveal="double"] label.choice-card:hover .choice-front { border-color: transparent; }
[data-answer-look="button"][data-answer-reveal="double"] .choice-card:has(input:checked) .choice-front { box-shadow: none; }
[data-answer-look="button"] .door-leaf { background: linear-gradient(180deg, #ffffff, #eef6f0); }
[data-answer-look="button"] .door-leaf-left { border-radius: 16px 0 0 16px; box-shadow: inset 1px 1px 0 #c9ddd0, inset 0 -1px 0 #c9ddd0, inset -1px 0 0 rgba(40, 99, 79, .25); }
[data-answer-look="button"] .door-leaf-right { border-radius: 0 16px 16px 0; box-shadow: inset -1px 1px 0 #c9ddd0, inset 0 -1px 0 #c9ddd0, inset 1px 0 0 rgba(40, 99, 79, .25); }

/* The door look: a wooden door in a stone frame with the answer on a plaque, or a pair with a sign across both. */
[data-answer-look="door"] { --arch: 46px; --door-shape: 50% 50% 6px 6px / var(--arch) var(--arch) 6px 6px; }
[data-answer-look="door"] .choice-list { gap: 22px; }
[data-answer-look="door"] label.choice-card { margin: 9px; border-radius: var(--door-shape); background: radial-gradient(ellipse at 50% 70%, #3a2614, #170e07 75%); box-shadow: 0 0 0 8px #e6dcc6, 0 0 0 9px #cdbd9c, 0 14px 22px -8px rgba(60, 40, 10, .35); }
[data-answer-look="door"] .choice-card-inner { min-height: 132px; }
[data-answer-look="door"] .choice-face { border-radius: var(--door-shape); }
[data-answer-look="door"] .choice-front,
[data-answer-look="door"] .door-leaf {
  background:
    linear-gradient(#3d2a1a, #3d2a1a) 0 20% / 100% 7px no-repeat,
    linear-gradient(#3d2a1a, #3d2a1a) 0 86% / 100% 7px no-repeat,
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 26px),
    linear-gradient(180deg, #b07338, #84501f); }
[data-answer-look="door"] .choice-front { position: relative; justify-content: center; padding: 26px 44px 26px; box-shadow: inset 0 0 0 3px rgba(40, 22, 8, .35), inset -10px 0 18px rgba(0, 0, 0, .18); transition: transform .8s cubic-bezier(.3, 1.1, .4, 1), filter .2s ease; }
[data-answer-look="door"] .choice-front .choice-card-mark { display: none; }
[data-answer-look="door"] .choice-front .choice-title,
[data-answer-look="door"] .door-sign { padding: 8px 12px; border: 2px solid #c9a15a; border-radius: 8px; background: linear-gradient(#fffaf0, #f4e8cc); color: #2b1d0e; text-align: center; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
[data-answer-look="door"] .choice-front::after,
[data-answer-look="door"] .door-leaf::after { content: ""; position: absolute; top: 74%; width: 12px; height: 12px; border: 3px solid #e9b765; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
[data-answer-look="door"] .choice-front::after { right: 16px; top: calc(50% - 9px); }
[data-answer-look="door"][data-answer-reveal="double"] .choice-front { background: none; box-shadow: none; }
[data-answer-look="door"][data-answer-reveal="double"] .choice-front::after { content: none; }
[data-answer-look="door"] .door-leaf-right { background-position: right 0 top 20%, right 0 top 86%, right 0 top 0, 0 0; }
[data-answer-look="door"] .door-leaf-right { background-image:
    linear-gradient(#3d2a1a, #3d2a1a),
    linear-gradient(#3d2a1a, #3d2a1a),
    repeating-linear-gradient(270deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 26px),
    linear-gradient(180deg, #b07338, #84501f); }
[data-answer-look="door"] .door-leaf-left { border-radius: 100% 0 0 6px / var(--arch) 0 0 6px; box-shadow: inset 0 0 0 3px rgba(40, 22, 8, .35), inset -6px 0 10px rgba(0, 0, 0, .25); }
[data-answer-look="door"] .door-leaf-right { border-radius: 0 100% 6px 0 / 0 var(--arch) 6px 0; box-shadow: inset 0 0 0 3px rgba(40, 22, 8, .35), inset 6px 0 10px rgba(0, 0, 0, .25); }
[data-answer-look="door"] .door-leaf-left::after { right: 7px; }
[data-answer-look="door"] .door-leaf-right::after { left: 7px; }
[data-answer-look="door"] label.choice-card:hover .choice-front,
[data-answer-look="door"] label.choice-card:hover .door-leaf { filter: brightness(1.08); }
[data-answer-look="door"] .choice-card[data-correct="true"] .choice-back { border: 0; background: radial-gradient(circle at 50% 62%, #fffbe9 0, #ffe9a6 22%, #f4c25a 48%, #d18a22 78%, #8a5512 100%); color: #5b3a07; box-shadow: none; }
[data-answer-look="door"] .choice-card[data-correct="false"] .choice-back { border: 0; background: radial-gradient(ellipse at 50% 70%, #4a3a2c, #1d150e 80%); color: #cbbfae; }
[data-answer-look="door"] .choice-card[data-correct="false"] .choice-back .choice-card-mark { background: rgba(255, 255, 255, .1); color: #cbbfae; }
[data-answer-look="door"] .choice-card[data-correct="true"]:has(input:checked) { box-shadow: 0 0 0 8px #f6e3a8, 0 0 0 9px #e3b85a, 0 14px 22px -8px rgba(60, 40, 10, .35); }
/* The right door's golden glow fades in as a layer of its own: a blurred shadow that changes is
   repainted on every frame, while a layer that fades is moved by the compositor. */
[data-answer-look="door"] label.choice-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 40px 10px rgba(255, 196, 64, .55); opacity: 0; transition: opacity .4s ease; pointer-events: none; }
[data-answer-look="door"] .choice-card[data-correct="true"]:has(input:checked)::after { opacity: 1; }

/* The flip reveal: the whole card turns over; the right one leaps as it does. Every card turns
   with the same one transition. The leap is a separate animation of `translate` and `scale`,
   which the browser applies apart from `transform`, so it rises and lands without touching the
   turn: keyframes that also turned the card would ease into each keyframe and out again, and
   the card would stop halfway round before finishing. */
[data-answer-reveal="flip"] .choice-back { transform: rotateY(180deg); }
[data-answer-reveal="flip"] .choice-card:has(input:checked) .choice-card-inner { transform: rotateY(180deg); }
[data-answer-reveal="flip"] .choice-card[data-correct="true"]:has(input:checked) .choice-card-inner { animation: choice-leap .6s ease-in-out; }
@keyframes choice-leap {
  45% { translate: 0 -16px; scale: 1.05; }
}

/* The double reveal: two halves part in the middle, each swinging in on its outer edge, away
   from the reader so nothing reaches outside the card, and the light inside grows as if the
   reader walked through. The two halves move as mirror images: one perspective, centred
   between them, and the same timing and angle each way. */
[data-answer-reveal="double"] .choice-card-inner { transform-style: flat; perspective: none; }
[data-answer-reveal="double"] .choice-front { z-index: 1; transform-style: preserve-3d; perspective: 1600px; perspective-origin: 50% 50%; }
[data-answer-reveal="double"] label.choice-card:not(:has(input:checked)):hover .door-leaf-left { transform: rotateY(12deg); }
[data-answer-reveal="double"] label.choice-card:not(:has(input:checked)):hover .door-leaf-right { transform: rotateY(-12deg); }
[data-answer-reveal="double"] .choice-card:has(input:checked) .door-leaf-left { transform: rotateY(87deg); }
[data-answer-reveal="double"] .choice-card:has(input:checked) .door-leaf-right { transform: rotateY(-87deg); }
[data-answer-reveal="double"] .choice-card:has(input:checked) .choice-back { padding-inline: 48px; }
/* The sign parts with the doors, then goes once they are nearly edge-on, where it is only a smudge.
   It goes in one step: fading it inside a turning half would repaint the half every frame. */
[data-answer-reveal="double"] .door-sign { transition: visibility 0s; }
[data-answer-reveal="double"] .choice-card:has(input:checked) .door-sign { visibility: hidden; transition-delay: .35s; }
[data-answer-reveal="double"] .choice-card[data-correct="true"]:has(input:checked) .door-leaf-left { animation: door-left-open 1.1s cubic-bezier(.3, .9, .3, 1); }
[data-answer-reveal="double"] .choice-card[data-correct="true"]:has(input:checked) .door-leaf-right { animation: door-right-open 1.1s cubic-bezier(.3, .9, .3, 1); }
[data-answer-reveal="double"] .choice-card[data-correct="true"]:has(input:checked) .choice-back { animation: door-light .9s .15s cubic-bezier(.3, .6, .4, 1) both; }
[data-answer-reveal="double"] .choice-card[data-correct="true"]:has(input:checked) .choice-back > * { animation: walk-through 1.1s .2s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes door-left-open { 0% { transform: none; } 12% { transform: rotateY(-3deg); } }
@keyframes door-right-open { 0% { transform: none; } 12% { transform: rotateY(3deg); } }
/* The light only fades up: the parting halves already uncover it from the middle out, and a fade
   runs on the compositor where a growing clip or a brightness filter is repainted every frame. */
@keyframes door-light { from { opacity: 0; } }
@keyframes walk-through { from { opacity: 0; transform: scale(.55); } 60% { opacity: 1; } to { transform: none; } }

.choice-results:has(.choice-result:not([hidden])) { margin-top: 16px; }
.choice-result:not([hidden]) { animation: choice-result-in .4s .15s cubic-bezier(.2, 1, .3, 1) both; }
@keyframes choice-result-in { from { opacity: 0; transform: translateY(-8px); } }
/* A celebration's pieces (`CELEBRATION_SCRIPT`). The stylesheet only shapes them; the script
   places each one and moves it with an animation of its own, in plain numbers, so every
   browser can hand it to the compositor and it never waits on the page. */
.celebration { position: fixed; inset: 0; z-index: 60; overflow: hidden; pointer-events: none; }
.celebration span { position: absolute; top: 0; left: 0; opacity: 0; will-change: transform, opacity; }
.confetti span { border-radius: 2px; }
.fireworks .rocket { width: 4px; height: 22px; margin-left: -2px; border-radius: 2px; background: linear-gradient(#e09a2a, rgba(242, 184, 75, 0)); }
.fireworks .spark { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; }
/* What a reader earns: a gold "+XP" beside the answer, and a copy that flies to the badge. */
.xp-gain { display: inline-flex; align-items: center; margin-right: 4px; padding: 3px 10px; border-radius: 999px; background: linear-gradient(145deg, #ffe39a, #f2b84b); color: #4d3100; font-weight: 800; box-shadow: 0 4px 12px -4px rgba(224, 154, 42, .7); animation: xp-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes xp-pop { from { opacity: 0; transform: scale(.4); } }
.xp-flight { position: fixed; top: 0; left: 0; z-index: 61; padding: 6px 12px; border-radius: 999px; background: linear-gradient(145deg, #ffe39a, #f2b84b); color: #4d3100; font-weight: 800; white-space: nowrap; box-shadow: 0 8px 20px -6px rgba(224, 154, 42, .8); pointer-events: none; }
/* Catching XP, the badge turns gold once and pulses in size; only the size animates, so the
   compositor runs it and nothing is repainted frame by frame while a celebration falls. */
.nav-xp.xp-bump { background: #ffe39a; color: #4d3100; animation: xp-bump .8s cubic-bezier(.3, 1.6, .5, 1); }
.xp-toast { position: fixed; top: 14px; right: 16px; z-index: 62; padding: 8px 14px; font-size: .95rem; box-shadow: 0 10px 24px -10px rgba(23, 44, 43, .5); pointer-events: none; animation: xp-toast-in .35s cubic-bezier(.3, 1.4, .5, 1); transition: opacity .35s ease, translate .35s ease; }
.xp-toast.xp-bump { background: #ffe39a; color: #4d3100; animation: xp-bump .8s cubic-bezier(.3, 1.6, .5, 1); }
.xp-toast-leaving { opacity: 0; translate: 0 -12px; }
@keyframes xp-toast-in { from { opacity: 0; translate: 0 -16px; } }
@keyframes xp-bump {
  30% { transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .choice-card-inner, .choice-front, .door-leaf, .door-sign { transition: none !important; }
  .choice-card-inner, .choice-front, .door-leaf, .choice-back, .choice-back > *, .choice-result:not([hidden]), .xp-gain, .nav-xp.xp-bump, .xp-toast { animation: none !important; }
}
.choice-audio { display: flex; align-items: center; }
.choice-player { display: flex; align-items: center; }
.choice-player audio { display: none; }
.choice-play-button { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--green); font-size: .95rem; line-height: 1; cursor: pointer; touch-action: manipulation; box-shadow: none; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.choice-play-button:hover:not(:disabled) { border-color: var(--green); background: var(--mint); }
.choice-play-button:focus { box-shadow: none; }
.choice-play-button:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; box-shadow: none; }
.choice-play-button:disabled { opacity: .45; cursor: progress; }
.choice-play-button .play-icon { margin-left: 2px; }
.choice-play-button .pause-icon, .choice-play-button.playing .play-icon { display: none; }
.choice-play-button.playing .pause-icon { display: inline; font-size: .78rem; letter-spacing: -1.5px; }
.choice-play-button.playing { border-color: var(--green); background: var(--green); color: var(--card); }
.muted-copy { color: var(--muted-ink); }
.choice-result { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f5faf6; }
.choice-result h5 { margin: 0 0 8px; color: var(--green-dark); font-size: 1rem; }
.choice-result p { margin: 6px 0; line-height: 1.65; }
.choice-translation { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.choice-translation-label { display: block; color: var(--green); font-size: .75rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.choice-translation p { margin: 4px 0; color: var(--muted-ink); }
.choice-translation .choice-translation-answer { font-weight: 700; }
.ending-card { background: #f0f7f2; }
.ending-card h4 { color: var(--green-dark); }
.ending-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; margin-bottom: 42px; }
.post-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); text-decoration: none; box-shadow: 0 1px 2px rgba(23, 44, 43, .04); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.post-card:hover { transform: translateY(-4px); border-color: var(--green); box-shadow: 0 18px 40px rgba(23, 44, 43, .1); }
.post-card:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.post-card-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--mint); }
.post-card-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 20px 22px 22px; }
.post-date { color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.post-card-title { margin: 0; color: var(--ink); font-size: 1.32rem; letter-spacing: -.025em; line-height: 1.2; }
.post-card-text { margin: 0; color: var(--muted-ink); line-height: 1.55; }
.post-card-text::first-letter { text-transform: uppercase; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-tag { padding: 3px 9px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .74rem; font-weight: 700; }
.post-card-more { margin-top: auto; padding-top: 6px; color: var(--green); font-size: .9rem; font-weight: 750; }
.post-article { width: min(100%, 720px); margin: 0 auto; padding: 42px 0 48px; background: none; box-shadow: none; }
.post-article .eyebrow { display: block; margin-top: 26px; }
.post-title { margin: 8px 0 10px; color: var(--ink); font-size: clamp(2.1rem, 5vw, 3.3rem); letter-spacing: -.05em; line-height: 1.05; }
.post-subtitle { margin: 0 0 24px; color: var(--muted-ink); font-size: 1.2rem; line-height: 1.5; }
.post-image { display: block; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 30px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); }
.post-back { color: var(--muted-ink); font-size: .92rem; font-weight: 700; text-decoration: none; }
.post-back:hover { color: var(--green); }
.post-body { color: var(--ink); font-size: 1.06rem; line-height: 1.75; }
.post-body p, .post-body li { color: var(--ink); }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 { margin: 1.8em 0 .5em; color: var(--ink); letter-spacing: -.03em; line-height: 1.2; }
.post-body h4 { color: var(--green-dark); }
.post-body img { display: block; width: 100%; height: auto; margin: 10px 0 26px; border: 1px solid var(--line); border-radius: var(--radius); }
.post-body a { font-weight: 650; }
.post-body blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--gold); color: var(--muted-ink); font-style: italic; }
.post-body code { padding: 2px 6px; border-radius: 6px; background: var(--mint); color: var(--green-dark); font-size: .9em; }
.post-body pre { overflow-x: auto; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.post-body pre code { padding: 0; background: none; color: inherit; }
.post-body hr { margin: 2.4em 0; border: 0; border-top: 1px solid var(--line); }
.post-end { margin-top: 42px; padding-top: 20px; border-top: 1px solid var(--line); }
.post-missing { text-align: center; }
.promise-table { width: 100%; margin: 1em 0 1.6em; border-collapse: collapse; font-size: .95rem; line-height: 1.5; }
.promise-table th, .promise-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; color: var(--ink); }
.promise-table th { color: var(--muted-ink); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.post-body .account-grid { margin: 1.4em 0; }
.post-body .generator-card ul { margin: 0; padding-left: 1.2em; }
.post-body .generator-card h2 { margin-top: 0; }
.account-terms { margin: 0 0 34px; color: var(--muted-ink); font-size: .92rem; text-align: center; }
.site-footer p { margin: 0 0 6px; }
.site-footer { padding: 24px 0 34px; border-top: 1px solid rgba(23, 44, 43, .1); color: var(--muted-ink); font-size: .86rem; text-align: center; }
.site-footer a { font-weight: 700; text-decoration: none; }
.site-footer .site-footer-note { font-weight: 800; }
.retry-busy { display: none; }
.retry-button.htmx-request .retry-idle { display: none; }
.retry-button.htmx-request .retry-busy { display: inline; }
.retry-button:disabled { opacity: .6; cursor: progress; }
.scene-image small { display: block; padding: 0 24px 18px; color: var(--muted-ink); }
.retry-button { margin: 0 0 16px; padding: 9px 14px; border: 1px solid var(--green); border-radius: 10px; background: white; color: var(--green); font-weight: 700; }
.admin-tools { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; max-width: 100%; margin: 10px 0 0; }
.scene-image .admin-tools { padding: 0 10px 12px; }
.admin-tools .redraw-service { flex: 0 1 auto; min-width: 0; width: auto; margin: 0; padding: 5px 32px 5px 8px; font-size: .8rem; }
.audio-card .admin-tools { justify-content: flex-start; }
.audio-card .admin-tools .redraw-service { flex: 1 1 120px; min-width: 0; }
.admin-tools .retry-button { flex: none; margin: 0; padding: 6px 12px; font-size: .8rem; white-space: nowrap; }
.admin-version-group { display: flex; flex: 1 1 100%; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-width: 0; }
.audio-card .admin-version-group { justify-content: flex-start; }
.audio-card .admin-version-group .version-select { flex: 1 1 120px; min-width: 0; }
.admin-tools .revert-button { border-color: var(--line); color: var(--muted-ink); }
.admin-tools .revert-button:hover { border-color: var(--green); color: var(--ink); }
.answer-presentation-tools { justify-content: flex-start; margin: -2px 0 16px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 12px; }
.answer-presentation-choice { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted-ink); font-size: .8rem; font-weight: 650; }
.answer-presentation-label { flex-basis: 100%; color: var(--muted-ink); font-size: .75rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.story-error { padding: 18px; border: 1px solid #efc4bd; border-radius: 14px; background: #fff4f1; color: #8d3025; }
.gallery-hero { padding: 42px 0 28px; }
.gallery-hero h1 { margin: 8px 0; color: var(--ink); font-size: clamp(2.3rem, 5vw, 3.8rem); letter-spacing: -.05em; }
.gallery-hero p { max-width: 650px; color: var(--muted-ink); line-height: 1.65; }
.library-layout { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 22px; align-items: start; }
.story-library { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.library-rail { position: relative; align-self: stretch; min-height: 360px; }
.library-rail > .story-library { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.story-details { margin-top: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.story-details > summary { padding: 16px 22px; color: var(--green-dark); font-weight: 750; cursor: pointer; }
.story-details[open] > summary { border-bottom: 1px solid var(--line); }
.story-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 22px; padding: 18px 22px; font-size: .92rem; overflow-wrap: anywhere; }
.story-fact-label { color: var(--muted-ink); font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; align-self: center; }
.story-details form { margin: 0; padding: 0 22px 18px; }
.story-details-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 22px 18px; }
.story-details-actions form { padding: 0; }
.story-visibility, .story-print-link, .ending-print-link { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 16px; border: 1px solid var(--green); border-radius: 999px; background: var(--card); color: var(--green); font-size: .86rem; font-weight: 750; line-height: 1.25; text-decoration: none; cursor: pointer; }
.story-visibility:hover, .story-print-link:hover, .ending-print-link:hover { background: var(--mint); color: var(--green-dark); }
.ending-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 4px; }
.library-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 15px; }
.library-heading h2 { margin: 0; color: var(--ink); font-size: 1.1rem; }
.library-count { color: var(--muted-ink); font-size: .78rem; }
.story-group-label { margin: 18px 0 8px; color: var(--muted-ink); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.story-list { display: grid; gap: 9px; }
.mini-card {
  --hue: 200;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 7px;
  border: 2px solid transparent;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 100% 0%, hsl(var(--hue) 80% 55% / .38), transparent 60%) padding-box,
    linear-gradient(#0b0f2b, #0b0f2b) padding-box,
    linear-gradient(155deg, hsl(var(--hue) 75% 68%), hsl(calc(var(--hue) + 50) 65% 42%) 50%, hsl(calc(var(--hue) + 130) 60% 30%)) border-box;
  color: #eef1ff;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.mini-card:hover { transform: translateY(-1px); color: #eef1ff; box-shadow: 0 8px 18px rgba(10, 14, 40, .3); }
.mini-card:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.mini-card.selected { box-shadow: 0 0 0 2px var(--card), 0 0 0 5px var(--green); }
.mini-card-text { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; min-width: 0; }
.mini-card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .86rem; font-weight: 800; line-height: 1.25; }
.mini-card-subtitle { overflow: hidden; color: #b9c2ea; font-size: .74rem; font-style: italic; text-overflow: ellipsis; white-space: nowrap; }
.mini-card-meta { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .68rem; }
.mini-card-meta .story-card-level { flex: none; }
.mini-card-meta .story-card-level { font-size: .78rem; }
.mini-card-meta .story-card-flags { margin-left: auto; }
.mini-card-note { min-width: 0; overflow: hidden; color: #98a3d4; font-weight: 750; letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.shelf-toggle { margin: 16px 0 12px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--green); font-size: .86rem; font-weight: 750; cursor: pointer; }
.shelf-toggle:hover { border-color: var(--green); }
.shelf-toggle:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.shelf-toggle-show { display: none; }
:root[data-shelf="hidden"] .shelf-toggle-show { display: inline; }
:root[data-shelf="hidden"] .shelf-toggle-hide { display: none; }
:root[data-shelf="hidden"] .library-layout { grid-template-columns: minmax(0, 1fr); }
:root[data-shelf="hidden"] .library-rail { display: none; }
.gallery-content { min-width: 0; }
.empty-story { padding: 32px; border: 1px dashed var(--line); border-radius: 18px; background: var(--card); color: var(--muted-ink); text-align: center; }
.arena-request { margin: 0 0 18px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.arena-request p { margin: 0 0 12px; font-weight: 700; }
.arena-request .story-meta, .arena-column .story-meta { justify-content: flex-start; margin-bottom: 0; }
.arena-note { margin: 0 0 18px; color: var(--muted-ink); }
.arena-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin-bottom: 22px; }
.arena-column { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.arena-column h3 { margin: 18px 0 2px; color: var(--ink); font-size: 1.35rem; letter-spacing: -.02em; }
.arena-column .story-error { margin-top: 18px; overflow-wrap: anywhere; }
.arena-column .story-error h3 { margin-top: 0; color: inherit; }
.arena-column .story-error p { color: inherit; }
.arena-scene { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.arena-scene h4 { margin: 0 0 10px; color: var(--green); font-size: 1rem; }
.arena-scene p { margin: 0 0 4px; line-height: 1.6; }
.arena-scene p.arena-translation { margin-bottom: 12px; color: var(--muted-ink); }
.arena-scene small { display: block; margin-top: 8px; color: var(--muted-ink); }
.card-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; margin: 14px 0 34px; perspective: 1400px; }
.library-actions { margin: 0 0 34px; font-weight: 750; }
.library-actions a { text-decoration: none; }
.story-card {
  --hue: 200; --rx: 0deg; --ry: 0deg; --gx: 90%; --gy: -20%; --glare: .5; --lift: 1;
  position: relative;
  display: flex;
  padding: 10px;
  border-radius: 20px;
  background: linear-gradient(155deg, hsl(var(--hue) 75% 68%), hsl(calc(var(--hue) + 50) 65% 42%) 50%, hsl(calc(var(--hue) + 130) 60% 30%));
  box-shadow: 0 16px 36px rgba(10, 14, 40, .3);
  transform: scale3d(var(--lift), var(--lift), 1) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .3s ease-out, box-shadow .3s ease-out;
  will-change: transform;
}
.story-card.tilting { --lift: 1.04; transition-duration: .15s; box-shadow: 0 26px 52px rgba(10, 14, 40, .42); }
.story-card-glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: var(--glare); background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%); transition: opacity .25s ease; mix-blend-mode: screen; }
.story-card-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  color: #eef1ff;
  background:
    radial-gradient(1.5px 1.5px at 12% 16%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 31% 62%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 54% 28%, #cfe0ff 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 81%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 12%, #ffe9c2 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 88%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 93% 54%, #fff 50%, transparent 51%),
    radial-gradient(ellipse at 85% 0%, hsl(var(--hue) 80% 55% / .38), transparent 60%),
    radial-gradient(ellipse at 0% 100%, hsl(calc(var(--hue) + 130) 70% 45% / .3), transparent 55%),
    #0b0f2b;
}
.story-card-open { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; }
.story-card-top { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.story-card-kind { padding: 3px 8px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; font-size: .56rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.story-card-level { color: #ffd98a; font-size: 1rem; letter-spacing: .12em; text-shadow: 0 0 10px rgba(255, 217, 138, .7); }
.story-card-title { min-height: 2.5em; font-size: .94rem; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.story-card-art { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; aspect-ratio: 1; overflow: hidden; border: 2px solid hsl(var(--hue) 70% 72% / .75); border-radius: 10px; background: radial-gradient(circle at 50% 45%, hsl(var(--hue) 75% 50% / .55), transparent 62%), #060817; }
.story-card-art img { width: 100%; height: 100%; object-fit: cover; }
.story-card-star { color: #fff; font-size: 3rem; text-shadow: 0 0 22px hsl(var(--hue) 90% 75%), 0 0 60px hsl(var(--hue) 90% 60%); }
.story-card-art.sized { flex: none; width: var(--art-fit, var(--art-size)); border-width: 1px; border-radius: clamp(8px, calc(var(--art-fit, var(--art-size)) * .09), 14px); }
.story-card-art.sized .story-card-star { font-size: calc(var(--art-fit, var(--art-size)) * .36); }
/* A shelf card with room grows its picture to the height of its text. */
.story-list, .stat-tile { container-type: inline-size; }
@container (min-width: 240px) { .mini-card { --art-fit: 80px; } }
.story-card-type { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 999px; background: hsl(var(--hue) 55% 30% / .75); font-size: .68rem; font-weight: 750; }
.story-card-topic { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-card-flags { display: flex; gap: 6px; flex: none; }
.story-card-flavor { color: #b9c2ea; font-size: .78rem; font-style: italic; line-height: 1.4; }
.story-card-facts { display: grid; gap: 4px; margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .16); }
.story-card-fact { display: flex; justify-content: space-between; gap: 10px; font-size: .66rem; }
.story-card-fact span:first-child { color: #98a3d4; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.story-card-fact span:last-child { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-align: right; overflow-wrap: anywhere; }
.story-card:hover, .story-card:focus-within { z-index: 5; }
.story-card-compare-button { margin: 0; padding: 2px 9px; border: 1px solid hsl(var(--hue) 70% 72% / .7); border-radius: 999px; background: hsl(var(--hue) 55% 30% / .75); color: #ffd98a; font-size: .74rem; font-weight: 800; line-height: 1.4; cursor: pointer; }
.story-card-compare-button:hover, .story-card-compare-button:focus-visible { background: hsl(var(--hue) 60% 40%); outline: none; }
.story-card-arena { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 2; gap: 7px; padding: 12px; border: 1px solid hsl(var(--hue) 70% 72% / .7); border-radius: 10px; background: #0b0f2b; box-shadow: 0 14px 30px rgba(0, 0, 0, .55); font-size: .76rem; }
.story-card-compare:hover .story-card-arena, .story-card-compare:focus-within .story-card-arena { display: grid; }
.story-card-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.story-card-actions > form { flex: 1 1 auto; min-width: 0; }
.story-card-visibility { width: 100%; margin: 0; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; background: transparent; color: #eef1ff; font-size: .74rem; font-weight: 750; line-height: 1.25; cursor: pointer; }
.story-card-visibility:hover { border-color: #ffd98a; color: #ffd98a; }
.story-delete { margin: 0; }
.story-delete > summary { list-style: none; cursor: pointer; user-select: none; margin: 0; }
.story-delete > summary::-webkit-details-marker, .story-delete > summary::marker { display: none; }
.story-delete > summary::after { display: none; content: none; }
.story-delete-cancel { display: none; }
.story-delete[open] > summary .story-delete-open { display: none; }
.story-delete[open] > summary .story-delete-cancel { display: inline; }
.story-delete-form { margin: 0; }
.story-card-delete { flex: none; --pico-accordion-close-summary-color: #d6dcf7; --pico-accordion-open-summary-color: #eef1ff; --pico-accordion-active-summary-color: #ffb3a6; }
.story-card-delete > summary.story-delete-toggle { padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; background: transparent; color: #d6dcf7; font-size: .74rem; font-weight: 700; line-height: 1.25; text-align: center; }
.story-card-delete > summary.story-delete-toggle:hover, .story-card-delete > summary.story-delete-toggle:focus-visible { border-color: #f48b78; color: #ffb3a6; }
.story-card-delete[open] { flex: 1 0 100%; display: grid; gap: 6px; padding: 8px; border: 1px solid rgba(244, 139, 120, .45); border-radius: 10px; background: rgba(217, 98, 43, .16); }
.story-card-delete[open] > summary.story-delete-toggle { margin: 0; padding: 5px 10px; border-color: rgba(255, 255, 255, .32); color: #eef1ff; }
.story-card-delete .story-delete-confirm { width: 100%; margin: 0; padding: 6px 10px; border: 1px solid #f48b78; border-radius: 999px; background: #c94b3b; color: #fff; font-size: .74rem; font-weight: 800; line-height: 1.25; cursor: pointer; }
.story-card-delete .story-delete-confirm:hover { background: #b43d2e; }
.story-card-inner form { margin: 0; }
.story-card-arena span { color: #98a3d4; font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.story-card-arena a { position: relative; color: #ffd98a; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.story-card-arena a:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  .story-card { transform: none; transition: none; }
}
.htmx-request.loading-panel, .htmx-request .loading-panel { display: block; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
:root[data-theme="dark"] body::before {
  background: radial-gradient(ellipse 32rem 70rem at 5% 0%, rgba(131, 201, 168, .08), transparent);
}
:root[data-theme="dark"] .site-nav { border-bottom-color: var(--line); }
:root[data-theme="dark"] .generator-card select,
:root[data-theme="dark"] .generator-card textarea,
:root[data-theme="dark"] .generator-card input,
:root[data-theme="dark"] .language-pill,
:root[data-theme="dark"] .audio-card,
:root[data-theme="dark"] .sentence-pairs,
:root[data-theme="dark"] .vocabulary-item,
:root[data-theme="dark"] .vocabulary-card,
:root[data-theme="dark"] .choices-card,
:root[data-theme="dark"] .scene-step,
:root[data-theme="dark"] .scene-turn,
:root[data-theme="dark"] .retry-button {
  background: #202f2a;
  color: var(--ink);
}
:root[data-theme="dark"] .admin-tools .revert-button { border-color: var(--line); color: var(--muted-ink); }
:root[data-theme="dark"] .choice-play-button { background: #202f2a; color: var(--green); }
:root[data-theme="dark"] .choice-play-button.playing { background: var(--green); color: #10201a; }
:root[data-theme="dark"] button.sentence-cell:not(:disabled):hover { background: rgba(240, 196, 119, .08); }
:root[data-theme="dark"] .sentence-pairs [data-language="original"] { background-color: rgba(0, 0, 0, .16); }
:root[data-theme="dark"] .sentence-pair.sentence-row-active { background: rgba(240, 196, 119, .06); }
:root[data-theme="dark"] button.language-toggle { color: #10201a; }
:root[data-theme="dark"] .language-toggles { background: #202f2a; }
:root[data-theme="dark"][data-hide-original] [data-language-toggle="original"],
:root[data-theme="dark"][data-hide-translation] [data-language-toggle="translation"] { background: #202f2a; color: var(--muted-ink); }
:root[data-theme="dark"] .language-toggle + .language-toggle { border-left-color: rgba(16, 32, 26, .45); }
:root[data-theme="dark"] button.sentence-cell.sentence-active { background: radial-gradient(ellipse at 35% 50%, rgba(245, 204, 126, .12), rgba(240, 196, 119, .04) 72%, transparent); box-shadow: inset 4px 0 0 var(--gold); color: #fff7e4; }
:root[data-theme="dark"] .scene-step.visited { background: var(--mint); color: var(--green-dark); }
:root[data-theme="dark"] .scene-step.current { background: var(--green); color: #10201a; }
:root[data-theme="dark"] .choice-result { background: #202f2a; }
:root[data-theme="dark"] [data-answer-look="button"] .choice-front { border-color: var(--line); background: linear-gradient(180deg, #2b3f37, #202f2a); box-shadow: 0 7px 0 #14211c, 0 14px 22px -10px rgba(0, 0, 0, .6); }
:root[data-theme="dark"] [data-answer-look="button"] label.choice-card:hover .choice-front { border-color: var(--green); box-shadow: 0 9px 0 #14211c, 0 18px 26px -12px rgba(0, 0, 0, .6); }
:root[data-theme="dark"] [data-answer-look="button"] label.choice-card:active .choice-front { box-shadow: 0 1px 0 #14211c; }
:root[data-theme="dark"] [data-answer-look="button"] .choice-card[data-correct="false"] .choice-back { box-shadow: 0 7px 0 #1a201d; }
:root[data-theme="dark"] [data-answer-look="button"] .choice-card[data-correct="false"] .choice-back { border-color: var(--line); background: #2a302d; color: #b9c2bd; }
:root[data-theme="dark"] [data-answer-look="button"] .choice-card[data-correct="false"] .choice-back .choice-card-mark { background: #3a423e; color: #b9c2bd; }
/* A button that opens as double doors: in the dark too, the card's front stays see-through so
   the result shows once the halves part, and the halves are the dark key's colours. */
:root[data-theme="dark"] [data-answer-look="button"][data-answer-reveal="double"] .choice-front,
:root[data-theme="dark"] [data-answer-look="button"][data-answer-reveal="double"] label.choice-card:hover .choice-front { background: none; border-color: transparent; }
:root[data-theme="dark"] [data-answer-look="button"] .door-leaf { background: linear-gradient(180deg, #2b3f37, #202f2a); }
:root[data-theme="dark"] [data-answer-look="button"] .door-leaf-left { box-shadow: inset 1px 1px 0 var(--line), inset 0 -1px 0 var(--line), inset -1px 0 0 rgba(160, 217, 189, .2); }
:root[data-theme="dark"] [data-answer-look="button"] .door-leaf-right { box-shadow: inset -1px 1px 0 var(--line), inset 0 -1px 0 var(--line), inset 1px 0 0 rgba(160, 217, 189, .2); }
:root[data-theme="dark"] [data-answer-look="button"][data-answer-reveal="double"] label.choice-card:hover .door-leaf { box-shadow: inset 0 0 0 1px var(--green); }
:root[data-theme="dark"] .ending-card { background: #24382f; }
:root[data-theme="dark"] .ending-continue-link, :root[data-theme="dark"] .ending-continue-link:hover { color: var(--paper); }
:root[data-theme="dark"] label.companion-option { background: #202f2a; }
:root[data-theme="dark"] label.companion-option:has(input:checked) { border-color: var(--green); background: var(--mint); }
:root[data-theme="dark"] .companion-realm, :root[data-theme="dark"] label.companion-option:has(input:checked) .companion-realm { background: #16211d; }
:root[data-theme="dark"] .scene-image { background: linear-gradient(135deg, #24382f, #393328); }
:root[data-theme="dark"] .story-error { border-color: #71453e; background: #382724; color: #ffc3b6; }
/* The charts and the vote box. */
.vote-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.vote-button, .vote-static { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-size: .95rem; }
.vote-button { cursor: pointer; }
.vote-button:hover { border-color: var(--green); }
.vote-button:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.vote-button.pressed { border-color: var(--green); background: var(--mint); color: var(--green-dark); font-weight: 800; }
.vote-count { font-variant-numeric: tabular-nums; font-weight: 700; }
.vote-sign-in { font-size: .86rem; font-weight: 700; }
.ending-vote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 16px; }
.ending-vote .vote-box { margin-top: 0; }
.ending-chart-link { font-size: .9rem; font-weight: 700; text-decoration: none; }
.ending-chart-link:hover { text-decoration: underline; }
.ending-card .xp-note + strong { display: block; margin-top: 16px; }
.xp-note { margin: 14px 0 0; color: var(--green-dark); font-size: .92rem; }
.choices-card .xp-note:not(:empty) + .continue-button { margin-top: 12px; }
.xp-note:empty { display: none; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); min-width: 0; }
.stat-label { color: var(--muted-ink); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stat-value { color: var(--ink); font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart-card { margin-bottom: 18px; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); min-width: 0; }
.chart-card .muted-copy { margin: 0 0 12px; font-size: .9rem; }
.chart-heading { margin: 4px 0 8px; color: var(--ink); font-size: 1.05rem; }
.chart-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 18px; }
.chart-columns .chart-card { margin-bottom: 0; }
.chart-columns + .site-footer { margin-top: 18px; }
.day-chart { display: block; width: 100%; height: auto; margin-bottom: 14px; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-baseline { stroke: var(--muted-ink); stroke-width: 1; }
.chart-axis { fill: var(--muted-ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--green); opacity: .12; }
.bar-up { fill: var(--vote-up); }
.bar-down { fill: var(--vote-down); }
.chart-hit { fill: transparent; }
.chart-hit:hover { fill: var(--ink); opacity: .06; }
.chart-table-wrap { overflow-x: auto; }
.chart-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.chart-table th { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--muted-ink); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.chart-table th.sorted { color: var(--green-dark); }
.chart-table th.sorted::after { content: " ▼"; }
.chart-table td { padding: 10px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.chart-table tbody tr:hover { background: var(--mint); }
.chart-table .number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-rank { color: var(--muted-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-table .mini-card { min-width: 220px; max-width: 340px; }
.chart-table-wrap:not(.compact) .mini-card { --art-fit: 80px; min-width: 280px; }
.chart-table-wrap.compact .chart-table { font-size: .84rem; }
.chart-table-wrap.compact .chart-table th,
.chart-table-wrap.compact .chart-table td { padding: 8px 6px; }
.chart-table-wrap.compact .chart-table th { font-size: .68rem; letter-spacing: .04em; white-space: normal; line-height: 1.25; }
.chart-table-wrap.compact .chart-table th:first-child,
.chart-table-wrap.compact .chart-table td:first-child { padding-left: 2px; }
.chart-table-wrap.compact .chart-table th:last-child,
.chart-table-wrap.compact .chart-table td:last-child { padding-right: 2px; }
.chart-table-wrap.compact .mini-card { --art-fit: 44px; min-width: 155px; max-width: 210px; gap: 8px; padding: 6px; }
.chart-table-wrap.compact .rating { min-width: 50px; }
.chart-table-wrap.compact .sparkline { width: 64px; height: 22px; }
.chart-hero { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.chart-hero .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.chart-hero-card { display: grid; perspective: 1400px; }
.chart-back { display: inline-block; margin: 28px 0 18px; font-weight: 700; text-decoration: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.chart-empty { padding: 12px 0; }
.rating { display: inline-flex; flex-direction: column; gap: 3px; min-width: 64px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rating-none { color: var(--muted-ink); }
.rating-bar { display: block; height: 4px; border-radius: 2px; background: var(--line); }
.rating-bar span { display: block; height: 100%; border-radius: 2px; background: var(--green); }
.change { font-size: .82rem; font-weight: 700; white-space: nowrap; }
.change-up { color: var(--vote-up); }
.change-down { color: var(--vote-down); }
.change-none { color: var(--muted-ink); }
.sparkline { display: block; width: 120px; height: 28px; overflow: visible; }
.sparkline-line { fill: none; stroke: var(--green); stroke-width: 1.5; stroke-linejoin: round; }
.page-intro { margin: 22px 0 0; }
.reader-intro { margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--muted-ink); font-size: .94rem; line-height: 1.5; }
.reader-intro strong { color: var(--ink); }
.reader-intro a { font-weight: 750; text-decoration: none; white-space: nowrap; }
.welcome-hero { padding-bottom: 12px; }
.welcome-hero > p { font-size: 1.12rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.cta-primary, .cta-secondary { display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px; border-radius: 13px; font-weight: 750; text-decoration: none; }
.cta-primary { background: var(--green); color: #fff; box-shadow: 0 8px 18px rgba(40, 99, 79, .16); }
.cta-primary:hover { background: var(--green-dark); }
.cta-secondary { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.cta-secondary:hover { border-color: var(--green); color: var(--green); }
:root[data-theme="dark"] .cta-primary { color: var(--paper); }
.ways-to-read { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.ways-label { color: var(--muted-ink); font-size: .88rem; }
.ways-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ways-list li { margin: 0; list-style: none; padding: 5px 12px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .86rem; font-weight: 700; }
.welcome-section { margin: 0 0 44px; }
.welcome-section > h2 { margin: 0 0 6px; color: var(--ink); font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.035em; }
.welcome-section > .muted-copy { margin: 0 0 18px; }
.welcome-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 18px 0 0; padding: 0; list-style: none; counter-reset: step; }
.welcome-steps li { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); counter-increment: step; }
.welcome-steps li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 12px; border-radius: 10px; background: var(--mint); color: var(--green-dark); font-weight: 800; }
.welcome-steps strong { color: var(--ink); font-size: 1.05rem; }
.welcome-steps p { margin: 6px 0 0; color: var(--muted-ink); line-height: 1.55; }
.account-benefits { margin: 0 0 22px; }
.account-benefits > .muted-copy { margin: 12px 0 0; font-size: .92rem; }
.benefit-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0; padding: 0; list-style: none; }
.benefit-list li { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.benefit-list strong { color: var(--ink); }
.benefit-list span { color: var(--muted-ink); font-size: .92rem; line-height: 1.5; }
.account-why { margin: 8px 0 14px; color: var(--ink); font-size: clamp(1.4rem, 3vw, 1.8rem); letter-spacing: -.03em; }
.field-hint { display: block; margin: -4px 0 8px; color: var(--muted-ink); font-size: .82rem; }
.welcome-back { margin: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.welcome-back h3 { margin: 0 0 12px; color: var(--ink); font-size: 1.1rem; }
.welcome-back-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.welcome-back-item { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--paper); color: var(--ink); text-decoration: none; }
a.welcome-back-item:hover { outline: 2px solid var(--green); }
.welcome-back-continue { background: var(--mint); }
.welcome-back-label { color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.welcome-back-detail { color: var(--muted-ink); font-size: .85rem; }
.ending-create { margin: 16px 0; color: var(--muted-ink); }
.ending-create p { margin: 0 0 10px; }
.ending-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.ending-continue-link { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 12px; background: var(--green); color: #fff; font-weight: 750; text-decoration: none; box-shadow: 0 6px 14px rgba(40, 99, 79, .16); }
.ending-continue-link:hover { background: var(--green-dark); color: #fff; }
.ending-new-link { font-weight: 750; text-decoration: none; }
.ending-new-link:hover { text-decoration: underline; }
.welcome-banner { margin: 22px 0 8px; padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 0 18px 48px rgba(37, 62, 50, .07); }
.welcome-title { margin: 8px 0; color: var(--ink); font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -.045em; line-height: 1.08; }
.welcome-lead { max-width: 640px; margin: 0 0 14px; color: var(--muted-ink); font-size: 1.05rem; line-height: 1.6; }
.welcome-banner .welcome-steps { gap: 12px; margin-top: 18px; }
.welcome-banner .welcome-steps li { padding: 14px 16px; background: var(--paper); }
.welcome-banner .welcome-steps li::before { width: 26px; height: 26px; margin-bottom: 8px; font-size: .85rem; }
.welcome-banner .welcome-steps p { font-size: .9rem; line-height: 1.45; }
.welcome-banner .cta-row { margin-bottom: 0; }
.cta-link { align-self: center; font-weight: 750; text-decoration: none; }
.library-more { display: inline-block; margin: -18px 0 30px; font-weight: 750; text-decoration: none; }
.library-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin: 0 0 6px; }
.library-controls .library-sort { margin: 0; }
.language-filter { display: flex; align-items: center; gap: 8px; margin: 0; }
.language-filter select { width: auto; margin: 0; padding: 6px 32px 6px 12px; border-radius: 999px; font-size: .88rem; font-weight: 700; }
.language-filter button { width: auto; margin: 0; padding: 6px 12px; border-radius: 999px; font-size: .88rem; }
.has-js .language-filter-apply { display: none; }
.library-sort { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; margin: 0 0 6px; }
.library-sort a.sort-link { margin: 0; }
.sort-label { margin-right: 4px; color: var(--muted-ink); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sort-link { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted-ink); font-size: .88rem; font-weight: 700; text-decoration: none; }
.sort-link:hover { border-color: var(--green); color: var(--green); }
.sort-link.current { border-color: var(--green); background: var(--mint); color: var(--green-dark); }
.nav-menu-button { display: none; }
@media (max-width: 680px) {
  .promise-table thead { display: none; }
  .promise-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .promise-table td { display: block; padding: 2px 0; border: 0; }
  .page-shell { width: min(100% - 24px, 1080px); }
  .site-nav { min-height: 64px; flex-wrap: wrap; gap: 0 12px; padding: 20px 0 14px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 15px; font-size: 26px; }
  .nav-links { flex: 0 1 auto; gap: 14px; flex-wrap: wrap; justify-content: flex-end; margin-left: 0; }
  .nav-account { flex-wrap: wrap; margin-left: 0; }
  .has-js .nav-menu-button { display: inline-flex; align-items: center; margin: 0 0 0 auto; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-size: .92rem; font-weight: 750; cursor: pointer; }
  .nav-menu-close, .menu-open .nav-menu-open { display: none; }
  .menu-open .nav-menu-close { display: inline; }
  .has-js .site-nav:not(.menu-open) .nav-links { display: none; }
  .has-js .menu-open .nav-links { width: 100%; flex-direction: column; align-items: stretch; gap: 0; margin-top: 12px; padding: 4px 0 12px; border-top: 1px solid var(--line); }
  .has-js .menu-open .nav-links > a { padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 1rem; }
  .has-js .menu-open .nav-links > .nav-account, .has-js .menu-open .nav-links > button { margin-top: 12px; }
  .has-js .menu-open .nav-links > .theme-toggle { align-self: flex-start; }
  .page-intro, .welcome-banner { margin-top: 18px; }
  .gallery-hero { padding: 30px 0 20px; }
  .chart-hero { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .chart-hero-card { width: min(100%, 270px); justify-self: center; }
  .stat-tile-story { grid-column: 1 / -1; }
  .welcome-lead { font-size: .98rem; }
  .ways-to-read { gap: 6px 8px; }
  .ways-list { gap: 6px; }
  .ways-list li { padding: 4px 10px; font-size: .8rem; }
  .ways-label { font-size: .82rem; }
  .welcome-steps li { display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; padding: 12px 14px; }
  .welcome-steps li::before { grid-row: span 2; margin: 0; width: 28px; height: 28px; }
  .welcome-steps p { margin-top: 2px; font-size: .9rem; }
  .cta-row { gap: 10px; }
  .cta-primary, .cta-secondary { flex: 1 1 auto; justify-content: center; }
  .story-panel { padding: 18px 14px; }
  .story-title { font-size: 1.6rem; }
  .story-title-translation { margin-bottom: 14px; font-size: 1.35rem; }
  .scene-title { font-size: 1rem; }
  .scene-image { margin: 14px 0; border-radius: 14px; }
  .audio-grid { gap: 8px; margin: 10px 0 20px; }
  .audio-card { padding: 8px 10px; }
  .audio-card p { margin-bottom: 4px; font-size: .8rem; }
  .audio-card audio { height: 40px; }
  .has-js .narration-player { gap: 4px; }
  .play-buttons { gap: 12px; }
  .play-skip { width: 44px; height: 44px; font-size: .85rem; }
  .play-button { width: 52px; height: 52px; font-size: 1.3rem; }
  .play-button .play-icon { margin-left: 4px; }
  .play-button.playing .pause-icon { font-size: 1rem; }
  .play-speed, .play-time { font-size: .85rem; }
  .page-intro { margin-bottom: 12px; }
  .gallery-hero h1 { font-size: 2.1rem; }
  .gallery-hero p { font-size: .98rem; }
  .library-sort { gap: 6px; }
  .sort-link { padding: 5px 11px; font-size: .82rem; white-space: nowrap; }
  .sort-label { white-space: nowrap; }
  .language-filter { max-width: 100%; }
  .language-filter select { max-width: 100%; }
  .card-gallery { grid-template-columns: 1fr 1fr; gap: 12px; }
  .story-card { padding: 6px; border-radius: 14px; }
  .story-card-inner { gap: 7px; padding: 8px; border-radius: 9px; }
  .story-card-kind { display: none; }
  .story-card-title { min-height: 2.4em; font-size: .82rem; }
  .story-card-star { font-size: 2rem; }
  .story-card-type { padding: 3px 7px; font-size: .6rem; }
  .story-card-flavor { font-size: .68rem; }
  .story-card-fact { font-size: .58rem; }
  .story-card-visibility, .story-card-delete > summary.story-delete-toggle, .story-card-delete .story-delete-confirm { padding: 5px 6px; font-size: .66rem; }
  .sentence-pair > * { padding: 10px 12px; font-size: .92rem; line-height: 1.5; }
  .choice-list { gap: 12px; }
  .choice-entry { gap: 8px; }
  .choice-front { padding: 14px; }
  .door-sign { font-size: .9rem; }
  .language-grid, .audio-grid, .ending-grid, .arena-grid, .account-grid, .welcome-steps, .benefit-list { grid-template-columns: minmax(0, 1fr); }
  .companion-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  label.companion-option { padding: 9px 10px; }
  .generator-card { padding: 20px; }
  .library-layout { grid-template-columns: minmax(0, 1fr); }
  .library-rail { min-height: 0; }
  .library-rail > .story-library { position: static; overflow: visible; }
  .scene-nav { grid-template-columns: 1fr 1fr; }
  .scene-steps { grid-column: 1 / -1; grid-row: 1; }
  .story-list { grid-auto-flow: column; grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-columns: 80%; margin: 0 -6px; padding: 6px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 6px; scrollbar-width: thin; }
  .story-list > * { scroll-snap-align: start; }
  .chart-columns { grid-template-columns: 1fr; }
  .chart-card { padding: 16px 14px; }
}
/* Printable bilingual picture-book view (`/story/print`). Always styled as warm cream
   storybook paper on screen (even in dark mode) and crisp paginated sheets when printed. */
.print-book-page {
  min-height: 100vh;
  background: #ede7db;
  color: #1b2a26;
}
:root[data-theme="dark"] .print-book-page {
  background: #141c19;
}
.print-book-shell {
  display: grid;
  gap: 28px;
  width: min(100% - 32px, 840px);
  margin: 0 auto;
  padding: 24px 0 56px;
}
.print-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(23, 44, 43, .08);
}
.print-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.print-back-link {
  color: var(--green);
  font-size: .92rem;
  font-weight: 750;
  text-decoration: none;
}
.print-back-link:hover { text-decoration: underline; }
.print-action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: .92rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(40, 99, 79, .18);
}
.print-action-button:hover { background: var(--green-dark); }
.print-action-button:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
:root[data-theme="dark"] .print-action-button { color: #10201a; }
.print-tip {
  margin: 0;
  color: var(--muted-ink);
  font-size: .84rem;
  line-height: 1.45;
}
.book-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(26px, 5vw, 52px);
  border: 1px solid #dfd5c2;
  border-radius: 16px;
  background: #fffdf7;
  color: #1b2a26;
  box-shadow: 0 16px 40px rgba(34, 40, 32, .10);
  min-width: 0;
}
.book-sheet :where(h1, h2, h3, p, strong) {
  color: #1b2a26;
}
.book-sheet :where(small), .book-sheet .book-muted {
  color: #546660;
}
.book-cover {
  align-items: center;
  text-align: center;
  outline: 1px solid #e6dcc8;
  outline-offset: -12px;
  padding: clamp(36px, 6vw, 64px) clamp(26px, 5vw, 56px);
}
.book-languages {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #dce6dd;
  border-radius: 999px;
  background: #eef6f0;
  color: #1f4f3f;
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .04em;
}
.book-cover-title {
  margin: 8px 0 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: clamp(2rem, 4.6vw, 3rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.02em;
  color: #162925;
}
.book-cover-subtitle {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-style: italic;
  line-height: 1.3;
  color: #4c625b;
}
.book-cover-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.book-meta-pill {
  padding: 5px 12px;
  border: 1px solid #e4dbc7;
  border-radius: 999px;
  background: #faf5e8;
  color: #4b5d56;
  font-size: .8rem;
  font-weight: 700;
}
.book-companions {
  margin: 0;
  color: #235947;
  font-size: .95rem;
  font-weight: 650;
}
.book-cover-art {
  margin: 6px auto;
  width: min(100%, 340px);
}
.book-cover-art img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 4px solid #f0e6d2;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(27, 42, 38, .12);
}
.book-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(100%, 240px);
  margin: 12px auto;
  color: #c8963e;
  font-size: 1.35rem;
}
.book-ornament::before, .book-ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #dfd4be;
}
.book-plate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid #e6dcc8;
  color: #546660;
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.book-plate-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #28634f;
  color: #ffffff;
  font-size: .85rem;
}
.book-scene-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e6dcc8;
}
.book-scene-number {
  color: #28634f;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.book-scene-title {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.2;
  color: #162925;
}
.book-scene-subtitle {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 1.08rem;
  font-style: italic;
  color: #546660;
}
.book-scene-art {
  margin: 0 auto;
  width: min(100%, 360px);
}
.book-scene-art img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 3px solid #f0e6d2;
  border-radius: 14px;
}
.book-sentences {
  border: 1px solid #e5dcc9;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}
.book-sentence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.book-sentence-row + .book-sentence-row {
  border-top: 1px solid #ece4d4;
}
.book-sentence-row > * {
  margin: 0;
  padding: 11px 16px;
  min-width: 0;
  font-size: .98rem;
  line-height: 1.62;
  overflow-wrap: break-word;
}
.book-sentence-row > * + * {
  border-left: 1px solid #ece4d4;
}
.book-sentence-heads {
  background: #eef6f0;
}
.book-sentence-heads > span {
  padding-top: 8px;
  padding-bottom: 8px;
  color: #1f4f3f;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.book-sentence-heads .fi { margin-right: .25em; }
.book-sentence-question {
  background: #fcf9f0;
  font-style: italic;
}
.book-vocab {
  padding: 16px 18px;
  border: 1px solid #e5dcc9;
  border-radius: 12px;
  background: #faf5e8;
}
.book-vocab h3 {
  margin: 0 0 10px;
  color: #204f40;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.book-vocab-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.book-vocab-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid #ebe2cf;
  border-radius: 9px;
  background: #ffffff;
  font-size: .88rem;
}
.book-vocab-item small {
  color: #61726e;
  font-size: .76rem;
}
.book-scene-folio {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #ece4d4;
  color: #6a7a75;
  font-size: .78rem;
  font-weight: 650;
}
.book-closing {
  text-align: center;
}
.book-closing-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.book-closing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  text-align: left;
}
.book-closing-card {
  padding: 20px;
  border: 1px solid #dce6dd;
  border-radius: 14px;
  background: #f4f9f5;
}
.book-closing-lesson {
  border-color: #e6dac2;
  background: #fbf6ea;
}
.book-closing-card h3 {
  margin: 0 0 10px;
  color: #204f40;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.book-closing-card p {
  margin: 0 0 10px;
  line-height: 1.6;
}
.book-closing-card p:last-child {
  margin-bottom: 0;
  color: #4c625b;
  font-style: italic;
}
.book-colophon {
  margin: 14px 0 0;
  padding-top: 16px;
  border-top: 1px solid #e6dcc8;
  color: #61726e;
  font-size: .82rem;
  font-style: italic;
}
.book-colophon-brand {
  margin: 4px 0 0;
  color: #546660;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
}
@media (max-width: 680px) {
  .print-book-shell { width: 100%; padding: 12px 12px 28px; gap: 18px; }
  .print-toolbar { padding: 12px 14px; border-radius: 14px; }
  .print-toolbar-top { flex-direction: column; align-items: stretch; }
  .print-action-button { width: 100%; justify-content: center; }
  .book-sheet { padding: 22px 14px; border-radius: 12px; gap: 16px; }
  .book-cover { outline-offset: -6px; padding: 26px 16px; }
  .book-cover-title { font-size: 1.75rem; }
  .book-cover-subtitle { font-size: 1.15rem; }
  .book-scene-title { font-size: 1.25rem; }
  .book-scene-subtitle { font-size: 1rem; }
  .book-sentence-row > * { padding: 9px 10px; font-size: .88rem; line-height: 1.5; }
  .book-vocab { padding: 14px 12px; }
  .book-vocab-list { grid-template-columns: minmax(0, 1fr); }
  .book-closing-grid { grid-template-columns: minmax(0, 1fr); }
  .book-scene-folio { flex-wrap: wrap; gap: 4px 12px; }
}
@media print {
  @page { margin: 14mm; }
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --ink: #1b2a26;
    --muted-ink: #546660;
    --paper: #ffffff;
    --card: #ffffff;
    --line: #dcd4c3;
    --green: #235947;
    --green-dark: #1b4638;
    --mint: #eef6f0;
  }
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #1b2a26 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body::before { display: none !important; }
  .no-print, .site-nav, .site-footer { display: none !important; }
  .print-book-page { min-height: 0 !important; background: #ffffff !important; }
  .print-book-shell { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; gap: 0 !important; }
  .book-sheet {
    margin: 0 !important;
    padding: 4mm 2mm !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    gap: 12px;
  }
  .book-cover {
    border: 1.5pt solid #d8ceb8 !important;
    outline: 0.75pt solid #e6dcc8 !important;
    outline-offset: -6mm !important;
    padding: 16mm 12mm !important;
    min-height: 245mm;
    justify-content: space-between;
  }
  .book-scene, .book-closing {
    break-before: page;
    page-break-before: always;
  }
  .book-scene-header,
  .book-cover-art,
  .book-scene-art,
  .book-sentence-row,
  .book-vocab,
  .book-vocab-item,
  .book-closing-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .book-cover-art { width: 88mm; }
  .book-cover-art img { max-height: 88mm; box-shadow: none; }
  .book-scene-art { width: 76mm; }
  .book-scene-art img { max-height: 76mm; }
  .book-sentence-row > * { padding: 7px 12px; font-size: 10.5pt; line-height: 1.48; }
  .book-vocab { padding: 10px 14px; }
  .book-vocab-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-closing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
