/* 英語ゲーム — bright, playful, legible Japanese. */
:root {
  /* The Robin of Loxley kit (static/rol/tokens.css, linked first) owns the
     colours, type and shapes; these names are the ones this stylesheet has
     always used, pointed at it. One accent, raspberry, from data-rol-app on
     <html>; the kit swaps every value for dark mode itself. */
  --bg: var(--rol-parchment); --card: var(--rol-linen); --ink: var(--rol-ink); --muted: var(--rol-ink-soft);
  --line: var(--rol-line-strong); --hair: var(--rol-line);
  --pink: var(--rol-accent); --pink-deep: var(--rol-accent-hover); --on-pink: var(--rol-on-accent); --pink-soft: var(--rol-accent-soft);
  --sun: var(--rol-gold); --sky: var(--rol-accent); --leaf: var(--rol-lincoln); --grape: var(--rol-ink-soft); --fire: var(--rol-scarlet);
  --ok: var(--rol-lincoln); --ok-soft: var(--rol-moss); --on-ok: var(--rol-on-accent);
  --bad: var(--rol-scarlet); --bad-soft: var(--rol-scarlet-soft); --on-bad: var(--rol-on-scarlet);
  --warn: var(--rol-yew); --warn-soft: color-mix(in oklab, var(--rol-straw) 60%, var(--rol-linen));
  --r: var(--rol-radius); --r-lg: var(--rol-radius-lg);
  --shadow: none;
  --latin: "Hanken Grotesk", "Helvetica Neue", Arial;
  --display: "Gloock", Georgia, "Times New Roman";
  --ja: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Source Han Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --zh: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  /* under Gloock, which has no CJK: the serif that matches it */
  --ja-serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --zh-serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", serif;
  --cjk-serif: var(--ja-serif);
  --jp: var(--ja);
  --en: var(--latin), var(--ja), sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--rol-straw); color: var(--ink); }
:focus-visible { outline: var(--rol-focus); outline-offset: 2px; }
/* Han characters are shared by Chinese and Japanese but drawn differently
   (難, 評, 判), so which font draws them is decided by language, never by
   the pack's code, in three layers, all at zero specificity (:where) so an
   element's own rule still wins:
   1. The page's own text is in its interface language: <html lang>, or any
      element marked lang="ja"/"zh", gets that language's font. Pages in a
      Latin-script interface fall back to the target's (a Chinese word quoted
      in an English grammar note).
   2. The text being studied is drawn with --jp and --en: <body data-target>
      sets both for the target language, whatever the interface is. A
      Latin-script target (Italian, German, English...) is Latin-first, so
      its words are Hanken Grotesk, with the interface's CJK font behind it
      for a Japanese or Chinese gloss. A Japanese or Chinese target is
      CJK-first in its own glyphs (Japanese taught in Chinese keeps Japanese
      kanji; Chinese taught in Japanese keeps Chinese hanzi).
   3. An element marked with its own lang sets both again for itself and
      what it contains (a Chinese translation inside a Japanese story).
   A custom property is resolved where it is declared, so each layer
   declares --jp and --en itself rather than deriving one from the other. */
:where(body) { font-family: var(--latin), var(--jp); }
:where(body[data-target]) { --jp: var(--latin), var(--ja), sans-serif; --en: var(--latin), var(--ja), sans-serif; }
:where(:root:lang(zh) > body[data-target]) { --jp: var(--latin), var(--zh), sans-serif; --en: var(--latin), var(--zh), sans-serif; }
:where([data-target|="ja"], [lang|="ja"]) { --jp: var(--ja); --en: var(--latin), var(--ja), sans-serif; --cjk-serif: var(--ja-serif); }
:where([data-target|="zh"], [lang|="zh"]) { --jp: var(--zh); --en: var(--latin), var(--zh), sans-serif; --cjk-serif: var(--zh-serif); }
:where(:lang(ja)) { font-family: var(--latin), var(--ja); }
:where(:lang(zh)) { font-family: var(--latin), var(--zh); }
a { color: var(--pink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
main { width: 100%; max-width: calc(var(--rol-container) + 2 * var(--rol-gutter)); margin: 0 auto; padding: var(--rol-space-6) var(--rol-gutter) var(--rol-space-8); }
/* the header: the kit's rol-header; the course beside the wordmark, then the nav row under it */
.top .pack-name { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 600; padding-left: var(--rol-space-4); border-left: 1px solid var(--line); white-space: nowrap; }
.top .pack-name:hover { text-decoration: none; color: var(--pink); }
.top .rol-header__actions { margin-left: auto; }
.short-label { display: none; }
/* a phone: the course shows as its flag, and under 420px the wordmark and the
   header's button give up a little room, so the header never wraps */
@media (max-width: 520px) {
  .top .pack-name { padding-left: var(--rol-space-3); }
  .top .pack-name span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 420px) {
  .top .rol-header__inner, .top .rol-header__actions { gap: var(--rol-space-2); }
  .top .rol-header__brand { font-size: 1.2rem; gap: 8px; }
  .top .rol-header__brand img { width: 24px; height: 24px; }
  .top .rol-header__actions .rol-btn { padding: 0 12px; }
  .top .ui-switch summary { padding: 0 .4rem; }
  .long-label { display: none; }
  .short-label { display: inline; }
}
.app-nav { border-bottom: 1px solid var(--hair); background: var(--bg); }
.app-nav__inner { display: flex; align-items: center; gap: var(--rol-space-4); overflow-x: auto; scrollbar-width: none; min-height: 48px; }
.app-nav__inner::-webkit-scrollbar { display: none; }
.app-nav a, .app-nav .linklike { color: var(--muted); font-weight: 500; font-size: .9375rem; white-space: nowrap; padding: 12px 0; }
.app-nav a:hover, .app-nav .linklike:hover { color: var(--ink); text-decoration: none; }
.app-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--pink); }
.app-nav form { margin-left: auto; }
span.nav-rest { display: contents; }
/* below a wide screen the row keeps the first few links and tucks the rest under More */
.app-nav { position: relative; }
.nav-more { display: none; margin-left: auto; }
.nav-more summary { list-style: none; cursor: pointer; color: var(--ink); font-weight: 600; font-size: .9375rem; white-space: nowrap; padding: 12px 0; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more__menu { position: absolute; right: var(--rol-gutter); top: 100%; z-index: 20; display: flex; flex-direction: column; min-width: 12rem; padding: .4rem 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--rol-shadow); }
.nav-more__menu a, .nav-more__menu .linklike { padding: .6rem 1rem; color: var(--ink); text-align: left; }
.nav-more__menu a:hover { background: var(--pink-soft); }
.nav-more__menu form { margin: 0; border-top: 1px solid var(--hair); }
@media (max-width: 1299px) {
  .nav-rest { display: none !important; }
  .nav-more { display: block; }
}
.nav-more__menu .nav-narrow { display: none; }
@media (max-width: 600px) {
  .app-nav__inner > .nav-wide { display: none; }
  .nav-more__menu .nav-narrow { display: block; }
}
.flag { display: inline-block; vertical-align: middle; border-radius: 2px; box-shadow: 0 0 0 1px var(--hair); object-fit: cover; }
.icon { display: inline-block; vertical-align: -.2em; flex: none; }
.display { font-family: var(--display), var(--cjk-serif); font-weight: 400; letter-spacing: -.01em; line-height: var(--rol-leading-display); text-wrap: balance; }
/* A CEFR level: a moss tag, the same for every level. The letters say which. */
.level-chip, .lv { display: inline-block; padding: .1rem .5rem; border-radius: 3px; font-weight: 700; color: var(--rol-lincoln); background: var(--rol-moss); font-size: .8125rem; line-height: 1.5; letter-spacing: .02em; }
.top .level-chip { min-height: 32px; display: inline-flex; align-items: center; padding: 0 .6rem; font-size: .875rem; }
.top .level-chip:hover { text-decoration: none; background: var(--pink-soft); color: var(--ink); }
.linklike { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.inline { display: inline; }
.foot { margin-top: var(--rol-space-7); }
.foot-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--rol-space-3) var(--rol-space-6); }
.foot-family { margin: 0; max-width: 60ch; }
.foot-family a { text-decoration: underline; text-underline-offset: 3px; }
.foot-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--rol-space-2) var(--rol-space-5); }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .sub { font-weight: 500; color: var(--muted); font-size: .8em; }
.card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: var(--rol-space-5); margin-bottom: 1rem; }
/* the woodcut: the one important surface on a page (rol/DESIGN.md, The One Woodcut Rule) */
.card.surface { border: var(--rol-rule); box-shadow: var(--rol-shadow); margin-right: 8px; }
.flash { background: var(--ok-soft); border-radius: var(--r-lg); padding: .6rem 1rem; margin-bottom: 1rem; }
.flash p { margin: .2rem 0; }
.banner { background: var(--warn-soft); border-radius: var(--r-lg); padding: .6rem 1rem; color: var(--warn); }
.err { background: var(--bad-soft); color: var(--bad); border-radius: var(--r); padding: .5rem .8rem; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: .4rem 0 .6rem; letter-spacing: -.01em; font-weight: 700; }
h2, h3 { line-height: 1.25; }
h3 { margin: 0 0 .5rem; }
button { font: inherit; cursor: pointer; }
.primary { background: var(--pink); color: var(--on-pink); border: 1px solid transparent; border-radius: var(--r); min-height: var(--rol-control-h); padding: .55rem 18px; font-weight: 600; line-height: 1.2;
  transition: transform var(--rol-dur-press) var(--rol-ease-out), background-color var(--rol-dur-press) ease; }
.primary:hover { background: var(--pink-deep); }
.primary:active:not(:disabled) { transform: scale(.97); }
.primary.big { font-size: 1.1rem; padding: .8rem 1.6rem; width: 100%; }
.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); min-height: var(--rol-control-h); padding: .55rem 18px; font-weight: 600; line-height: 1.2;
  transition: transform var(--rol-dur-press) var(--rol-ease-out), background-color var(--rol-dur-press) ease, border-color var(--rol-dur-press) ease; }
.secondary:hover { background: var(--pink-soft); border-color: var(--ink); text-decoration: none; }
.secondary:active:not(:disabled) { transform: scale(.97); }

/* auth */
.auth { max-width: 420px; margin: 2rem auto; }
.auth label { display: block; font-weight: 600; margin: .8rem 0 .3rem; }
.auth input { width: 100%; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--r-lg); font: inherit; background: var(--bg); color: var(--ink); }
.auth input:focus { outline: none; border-color: var(--sky); }
.auth .primary { margin-top: 1.2rem; }

/* level select */
.center { text-align: center; }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-top: 1.2rem; }
.level-card { border: 1px solid var(--hair); background: var(--card); border-radius: var(--r-lg); padding: 1.2rem 1rem; color: var(--ink); display: flex; flex-direction: column; gap: .3rem; text-align: center; font: inherit; cursor: pointer;
  transition: border-color var(--rol-dur-press) ease, transform var(--rol-dur-press) var(--rol-ease-out); }
.level-card:hover { border-color: var(--pink); text-decoration: none; }
.level-card:active { transform: scale(.98); }
.level-card.current { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); }
.level-card .big { font-size: 2.2rem; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.level-card .blurb { font-size: .9375rem; color: var(--muted); }
.level-card .small { color: var(--rol-ink-faint); }

/* hub */
/* hub: who and where you are, the one next step, then every game as a small tile */
.hub-hello { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.hub-hello h1 { margin: 0; }
.hub-hello .lv { font-size: .9375rem; padding: .15rem .6rem; }
.hub-hello .lv:hover { text-decoration: none; background: var(--pink-soft); color: var(--ink); }
.next-up { padding: var(--rol-space-5) var(--rol-space-5) var(--rol-space-4); }
.next-up .eyebrow { margin: 0; font-size: 1rem; font-weight: 700; display: inline-flex; align-items: center; gap: .4rem; }
.next-btn { display: flex; align-items: center; justify-content: center; gap: .5rem; margin: .9rem 0 .7rem; text-decoration: none; max-width: 30rem; }
.next-btn:hover { text-decoration: none; color: var(--on-pink); }
.next-up .daily-games { list-style: none; padding: 0; margin: 0; }
.next-up .daily-chip { font-weight: 600; font-size: .9rem; padding: .3rem .75rem .3rem .4rem; }
.next-up .daily-chip .tick { width: 1.3rem; height: 1.3rem; font-size: .75rem; }
.next-up .daily-status { font-size: 1.1rem; margin: .8rem 0 .6rem; }
.start-card { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--ink); border-color: var(--pink); }
.start-card:hover { text-decoration: none; background: var(--pink-soft); }
.section-title { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
.game-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; }
@media (max-width: 520px) { .game-tiles { grid-template-columns: 1fr 1fr; } }
.game-tile { display: flex; align-items: center; gap: .6rem; background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: .7rem .8rem; color: var(--ink); min-height: 56px;
  transition: border-color var(--rol-dur-press) ease, transform var(--rol-dur-press) var(--rol-ease-out); }
.game-tile:hover { border-color: var(--pink); text-decoration: none; }
.game-tile:active { transform: scale(.98); }
.game-tile > .icon { color: var(--pink); }
.game-tile .name { font-weight: 600; line-height: 1.25; flex: 1; }
.game-tile .best { font-size: .8125rem; font-weight: 700; color: var(--ok); white-space: nowrap; }
.more-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.6rem 0 1rem; }
.more-links a { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-weight: 600; font-size: .9375rem; background: var(--card); }
.more-links a:hover { text-decoration: none; border-color: var(--pink); }
.daily { margin: 1rem 0 0; }
.daily-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.daily-head h3 { margin: 0; }
.streak { font-weight: 700; padding: .25rem .6rem; border-radius: 3px; background: var(--hair); color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; white-space: nowrap; }
.streak.hot { background: var(--warn-soft); color: var(--warn); }
.daily-games { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0; }
.daily-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .9rem .45rem .5rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; }
.daily-chip:hover { text-decoration: none; border-color: var(--pink); }
.daily-chip .tick { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--line); color: var(--muted); font-size: .8125rem; font-weight: 700; }
.daily-chip.done { border-color: var(--ok); background: var(--ok-soft); }
.daily-chip.done .tick { background: var(--ok); color: var(--on-ok); }
.daily-status { margin: .3rem 0 0; font-weight: 700; color: var(--muted); }
.daily-status.ok { color: var(--ok); }
.daily-line { margin: .5rem auto; padding: .5rem .9rem; border-radius: var(--r-lg); background: var(--warn-soft); color: var(--ink); max-width: 36rem; font-weight: 700; }
.daily-line.ok { background: var(--ok-soft); }
.daily-stats { display: flex; gap: 1.6rem; margin: .4rem 0; }
.daily-stats div { display: flex; flex-direction: column; align-items: center; }
.daily-stats b { font-size: 1.6rem; line-height: 1.1; }
.daily-strip { display: flex; flex-wrap: wrap; gap: 5px; margin: .5rem 0 .2rem; }
.daily-strip .dot { width: 16px; height: 16px; border-radius: 4px; background: var(--line); }
.daily-strip .dot.done { background: var(--leaf); }
.daily-strip .dot.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.streaks-head { margin-top: 1.2rem; }
.privacy-form { align-items: flex-start; }
.privacy-form .check { display: flex; gap: .5rem; align-items: flex-start; max-width: 40rem; }
.privacy-form .check input { margin-top: .2rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.rank { padding-left: 1.4rem; margin: .3rem 0; }
.rank li { display: flex; gap: .6rem; align-items: baseline; padding: .15rem 0; }
.rank li span:first-child { flex: 1; }

/* round */
.round-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.round-head h1 { margin: 0; }
.progress { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.progress .bar { width: 160px; height: 10px; background: var(--line); border-radius: var(--r); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.stage { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 1.4rem; margin-top: 1rem; }
.q-level { float: right; }
.q-sentence { font-family: var(--jp); font-size: 1.65rem; line-height: 1.9; margin: .4rem 0 .8rem; word-break: keep-all; }
.q-sentence .blank { display: inline-block; min-width: 2.2em; border-bottom: 3px solid var(--pink); text-align: center; color: var(--pink); }
.q-sentence .blank.filled { color: var(--ink); }
.q-word { font-family: var(--jp); font-size: 2.6rem; font-weight: 700; margin: .3rem 0 0; }
.q-reading { font-family: var(--jp); color: var(--muted); font-size: 1.05rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-top: .8rem; }
.choice { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .8rem .9rem; font-size: 1.05rem; font-family: var(--jp); text-align: left; transition: transform .08s; }
.choice.particle { font-size: 1.6rem; text-align: center; }
.choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--sky); }
.choice:disabled { cursor: default; opacity: .7; }
.choice.right { background: var(--ok-soft); border-color: var(--ok); opacity: 1; }
.choice.wrong { background: var(--bad-soft); border-color: var(--bad); opacity: 1; animation: shake .35s; }
/* a story's question in the language being learned, with its help a tap away */
.qhelp { margin-left: .4rem; vertical-align: middle; cursor: pointer; }
.qtext-help { margin: .2rem 0 0; }
.choice .choice-help { display: block; margin-top: .25rem; font-family: inherit; }
.progress .bar.lives i { background: var(--bad); }
.clock { clear: both; height: 8px; background: var(--line); border-radius: var(--r); overflow: hidden; margin: .5rem 0 1rem; }
.clock i { display: block; height: 100%; width: 100%; background: var(--ok); transition-property: width; transition-timing-function: linear; }
.clock.fast i { background: var(--bad); }
.fast-badge { float: right; margin-right: .5rem; background: var(--bad); color: var(--on-bad); display: inline-flex; align-items: center; gap: .25rem; border-radius: var(--r); padding: .1rem .6rem; font-weight: 700; font-size: .85rem; animation: pulse .45s infinite alternate; }
.snap { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: center; min-height: 8rem; }
.snap-kanji { font-family: var(--jp); font-size: 3.4rem; font-weight: 700; text-align: center; line-height: 1.2; word-break: keep-all; }
.snap-def { font-size: 1.35rem; font-weight: 600; text-align: center; border-left: 3px solid var(--line); padding: .6rem 1rem; }
.snap-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.snap-btn { border: none; border-radius: var(--r); min-height: 56px; padding: 1rem; font-size: 1.25rem; font-weight: 700; transition: transform var(--rol-dur-press) var(--rol-ease-out); }
.snap-btn.no { background: var(--bad); color: var(--on-bad); }
.snap-btn.yes { background: var(--ok); color: var(--on-ok); }
.snap-btn:active:not(:disabled) { transform: scale(.97); }
.snap-btn:disabled { opacity: .55; cursor: default; }
.snap-btn.right { outline: 4px solid var(--sun); opacity: 1; }
.snap-btn.wrong { animation: shake .35s; opacity: 1; }
.snap-keys { text-align: center; margin: .6rem 0 0; }
@media (max-width: 420px) { .snap-kanji { font-size: 2.4rem; } .snap-def { font-size: 1.1rem; } }
.trail { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-family: var(--jp); margin: .2rem 0 .4rem; }
.trail span { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: .1rem .6rem; font-size: 1rem; }
.trail i { color: var(--muted); font-style: normal; }
.q-chain { font-family: var(--jp); font-size: 3rem; font-weight: 700; margin: .3rem 0 .6rem; display: flex; align-items: center; gap: .3rem; line-height: 1.2; }
.q-chain .anchor { padding: .1rem .35rem; }
.q-chain .slot { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; border: 3px dashed var(--pink); border-radius: var(--r-lg); color: var(--pink); font-size: .9em; }
.q-chain .slot.filled { border-style: solid; border-color: var(--ok); color: var(--ink); background: var(--ok-soft); }
.q-chain .slot.missed { border-color: var(--bad); background: var(--bad-soft); }
.choices.kanji { grid-template-columns: repeat(4, 1fr); }
.q-ladder { font-family: var(--jp); font-size: 2.6rem; font-weight: 700; margin: .3rem 0 .6rem; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; line-height: 1.15; }
.q-ladder .from { display: inline-flex; flex-direction: column; align-items: center; color: var(--muted); }
.q-ladder .from .en { font-size: .85rem; font-weight: 600; letter-spacing: 0; }
.q-ladder .arrow { color: var(--pink); }
.q-ladder .to { color: var(--ink); }
.q-ladder .changed { color: var(--pink); border-bottom: 5px solid var(--pink); padding-bottom: .05em; }
.chain-list { list-style: none; padding: 0; margin: 1rem 0 0; border-top: 2px dashed var(--line); }
.chain-list li { display: flex; align-items: baseline; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); animation: pop .3s ease-out; }
.chain-list li b { font-family: var(--jp); font-size: 1.35rem; }
.chain-list .mark { font-weight: 700; }
.chain-list li.ok .mark { color: var(--ok); } .chain-list li.bad .mark { color: var(--bad); }
.chain-list .reading { font-family: var(--jp); color: var(--muted); }
.chain-list .en { color: var(--muted); font-size: .9rem; }
.choices.kanji .choice { font-size: 1.9rem; padding: .6rem .3rem; }
.pairs { display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem; margin: .8rem auto 0; max-width: 46rem; }
.ptile { position: relative; aspect-ratio: 3 / 2; border: none; background: transparent; padding: 0; perspective: 600px; cursor: pointer; }
.ptile .face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: var(--r-lg); backface-visibility: hidden; transition: transform .5s, box-shadow .15s, border-color .15s; font-family: var(--jp); padding: .15rem; line-height: 1.15; word-break: break-all; }
.ptile .front { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.ptile.k .front { font-size: 2rem; font-weight: 700; }
.ptile.r .front { font-size: 1.2rem; background: var(--bg); }
.ptile.r.long .front { font-size: 1rem; letter-spacing: -.03em; }
.ptile.k.long .front { font-size: 1.35rem; letter-spacing: -.02em; }
.ptile.k.xlong .front { font-size: 1.05rem; }
.ptile .back { background: var(--ok); color: var(--on-ok); transform: rotateY(180deg); font-size: 1.5rem; }

/* Word Grid (grid.js): the meaning, a row of slots, then the 4 × 4 board */
.grid-game { max-width: 24rem; margin: .4rem auto 0; }
.grid-ask { text-align: center; margin-bottom: .8rem; }
.grid-ask .grid-count { margin: 0; }
.grid-meaning { font-size: 1.35rem; font-weight: 700; margin: .2rem 0 0; }
.grid-sub { margin: .1rem 0 0; font-size: 1.05rem; }
.grid-row { display: flex; justify-content: center; align-items: center; gap: .5rem; margin-top: .6rem; }
.grid-slots { display: flex; gap: .3rem; justify-content: center; }
.grid-slots .slot { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 2px dashed var(--pink); border-radius: var(--r); font-family: var(--jp); font-size: 1.5rem; font-weight: 700; }
.grid-slots .slot.full { border-style: solid; border-color: var(--ink); background: var(--card); }
.grid-slots.right .slot { border-color: var(--ok); background: var(--ok-soft); }
.grid-slots.shake { animation: shake .35s; }
.grid-slots.shake .slot { border-color: var(--bad); background: var(--bad-soft); }
.grid-back { min-height: 2.6rem; padding: .3rem .7rem; }
.grid-note { margin: .5rem 0 0; }
.grid-note.bad { color: var(--bad); font-weight: 600; }
.grid-board { display: grid; gap: .45rem; }
.gtile { position: relative; aspect-ratio: 1; border: none; background: transparent; padding: 0; perspective: 600px; cursor: pointer; }
.gtile .face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: var(--r-lg); backface-visibility: hidden; transition: transform .45s, background .15s, border-color .15s; font-family: var(--jp); font-size: 1.9rem; font-weight: 700; }
.gtile .front { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.gtile .back { background: var(--ok-soft); border: 1px solid var(--hair); transform: rotateY(180deg); }
.gtile.picked .front { background: var(--pink-soft); border: 2px solid var(--pink); }
.gtile.done { cursor: default; }
.gtile.done .front { transform: rotateY(180deg); }
.gtile.done .back { transform: rotateY(0); }
.gtile:focus-visible .front { outline: 3px solid var(--pink); outline-offset: 2px; }
.grid-lives { text-align: center; color: var(--bad); font-size: 1.3rem; letter-spacing: .15em; margin: .7rem 0 0; }
.ptile.sel .front { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink); }
.ptile.done { pointer-events: none; }
.ptile.done .front { transform: rotateY(180deg); }
.ptile.done .back { transform: rotateY(0); }
.ptile.miss .front { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.ptile:disabled { cursor: default; }
@media (max-width: 600px) { .ptile { aspect-ratio: 1 / 1.15; } }
@media (max-width: 420px) { .pairs { gap: .3rem; } .ptile.k .front { font-size: 1.5rem; } .ptile.k.long .front { font-size: 1.1rem; } .ptile.k.xlong .front { font-size: .9rem; } .ptile.r .front { font-size: .95rem; } .ptile.r.long .front { font-size: .8125rem; } }
.tiles { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; min-height: 3rem; }
.tile { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .5rem .8rem; font-family: var(--jp); font-size: 1.3rem; }
.tile:hover:not(:disabled) { border-color: var(--sky); }
.tile.used { visibility: hidden; }
.answer-line { min-height: 3.4rem; border: 1px dashed var(--line); border-radius: var(--r-lg); padding: .5rem .8rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-family: var(--jp); font-size: 1.35rem; }
.answer-line .placed { background: var(--card); border: 2px solid var(--sky); border-radius: var(--r); padding: .25rem .6rem; font: inherit; color: inherit; }
.answer-line .placed:hover:not(:disabled) { border-color: var(--pink); }
.answer-line .placed:disabled { cursor: default; }
.answer-line .gap { width: 14px; min-height: 2.4rem; align-self: stretch; margin: 0 -.2rem; padding: 0; border: 0; background: transparent; position: relative; }
.answer-line .gap::before { content: ""; position: absolute; left: 5px; top: 18%; bottom: 18%; width: 3px; border-radius: 2px; background: var(--line); }
.answer-line .gap:hover::before { background: var(--sky); }
.answer-line .gap.here::before { left: 4px; width: 5px; background: var(--pink); animation: caret 1s step-end infinite; }
@keyframes caret { 50% { opacity: .25; } }
.answer-line .placed.ok, .correct-line .placed.ok { border-color: var(--ok); background: var(--ok-soft); }
.answer-line .placed.bad { border-color: var(--bad); background: var(--bad-soft); }
.correct-line { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-family: var(--jp); font-size: 1.35rem; }
.correct-line .placed { background: var(--card); border: 2px solid var(--ok); border-radius: var(--r); padding: .25rem .6rem; }
.correct-line .tail, .correct-line .head { color: var(--muted); }
.answer-line .tail, .answer-line .head { color: var(--muted); }
.row { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; align-items: center; }
.feedback { margin-top: .8rem; border-radius: var(--r-lg); padding: .9rem 1.1rem; font-weight: 600; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback .detail { display: block; font-weight: 400; color: var(--ink); margin-top: .35rem; font-family: var(--jp); }
.feedback .detail .en { color: var(--muted); font-family: inherit; }
.feedback .next { margin-top: .6rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.feedback.bad { cursor: pointer; }
.feedback .detail .jp { font-family: var(--jp); font-size: 1.15rem; color: var(--ink); }
.feedback .detail .reading { color: var(--muted); font-family: var(--jp); }
.feedback .rule { margin-top: .5rem; font-weight: 400; color: var(--ink); background: var(--card); border-radius: var(--r); padding: .5rem .7rem; }
.feedback .rule a { margin-left: .3rem; }
.last { margin-top: .6rem; border-radius: var(--r-lg); padding: .5rem .9rem; background: var(--ok-soft); color: var(--ink); font-size: .95rem; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; animation: pop .25s ease-out; }
.last .mark { color: var(--ok); font-weight: 700; }
.last .jp { font-family: var(--jp); font-size: 1.05rem; }
.last .reading, .last .en { color: var(--muted); }
.last .reading { font-family: var(--jp); }
.flash-mark { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 50; font-size: 11rem; font-weight: 700; line-height: 1; animation: flashmark .45s ease-out forwards; }
.flash-mark.ok { color: var(--ok); } .flash-mark.bad { color: var(--bad); }
@keyframes flashmark { 0% { opacity: 0; transform: scale(.5); } 15% { opacity: .9; transform: scale(1.05); } 65% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }
.hint-line { font-family: var(--jp); color: var(--muted); font-size: 1.15rem; margin: -.4rem 0 .4rem; }
.hint-line .blank.small { min-width: 1.6em; border-bottom: 2px solid var(--pink); display: inline-block; text-align: center; color: var(--pink); }
.hint-row { margin: 0 0 .4rem; }
.hint { color: var(--pink-deep); font-weight: 600; }
.hearts { color: var(--pink); letter-spacing: .05em; font-size: 1.1rem; }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }

/* result */
.result { text-align: center; animation: pop .3s ease-out; }
.result .score { font-size: clamp(2rem, 7vw, 2.75rem); font-weight: 700; line-height: 1.15; margin: .2rem 0 .4rem; }
.result .change { display: inline-block; padding: .5rem 1.1rem; border-radius: var(--r); font-weight: 700; font-size: 1.1rem; margin: .4rem 0 .8rem; }
.result .change.up { background: var(--ok-soft); color: var(--ok); }
.result .change.down { background: var(--warn-soft); color: var(--warn); }
.result .change.repeat { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.result .result-actions { justify-content: center; margin: .8rem 0 .4rem; }
.result .look-title { font-size: 1.05rem; text-align: left; margin: 1.4rem 0 .2rem; }
.result .none-missed { display: inline-flex; align-items: center; gap: .4rem; color: var(--ok); font-weight: 700; margin: 1.2rem 0 .4rem; }
.result .all-answers { text-align: left; margin-top: .8rem; }
.result .all-answers summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: .4rem 0; }
.result .review { text-align: left; margin-top: .4rem; padding-left: 0; list-style: none; }
.result .review li { padding: .45rem 0 .45rem 1.8rem; border-bottom: 1px solid var(--line); font-family: var(--jp); position: relative; }
.result .review li .mark { position: absolute; left: .2rem; font-weight: 700; }
.result .review li.ok .mark { color: var(--ok); }
.result .review li.late .mark { color: var(--warn); }
.result .review li.bad .mark { color: var(--bad); }
.result .review .ans, .feedback .detail .ans, .last .ans { color: var(--ok); }
/* a right answer: a short cheer while the card shows it filled */
.feedback.cheer { display: flex; align-items: center; gap: .45rem; font-size: 1.1rem; animation: pop .25s ease-out; }
.result .review .en { color: var(--muted); font-family: inherit; font-size: .85rem; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -10px; width: 10px; height: 14px; border-radius: 2px; animation: fall 1.6s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .9 } }

/* leaderboard */
.period-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: .2rem 0 .8rem; }
.period-row select { font: inherit; font-weight: 700; padding: .35rem .6rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.small-btn { padding: .3rem .8rem; font-size: .9rem; }
details.danger { margin-top: 1rem; }
details.danger summary { cursor: pointer; }
details.danger input { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); color: var(--ink); margin-left: .3rem; width: 9rem; }
.danger-btn { border-color: var(--bad); color: var(--bad); }
.sound { font-size: 1.1rem; vertical-align: middle; margin-left: .3rem; opacity: .8; }
.sound.off { opacity: .35; }
/* Tales: the shared bits. nihongo's reader hid .en because there the
   Japanese leads and the English is the translation; here it is the other
   way round, so only what both readers agree on lives up here and the rest
   is in the 物語 block at the end of this file. */
.notes .gp summary { cursor: pointer; font-size: 1rem; padding: .3rem 0; }
.notes .gp summary span[lang=ja] { font-family: var(--jp); font-size: 1.1rem; }
.notes .gp p { margin: .2rem 0 .8rem 1rem; color: var(--ink); }
/* practice */
.practice-form .opt-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .6rem 0; }
.practice-form .lv.dim { opacity: .45; } .practice-form .lv.chosen { outline: 3px solid var(--ink); }
.pill { border: 1px solid var(--line); border-radius: var(--r); padding: .25rem .7rem; background: var(--card); cursor: pointer; font-weight: 600; }
.pill input { accent-color: var(--pink); }
.pill:has(input:checked) { border-color: var(--pink); background: var(--bad-soft); }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem; margin: 1rem 0; }
.deck-card { text-align: left; background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg); cursor: pointer; padding: 1rem 1.1rem; color: var(--ink); display: flex; flex-direction: column; gap: .3rem; transition: transform .12s; font: inherit; }
.deck-card:hover:not(:disabled) { border-color: var(--pink); }
.deck-card:disabled { opacity: .5; cursor: default; }
.deck-card > .icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r); border: 1px solid var(--hair); background: var(--bg); color: var(--ink); }
.deck-card .name { font-weight: 700; font-size: 1.05rem; }
.deck-card .desc { color: var(--muted); font-size: .9rem; }
.deck-card .stat { font-size: .85rem; } .deck-card .stat .due { color: var(--pink-deep); }
.deck-card .cta { align-self: flex-start; margin-top: .5rem; color: var(--pink); font-weight: 600; }
.deck-card:hover:not(:disabled) .cta { text-decoration: underline; text-underline-offset: 3px; }
.fstage { min-height: 16rem; display: grid; place-items: center; }
.fcard { position: relative; width: 100%; max-width: 520px; min-height: 15rem; perspective: 1000px; cursor: pointer; }
.fcard .side { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 1.2rem; border-radius: var(--r-lg); backface-visibility: hidden; transition: transform .45s; text-align: center; }
.fcard .front { background: var(--bg); border: 1px solid var(--line); }
.fcard .back { background: var(--ok-soft); border: 2px solid var(--ok); transform: rotateY(180deg); }
.fcard.flipped .front { transform: rotateY(180deg); } .fcard.flipped .back { transform: rotateY(0); }
.f-main.jp { font-family: var(--jp); font-size: 3rem; font-weight: 700; line-height: 1.2; word-break: keep-all; }
.f-main.en { font-size: 1.5rem; font-weight: 700; }
.f-reading { font-family: var(--jp); color: var(--muted); font-size: 1.3rem; }
.f-note { font-family: var(--jp); color: var(--muted); font-size: 1rem; margin-top: .3rem; }
.f-hint, .f-box { position: absolute; bottom: .6rem; right: .9rem; }
.fbuttons { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
@media (max-width: 420px) { .f-main.jp { font-size: 2.2rem; } }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: var(--r); padding: .35rem .9rem; font-weight: 700; color: var(--ink); }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8125rem; color: var(--muted); padding: .3rem .5rem; }
.table td { padding: .45rem .5rem; border-top: 1px solid var(--line); }
.table tr.me td { background: var(--warn-soft); }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.chg.up { color: var(--ok); font-weight: 700; } .chg.down { color: var(--warn); font-weight: 700; } .chg.repeat { color: var(--muted); }

/* grammar */
.grammar .gp summary { cursor: pointer; font-size: 1.05rem; }
.grammar .gp code { background: var(--bg); padding: .1rem .4rem; border-radius: var(--r); font-family: var(--jp); margin-left: .4rem; }
.jp { font-family: var(--jp); }
.ex { font-size: 1.15rem; }
.reading { color: var(--muted); font-size: .9rem; }
.prose ul { padding-left: 1.2rem; }
@media (max-width: 600px) { .q-sentence { font-size: 1.4rem; } .progress .bar { width: 110px; } .stage { padding: 1rem; } }
#sync-start { color: var(--pink-deep); }
.help h2 { margin-top: 1.6rem; }
.help .toc { font-size: .95rem; line-height: 1.8; }
.help dl dt { font-weight: 700; margin-top: .8rem; }
.help dl dd { margin: .2rem 0 0; }
.help ol, .help ul { padding-left: 1.2rem; }
.help li { margin: .3rem 0; }

/* Guess the Onomatopoeia */
.choices.ono .choice { font-size: 1.35rem; text-align: center; }
.q-en { margin: .2rem 0 0; }
.kind-hint { color: var(--muted); }
#last .small, .feedback .small { font-size: .95rem; }
/* Admin: the player table and the password forms */
.admin-table { width: 100%; border-collapse: collapse; margin-top: .6rem; }
.admin-table th { text-align: left; font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--line); padding: .3rem .6rem .3rem 0; }
.admin-table td { padding: .45rem .6rem .45rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pw-form { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin-top: .6rem; }
.pw-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; }
.pw-form input, .pw-form select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); color: var(--ink); min-width: 11rem; }
.reminders-form { flex-direction: column; align-items: flex-start; }
.reminders-form label.check { flex-direction: row; align-items: center; gap: .5rem; font-size: 1rem; }
.reminders-form label.check input { min-width: 0; width: 1.1rem; height: 1.1rem; }
.reminders-form .rem-when { display: flex; flex-wrap: wrap; gap: .8rem; }
.reminders-form .rem-when select { max-width: 100%; }
.reminders-form .rem-langs { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.reminders-form .rem-langs legend { margin-bottom: .3rem; }
.reminders-form .rem-langs p { flex-basis: 100%; margin: 0; }
.reminders-form p { margin: 0; }
.pw-issued { border: 2px solid var(--pink); }
.pw-value code { font-size: 1.8rem; font-weight: 700; letter-spacing: .06em; user-select: all; }
details#password { margin-top: 1rem; }
details#password summary { cursor: pointer; }
.table-scroll { overflow-x: auto; }
/* Mastery: progress page, hub chips, review and mastered badges */
.review-chip { display: inline-block; margin-left: .4rem; padding: .1rem .5rem; border-radius: 3px; background: var(--warn-soft); color: var(--warn); font-size: .8125rem; font-weight: 700; vertical-align: middle; }
.mastered-badge { display: inline-block; margin-left: .4rem; padding: .05rem .5rem; border-radius: var(--r); background: var(--ok-soft); color: var(--ok); font-size: .8125rem; font-weight: 700; }
.mastered-now { margin: .6rem auto; padding: .6rem .9rem; border-radius: var(--r-lg); background: var(--ok-soft); color: var(--ink); max-width: 36rem; font-family: var(--jp); }
.mastered-chip { display: block; font-size: .8125rem; color: var(--ok); font-weight: 700; margin-top: .2rem; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; text-align: center; }
.stat-row div { display: flex; flex-direction: column; align-items: center; }
.stat-row b { font-size: 2rem; line-height: 1.1; }
.empty-state { text-align: center; }
.empty-state p { font-size: 1.05rem; }
.not-yet { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 1rem 0; }
.game-progress h3 { margin: 0 0 .2rem; }
.levels-table { width: 100%; border-collapse: collapse; margin-top: .4rem; }
.levels-table td { padding: .2rem .3rem; vertical-align: middle; }
.levels-table .bar-cell { width: 100%; }
.levels-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-track { height: 12px; border-radius: var(--r); background: var(--line); overflow: hidden; }
.bar-track.small { height: 8px; }
.bar-fill { height: 100%; background: var(--ok); border-radius: var(--r); transition: width .3s; }
.due { color: var(--warn); font-weight: 700; }
.mastered-list { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.mastered-list li { font-family: var(--jp); }

.feedback.retry { background: var(--warn-soft); color: var(--warn); }

/* 英語ゲーム: English text gets a clean Latin face; the mark is sky blue */
.en, [lang="en"] { font-family: var(--en); }
.q-sentence.en { font-size: 1.5rem; line-height: 1.7; word-break: normal; }
.q-sentence.en .tok { margin-right: .32em; }
.q-sentence.en .punct { margin-left: -.32em; }
.q-sentence.en .punct.sp { margin-left: -.16em; }   /* French ? ! : ; keep a narrow space before them */
.q-sentence.en .blank { letter-spacing: .05em; margin-right: .32em; }
.q-word.en { font-size: 2.6rem; letter-spacing: .01em; }
.q-en { font-size: 1rem; margin: 0 0 .6rem; }
.snap-kanji.en { font-size: 2.6rem; word-break: normal; overflow-wrap: anywhere; }
.tile.en { font-size: 1.15rem; padding: .5rem .75rem; }
.answer-line.en { font-size: 1.15rem; }
.answer-line.en .placed, .correct-line .placed { font-family: var(--en); }
.q-ladder.en { font-size: 2.4rem; letter-spacing: .02em; }
.q-ladder.en .from .en { font-family: var(--jp); }
[data-target|="en"] .ptile.k .face { font-family: var(--en); font-size: 1.05rem; }   /* English words run long; other targets keep the 2rem above */
[data-target|="en"] .ptile.k.long .face { font-size: .85rem; }
.ptile.r .face { font-family: var(--jp); }
.chain-list li b[lang="en"] { font-family: var(--en); }
.choice[lang="en"] { font-family: var(--en); }
.f-main.en { font-family: var(--en); }
.f-reading { color: var(--muted); font-size: 1rem; }
.f-note { color: var(--muted); font-size: .95rem; margin-top: .4rem; font-family: var(--jp); }

/* A card face carries a single word or a whole grammar explanation. The face
   scrolls rather than spilling over the card, and practice.js adds .long /
   .xlong so the type steps down as the text grows. */
.fcard .side { justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 2.2rem; }
.face-inner { margin: auto 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.f-main.jp.long { font-size: 1.9rem; line-height: 1.45; word-break: normal; }
.f-main.jp.xlong { font-size: 1.15rem; font-weight: 600; line-height: 1.75; word-break: normal; text-align: left; }
.f-main.en.long { font-size: 1.25rem; }
.f-main.en.xlong { font-size: 1.05rem; font-weight: 600; line-height: 1.6; text-align: left; }
@media (max-width: 420px) {
  .f-main.jp.long { font-size: 1.5rem; }
  .f-main.jp.xlong { font-size: 1.05rem; }
}

/* 物語: the reader. English is the text being studied, so it leads and the
   Japanese sits under it, hidden until you ask. */
.tale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.tale-card { display: block; color: inherit; text-decoration: none; max-width: 460px; transition: transform .08s; }
.tale-card:hover { transform: translateY(-2px); text-decoration: none; }   /* a:hover underlines everything otherwise */
.tale-card h3 { margin: 0 0 .3rem; font-family: var(--en); }
.tale-card .jp { font-family: var(--jp); font-size: 1.2rem; margin: 0 0 .4rem; }
.tale-head h1 { margin: .2rem 0 .6rem; font-family: var(--en); }
.tale-head .sub { display: block; font-size: 1.2rem; color: var(--muted); }
.player .row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.player input[type=range] { vertical-align: middle; }
.text .sent { margin: 0; padding: .45rem .6rem; border-radius: var(--r-lg); font-size: 1.25rem; line-height: 1.9;
  font-family: var(--en); cursor: pointer; transition: background .15s; }
.text .sent:hover, .text .sent:focus { background: var(--bg); outline: none; }
.text .sent .ja { display: none; font-family: var(--jp); font-size: .98rem; line-height: 1.6; color: var(--muted); }
.text .sent:hover .ja, .text .sent.open .ja, .text.all-ja .sent .ja { display: block; }
.text .sent.reading { background: var(--ok-soft); box-shadow: inset 4px 0 0 var(--ok); }
.w { border-bottom: 2px dotted var(--sky); cursor: help; }
.w:hover { background: var(--ok-soft); }
.tip { position: absolute; z-index: 60; max-width: 320px; background: var(--ink); color: var(--card);
  border-radius: var(--r); padding: .5rem .7rem; font-size: .95rem; line-height: 1.4; pointer-events: none; }
.tip b { font-family: var(--en); }
.tip [lang=ja] { font-family: var(--jp); }
.tip .small { opacity: .85; font-size: .85rem; }
.notes .gp summary { font-family: var(--en); }
.notes .gp .jp, .notes .gp p { font-family: var(--jp); }
#quiz .row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; }
#quiz .row p { margin: 0; }
#qlist .q { margin: .8rem 0 1.2rem; }
#qlist .qtext { font-family: var(--jp); font-weight: 600; margin: 0; }
@media (max-width: 420px) { .text .sent { font-size: 1.1rem; line-height: 1.8; } }

/* landing */
.hero { padding: 2.5rem 0 1.5rem; }
.hero.center h1 { font-size: 2.3rem; line-height: 1.15; max-width: 22ch; margin: 0 auto .8rem; }
.hero h1.display { font-size: var(--rol-text-h1); max-width: 18ch; margin: 0 0 var(--rol-space-5); }
.hero h1 .sub { display: block; margin-top: .3rem; font-size: 1rem; }
section > h2.display, .card > h2.display { font-size: var(--rol-text-h2); font-weight: 400; margin: 0 0 var(--rol-space-4); }
/* an icon beside a heading: the heading's size, in the secondary ink */
h1 > .icon, h2 > .icon, h3 > .icon, h1 > .jp > .icon { width: .9em; height: .9em; vertical-align: -.12em; color: var(--muted); }
.lede { font-size: var(--rol-text-lede); color: var(--muted); max-width: 56ch; margin: 0 auto 1.4rem; }
.cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-bottom: .8rem; }
/* the public pages' hero: left-aligned, as the kit asks */
.hero--left { padding: var(--rol-space-7) 0 var(--rol-space-6); }
.hero--left .lede { margin: 0 0 var(--rol-space-5); max-width: 60ch; }
.hero--left .cta { justify-content: flex-start; }
.cta a:hover, .center > .primary:hover { text-decoration: none; }
.lang-card { align-items: center; }
.lang-card .big { line-height: 0; margin: .2rem 0 .3rem; }
.lang-card .big .flag { width: 48px; height: 32px; }
.lang-card .blurb { font-weight: 700; font-size: 1.125rem; color: var(--ink); }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin: 2rem 0 1rem; }
.feature { margin: 0; }
.feature p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--bg); border: 1px solid var(--hair); border-radius: var(--r); padding: .35rem .75rem; font-weight: 600; font-size: .9375rem; }
.chip .icon { color: var(--muted); }
section h2 { font-size: 1.25rem; margin: 1.5rem 0 .4rem; }
.card h2 { margin-top: 0; }
@media (max-width: 520px) { .hero h1 { font-size: 1.8rem; } }

/* Typed answers (Type the Word, Type the Form) */
.q-meaning { font-size: 1.7rem; font-weight: 700; margin: .3rem 0 0; line-height: 1.3; overflow-wrap: anywhere; }
.typed { margin-top: .9rem; }
.typed-input { width: 100%; box-sizing: border-box; font-family: var(--jp); font-size: 1.4rem; /* ≥16px: phones do not zoom in */
  padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); color: var(--ink); }
.typed-input.en { font-family: var(--en); }
.typed-input:focus { outline: none; border-color: var(--sky); }
.typed-input.missed { border-color: var(--warn); }
.typed-input.right { border-color: var(--ok); background: var(--ok-soft); }
.typed-input.near { border-color: var(--warn); background: var(--warn-soft); }
.typed-input.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.typed-input:disabled { opacity: 1; color: var(--ink); -webkit-text-fill-color: var(--ink); }
.accent-keys { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.accent-key { min-width: 2.6rem; min-height: 2.6rem; padding: 0 .5rem; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); color: var(--ink); font-size: 1.15rem; font-family: var(--en); touch-action: manipulation; }
.accent-key:active { transform: translateY(1px); background: var(--line); }
.typed .row { margin-top: .7rem; }
.typed-right { margin: .6rem 0 0; font-weight: 700; }
.typed-right.near { color: var(--warn); }
.typed-right.wrong { color: var(--bad); }
.last .near-note { color: var(--warn); font-weight: 700; }

/* billing and the paywall (Phase 3B) */
.upgrade { max-width: 40rem; margin: 0 auto; }
.upgrade-list { padding-left: 1.2rem; line-height: 1.7; }
.upgrade .price { font-size: 1.4rem; margin: .8rem 0 .2rem; }
.consent { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0; font-weight: 600; cursor: pointer; }
.consent input { margin-top: .25rem; width: 1.2rem; height: 1.2rem; flex: none; }
.upgrade label.country { display: flex; flex-direction: column; gap: .35rem; margin: 1rem 0 .25rem; font-weight: 600; }
.upgrade label.country select { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); color: var(--ink); max-width: 100%; min-height: 44px; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
a.primary { display: inline-block; text-decoration: none; }
.billing-card { margin-top: 1rem; }
.lock-note { display: block; font-size: .8125rem; font-weight: 700; opacity: .95; }
.level-card.locked { filter: saturate(.6); }
.paywall-card { text-align: center; }
.paywall-card .actions { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.tale-card.locked { opacity: .7; }
/* accounts, email and legal pages (Phase 3A) */
.ok-text { color: var(--ok); font-weight: 700; }
.auth .legal-note { margin-top: 1rem; }
.auth .aside-link { display: block; margin-top: .6rem; }
.legal h1 { margin-top: .2rem; }
.legal h2 { font-size: 1.15rem; margin: 1.4rem 0 .4rem; }
.legal p, .legal li { max-width: 68ch; }
.legal-draft { text-align: center; }
.foot .legal-links { display: block; margin: .3rem 0; }

/* Start here (core/start.py): the track, and its five kinds of step.
   Target-language text carries the pack's lang, so its font comes from
   the rules above; nothing here names a language. */
.start-head { margin-bottom: 1.2rem; }
.start-head .lead { font-size: 1.08rem; max-width: 62ch; }
.track-bar { height: 10px; border-radius: var(--r); background: var(--line); overflow: hidden; max-width: 420px; }
.track-bar span { display: block; height: 100%; background: var(--leaf); transition: width .3s; }
.track { list-style: none; padding: 0; margin: 0 0 1rem; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step-mark { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); font-weight: 700; }
.step.done .step-mark { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.step.next { outline: 3px solid var(--pink); }
.step.next .step-mark { background: var(--pink); border-color: var(--pink); color: var(--on-pink); }
.step-body { flex: 1; min-width: 0; }
.step-body h3 { margin: 0 0 .3rem; }
.step-body p { margin: .2rem 0 .6rem; }
a.btn { display: inline-block; text-decoration: none; }
a.btn.secondary { color: var(--ink); }
.start-prompt { text-align: left; border-left: 6px solid var(--leaf); display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; }
.start-prompt .primary { margin-left: auto; }
.start-card { border-left: 6px solid var(--leaf); }
.voice-note { margin: 0 0 1rem; }
.basics { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1rem; align-items: start; }
.basic p { margin: .3rem 0 .6rem; }
.examples { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .35rem; }
.ex { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; padding: .3rem .5rem; border-radius: var(--r); background: var(--bg); }
.ex-text[lang] { font-family: var(--jp); font-size: 1.45rem; }
.ex-reading { font-weight: 700; }
.say { background: none; border: 1px solid var(--line); border-radius: var(--r); min-width: 2.4rem; min-height: 2.4rem;
  cursor: pointer; font-size: 1rem; margin-left: auto; }
.say:hover { border-color: var(--sky); }
body.no-voice .say, body.no-voice .w-icon { opacity: .45; }
.chart h3 { margin-bottom: .3rem; }
.chart-label { margin: .6rem 0 .2rem; font-weight: 700; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: .45rem; margin: .3rem 0; }
.cells.wide { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
/* a chart with `columns`: the same number across at every width, so a column means something
   (a syllabary's vowels); a null cell keeps its slot empty */
.cells.cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); max-width: calc(var(--cols) * 6.5rem); }
.cell-blank { min-height: 4rem; }
.cell { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--ink); cursor: pointer;
  min-height: 4rem; padding: .35rem .3rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .1rem; transition: transform .08s; touch-action: manipulation; }
.cell:hover { transform: translateY(-2px); border-color: var(--sky); }
.cell.on { border-color: var(--pink); background: var(--bad-soft); }
.cell .c-text { font-size: 1.35rem; font-weight: 700; line-height: 1.15; }
.cell .c-text[lang] { font-family: var(--jp); font-size: 1.9rem; font-weight: 600; }
.cell .c-sub { font-size: .8125rem; color: var(--muted); }
.cell .c-sub[lang] { font-family: var(--jp); font-size: .95rem; }
body.no-subs .cell .c-sub { visibility: hidden; }
.cell-note { margin: .6rem 0 0; padding: .45rem .7rem; border-radius: var(--r); background: var(--bg); }
.cell-note [lang] { font-family: var(--jp); }
.listen-set .quiz:empty { display: none; }
.listen-play { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.listen-play .play { font-size: 1.15rem; }
.unheard b { font-size: 1.6rem; }
.unheard b[lang] { font-family: var(--jp); }
.q-prompt { text-align: center; font-size: 2.4rem; font-weight: 700; margin: .4rem 0 .2rem; }
.q-prompt[lang] { font-family: var(--jp); font-weight: 600; font-size: 3rem; }
.choice.reading, .choice.gloss { font-family: var(--latin), sans-serif; text-align: center; font-size: 1.2rem; }
.choice.target { font-size: 1.8rem; text-align: center; }
.feedback-line { margin: .8rem 0 .2rem; padding: .5rem .8rem; border-radius: var(--r); }
.feedback-line.ok { background: var(--ok-soft); }
.feedback-line.bad { background: var(--bad-soft); }
.feedback-line [lang] { font-family: var(--jp); }
.words { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .3rem; }
.word { display: flex; align-items: center; gap: .8rem; padding: .35rem 0; border-top: 1px solid var(--line); }
.word:first-child { border-top: none; }
.word-say { flex: 0 0 11rem; display: flex; align-items: baseline; gap: .5rem; text-align: left; background: none; border: none;
  padding: .2rem .3rem; border-radius: var(--r); cursor: pointer; color: inherit; font: inherit; }
.word-say:hover { background: var(--line); }
.w-word { font-family: var(--jp); font-size: 1.6rem; }
.w-reading { font-weight: 700; color: var(--pink-deep); }
.w-icon { font-size: .8125rem; }
.w-body { display: flex; flex-direction: column; min-width: 0; }
.w-meaning { font-weight: 600; }
body.no-meanings .w-meaning, body.no-meanings .w-note { visibility: hidden; }
.sentences { margin: .6rem 0 0; padding-left: 1.4rem; display: grid; gap: .8rem; }
.sentence { position: relative; }
.sentence .sent { display: inline-block; font-family: var(--jp); font-size: 1.6rem; padding-right: 3rem; }
.sentence .say { position: absolute; right: 0; top: .5rem; }
/* the translation under a sentence: hidden until the sentence is tapped, as in a tale */
.text .sent .tr { display: none; font-family: var(--latin), sans-serif; font-size: 1rem; line-height: 1.6; color: var(--muted); }
.text .sent:hover .tr, .text .sent.open .tr, .text.all-ja .sent .tr { display: block; }
.s-note { margin: .1rem 0 0 .6rem; }
.sentence .w + .w { margin-left: .15em; }   /* the dotted underlines show where one word ends */
.done-box .row { margin: .4rem 0; }
@media (max-width: 520px) {
  .step { gap: .7rem; }
  .cells { grid-template-columns: repeat(auto-fill, minmax(3.9rem, 1fr)); }
  .cells.wide { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
  .cells.cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: .3rem; }
  .cells.cols .cell { padding: .3rem .1rem; min-height: 3.6rem; }
  .cell .c-text[lang] { font-size: 1.6rem; }
  .word { flex-direction: column; align-items: flex-start; gap: .1rem; }
  .word-say { flex: 0 0 auto; }
  .sentence .sent { font-size: 1.35rem; }
  .q-prompt { font-size: 2rem; }
  .start-prompt .primary { margin-left: 0; }
}

/* the site language menu in the header, and a pair's beta mark */
.ui-switch { position: relative; margin-left: auto; }
.ui-switch summary { list-style: none; cursor: pointer; line-height: 1; padding: 0 .6rem; border-radius: var(--r); min-height: 44px; display: flex; align-items: center; }
.ui-switch summary::-webkit-details-marker { display: none; }
.ui-switch summary:hover, .ui-switch[open] summary { background: var(--pink-soft); }
.ui-switch ul { position: absolute; right: 0; top: 100%; z-index: 20; margin: .3rem 0 0; padding: .35rem; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 12rem; transform-origin: top right; animation: rol-pop var(--rol-dur-ui) var(--rol-ease-out); }
.ui-switch li a { display: flex; gap: .5rem; align-items: center; min-height: 44px; padding: 0 .7rem; border-radius: var(--r); text-decoration: none; color: inherit; white-space: nowrap; }
.ui-switch li a:hover { background: var(--pink-soft); }
.ui-switch li a[aria-current] { font-weight: 700; }
.beta-chip { display: inline-block; align-self: center; border-radius: var(--r); padding: .05rem .55rem; font-size: .8125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--rol-moss); color: var(--rol-lincoln); }
.beta-banner .beta-chip { background: var(--ink); color: var(--bg); margin-right: .3rem; }
/* /compare: the price and feature tables. The features table is wider than
   a phone, so it scrolls inside its own box and the page never does. */
.compare-table caption { caption-side: bottom; text-align: left; padding-top: .5rem; }
.compare-table th[scope="row"] { font-weight: 700; white-space: nowrap; }
.compare-table thead th { border-bottom: 2px solid var(--line); vertical-align: bottom; }
.compare-table th[scope="row"], .compare-table td { border-top: 1px solid var(--line); padding: .45rem .5rem; vertical-align: top; }
.compare-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.compare-table tr.us th, .compare-table tr.us td { background: var(--pink-soft); }
.compare-table tr.us th { color: var(--pink); }
.compare-table tr.us .num { color: var(--pink-deep); font-size: 1.1rem; }
.compare-scroll { -webkit-overflow-scrolling: touch; border-radius: var(--r-lg); }
.compare-scroll:focus-visible { outline: 2px solid var(--pink-deep); outline-offset: 3px; }
.features-table { min-width: 760px; font-size: .92rem; }
.features-table th[scope="row"] { position: sticky; left: 0; background: var(--card); z-index: 1; }
.features-table tr.us th[scope="row"] { background: var(--pink-soft); }
.scroll-hint { display: none; }
.compare-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.compare-list { margin: 0; padding-left: 1.2rem; }
.compare-list li { margin-bottom: .6rem; }
.small-print { margin-top: 2rem; }
.small-print h2 { font-size: 1rem; color: var(--ink); }
.small-print a { overflow-wrap: anywhere; }
.compare-link { margin-top: .4rem; }
@media (prefers-color-scheme: dark) { .compare-table tr.us th, .compare-table tr.us .num { color: var(--pink); } }
@media (max-width: 760px) { .scroll-hint { display: block; } }

/* the paper (core/news.py): a reader per story, as Tales */
.paper .story { margin-bottom: 1.2rem; }
.paper .headline { font-size: 1.6rem; line-height: 1.35; margin: .3rem 0 .2rem; }
.paper .headline-reading { margin: 0 0 .4rem; }
.paper .hl-gloss summary { cursor: pointer; color: var(--muted); }
.paper .sub-card { margin: .8rem 0; border-top: 1px solid var(--line); padding-top: .6rem; }
.paper .sub-card > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.paper .newswords { margin: .4rem 0; padding-left: 1.2rem; line-height: 1.8; }
.paper-walk { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem 0; }
.paper-walk a { min-height: 44px; display: inline-flex; align-items: center; }
.news-archive { list-style: none; margin: 0; padding: 0; }
.news-archive li a { display: block; padding: .6rem .4rem; border-radius: var(--r); color: inherit; text-decoration: none; }
.news-archive li a:hover { background: var(--bg); }
.news-archive .hl { display: block; margin-top: .15rem; }
.compare p, .compare li, .small-print p { max-width: 68ch; }

/* Start here, one thing at a time: reading cards with a pager and a quick check,
   the chart behind tabs with its Test me, the words step's check */
body.paged .basics { display: block; max-width: 44rem; }
body.paged .basic { animation: pop .2s ease-out; }
.basic h2 { font-size: 1.35rem; margin: .1rem 0 .6rem; }
.card-count { margin: 0; }
body:not(.paged) .card-count { display: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .8rem; max-width: 44rem; margin: .2rem 0 1.2rem; }
.pager .dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pager .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.pager .dots i.seen { background: var(--leaf); }
.pager .dots i.on { background: var(--pink); transform: scale(1.25); }
.pager button[hidden] { display: inline-block !important; visibility: hidden; }
.quick-check { margin-top: 1rem; padding: .9rem 1rem; border-radius: var(--r-lg); background: var(--pink-soft); }
.qc-ask { margin: 0 0 .6rem; font-weight: 600; }
.qc-label { display: inline-block; margin-right: .3rem; padding: .05rem .5rem; border-radius: 3px; background: var(--pink); color: var(--on-pink); font-size: .8125rem; font-weight: 700; vertical-align: .1em; }
.qc-options { display: flex; flex-wrap: wrap; gap: .5rem; }
.qc-option { flex: 1 1 8rem; text-align: center; }
.qc-option[lang] { font-size: 1.35rem; }
.qc-option.right { background: var(--ok-soft); border-color: var(--ok); }
.qc-option.wrong { background: var(--bad-soft); border-color: var(--bad); opacity: .7; animation: shake .35s; }
.qc-why { margin: .7rem 0 0; }
.later-box summary, .note-box summary { cursor: pointer; font-weight: 700; }
.later-box .basic { margin-top: .8rem; }
.note-box p { margin: .5rem 0; }
.chart-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 .6rem; }
.chart-tabs button { min-width: 3.2rem; min-height: 44px; padding: .3rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 1.25rem; font-family: var(--jp); }
.chart-tabs button.on { background: var(--pink); border-color: var(--pink); color: var(--on-pink); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.chart-head h3 { margin: 0; }
.chart-test { margin: .7rem 0; padding: .7rem 1rem; border-radius: var(--r-lg); background: var(--pink-soft); }
.chart-test p { margin: .2rem 0; }
.test-target { font-size: 2rem; line-height: 1.2; display: flex; align-items: center; gap: .5rem; }
.test-done { font-size: 1.1rem; }
.chart.testing .cell .c-sub { visibility: hidden; }
.chart.testing .cell:hover { border-color: var(--pink); }
.cell.hit { background: var(--ok-soft); border-color: var(--ok); }
.cell.miss { background: var(--bad-soft); border-color: var(--bad); animation: shake .35s; }
.step-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--ink); min-height: 2.2rem; }
.step-line:hover { text-decoration: none; color: var(--pink); }
.step:not(.next) { padding-top: .7rem; padding-bottom: .7rem; }
.word-check .q-prompt { font-size: 1.8rem; font-family: var(--jp); margin: .2rem 0 .6rem; }
/* the hear button sits in the example's corner instead of taking a line of its own */
.basic .ex { position: relative; padding-right: 3.2rem; }
.basic .ex .say { position: absolute; right: .35rem; top: .3rem; }
/* under test: the prompt stays in view above the cells, and the chart's prose steps aside */
.chart .chart-test { position: sticky; top: .5rem; z-index: 5; box-shadow: 0 2px 0 var(--hair); }
.chart.testing > p.muted, .chart.testing .cell-note { display: none !important; }

/* Start here script lessons (start/script.html, start/lesson.html, lesson.js) */
.review-card { margin: .4rem 0 1rem; }
.script-chart .cell.met { border-color: var(--ok); background: var(--ok-soft); }
.lesson-stages { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0 0 .8rem; }
.lesson-stages button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .875rem; cursor: pointer; min-height: 2.2rem; }
.lesson-stages button.on { border-color: var(--pink); background: var(--pink-soft); font-weight: 700; }
.meet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: .5rem; margin: .4rem 0 1rem; }
.meet { display: grid; justify-items: center; gap: .15rem; padding: .6rem .3rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--ink); cursor: pointer; }
.meet:hover { border-color: var(--pink); }
.meet .m-char { font-family: var(--jp); font-size: 2.3rem; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.meet-grid.wide { grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); }
.meet-grid.wide .m-char { font-size: 2rem; }
.meet .m-sound { font-weight: 700; color: var(--pink); }
.meet .m-tip { text-align: center; line-height: 1.25; }
.flash-card { display: grid; place-items: center; gap: .4rem; width: min(100%, 16rem); min-height: 12rem; margin: .6rem auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--ink); cursor: pointer; box-shadow: var(--rol-shadow); }
.flash-card .fc-front { font-family: var(--jp); font-size: 4.5rem; font-weight: 600; line-height: 1; white-space: nowrap; }
.flash-card .fc-back { display: grid; justify-items: center; gap: .2rem; font-size: 1.6rem; }
.flash-card .fc-back[hidden] { display: none; }
.flash-card.flipped { border-color: var(--pink); }
.fc-hint { text-align: center; }
.fc-grade { justify-content: center; }
.hear-prompt { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: .4rem 0; }
.hear-sound { font-size: 1.8rem; }
.hear-choices { grid-template-columns: repeat(4, 1fr); }
.hear-choices .choice { font-family: var(--jp); font-size: 2rem; padding: .6rem .3rem; text-align: center; }
.lesson-pairs { grid-template-columns: repeat(3, 1fr); max-width: 24rem; }
.lesson-pairs .ptile.r .front { font-size: 1.45rem; font-weight: 700; }
.lesson-pairs .ptile.k .front { font-size: 2.2rem; }
.stage-end { margin-top: 1rem; }
.lesson-back { margin-top: .5rem; }
@media (max-width: 420px) { .hear-choices { grid-template-columns: repeat(2, 1fr); } .meet-grid { grid-template-columns: repeat(auto-fill, minmax(4.4rem, 1fr)); } }

/* the free level test (core/templates/placement.html) */
.choice.picked { border-color: var(--pink); }
.test-blocks { list-style: none; padding: 0; margin: .6rem auto; display: flex; flex-wrap: wrap; gap: .4rem .9rem; justify-content: center; }
.test-blocks li { display: flex; align-items: center; gap: .35rem; }
.level-card.suggested { border-color: var(--pink); box-shadow: inset 0 0 0 2px var(--pink); }
.test-note { text-align: center; }
.test-link { margin: .6rem 0 0; }
.test-intro p, .test-result p { max-width: 62ch; margin-left: auto; margin-right: auto; }

/* a mock exam (core/templates/mock.html, core/static/mock.js) */
.mock-intro p, .mock-what { max-width: 62ch; margin-left: auto; margin-right: auto; }
.mock-intro .lede { font-size: 1.15rem; font-weight: 700; }
.mock-what { text-align: left; margin-top: 1rem; }
.mock-what ul { padding-left: 1.1rem; margin: .4rem 0; }
.mock-what li { margin: .3rem 0; }
.mock-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .6rem; margin: 1rem auto; max-width: 40rem; }
.mock-levels .level-card { padding: .7rem .5rem; }
.mock-head h1 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.mock-clock { font-weight: 700; font-variant-numeric: tabular-nums; }
.mock-clock.low { color: var(--bad); }
.mock-progress { margin-top: .4rem; }
.mock-part { margin: 0 0 .2rem; }
.mock-sentence u.mark { text-decoration-thickness: 2px; text-underline-offset: .25em; }
.mock-sentence .slot { display: inline-block; min-width: 2.4em; border-bottom: 2px solid var(--ink); margin: 0 .2em; text-align: center; line-height: 1; }
.mock-sentence .slot.star { color: var(--pink); font-size: .8em; }
.mock-choices { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.mock-choices .choice { width: 100%; font-size: 1.2rem; }
.mock-choices .choice.picked { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); }
.mock-choices .num { display: inline-block; min-width: 1.4em; color: var(--muted); font-family: inherit; font-size: .85em; }
.mock-nav { justify-content: space-between; }
.mock-map { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: 1rem; align-items: center; }
.mock-map .map-head { font-weight: 700; color: var(--muted); font-size: .8125rem; margin: 0 .2rem 0 .5rem; }
.mock-map .map-cell { min-width: 2.75rem; min-height: 2.75rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; }
.mock-map .map-cell.done { background: var(--ok-soft); border-color: var(--ok); }
.mock-map .map-cell.here { outline: 2px solid var(--pink); outline-offset: 1px; }
.mock-result .mock-parts { max-width: 34rem; margin: 1rem auto; text-align: left; }
.mock-result .mock-parts tr.sec th { padding-top: .8rem; }
.mock-bar { display: inline-block; width: 8rem; height: .5rem; background: var(--hair); border-radius: 999px; overflow: hidden; vertical-align: middle; }
.mock-bar i { display: block; height: 100%; background: var(--ok); }
.mock-review-head { text-align: left; margin-top: 2rem; }
.mock-review { text-align: left; padding-left: 1.4rem; }
.mock-review li { margin: 0 0 1rem; padding: .6rem .8rem; border-radius: var(--r-lg); background: var(--bg); border-left: 3px solid var(--ok); }
.mock-review li.miss { border-left-color: var(--bad); }
.mock-review .mock-sentence { font-size: 1.25rem; margin: .2rem 0; }
.mock-answers { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .3rem 0 0; }
.mock-answers .right { color: var(--ok); font-weight: 700; }
.mock-answers .wrong { color: var(--bad); text-decoration: line-through; }
.mock-history { margin-top: 1.5rem; overflow-x: auto; }

/* the daily story (core/story.py): the story page and the reader */
.story-lede { margin-left: 0; }
.story-how h3 { margin: 0 0 .4rem; }
.story-how ol { margin: 0; padding-left: 1.3rem; max-width: 70ch; }
.story-how li { margin: .2rem 0; }
.story-form { display: flex; flex-direction: column; gap: .8rem; align-items: flex-start; }
.story-field { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.story-field select { max-width: 100%; }
.story-paces { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.story-paces legend { font-weight: 700; margin-bottom: .3rem; }
.story-paces .pill { display: inline-flex; gap: .35rem; align-items: baseline; flex-wrap: wrap; max-width: 100%; }
.story-card .story-gloss { margin: 0 0 .4rem; color: var(--muted); }
.story-had { margin: .4rem 0 0; padding-left: 1.4rem; }
.story-before .eyebrow { margin: 0 0 .2rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.story-before p:last-child { margin: 0; }
.story-audio { width: 100%; max-width: 520px; }
.story-again { margin: .8rem 0 1.2rem; gap: .6rem; align-items: center; }
.story-new { margin: .4rem 0 0; padding-left: 1.2rem; }
.story-new li { margin: .2rem 0; }
.story-walk { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.2rem 0; flex-wrap: wrap; }
.story-cta .row { gap: .6rem; }
.story-from-news { margin: 1rem 0; }
/* the first read: the text clean, nothing to hover or tap */
.text.clean .w { border-bottom: 0; cursor: auto; }
.text.clean .w:hover { background: none; }
.text.clean .sent .ja, .text.clean .sent:hover .ja, .text.clean .sent.open .ja { display: none; }
.story-ch.clean + .tip { display: none !important; }
