:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --ink: #2a2622;
  --muted: #7a7166;
  --line: #e2d9c8;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --mark: #fbe3a6;
  --good: #3f7d57;
  --danger: #b3261e;
  --shadow: 0 6px 24px rgba(60, 40, 20, .14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1917;
    --surface: #262320;
    --ink: #ece5d8;
    --muted: #a0968a;
    --line: #3a3530;
    --accent: #e08a5b;
    --accent-ink: #1b1917;
    --mark: #5c4a1e;
    --good: #7fc79b;
    --danger: #f2796f;
    --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
/* --room is set while a story is read: see showTurn in browser.ffi.mjs. */
.app { min-height: max(100vh, var(--room, 0px)); background: var(--bg); color: var(--ink); }
/* A theme changes the type variables, so each themed scope asks for its font
   again; otherwise it would inherit the one already worked out above it. */
.app, .card.tale { font-family: var(--sans); }
.card.tale + .card.tale { margin-top: 20px; }
.hero { display: none; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  /* Nothing may make the page scroll sideways. */
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
button { font: inherit; color: inherit; cursor: pointer; }
header {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.bar {
  max-width: 680px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
a.brand { color: inherit; text-decoration: none; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: .01em; margin-right: auto; }
.brand small { font-family: var(--sans); font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }
nav { display: flex; gap: 4px; }
nav a {
  padding: 6px 10px; border-radius: 999px; color: var(--muted); text-decoration: none;
}
nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
main { max-width: 680px; margin: 0 auto; padding: 24px 16px 96px; }
h1 { font-family: var(--serif); font-size: 28px; line-height: 1.2; margin: 0 0 4px; }
h2 { font-family: var(--serif); font-size: 20px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
}
.card + .card { margin-top: 12px; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); vertical-align: middle;
}
.meta { color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 10px 14px; color: inherit; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.small { padding: 5px 10px; font-size: 14px; }
.btn:focus-visible, .w:focus-visible, nav a:focus-visible, .choice:focus-visible, .flash:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* reader */
.story { position: relative; font-family: var(--serif); font-size: 20px; line-height: 1.7; }
.story p { margin: 0 0 1em; }
.story .picked { font-family: var(--sans); font-size: 15px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 10px; margin: 1.4em 0; scroll-margin-top: 110px; }
.w { border-radius: 4px; cursor: pointer; padding: 1px 0; }
.w:hover { background: var(--mark); }
.w.ph { border-bottom: 1px dotted var(--muted); }
.w.saved { background: var(--mark); }
.choices { display: grid; gap: 10px; margin-top: 8px; }
.choice {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 12px 14px; font-family: var(--serif); font-size: 18px;
}
.choice:hover { border-color: var(--accent); }
.choice .pl { display: block; font-family: var(--sans); font-size: 14px; color: var(--muted); margin-top: 2px; }
.prompt { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.prompt label { text-transform: none; letter-spacing: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ending { margin-top: 28px; text-align: center; }
.ending .title { font-family: var(--serif); font-size: 24px; margin: 4px 0 8px; }
.ending .row { justify-content: center; margin-top: 14px; }

/* popover */
#pop {
  position: absolute; z-index: 10; font-family: var(--sans); font-size: 16px; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 12px;
}
#pop .en { font-family: var(--serif); font-size: 18px; font-weight: 700; }
#pop .plg { margin: 2px 0 10px; }

/* vocabulary */
.word { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.word .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.word .gloss { color: var(--accent); font-weight: 600; }
.word .part { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.word .def { grid-column: 1 / -1; font-size: 15px; }
.word .lvl { grid-column: 1 / -1; }
/* Taking a word off the list. */
.bin {
  width: 36px; height: 36px; padding: 7px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); line-height: 0;
}
.bin:hover { background: var(--danger); color: #fff; }
.bin svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.word:last-child { border-bottom: 0; }
.word .en { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.word .ctx { grid-column: 1 / -1; color: var(--muted); font-size: 14px; font-style: italic; }
.lvl { font-size: 12px; color: var(--muted); }
.lvl.known { color: var(--good); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 24px; font-family: var(--serif); }
.stat span { font-size: 13px; color: var(--muted); }

/* flashcards */
.flash {
  width: 100%; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 10px; padding: 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.flash .en { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.flash .ctx { color: var(--muted); font-style: italic; }
.flash .plg { font-size: 22px; color: var(--accent); }
.flash .hint { font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px 8px; }

/* layout helpers */
.row.gap { margin-bottom: 12px; }
.row.centre { justify-content: center; margin-top: 14px; }
.notice {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 20; max-width: 648px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow);
  padding: 12px 14px;
}

.offline {
  max-width: 680px; margin: 12px auto 0; padding: 10px 16px; font-size: 14px;
  background: var(--mark); color: var(--ink); border-radius: 10px;
}
@media (max-width: 712px) { .offline { margin: 12px 16px 0; } }
/* Installed on a phone, the app draws under the status bar. */
header { padding-top: env(safe-area-inset-top); }

/* library */
.levels { margin-bottom: 12px; }
.picker { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.picker .btn { min-width: 52px; text-align: center; font-weight: 600; }
h2.section { margin: 28px 0 10px; }
.outline { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.outline:first-child { padding-top: 0; }
.outline:last-child { border-bottom: 0; padding-bottom: 0; }
.outline .en { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.outline:hover .meta { color: var(--accent); }
.btn:disabled { opacity: .6; cursor: default; }

/* the narrator at work, and its corrections */
.story .picked.typed { font-style: italic; }
/* Somebody is writing: three dots that rise in turn. */
.writing { display: flex; gap: 7px; align-items: center; height: 28px; margin: 4px 0 12px; }
.writing span { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: rise 1.1s ease-in-out infinite; }
.writing span:nth-child(2) { animation-delay: .15s; }
.writing span:nth-child(3) { animation-delay: .3s; }
@keyframes rise { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-7px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .writing span { animation: none; opacity: .7; } }
.feedback {
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; margin: 0 0 1.2em;
}
.feedback.good { border-left-color: var(--good); }
.feedback .label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.feedback .better { font-family: var(--serif); font-size: 18px; margin: 2px 0; }
.feedback .note { color: var(--muted); }
.looking { color: var(--muted); }

/* typing an answer, asking the tutor */
.typing { margin-top: 16px; }
.typing label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.typing .line { display: flex; gap: 8px; }
.typing input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.typing input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tutor .row { justify-content: space-between; flex-wrap: nowrap; align-items: flex-start; }
.tutor .typing { margin-top: 10px; }
/* The conversation with the tutor: the learner's questions on the right,
   the tutor's answers on the left, the newest at the bottom. */
.tutor .chat { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 10px -4px 0; padding: 2px 4px; overscroll-behavior: contain; }
.tutor .msg { max-width: 88%; padding: 8px 12px; border-radius: 14px; font-family: var(--sans); font-size: 15px; line-height: 1.45; }
.tutor .msg p { margin: 0 0 .5em; }
.tutor .msg p:last-child { margin-bottom: 0; }
.tutor .msg.them { align-self: flex-start; background: color-mix(in srgb, var(--ink) 7%, transparent); border-bottom-left-radius: 4px; }
.tutor .msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.tutor .msg .writing { margin: 4px 0 0; }
.tutor .quick {
  align-self: flex-end; flex: none; padding: 5px 12px; border-radius: 999px; border: 1px dashed var(--accent);
  background: none; color: var(--accent); font-family: var(--sans); font-size: 14px; text-transform: none; letter-spacing: 0;
}
.tutor .quick:disabled { opacity: .4; }
.tutor .typing { flex: none; }


/* ── translations on hover or hold ──
   The app speaks the language being learned. Text that has a translation
   carries it in `data-tip`: a mouse shows it by resting on the text, a
   finger by holding it (see installTips). */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 40;
  width: max-content; max-width: min(320px, 78vw); padding: 6px 10px; border-radius: 8px;
  background: #2a2622; color: #fffdf8; box-shadow: 0 4px 14px #0005;
  font: 400 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; font-style: normal; font-variant: normal;
  text-transform: none; letter-spacing: 0; text-align: left; white-space: normal; text-shadow: none;
  /* Not in the page at all until shown: a hidden tip near the right edge
     would still make the page wider than the screen. */
  display: none; pointer-events: none;
}
@keyframes tip { from { opacity: 0; } to { opacity: 1; } }
nav [data-tip]::after { left: auto; right: 0; }
@media (hover: hover) {
  [data-tip]:hover::after { display: block; animation: tip .15s .5s both; }
}
[data-tip].tip-on::after { display: block; }
.row.between { justify-content: space-between; margin-bottom: 16px; }
.row.between h1 { margin: 0; }
nav { align-items: center; flex-wrap: wrap; }
nav a { white-space: nowrap; }
/* The studio is wide, and so is the bar above it. */
.app:has(main.wide) .bar { max-width: 1180px; }
nav a.track { font-size: 12px; font-weight: 700; letter-spacing: .04em; border: 1px solid var(--line); padding: 4px 8px; white-space: nowrap; }

/* choosing languages */
.languages .picker { margin: 8px 0 18px; }
.languages .picker .btn { min-width: 96px; }
.languages .go { min-width: 140px; }

/* a story in the list of the learner's own */
a.card.outline { display: block; padding: 18px; border-bottom: 1px solid var(--line); margin-top: 14px; }
a.card.outline:hover { border-color: var(--accent); }
a.card.outline h2 { margin: 0; }

/* the illustration of a passage */
.art { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin: 0 0 1.2em; border-radius: 12px; background: var(--line); }

/* a word's card */
#pop .en { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
#pop .part { font-family: var(--sans); font-size: 12px; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
#pop .def { margin: 4px 0 6px; }
#pop .forms { font-size: 14px; color: var(--muted); }
#pop .example { font-size: 15px; font-style: italic; margin: 6px 0 2px; }
#pop .plg { margin: 8px 0 10px; font-weight: 600; }
#pop .reveal { display: block; margin: 8px 0 10px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 14px; text-decoration: underline dotted; text-underline-offset: 3px; }
#pop .btn { margin-top: 4px; }

/* the level, and advice about it */
button.badge.level { border: 0; cursor: pointer; }
.advice, .levelling { margin: 20px 0 0; }
.advice p { margin: 0 0 12px; }
.levelling .picker { margin-bottom: 0; }
.moves .prompt { justify-content: flex-start; }
.choice[data-tip]::after { top: calc(100% - 4px); left: 12px; }

/* words a story suggests keeping */
.suggestions { margin-top: 16px; }
.suggestions .row { justify-content: space-between; margin-bottom: 4px; }
.feedback .btn { margin-top: 8px; }
.tutor .btn.small { margin-top: 10px; }

/* The tutor: a round button that opens a sheet on a narrow screen, a panel
   beside the story on a wide one. Both are always in the page. */
.tutor .fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 15; width: 58px; height: 58px; border-radius: 50%;
  border: 0; padding: 0; background: none; box-shadow: var(--shadow);
}
/* The tutor's face, in the colours of the story's look. */
.face { display: block; width: 100%; height: 100%; }
.face .head { fill: var(--accent); }
.face .cheek { fill: #fff; opacity: .22; }
.face .eyes { fill: var(--accent-ink); transform-origin: 24px 20px; animation: blink 5.5s infinite; }
.face .smile { fill: none; stroke: var(--accent-ink); stroke-width: 2.6; stroke-linecap: round; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
/* What the tutor says when the learner has sat still for a while: see
   installIdle in browser.ffi.mjs. */
.tutor .bubble {
  display: none; position: fixed; right: 16px; bottom: 84px; z-index: 15; max-width: min(240px, 70vw);
  padding: 10px 14px; border: 0; border-radius: 16px 16px 4px 16px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); font: 600 15px/1.35 var(--sans); text-align: left; text-transform: none; letter-spacing: 0;
}
.idle .tutor:not(.open) .bubble { display: block; animation: pop .25s ease-out; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .face .eyes, .idle .tutor .bubble { animation: none; } }
.tutor .who { width: 30px; height: 30px; flex: none; }
.tutor .row b { flex: 1; align-self: center; }
.tutor .close {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 700; line-height: 1;
}
.tutor .shade { display: none; position: fixed; inset: 0; z-index: 29; background: #0007; }
.tutor .panel { display: none; }
.tutor.open .fab { display: none; }
.tutor.open .shade { display: block; }
.tutor.open .panel {
  display: block; position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 30; margin: 0;
  /* Half the screen at most: the story stays in view above it. */
  max-height: 50vh; max-height: 50dvh; display: flex; flex-direction: column; overflow: hidden;
  font-family: var(--sans); font-size: 16px;
}
@media (min-width: 1080px) {
  main.reading { max-width: 1060px; padding-right: 396px; }
  .tutor .fab, .tutor .shade, .tutor.open .shade, .tutor .close, .tutor .bubble, .idle .tutor:not(.open) .bubble { display: none; }
  .tutor .panel, .tutor.open .panel {
    display: block; position: fixed; top: 78px; bottom: auto; left: auto; right: max(16px, calc(50vw - 514px));
    width: 348px; max-height: calc(100vh - 102px); display: flex; flex-direction: column; overflow: hidden; z-index: 4; margin: 0;
  }
}

/* a paragraph, or the choices, in the learner's own language */
.tr {
  font-family: var(--sans); font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .06em; font-style: normal;
  padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--muted);
  vertical-align: middle; text-shadow: none;
}
.tr.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.story .translation {
  font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--muted);
  border-left: 3px solid var(--line); padding-left: 10px; margin: -.5em 0 1.2em;
}
.story .translation::first-letter { all: unset; }

/* a word's forms from the lexicon, on its card */
.inflections { margin: 8px 0 4px; font-family: var(--sans); font-size: 14px; }
.inflections summary { cursor: pointer; color: var(--accent); }
.inflections table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.inflections th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 2px 8px 2px 0; white-space: nowrap; }
.inflections td { font-weight: 600; padding: 2px 0; }
.inflections .credit { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* the flashcard quiz */
.flash .def { font-size: 17px; max-width: 34em; }
.quiz .part { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.quiz .ask { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 10px; }
.quiz .options, .quiz .typing, .quiz .verdict { width: 100%; max-width: 440px; }
.quiz .options { display: grid; gap: 8px; }
.app .quiz .option { text-align: center; padding: 13px 12px; font-size: 17px; text-transform: none; letter-spacing: 0; }
.quiz .option:disabled { opacity: .55; cursor: default; }
.quiz .option.right { opacity: 1; border-color: var(--good); box-shadow: inset 0 0 0 2px var(--good); }
.quiz .option.wrong { opacity: 1; border-color: var(--accent); text-decoration: line-through; }
.quiz .gap { display: inline-block; min-width: 3.5em; padding: 0 4px; border-bottom: 2px solid var(--accent); text-align: center; font-style: normal; font-weight: 700; color: var(--ink); }
.quiz .gapped { font-size: 19px; }
.quiz .typing { margin-top: 0; }
.quiz .verdict { margin-top: 6px; padding: 12px; border: 1px solid var(--accent); border-radius: 12px; }
.quiz .verdict.good { border-color: var(--good); }
.quiz .verdict .en { font-size: 18px; }
.quiz .verdict .def { font-size: 15px; color: var(--muted); margin-top: 4px; }
.quiz .row.centre { margin-top: 4px; }
.quiz .next { min-width: 160px; }

/* ── the studio ── */
main.wide { max-width: 1180px; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 16px; }
@media (min-width: 980px) { .studio { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.field { display: block; margin-top: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.triple { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.source {
  display: block; width: 100%; min-height: 420px; resize: vertical; padding: 12px; margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.55;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.source.short { min-height: 110px; font-family: inherit; font-size: 16px; }
.source:focus-visible, .field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.assistant h2 { margin-bottom: 4px; }
.assistant .row { margin-top: 10px; }
.chip { font-size: 13px; text-align: left; border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 5px 10px; color: var(--muted); }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.trouble { color: var(--accent); margin: 10px 0 0; }
.assistant .answer { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.assistant .answer p { margin: 0 0 .6em; }
button.outline { width: 100%; text-align: left; border-width: 0 0 1px; background: none; cursor: pointer; }

/* ───────────────────────────── story themes ─────────────────────────────
   A story is shown in the look named by `style:` in its file. The class is
   on the whole app while the story is open (`.app.theme-x`) and on the
   story's card in the library (`.card.theme-x`). Each theme sets the colour
   and type variables the base styles use, then restyles the pieces that
   give it its character. Themes keep their palette in dark mode. */

/* ── dusk: cream paper, ink shadows, dithered dusk colours ── */
.theme-dusk {
  --bg: #f6ecd9; --surface: #f6ecd9; --ink: #1a1433; --muted: #5d5470; --line: #1a1433;
  --accent: #c8475c; --accent-ink: #f6ecd9; --mark: #f8cf7a; --good: #2f6b4a;
  --shadow: 5px 5px 0 #1a1433;
  --serif: "Newsreader", Georgia, serif; --sans: "Space Mono", ui-monospace, monospace;
}
.app.theme-dusk header { border-bottom: 2px solid var(--ink); }
.theme-dusk .brand { font-style: italic; }
.app.theme-dusk nav a { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; border-radius: 0; padding: 6px 7px; }
.app.theme-dusk nav a[aria-current="page"] { background: none; box-shadow: inset 0 -3px 0 var(--accent); }
.theme-dusk .hero {
  display: block; height: 132px; margin-bottom: 22px; image-rendering: pixelated;
  background: #7a2e6b var(--dither-dusk, linear-gradient(#1a1433, #c8475c, #f8cf7a)) left top / auto 100% repeat-x;
  border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
}
.theme-dusk .badge { font-family: var(--sans); border-radius: 0; background: var(--ink); color: var(--bg); }
.theme-dusk .sub, .theme-dusk .meta { font-family: var(--sans); font-size: 13px; }
.theme-dusk .btn {
  font-family: var(--sans); font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
  background: var(--bg); border: 2px solid var(--ink); border-radius: 0; box-shadow: 3px 3px 0 var(--accent);
}
.theme-dusk .btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.theme-dusk .btn:active:not(:disabled), .theme-dusk .choice:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--accent); }
.theme-dusk .w.ph { border-bottom: 2px dotted var(--accent); }
.theme-dusk .w.saved { box-shadow: 0 0 0 2px var(--mark); }
.theme-dusk #pop { border: 2px solid var(--ink); border-radius: 0; font-family: var(--serif); }
.theme-dusk #pop .plg { font-style: italic; }
.theme-dusk .prompt { font-family: var(--sans); font-size: 12px; justify-content: flex-start; flex-wrap: nowrap; }
.theme-dusk .prompt::after {
  content: ""; order: 1; flex: 1; min-width: 24px; height: 16px; image-rendering: pixelated;
  background: var(--dither-strip, var(--accent)) left top / 192px 16px repeat-x;
}
.theme-dusk .prompt label { order: 2; font-size: 12px; white-space: nowrap; }
.theme-dusk .choice {
  border: 2px solid var(--ink); border-radius: 0; box-shadow: 4px 4px 0 var(--accent); image-rendering: pixelated;
  background: var(--bg) var(--dither-fade, none) right top / 96px 16px repeat-y;
  transition: transform .06s, box-shadow .06s;
}
.theme-dusk .choice:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--accent); border-color: var(--ink); }
.theme-dusk .choice .pl { font-size: 12px; }
.theme-dusk .story .picked { font-size: 13px; }
.theme-dusk .feedback { border: 2px solid var(--ink); border-left-width: 8px; border-radius: 0; font-family: var(--serif); font-size: 16px; }
.theme-dusk .feedback.good { border-color: var(--ink); border-left-color: var(--good); }
.theme-dusk .feedback .label { font-family: var(--sans); }
.theme-dusk .typing input { border: 2px solid var(--ink); border-radius: 0; font-family: var(--serif); background: #fffaf0; }
.theme-dusk .typing label { font-size: 12px; }
.theme-dusk .card { border: 2px solid var(--ink); border-radius: 0; box-shadow: 6px 6px 0 var(--ink); }
.card.theme-dusk { border: 2px solid var(--ink); border-radius: 0; box-shadow: 6px 6px 0 var(--ink); }
.card.tale .hero { height: 54px; margin: -18px -18px 14px; border-width: 0 0 2px; box-shadow: none; }

/* ── pixel: a small adventure game ── */
.theme-pixel {
  --bg: #141b3a; --surface: #1d2b53; --ink: #f4f4f4; --muted: #94b0c2; --line: #000;
  --accent: #ffcd75; --accent-ink: #141b3a; --mark: #ffcd75; --good: #38b764;
  --shadow: 6px 10px 0 #0006;
  --serif: "Pixelify Sans", "Space Mono", ui-monospace, monospace; --sans: "Pixelify Sans", "Space Mono", ui-monospace, monospace;
  --px: 0 -4px 0 #000, 0 4px 0 #000, -4px 0 0 #000, 4px 0 0 #000;
}
.app.theme-pixel header { border-bottom: 4px solid #000; }
.theme-pixel .brand { color: var(--accent); text-shadow: 2px 2px 0 #000; }
.app.theme-pixel nav a { border-radius: 0; font-size: 16px; }
.app.theme-pixel nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.theme-pixel .hero {
  display: block; height: 132px; margin: 4px 4px 22px; image-rendering: pixelated; box-shadow: var(--px);
  background: #1d2b53 var(--dither-night, linear-gradient(#0f1028, #3b5dc9, #73eff7)) left top / auto 100% repeat-x;
}
.theme-pixel h1, .theme-pixel h2 { text-shadow: 2px 2px 0 #000; }
.theme-pixel .badge { border-radius: 0; background: var(--good); color: #fff; box-shadow: 0 -2px 0 #000, 0 2px 0 #000, -2px 0 0 #000, 2px 0 0 #000; text-shadow: none; }
.theme-pixel .sub { color: #41a6f6; }
/* The story sits in a dialogue box. A plain monospace keeps a long passage
   easier on the eyes than the pixel face would. */
.theme-pixel .story {
  margin: 4px; padding: 16px 16px 4px; background: #f4e8c8; color: #2b1d3a;
  font-family: "Space Mono", ui-monospace, monospace; font-size: 17px; line-height: 1.65;
  box-shadow: var(--px), inset 0 0 0 3px #fff8, inset 0 -6px 0 #0001;
  --ink: #2b1d3a; --muted: #6d5a6e; --surface: #fff; --line: #2b1d3a;
}
.theme-pixel .story .picked { font-family: "Pixelify Sans", monospace; font-size: 17px; color: #5d275d; border-left: 4px solid #b13e53; }
.theme-pixel .w.ph { border-bottom: 2px dashed #b13e53; }
.theme-pixel .w, .theme-pixel .w:hover { border-radius: 0; }
.theme-pixel #pop { background: #fff; color: #2b1d3a; border: 0; border-radius: 0; box-shadow: var(--px), 6px 10px 0 #0006; font-family: "Pixelify Sans", monospace; }
.theme-pixel #pop .plg { color: #3b5dc9; }
.theme-pixel .btn {
  border: 0; border-radius: 0; background: #29366f; color: #f4f4f4; font-size: 16px; padding: 8px 14px 10px; margin: 3px;
  box-shadow: 0 -3px 0 #000, 0 3px 0 #000, -3px 0 0 #000, 3px 0 0 #000, inset 0 -4px 0 #1d2b53;
}
.theme-pixel .btn.primary { background: var(--good); color: #fff; font-weight: 600; box-shadow: 0 -3px 0 #000, 0 3px 0 #000, -3px 0 0 #000, 3px 0 0 #000, inset 0 -4px 0 #257179; }
.theme-pixel .btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 -3px 0 #000, 0 3px 0 #000, -3px 0 0 #000, 3px 0 0 #000; }
.theme-pixel .prompt { color: var(--accent); font-size: 16px; text-transform: none; letter-spacing: 0; margin: 26px 4px 12px; }
.theme-pixel .prompt span::before { content: "▸ "; }
.theme-pixel .prompt label { color: var(--muted); }
.theme-pixel .choices { gap: 0; margin: 4px; padding: 6px; background: #000; box-shadow: 0 -4px 0 #fff, 0 4px 0 #fff, -4px 0 0 #fff, 4px 0 0 #fff; }
.theme-pixel .choice { position: relative; background: none; border: 0; border-radius: 0; color: #f4f4f4; font-size: 18px; padding: 9px 8px 9px 30px; }
.theme-pixel .choice:hover, .theme-pixel .choice:focus-visible { background: #1d2b53; outline: 0; }
.theme-pixel .choice:hover::before, .theme-pixel .choice:focus-visible::before { content: "▶"; position: absolute; left: 9px; color: var(--accent); animation: bob .5s steps(2) infinite; }
.theme-pixel .choice:active { background: #3b5dc9; }
.theme-pixel .choice .pl { color: #94b0c2; font-size: 15px; }
@keyframes bob { 50% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .theme-pixel .choice::before { animation: none !important; } }
.theme-pixel .feedback { background: #fff; border: 0; border-radius: 0; box-shadow: 0 -3px 0 #2b1d3a, 0 3px 0 #2b1d3a, -3px 0 0 #2b1d3a, 3px 0 0 #2b1d3a, inset 6px 0 0 #b13e53; padding-left: 18px; margin: 4px 3px 1.4em; font-family: "Space Mono", monospace; font-size: 14px; }
.theme-pixel .feedback.good { box-shadow: 0 -3px 0 #2b1d3a, 0 3px 0 #2b1d3a, -3px 0 0 #2b1d3a, 3px 0 0 #2b1d3a, inset 6px 0 0 #38b764; }
.theme-pixel .feedback .note { color: #4a3b52; }
.theme-pixel .feedback .better { font-family: "Space Mono", monospace; font-size: 16px; font-weight: 700; }
.theme-pixel .writing span { border-radius: 0; background: #b13e53; animation-timing-function: steps(2); }
.theme-pixel .typing { margin: 20px 4px 0; }
.theme-pixel .typing input { background: #000; color: #f4f4f4; border: 0; border-radius: 0; margin: 3px; box-shadow: 0 -3px 0 #fff, 0 3px 0 #fff, -3px 0 0 #fff, 3px 0 0 #fff; font-family: "Space Mono", monospace; font-size: 16px; }
.theme-pixel .typing input::placeholder { color: #566c86; }
.theme-pixel .card { margin-left: 4px; margin-right: 4px; border: 0; border-radius: 0; box-shadow: var(--px); }
.card.theme-pixel { border: 0; border-radius: 0; background: var(--bg); color: var(--ink); box-shadow: var(--px); margin: 16px 4px; }
.card.theme-pixel .hero { margin: -18px -18px 14px; border-bottom: 4px solid #000; box-shadow: none; }

/* ── chunky: bright, rounded, buttons that press ── */
.theme-chunky {
  --bg: #fff; --surface: #fff; --ink: #3c3c3c; --muted: #777; --line: #e5e5e5;
  --accent: #58cc02; --accent-ink: #fff; --mark: #fff3bf; --good: #46a302;
  --shadow: 0 6px 0 #0000000d;
  --serif: "Nunito", system-ui, sans-serif; --sans: "Nunito", system-ui, sans-serif;
  font-weight: 600;
}
.app.theme-chunky header { border-bottom: 2px solid var(--line); }
.theme-chunky .brand { font-weight: 900; color: var(--accent); letter-spacing: -.02em; }
.app.theme-chunky nav a { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 12px; border: 2px solid transparent; color: #999; }
.app.theme-chunky nav a[aria-current="page"] { background: #ddf4ff; border-color: #84d8ff; color: #1899d6; box-shadow: none; }
.theme-chunky h1, .theme-chunky h2 { font-weight: 900; }
.theme-chunky .badge { background: #ffd43b; color: #7a5200; border-radius: 8px; border-bottom: 3px solid #e6a800; font-weight: 900; }
/* A small mascot with a tip, in place of the tip above the story. */
.theme-chunky .hero {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 16px;
  border-radius: 18px; background: linear-gradient(#bfe9ff, #e9f8ff);
}
.theme-chunky .hero::before {
  content: ""; flex: none; width: 58px; height: 54px; border-radius: 50% 50% 46% 46%;
  border: 3px solid #3c3c3c;
  background:
    radial-gradient(circle at 34% 44%, #3c3c3c 0 4px, #0000 4.5px),
    radial-gradient(circle at 66% 44%, #3c3c3c 0 4px, #0000 4.5px),
    radial-gradient(circle at 22% 64%, #ffb3b3 0 5px, #0000 5.5px),
    radial-gradient(circle at 78% 64%, #ffb3b3 0 5px, #0000 5.5px),
    radial-gradient(ellipse 9px 6px at 50% 66%, #3c3c3c 0 99%, #0000 100%),
    #58cc02;
}
.theme-chunky .hero::after {
  content: attr(data-say); padding: 9px 12px; font-size: 15px; font-weight: 800;
  background: #fff; border: 2px solid var(--line); border-radius: 14px;
}
.app.theme-chunky .sub { display: none; }
.app.theme-chunky .row.title { margin-bottom: 12px; }
.theme-chunky .story { font-weight: 600; font-size: 19px; }
.theme-chunky .w { border-radius: 6px; }
.theme-chunky .w:hover { background: #ddf4ff; }
.theme-chunky .w.ph { border-bottom: 2px dashed #bbb; border-radius: 0; }
.theme-chunky .w.saved { background: var(--mark); box-shadow: inset 0 -3px 0 #ffd43b; }
.theme-chunky #pop { border: 2px solid var(--line); border-radius: 16px; }
.theme-chunky #pop .en { font-weight: 900; color: #1899d6; }
.theme-chunky #pop .btn { width: 100%; }
.theme-chunky .btn {
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; color: #777;
  font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; transition: transform .05s;
}
.theme-chunky .btn.primary { background: var(--accent); color: #fff; border: 0; box-shadow: 0 4px 0 #46a302; margin-bottom: 4px; }
.theme-chunky .btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.theme-chunky .btn.primary:active:not(:disabled) { transform: translateY(4px); box-shadow: none; margin-bottom: 4px; }
.theme-chunky .prompt { color: var(--ink); font-size: 18px; font-weight: 900; text-transform: none; letter-spacing: 0; }
.theme-chunky .prompt label { font-weight: 600; color: var(--muted); }
.theme-chunky .choice {
  position: relative; border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px;
  padding: 11px 12px 11px 52px; font-size: 18px; font-weight: 800; transition: transform .05s;
}
.theme-chunky .choice::before {
  content: attr(data-n); position: absolute; left: 12px; top: 50%; margin-top: -14px; width: 28px; height: 28px;
  line-height: 24px; text-align: center; border: 2px solid var(--line); border-radius: 8px; color: #999; font-size: 14px;
}
.theme-chunky .choice:hover { background: #ddf4ff; border-color: #84d8ff; color: #1899d6; }
.theme-chunky .choice:hover::before { border-color: #84d8ff; color: #1899d6; }
.theme-chunky .choice:active { transform: translateY(3px); border-bottom-width: 2px; margin-bottom: 3px; }
.theme-chunky .choice .pl { font-weight: 600; color: var(--muted); }
.theme-chunky .story .picked { border-left: 0; padding: 8px 12px; background: #f1f1f1; border-radius: 12px; font-weight: 800; color: #666; display: table; }
.theme-chunky .feedback { border: 2px solid #ffd43b; background: #fffbe6; border-radius: 16px; }
.theme-chunky .feedback.good { border-color: #b8f28b; background: #f1ffe5; }
.theme-chunky .feedback .label { font-weight: 900; color: #a47200; }
.theme-chunky .feedback.good .label { color: var(--good); }
.theme-chunky .feedback .better { font-weight: 800; }
.theme-chunky .typing input { border: 2px solid var(--line); border-radius: 14px; background: #f7f7f7; font-weight: 600; }
.theme-chunky .card { border-width: 2px; border-bottom-width: 5px; border-radius: 20px; }
.card.theme-chunky { border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 20px; background: var(--surface); color: var(--ink); }
.card.theme-chunky .hero { display: none; }

/* ── storybook: a leather-bound book ── */
.theme-storybook {
  --bg: #4a2c19; --surface: #fffaf0; --ink: #3a2a1c; --muted: #76644c; --line: #b9a67d;
  --accent: #a3272b; --accent-ink: #fbf3df; --mark: #ffe45c99; --good: #3d6b3a;
  --shadow: 2px 10px 14px -6px #0009;
  --serif: "Fraunces", Georgia, serif; --sans: "Fraunces", Georgia, serif;
}
.app.theme-storybook {
  background:
    repeating-linear-gradient(92deg, #0000 0 7px, #0000000f 7px 8px),
    linear-gradient(100deg, #3b2416, #5a3722 12%, #6b4227 60%, #4a2c19);
}
.app.theme-storybook header { background: #3b2416; border-bottom: 1px solid #2a180d; box-shadow: 0 1px 0 #ffffff1f; }
.app.theme-storybook .brand { color: #f3e8cd; font-style: italic; }
.app.theme-storybook .brand small { color: #c9b88f; font-family: var(--serif); }
.app.theme-storybook nav a { color: #d9c8a3; font-variant: small-caps; letter-spacing: .08em; }
.app.theme-storybook nav a[aria-current="page"] { background: none; box-shadow: none; color: #ffd98a; text-decoration: underline; text-underline-offset: 5px; }
.app.theme-storybook main { padding-top: 22px; }
.app.theme-storybook .page {
  position: relative; padding: 26px 26px 34px 30px; border-radius: 3px 10px 10px 3px;
  background: linear-gradient(90deg, #d9c8a3 0, #f3e8cd 14px, #fbf3df 44px, #f6ecd4 100%);
  box-shadow: inset 0 0 28px #b9965a55, -1px 0 0 #cdb98e, -3px 0 0 #f3e8cd, -4px 0 0 #cdb98e, -6px 0 0 #f3e8cd, -7px 0 0 #bda77a, 0 2px 6px #0007, 0 18px 30px -12px #000b;
}
.app.theme-storybook .page::before {
  content: ""; position: absolute; top: -10px; right: 34px; width: 24px; height: 104px; z-index: 2;
  background: linear-gradient(90deg, #7d1b1f, #a3272b 30%, #c2383c 55%, #8e2125);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 88%, 0 100%); filter: drop-shadow(1px 3px 2px #0006);
}
.theme-storybook .hero { display: block; text-align: center; color: var(--accent); font-size: 26px; line-height: 1; margin: 2px 0 10px; }
.theme-storybook .hero::before { content: "❦"; }
.app.theme-storybook .row.title { justify-content: center; padding: 0 44px; }
.theme-storybook h1, .theme-storybook h2 { font-style: italic; font-weight: 600; text-shadow: 0 1px 0 #fffc; }
.app.theme-storybook h1 { text-align: center; }
.app.theme-storybook .sub { text-align: center; font-variant: small-caps; letter-spacing: .1em; font-size: 14px; }
/* The level is a wax seal. */
.theme-storybook .badge {
  width: 44px; height: 44px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; transform: rotate(-12deg);
  color: #f7d9d0; font-size: 14px; text-shadow: 0 -1px 0 #5a0f12;
  background: radial-gradient(circle at 35% 30%, #d9575b, #a3272b 45%, #6f1518 100%);
  box-shadow: inset 0 0 0 4px #8a1d21, inset 0 0 0 5px #c9474b, inset 0 2px 3px 5px #0003, 0 2px 3px #0007;
}
.theme-storybook .story { font-size: 19px; }
.app.theme-storybook .story > p:first-of-type::first-letter { float: left; font-size: 3.1em; line-height: .8; padding: 6px 7px 0 0; color: var(--accent); font-weight: 700; font-style: italic; }
.theme-storybook .w:hover { background: #f4dd7a88; }
.theme-storybook .w.ph { border-bottom: 0; text-decoration: underline wavy #8a7a5c; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.theme-storybook .w.saved { background: linear-gradient(178deg, #0000 12%, #ffe45cbb 14% 86%, #0000 88%); border-radius: 2px 6px 3px 5px; }
/* Translations come on a sticky note. */
.theme-storybook #pop {
  background: linear-gradient(#ffef9c, #ffe270); border: 0; border-radius: 1px; padding: 18px 14px 14px; transform: rotate(-1.4deg);
  font-family: "Caveat", "Segoe Print", cursive; font-size: 23px; line-height: 1.15; box-shadow: 0 1px 1px #0003, 2px 10px 14px -6px #0009;
}
.theme-storybook #pop::before { content: ""; position: absolute; top: -9px; left: 50%; width: 64px; height: 18px; margin-left: -32px; transform: rotate(2deg); background: #ffffff8c; box-shadow: 0 1px 2px #0003; }
.theme-storybook #pop .en { font-family: "Caveat", cursive; font-size: 26px; }
.theme-storybook #pop .plg { color: #7a2d1a; }
.theme-storybook .btn {
  font-family: var(--serif); font-size: 15px; font-variant: small-caps; letter-spacing: .08em; font-weight: 700; border-radius: 6px;
  color: #f0dcc0; border: 1px solid #2a160a; text-shadow: 0 -1px 0 #0008;
  background: linear-gradient(#7a4a2c, #5a341e 55%, #452613); box-shadow: inset 0 1px 0 #ffffff3d, inset 0 -2px 3px #0005, 0 2px 3px #0006;
}
.theme-storybook .btn.primary {
  color: #3b2606; border-color: #6e4f1c; text-shadow: 0 1px 0 #ffe9b0;
  background: linear-gradient(#f1d089, #b8893b 55%, #9a6f2a); box-shadow: inset 0 1px 0 #fff8, inset 0 -2px 3px #0003, 0 2px 3px #0006;
}
.theme-storybook .btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 4px #0007; }
.theme-storybook .prompt { justify-content: center; text-align: center; font-variant: small-caps; text-transform: none; letter-spacing: .12em; font-size: 15px; flex-direction: column; gap: 4px; }
.theme-storybook .prompt span::before, .theme-storybook .prompt span::after { content: " ❦ "; color: var(--accent); }
.theme-storybook .prompt label { letter-spacing: 0; font-variant: normal; font-style: italic; }
/* Choices are luggage tags. */
.theme-storybook .choices { gap: 14px; }
.theme-storybook .choice {
  position: relative; border: 0; border-radius: 4px; padding: 12px 14px 12px 40px; color: var(--ink);
  background: radial-gradient(circle at 18px 50%, #5a3722 0 5px, #c9b88f 5px 6.5px, #0000 7px), linear-gradient(#fffaf0, #f1e4c6);
  outline: 1px dashed #b29b6c; outline-offset: -5px; box-shadow: 0 1px 0 #fff inset, 0 1px 2px #0005, 0 6px 10px -6px #0008;
  transition: transform .1s, box-shadow .1s;
}
.theme-storybook .choice:nth-child(odd) { transform: rotate(-.4deg); }
.theme-storybook .choice:nth-child(even) { transform: rotate(.35deg); }
.theme-storybook .choice:hover { transform: translateY(-2px) rotate(0); box-shadow: 0 1px 0 #fff inset, 0 2px 3px #0005, 0 12px 14px -8px #0009; }
.theme-storybook .choice:active { transform: translateY(1px); box-shadow: 0 1px 0 #fff inset, 0 1px 1px #0006; }
.theme-storybook .choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-storybook .choice .pl { font-style: italic; }
.theme-storybook .story .picked { font-style: italic; border-left: 0; padding-left: 0; text-align: center; color: var(--muted); }
.theme-storybook .story .picked::before { content: "— "; }
.theme-storybook .story .picked::after { content: " —"; }
/* Corrections are written on an index card. */
.theme-storybook .feedback {
  border: 0; border-radius: 3px; padding: 12px 14px 12px 40px; font-family: var(--serif);
  background: linear-gradient(90deg, #0000 28px, #e2777a 28px 29px, #0000 29px), repeating-linear-gradient(#0000 0 25px, #9cc3e055 25px 26px), linear-gradient(#fffdf6, #f6efdd);
  box-shadow: 0 1px 2px #0005, 0 8px 12px -8px #0008; transform: rotate(-.3deg);
}
.theme-storybook .feedback .label { font-variant: small-caps; text-transform: none; letter-spacing: .1em; font-size: 13px; }
.theme-storybook .feedback .better { font-family: "Caveat", cursive; font-size: 25px; line-height: 1.2; color: #1d4e89; }
.theme-storybook .typing input { background: #fffaf0; border: 1px solid var(--line); border-radius: 4px; font-family: var(--serif); font-style: italic; box-shadow: inset 0 1px 3px #0002; }
.theme-storybook .typing label { font-style: italic; }
.theme-storybook .card { border-radius: 4px; box-shadow: 0 1px 2px #0004, 0 8px 12px -8px #0007; }
.card.theme-storybook {
  position: relative; border: 0; border-left: 10px solid #5a3722; border-radius: 4px 10px 10px 4px; color: var(--ink);
  background: linear-gradient(90deg, #e6d6b2 0, #fbf3df 26px, #f6ecd4 100%);
  box-shadow: inset 0 0 22px #b9965a44, 0 1px 2px #0005, 0 10px 16px -10px #0009;
}
.card.theme-storybook .hero { display: none; }

/* ── the newer pieces, per theme ── */
.theme-dusk .art { border: 2px solid var(--ink); border-radius: 0; box-shadow: 6px 6px 0 var(--ink); }
.theme-dusk button.badge.level { box-shadow: 3px 3px 0 var(--accent); }
.theme-dusk .writing span { border-radius: 0; }
.theme-pixel .art { border-radius: 0; box-shadow: var(--px); image-rendering: pixelated; margin: 4px 0 1.4em; }
.theme-pixel #pop .part, .theme-pixel #pop .forms { color: #6d5a6e; }
.theme-pixel #pop .reveal { color: #3b5dc9; }
.theme-chunky .art { border-radius: 18px; }
.theme-chunky #pop .reveal { color: #1899d6; font-weight: 800; }
.theme-chunky .writing span { width: 11px; height: 11px; }
.theme-storybook .art { border-radius: 3px; border: 6px solid #fffaf0; box-shadow: 0 1px 3px #0006, 0 8px 12px -8px #0008; transform: rotate(-.4deg); }
.theme-storybook #pop .def, .theme-storybook #pop .forms, .theme-storybook #pop .example { font-family: var(--serif); font-size: 15px; }
.theme-storybook #pop .reveal { color: #7a2d1a; font-family: var(--serif); }
.theme-storybook .badge.level { border: 0; }
.app.theme-storybook .flash { background: repeating-linear-gradient(#0000 0 27px, #9cc3e066 27px 28px), linear-gradient(#fffdf6, #f6efdd); border: 0; border-radius: 4px; box-shadow: inset 0 28px 0 -27px #e2777a, 0 1px 2px #0005, 0 10px 16px -8px #0008; }
.app.theme-storybook .stat { background: #fffaf0; }
