@font-face {
  font-family: 'Lilita One';
  src: url('/assets/lilita-one-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Condensed';
  src: url('/assets/barlow-condensed-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/assets/dm-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/assets/dm-sans-700.woff2') format('woff2');
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}
/*
 * Romaji: DM Sans draws a capital I like a small l, so "Iie" read as the English "lie". Kero
 * Romaji holds one glyph, DM Sans's I with bars (its stem, cap height and T-bar thickness), and
 * a romaji's other letters stay DM Sans. Made from dist/assets/dm-sans-*.woff2 with fontTools
 * (SIL Open Font License, as DM Sans).
 */
@font-face {
  font-family: 'Kero Romaji';
  src: url('/assets/fonts/kero-romaji-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0049;
}
@font-face {
  font-family: 'Kero Romaji';
  src: url('/assets/fonts/kero-romaji-700.woff2') format('woff2');
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0049;
}
@font-face {
  font-family: 'Kero Japanese';
  src: url('/assets/noto-sans-jp.woff2') format('woff2');
  font-display: swap;
}
/* The comic fonts load only on pages that use them. */
@font-face {
  font-family: 'Kero Comic';
  src: url('/assets/fonts/comic-neue-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Kero Comic';
  src: url('/assets/fonts/comic-neue-700-italic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Kero Impact';
  src: url('/assets/fonts/bangers-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  --ink: #392c20;
  --paper: #fffaf0;
  --yellow: #f6c747;
  --butter: #ffe6a3;
  --red: #b6382b;
  --blue: #8bd1d6;
  --muted: #685844;
  --line: #d8c9a9;
  --heading: 'Lilita One', sans-serif;
  --body: 'DM Sans', sans-serif;
  /* The body font with a capital I that never reads as l (Iie, not "lie"). */
  --romaji: 'Kero Romaji', 'DM Sans', sans-serif;
  --page: 1380px;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--body);
}
a {
  color: inherit;
  text-decoration: none;
}
button,
select {
  font: inherit;
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  font-family: var(--heading);
  font-weight: 400;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
h1 {
  font-size: clamp(3rem, 7vw, 6rem);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
h2 {
  font-size: clamp(2.5rem, 4.5vw, 4rem);
  margin-bottom: 24px;
}
h3 {
  font-size: 2rem;
}
h1 em,
h2 em {
  font-style: normal;
  color: var(--red);
}
p {
  margin-bottom: 18px;
}
a,
summary,
select,
button {
  -webkit-tap-highlight-color: transparent;
}
a:focus-visible,
summary:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 5px;
}
a:hover .link-label,
.text-link:hover,
.quiet-link:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}
.nowrap {
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  background: var(--ink);
  color: white;
  padding: 14px 20px;
  transform: translateY(-180%);
}
.skip-link:focus {
  transform: none;
}
.section {
  max-width: var(--page);
  margin: 0 auto;
  padding: 80px 6%;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.section-heading h2 {
  margin: 0;
}
.section-heading h2 > span {
  color: var(--red);
}
.eyebrow {
  display: block;
  font: 700 0.8125rem/1.5 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 56px;
  max-width: 100%;
  padding: 15px 24px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 18px 21px 17px 23px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 700;
  line-height: 1.4;
  transition:
    transform 0.18s,
    box-shadow 0.18s;
}
.button:hover {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 0 7px 0 var(--ink);
}
/* A button that lifts when hovered keeps a strip of its old place under it while it is up, so a
   pointer resting on its bottom edge never makes it flicker up and down (a Start button that
   appears under a still mouse did, every frame). No specificity, so a button placed by its own
   class keeps its place. */
:where(.button:hover, .drawing-button:not(:disabled):hover) {
  position: relative;
}
:where(.button:hover, .drawing-button:not(:disabled):hover)::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 4px;
}
.button.white {
  background: var(--paper);
}
.button span {
  flex-shrink: 0;
}
/* KEROTOWN's two stores side by side (src/components/store-link.ts), Google Play first: one row
   where both fit, one above the other where they do not. */
.store-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}
/* Each store's own official badge, unchanged and the same height as its twin: 56px for a page's
   main pair, 44px on the cards. Apple's and Google's rules: no recolouring, no extra frame. */
.store-badge {
  display: inline-block;
  flex: none;
  border-radius: 9px;
  line-height: 0;
  transition: transform 120ms ease;
}
.store-badge:hover {
  transform: translateY(-2px);
}
.store-badge:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.store-badge-image {
  display: block;
  width: auto;
  height: 100%;
}
.store-badge--big {
  height: 56px;
}
.store-badge--small {
  height: 44px;
}
@media (prefers-reduced-motion: reduce) {
  .store-badge {
    transition: none;
  }
  .store-badge:hover {
    transform: none;
  }
}
.watch-button {
  background: var(--red);
  color: white;
}
.play-icon {
  font-size: 0.875rem;
}
/* TikTok's note (src/components/channel-marks.ts), white on an ink circle, the size of the
   YouTube play circle beside it. Discord's speech bubble is the same size, ink on the site's
   blue. */
.tiktok-icon,
.discord-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
}
.discord-icon {
  background: var(--blue);
  color: var(--ink);
}
.tiktok-icon svg,
.discord-icon svg {
  display: block;
  width: 17px;
  height: 17px;
}
.quiet-link {
  display: block;
  width: fit-content;
  padding: 14px 0 4px;
  font-size: 0.9375rem;
  font-weight: 700;
  min-height: 44px;
}
.text-link,
.link-label {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-weight: 700;
  min-height: 44px;
}
.page-intro {
  padding-top: 52px;
  padding-bottom: 28px;
}
.page-intro h1 {
  margin: 0 0 18px;
}
.page-intro > p {
  max-width: 560px;
}
.site-header {
  max-width: var(--page);
  margin: 0 auto;
  padding: 22px 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-frog {
  width: 54px;
  height: 56px;
  position: relative;
}
.brand-frog img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: rotate(-8deg);
}
.brand-name {
  font: 400 2.15rem/0.9 var(--heading);
  letter-spacing: -0.025em;
}
.brand-name small {
  display: block;
  font: 700 0.625rem/1.5 var(--body);
  letter-spacing: 0.055em;
  margin-top: 5px;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  margin-left: auto;
  font-size: 0.9375rem;
  font-weight: 700;
}
.site-header nav > a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
}
.site-header nav > a[aria-current] {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 7px;
}
/* The way into learning stands out: Learn comes first, as a butter pill. */
.site-header nav > a.nav-learn {
  padding: 0 14px;
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.site-header nav > a.nav-learn:hover {
  background: var(--yellow);
}
/* KEROTOWN ONLINE, named in full (the owner, 28 October 2026): one line wherever the menu is one
   row, KEROTOWN over ONLINE on a phone (below). */
.site-header nav > a.nav-online {
  white-space: nowrap;
}
/* The red Watch tab (src/render/layout.ts): the site's own /watch/ page, so no outside-link
   arrow. On /watch/ it is the current page: underlined like the menu, with an ink ring. */
.watch-tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 19px 0 12px;
  flex-shrink: 0;
  border-radius: 30px;
  color: white;
  background: var(--red);
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
}
.watch-tab:hover {
  background: var(--ink);
}
.watch-tab[aria-current] {
  box-shadow:
    0 0 0 3px var(--paper),
    0 0 0 5px var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}
/* Kero's Discord beside it (src/render/layout.ts): the site's blue with ink words and the white
   speech-bubble mark, as the Discord button on /watch/, so it reads as the site's own way in. */
.discord-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 17px 0 8px;
  flex-shrink: 0;
  border-radius: 30px;
  color: var(--ink);
  background: var(--blue);
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
}
.discord-tab:hover {
  color: white;
  background: var(--ink);
}
.discord-tab .discord-icon {
  background: white;
  color: var(--ink);
}
.watch-tab-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: white;
  color: var(--red);
}
.watch-tab-icon svg {
  display: block;
  width: 62%;
  height: 62%;
  fill: currentColor;
}
.watch-tab:hover .watch-tab-icon {
  color: var(--ink);
}
.site-footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: 42px 6% 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 0.875rem;
  font-weight: 700;
}
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.copyright {
  flex-basis: 100%;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  padding-top: 14px;
}
.not-found {
  min-height: 65vh;
}
.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
/* A SLIM BAR, NOT A CARD. The bar is legal furniture and it should read as furniture: one line of
   text and two answers on a single row from about 700px up, and a two row stack on a phone. It
   used to be a paragraph on a chunky pair of buttons, which measured 237px on a 320px phone and
   103px on a desktop, and a notice that size stops being furniture and starts being a takeover.

   The bar is capped and scrolls: at 200% text on a small phone an uncapped one filled the screen
   and buried the page behind it. src/client/consent.ts reserves its measured height at the foot
   of the body so the footer never sits underneath it. */
.consent-banner {
  position: fixed;
  inset: auto 0 0;
  z-index: 900;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px 6%;
  background: var(--butter);
  border-top: 3px solid var(--ink);
}
.consent-banner[hidden] {
  display: none;
}
.consent-banner:focus-visible {
  outline: 3px solid #075693;
  outline-offset: -8px;
}
/* The basis is what decides the two layouts, and it is the only thing that does. Wider than about
   700px there is room for the line and both answers, so nothing wraps; narrower, the line claims
   its own row and the answers drop under it. No media query is needed for either. */
.consent-copy {
  flex: 1 1 340px;
  max-width: 640px;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
}
/* Grows into whatever the line leaves, so the answers sit at the far end of the bar on a wide
   screen and at the right of their own row on a phone. */
.consent-actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
/* ONE RULE FOR BOTH ANSWERS, AND NO VARIANT. Same size, same fill, same weight, and the decline
   is first: see the note in src/components/consent-banner.ts. The site's own button, cut down to
   the bar's scale. These two sit at 44px rather than the 56px .button floor, because the bar has
   to read as furniture and a 56px pair pushes it back towards the card it replaced; 44px is the
   floor the site's smaller controls keep and it still clears WCAG 2.5.5 at AAA. The wobble is
   scaled, not flattened: a perfect pill would make the only two buttons a first time visitor
   meets the only two that are not in the site's hand drawn voice. The rest plus the lift equals
   the hover offset, as it does on .button, so the shadow's bottom edge stays put. */
.consent-actions .button {
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 14px 17px 13px 19px;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 0.875rem;
  cursor: pointer;
}
.consent-actions .button:hover {
  box-shadow: 0 6px 0 var(--ink);
}
.consent-choice {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.consent-choice[hidden] {
  display: none;
}
.consent-choice:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}
/* Eight places beside the logo need a little less room from here down, and less again near 960px,
   where the menu moves under the logo. Each step starts where the one above it stops fitting on
   one line, KEROTOWN ONLINE in full. */
@media (max-width: 1260px) {
  .site-header {
    gap: 18px;
  }
  .site-header nav {
    gap: 18px;
  }
}
@media (max-width: 1160px) {
  .site-header {
    gap: 14px;
  }
  .site-header nav {
    gap: 14px;
    font-size: 0.875rem;
  }
}
/* Just over 960px the eight places still fit on one line beside the logo, a little closer. */
@media (max-width: 1080px) {
  .site-header {
    gap: 10px;
  }
  .site-header nav {
    gap: 7px;
    font-size: 0.8125rem;
  }
  .site-header nav > a.nav-learn {
    padding: 0 11px;
  }
}
/* Two rows from here down: the logo, the Watch tab and the Discord tab on top, the eight places
   under them, spread across the whole width so every one shows on a 320px phone without sideways
   scrolling. Eight places and both tabs only fit beside the logo from 1261px (since 5 November
   2026, when the Discord tab joined the header; before, from 961px). */
@media (max-width: 1260px) {
  .site-header {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 14px 5% 6px;
  }
  /* 44 px tall like every other tap target in the menu (audit F24). */
  .site-header .watch-tab {
    margin-left: auto;
    min-height: 44px;
    padding: 0 14px 0 9px;
    gap: 7px;
    font-size: 0.8125rem;
  }
  .site-header nav {
    order: 3;
    flex-basis: 100%;
    justify-content: space-between;
    gap: 2px 10px;
    margin-left: 0;
    font-size: 0.875rem;
  }
  .site-header nav > a.nav-learn {
    padding: 0 12px;
  }
  .brand-name {
    font-size: 1.9rem;
  }
  .brand-frog {
    width: 45px;
    height: 47px;
  }
  .brand-name small {
    font-size: 0.5625rem;
  }
}
/* From 1261px the eight places share the line with the logo and both tabs, a little closer, and
   from 1361px the Discord tab has its word too; between them it shows only its mark, a 44px circle
   (its name shows as a tooltip, and the home page has the labelled button). From 1260px down it
   sits on the top row with Watch, with its word. */
@media (min-width: 1261px) {
  .site-header {
    padding-left: min(6%, 80px);
    padding-right: min(6%, 80px);
  }
  .site-header nav {
    gap: 20px;
  }
}
@media (min-width: 1261px) and (max-width: 1360px) {
  .site-header .discord-tab {
    padding: 0 8px;
  }
  .site-header .discord-tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
@media (max-width: 1260px) {
  .site-header .discord-tab {
    padding: 0 13px 0 8px;
    gap: 7px;
    font-size: 0.8125rem;
  }
}
/* On the narrowest phones the logo, Watch and the Discord mark share the top row, a little closer
   on a 320px phone. */
@media (max-width: 400px) {
  .site-header .discord-tab {
    padding: 0 8px;
  }
  .site-header .discord-tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
/* Just over 640px the eight places still fit one row under the logo, a little smaller. */
@media (min-width: 641px) and (max-width: 700px) {
  .site-header nav {
    font-size: 0.8125rem;
  }
}
/* Eight places do not fit one row on a phone or a small tablet, so they sit in a row of four over a
   row of four (Learn, Manga, Fan art, Characters over KEROTOWN, KEROTOWN ONLINE, Japan, Ideas),
   spread across the whole width, so the header stays two rows tall and the home page's first tiles
   stay on the first screen. KEROTOWN ONLINE stands as KEROTOWN over ONLINE, no wider than KEROTOWN
   and inside its 44px tap, so the header is no taller. Each column is as wide as its longest name,
   so Characters and KEROTOWN never clip, and every place is a 44px tap. The header is the size
   container, so the menu itself can change its columns: by the header's width in its own em, with
   text at 200% a place is never narrower than its longest name, so the places go three a row, two
   a row or one a row, and none runs into another. */
@media (max-width: 640px) {
  .site-header {
    container: site-header / inline-size;
  }
  .site-header nav {
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: space-between;
    justify-items: center;
    gap: 0 4px;
  }
  .site-header nav > a {
    justify-content: center;
    min-width: 44px;
  }
  /* Its current mark is one bar under both words: an underline under KEROTOWN would run into
     ONLINE. */
  .site-header nav > a.nav-online {
    flex-direction: column;
    gap: 0;
    width: min-content;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }
  .site-header nav > a.nav-online[aria-current] {
    text-decoration: none;
  }
  .site-header nav > a.nav-online[aria-current]::after {
    content: '';
    align-self: stretch;
    margin-top: 4px;
    border-top: 3px solid;
  }
  @container site-header (width < 18em) {
    .site-header nav {
      grid-template-columns: repeat(3, auto);
    }
  }
  @container site-header (width < 13.5em) {
    .site-header nav {
      grid-template-columns: repeat(2, auto);
    }
  }
  @container site-header (width < 10em) {
    .site-header nav {
      grid-template-columns: auto;
      justify-content: center;
    }
  }
}
@media (max-width: 360px) {
  .site-header nav {
    font-size: 0.8125rem;
  }
  .site-header nav > a.nav-learn {
    padding: 0 9px;
  }
  .brand-name {
    font-size: 1.7rem;
  }
}
/* Four places a row on a 320 px phone, with room to spare. */
@media (max-width: 340px) {
  .site-header {
    column-gap: 5px;
  }
  .site-header .watch-tab {
    padding: 0 11px 0 8px;
  }
  .site-header nav {
    gap: 0 2px;
    font-size: 0.75rem;
  }
  .site-header nav > a.nav-learn {
    padding: 0 8px;
  }
}
@media (max-width: 700px) {
  .section {
    padding: 48px 6%;
  }
  .section-heading {
    gap: 8px;
    margin-bottom: 20px;
  }
  .page-intro {
    padding-top: 28px;
    padding-bottom: 18px;
  }
  .site-footer {
    padding-top: 32px;
  }
  .site-footer nav {
    gap: 4px 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
@media (forced-colors: active) {
  .button,
  .cast-card,
  .portrait,
  .manga-page,
  .manga-panel {
    box-shadow: none;
    border: 2px solid CanvasText;
  }
  a:focus-visible,
  summary:focus-visible,
  select:focus-visible,
  button:focus-visible {
    outline: 3px solid Highlight;
  }
}
/* How a drawing gets onto the art wall: Fan art and Draw. */
.share-steps {
  overflow-wrap: anywhere;
  display: grid;
  gap: 10px;
  margin: 18px 0 24px;
  padding: 0;
  list-style: none;
  counter-reset: share-step;
  font-size: 1rem;
  line-height: 1.5;
}
.share-steps li {
  position: relative;
  padding-left: 44px;
  counter-increment: share-step;
}
.share-steps li::before {
  content: counter(share-step);
  position: absolute;
  top: -2px;
  left: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fffaf0;
  font-weight: 800;
}
.share-steps a {
  display: inline-block;
  padding: 4px 0;
  font-weight: 700;
  text-decoration: underline;
}
/* The Continue button: home, /learn/ and /study/. */
.continue-box {
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
}
.continue-box[hidden] {
  display: none;
}
.continue-box .continue-go {
  max-width: 100%;
  text-align: left;
}
.continue-go span:first-child {
  flex-shrink: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Manga pages retain high-contrast ink, clear dialogue and native page anchors. */
.reader-site {
  background: white;
}
.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 15;
  flex-wrap: wrap;
  background: #fffaf0f5;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 4px max(12px, calc((100vw - 1360px) / 2));
  border-bottom: 1px solid #392c2025;
  font-size: 0.8125rem;
}
.reader-toolbar a,
.reader-help summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.reader-toolbar select {
  background: transparent;
  color: var(--ink);
  border: 1px solid #392c2050;
  border-radius: 4px;
  padding: 8px;
  min-height: 40px;
  min-width: 0;
  max-width: min(40vw, 280px);
  margin-left: auto;
  font: inherit;
  cursor: pointer;
}
.reader-help summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
.reader-help summary::after {
  content: '+';
  margin-left: 8px;
}
.reader-help[open] summary::after {
  content: '−';
}
.reader-help-content {
  position: absolute;
  top: 100%;
  right: 12px;
  width: min(380px, calc(100vw - 24px));
  padding: 20px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 #392c2025;
}
.reader-scene-links {
  display: grid;
  gap: 6px;
  max-height: 50vh;
  overflow: auto;
}
.reader-help-content p {
  font-size: 0.9375rem;
  margin: 0 0 12px;
}
.manga-reader {
  container: comic-reader / inline-size;
  --comic-gutter: 12px;
  --comic-font: 'Kero Comic', 'Comic Sans MS', cursive;
  --comic-size: clamp(1.0625rem, 1.5vw, 1.5rem);
  max-width: 1400px;
  padding: var(--comic-gutter) 20px 0;
  margin: 0 auto;
}
.manga-page {
  position: relative;
  margin-bottom: var(--comic-gutter);
  scroll-margin-top: max(65px, 4.5rem);
}
/* Dialogue shares the illustration cell; frame-specific positions live in content. */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--comic-gutter);
  align-items: start;
}
.manga-panel {
  --voice-colour: #587780;
  margin: 0;
  border: 2px solid var(--ink);
  background: white;
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-column: span 6;
  container-type: inline-size;
}
.voice-kero {
  --voice-colour: #886815;
}
.voice-goro {
  --voice-colour: #b6382b;
}
.comic-panel--wide,
.comic-panel--aside {
  grid-column: 1 / -1;
}
.comic-panel--large {
  grid-column: span 6;
}
.comic-panel--small {
  grid-column: span 6;
}
.panel-art {
  min-width: 0;
  grid-area: 1 / 1;
  margin: 0;
  background: #fffaf0;
}
.panel-art img {
  width: 100%;
  height: auto;
  object-fit: contain;
}
.manga-panel .comic-caption {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  padding: 0;
  min-width: 0;
  min-height: 0;
  pointer-events: none;
}
.comic-lettering {
  position: absolute;
  inset: 0;
}
.lettered--slim {
  --letter-width: 32%;
}
.lettered--narrow {
  --letter-width: 40%;
}
.lettered--medium {
  --letter-width: 49%;
}
.lettered--full {
  --letter-width: 94%;
}
.lettered--wide {
  --letter-width: 88%;
}
.lettered--top-left .speech-balloon {
  top: 4%;
  left: 3%;
}
.lettered--top-right .speech-balloon {
  top: 4%;
  right: 3%;
}
.lettered--bottom-left .speech-balloon {
  bottom: 4%;
  left: 3%;
}
.lettered--bottom-right .speech-balloon {
  bottom: 4%;
  right: 3%;
}
.speech-balloon {
  position: absolute;
  isolation: isolate;
  width: fit-content;
  max-width: var(--letter-width);
  min-width: 0;
  padding: clamp(12px, 2.2cqi, 24px) clamp(16px, 3.2cqi, 34px);
  pointer-events: auto;
  border: 2px solid var(--ink);
  border-radius: 46% 44% 45% 43% / 24px 25px 23px 26px;
  background: white;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
/* The responsive SVG draws one continuous contour, including the speaker tail.
   CSS balloons remain the no-script and enlarged-text fallback. */
.balloon-ink {
  display: none;
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  overflow: visible;
  pointer-events: none;
  z-index: -1;
}
.balloon-ink path {
  fill: #fffdf5;
  stroke: #493726;
  stroke-width: clamp(1.6px, 0.35cqi, 2.5px);
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.balloon--inked {
  border-color: transparent;
  background: transparent;
}
.balloon--inked .balloon-ink {
  display: block;
}
.balloon--inked::before,
.balloon--inked::after,
.balloon--inked .balloon-tail {
  display: none;
}
.speaker {
  font: 700 0.6875rem/1.4 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--voice-colour);
}
.dialogue {
  display: block;
  font: 700 var(--comic-size)/1.18 var(--comic-font);
  text-transform: uppercase;
  letter-spacing: 0;
  font-synthesis: none;
  overflow-wrap: normal;
  text-wrap: pretty;
  max-width: 34ch;
}
.lettered--slim .balloon--speech,
.lettered--narrow .balloon--speech {
  padding: clamp(10px, 2cqi, 22px) clamp(13px, 2.7cqi, 28px);
}
.lettered--slim .speech-balloon {
  padding-inline: 10px;
}
.balloon-tail {
  position: absolute;
  top: calc(100% - 3px);
  right: 24%;
  width: 27px;
  height: 27px;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 88% 100%);
}
.balloon-tail::after {
  content: '';
  position: absolute;
  inset: 0 3px 5px;
  background: white;
  clip-path: polygon(0 0, 100% 0, 88% 100%);
}
.tail--left .balloon-tail {
  right: auto;
  left: 22%;
  transform: scaleX(-1);
}
.tail--center .balloon-tail {
  left: calc(50% - 13px);
  right: auto;
}
.lettered--full .balloon--speech {
  padding-inline: 5px;
  border-radius: 30px / 20px;
}
.balloon--shout {
  --burst: polygon(
    5% 12%,
    20% 15%,
    23% 1%,
    36% 11%,
    46% 0,
    54% 10%,
    70% 0,
    76% 13%,
    93% 7%,
    92% 26%,
    100% 37%,
    94% 52%,
    100% 68%,
    88% 76%,
    90% 94%,
    72% 88%,
    66% 100%,
    52% 91%,
    38% 100%,
    31% 90%,
    13% 97%,
    14% 80%,
    1% 74%,
    7% 58%,
    0 44%,
    9% 31%
  );
  border: 0;
  border-radius: 0;
  padding: clamp(15px, 2.5cqi, 30px) clamp(17px, 3cqi, 36px);
  background: transparent;
}
.balloon--shout::before,
.balloon--shout::after {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: var(--burst);
  background: var(--ink);
  z-index: -2;
}
.balloon--shout::after {
  inset: 3px;
  background: white;
  z-index: -1;
}
.balloon--shout .dialogue {
  font-style: italic;
  max-width: 24ch;
}
.dialogue .spoken-emphasis {
  font-style: italic;
  font-weight: inherit;
}
.balloon--shout .balloon-tail {
  display: none;
}
.balloon--caption {
  border-radius: 0;
  background: #fff8de;
  padding: clamp(6px, 1cqi, 12px) clamp(9px, 1.6cqi, 18px);
  align-items: flex-start;
  text-align: left;
}
.balloon--caption .speaker {
  display: none;
}
.balloon--caption .dialogue {
  line-height: 1.18;
  max-width: 54ch;
}
.lettered--bottom-left .balloon-tail,
.lettered--bottom-right .balloon-tail {
  top: auto;
  bottom: calc(100% - 3px);
  transform: rotate(180deg);
}
.lettered--bottom-left .tail--left .balloon-tail,
.lettered--bottom-right .tail--left .balloon-tail {
  transform: rotate(180deg) scaleX(-1);
}
.panel-sfx {
  position: absolute;
  top: 4%;
  right: 4%;
  transform: rotate(-7deg);
  padding: 4px;
  font: italic 700 clamp(1.5rem, 5cqi, 3.5rem)/1 var(--comic-font);
  color: var(--yellow);
  -webkit-text-stroke: 1.5px var(--ink);
  paint-order: stroke fill;
  text-shadow: 2px 2px var(--ink);
  letter-spacing: 1px;
}
.lettered--top-left .panel-sfx,
.lettered--top-right .panel-sfx {
  top: auto;
  bottom: 4%;
}
.comic-caption .scene-caption {
  position: absolute;
  top: 3%;
  left: 3%;
  width: fit-content;
  max-width: 86%;
  padding: 4px 8px;
  margin: 0;
  font: 700 clamp(0.9375rem, 1.2vw, 1.125rem)/1.12 var(--comic-font);
  text-transform: uppercase;
  background: #fff8de;
  border: 1.5px solid var(--ink);
  text-align: left;
  z-index: 2;
}
.lettered--top-left .scene-caption,
.lettered--top-right .scene-caption {
  top: auto;
  bottom: 3%;
}
.comic-caption:has(.scene-caption) .panel-sfx {
  top: auto;
  bottom: 4%;
}
.lettered--bottom-right .comic-caption:has(.scene-caption) .panel-sfx {
  right: auto;
  left: 4%;
}
.manga-page--memory .balloon--speech {
  border-radius: 8px;
  text-align: left;
  align-items: flex-start;
  background: #fffaf0;
}
.manga-page--memory .balloon-tail {
  display: none;
}
.manga-watch {
  display: flex;
  justify-content: center;
  padding: 28px 6px 18px;
  scroll-margin-top: 90px;
}
.manga-watch .button {
  max-width: 100%;
  text-align: center;
}
.chapter-end {
  background: var(--ink);
  text-align: center;
  color: white;
  padding: 70px 25px 78px;
  scroll-margin-top: 70px;
}
.chapter-end h2 {
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.92;
  margin: 15px 0 30px;
}
.chapter-end h2 em {
  color: var(--yellow);
}
.chapter-end p {
  color: #e3e3e5;
}
.chapter-end .button {
  color: var(--ink);
  border-color: var(--yellow);
  box-shadow: 4px 4px 0 #fff;
}
.chapter-end .quiet-link {
  margin: 8px auto 0;
}
.reader-site .site-footer {
  background: var(--paper);
}
.episode-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  margin-bottom: 45px;
}
.episode-art {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 30px;
  box-shadow: 0 7px 0 var(--ink);
  transform: rotate(-2deg);
}
.episode-art img {
  width: 100%;
  border-radius: 27px;
}
.chapter-stamp {
  position: absolute;
  top: 18px;
  left: 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 9px 12px;
  background: var(--yellow);
  font: 400 1.5rem/1 var(--heading);
}
.episode-new {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--red);
  color: #fff;
  font: 400 1.2rem/1 var(--heading);
  letter-spacing: 0.04em;
}
.episode-copy {
  min-width: 0;
}
/* The end of an episode: its words, the lessons that teach them, then the next episode. */
.episode-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 16px;
  margin: 28px auto 0;
  padding: 26px 18px;
  max-width: 760px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--butter);
  text-align: center;
}
.episode-next h2 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
}
.episode-next-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.episode-next-words li {
  max-width: 100%;
}
/* At 200% text on a small phone a word and its romaji wrap inside the pill, not off the page. */
.episode-next-words a {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  align-items: baseline;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  text-decoration: none;
}
.episode-next-words [lang='ja'] {
  font-size: 1.15rem;
}
.episode-next-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.episode-next-lessons,
.episode-next-episode {
  margin: 0;
  font-weight: 700;
}
.episode-next-lessons a,
.episode-next-episode a {
  display: inline-block;
  min-height: 44px;
  padding: 10px 4px;
  text-decoration: underline;
}
.episode-copy h2 {
  font-size: clamp(2.5rem, 4vw, 3.6rem);
}
.episode-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.8125rem;
  margin-bottom: 24px;
}
.manga-library {
  padding-top: 12px;
}
@media (max-width: 700px) {
  .episode-feature {
    grid-template-columns: minmax(0, 1fr);
    gap: 33px;
  }
  .episode-art {
    margin-right: 7px;
  }
  .episode-copy h2 {
    font-size: 2.8rem;
  }
  .reader-toolbar {
    padding: 2px 8px;
    gap: 6px;
    font-size: 0.75rem;
  }
  .reader-toolbar select {
    flex: 1 1 4.5rem;
    width: 4.5rem;
    max-width: 37vw;
  }
  .manga-reader {
    --comic-gutter: 10px;
    padding: var(--comic-gutter) 8px 0;
  }
  .panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--comic-gutter);
    align-items: stretch;
  }
  .manga-panel {
    grid-column: span 1;
  }
  .comic-panel--wide,
  .comic-panel--aside,
  .comic-panel--mobile-wide {
    grid-column: 1 / -1;
  }
  .manga-panel .comic-caption {
    padding: 0;
  }
  .comic-panel--small {
    margin-inline: 0;
  }
  .speech-balloon {
    border-width: 1.5px;
  }
  .balloon-tail {
    width: 17px;
    height: 18px;
  }
  .balloon--shout::after {
    inset: 2px;
  }
  .chapter-end {
    padding: 55px 6%;
  }
  .chapter-end h2 {
    font-size: clamp(2.8rem, 12vw, 4.6rem);
  }
  .chapter-end p {
    font-size: 0.9375rem;
  }
}

/* Beginner reading: keep Japanese, romaji and meaning together. */
.japanese-reading {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.japanese-word {
  font:
    700 1.65rem/1.5 'Kero Japanese',
    sans-serif;
  overflow-wrap: anywhere;
}
.japanese-romaji {
  font: 700 1.0625rem/1.5 var(--body);
  color: var(--ink);
}
.japanese-meaning {
  font: 700 1.125rem/1.5 var(--body);
}
.pronunciation {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.listen-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 48px;
  min-width: 116px;
  max-width: 100%;
  padding: 12px 18px;
  font: 700 1rem/1.4 var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.listen-button:hover {
  background: white;
}
.listen-button:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 5px;
}
.listen-icon {
  font-size: 0.875rem;
  flex-shrink: 0;
}
.listen-button[hidden],
.pronunciation audio[hidden] {
  display: none;
}
.pronunciation audio {
  max-width: 100%;
  width: 260px;
  min-width: 0;
}
.audio-status {
  font-size: 0.875rem;
  max-width: 230px;
}
.audio-status:not(:empty) {
  margin-top: 9px;
}
.sensei-avatar {
  display: block;
  width: 72px;
  height: 72px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  overflow: hidden;
  background: #c6e5e7;
  flex-shrink: 0;
  position: relative;
}
.sensei-avatar img {
  width: 170%;
  max-width: none;
  height: auto;
  position: absolute;
  top: -2px;
  left: -35%;
}
@media (max-width: 700px) {
  .japanese-word {
    font-size: 1.5rem;
  }
  .sensei-avatar {
    width: 56px;
    height: 56px;
  }
}

.lesson-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--butter);
}
.lesson-illustration {
  margin: 0;
  min-width: 0;
  background: var(--paper);
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lesson-illustration img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.lesson-illustration figcaption {
  font-size: 1rem;
  line-height: 1.5;
  padding: 14px 22px 20px;
}
.lesson-feature-copy {
  min-width: 0;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  justify-content: center;
}
.lesson-feature-copy .japanese-word {
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
}
.lesson-feature-copy .japanese-meaning {
  font-size: 1.4rem;
}
.lesson-feature-copy .japanese-romaji {
  font-size: 1.2rem;
}
.sensei-tip {
  grid-column: 1/-1;
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-top: 2px solid var(--ink);
  background: var(--paper);
}
.sensei-tip h3 {
  margin: 0 0 5px;
  font: 700 1rem/1.4 var(--body);
}
.sensei-tip p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}
.sensei-tip > div {
  min-width: 0;
}
@media (max-width: 700px) {
  .lesson-feature {
    grid-template-columns: minmax(0, 1fr);
  }
  .lesson-illustration .eyebrow {
    margin: 20px 20px 12px;
  }
  .lesson-feature-copy {
    padding: 24px 20px;
  }
  .sensei-tip {
    align-items: flex-start;
    padding: 20px;
    gap: 12px;
  }
}

/* Dedicated vocabulary pages: complete artwork, real text, one player. */
.manga-page--lesson {
  background: #fff8e8;
}
.page-anchor {
  display: block;
  scroll-margin-top: 95px;
}
.lesson-feature {
  background: var(--lesson-colour, #ffe6a3);
}
.theme-coral {
  --lesson-colour: #ffd4bd;
}
.theme-mint {
  --lesson-colour: #d1ece0;
}
.theme-lavender {
  --lesson-colour: #e1def1;
}
.scene-caption {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 5px;
  font-weight: 400;
}
.word-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.word-jump > span {
  font-size: 0.875rem;
  font-weight: 700;
  margin-right: 6px;
}
.word-jump a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 24px;
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--paper);
}
.word-jump a:hover {
  background: var(--butter);
}
@media (max-width: 700px) {
  .lesson-feature {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The lesson is a quiet comic interlude, with Sensei's words in a speech balloon. */
.manga-page--lesson .lesson-feature {
  border-radius: 0;
  border-width: 2px;
}
.manga-page--lesson .lesson-feature-copy {
  margin: 24px;
  padding: 28px;
  border: 2px solid var(--ink);
  border-radius: 44% 46% 45% 42% / 20% 24% 20% 24%;
  background: white;
  align-items: center;
  text-align: center;
}
.manga-page--lesson .sensei-tip {
  border-top: 2px solid var(--ink);
}
@media (max-width: 700px) {
  .manga-page--lesson .lesson-feature-copy {
    margin: 16px;
    padding: 26px 20px;
    border-radius: 26px;
  }
}
@media (forced-colors: active) {
  .speech-balloon {
    border: 2px solid CanvasText;
  }
  .balloon--shout::before,
  .balloon--shout::after,
  .balloon-tail {
    display: none;
  }
}

/* Enlarged text can outgrow a phone panel. Reflow it without shrinking the type or artwork. */
@container (width < 18rem) {
  .manga-panel .comic-caption {
    grid-area: 2 / 1;
    padding: 16px;
    background: var(--paper);
  }
  .comic-caption .comic-lettering {
    position: static;
  }
  .comic-caption .speech-balloon {
    position: relative;
    inset: auto;
    max-width: 100%;
    padding: 16px 20px;
  }
  .comic-caption .scene-caption {
    position: static;
    max-width: 100%;
    margin-bottom: 12px;
  }
  .manga-panel .comic-caption .panel-sfx {
    position: static;
    display: block;
    transform: none;
    margin-bottom: 12px;
    /* A long effect (WHOOOOSH!) at 200% text would otherwise push the page sideways. */
    overflow-wrap: anywhere;
  }
  .comic-caption .balloon-tail {
    display: none;
  }
  /* The lettered corner offsets (left or right: 3%) would shift a transcript balloon sideways,
     past the frame (tiered panels keep their lettering on the art, placed by those offsets); and
     free lettering's italic punch line overhangs its box, so it keeps the transcript's margins. */
  .manga-panel:not(.comic-panel--tier) .comic-caption .speech-balloon {
    inset: auto;
  }
  .delivery--free .comic-caption .speech-balloon {
    padding-inline: 20px;
  }
}

/* Lesson copy belongs to the same comic; retain native Japanese and lowercase romaji. */
.manga-reader .lesson-feature-copy .japanese-meaning,
.manga-reader .lesson-illustration figcaption,
.manga-reader .sensei-tip h3,
.manga-reader .sensei-tip p {
  font-family: var(--comic-font);
  font-weight: 700;
}
.manga-reader .lesson-feature-copy .japanese-meaning {
  text-transform: uppercase;
  letter-spacing: 0;
}

/* Dialogue is lettered for the performance, at the scale of its own scene. */
.delivery--speech .dialogue,
.delivery--tremble .dialogue {
  font-size: clamp(1.0625rem, 2.8cqi, 2.375rem);
  line-height: 1.08;
}
.delivery--hushed .dialogue {
  font-size: clamp(1.0625rem, 2.7cqi, 2rem);
  line-height: 1.12;
}
.delivery--roar .dialogue {
  font:
    400 clamp(1.1875rem, 3.5cqi, 2.75rem)/1.02 'Kero Impact',
    var(--comic-font);
  letter-spacing: 0.015em;
}
.delivery-line {
  display: block;
  paint-order: stroke fill;
}
.delivery-line--small {
  font-size: max(1rem, 0.84em);
  line-height: 1.13;
}
.delivery-line--punch {
  font:
    400 1.4em/0.98 'Kero Impact',
    var(--comic-font);
  letter-spacing: 0.015em;
  padding: 0.04em 0;
}
.delivery--roar .speech-balloon {
  padding: clamp(13px, 2.2cqi, 30px) clamp(16px, 3.2cqi, 43px);
}
.delivery--hushed .speech-balloon {
  padding-block: clamp(12px, 2cqi, 24px);
}
.delivery--free .speech-balloon {
  border: 2px solid transparent;
  background: transparent;
  padding: clamp(8px, 1.4cqi, 18px) clamp(8px, 1.6cqi, 22px);
}
.delivery--free .speech-balloon::before,
.delivery--free .speech-balloon::after,
.delivery--free .balloon-tail,
.delivery--free .balloon-ink {
  display: none;
}
.delivery--free .dialogue {
  font:
    400 clamp(1.25rem, 4cqi, 3.25rem)/1.03 'Kero Impact',
    var(--comic-font);
  color: #fff8dc;
  -webkit-text-stroke: clamp(1.5px, 0.4cqi, 4px) #30241c;
  paint-order: stroke fill;
  text-shadow: none;
  overflow: visible;
}
.delivery--free .delivery-line--punch {
  font-size: 1.24em;
}
.delivery--free .delivery-line--small {
  font-family: var(--comic-font);
  font-weight: 700;
  font-size: max(1rem, 0.58em);
  line-height: 1.15;
}
.manga-panel .speech-balloon {
  transform: rotate(var(--letter-angle));
  transform-origin: center;
}
.lettered--top-left .speech-balloon {
  top: var(--letter-y, 4%);
  left: var(--letter-x, 3%);
}
.lettered--top-right .speech-balloon {
  top: var(--letter-y, 4%);
  right: var(--letter-x, 3%);
}
.lettered--bottom-left .speech-balloon {
  bottom: var(--letter-y, 4%);
  left: var(--letter-x, 3%);
}
.lettered--bottom-right .speech-balloon {
  bottom: var(--letter-y, 4%);
  right: var(--letter-x, 3%);
}
.manga-panel .comic-caption .effect--directed {
  top: var(--effect-y);
  left: var(--effect-x);
  right: auto;
  bottom: auto;
  transform: rotate(var(--effect-angle));
  transform-origin: center;
  max-width: 90%;
  font:
    400 clamp(1.65rem, var(--effect-size), 9rem)/0.95 'Kero Impact',
    var(--comic-font);
  letter-spacing: 0.015em;
  color: #ffdc58;
  -webkit-text-stroke: clamp(2px, 0.55cqi, 6px) #38291e;
  paint-order: stroke fill;
  text-shadow: none;
}
.manga-panel .comic-caption .effect--orange {
  color: #f17138;
}
.manga-panel .comic-caption .effect--paper {
  color: #fff5d8;
}
/* A reader who enlarges text gets a calm, complete transcript below the art. */
@container (width < 18rem) {
  .manga-panel .speech-balloon {
    transform: none;
  }
  .delivery--free .dialogue {
    color: var(--ink);
    -webkit-text-stroke: 0;
    text-shadow: none;
  }
  .manga-panel .comic-caption .effect--directed {
    position: static;
    transform: none;
  }
  .manga-panel .dialogue {
    overflow-wrap: anywhere;
  }
}

/* Reserve paper within selected panels so long captions cannot obscure small
   character limbs or the closing illustration’s existing lettering. */
@container (18rem <= width < 44rem) {
  .lettered--reserve-bottom .panel-art {
    padding-bottom: 92px;
    background: #fff7e1;
  }
  .lettered--reserve-bottom .speech-balloon {
    max-width: 94%;
    left: 3%;
    right: 3%;
    margin-inline: auto;
    bottom: 8px;
  }
}

/* Action descriptions stay available to assistive technology and can be shown
   below the artwork without covering dialogue or expressions. No script required. */
.description-choice {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-height: 44px;
  margin-block: 0.75rem;
  cursor: pointer;
}
.description-choice input {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
  accent-color: var(--ink);
}
main:has(#scene-descriptions:checked) .panel-description {
  grid-area: 3 / 1;
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
  margin: 0;
  padding: 1rem;
  border-top: 1px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.5;
}

/* A directed caption box (Episode 6's recap) borrows the opening box's grammar: a red rule,
   dark ink and a red Bangers punch line, so narration reads as a told story, not a label. */
.comic-panel--caption.delivery--speech .balloon--caption:has(.delivery-line--punch) {
  border-left: 5px solid #9f2b1f;
}
.comic-panel--caption.delivery--speech .delivery-line--punch {
  color: #9f2b1f;
  font-size: 1.3em;
  text-transform: uppercase;
}

/* On the smallest phones a two-line caption must stay clear of tight close-ups. */
@container (width < 20rem) {
  .comic-panel--caption.delivery--speech .delivery-line--punch {
    font-size: 1.12em;
  }
}

/* The introduction needs a solid reading surface over the busy flames. On small
   panels it becomes a paper strip inside the frame, keeping the artwork whole. */
.delivery--introduction .speech-balloon {
  top: 4%;
  left: 3%;
  max-width: 58%;
  border: 2px solid var(--ink);
  border-left: 6px solid #9f2b1f;
  border-radius: 0;
  padding: clamp(16px, 2cqi, 28px);
  background: #fff8de;
  transform: none;
}
.delivery--introduction .dialogue {
  color: #30241c;
  font: 700 clamp(1.125rem, 2cqi, 2rem)/1.4 var(--comic-font);
  text-transform: none;
  -webkit-text-stroke: 0;
}
.delivery--introduction .delivery-line + .delivery-line {
  margin-top: 0.55em;
}
.delivery--introduction .delivery-line--punch {
  color: #9f2b1f;
  font-size: clamp(2rem, 4.5cqi, 4rem);
  line-height: 1.12;
  text-transform: uppercase;
}
@container (width < 44rem) {
  .delivery--introduction .comic-caption {
    grid-area: 1 / 1;
    padding: 0;
    background: #fff8de;
    border-bottom: 2px solid var(--ink);
  }
  .delivery--introduction .comic-lettering {
    position: static;
  }
  .delivery--introduction .panel-art {
    grid-area: 2 / 1;
  }
  .delivery--introduction .speech-balloon {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 100%;
    border: 0;
    padding: 1rem 1.125rem;
    transform: none;
  }
  .delivery--introduction .dialogue,
  .delivery--introduction .delivery-line--punch {
    overflow-wrap: anywhere;
  }
}

/* At ordinary phone text sizes, lettering shares the artwork itself. Long lines
   receive wider frames; short exchanges and silent action keep the paired layout.
   Enlarged text retains the transcript reflow above instead of covering the scene. */
@media (max-width: 700px) {
  @container comic-reader (width >= 18.75rem) {
    .manga-panel .panel-art,
    .manga-panel .comic-caption {
      grid-area: 1 / 1;
      padding: 0;
      background: transparent;
      border: 0;
    }
    .manga-panel .comic-lettering {
      position: absolute;
      inset: 0;
    }
    .delivery--introduction .panel-art {
      position: relative;
    }
    .delivery--introduction .panel-art::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(#17100deb 0%, #17100dba 46%, transparent 85%);
    }
    .delivery--introduction .speech-balloon {
      position: absolute;
      inset: 6px 6px auto;
      width: auto;
      max-width: none;
      padding: 6px 8px;
      border: 0;
      background: transparent;
    }
    .delivery--introduction .dialogue {
      color: #fff8de;
      font-size: 1.0625rem;
      line-height: 1.25;
      text-shadow: 0 1px 2px #17100d;
    }
    .delivery--introduction .delivery-line + .delivery-line {
      margin-top: 0.3em;
    }
    .delivery--introduction .delivery-line--punch {
      color: #ffdc58;
      font-size: 1.5rem;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide)
      .speech-balloon {
      position: absolute;
      max-width: calc(100% - 12px);
      padding: 6px 8px;
      transform: none;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide):is(.lettered--top-left, .lettered--bottom-left)
      .speech-balloon {
      left: 6px;
      right: auto;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide):is(.lettered--top-right, .lettered--bottom-right)
      .speech-balloon {
      right: 6px;
      left: auto;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide):is(.lettered--top-left, .lettered--top-right)
      .speech-balloon {
      top: 6px;
      bottom: auto;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide):is(.lettered--bottom-left, .lettered--bottom-right)
      .speech-balloon {
      bottom: 6px;
      top: auto;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide)
      .dialogue {
      font-size: 1.0625rem;
      line-height: 1.12;
      overflow-wrap: anywhere;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide)
      .delivery-line {
      display: inline;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide)
      .delivery-line--punch {
      font-size: 1.15em;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide).delivery--free
      .dialogue {
      color: #fff8dc;
      -webkit-text-stroke: 1px #30241c;
    }
    :is(
        .comic-panel--half,
        .comic-panel--large,
        .comic-panel--small,
        .comic-panel--tier-shared
      ):not(.comic-panel--mobile-wide)
      .panel-sfx.effect--directed {
      position: absolute;
      top: clamp(8px, var(--effect-y), calc(100% - 2.4rem));
      left: clamp(6px, var(--effect-x), calc(100% - 6rem));
      margin: 0;
      max-width: calc(100% - 12px);
      font-size: clamp(1.5rem, 10cqi, 2.25rem);
      transform: rotate(clamp(-8deg, var(--effect-angle), 8deg));
    }
  }
}

/* Honour larger default or zoomed text: when two readable columns cannot fit,
   the same frames reflow to one column. rem tracks the reader's text size. */
@container comic-reader (width < 18.75rem) {
  .panel-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .manga-panel {
    grid-column: 1 / -1;
  }
}

/* Optional scene transitions and original fan credits extend the shared reader. */
.comic-scene-label {
  margin: 0 0 var(--comic-gutter);
  padding: 0.7rem 1rem;
  border: 2px solid var(--ink);
  background: #fff2bf;
  color: #30241c;
  font: 700 clamp(1rem, 2vw, 1.35rem)/1.35 var(--comic-font);
}
.manga-page--recap .panel-art img {
  filter: grayscale(1);
}
.manga-page--flashback .panel-art img {
  filter: sepia(0.7) saturate(0.85);
}

/* Printed-comic tiers: each row keeps one height while its panels keep their own shapes.
   Zero-height breaks start the wide, medium (tablet) or narrow rows, so one source order
   serves every layout. */
.panel-grid--tiers {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--comic-gutter);
  row-gap: 0;
  align-items: stretch;
}
.panel-grid--tiers > .manga-panel {
  box-sizing: border-box;
  /* Grow in proportion to the art's aspect ratio (times ten: a line whose grow factors sum
     below 1 would not fill its row). Panels in a row then share one height. Each panel's
     comic-shape class sets --panel-grow (comicPlacementCss), never a style attribute. */
  flex: var(--panel-grow, 17.778) 1 0px;
  margin-bottom: var(--comic-gutter);
  align-content: start;
}
.panel-grid--tiers > .tier-break {
  display: none;
  flex-basis: 100%;
  height: 0;
}
@container comic-reader (width >= 50rem) {
  .panel-grid--tiers > .tier-break--wide {
    display: block;
  }
}
@container comic-reader (40rem <= width < 50rem) {
  .panel-grid--tiers > .tier-break--medium {
    display: block;
  }
  /* A Japanese reading needs room on the art: its panel takes the whole tablet row. */
  .panel-grid--tiers > .japanese-panel {
    flex-basis: 100%;
  }
}
@container comic-reader (width < 40rem) {
  .panel-grid--tiers > .tier-break--narrow {
    display: block;
  }
}
/* Comic lettering stays on the art in every tier at normal text size, even where a panel is
   narrower than the enlarged-text reflow width. With enlarged text the reader container drops
   below 18.75rem, every panel takes a full row, and the reflow rules apply as elsewhere. */
@container comic-reader (width >= 18.75rem) {
  .panel-grid--tiers > .comic-panel--tier .comic-caption {
    grid-area: 1 / 1;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .panel-grid--tiers > .comic-panel--tier .comic-caption .comic-lettering {
    position: absolute;
    inset: 0;
  }
  .panel-grid--tiers > .comic-panel--tier .comic-caption .speech-balloon {
    position: absolute;
    /* The far side keeps the anchored side's inset, so a long line never runs into the frame. */
    max-width: calc(100% - 2 * var(--letter-x, 3%));
    padding: 7px 14px;
  }
  /* The drawn ink tail replaces the CSS triangle; keep the triangle only as the fallback. */
  .panel-grid--tiers
    > .comic-panel--tier
    .comic-caption
    .speech-balloon:not(.balloon--inked)
    .balloon-tail {
    display: block;
  }
  .panel-grid--tiers > .comic-panel--tier .comic-caption .panel-sfx:not(.effect--directed) {
    position: absolute;
    display: block;
    top: clamp(8px, 4%, 24px);
    right: 4%;
    left: auto;
    margin: 0;
    max-width: 88%;
    transform: rotate(-6deg);
  }
  /* Placed effects keep their authored spot (the panel-level enlarged-text reflow would
     otherwise drop them flat into the top-left corner on tablets and laptops). */
  .panel-grid--tiers > .comic-panel--tier .comic-caption .panel-sfx.effect--directed {
    position: absolute;
    display: block;
    margin: 0;
    top: clamp(8px, var(--effect-y), calc(100% - 2.4rem));
    left: clamp(6px, var(--effect-x), calc(100% - 6rem));
    right: auto;
    max-width: calc(100% - 12px);
    font-size: clamp(1.5rem, 10cqi, 2.25rem);
    transform: rotate(clamp(-8deg, var(--effect-angle), 8deg));
  }
  .panel-grid--tiers > .japanese-panel .comic-caption .speech-balloon {
    padding: 12px 22px 10px;
  }
  .panel-grid--tiers > .japanese-panel .japanese-reading {
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.1rem 0.6rem;
    text-align: center;
  }
  .panel-grid--tiers > .japanese-panel .japanese-word {
    flex-basis: 100%;
  }
  .panel-grid--tiers > .japanese-panel .pronunciation {
    align-items: center;
  }
  .panel-grid--tiers > .japanese-panel .listen-button {
    min-height: 34px;
    min-width: 96px;
    padding: 4px 14px;
    box-shadow: 0 2px 0 var(--ink);
  }
}
/* Shared phone rows letter 6px from the frame edge (see the max-width: 700px block above), so
   the far side keeps 6px as well. */
@media (max-width: 700px) {
  @container comic-reader (width >= 18.75rem) {
    .panel-grid--tiers > .comic-panel--tier-shared .comic-caption .speech-balloon {
      max-width: calc(100% - 12px);
    }
  }
}
/* On narrow screens a Japanese line, its reading and its Listen control, or a long line on a
   banner, sit in a paper strip under the complete picture. Such a panel shares its narrow row
   only with other strip panels (comicTierPlacements checks this): the pictures share one height,
   and each strip takes the rest of the row, so paired strips end level and a shorter line sits
   in the middle of its strip instead of over a band of blank paper. */
@container comic-reader (width < 40rem) {
  .panel-grid--tiers > .manga-panel:is(.japanese-panel, .lettered--reserve-responsive) {
    grid-template-rows: auto 1fr;
    background: #fff8de;
  }
  .panel-grid--tiers
    > .manga-panel:is(.japanese-panel, .lettered--reserve-responsive)
    .comic-caption {
    grid-area: 2 / 1;
    /* Unpositioned, so an effect measures from the panel (the picture's top), not the strip. */
    position: static;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    border-top: 2px solid var(--ink);
    background: #fff8de;
  }
  .panel-grid--tiers
    > .manga-panel:is(.japanese-panel, .lettered--reserve-responsive)
    .comic-caption
    .comic-lettering {
    position: static;
  }
  .panel-grid--tiers
    > .manga-panel:is(.japanese-panel, .lettered--reserve-responsive)
    .comic-caption
    .speech-balloon {
    position: relative;
    inset: auto;
    width: auto;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    padding: 0.7rem 1rem;
    background: #fff8de;
    /* Centred like a wrapped line, including a one-line caption (captions align left on art). */
    align-items: center;
    text-align: center;
  }
  /* A strip that shares its row is narrow: slimmer side margins and balanced lines keep a
     caption from stacking one word per line. */
  .panel-grid--tiers
    > .comic-panel--tier-shared:is(.japanese-panel, .lettered--reserve-responsive)
    .comic-caption
    .speech-balloon {
    padding-inline: 0.5rem;
    text-wrap: balance;
  }
  .panel-grid--tiers > .manga-panel.japanese-panel .japanese-reading {
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
  }
  /* With the words in a strip below, an effect belongs on the picture: pin it to its top. */
  .panel-grid--tiers
    > .manga-panel:is(.japanese-panel, .lettered--reserve-responsive)
    .comic-caption
    .panel-sfx:is(.effect--directed, :not(.effect--directed)) {
    top: clamp(8px, 4%, 24px);
    right: 4%;
    left: auto;
  }
  /* Outranks the on-art fallback tail rule above: a strip has no tail. */
  .panel-grid--tiers
    > .comic-panel--tier.manga-panel:is(.japanese-panel, .lettered--reserve-responsive)
    .comic-caption
    .speech-balloon
    .balloon-tail {
    display: none;
  }
}
/* Episode 6 letters its Japanese lines on layout pages, the Episode 1 way. In a panel narrower
   than 30rem (a phone row, a tablet half) a Japanese line with its romaji, English and Listen
   control is taller than any clear area of the 16:9 frame, so, as on tiered pages, it moves to a
   paper strip under the complete picture, in one compact row. Wider panels keep it on the art.
   A frame that keeps a clear half for its words (lettering.compact: the lesson circle) keeps the
   line there instead, in a smaller balloon, so the frame never reads as a captioned slide. */
@container (width < 30rem) {
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel:not(.lettered--compact)
    .comic-caption {
    grid-area: 2 / 1;
    position: static;
    padding: 0;
    border-top: 2px solid var(--ink);
    background: #fff8de;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel:not(.lettered--compact)
    .comic-lettering {
    position: static;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel:not(.lettered--compact)
    .speech-balloon {
    position: relative;
    inset: auto;
    width: auto;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    padding: 0.55rem 0.9rem;
    background: #fff8de;
    flex-flow: row wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem 1rem;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel:not(.lettered--compact)
    .japanese-reading {
    flex-flow: row wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0 0.6rem;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel:not(.lettered--compact)
    .listen-button {
    min-height: 40px;
    min-width: 96px;
    padding: 6px 14px;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel:not(.lettered--compact)
    :is(.balloon-tail, .balloon-ink) {
    display: none;
  }
}
/* The compact balloon on the clear half of the frame. Enlarged text (a panel under 18rem) takes
   the calm transcript below the art instead, like every other panel. */
@container (18rem <= width < 30rem) {
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel.lettered--compact
    .speech-balloon {
    max-width: 46%;
    padding: 7px 12px 9px;
    gap: 4px;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel.lettered--compact
    .japanese-reading {
    flex-flow: row wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0 0.4rem;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel.lettered--compact
    .japanese-word {
    flex-basis: 100%;
    font-size: clamp(1.125rem, 6.5cqi, 1.5rem);
    line-height: 1.2;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel.lettered--compact
    :is(.japanese-romaji, .japanese-meaning) {
    font-size: 0.875rem;
    line-height: 1.25;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel.lettered--compact
    .pronunciation {
    align-items: center;
  }
  .manga-reader:not(.manga-reader--cinematic)
    .panel-grid:not(.panel-grid--tiers)
    > .japanese-panel.lettered--compact
    .listen-button {
    gap: 6px;
    min-height: 34px;
    min-width: 88px;
    padding: 3px 12px;
    font-size: 0.875rem;
    box-shadow: 0 2px 0 var(--ink);
  }
}
/* Compact lettering (lettering.compact) on a frame with a small clear area: in a phone-sized
   panel the type keeps shrinking with the frame below its usual 17px phone size (to 14px at the
   least), so on a 320px phone the words stay where they sit at 390px instead of growing over a
   face. Enlarged text (a panel under 18rem) keeps the transcript reflow above. */
@container (18rem <= width < 30rem) {
  .manga-panel.lettered--compact .dialogue {
    font-size: clamp(0.875rem, 4.8cqi, 1.0625rem);
  }
  .manga-panel.lettered--compact .delivery-line--small {
    font-size: max(0.875rem, 0.84em);
  }
  .manga-panel.lettered--compact .balloon--shout {
    padding: clamp(10px, 3.4cqi, 15px) clamp(12px, 4cqi, 17px);
  }
}
/* A line run on along a clear band of the art, such as a floor (lettering.oneLine). */
.lettered--one-line .delivery-line {
  display: inline;
}
/* The smallest phones cannot fit a narration box inside half a row, or any balloon inside a
   slim share of one; those panels take full rows there. Wordless panels stay paired. */
@container comic-reader (width < 22rem) {
  .panel-grid--tiers
    > .comic-panel--tier-shared:has(.balloon--caption):not(.lettered--reserve-responsive) {
    flex-basis: 100%;
  }
}
@container comic-reader (width < 20rem) {
  .panel-grid--tiers > .comic-panel--tier-slim:has(.speech-balloon) {
    flex-basis: 100%;
  }
}
@container comic-reader (width < 18.75rem) {
  .panel-grid--tiers > .manga-panel {
    flex-basis: 100%;
  }
  .panel-grid--tiers > .tier-break {
    display: none;
  }
}
.panel-credit {
  grid-area: auto / 1;
  margin: 0;
  padding: 0.7rem 1rem;
  background: #fff8de;
  font-size: 1rem;
  overflow-wrap: anywhere;
  border-top: 2px solid var(--ink);
}
.panel-credit a {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.chapter-navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  border-block: 2px solid var(--ink);
  margin-block: 1rem;
}
.chapter-navigation a {
  max-width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  text-decoration: underline;
}
/* Opt-in paper strips preserve complete close-ups and room for Japanese controls.
   These selectors also win over the compact paired-panel treatment on phones. */
.manga-panel.lettered--reserve-below {
  align-content: start;
  background: #fff8de;
}
.manga-panel.lettered--reserve-below .panel-art {
  grid-area: 1 / 1;
  padding: 0;
}
.manga-panel.lettered--reserve-below .comic-caption {
  grid-area: 2 / 1;
  padding: 0;
  border: 0;
  border-top: 2px solid var(--ink);
  background: #fff8de;
}
.manga-panel.lettered--reserve-below .comic-caption .comic-lettering {
  position: static;
}
.manga-panel.lettered--reserve-below .comic-caption .speech-balloon {
  position: relative;
  inset: auto;
  width: auto;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
  padding: 0.8rem 1rem;
  background: #fff8de;
}
.manga-panel.lettered--reserve-below .comic-caption .dialogue {
  font: 700 clamp(1.125rem, 2cqi, 1.7rem)/1.35 var(--comic-font);
  color: #30241c;
  overflow-wrap: anywhere;
}
.manga-panel.lettered--reserve-below .speaker {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
  clip-path: none;
  overflow: visible;
  white-space: normal;
  margin: 0 0 0.35rem;
  font-size: 0.875rem;
  color: #493726;
}
.manga-panel.lettered--reserve-below .balloon-tail {
  display: none;
}

/* Comic spreads: close dialogue beats, with full-width space for the big reveals. */
.manga-reader--cinematic {
  max-width: 1840px;
  padding-inline: 8px;
  --comic-gutter: 10px;
}
.manga-reader--cinematic > :not(.manga-page--splash) {
  max-width: 1120px;
  margin-inline: auto;
}
.manga-reader--cinematic .panel-grid {
  align-items: stretch;
}
.manga-reader--cinematic .manga-page {
  --panel-paper: #fff8e5;
  padding: 0;
  margin-bottom: 18px;
}
.manga-reader--cinematic .manga-page:has(.comic-transition--underwater) {
  --panel-paper: #e7f2ed;
}
.manga-reader--cinematic .manga-page:has(.comic-transition--town) {
  --panel-paper: #ffebce;
}
.manga-reader--cinematic .manga-page:has(.comic-transition--ancient) {
  --panel-paper: #ececdd;
}
/* Silent frames hug the complete artwork instead of stretching into empty paper. */
.manga-reader--cinematic
  .manga-page:not(.manga-page--gallery)
  .manga-panel:not(:has(.speech-balloon)) {
  align-self: start;
}
.manga-reader--cinematic .manga-panel:not(:has(.speech-balloon)) .comic-caption {
  position: absolute;
  inset: 0;
  grid-area: 1 / 1;
  padding: 0;
  background: transparent;
}
.manga-reader--cinematic .manga-panel:not(:has(.speech-balloon)) .comic-lettering {
  position: absolute;
  inset: 0;
}
.manga-reader--cinematic .manga-panel:not(:has(.speech-balloon)) .panel-sfx {
  position: absolute;
  top: clamp(12px, 4%, 28px);
  right: 4%;
  max-width: 88%;
  margin: 0;
  transform: rotate(-5deg);
}
@container comic-reader (width < 50rem) {
  .manga-reader--cinematic .comic-panel--mobile-wide {
    grid-column: 1 / -1;
  }
}
/* Enlarged text on a tablet or laptop makes the reader as narrow, in rem, as a phone, and a frame
   half a row wide letters its words in a transcript strip under the art. Frames then pair as they
   do on phones: a captioned frame takes a full row beside a silent one (mobileWidePanels), a pair
   of strips fills its row and ends level, and a silent frame keeps its sound effect on the art,
   so no row ends ragged over a gap. Phones keep their own rules (max-width: 700px). */
@container comic-reader (width < 40rem) {
  .manga-reader:not(.manga-reader--cinematic) .comic-panel--mobile-wide {
    grid-column: 1 / -1;
  }
}
@media (min-width: 701px) {
  @container comic-reader (width < 40rem) {
    .manga-reader:not(.manga-reader--cinematic) .panel-grid:not(.panel-grid--tiers) {
      align-items: stretch;
    }
    .manga-reader:not(.manga-reader--cinematic) .panel-grid:not(.panel-grid--tiers) > .manga-panel {
      grid-template-rows: auto 1fr;
    }
    @container (width < 18rem) {
      .manga-reader:not(.manga-reader--cinematic)
        .manga-panel:not(:has(.speech-balloon))
        .comic-caption {
        grid-area: 1 / 1;
        padding: 0;
        background: transparent;
      }
      .manga-reader:not(.manga-reader--cinematic)
        .manga-panel:not(:has(.speech-balloon))
        .comic-caption
        .comic-lettering {
        position: absolute;
        inset: 0;
      }
      .manga-reader:not(.manga-reader--cinematic)
        .manga-panel:not(:has(.speech-balloon))
        .comic-caption
        .panel-sfx {
        position: absolute;
        top: clamp(8px, 4%, 24px);
        right: 4%;
        left: auto;
        max-width: 88%;
        margin: 0;
        transform: rotate(-6deg);
      }
    }
  }
}
.manga-reader--cinematic .comic-scene-label {
  width: fit-content;
  max-width: 100%;
  padding: 0.35rem 0.65rem;
  margin-bottom: 8px;
  font-size: 1rem;
  border-width: 2px;
}
.manga-reader--cinematic .manga-panel.lettered--reserve-responsive {
  background: var(--panel-paper);
  grid-template-rows: auto 1fr;
  align-content: start;
}
.manga-reader--cinematic .lettered--reserve-responsive .panel-art {
  grid-area: 1 / 1;
  padding: 0;
}
.manga-reader--cinematic .lettered--reserve-responsive .comic-caption {
  grid-area: 2 / 1;
  padding: 0.45rem;
  border: 0;
  background: var(--panel-paper);
  display: grid;
  align-items: center;
}
.manga-reader--cinematic .lettered--reserve-responsive .comic-lettering {
  position: static;
}
.manga-reader--cinematic .manga-panel.lettered--reserve-responsive .speech-balloon {
  position: relative;
  inset: auto;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--ink);
  border-radius: 45%;
  background: white;
  transform: none;
  box-shadow: none;
}
.manga-reader--cinematic .manga-panel.lettered--reserve-responsive .balloon--caption {
  border-radius: 0;
  background: #fff7d6;
}
.manga-reader--cinematic .manga-panel.lettered--reserve-responsive .dialogue {
  font: 700 1.0625rem/1.2 var(--comic-font);
  color: #30241c;
  overflow-wrap: anywhere;
}
.manga-reader--cinematic .lettered--reserve-responsive .balloon-tail {
  display: none;
}
.manga-reader--cinematic .manga-page--splash {
  margin-block: 28px;
}
/* Full-width title panels mark a change of place, time or point of view. */
.comic-transition {
  --scene-dark: #302a35;
  --scene-light: #765347;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(112px, 14cqi, 176px);
  margin-bottom: 12px;
  padding: clamp(18px, 3cqi, 32px);
  border: 3px solid var(--ink);
  background:
    radial-gradient(ellipse at 25% 100%, var(--scene-light), transparent 75%), var(--scene-dark);
  color: #fff2c6;
}
.comic-transition::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, #fff3d518 1px, transparent 1.5px),
    repeating-conic-gradient(from 10deg at 30% 100%, transparent 0deg 14deg, #fff4d40b 14deg 17deg);
  background-size:
    6px 6px,
    100% 100%;
}
.comic-transition::after {
  content: '';
  position: absolute;
  z-index: -1;
  right: -38px;
  top: -85px;
  width: 260px;
  height: 260px;
  border: 3px solid #ffe6b42b;
  border-radius: 50%;
  box-shadow:
    0 0 0 22px #ffe6b410,
    0 0 0 46px #ffe6b40c;
  pointer-events: none;
}
.comic-transition h2 {
  margin: 0;
  max-width: 100%;
  font:
    400 clamp(2.125rem, 5.2cqi, 4.75rem)/1.08 'Kero Impact',
    sans-serif;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #241c21;
  overflow-wrap: anywhere;
}
.comic-transition p {
  max-width: 65ch;
  margin: 10px 0 0;
  color: #fff8df;
  font: 700 clamp(1.0625rem, 1.65cqi, 1.375rem)/1.4 var(--comic-font);
}
.comic-transition--underwater {
  --scene-dark: #06344c;
  --scene-light: #17677a;
}
.comic-transition--underwater::after {
  top: 22px;
  right: 8%;
  width: 48px;
  height: 48px;
  border-color: #b8f8ff66;
  box-shadow:
    68px 60px 0 -8px #9de3ed29,
    -70px 80px 0 -15px #9de3ed55,
    100px -32px 0 -12px #9de3ed33;
}
.comic-transition--town {
  --scene-dark: #52292c;
  --scene-light: #8c472e;
}
.comic-transition--town::after {
  border-radius: 0;
  transform: rotate(35deg);
}
.comic-transition--ancient {
  --scene-dark: #343226;
  --scene-light: #6d5a2c;
}
.comic-transition--memory {
  --scene-dark: #323a54;
  --scene-light: #685b7f;
}
.comic-transition--threat {
  --scene-dark: #251c3b;
  --scene-light: #763c56;
  color: #ffe3b7;
}

/* A softly lit gallery wall, with dimensional frames around complete originals. */
.manga-reader--cinematic .manga-page--gallery {
  padding: clamp(14px, 2vw, 24px) clamp(14px, 2vw, 24px) 22px;
  border: 3px solid #615444;
  box-shadow: inset 0 0 0 5px #f4ecd380;
  background-color: #d5dfd3;
  background-image:
    radial-gradient(ellipse at 17% 32%, #fffbed, transparent 35%),
    radial-gradient(ellipse at 50% 32%, #fffbed, transparent 35%),
    radial-gradient(ellipse at 83% 32%, #fffbed, transparent 35%),
    repeating-linear-gradient(
      90deg,
      transparent 0 calc(33.333% - 2px),
      #77958425 calc(33.333% - 2px) 33.333%
    ),
    radial-gradient(circle, #69776312 1px, transparent 1.5px);
  background-size:
    100% 100%,
    100% 100%,
    100% 100%,
    100% 100%,
    5px 5px;
}
.gallery-title {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 14px;
  padding: 8px 18px;
  border: 3px double #725b38;
  background: #fff0be;
  box-shadow: 0 4px 8px #392c2026;
  color: var(--ink);
  text-align: center;
  font:
    400 clamp(2.5rem, 6cqi, 4.25rem)/1.08 'Kero Impact',
    sans-serif;
}
.comic-page-note {
  margin: 0 0 20px;
  max-width: 60ch;
  font: 400 0.9375rem/1.5 var(--body);
}
.manga-page--gallery .comic-page-note {
  max-width: 40ch;
  margin: 0 auto 26px;
  color: #392c20;
  text-align: center;
  font: 700 clamp(1.25rem, 2.1cqi, 1.75rem)/1.3 var(--comic-font);
}
.manga-page--gallery .panel-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 20px;
  align-items: end;
}
.manga-page--gallery .manga-panel {
  --gallery-frame: #b38a4f;
  --gallery-art-height: 180px;
  grid-column: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.manga-page--gallery .manga-panel:nth-child(3n + 2) {
  --gallery-frame: #916750;
}
.manga-page--gallery .manga-panel:nth-child(3n) {
  --gallery-frame: #697869;
}
.manga-page--gallery .panel-art {
  grid-area: 1 / 1;
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  padding: 9px;
  border: 2px solid #59483a;
  background: linear-gradient(135deg, #fff4c899, transparent 40%, #241b2059), var(--gallery-frame);
  box-shadow:
    inset 2px 2px 0 #fff2c77d,
    inset -2px -2px 0 #39271e80,
    3px 5px 7px #392c2040;
}
.manga-page--gallery .panel-art a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--gallery-art-height) + 8px);
  max-width: 100%;
  padding: 3px;
  border: 1px solid #63513a;
  background: #fff3d4;
  box-shadow:
    0 0 0 1px #ffeabb99,
    inset 1px 1px 3px #392c203d;
}
.manga-page--gallery .panel-art img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: var(--gallery-art-height);
  object-fit: contain;
}
.manga-page--gallery .panel-credit {
  grid-area: 2 / 1;
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 0;
  padding: 3px 10px;
  border: 2px solid #59483a;
  background: #ffe9a6;
  box-shadow: 2px 2px 0 #59483a;
  font: 700 1.0625rem/1.3 var(--body);
}
.manga-page--gallery .creator-channel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}
.manga-page--gallery .fan-art-window {
  position: relative;
  display: block;
  width: var(--gallery-art-height);
  max-width: 100%;
  overflow: hidden;
}
/* The site is served with `style-src 'self'` and no 'unsafe-inline', so a style
   attribute on the span is dropped before it reaches the page and the window
   collapses to nothing. A crop therefore has to be declared here, where the
   stylesheet is same origin and allowed. The generic rules below still read the
   custom properties; only their source moves.

   To crop another fan artwork, add a block like this one named after its image
   and convert its `focus` from content/artwork.ts:
     --art-width: 10000 / focus.width, as a percentage
     --art-x:     -focus.left, a percentage of the image's own width
     --art-y:     -focus.top, a percentage of the image's own height
   BomberGaming: focus { left: 22, top: 25.5, width: 40, aspectRatio: 1 }. */
.manga-page--gallery .fan-art-window--fan-bomber-kero {
  --art-width: 250%;
  --art-x: -22%;
  --art-y: -25.5%;
  aspect-ratio: 1;
}
.manga-page--gallery .panel-art .fan-art-window img {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--art-width);
  max-width: none;
  max-height: none;
  transform: translate(var(--art-x), var(--art-y));
}
/* One featured original balances the six smaller frames without an orphaned row. */
.manga-page--gallery .manga-panel.comic-panel--large {
  --gallery-frame: #b38a4f;
  grid-column: 1 / -1;
  width: 100%;
  max-width: 660px;
  justify-self: center;
  align-self: center;
}
.manga-page--gallery .comic-panel--large .panel-art {
  width: 100%;
}
.manga-page--gallery .comic-panel--large .panel-art a {
  height: auto;
}
.manga-page--gallery .comic-panel--large .panel-art img {
  width: 100%;
  max-height: none;
}
@container comic-reader (width >= 60rem) {
  .manga-page--gallery:has(.comic-panel--large) .panel-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .manga-page--gallery .manga-panel.comic-panel--large {
    grid-column: span 2;
    grid-row: span 2;
  }
  .manga-page--gallery .manga-panel:not(.comic-panel--large) .panel-credit {
    font-size: 1rem;
    padding-inline: 6px;
  }
  .manga-page--gallery .manga-panel:not(.comic-panel--large) .creator-channel > span {
    display: none;
  }
}
@container comic-reader (width < 45rem) {
  .manga-page--gallery .panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }
  .manga-page--gallery .manga-panel {
    --gallery-art-height: 125px;
  }
  .manga-page--gallery .panel-art {
    padding: 6px;
  }
  .manga-page--gallery .panel-credit {
    padding-inline: 5px;
    font-size: 1rem;
  }
  .manga-page--gallery .creator-channel {
    gap: 4px;
  }
  .manga-page--gallery .creator-channel > span {
    display: none;
  }
}
@container comic-reader (width < 18rem) {
  .manga-page--gallery .panel-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .manga-page--gallery .manga-panel {
    --gallery-art-height: 180px;
  }
}

/* Above-art dialogue stays inside each frame; enlarged text and phones use the
   same compact bubbles beneath the art, without covering characters. */
@container comic-reader (width >= 50rem) {
  .manga-reader--cinematic .manga-panel.lettered--reserve-responsive:not(.japanese-panel) {
    grid-template-rows: auto;
  }
  .manga-reader--cinematic .lettered--reserve-responsive:not(.japanese-panel) .comic-caption {
    grid-area: 1 / 1;
    padding: 0;
    background: transparent;
  }
  .manga-reader--cinematic .lettered--reserve-responsive:not(.japanese-panel) .comic-lettering {
    position: absolute;
  }
  .manga-reader--cinematic
    .manga-panel.lettered--reserve-responsive:not(.japanese-panel)
    .speech-balloon {
    position: absolute;
    inset: auto auto 3% 3%;
    margin: 0;
    max-width: 72%;
    padding: 0.5rem 1rem;
  }
  .manga-reader--cinematic
    .manga-panel.lettered--reserve-responsive:not(.japanese-panel).lettered--top-left
    .speech-balloon {
    top: 3%;
    bottom: auto;
  }
  .manga-reader--cinematic
    .manga-panel.lettered--reserve-responsive:not(.japanese-panel).lettered--top-right
    .speech-balloon {
    inset: 3% 3% auto auto;
  }
  .manga-reader--cinematic
    .manga-panel.lettered--reserve-responsive:not(.japanese-panel).lettered--bottom-right
    .speech-balloon {
    left: auto;
    right: 3%;
  }
  .manga-reader--cinematic .manga-panel.lettered--reserve-responsive .dialogue {
    font-size: clamp(1.0625rem, 3.3cqi, 1.4rem);
  }
  .manga-reader--cinematic .manga-page--splash .speech-balloon {
    max-width: 35rem;
  }
}
/* Tall frames sit in a printed comic spread; decorative margins disappear on phones. */
.comic-lesson-spread {
  --margin-paper: #fff0bd;
  --margin-colour: #b6651e;
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 600px) minmax(0, 1fr);
  padding-block: 18px;
  background-color: var(--margin-paper);
  background-image:
    radial-gradient(
      circle,
      color-mix(in srgb, var(--margin-colour) 24%, transparent) 1px,
      transparent 1.5px
    ),
    repeating-conic-gradient(from 10deg at 50% 48%, transparent 0deg 13deg, #ffffff60 13deg 15deg);
  background-size:
    7px 7px,
    100% 100%;
}
.comic-lesson-spread--sugoi {
  --margin-paper: #f7dbe1;
  --margin-colour: #b14a65;
}
.comic-lesson-spread--utae {
  --margin-paper: #e5e5f3;
  --margin-colour: #615878;
}
.comic-lesson-spread > .comic-lesson {
  grid-area: 1 / 2;
  z-index: 1;
}
.comic-margin-art {
  display: none;
  min-width: 0;
  pointer-events: none;
  color: var(--margin-colour);
}
.comic-margin-word {
  font:
    400 clamp(2rem, 4.7cqw, 3.5rem)/1 'Kero Impact',
    sans-serif;
  writing-mode: vertical-rl;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(-10deg);
  color: var(--ink);
  text-shadow: 3px 3px 0 #fff8e8;
}
.comic-margin-symbol {
  font:
    400 clamp(4rem, 12cqw, 9rem)/1 'Kero Impact',
    sans-serif;
  transform: rotate(-12deg);
  color: var(--margin-paper);
  -webkit-text-stroke: 2px var(--margin-colour);
  text-shadow: 5px 5px 0 #ffffffb3;
}
.comic-margin-art--right .comic-margin-symbol:last-child {
  transform: rotate(14deg);
}
@container (min-width: 64rem) {
  .comic-margin-art {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 48px 14px;
  }
  .comic-margin-art--left {
    grid-area: 1 / 1;
  }
  .comic-margin-art--right {
    grid-area: 1 / 3;
  }
}

/* A single illustrated comic frame. The lower row reserves the characters’
   full space, so larger text can grow upward without covering the drawing. */
.comic-lesson {
  container-type: inline-size;
  width: min(100%, 600px);
  margin-inline: auto;
  border: 3px solid var(--ink);
  background: #fff6df;
  box-shadow: 4px 4px 0 var(--ink);
}
.comic-lesson-scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.comic-lesson-scene::after {
  content: '';
  grid-area: 2 / 1;
  aspect-ratio: 10 / 9;
  pointer-events: none;
}
.comic-lesson .lesson-illustration {
  grid-area: 1 / 1 / 3 / 2;
  align-self: end;
  background: transparent;
}
.comic-lesson-lettering {
  grid-area: 1 / 1;
  z-index: 1;
  min-height: 60cqw;
  display: grid;
  align-items: center;
  padding: 5% 7% 7%;
}
.comic-lesson-balloon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(12px, 3cqw, 22px) 12px;
  border: 3px solid var(--ink);
  border-radius: 44% 46% 43% 42% / 24% 26% 25% 25%;
  background: #fffefa;
  text-align: center;
  box-shadow: 3px 3px 0 var(--ink);
}
.comic-lesson-balloon::after {
  content: '';
  position: absolute;
  left: 33%;
  bottom: -14px;
  width: 18px;
  height: 22px;
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  background: #fffefa;
  transform: skewY(-32deg) rotate(35deg);
}
.comic-lesson .japanese-reading {
  gap: 0;
}
.comic-lesson .japanese-word {
  font-size: clamp(2rem, 9cqw, 3.5rem);
  line-height: 1.25;
}
.comic-lesson .japanese-romaji {
  font-size: 1rem;
  line-height: 1.4;
}
.comic-lesson .japanese-meaning {
  font: 700 1.15rem/1.25 var(--comic-font);
  text-transform: uppercase;
}
.comic-lesson .listen-button {
  min-height: 44px;
  padding: 6px 14px;
  box-shadow: 0 2px 0 var(--ink);
}
.comic-lesson .pronunciation {
  align-items: center;
  max-width: 100%;
  margin-top: 4px;
}
.comic-lesson-intro {
  font: 700 1rem/1.2 var(--comic-font);
  text-transform: uppercase;
}
.comic-lesson-speaker {
  color: #a64b24;
}
/* Keep a long introduction clear of the balloon's rounded top corners on phones. */
/* Lesson intros that name their speaker (Episodes 4 to 6) are longer lines: keep them clear of
   the curved top at every width, on tiered and layout pages alike. */
.manga-reader:has(.panel-grid--tiers) .comic-lesson-intro,
.comic-lesson-intro:has(.comic-lesson-speaker) {
  display: block;
  max-width: 72%;
  margin-inline: auto;
}
.comic-lesson-caption {
  margin: 0;
  border-top: 2px solid var(--ink);
  padding: 12px 16px;
  font: 700 0.9375rem/1.45 var(--comic-font);
  background: #fff5cf;
}

.comic-lesson--utae .comic-lesson-balloon::after {
  left: 70%;
  transform: skewY(32deg) rotate(55deg);
}

/* Native wide episode frames: an establishing memory above two smaller beats. */
.manga-page--montage .panel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.manga-page--montage .manga-panel:first-child {
  grid-area: 1 / 1 / 2 / 3;
}
.manga-page--montage .manga-panel:nth-child(2) {
  grid-area: 2 / 1;
}
.manga-page--montage .manga-panel:nth-child(3) {
  grid-area: 2 / 2;
}
.manga-page--spotlight .panel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.manga-page--spotlight .manga-panel {
  grid-column: auto;
}
@container comic-reader (width < 45rem) {
  .manga-page--spotlight .panel-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .manga-page--montage .panel-grid {
    gap: 8px;
  }
  .manga-page--montage .manga-panel.lettered--reserve-responsive .comic-caption {
    padding: 4px;
  }
  .manga-page--montage .manga-panel.lettered--reserve-responsive .speech-balloon {
    padding: 0.4rem;
    border-radius: 0;
  }
  .manga-page--montage .manga-panel.lettered--reserve-responsive .dialogue {
    font-size: 1rem;
  }
}
@container comic-reader (width < 18rem) {
  .manga-page--montage .panel-grid {
    display: flex;
    flex-direction: column;
  }
  .manga-page--montage .manga-panel {
    width: 100%;
  }
}

/* An English line that carries one Japanese word keeps the comic lettering. */
.japanese-word--mixed {
  font-family: var(--comic-font);
  text-transform: uppercase;
}
.japanese-word--mixed [lang='ja'] {
  text-transform: none;
}

.learn-room {
  --learn-bg: var(--butter);
  max-width: var(--page);
  margin: 10px auto 40px;
  padding: 30px 6% 48px;
  background: var(--learn-bg);
  border-block: 3px solid var(--ink);
}
.learn-room--katakana {
  --learn-bg: var(--blue);
  /* Darker text tones keep contrast on the blue background. */
  --muted: #3f3224;
  --red: #7f2219;
}
.learn-room--numbers {
  --learn-bg: #ffd9c2;
  --muted: #4a3a2a;
  --red: #8a2a1f;
}
.learn-room--index {
  --learn-bg: var(--butter);
}
.learn-room [hidden] {
  display: none !important;
}
.learn-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
}
.learn-intro h1 {
  font-size: clamp(2.3rem, 4.5vw, 3.8rem);
  margin-bottom: 12px;
}
.learn-intro h1 [lang='ja'] {
  font-family: 'Kero Japanese', var(--body);
  color: var(--red);
}
.learn-intro p:last-child {
  margin: 0;
  max-width: 46ch;
}
.learn-sticker {
  padding: 16px 22px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(7deg);
  font: 1.3rem/1.1 var(--heading);
  flex-shrink: 0;
  text-align: center;
}
.learn-room--katakana .learn-sticker {
  background: var(--paper);
}
.learn-switch {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 26px;
}
.learn-switch a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 18px;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--ink);
}
.learn-switch a[aria-current='page'] {
  background: var(--ink);
  color: var(--paper);
}
.learn-switch [lang='ja'] {
  font-family: 'Kero Japanese', var(--body);
}

.learn-lesson {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  grid-template-areas:
    'guide cards'
    'guide nav';
  gap: 18px 28px;
  align-items: start;
}
.learn-guide {
  grid-area: guide;
  text-align: center;
}
.learn-sensei {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
}
.learn-guide h2 {
  font-size: 1.4rem;
  margin: 12px 0 4px;
}
.learn-count {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.learn-cards {
  grid-area: cards;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}
.learn-card {
  padding: 24px 28px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px 24px 18px 26px;
  box-shadow: 6px 6px 0 var(--ink);
}
.learn-card .eyebrow {
  color: var(--red);
  margin-bottom: 6px;
}
.learn-card h3 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin: 0 0 10px;
}
.learn-card h3:focus {
  outline: none;
}
.learn-card p {
  font-size: 1.1rem;
  margin: 0 0 14px;
  max-width: 60ch;
}
.learn-outro {
  font-weight: 700;
}
.learn-examples {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.learn-examples li {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 130px;
  flex: 1 1 130px;
  max-width: 260px;
  padding: 14px 12px;
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 14px;
  text-align: center;
}
.learn-room--katakana .learn-examples li {
  background: #d9f0f2;
}
.learn-jp {
  font:
    2.2rem/1.2 'Kero Japanese',
    var(--body);
  font-weight: 700;
}
.learn-romaji {
  font-weight: 700;
  color: var(--red);
}
.learn-meaning {
  font-size: 0.95rem;
  color: var(--muted);
}
.learn-nav {
  grid-area: nav;
  display: flex;
  gap: 12px;
}
.learn-nav .primary {
  flex: 1;
}

.learn-quiz {
  margin-top: 44px;
  padding: 26px 28px 30px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 24px 20px 26px 18px;
  box-shadow: 6px 6px 0 var(--ink);
  scroll-margin-top: 90px;
}
.learn-quiz-heading h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin: 0 0 6px;
}
.learn-quiz-heading p:last-child {
  margin: 0 0 18px;
}
.learn-question h3 {
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  margin: 0 0 14px;
}
.learn-question h3:focus,
.learn-results h3:focus {
  outline: none;
}
.learn-choices {
  display: grid;
  gap: 10px;
  max-width: 560px;
}
.learn-choice {
  min-height: 52px;
  padding: 10px 18px;
  font: 700 1.05rem/1.4 var(--body);
  color: var(--ink);
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.learn-choice [lang='ja'] {
  font-family: 'Kero Japanese', var(--body);
  font-size: 1.25em;
}
.learn-choice:not(:disabled):hover {
  background: var(--butter);
  transform: translateY(-2px);
}
.learn-choice:disabled {
  cursor: default;
  opacity: 0.6;
}
.learn-choice.is-right {
  opacity: 1;
  background: #cfeccb;
}
.learn-choice.is-right::after {
  content: ' ✓';
}
.learn-choice.is-wrong {
  opacity: 1;
  background: #f6d2cc;
}
.learn-choice.is-wrong::after {
  content: ' ✗';
}
.learn-feedback {
  max-width: 560px;
  margin-top: 16px;
}
.learn-feedback p {
  margin: 0 0 12px;
}
.learn-verdict {
  font: 1.3rem/1.2 var(--heading);
  color: var(--red);
}
.learn-verdict.is-right {
  color: #2f7a35;
}
.learn-results {
  display: flex;
  align-items: center;
  gap: 24px;
}
.learn-result-kero {
  width: 140px;
  height: auto;
  flex-shrink: 0;
}
.learn-results h3 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 14px;
  letter-spacing: 0.04em;
}
.learn-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.learn-result-actions [lang='ja'] {
  font-family: 'Kero Japanese', var(--body);
}
.learn-paper details {
  margin-bottom: 10px;
}

@media (max-width: 720px) {
  .learn-intro {
    flex-direction: column;
    align-items: flex-start;
  }
  .learn-sticker {
    display: none;
  }
  .learn-lesson {
    grid-template-columns: 1fr;
    grid-template-areas: 'guide' 'cards' 'nav';
  }
  .learn-guide {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
  }
  .learn-sensei {
    width: 84px;
  }
  .learn-guide h2 {
    margin: 0;
  }
  .learn-card,
  .learn-quiz {
    padding: 20px;
  }
  .learn-results {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .learn-choice:not(:disabled):hover {
    transform: none;
  }
}

/* ════ Lesson grid ════ */
.learn-back {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.learn-progress {
  margin: -8px 0 18px;
  font-weight: 700;
}
.learn-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.learn-tile {
  position: relative;
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 18px 18px 16px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px 22px 16px 20px;
  box-shadow: 0 4px 0 var(--ink);
  transition:
    transform 0.18s,
    box-shadow 0.18s;
}
.learn-tile:hover {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 0 7px 0 var(--ink);
}
.learn-tile--intro {
  background: var(--yellow);
}
.learn-tile-label {
  font: 700 0.8125rem/1.4 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--red);
}
.learn-tile-kana {
  font:
    700 1.9rem/1.25 'Kero Japanese',
    var(--body);
  letter-spacing: 0.04em;
}
.learn-tile-title {
  font: 1.2rem/1.2 var(--heading);
}
.learn-tile-sub {
  color: var(--muted);
  font-size: 0.95rem;
}
.learn-tile--intro .learn-tile-sub,
.learn-tile--intro .learn-tile-label {
  color: var(--ink);
}
.learn-tile-badge:empty {
  display: none;
}
.learn-tile-badge {
  justify-self: start;
  margin-top: 6px;
  padding: 2px 10px;
  font-weight: 700;
  font-size: 0.85rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #cfeccb;
}
.learn-tile.is-next {
  outline: 4px solid var(--red);
  outline-offset: 3px;
}
.learn-tile.is-next .learn-tile-badge {
  background: var(--yellow);
}
.learn-how {
  margin-top: 36px;
  padding: 22px 26px;
  background: var(--paper);
  border: 2px dashed var(--ink);
  border-radius: 18px;
}
.learn-how h2 {
  font-size: 1.5rem;
  margin: 0 0 10px;
}
.learn-how ol {
  margin: 0 0 10px;
  padding-left: 1.3em;
}
.learn-how li + li {
  margin-top: 6px;
}
.learn-how p {
  margin: 0;
  color: var(--muted);
}

/* ════ Flash cards ════ */
.learn-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.learn-section-head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}
.flash-cards {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.learn-flash--stepped .flash-cards {
  grid-template-columns: minmax(0, 460px);
  justify-content: center;
}
.flash-face {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  width: 100%;
  min-height: 210px;
  padding: 20px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 6px 6px 0 var(--ink);
  cursor: pointer;
}
.flash-face:disabled {
  cursor: default;
  opacity: 1;
}
.learn-flash--stepped .flash-face {
  min-height: 300px;
}
.flash-kana {
  font:
    700 clamp(4.5rem, 12vw, 7rem)/1 'Kero Japanese',
    var(--body);
}
.flash-back {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}
.flash-romaji {
  font: 2rem/1 var(--heading);
  color: var(--red);
}
.flash-cue {
  max-width: 30ch;
  color: var(--muted);
}
.flash-hint {
  display: none;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--muted);
}
/* With JavaScript the back is hidden until the card is flipped. */
.learn-flash--stepped .flash-back {
  display: none;
}
.learn-flash--stepped .flash-hint {
  display: block;
}
.learn-flash--stepped .is-flipped .flash-back {
  display: grid;
}
.learn-flash--stepped .is-flipped .flash-hint {
  display: none;
}
.learn-flash--stepped .is-flipped .flash-face {
  background: var(--butter);
}
.learn-room--katakana .learn-flash--stepped .is-flipped .flash-face {
  background: #d9f0f2;
}
.learn-flash .learn-nav {
  max-width: 460px;
  margin: 0 auto;
}

/* ════ Multiple choice ════ */
.mc-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.mc-progress p {
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
}
.mc-bar {
  flex: 1;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}
.mc-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--yellow);
  transition: width 0.3s;
}
.mc-question {
  text-align: center;
}
.mc-prompt {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.mc-target {
  margin: 4px 0 18px;
  font: 2.6rem/1.2 var(--heading);
}
.mc-target:focus {
  outline: none;
}
.mc-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}
.mc-choice {
  min-height: 64px;
  padding: 10px;
  font: 1.6rem/1.2 var(--heading);
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.mc-choice--kana {
  font:
    700 2.2rem/1.2 'Kero Japanese',
    var(--body);
}
.mc-choice:not(:disabled):hover {
  background: var(--butter);
  transform: translateY(-2px);
}
.mc-choice:disabled {
  cursor: default;
  opacity: 0.55;
}
.mc-choice.is-right {
  opacity: 1;
  background: #cfeccb;
}
.mc-choice.is-wrong {
  opacity: 1;
  background: #f6d2cc;
}
.mc-question .learn-feedback {
  margin: 18px auto 0;
}
.learn-paper-list {
  columns: 3;
  font-size: 1.1rem;
}

/* ════ Home page section ════ */
.learn-preview {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 40px;
  align-items: center;
  background: var(--butter);
  border-block: 3px solid var(--ink);
  margin-block: 35px 0;
}
.learn-preview [hidden] {
  display: none !important;
}
.learn-preview h2 span {
  color: var(--red);
}
.learn-resume {
  display: grid;
  gap: 10px;
  justify-items: start;
  font-weight: 700;
}
.learn-preview-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.learn-preview-card {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 22px 20px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(-2deg);
  transition: transform 0.18s;
}
.learn-preview-card--katakana {
  background: #d9f0f2;
  transform: rotate(2deg);
}
.learn-preview-card:hover {
  transform: rotate(0) translateY(-4px);
}
.learn-preview-kana {
  font:
    700 clamp(2rem, 4vw, 2.8rem)/1.2 'Kero Japanese',
    var(--body);
}
.learn-preview-name {
  font: 1.5rem/1.2 var(--heading);
}
.learn-preview-name [lang='ja'] {
  white-space: nowrap;
  font-family: 'Kero Japanese', var(--body);
  color: var(--red);
  font-size: 0.85em;
}
.learn-preview-sub {
  color: var(--muted);
}
.learn-preview-go {
  margin-top: 6px;
  font-weight: 700;
}

@media (max-width: 860px) {
  .learn-preview {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .learn-preview-cards {
    grid-template-columns: 1fr;
  }
  .learn-paper-list {
    columns: 2;
  }
  .mc-choice {
    font-size: 1.35rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .learn-tile,
  .learn-preview-card,
  .mc-bar span {
    transition: none;
  }
  .learn-tile:hover,
  .learn-preview-card:hover,
  .mc-choice:not(:disabled):hover {
    transform: none;
  }
}

/* ════ Simpler lesson layout ════ */
.lesson-head {
  text-align: center;
  margin-bottom: 18px;
}
.lesson-head .eyebrow {
  margin-bottom: 4px;
  color: var(--red);
}
.lesson-head h1 {
  margin: 0;
  font:
    700 clamp(3rem, 9vw, 5.5rem)/1.1 'Kero Japanese',
    var(--heading);
  letter-spacing: 0.06em;
}
.battle-room .lesson-head h1 {
  font: clamp(2.4rem, 6vw, 4rem)/1.1 var(--heading);
  letter-spacing: 0;
}
.battle-vs {
  color: var(--red);
}
.lesson-romaji {
  margin: 4px 0 0;
  font: 1.3rem/1.3 var(--heading);
  letter-spacing: 0.08em;
  color: var(--muted);
}
.lesson-steps {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 28px;
}
.lesson-steps a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lesson-steps b,
.step-title b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding-top: 0.1em;
}
.lesson-steps a {
  min-height: 46px;
  padding: 8px 18px;
  font-weight: 700;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}
.lesson-steps b,
.step-title b {
  justify-content: center;
  width: 1.7em;
  height: 1.7em;
  font: 1rem/1 var(--heading);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}
.learn-flash,
.learn-words,
.learn-draw {
  scroll-margin-top: 90px;
}
.learn-room .learn-quiz {
  margin-top: 36px;
}

/* Sound buttons */
.sound-button {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  font-size: 1.5rem;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.sound-button:hover {
  transform: translateY(-2px);
}
.flash-card {
  position: relative;
}
.flash-sound {
  position: absolute;
  top: 14px;
  right: 14px;
}
.flash-card audio {
  width: 100%;
  margin-top: 8px;
}
.mc-target-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.mc-target-row .mc-target {
  margin-bottom: 18px;
}
.mc-target-row .sound-button {
  margin-bottom: 18px;
}

/* ════ Stroke order ════ */
.learn-draw {
  margin-top: 36px;
  padding: 26px 28px 22px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px 26px 18px 24px;
  box-shadow: 6px 6px 0 var(--ink);
}
.draw-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.draw-picker button {
  width: 58px;
  height: 58px;
  font:
    700 1.8rem/1 'Kero Japanese',
    var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.draw-picker button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
.draw-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.draw-demo,
.draw-pad {
  margin: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.draw-demo svg,
.draw-paper {
  width: min(100%, 320px);
  aspect-ratio: 1;
  background:
    linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat,
    linear-gradient(var(--line), var(--line)) center / 1px 100% no-repeat,
    #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
}
.draw-demo figcaption,
.draw-pad figcaption {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  font-weight: 700;
}
.draw-under {
  fill: none;
  stroke: #efe4cb;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.draw-stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-stroke 0.9s ease-in-out forwards;
  animation-delay: calc(var(--s) * 1s + 0.3s);
}
.draw-number {
  opacity: 0;
  animation: draw-number 0.2s forwards;
  animation-delay: calc(var(--s) * 1s + 0.3s);
}
.draw-number circle {
  fill: var(--red);
}
.draw-number text {
  font: 700 6.5px/1 var(--body);
  fill: #fff;
}
/* Stroke timing by class, because the live security policy blocks inline styles. */
.draw-s0 {
  --s: 0;
}
.draw-s1 {
  --s: 1;
}
.draw-s2 {
  --s: 2;
}
.draw-s3 {
  --s: 3;
}
.draw-s4 {
  --s: 4;
}
.draw-s5 {
  --s: 5;
}
@keyframes draw-stroke {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes draw-number {
  to {
    opacity: 1;
  }
}
.draw-paper {
  position: relative;
  overflow: hidden;
}
.draw-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.draw-guide path {
  fill: none;
  stroke: #e9dcc0;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.draw-paper canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.draw-credit {
  margin: 18px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}
.draw-credit a {
  text-decoration: underline;
}

/* ════ Battle ════ */
.battle-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 26px;
  padding: 14px 20px;
  background: var(--red);
  color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--ink);
  font: 1.6rem/1.2 var(--heading);
  text-align: center;
  transition: transform 0.18s;
}
.battle-banner:hover {
  transform: translateY(-3px) rotate(-1deg);
}
.battle-banner span {
  display: grid;
  font-family: var(--body);
  font-weight: 700;
  font-size: 1rem;
}
.battle-banner b {
  font: 1.8rem/1.1 var(--heading);
}
.battle-banner img {
  width: 90px;
  height: 90px;
  object-fit: contain;
}
.battle-banner-sensei {
  border: 3px solid var(--ink);
  border-radius: 50%;
  object-fit: cover !important;
  object-position: top;
  background: var(--paper);
}
.battle-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto 18px;
  padding: 18px 18px 26px;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(57, 44, 32, 0.15) 0 40%, transparent 41%),
    linear-gradient(#fff6dc, var(--paper));
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
}
.fighter {
  display: grid;
  gap: 8px;
  justify-items: center;
}
.fighter-art {
  width: min(100%, 220px);
  height: 220px;
  object-fit: contain;
}
.fighter--sensei .fighter-art {
  width: min(100%, 180px);
  object-fit: cover;
  object-position: top;
  border: 3px solid var(--ink);
  border-radius: 20px;
}
.hp {
  display: grid;
  gap: 4px;
  width: min(100%, 200px);
  margin: 0;
  font-weight: 700;
}
.hp-bar {
  display: block;
  height: 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}
.hp-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: #4caf50;
  transition: width 0.4s;
}
.fighter--sensei .hp-bar span {
  background: var(--red);
}
.battle-bubble {
  align-self: center;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.battle-kana {
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  margin: 0;
  font:
    700 4.5rem/1 'Kero Japanese',
    var(--body);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 5px 0 var(--ink);
}
.battle-kana.is-new {
  animation: battle-pop-in 0.35s ease-out;
}
.fighter--kero.is-attacking .fighter-art {
  animation: kero-lunge 0.6s ease-in-out;
}
.fighter--sensei.is-attacking .fighter-art {
  animation: sensei-lunge 0.6s ease-in-out;
}
.fighter.is-hit .fighter-art {
  animation: fighter-shake 0.5s 0.25s ease-in-out;
}
.battle-pop {
  position: absolute;
  top: 30%;
  margin: 0;
  font: 2rem/1 var(--heading);
  color: var(--red);
  opacity: 0;
  pointer-events: none;
}
.battle-pop[data-side='sensei'] {
  right: 18%;
}
.battle-pop[data-side='kero'] {
  left: 18%;
}
.battle-pop.is-popping {
  animation: damage-float 1s ease-out;
}
.battle-choices {
  margin-bottom: 10px;
}
.battle-log {
  min-height: 1.6em;
  margin: 8px 0 0;
  font-weight: 700;
  text-align: center;
}
.battle-using {
  margin: 4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.battle-won .fighter--sensei .fighter-art {
  transform: rotate(80deg) translateY(30px);
  transition: transform 0.6s;
}
.battle-lost .fighter--kero .fighter-art {
  transform: rotate(-80deg) translateY(30px);
  transition: transform 0.6s;
}
.battle-room .learn-results {
  justify-content: center;
  text-align: center;
}
.battle-room .learn-result-actions {
  justify-content: center;
}
@keyframes kero-lunge {
  40% {
    transform: translateX(90px) rotate(12deg);
  }
}
@keyframes sensei-lunge {
  40% {
    transform: translateX(-90px) rotate(-8deg);
  }
}
@keyframes fighter-shake {
  20%,
  60% {
    translate: -10px 0;
  }
  40%,
  80% {
    translate: 10px 0;
  }
}
@keyframes damage-float {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-40px);
  }
}
@keyframes battle-pop-in {
  0% {
    transform: scale(0.4);
  }
  70% {
    transform: scale(1.1);
  }
}

@media (max-width: 640px) {
  .battle-stage {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 'bubble bubble' 'kero sensei';
  }
  .battle-bubble {
    grid-area: bubble;
  }
  .fighter--kero {
    grid-area: kero;
  }
  .fighter--sensei {
    grid-area: sensei;
  }
  .fighter-art {
    height: 140px;
  }
  .battle-kana {
    width: 104px;
    height: 104px;
    font-size: 3.6rem;
  }
  .battle-banner img {
    width: 60px;
    height: 60px;
  }
  .learn-draw {
    padding: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .draw-stroke {
    animation: none;
    stroke-dashoffset: 0;
  }
  .draw-number {
    animation: none;
    opacity: 1;
  }
  .battle-kana.is-new,
  .fighter .fighter-art,
  .battle-pop.is-popping {
    animation: none !important;
  }
  .battle-pop.is-popping {
    opacity: 1;
  }
  .battle-banner,
  .hp-bar span {
    transition: none;
  }
}

/* ════ Read words ════ */
.learn-words {
  margin-top: 36px;
  padding: 26px 28px 26px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 24px 18px 22px 20px;
  box-shadow: 6px 6px 0 var(--ink);
  text-align: center;
}
.learn-words .step-title {
  justify-content: flex-start;
}
.word-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 6px auto 14px;
}
.word-art {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
}
.word-meaning {
  margin: 0;
  font: 1.4rem/1.2 var(--heading);
}
.word-tiles {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 4px;
}
.word-tiles:focus {
  outline: none;
}
.word-tile {
  display: grid;
  place-items: center;
  width: 72px;
  height: 80px;
  font:
    700 2.8rem/1 'Kero Japanese',
    var(--body);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
}
.word-tile.is-blank {
  color: var(--red);
  background: var(--butter);
  border-style: dashed;
}
.word-tile.is-filled {
  background: #cfeccb;
  animation: battle-pop-in 0.35s ease-out;
}
.word-romaji {
  margin: 4px 0 6px;
  font: 1.4rem/1.2 var(--heading);
  letter-spacing: 0.08em;
  color: var(--muted);
}
.learn-words .learn-results {
  justify-content: center;
}
.learn-words .learn-result-actions {
  justify-content: center;
}
.word-list {
  list-style: none;
  padding: 0;
  font-size: 1.2rem;
}
@media (max-width: 520px) {
  .word-tile {
    width: 54px;
    height: 62px;
    font-size: 2.1rem;
  }
  .word-tiles {
    gap: 5px;
  }
  .learn-words {
    padding: 20px 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .word-tile.is-filled {
    animation: none;
  }
}

/* ════ Next lesson ════ */
.lesson-next {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* ════ In this lesson: a plain table under the games (docs/pm-audit.md C6) ════ */
.lesson-table {
  max-width: 760px;
  margin: 36px auto 0;
}
.lesson-table h2 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
}
.lesson-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-size: 0.95rem;
}
.lesson-table th,
.lesson-table td {
  padding: 8px 6px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.lesson-table td:nth-child(3),
.lesson-table td:nth-child(4) {
  overflow-wrap: anywhere;
}
.lesson-table th:first-child,
.lesson-table td:nth-child(2) {
  white-space: nowrap;
}
.lesson-table thead th {
  border-top: 0;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
}
.lesson-table tbody th {
  font-size: 1.6rem;
  line-height: 1.1;
  text-align: center;
}
.lesson-table p {
  margin: 12px 0 0;
}
.learn-chart-link {
  display: flex;
  justify-content: center;
  margin: 22px 0 0;
}
.manga-word-links {
  max-width: 760px;
  margin: 28px auto 0;
  padding: 16px 18px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
}
.manga-word-links h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}
.manga-word-links ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.manga-word-links a {
  display: inline-block;
  min-height: 44px;
  padding: 10px 0;
  font-weight: 700;
  text-decoration: underline;
}

/* ════ The kana chart: tap to hear, and printable ════ */
.kana-chart-room h1 {
  font-family: var(--heading);
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  line-height: 1;
}
.kana-chart-line {
  max-width: 34rem;
  margin-inline: auto;
}
.kana-chart-wrap {
  max-width: 640px;
  margin: 18px auto 0;
}
.kana-chart {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
}
.kana-chart thead th {
  font-size: 0.9rem;
  color: var(--muted);
}
.kana-chart .kana-chart-lesson {
  width: 3.4em;
  font-size: 0.7rem;
}
.kana-chart tbody th {
  text-align: center;
}
.kana-chart tbody th a {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  min-height: 44px;
  font-weight: 800;
}
.kana-chart td {
  padding: 0;
}
.chart-cell {
  display: grid;
  justify-items: center;
  width: 100%;
  min-height: 56px;
  padding: 6px 2px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.chart-cell:hover,
.chart-cell:focus-visible {
  background: var(--yellow);
}
.chart-kana {
  font-size: clamp(1.4rem, 6vw, 2rem);
  line-height: 1.1;
}
.chart-romaji {
  font-size: 0.8rem;
  font-weight: 700;
}
.kana-chart-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}
@media print {
  .site-header,
  .site-footer,
  .consent-banner,
  .skip-link,
  .learn-back,
  .kana-chart-actions {
    display: none !important;
  }
  .kana-chart-room {
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
  }
  .chart-cell {
    background: #fff;
  }
}

/* ════ Learn landing ════ */
.learn-picks {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.learn-pick {
  display: grid;
  gap: 6px;
  height: 100%;
  padding: 26px 22px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform 0.18s;
}
.learn-pick:hover {
  transform: translateY(-4px) rotate(-1deg);
}
.learn-pick--katakana {
  background: #d9f0f2;
}
.learn-pick--numbers {
  background: #ffe9dc;
}
.learn-pick-big {
  font:
    700 clamp(2.2rem, 5vw, 3rem)/1.15 'Kero Japanese',
    var(--heading);
}
.learn-pick-title {
  font: 1.7rem/1.2 var(--heading);
}
.learn-pick-sub {
  font-weight: 700;
  color: var(--muted);
}

/* ════ Numbers and time ════ */
.learn-group + .learn-group {
  margin-top: 28px;
}
.learn-group-title {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}
.learn-room--numbers .learn-tile-title {
  font-size: 1.35rem;
}
.learn-room--numbers .learn-tile-sub[lang='ja'] {
  font-family: 'Kero Japanese', var(--body);
}
.lesson-head .lesson-title {
  font: clamp(2.4rem, 7vw, 4rem)/1.1 var(--heading);
  letter-spacing: 0;
}
.lesson-jp {
  font-family: 'Kero Japanese', var(--body);
  letter-spacing: 0.04em;
}
.time-prompt {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.time-prompt--number {
  font: clamp(3.5rem, 11vw, 5.5rem)/1 var(--heading);
}
.time-prompt-visual {
  display: grid;
  place-items: center;
}
.learn-art {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
}
.time-prompt-text {
  font: 1.7rem/1.2 var(--heading);
}
.clock {
  width: 130px;
  height: 130px;
}
.clock-face {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 4;
}
.clock-tick {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}
.clock-tick--big {
  stroke-width: 3.5;
}
.clock-hour,
.clock-minute {
  stroke: var(--ink);
  stroke-linecap: round;
}
.clock-hour {
  stroke-width: 6;
}
.clock-minute {
  stroke: var(--red);
  stroke-width: 4;
}
.clock-pin {
  fill: var(--ink);
}
.flash-jp {
  font:
    700 clamp(2.4rem, 8vw, 3.4rem)/1.15 'Kero Japanese',
    var(--body);
}
.mc-choice-main {
  display: block;
}
.mc-choice-main[lang='ja'] {
  font:
    700 1.6rem/1.25 'Kero Japanese',
    var(--body);
}
.learn-quiz .mc-choice {
  font-size: 1.25rem;
}
.battle-kana--text {
  width: auto;
  min-width: 130px;
  height: auto;
  min-height: 130px;
  padding: 12px 18px;
  border-radius: 28px;
  font: 1.6rem/1.2 var(--heading);
  text-align: center;
}
.battle-kana .time-prompt-text {
  font-size: 1rem;
}
.battle-show-main {
  display: block;
}
.battle-kana--text .battle-show-main:not(:has(*)) {
  font-size: 2rem;
  line-height: 1.1;
}
/* How a number's reading is said, under what Sensei shows. */
.battle-romaji {
  display: block;
  margin-top: 4px;
  font: 1.3rem/1.2 var(--heading);
  color: var(--red);
}
/* The kana battle shows a sound in romaji: letters, a little smaller than a kana. */
.battle-kana--sound {
  font: 3.3rem/1 var(--heading);
}
@media (max-width: 640px) {
  .battle-kana--sound {
    font-size: 2.7rem;
  }
}
.battle-kana .clock {
  width: 92px;
  height: 92px;
}
.learn-preview-card--numbers {
  background: #ffe9dc;
  transform: rotate(-1deg);
}
@media (max-width: 520px) {
  .clock {
    width: 110px;
    height: 110px;
  }
  .time-prompt-text {
    font-size: 1.4rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .learn-pick {
    transition: none;
  }
  .learn-pick:hover {
    transform: none;
  }
}

/* Long "Next lesson: …" labels wrap on narrow phones instead of pushing the page wide. */
.learn-room .button {
  text-align: center;
}
.learn-room .button > span:first-child {
  flex-shrink: 1;
  min-width: 0;
}

.learn-quiz .mc-target-row {
  flex-wrap: wrap;
}
.sound-button--big {
  width: 96px;
  height: 96px;
  font-size: 2.6rem;
  margin-bottom: 18px;
}

/* ════ Drawn visuals ════ */
.speaker-icon {
  width: 26px;
  height: 26px;
}
.speaker-body {
  fill: var(--ink);
}
.speaker-waves {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.sound-button--big .speaker-icon {
  width: 48px;
  height: 48px;
}
.visual {
  display: block;
}
.visual--calendar {
  width: 110px;
  height: 110px;
}
.cal-page {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 3;
}
.cal-top {
  fill: var(--red);
  stroke: var(--ink);
  stroke-width: 3;
}
.cal-ring {
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
}
.cal-day {
  font: 30px var(--heading);
  fill: var(--ink);
}
.visual--days,
.visual--span,
.visual--week {
  width: 250px;
  max-width: 100%;
  height: auto;
}
.tl-label {
  font: 700 11px var(--body);
  fill: var(--red);
}
.tl-box {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 2.5;
}
.tl-box--on {
  fill: var(--yellow);
}
.tl-today {
  fill: var(--red);
}
.tl-tick {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.clock-wedge {
  fill: var(--yellow);
  stroke: var(--ink);
  stroke-width: 1.5;
}
.clock-question {
  font: 48px var(--heading);
  fill: var(--red);
}
.battle-kana .learn-art,
.battle-kana .visual--calendar {
  width: 84px;
  height: 84px;
}
.battle-kana .visual--days,
.battle-kana .visual--span,
.battle-kana .visual--week {
  width: 150px;
}
@media (max-width: 520px) {
  .learn-art,
  .word-art,
  .visual--calendar {
    width: 96px;
    height: 96px;
  }
}

/* ════ The learning path (home page and /learn/) ════ */
.learn-path {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  counter-reset: none;
}
.learn-path-step {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    'number big go'
    'number title go'
    'number line go'
    'number size go';
  column-gap: 14px;
  row-gap: 2px;
  align-items: center;
  padding: 16px 18px;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 0.18s;
}
a.learn-path-step:hover {
  transform: translateY(-3px);
}
.learn-path-step--katakana {
  background: #d9f0f2;
}
.learn-path-step--numbers {
  background: #ffe9dc;
}
.learn-path-step--vocab {
  background: #ece4f7;
}
.learn-path-step--study {
  background: #e6f5dc;
}
.learn-path-step--food {
  background: #fff0cb;
}
.learn-path-number {
  grid-area: number;
  align-self: start;
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  padding-top: 0.1em;
  font: 1.3rem/1 var(--heading);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.learn-path-step.is-done .learn-path-number {
  background: #9ccf7f;
}
.learn-path-big {
  grid-area: big;
  font:
    700 clamp(1.6rem, 5vw, 2.2rem)/1.15 'Kero Japanese',
    var(--heading);
}
.learn-path-title {
  grid-area: title;
  margin: 0;
  font: 1.45rem/1.15 var(--heading);
}
.learn-path-line {
  grid-area: line;
  line-height: 1.35;
}
.learn-path-size {
  grid-area: size;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted, #4a3a2a);
}
.learn-path-go {
  grid-area: go;
  font: 1.6rem/1 var(--heading);
}
.learn-preview--path {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
}
.learn-preview--path .learn-path {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.learn-path-does {
  grid-area: does;
  margin-top: 2px;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--muted, #4a3a2a);
}
.learn-room--index .learn-path {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 8px 0 0;
}
.learn-room--index .learn-path-step {
  height: 100%;
  grid-template-areas:
    'number big go'
    'number title go'
    'number line go'
    'number does go'
    'number size go';
  align-content: start;
}
.learn-room--index .continue-box {
  margin: 12px 0 0;
}
.learn-steps-title {
  margin: 34px 0 16px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

/* ════ /learn/: Kero at his desk ════ */
.learn-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
}
.learn-hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  margin-bottom: 14px;
}
.learn-hero-copy > p:not(.eyebrow) {
  max-width: 40ch;
}
.learn-order {
  padding: 10px 14px;
  background: var(--paper);
  border: 2px dashed var(--ink);
  border-radius: 14px;
  font-weight: 700;
  line-height: 1.4;
}
.learn-saved {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.learn-order {
  margin: 18px 0 8px;
}
.learn-new {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0;
  font-weight: 700;
}
/* The way into the games, part of Learn: a plain link under the order, not a second button. */
.learn-to-games {
  margin-bottom: 2px;
}
/* A returning learner's Continue button is the one yellow button; the newcomer's start goes white. */
.learn-hero-copy:has(.continue-box:not([hidden])) .learn-new .button {
  background: var(--paper);
}
.study-scene {
  margin: 0;
  min-width: 0;
}
.study-scene-inner {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  border: 3px solid var(--ink);
  border-radius: 26px 22px 28px 24px;
  box-shadow: 6px 6px 0 var(--ink);
  background: #f6e7c8;
  transform: rotate(1deg);
}
.study-scene-inner picture,
.study-scene-room,
.study-scene-desk,
.study-scene-sheet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.study-scene-room,
.study-scene-desk img {
  display: block;
  width: 100%;
  height: 100%;
  /* The room is drawn a hair wider than 3:2: fill the frame without stretching it. */
  object-fit: cover;
}
/* Kero stands behind the desk; the desk's back edge is at 66.5% of the room's height. */
.study-scene-kero {
  position: absolute;
  left: 33.5%;
  top: 38%;
  width: 33%;
  height: auto;
  animation: kero-reads 3.2s ease-in-out infinite;
  transform-origin: 50% 100%;
}
/* The same room again, drawn only below the desk's back edge, in front of Kero. */
.study-scene-desk {
  clip-path: inset(66.5% 0 0 0);
}
.study-scene-sheet path {
  fill: none;
  stroke: #3f3226;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  animation: kana-write 0.42s ease-in backwards;
}
.study-scene figcaption {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}
.study-scene figcaption a {
  text-decoration: underline;
  white-space: nowrap;
}
@keyframes kero-reads {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  45% {
    transform: translateY(-4%) rotate(-2deg);
  }
  60% {
    transform: translateY(-3%) rotate(1.5deg);
  }
}
@keyframes kana-write {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@media (max-width: 860px) {
  .learn-room--index .learn-path {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .learn-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .study-scene {
    order: -1;
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
  }
}
/* On a phone the picture shows the right three quarters of the room: Kero and the sheet. */
@media (max-width: 560px) {
  .study-scene-inner {
    aspect-ratio: 9 / 8;
    transform: none;
  }
  .study-scene-inner > picture,
  .study-scene-desk,
  .study-scene-sheet {
    width: 133.4%;
    left: -33.4%;
  }
  .study-scene-kero {
    left: calc(33.5% * 1.334 - 33.4%);
    width: calc(33% * 1.334);
  }
}

/* ════ The home page's short Learn block ════ */
.learn-preview--compact {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  margin-top: 40px;
  padding-block: 48px;
}
.learn-preview--compact h2 {
  margin-bottom: 14px;
}
.learn-preview--compact .learn-preview-copy > p {
  max-width: 36ch;
  font-weight: 700;
}
/* Two steps a row up to tablets (four in a row squeezed the names), wider cards beside the copy
   on a desktop. */
.learn-path--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 901px) {
  .learn-path--compact {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  }
}
.learn-path--compact .learn-path-step {
  grid-template-areas:
    'number title go'
    'number size go';
  padding: 12px 14px;
}
.learn-path--compact .learn-path-number {
  align-self: center;
}
.learn-path--compact .learn-path-title {
  font-size: 1.25rem;
}
@media (max-width: 900px) {
  .learn-preview--compact {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}
/* On phones the number and arrow share the top line and the name gets the card's full width, so
   names such as "Hiragana" keep whole words from 320 px up. */
@media (max-width: 560px) {
  .learn-path--compact {
    gap: 10px;
  }
  .learn-path--compact .learn-path-step {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'number go'
      'title title'
      'size size';
    row-gap: 4px;
    padding: 10px 12px;
  }
  .learn-path--compact .learn-path-number {
    justify-self: start;
    width: 2rem;
    height: 2rem;
    font-size: 1.1rem;
  }
  .learn-path--compact .learn-path-go {
    font-size: 1.3rem;
  }
  .learn-path--compact .learn-path-title {
    font-size: 1.15rem;
  }
}
.learn-games {
  margin-top: 40px;
}
.learn-games .section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}
@media (max-width: 900px) {
  .learn-preview--path {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .learn-preview--path .learn-path {
    grid-template-columns: 1fr;
  }
  .learn-path-step {
    padding: 14px 14px;
    column-gap: 10px;
  }
}

/* One stroke after another, in stroke order: あ い う え お. */
.study-scene-sheet .stroke-0 {
  animation-delay: 0.8s;
}
.study-scene-sheet .stroke-1 {
  animation-delay: 1.25s;
}
.study-scene-sheet .stroke-2 {
  animation-delay: 1.7s;
}
.study-scene-sheet .stroke-3 {
  animation-delay: 2.15s;
}
.study-scene-sheet .stroke-4 {
  animation-delay: 2.6s;
}
.study-scene-sheet .stroke-5 {
  animation-delay: 3.05s;
}
.study-scene-sheet .stroke-6 {
  animation-delay: 3.5s;
}
.study-scene-sheet .stroke-7 {
  animation-delay: 3.95s;
}
.study-scene-sheet .stroke-8 {
  animation-delay: 4.4s;
}
.study-scene-sheet .stroke-9 {
  animation-delay: 4.85s;
}
.study-scene-sheet .stroke-10 {
  animation-delay: 5.3s;
}
.study-scene-sheet .stroke-11 {
  animation-delay: 5.75s;
}

/* The Japan section (src/pages/japan.ts): the hub at /japan/, its stories at /japan/<slug>/ and the
   home page's From Japan card. A story is a bright explainer: big headings, whole episode frames at
   their own shape (no crops), and colour-coded parts in the site's palette. Colour sits on marks, frames,
   tiles and short notes; long text stays dark ink on cream or white, so it always reads clearly. */

.japan-intro h1 > span,
.japan-list h2 > span,
.japan-more h2 > span,
.home-japan h2 > span {
  color: var(--red);
}
.japan-intro .eyebrow,
.japan-head .eyebrow {
  color: var(--red);
}

/* ── Breadcrumb: Home › Japan › the story ── */
.japan-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  font-weight: 700;
}
.japan-crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.japan-crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.japan-crumbs a[aria-current] {
  color: var(--muted);
  text-decoration: none;
}

/* ── Article cards: the hub, the home page and More from Japan ── */
.japan-cards {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.japan-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px 32px;
  padding: 16px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 28px 24px 30px 26px;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 0.18s;
}
.japan-card:hover {
  transform: translateY(-3px);
}
.japan-card:hover .japan-card-more {
  text-decoration: underline;
  text-underline-offset: 5px;
}
.japan-card:not(.japan-card--wide) {
  grid-template-columns: minmax(0, 1fr);
  max-width: 30rem;
}
.japan-card-art img {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 18px;
}
.japan-card-copy {
  display: grid;
  gap: 8px;
  padding-right: 8px;
}
.japan-card-copy .eyebrow {
  margin: 0;
  color: var(--red);
}
.japan-card-title {
  margin: 0;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
}
.japan-card:not(.japan-card--wide) .japan-card-title {
  font-size: 1.75rem;
}
.japan-card-line {
  font-size: 1.0625rem;
  line-height: 1.5;
}
.japan-card-more {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.japan-list {
  padding-top: 8px;
}
.japan-list h2,
.japan-more h2 {
  font-size: clamp(2rem, 3.6vw, 3rem);
}
.japan-ask {
  margin-top: 22px;
}
.home-japan {
  padding-block: 40px 56px;
}
.home-japan .japan-card {
  background: var(--butter);
}

/* ── The part colours: leaf green, coral red, sunny yellow and sky blue. Each part sets --part
   (marks, frames, tiles) and --part-soft (notes, the heading's highlighter). Dark ink on all of
   them is above 4.5:1; the coral's tags use white on the site's red instead. ── */
.japan-article {
  --leaf: #8fd06b;
  --leaf-soft: #e4f5d6;
  --coral: #f2846f;
  --coral-soft: #fde2db;
  --sky-soft: #dcf2f3;
  --part: var(--yellow);
  --part-soft: var(--butter);
}
.japan-article [data-colour='green'] {
  --part: var(--leaf);
  --part-soft: var(--leaf-soft);
}
.japan-article [data-colour='red'] {
  --part: var(--coral);
  --part-soft: var(--coral-soft);
  --tag: var(--red);
  --tag-ink: white;
}
.japan-article [data-colour='yellow'] {
  --part: var(--yellow);
  --part-soft: var(--butter);
}
.japan-article [data-colour='blue'] {
  --part: var(--blue);
  --part-soft: var(--sky-soft);
}
.japan-article [data-colour='ink'] {
  --part: white;
}

/* ── The story's head: the question, the hook and the hero picture ── */
.japan-head {
  padding-top: 28px;
  padding-bottom: 20px;
}
.japan-head-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 32px 56px;
}
.japan-head h1 {
  margin-bottom: 20px;
  font-size: clamp(2.6rem, 5.4vw, 4.6rem);
}
.japan-hook {
  max-width: 34rem;
  font-size: 1.1875rem;
  line-height: 1.6;
}
.japan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}
.japan-hero {
  margin: 0;
}
.japan-hero img {
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 26px 30px 24px 32px;
  box-shadow: 0 8px 0 var(--ink);
  transform: rotate(1.5deg);
}

/* ── Setsubun at a glance: four bright tiles ── */
.japan-glance {
  padding-top: 20px;
  padding-bottom: 28px;
}
.japan-glance h2 {
  margin-bottom: 16px;
  font-size: clamp(1.9rem, 3.2vw, 2.4rem);
}
.japan-glance dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}
.japan-glance-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px 18px;
  background: var(--leaf);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 0 6px 0 var(--ink);
}
.japan-glance-item:nth-child(2) {
  background: var(--yellow);
}
.japan-glance-item:nth-child(3) {
  background: var(--coral);
}
.japan-glance-item:nth-child(4) {
  background: var(--blue);
}
.japan-glance dt {
  font: 400 1.5rem/1.1 var(--heading);
}
.japan-glance dd {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.45;
}
.japan-glance-kana {
  font:
    700 1.375rem/1.3 'Kero Japanese',
    var(--body);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.japan-glance-romaji {
  font-weight: 700;
}

/* ── The page: the Jump to list beside the story on wide screens, over it on narrow ones ── */
.japan-page {
  display: grid;
  grid-template-columns: 15rem minmax(0, 46rem);
  justify-content: center;
  gap: 56px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 12px 6% 24px;
}
.japan-jump {
  position: sticky;
  top: 20px;
  align-self: start;
  padding: 16px 20px 12px;
  background: var(--butter);
  border: 3px solid var(--ink);
  border-radius: 20px 18px 22px 17px;
}
.japan-jump h2 {
  margin-bottom: 4px;
  font-size: 1.5rem;
}
.japan-jump ol {
  margin: 0;
  padding-left: 1.4em;
}
.japan-jump li::marker {
  font-weight: 700;
}
/* Each link wears its part's colour as a dot. */
.japan-jump a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  font-weight: 700;
  line-height: 1.35;
}
.japan-jump a::before {
  content: '';
  flex: none;
  width: 0.75em;
  height: 0.75em;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--part);
  transform: translateY(0.05em);
}
.japan-jump a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.japan-part,
.japan-episode,
.japan-say,
.japan-try,
.japan-sources {
  scroll-margin-top: 20px;
}

/* ── A part: a highlighted heading, then its blocks in reading order ── */
.japan-part {
  display: flow-root;
  padding-bottom: 34px;
}
.japan-part h2 {
  margin-bottom: 16px;
  font-size: clamp(2rem, 3.6vw, 2.8rem);
}
.japan-part h2 > span {
  padding: 0 0.12em;
  background: linear-gradient(transparent 58%, var(--part) 58%, var(--part) 92%, transparent 92%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.japan-part p,
.japan-try li {
  font-size: 1.125rem;
  line-height: 1.65;
}
.japan-figure {
  margin: 4px 0 22px;
}
.japan-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--part);
}
.japan-figure figcaption {
  margin-top: 12px;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ── Notes: Did you know?, People say and Careful ── */
.japan-note {
  margin: 4px 0 22px;
  padding: 14px 18px;
  border: 3px solid var(--ink);
  border-radius: 18px 16px 20px 15px;
}
.japan-note p {
  margin: 0;
}
.japan-note--know {
  background: var(--part-soft);
}
.japan-note--say {
  background: white;
  border-style: dashed;
  border-width: 2px;
}
.japan-note-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 10px;
  background: var(--tag, var(--part));
  border-radius: 999px;
  color: var(--tag-ink, var(--ink));
}
.japan-part .japan-careful {
  padding: 12px 16px;
  background: white;
  border: 3px solid var(--red);
  border-radius: 16px;
}
.japan-careful .japan-note-tag {
  background: var(--red);
  color: white;
}
.japan-careful a {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
}

/* ── The chant in a speech bubble ── */
.japan-part .japan-chant {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0 30px;
  padding: 18px 22px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 28px 24px 30px 26px;
  box-shadow: 0 6px 0 var(--part);
}
.japan-chant::after {
  content: '';
  position: absolute;
  bottom: -19px;
  left: 44px;
  width: 26px;
  height: 26px;
  background: white;
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: skewX(-24deg) rotate(45deg);
}
.japan-chant-kana {
  font:
    700 clamp(1.75rem, 5vw, 2.5rem) / 1.25 'Kero Japanese',
    var(--body);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.japan-chant-romaji {
  font-weight: 700;
  color: var(--red);
}

/* ── Setsubun night, step by step ── */
.japan-steps {
  margin: 4px 0 24px;
}
.japan-steps h3 {
  margin-bottom: 12px;
  font-size: 1.6rem;
}
.japan-steps ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.japan-steps li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 16px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 18px 16px 20px 15px;
  font-size: 1rem;
  line-height: 1.45;
  counter-increment: step;
}
.japan-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: 4px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--leaf);
  font: 400 1.25rem/1 var(--heading);
}
.japan-steps li:nth-child(2)::before {
  background: var(--yellow);
}
.japan-steps li:nth-child(3)::before {
  background: var(--coral);
}
.japan-steps li:nth-child(4)::before {
  background: var(--blue);
}
.japan-step-title {
  font: 400 1.3rem/1.1 var(--heading);
}
.japan-steps [lang='ja'] {
  font-weight: 700;
  font-size: 1.1em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ── Where it comes from: three stops down a dotted line, each date over its text, so it reads
   the same on a phone and at 200% text ── */
.japan-timeline {
  display: grid;
  gap: 20px;
  margin: 4px 0 22px 12px;
  padding: 0 0 0 26px;
  border-left: 4px dotted var(--ink);
  list-style: none;
}
.japan-timeline li {
  position: relative;
}
.japan-timeline li::before {
  content: '';
  position: absolute;
  top: 0.45em;
  left: -41px;
  width: 22px;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--part);
  box-sizing: border-box;
}
.japan-timeline-when {
  display: inline-block;
  margin-bottom: 6px;
  padding: 5px 14px;
  background: var(--part);
  border: 3px solid var(--ink);
  border-radius: 999px;
  font: 400 1.25rem/1.1 var(--heading);
}
.japan-timeline p {
  margin: 0;
}

/* ── A row of small cards: the temple chants ── */
.japan-cards-row {
  margin: 4px 0 22px;
}
.japan-part .japan-cards-lead {
  margin-bottom: 12px;
  font-weight: 700;
}
.japan-cards-row ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.japan-cards-row li {
  overflow: hidden;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 18px 16px 20px 15px;
}
.japan-cards-row h3 {
  margin: 0;
  padding: 10px 16px 8px;
  background: var(--leaf);
  border-bottom: 3px solid var(--ink);
  font-size: 1.4rem;
}
.japan-cards-row li:nth-child(2) h3 {
  background: var(--yellow);
}
.japan-cards-row li:nth-child(3) h3 {
  background: var(--blue);
}
.japan-part .japan-cards-row p:not(.japan-cards-lead) {
  margin: 0;
  padding: 12px 16px 14px;
  font-size: 1rem;
  line-height: 1.55;
}

/* ── A picture with a coloured list of parts under it: what an oni has. Each part is a small card
   with a stripe of the part colours along its top, like the Say it cards. ── */
.japan-parts {
  margin: 4px 0 22px;
}
.japan-parts .japan-figure {
  margin-bottom: 16px;
}
.japan-parts-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 10px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.japan-parts-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px 12px;
  background: white;
  border: 2px solid var(--ink);
  border-top: 8px solid var(--leaf);
  border-radius: 16px;
  font-size: 1.0625rem;
  line-height: 1.4;
}
.japan-parts-list li:nth-child(4n + 2) {
  border-top-color: var(--yellow);
}
.japan-parts-list li:nth-child(4n + 3) {
  border-top-color: var(--coral);
}
.japan-parts-list li:nth-child(4n + 4) {
  border-top-color: var(--blue);
}
.japan-parts-list b {
  font: 400 1.3rem/1.2 var(--heading);
}
.japan-parts-list [lang='ja'] {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ── In Kero's Episode 6: a short note with the Watch and Read buttons ── */
.japan-episode {
  margin: 8px 0 8px;
  padding: 20px 22px 22px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 26px 22px 28px 24px;
  box-shadow: 0 6px 0 var(--yellow);
  --part: var(--yellow);
}
.japan-episode h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: clamp(1.7rem, 3vw, 2.1rem);
}
.japan-episode h2::before {
  content: '▶';
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 0.6em;
}
.japan-episode p {
  font-size: 1.125rem;
  line-height: 1.6;
}

/* ── Say it in Japanese: word cards on gold ── */
.japan-say,
.japan-try {
  margin-top: 30px;
  padding: 24px;
  border: 3px solid var(--ink);
  border-radius: 26px 22px 28px 24px;
}
.japan-say {
  background: var(--yellow);
  box-shadow: 0 6px 0 var(--ink);
}
.japan-say h2,
.japan-try h2 {
  margin-bottom: 16px;
  font-size: clamp(1.9rem, 3.2vw, 2.4rem);
}
.japan-words {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Each card wears a stripe of the part colours along its top. */
.japan-word {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-top: 8px solid var(--leaf);
  border-radius: 16px;
}
.japan-word:nth-child(4n + 2) {
  border-top-color: var(--coral);
}
.japan-word:nth-child(4n + 3) {
  border-top-color: var(--blue);
}
.japan-word:nth-child(4n + 4) {
  border-top-color: var(--red);
}
/* The chant is a whole line: it takes the full row, or two cards' room once three fit in a row,
   so the cards around it fill their rows without a gap. */
.japan-word:has(.japan-word-note) {
  grid-column: 1 / -1;
}
@container (min-width: 37.5rem) {
  .japan-word:has(.japan-word-note) {
    grid-column: span 2;
  }
}
.japan-word-kana {
  font:
    700 1.875rem/1.25 'Kero Japanese',
    var(--body);
  /* A chant breaks only after its ！, never inside a word. */
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.japan-word-romaji {
  font-weight: 700;
  color: var(--red);
}
.japan-word-note {
  font-size: 0.9375rem;
  color: var(--muted);
}
/* The Listen button sits at the foot of the card, so a row of cards lines its buttons up
   however much text each card holds. */
.japan-word .pronunciation {
  margin-top: auto;
  padding-top: 10px;
}
.japan-word audio {
  max-width: 100%;
}

/* ── Try it at home: the safety box ── */
.japan-try {
  background: white;
  box-shadow: 0 6px 0 var(--red);
}
.japan-try h2::before {
  content: '!';
  display: inline-grid;
  place-items: center;
  width: 1.2em;
  height: 1.2em;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 0.8em;
  vertical-align: 0.08em;
}
.japan-try-lead {
  font-size: 1.125rem;
  line-height: 1.6;
}
.japan-try ul {
  margin: 0;
  padding-left: 1.3em;
}
.japan-try li {
  margin-bottom: 8px;
}
.japan-try li:first-child {
  font-weight: 700;
}

/* ── Where I checked these facts ── */
.japan-sources {
  margin-top: 40px;
  font-size: 0.9375rem;
  color: var(--muted);
}
.japan-sources h2 {
  margin-bottom: 10px;
  font-size: 1.6rem;
  color: var(--ink);
}
.japan-sources p {
  margin-bottom: 8px;
}
.japan-sources ul {
  margin: 0;
  padding-left: 1.2em;
}
.japan-sources li {
  padding: 4px 0;
}
.japan-sources a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.japan-more {
  padding-top: 32px;
}

@media (max-width: 1000px) {
  .japan-page {
    grid-template-columns: minmax(0, 46rem);
    gap: 24px;
  }
  .japan-jump {
    position: static;
  }
}
@media (min-width: 561px) and (max-width: 1000px) {
  .japan-jump ol {
    columns: 2;
    column-gap: 32px;
  }
  .japan-jump li {
    break-inside: avoid;
  }
}
@media (max-width: 1000px) {
  .japan-glance dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .japan-head-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .japan-hero {
    max-width: 40rem;
  }
}
@media (max-width: 700px) {
  .japan-card,
  .japan-card--wide {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }
  .japan-card-copy {
    padding: 0 6px 6px;
  }
  .japan-head {
    padding-top: 12px;
  }
  .japan-hero img {
    transform: none;
  }
  .japan-say,
  .japan-try,
  .japan-episode {
    padding: 18px 16px;
  }
}
@media (max-width: 560px) {
  .japan-glance dl {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  .japan-card {
    transition: none;
  }
  .japan-card:hover {
    transform: none;
  }
}

/* ════ Lessons ════ */
.learn-room--study {
  /* Pond green, with darker text tones so muted copy and red keep their contrast. */
  --learn-bg: #d9efcb;
  --pond: #8bd1d6;
  --pad: #6fae4f;
  --pad-dark: #3f7a2c;
  --muted: #4a3a2a;
  --red: #8f2a1f;
  --right: #cfeccb;
  --wrong: #f6d2cc;
}
.learn-room--study [lang='ja'] {
  font-family: 'Kero Japanese', var(--body);
}
/*
 * Romaji in the body font takes the capital I with bars (site.css), so いいえ's Iie never reads
 * as "lie". Kept weak (:where), so a romaji in the heading font (Lilita One, whose I has its own
 * bars) keeps it.
 */
:where(.learn-room--study, .play-host) [lang='ja-Latn'] {
  font-family: var(--romaji);
}
/* The numbers and time lessons run the same player on their own peach page. */
.learn-room--study.learn-room--numbers {
  --learn-bg: #ffd9c2;
  --red: #8a2a1f;
}
/* The Vocabulary section: the same player on a soft lilac page. */
.learn-room--study.learn-room--vocab {
  --learn-bg: #e9e0f6;
  --muted: #45372a;
  --red: #84271c;
}
.learn-pick--study {
  background: #e6f5dc;
}
.study-meter {
  display: block;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}
.study-meter > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--pad);
  transition: width 0.3s;
}
.study-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.study-progress-row .study-meter {
  flex: 1;
  min-width: 80px;
}
.study-progress-row p {
  margin: 0;
  font-weight: 700;
}

/* The six lesson cards */
.study-resume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  font-weight: 700;
}
.study-lessons {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}
.study-lesson {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 20px 20px 18px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px 24px 18px 22px;
  box-shadow: 0 5px 0 var(--ink);
  transition:
    transform 0.18s,
    box-shadow 0.18s;
}
.study-lesson:hover {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 0 8px 0 var(--ink);
}
.study-lesson-title {
  font: 1.45rem/1.15 var(--heading);
}
.study-lesson-jp {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--red);
}
.study-lesson-sub {
  color: var(--muted);
  font-size: 0.95rem;
}
.study-lesson .study-meter {
  margin-top: 8px;
}
.study-lesson-progress {
  font-weight: 700;
  font-size: 0.9rem;
}
.study-lesson-progress:empty {
  display: none;
}
.study-lesson.is-done {
  background: #eef8e6;
}
.study-review-banner {
  background: var(--pad-dark);
}
.battle-banner-goro {
  transform: scaleX(-1);
}

/* One lesson: the outline */
.learn-room--study .lesson-head h1.lesson-title {
  font: clamp(2.6rem, 7vw, 4.4rem)/1.05 var(--heading);
  letter-spacing: 0;
}
.study-lesson-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 22px;
  max-width: 760px;
  margin: 0 auto 22px;
}
.study-lesson-bar .study-progress-row {
  flex: 1 1 260px;
}
.study-noscript {
  max-width: 60ch;
  margin: 0 auto 18px;
  padding: 12px 16px;
  background: var(--paper);
  border: 2px dashed var(--ink);
  border-radius: 14px;
  text-align: center;
}
.study-part {
  margin-top: 34px;
  scroll-margin-top: 90px;
}
.study-part > p {
  max-width: 60ch;
}
.study-sections {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}
.study-section {
  padding: 18px 20px 16px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px 24px 18px 26px;
  box-shadow: 5px 5px 0 var(--ink);
}
.study-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.study-section-head > div {
  flex: 1;
  min-width: 0;
}
.study-section-head h3 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
}
.study-section-number {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  padding-top: 0.1em;
  font: 1.15rem/1 var(--heading);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.study-section.is-done .study-section-number {
  background: var(--pad);
}
.study-section-pattern {
  margin: 4px 0 0;
  font-weight: 700;
  color: var(--red);
}
.study-section-count {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: right;
}
.study-sets {
  container-type: inline-size;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  gap: 10px;
}
/* Each set has a Play button beside it, straight into its two games. */
.study-set-item {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.study-set-item > .study-set {
  flex: 1 1 auto;
  min-width: 0;
}
.study-set-play {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 58px;
  padding: 6px 8px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  text-decoration: none;
  background: #3f7a2c;
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.15s;
}
.study-set-play[hidden] {
  display: none;
}
.study-set-play:hover {
  transform: translateY(-2px);
}
.study-play-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.study-set {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  height: 100%;
  min-height: 64px;
  padding: 10px 14px;
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.15s;
}
.study-set:hover {
  transform: translateY(-2px);
}
.study-set-label {
  font: 1.05rem/1.2 var(--heading);
}
.study-set-range {
  grid-column: 1 / -1;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.study-set .study-meter {
  grid-column: 1 / -1;
  height: 8px;
  margin-top: 4px;
}
.study-set-badge {
  grid-row: 1;
  grid-column: 2;
  padding: 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
}
.study-set-badge:empty {
  display: none;
}
.study-set.is-done {
  background: #e3f3d8;
}
.study-set.is-done .study-set-badge {
  color: #fff;
  border-color: var(--pad-dark);
  background: var(--pad-dark);
}
/* Large text on a phone (200%): the set and its Play button stack, and the badge takes its own
   line, so nothing runs off the screen. At normal sizes the query never matches. */
@container (max-width: 13em) {
  .study-set-item {
    flex-direction: column;
  }
  .study-set-play {
    flex-direction: row;
    min-height: 44px;
  }
  .study-set {
    grid-template-columns: minmax(0, 1fr);
  }
  .study-set-badge {
    grid-row: 2;
    grid-column: 1;
    justify-self: start;
  }
}
.study-set--revision {
  background: var(--paper);
  border-style: dashed;
}
.study-set--review {
  background: var(--yellow);
  min-height: 80px;
}
.study-sets--review {
  grid-template-columns: minmax(0, 520px);
}
.study-list {
  margin-top: 12px;
}
.study-list summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.study-list-set {
  scroll-margin-top: 90px;
}
.study-list-set h3,
.study-list-set h4 {
  margin: 12px 0 6px;
  font: 1.1rem/1.2 var(--heading);
}
.study-list-set ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.study-list-set li {
  padding: 8px 12px;
  background: var(--butter);
  border-radius: 12px;
}
/* Make your own without JavaScript: each topic and the words that suit it. */
.study-list-make p {
  margin: 0 0 6px;
}
.study-list-set .study-list-fits {
  gap: 6px;
}
.study-list-set .study-list-fits li {
  padding: 0;
}
.study-list-fits li > [lang='ja']:first-child {
  font-weight: 700;
}
.study-list-word,
.study-list-pattern {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}
.study-list-jp,
.study-pattern-jp {
  font-size: 1.2rem;
  font-weight: 700;
}
.study-list-romaji {
  font-weight: 700;
  color: var(--red);
}
.study-list-note,
.study-list-example,
.study-list-how {
  flex-basis: 100%;
  font-size: 0.9rem;
  color: var(--muted);
}
.study-list-drill summary {
  cursor: pointer;
}
.study-list-answer {
  margin: 6px 0 0;
  font-weight: 700;
}
.study-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0 0 4px;
}
.study-line-jp {
  font-weight: 700;
}
.study-line-romaji {
  color: var(--red);
  font-size: 0.9rem;
}
.study-line-en {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.9rem;
}
.study-speaker {
  font-weight: 700;
}
.study-blank {
  display: inline-block;
  min-width: 2.4em;
  padding: 0 4px;
  margin: 0 2px;
  border-bottom: 3px solid var(--red);
  color: var(--red);
  text-align: center;
}
.study-blank.is-filled {
  background: var(--right);
  border-radius: 6px 6px 0 0;
  color: var(--ink);
  font-weight: 700;
}
.study-review-lessons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
}
.study-review-lessons a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ════ The player ════ */
.study-player {
  scroll-margin-top: 4px;
}
.study-player-head {
  text-align: center;
  margin-bottom: 10px;
}
.study-player-head .eyebrow {
  margin-bottom: 4px;
  color: var(--red);
}
.study-player-head h2 {
  margin: 0 0 2px;
  font-size: clamp(1.8rem, 6vw, 3rem);
}
.study-player-head h2:focus {
  outline: none;
}
.study-player-range {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
}
/* A big review covers studied cards; this adds the rest. */
.study-review-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}
.study-review-all[hidden] {
  display: none;
}
.study-review-all input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--ink);
}
.study-player-head .study-progress-row {
  max-width: 420px;
  margin: 0 auto;
}
/* The tabs and the two sound switches share one row above the stage. */
.study-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
}
.study-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.study-tab {
  min-height: 46px;
  padding: 8px 16px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.study-tab[aria-selected='true'] {
  background: var(--ink);
  color: var(--paper);
}
.study-tab:not([aria-selected='true']):hover {
  background: var(--butter);
}
.study-panel {
  padding: 22px 24px 26px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 24px 20px 26px 18px;
  box-shadow: 6px 6px 0 var(--ink);
}
.study-player-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
/* The set buttons are secondary: the round's own answer or Next is the one primary button. */
.study-player-nav .study-player-next {
  margin-left: auto;
}
.study-count {
  margin: 0 0 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.study-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}
.study-count-row .study-count {
  margin: 0;
}
.study-empty {
  margin: 0;
  text-align: center;
  font-weight: 700;
}
.study-done:empty {
  display: none;
}
.study-results h3 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}
.study-result-detail {
  max-width: 50ch;
}
.study-results.is-record .study-result-kero {
  animation: study-cheer 0.9s ease-in-out 3;
}
.study-tricky-title {
  margin: 0 0 6px;
  font-weight: 700;
}
.study-tricky {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.study-tricky li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 10px;
  background: var(--butter);
  border-radius: 10px;
}
.study-tricky-jp {
  font-weight: 700;
}
.study-tricky-romaji {
  color: var(--red);
}
@keyframes study-cheer {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  30% {
    transform: translateY(-22px) rotate(-8deg);
  }
  60% {
    transform: translateY(0) rotate(6deg);
  }
}

/* ════ Rounds of 4: the round bar, the answer sheet and the round summary ════
 * Shared by Flashcards and Learn (src/client/study-feedback.ts). Props such as cards, choices and
 * the sheet may tilt and squash; Kero only hops and turns as a whole picture.
 */
.learn-room--study {
  --orange: #c9661c;
  --orange-soft: #fde6c8;
  --green-ink: #2f6a24;
}
.round-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  margin: 0 0 12px;
}
.round-bar[hidden] {
  display: none;
}
.round-dots {
  display: flex;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.round-dot {
  width: 14px;
  height: 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  transition:
    background 0.2s,
    transform 0.26s var(--ease-spring);
}
.round-dot.is-now {
  background: var(--butter);
  transform: scale(1.3);
}
.round-dot.is-right {
  background: var(--pad);
}
.round-dot.is-again {
  border-color: var(--orange);
  box-shadow: inset 0 0 0 2px var(--orange);
}
.round-dot.is-miss {
  background: var(--orange);
}
.round-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
}
.round-overall {
  font-weight: 700;
}
.round-streak {
  padding: 1px 10px;
  font: 1.05rem/1.4 var(--heading);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 2px 0 var(--ink);
}
.round-streak[hidden] {
  display: none;
}
.round-streak.is-pop {
  animation: round-pop 0.32s var(--ease-spring);
}
@keyframes round-pop {
  from {
    transform: scale(0.5) rotate(-8deg);
  }
  to {
    transform: none;
  }
}

/* The answer sheet: rises from the bottom of the stage after every answer. */
.answer-sheet {
  position: absolute;
  right: -6px;
  bottom: -6px;
  left: -6px;
  z-index: 4;
  display: grid;
  gap: 8px;
  padding: 12px 14px 14px;
  border: 3px solid var(--ink);
  border-radius: 20px 18px 16px 16px;
  box-shadow:
    0 -6px 18px rgb(57 44 32 / 0.12),
    4px 4px 0 var(--ink);
  opacity: 0;
  transform: translateY(18px);
  transition:
    transform 0.26s var(--ease-out),
    opacity 0.18s;
}
.answer-sheet[hidden] {
  display: none;
}
/* Too long for the screen where it sits: docked to the bottom of the screen, scrolling inside. */
.answer-sheet.is-docked {
  position: fixed;
  right: 8px;
  bottom: 8px;
  left: 8px;
  z-index: 30;
  max-width: 640px;
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.answer-sheet.is-docked .answer-actions {
  position: sticky;
  bottom: -14px;
  margin: 0 -14px -14px;
  padding: 10px 14px 14px;
  background: inherit;
}
.answer-sheet.is-in {
  opacity: 1;
  transform: none;
}
.answer-sheet.is-right {
  background: #e4f5dc;
}
.answer-sheet.is-wrong {
  background: #fff0e6;
}
.answer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font: 1.45rem/1.1 var(--heading);
}
.is-right > .answer-head {
  color: var(--green-ink);
}
.is-wrong > .answer-head {
  color: var(--red);
}
.answer-mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  background: #fff;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.is-in .answer-mark {
  animation: round-pop 0.3s var(--ease-spring);
}
.mark-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.answer-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.answer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin: 0;
  font-weight: 700;
}
.answer-line-jp {
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}
.answer-line-romaji,
.answer-romaji {
  color: var(--red);
}
.answer-big {
  display: grid;
  justify-items: start;
  gap: 1px;
}
.answer-jp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.answer-jp {
  font-size: clamp(1.5rem, 7vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.answer-romaji {
  font: 1.2rem/1.2 var(--heading);
}
.answer-en {
  font-size: 1.08rem;
  font-weight: 700;
}
.answer-given,
.answer-note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.answer-given s {
  color: var(--red);
  font-weight: 700;
}
.answer-given-romaji {
  font-weight: 600;
}
.answer-say {
  width: 34px;
  height: 34px;
  margin: 0;
}
.answer-say .speaker-icon {
  width: 19px;
  height: 19px;
}
.answer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.answer-actions .drawing-button[hidden] {
  display: none;
}
.answer-next {
  position: relative;
  min-width: 132px;
  overflow: hidden;
}
/* A right answer moves on by itself: a thin bar fills along the Next button meanwhile. */
.answer-timer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--ink);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
}
.answer-sheet.is-auto.is-in .answer-timer {
  opacity: 0.35;
  animation: answer-timer 0.9s linear forwards;
}
@keyframes answer-timer {
  to {
    transform: scaleX(1);
  }
}

/* The round summary: Kero, stars, the four answers, one clear next step. */
.study-done[hidden] {
  display: none;
}
.round-summary {
  position: relative;
  display: grid;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
}
.round-summary-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.round-summary-kero {
  flex: none;
  width: 92px;
  height: auto;
}
.round-summary.is-cheer .round-summary-kero {
  animation: kero-cheer 0.8s var(--ease-out) 2;
}
@keyframes kero-cheer {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  35% {
    transform: translateY(-24px) rotate(-8deg);
  }
  65% {
    transform: translateY(0) rotate(5deg);
  }
}
.round-summary-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.round-summary-title {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.3rem);
}
.round-summary-title:focus {
  outline: none;
}
.round-summary-detail {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.round-stars {
  display: flex;
  gap: 4px;
  margin: 0;
}
.round-star .hop-star {
  display: block;
  width: 34px;
  height: 32px;
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linejoin: round;
}
.round-star.is-on .hop-star {
  fill: var(--yellow);
}
.round-star {
  animation: round-pop 0.34s var(--ease-spring) both;
}
.round-star:nth-child(2) {
  animation-delay: 0.12s;
}
.round-star:nth-child(3) {
  animation-delay: 0.24s;
}
.round-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.round-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
}
.round-row-mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.round-row-mark .mark-icon {
  width: 16px;
  height: 16px;
}
.round-row.is-right .round-row-mark {
  color: var(--green-ink);
  background: var(--right);
}
.round-row.is-again .round-row-mark {
  color: var(--orange);
  background: var(--orange-soft);
}
.round-row-words {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 10px;
  min-width: 0;
}
.round-row-jp {
  font-size: 1.15rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.round-row-romaji {
  color: var(--red);
  font-weight: 700;
}
.round-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.round-actions > :first-child {
  flex: 1 1 200px;
}
.round-play {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 2px dashed rgb(57 44 32 / 0.25);
}
.round-play-label {
  margin-right: 4px;
  font: 1.1rem/1 var(--heading);
}
.round-play-link {
  flex: 1 1 0;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}
.round-confetti {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ════ Flashcards: a stack of cards to flip and swipe ════ */
.cards-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-width: 520px;
  margin: 0 auto;
}
.cards-stage[hidden] {
  display: none;
}
.card-deck {
  position: relative;
  display: grid;
  margin-bottom: 8px;
  /* A sorted card flies off sideways. Left unclipped, that overflow plus the next card rising
     made phone browsers scroll the page to the top on every Know it or Still learning. Clip
     sideways only, with room for the cards' offset shadow. */
  overflow-x: clip;
  overflow-clip-margin: 12px;
}
.card-ghost {
  grid-area: 1 / 1;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 4px 4px 0 var(--ink);
}
.card-ghost[hidden] {
  display: none;
}
.card-ghost--1 {
  transform: translateY(7px) rotate(1.6deg) scale(0.975);
}
.card-ghost--2 {
  background: #f4ead2;
  transform: translateY(13px) rotate(-2.2deg) scale(0.95);
}
.flashcard {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
  touch-action: pan-y;
}
.flashcard.is-rising {
  animation: card-rise 0.24s var(--ease-out);
}
@keyframes card-rise {
  from {
    transform: translateY(10px) scale(0.95);
  }
}
.flashcard--flyer {
  z-index: 3;
  pointer-events: none;
}
.flashcard--flyer .flashcard-stamp.is-shown {
  opacity: 1;
}
.flashcard.is-flying {
  transition:
    transform 0.22s var(--ease-in),
    opacity 0.22s ease-in;
}
.flashcard.is-back {
  transition: transform 0.26s var(--ease-spring);
}
.flashcard-face {
  display: block;
  width: 100%;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-align: center;
  background: none;
  border: 0;
  border-radius: 22px 18px 24px 20px;
  cursor: grab;
  touch-action: pan-y;
  perspective: 1400px;
  -webkit-tap-highlight-color: transparent;
}
.flashcard.is-dragging .flashcard-face {
  cursor: grabbing;
}
.flashcard-face:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 4px;
}
.flashcard-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.32s var(--ease-spring);
}
.flashcard.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-side {
  grid-area: 1 / 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  /* Tall enough for most backs (a note included), so the buttons stay put from card to card. */
  min-height: 290px;
  padding: 26px 20px 28px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 6px 6px 0 var(--ink);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.study-card-back.flashcard-side {
  background: #eef8e6;
  transform: rotateY(180deg);
}
.flashcard-stamp {
  position: absolute;
  top: 62px;
  z-index: 2;
  padding: 4px 12px;
  font: 1.25rem/1.2 var(--heading);
  background: rgb(255 255 255 / 0.88);
  border: 3px solid currentColor;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
}
.flashcard-stamp.is-know {
  left: 16px;
  color: var(--green-ink);
  transform: rotate(-12deg);
}
.flashcard-stamp.is-learning {
  right: 16px;
  color: var(--orange);
  transform: rotate(10deg);
}
.flashcard-again {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--orange-soft);
  border: 2px solid var(--ink);
  border-radius: 999px;
  pointer-events: none;
}
.flashcard-again[hidden] {
  display: none;
}
.study-card-sound {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  gap: 8px;
}
.study-card-hint {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}
.study-card-jp {
  font-size: clamp(2rem, 9.5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.study-card-romaji {
  font: 1.7rem/1.1 var(--heading);
  color: var(--red);
}
.study-card-meaning {
  font: clamp(1.6rem, 6vw, 2.2rem)/1.15 var(--heading);
}
.study-card-visual .learn-art,
.study-card-visual .clock,
.study-card-visual .visual {
  width: 104px;
  height: 104px;
}
.study-card-visual .visual--days,
.study-card-visual .visual--span,
.study-card-visual .visual--week {
  width: 170px;
  height: auto;
}
.study-card-kana {
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.study-card-example {
  display: grid;
  gap: 2px;
  max-width: 40ch;
  padding: 8px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  font-size: 0.95rem;
}
.study-card-example-jp {
  font-size: 1.1rem;
  font-weight: 700;
}
.study-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}
.study-card-note {
  max-width: 42ch;
  font-size: 0.95rem;
  color: var(--muted);
}
.study-card-pattern {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 700;
}
.study-card-line {
  display: grid;
  gap: 2px;
}
.study-card-speaker {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}
.study-card-sentence {
  font-size: clamp(1.35rem, 5vw, 1.9rem);
  font-weight: 700;
}
.study-card-romaji-small {
  color: var(--red);
  font-weight: 700;
}
.study-card-english {
  font-size: 1.1rem;
}
.study-piles {
  display: grid;
  /* Side by side, or one above the other once large text no longer fits two. */
  grid-template-columns: repeat(auto-fit, minmax(min(6.5rem, 100%), 1fr));
  gap: 12px;
}
.study-pile {
  min-height: 54px;
  gap: 8px;
  padding: 8px 10px;
}
.study-pile--learning {
  background: var(--orange-soft);
}
.study-pile-count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  font-size: 0.85rem;
  background: rgb(255 255 255 / 0.75);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.study-pile-arrow {
  font-size: 1.1rem;
}
.card-sides {
  justify-self: center;
}
.study-toggle {
  display: inline-flex;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}
.study-chip {
  min-height: 44px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
}
.study-toggle .study-chip {
  border: 0;
  border-radius: 0;
}
.study-toggle .study-chip + .study-chip {
  border-left: 2px solid var(--ink);
}
.study-chip[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
@media (min-width: 720px) {
  .flashcard-side {
    min-height: 320px;
  }
}
@media (max-width: 380px) {
  .study-pile {
    font-size: 0.9rem;
    gap: 6px;
  }
  .study-pile-arrow {
    display: none;
  }
  .flashcard-side {
    min-height: 250px;
  }
}

/* ════ Learn: one question at a time, on a stage that never jumps ════ */
.ask-stage {
  position: relative;
  min-height: 360px;
  max-width: 620px;
  margin: 0 auto;
}
.ask-stage[hidden] {
  display: none;
}
.ask-question {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  text-align: center;
}
.ask-prompt {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.ask-target {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-height: 100px;
  padding: 12px 46px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px 16px 22px 18px;
  box-shadow: 4px 4px 0 var(--ink);
}
.ask-target--sentence {
  padding: 12px 14px;
}
.ask-target:focus {
  outline: none;
}
.ask-target:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.ask-target--gap {
  justify-items: stretch;
  padding: 12px 14px;
  text-align: left;
}
.ask-target--listen {
  background: var(--butter);
}
.ask-jp {
  font-size: clamp(1.9rem, 8.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.ask-jp.is-long,
.ask-line-jp.is-very-long {
  font-size: clamp(1.6rem, 6vw, 2.3rem);
}
.ask-jp.is-very-long {
  font-size: clamp(1.3rem, 5vw, 1.8rem);
}
.ask-romaji {
  font: 1.25rem/1.2 var(--heading);
  color: var(--red);
}
.ask-romaji--line {
  font: 700 1rem/1.3 var(--romaji);
}
.ask-line--romaji {
  justify-content: center;
}
.ask-en {
  font: clamp(1.5rem, 6vw, 2.1rem)/1.15 var(--heading);
}
.ask-target .ask-say {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
}
.ask-visual .learn-art,
.ask-visual .clock,
.ask-visual .visual {
  width: 88px;
  height: 88px;
}
.ask-visual .visual--days,
.ask-visual .visual--span,
.ask-visual .visual--week {
  width: 150px;
  height: auto;
}
.ask-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0;
}
.ask-line-speaker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ask-line-jp {
  font-size: clamp(1.3rem, 5.4vw, 1.8rem);
  font-weight: 700;
}
/* Japanese with spaces between its words wraps at the spaces, never inside a word: everywhere
   in the lessons (the Pattern tab, word lists, blocks), not just in the questions. */
.learn-room--study [lang='ja'],
.ask-line-jp,
.ask-jp,
.answer-jp,
.answer-line-jp,
.round-row-jp,
.study-card-sentence,
.study-card-jp,
.study-card-kana,
.ask-choice-jp {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.ask-line--before .ask-line-jp {
  font-size: 1.05rem;
}
.ask-line-en {
  flex-basis: 100%;
  font-size: 0.9rem;
  color: var(--muted);
}
.ask-target .ask-line--main .ask-say {
  position: static;
  width: 32px;
  height: 32px;
}
.ask-choices {
  display: grid;
  gap: 8px;
}
.ask-choices[hidden] {
  display: none;
}
.ask-choices.is-grid {
  grid-template-columns: 1fr 1fr;
}
.ask-choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 6px 14px;
  font: 700 1.05rem/1.25 var(--body);
  color: var(--ink);
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  overflow-wrap: anywhere;
  transition:
    transform 90ms,
    box-shadow 90ms,
    background 0.15s;
}
/* Hover only where there is a mouse: on a phone a tap leaves :hover on the spot, and the next
   question's choice under it would look picked already. */
@media (hover: hover) {
  .ask-choice:not(:disabled):hover {
    background: var(--butter);
  }
}
.ask-choice:not(:disabled):active {
  box-shadow: 0 1px 0 var(--ink);
  transform: translateY(3px);
}
.ask-choice:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.ask-choice:disabled {
  cursor: default;
}
.ask-choice:disabled:not(.is-right, .is-wrong) {
  opacity: 0.5;
}
.ask-choice.is-right {
  background: var(--right);
  animation: choice-pop 0.3s var(--ease-spring);
}
.ask-choice.is-wrong {
  background: var(--wrong);
  animation: choice-shake 0.24s;
}
@keyframes choice-pop {
  50% {
    transform: scale(1.05);
  }
}
@keyframes choice-shake {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.ask-choice-key {
  display: none;
  position: absolute;
  top: 4px;
  left: 7px;
  font-size: 0.72rem;
  color: var(--muted);
}
@media (hover: hover) and (pointer: fine) {
  .ask-choice-key {
    display: block;
  }
}
.ask-choice-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.ask-choice-jp {
  font-size: 1.35rem;
}
.ask-choice-jp.is-long {
  font-size: 1.1rem;
}
.ask-dunno {
  min-height: 44px;
  padding: 6px 12px;
  font: 700 0.95rem/1.2 var(--body);
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
.ask-dunno:disabled {
  opacity: 0.5;
  cursor: default;
}
.ask-question.is-enter .ask-target,
.ask-question.is-enter .ask-choice {
  animation: learn-in 0.26s var(--ease-out) both;
}
.ask-question.is-enter .ask-choice:nth-child(2) {
  animation-delay: 0.04s;
}
.ask-question.is-enter .ask-choice:nth-child(3) {
  animation-delay: 0.08s;
}
.ask-question.is-enter .ask-choice:nth-child(4) {
  animation-delay: 0.12s;
}
/* Slide and settle without fading, so the question and its answers are readable (and pass the
   contrast audit) from the first frame. */
@keyframes learn-in {
  from {
    transform: translateY(10px) scale(0.96);
  }
}
/* A finished set or run has its own Next button, so the player's set buttons step aside. */
.study-player:has(.study-panel:not([hidden]) .round-play) .study-player-nav,
.study-player:has(.study-panel:not([hidden]) .round-summary--end) .study-player-nav,
.study-player:has(.study-panel:not([hidden]) .make-done) .study-player-nav {
  display: none;
}
@media (max-width: 520px) {
  /* On a phone the round needs the room; the set's words are on its cards. */
  .study-player-range {
    display: none;
  }
  .ask-question {
    gap: 10px;
  }
}
.study-pattern-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
@media (prefers-reduced-motion: reduce) {
  .flashcard-inner,
  .flashcard.is-flipped .flashcard-inner {
    transform: none;
    transition: none;
  }
  .flashcard-side {
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    transition: opacity 0.15s;
  }
  .study-card-back.flashcard-side {
    visibility: hidden;
    opacity: 0;
    transform: none;
  }
  .flashcard.is-flipped .study-card-back {
    visibility: visible;
    opacity: 1;
  }
  .flashcard.is-flipped .study-card-front {
    visibility: hidden;
    opacity: 0;
  }
  .flashcard.is-rising,
  .ask-question.is-enter .ask-target,
  .ask-question.is-enter .ask-choice,
  .ask-choice.is-right,
  .ask-choice.is-wrong,
  .round-streak.is-pop,
  .round-star,
  .is-in .answer-mark,
  .round-summary.is-cheer .round-summary-kero {
    animation: none;
  }
  .answer-sheet {
    transform: none;
    transition: opacity 0.15s;
  }
  .answer-sheet.is-auto.is-in .answer-timer {
    animation: none;
  }
  .round-dot,
  .ask-choice {
    transition: none;
  }
}
@media (forced-colors: active) {
  .round-dot.is-right,
  .round-dot.is-miss,
  .round-dot.is-now {
    background: Highlight;
  }
  .answer-sheet,
  .flashcard-side,
  .ask-choice {
    border-color: CanvasText;
  }
}

/* Lily pads and Gyoza Grab: see the sections at the end of this file. */

/* Grammar */
.study-patterns {
  display: grid;
  gap: 16px;
}
.study-patterns-intro {
  margin: 0;
  font-weight: 700;
}
.study-pattern-card {
  padding: 18px 20px;
  background: var(--butter);
  border: 3px solid var(--ink);
  border-radius: 18px 22px 16px 20px;
}
.study-pattern-card .eyebrow {
  margin-bottom: 4px;
  color: var(--red);
}
.study-pattern-card .study-pattern-jp {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
}
.study-pattern-romaji {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--red);
}
.study-pattern-meaning {
  margin: 0 0 6px;
  font: 1.3rem/1.2 var(--heading);
}
.study-pattern-how {
  max-width: 62ch;
  margin: 0;
}
.study-examples-title {
  margin: 16px 0 8px;
  font: 1.15rem/1.2 var(--heading);
}
.study-examples {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.study-example {
  padding: 10px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
}
.study-say {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 0 0 8px;
}
.study-say-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.study-say:last-child {
  margin-bottom: 0;
}
.study-say-name {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.study-say-jp {
  font-size: 1.25rem;
  font-weight: 700;
}
.study-say-romaji {
  color: var(--red);
  font-weight: 700;
}
.study-say-en {
  color: var(--muted);
}
.study-face {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: cover;
  object-position: top;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.study-face--text {
  display: inline-grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--butter);
}
.study-more-examples,
.study-pattern-fold {
  margin-top: 12px;
}
.study-more-examples summary,
.study-pattern-fold summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  min-height: 44px;
  padding: 8px 0;
  font-weight: 700;
  cursor: pointer;
}
.study-pattern-fold {
  padding: 4px 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
}
.study-pattern-fold[open] {
  padding-bottom: 14px;
}
.study-fold-jp {
  font-size: 1.2rem;
}
.study-fold-en {
  color: var(--muted);
}
.study-gap-hint {
  margin: 6px 0 0;
  font-weight: 700;
  color: var(--red);
}

@media (max-width: 720px) {
  .study-panel {
    padding: 14px 12px 16px;
  }
  .study-section {
    padding: 16px 14px 14px;
  }
  .study-section-head {
    flex-wrap: wrap;
  }
  .study-section-count {
    flex-basis: 100%;
    text-align: left;
  }
  .study-sets {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .study-lesson,
  .study-set,
  .study-meter > span {
    transition: none;
  }
  .study-lesson:hover,
  .study-set:hover,
  .study-tile[aria-pressed='true'] {
    transform: none;
  }
}
@media (forced-colors: active) {
  .study-set,
  .study-section,
  .study-panel,
  .study-card-face,
  .study-tile,
  .study-lesson {
    box-shadow: none;
  }
  .study-tab[aria-selected='true'],
  .study-chip[aria-pressed='true'],
  .study-tile[aria-pressed='true'] {
    outline: 3px solid Highlight;
  }
  .hop-label {
    border-color: CanvasText;
  }
}

/* Long phrases shrink so they still fit a phone. */
.study-card-jp.is-long {
  font-size: clamp(1.6rem, 6vw, 2.3rem);
}
.study-card-jp.is-very-long {
  font-size: clamp(1.3rem, 5vw, 1.8rem);
}
.learn-room--study.is-playing > .learn-back {
  display: none;
}
@media (max-width: 520px) {
  .study-tabs {
    gap: 5px;
  }
  .study-tab {
    min-height: 44px;
    padding: 6px 11px;
    font-size: 0.9rem;
  }
  .study-bar {
    gap: 6px;
  }
  /* On a phone the switches show just their icons; their names stay for screen readers. */
  .study-switch {
    justify-content: center;
    width: 44px;
    padding: 0;
  }
  .study-switch-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
@media (max-width: 360px) {
  .study-tab {
    padding: 6px 8px;
    font-size: 0.86rem;
  }
}

/* While a set is open, the lesson title shrinks to one line above the player. */
.learn-room--study.is-playing .study-head {
  margin-bottom: 6px;
}
.learn-room--study.is-playing .study-head h1.lesson-title {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
}
.learn-room--study.is-playing .study-head .eyebrow,
.learn-room--study.is-playing .study-head .lesson-romaji,
.learn-room--study.is-playing .study-head .study-summary {
  display: none;
}

/* ════ Lily pads ════
 * One portrait stage: the painted pond scrolls under a camera, the pads are drawn in code, and
 * Kero and Goro move only as whole pictures (translate, rotate, uniform scale, opacity).
 * JavaScript sets transforms through the CSSOM, never a style attribute.
 */
.learn-room--study,
.play-host {
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.9, 0.4);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* The games also run on the kana and numbers lessons, which have their own page colours. */
.play-host {
  --pond: #8bd1d6;
  --pad: #6fae4f;
  --pad-dark: #3f7a2c;
  --right: #cfeccb;
  --wrong: #f6d2cc;
}
.play-host [lang='ja'] {
  font-family: 'Kero Japanese', var(--body);
}
.study-panel[data-panel='play'] {
  padding: 10px;
}
.hop-stage {
  position: relative;
  width: min(100%, 520px);
  height: clamp(460px, calc(100vh - 28px), 720px);
  height: clamp(460px, calc(100svh - 28px), 720px);
  /* Taller only when a long card needs it, so the pads ahead stay clear (study-hop.ts). */
  min-height: var(--hop-need-h, 0px);
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
  background: #5ed8c3;
  border: 3px solid var(--ink);
  border-radius: 20px;
  scroll-margin-top: 10px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.hop-scene,
.hop-fx,
.hop-front {
  position: absolute;
  inset: 0;
}
.hop-scene {
  z-index: 0;
}
.hop-scene.is-arriving {
  animation: hop-fade-in 0.35s ease-out;
}
.hop-fx {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hop-scene.is-shaking {
  animation: hop-shake 0.2s linear;
}
.hop-world {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  will-change: transform;
}
.hop-water,
.hop-far-water {
  background-color: #5ed8c3;
  background-image: url('/assets/study/pond-water-720.webp');
  background-image: -webkit-image-set(
    url('/assets/study/pond-water-720.webp') 1x,
    url('/assets/study/pond-water.webp') 2x
  );
  background-image: image-set(
    url('/assets/study/pond-water-720.webp') 1x,
    url('/assets/study/pond-water.webp') 2x
  );
  background-repeat: repeat-y;
  background-size: 100% auto;
}
.hop-water {
  position: absolute;
  inset: 0;
}
.hop-far {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}
.hop-far.is-moving {
  transition: transform 0.42s var(--ease-out);
}
.hop-sky {
  position: relative;
  height: 1600px;
  background: linear-gradient(to bottom, #f1fbff 0%, #d6f2fd 70%, #bcebfe 100%);
}
/* Two soft clouds just above the far bank's roofs, drawn in code. */
.hop-sky::before,
.hop-sky::after {
  content: '';
  position: absolute;
  bottom: 34px;
  width: 30%;
  height: 34px;
  background:
    radial-gradient(circle at 30% 70%, #fff 0 38%, transparent 40%),
    radial-gradient(circle at 55% 45%, #fff 0 44%, transparent 46%),
    radial-gradient(circle at 78% 70%, #fff 0 34%, transparent 36%);
  opacity: 0.9;
}
.hop-sky::before {
  left: 8%;
}
.hop-sky::after {
  right: 6%;
  bottom: 70px;
  width: 24%;
  opacity: 0.75;
}
.hop-far-art {
  display: block;
  width: 100%;
  height: auto;
  margin-top: -1px;
}
.hop-far-water {
  height: 0;
  margin-top: -1px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.hop-near {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: auto;
}
/* Light glinting on the water: two drifting layers of code-drawn highlights. */
.hop-shimmer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
.hop-shimmer::before,
.hop-shimmer::after {
  content: '';
  position: absolute;
  inset: -40px -60px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='170'%3E%3Cg fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-width='2.4'%3E%3Cpath d='M18 30q9-6 18 0'/%3E%3Cpath d='M122 74q11-7 22 0'/%3E%3Cpath d='M58 128q8-5 16 0'/%3E%3Cpath d='M176 146q8-5 16 0'/%3E%3C/g%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='92' cy='22' r='1.8'/%3E%3Ccircle cx='172' cy='98' r='1.5'/%3E%3Ccircle cx='34' cy='88' r='1.3'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.32;
  animation: hop-drift 9s ease-in-out infinite alternate;
}
.hop-shimmer::after {
  background-position: 110px 60px;
  opacity: 0.22;
  animation:
    hop-drift 12s ease-in-out -4s infinite alternate-reverse,
    hop-twinkle 3.6s ease-in-out infinite alternate;
}
.hop-rows {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hop-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
}
.hop-pad {
  position: absolute;
  bottom: 0;
  width: 29%;
  padding: 0;
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  transform: translate(-50%, 50%);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.hop-row--3 .hop-pad:nth-child(1) {
  left: 20%;
}
.hop-row--3 .hop-pad:nth-child(2) {
  left: 50%;
}
.hop-row--3 .hop-pad:nth-child(3) {
  left: 80%;
}
.hop-row--2 .hop-pad {
  width: 38%;
}
.hop-row--2 .hop-pad:nth-child(1) {
  left: 30%;
}
.hop-row--2 .hop-pad:nth-child(2) {
  left: 70%;
}
.hop-pad:disabled {
  cursor: default;
}
.hop-pad:focus {
  outline: none;
}
.hop-pad-sink,
.hop-pad-float,
.hop-pad-bob {
  position: relative;
  display: block;
}
.hop-pad-float {
  transition:
    transform 0.32s var(--ease-spring),
    opacity 0.28s ease-out;
}
.hop-pad:nth-child(2) .hop-pad-float {
  transition-delay: 60ms;
}
.hop-pad:nth-child(3) .hop-pad-float {
  transition-delay: 120ms;
}
.hop-row.is-submerged .hop-pad-float {
  opacity: 0.45;
  transform: translateY(10px) scale(0.86);
}
.hop-row.is-submerged .hop-label,
.hop-row.is-submerged .hop-lotus {
  visibility: hidden;
}
.hop-pad-bob {
  animation: hop-bob 3s ease-in-out infinite;
}
.hop-pad:nth-child(2) .hop-pad-bob {
  animation-delay: -1s;
}
.hop-pad:nth-child(3) .hop-pad-bob {
  animation-delay: -2s;
}
/* A slow ring of water spreading round each pad. */
.hop-pad-sink::before {
  content: '';
  position: absolute;
  left: 2%;
  right: 2%;
  top: 34%;
  height: 52%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  opacity: 0;
  animation: hop-ripple 3.4s ease-out infinite;
}
.hop-pad:nth-child(2) .hop-pad-sink::before {
  animation-delay: -1.2s;
}
.hop-pad:nth-child(3) .hop-pad-sink::before {
  animation-delay: -2.3s;
}
.hop-leaf {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.hop-leaf-shadow {
  fill: rgba(12, 74, 78, 0.24);
}
.hop-leaf-under {
  fill: #2f6a25;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.hop-leaf-top {
  fill: #6fb04e;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.hop-leaf-light {
  fill: #93d468;
  opacity: 0.75;
}
.hop-leaf-vein {
  fill: none;
  stroke: #3f7a2c;
  stroke-width: 1.8;
  stroke-linecap: round;
  opacity: 0.8;
}
.hop-lotus {
  position: absolute;
  top: -30%;
  right: -4%;
  width: 30%;
  height: auto;
  pointer-events: none;
}
.hop-label {
  position: absolute;
  top: 48%;
  left: 50%;
  display: block;
  width: max-content;
  max-width: 92%;
  padding: 3px 7px;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.18;
  text-align: center;
  overflow-wrap: break-word;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 2px 0 var(--ink);
  transform: translate(-50%, -50%);
  transition: transform 0.15s var(--ease-out);
}
.hop-label:empty {
  display: none;
}
.hop-key {
  position: absolute;
  top: -9px;
  left: -9px;
  display: none;
  width: 20px;
  height: 20px;
  font: 700 0.72rem/16px var(--body);
  text-align: center;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--paper);
  border-radius: 50%;
}
@media (hover: hover) and (pointer: fine) {
  .hop-key {
    display: block;
  }
}
.hop-label.is-long {
  font-size: 0.8rem;
}
.hop-label.is-very-long {
  font-size: 0.72rem;
}
.hop-label.is-jp {
  max-width: 100%;
  padding-inline: 5px;
}
.hop-label-jp {
  display: block;
  font-size: 1.22rem;
  line-height: 1.15;
  white-space: nowrap;
}
.hop-label.is-long .hop-label-jp {
  font-size: 1.04rem;
}
.hop-label.is-very-long .hop-label-jp {
  font-size: 0.88rem;
}
.hop-label.is-wrap .hop-label-jp {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
@media (hover: hover) {
  .hop-pad:not(:disabled):hover .hop-label {
    transform: translate(-50%, -58%);
  }
}
.hop-pad:focus-visible .hop-label {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.hop-pad.is-pressed .hop-pad-float {
  transform: translateY(3px);
  transition-duration: 0.09s;
}
.hop-pad.is-landed .hop-pad-float {
  animation: hop-dip 0.38s var(--ease-out);
}
.hop-pad.is-right .hop-label {
  background: var(--right);
  opacity: 0;
  transition: opacity 0.2s 0.15s;
}
.hop-pad.is-gone .hop-pad-float {
  animation: hop-wobble-sink 0.7s ease-in forwards;
}
.hop-pad.is-tipped .hop-pad-float {
  animation: hop-tip 0.45s var(--ease-in) 0.05s forwards;
}
.hop-pad.is-under .hop-pad-float {
  animation: hop-under 0.4s ease-in forwards;
}
.hop-pad.is-gold .hop-pad-float {
  animation: hop-resurface 0.4s var(--ease-spring) both;
}
.hop-pad.is-gold .hop-label {
  background: #ffe08a;
}
.hop-pad-bob::after {
  content: '';
  position: absolute;
  left: -6%;
  right: -6%;
  top: 8%;
  height: 84%;
  border: 4px solid #ffd23f;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.hop-pad.is-gold .hop-pad-bob::after {
  animation: hop-glow 0.8s ease-in-out 0.4s 2 both;
}
/* A streak of three makes the labels glint. */
.hop-row.is-glinting .hop-label {
  background-image: linear-gradient(
    110deg,
    transparent 30%,
    rgba(255, 236, 160, 0.9) 48%,
    transparent 66%
  );
  background-size: 260% 100%;
  animation: hop-glint 1.4s ease-in-out 0.3s 1 both;
}

/* Kero and his shadow */
.hop-kero {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--kero-w, 86px);
  will-change: transform;
  pointer-events: none;
}
.hop-kero-sink {
  position: relative;
  display: block;
  transform-origin: 50% 100%;
}
.hop-kero-sink.is-sinking {
  overflow: hidden;
  margin-top: -220px;
  padding-top: 220px;
}
.hop-kero-img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 100%;
}
.hop-stage[data-state='ready'] .hop-kero-sink,
.hop-stage[data-state='intro'] .hop-kero-sink {
  animation: hop-breathe 2.6s ease-in-out infinite;
}
.hop-kero.is-happy .hop-kero-sink {
  animation: hop-happy 0.46s var(--ease-out) 2;
}
.hop-kero.is-startled .hop-kero-sink {
  animation: hop-startle 0.42s var(--ease-out);
}
.hop-shadow {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(var(--kero-w, 86px) * 0.72);
  height: calc(var(--kero-w, 86px) * 0.2);
  background: rgba(16, 58, 52, 0.3);
  border-radius: 50%;
  pointer-events: none;
}

/* Reeds in front, and Goro hiding behind the right-hand clump */
.hop-front {
  overflow: hidden;
  pointer-events: none;
}
.hop-reeds {
  position: absolute;
  bottom: -3%;
  width: auto;
  height: 25%;
  transform-origin: 50% 100%;
  animation: hop-sway 5s ease-in-out infinite alternate;
}
.hop-reeds--left {
  left: -8%;
  height: 22%;
}
.hop-hide {
  position: absolute;
  right: -7%;
  bottom: -3%;
  height: 26%;
  aspect-ratio: 568 / 900;
}
.hop-reeds-clump {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
  animation: hop-sway 5s ease-in-out -2.4s infinite alternate;
}
.hop-goro {
  position: absolute;
  left: 6%;
  bottom: 34%;
  width: 84%;
  transform: translateY(110%);
  transition: transform 0.26s var(--ease-spring);
}
.hop-goro.is-peek {
  transform: translateY(6%);
  transition-duration: 0.4s;
  transition-timing-function: var(--ease-out);
}
.hop-goro.is-up {
  transform: translateY(-72%);
}
.hop-goro.is-sulking {
  transform: translateY(70%) rotate(-10deg);
  transition-duration: 0.7s;
  transition-timing-function: var(--ease-in);
}
.hop-goro-img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 90%;
}
.hop-goro.is-peek .hop-goro-img {
  animation: hop-look 4.2s ease-in-out infinite;
}
.hop-goro.is-laughing .hop-goro-img {
  animation: hop-laugh 0.5s ease-in-out 2;
}

/* Heads-up: takoyaki, crossing, streak, sound */
.hop-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  pointer-events: none;
}
.hop-hud > * {
  pointer-events: auto;
}
.hop-hud.is-quiet .hop-boat,
.hop-hud.is-quiet .hop-crossing,
.hop-hud.is-quiet .hop-combo,
.hop-stage[data-state='results'] .hop-crossing,
.hop-stage[data-state='results'] .hop-combo {
  visibility: hidden;
}
.hop-boat {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  width: 94px;
  height: 40px;
  padding: 0 8px 7px;
}
.hop-boat-tray {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 22px;
}
.hop-boat-wood {
  fill: #ecc98c;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}
.hop-boat-grain {
  fill: none;
  stroke: #c79a55;
  stroke-width: 1.4;
}
.hop-boat-ball {
  position: relative;
  width: 26px;
  height: 26px;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.hop-boat-ball.is-gone {
  opacity: 0;
  transform: scale(0.4);
}
.hop-tako {
  display: block;
  width: 100%;
  height: 100%;
}
.hop-tako-ball {
  fill: #d99140;
  stroke: var(--ink);
  stroke-width: 2;
}
.hop-tako-shade {
  fill: #b4692a;
}
.hop-tako-sauce {
  fill: #5b2d14;
}
.hop-tako-mayo {
  fill: none;
  stroke: #fffaf0;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hop-tako-nori {
  fill: #3f8a2c;
}
.hop-tako-flake {
  fill: #f0c49a;
}
.hop-tako-shine {
  fill: none;
  stroke: #f3c27c;
  stroke-width: 2;
  stroke-linecap: round;
}
.hop-flyer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: 26px;
  height: 26px;
  pointer-events: none;
}
.hop-crossing {
  margin: 0 auto;
  padding: 2px 10px;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.hop-crossing:empty {
  visibility: hidden;
}
.hop-combo {
  margin: 0;
  padding: 2px 8px;
  font: 1.05rem/1.2 var(--heading);
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
}
.hop-combo:empty {
  display: none;
}
.hop-combo.is-hot {
  color: var(--yellow);
}
.hop-sound {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
}
.hop-sound .speaker-icon {
  width: 24px;
  height: 24px;
}
.hop-sound[aria-pressed='false'] .speaker-waves {
  opacity: 0;
}
.hop-sound[aria-pressed='false']::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 3px;
  background: var(--ink);
  border-radius: 2px;
  transform: rotate(-45deg);
}
.hop-sound:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}

/* The prompt card: the question, then the answer in the same place */
.hop-card {
  position: absolute;
  top: 58px;
  left: 10px;
  right: 10px;
  z-index: 3;
  padding: 12px 14px 16px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink);
}
.hop-card[hidden] {
  display: none;
}
.hop-card:focus {
  outline: none;
}
.hop-card:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.hop-card.is-right {
  background: #effae9;
}
.hop-card.is-wrong {
  background: #fff3ee;
}
.hop-card-body {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 3px;
  max-height: calc(var(--stage-h, 600px) - 100px);
  overflow-y: auto;
}
/* A short prompt with no speaker (a sound to pick the kana for, a particle's job) never needs
   scrolling, and with nothing in it to focus it must not become a scroll box at all: a romaji
   sound overflows its line box by a few pixels, which would show a scroll bar on Windows and
   fail the keyboard scroll check. */
.hop-card-body:not(:has(button)) {
  overflow: visible;
}
.hop-card-body.is-new {
  animation: hop-card-in 0.22s var(--ease-out);
}
.hop-clock-ring {
  position: absolute;
  top: -3px;
  left: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  overflow: visible;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.hop-clock-track {
  fill: none;
  stroke: none;
}
.hop-clock-left {
  fill: none;
  stroke: #f0a63a;
  stroke-width: 5;
  stroke-dasharray: 100 100;
  stroke-linecap: round;
}
.hop-card.is-timed .hop-clock-ring {
  opacity: 1;
}
.hop-card.is-hurry .hop-clock-left {
  stroke: var(--red);
}
.hop-clock-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  display: none;
  height: 5px;
  background: var(--red);
  border-radius: 3px;
  transform-origin: left center;
}
.hop-prompt-jp {
  font-size: clamp(1.9rem, 8vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
}
.hop-prompt-jp.is-long {
  font-size: clamp(1.5rem, 6vw, 2rem);
}
.hop-prompt-jp.is-very-long {
  font-size: clamp(1.2rem, 5vw, 1.6rem);
}
.hop-prompt-romaji,
.hop-answer-romaji {
  font: 1.08rem/1.2 var(--heading);
  color: var(--red);
}
/* A particle's sound alone (wa, o, e) is too short to read at the romaji's usual size. */
.hop-prompt-romaji--big {
  font-size: 1.7rem;
}
.hop-prompt-ask {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hop-prompt-en {
  font: clamp(1.3rem, 5.4vw, 1.7rem)/1.15 var(--heading);
}
/* A long meaning stays short enough that the card never reaches the pads on a small phone. */
.hop-prompt-en.is-long {
  font-size: clamp(1.1rem, 4.6vw, 1.45rem);
}
.hop-prompt-en.is-very-long {
  font-size: clamp(1rem, 4.1vw, 1.25rem);
}
/* The English to spell, with the word's picture or clock beside it. */
.hop-prompt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
}
.hop-prompt-visual {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
}
.hop-prompt-visual > *,
.hop-prompt-visual img,
.hop-prompt-visual svg {
  max-width: 48px;
  max-height: 48px;
  width: auto;
  height: auto;
}
.hop-prompt-visual .time-prompt-text {
  display: none;
}
.hop-context {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}
.hop-context-name {
  font-weight: 700;
}
.hop-pieces {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin: 2px 0;
}
.hop-piece {
  max-width: 100%;
  padding: 2px 8px;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
  /* A piece is a word or two: it moves to the next line whole, never split from its 。 */
  white-space: nowrap;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
}
.hop-piece.has-gap {
  border-style: dashed;
}
.hop-piece.has-gap:has(.hop-filled) {
  border-style: solid;
}
.hop-piece.is-long {
  font-size: 0.98rem;
}
.hop-blank {
  display: inline-block;
  min-width: 2em;
  color: var(--red);
}
.hop-filled {
  color: #1f6b2a;
  text-decoration: underline 3px;
  text-underline-offset: 4px;
}
.hop-prompt-line-en,
.hop-answer-en {
  font-weight: 700;
}
.hop-prompt-line-romaji,
.hop-answer-line-romaji,
.hop-answer-note {
  font-size: 0.86rem;
  color: var(--muted);
}
.hop-picked {
  font: 700 0.9rem/1.2 var(--body);
  color: var(--muted);
}
.hop-picked s {
  text-decoration-thickness: 2px;
}
.hop-picked-romaji {
  margin-left: 0.3em;
  font-weight: 600;
}
.hop-hint {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--red);
}
.hop-verdict {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 8px;
  font: 1.15rem/1.2 var(--heading);
}
.hop-card.is-right .hop-verdict {
  color: #1f6b2a;
}
.hop-card.is-wrong .hop-verdict {
  color: var(--red);
}
.hop-answer-word {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 10px;
}
.hop-answer-jp {
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  font-weight: 700;
  line-height: 1.15;
}
.hop-answer-jp.is-long,
.hop-answer-jp.is-very-long {
  font-size: clamp(1.25rem, 5vw, 1.6rem);
}
.hop-card.is-right .hop-answer-jp {
  font-size: 1.4rem;
}
.hop-note {
  display: block;
  margin-top: 2px;
  font-size: 0.86rem;
  line-height: 1.5;
}
.hop-note-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  margin-right: 6px;
  padding: 0 8px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.hop-note-chip b {
  font-size: 1.05rem;
}
.hop-note-chip span {
  font-size: 0.8rem;
  color: var(--muted);
}
.hop-note-text {
  font-weight: 700;
}
.hop-next {
  min-width: 150px;
  margin-top: 6px;
}

/* Start card and results */
.hop-intro {
  position: absolute;
  top: 60px;
  left: 12px;
  right: 12px;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 16px 18px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
}
.hop-intro[hidden],
.hop-results[hidden] {
  display: none;
}
.hop-intro-title {
  margin: 0;
  font-size: 1.8rem;
}
.hop-intro-title:focus {
  outline: none;
}
.hop-intro-line {
  max-width: 32ch;
  margin: 0;
  font-weight: 700;
}
.hop-best {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 700;
}
.hop-best[hidden] {
  display: none;
}
.hop-best-stars,
.hop-results-stars {
  display: inline-flex;
  gap: 2px;
}
.hop-best .hop-star {
  width: 22px;
  height: 21px;
}
.hop-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 700;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}
.hop-switch input {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  margin: 0;
  background: #d8c9a9;
  border: 2px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.hop-switch input::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-sizing: border-box;
  transition: transform 0.15s var(--ease-out);
}
.hop-switch input:checked {
  background: #6fb04e;
}
.hop-switch input:checked::before {
  transform: translateX(20px);
}
.hop-switch input:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}
.hop-start {
  min-width: 170px;
}
.hop-results {
  position: absolute;
  top: 28%;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
}
.hop-results-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 100%;
  padding: 12px 14px 14px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  animation: hop-rise 0.42s var(--ease-spring);
}
.hop-results-stars {
  justify-content: center;
  margin: 0;
}
.hop-star {
  width: 36px;
  height: 34px;
}
.hop-star path {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.hop-star.is-filled path {
  fill: var(--yellow);
}
.hop-results-stars .hop-star {
  animation: hop-star-pop 0.4s var(--ease-spring) both;
}
.hop-results-stars .hop-star:nth-child(2) {
  animation-delay: 0.12s;
}
.hop-results-stars .hop-star:nth-child(3) {
  animation-delay: 0.24s;
}
.hop-results-title {
  margin: 2px 0 0;
  font-size: 1.5rem;
}
.hop-results-title:focus {
  outline: none;
}
.hop-results-sub {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.hop-results-list {
  display: grid;
  flex: 0 1 auto;
  align-content: start;
  gap: 5px;
  min-height: 0;
  margin: 10px 0 12px;
  padding: 2px;
  overflow-y: auto;
  list-style: none;
  text-align: left;
}
.hop-results-list:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}
.hop-results-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 8px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
}
.hop-results-list li.is-missed {
  background: var(--wrong);
}
.hop-mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}
.hop-mark--right circle {
  fill: #2f7a3a;
}
.hop-mark--right path {
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hop-mark--splash path {
  fill: #2f78b5;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.hop-mark--splash .hop-mark-shine {
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.hop-verdict .hop-mark {
  margin-top: 0;
}
.hop-results-words {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  min-width: 0;
}
.hop-results-jp {
  font-weight: 700;
}
.hop-results-romaji {
  font-size: 0.84rem;
  color: var(--muted);
}
.hop-results-en {
  flex-basis: 100%;
  font-size: 0.9rem;
}
.hop-results-actions {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.hop-badge {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  padding: 2px 10px;
  font: 1.5rem/1.1 var(--heading);
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  opacity: 0;
  pointer-events: none;
}
.hop-badge.is-popping {
  animation: hop-badge 0.9s var(--ease-out) forwards;
}

@keyframes hop-bob {
  50% {
    transform: translateY(-2px);
  }
}
@keyframes hop-ripple {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  25% {
    opacity: 0.55;
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}
@keyframes hop-dip {
  40% {
    transform: translateY(4px) scale(0.96);
  }
  75% {
    transform: translateY(-1px) scale(1.01);
  }
}
@keyframes hop-wobble-sink {
  20% {
    transform: rotate(-5deg);
  }
  40% {
    transform: rotate(4deg);
    opacity: 1;
  }
  100% {
    transform: translateY(26px) scale(0.84);
    opacity: 0;
  }
}
@keyframes hop-tip {
  to {
    transform: translateY(30px) rotate(25deg);
    opacity: 0;
  }
}
@keyframes hop-under {
  to {
    transform: translateY(18px) scale(0.9);
    opacity: 0;
  }
}
@keyframes hop-resurface {
  from {
    transform: translateY(14px) scale(0.9);
    opacity: 0.2;
  }
}
@keyframes hop-glow {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}
@keyframes hop-glint {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -20% 0;
  }
}
@keyframes hop-breathe {
  50% {
    transform: scale(1.025);
  }
}
@keyframes hop-startle {
  30% {
    transform: translateY(-10px) rotate(-6deg);
  }
  60% {
    transform: translateY(-4px) rotate(5deg);
  }
}
@keyframes hop-happy {
  45% {
    transform: translateY(-18px) rotate(6deg);
  }
}
@keyframes hop-shake {
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}
@keyframes hop-sway {
  from {
    transform: rotate(-1.5deg);
  }
  to {
    transform: rotate(1.5deg);
  }
}
@keyframes hop-laugh {
  25% {
    transform: rotate(-6deg);
  }
  75% {
    transform: rotate(6deg);
  }
}
@keyframes hop-drift {
  from {
    transform: translate(-24px, 0);
  }
  to {
    transform: translate(24px, 10px);
  }
}
@keyframes hop-twinkle {
  from {
    opacity: 0.1;
  }
  to {
    opacity: 0.4;
  }
}
@keyframes hop-card-in {
  from {
    opacity: 0.4;
    transform: scale(0.97);
  }
}
@keyframes hop-look {
  0%,
  55%,
  100% {
    transform: none;
  }
  65% {
    transform: translateY(-4px) rotate(-5deg);
  }
  80% {
    transform: translateY(-4px) rotate(4deg);
  }
}
@keyframes hop-fade-in {
  from {
    opacity: 0;
  }
}
@keyframes hop-rise {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@keyframes hop-star-pop {
  from {
    transform: scale(0.4) rotate(-20deg);
    opacity: 0;
  }
}
@keyframes hop-badge {
  0% {
    opacity: 0;
    scale: 0.6;
  }
  25% {
    opacity: 1;
    scale: 1.12;
  }
  40% {
    scale: 1;
  }
  100% {
    opacity: 0;
    translate: 0 -34px;
  }
}

@media (max-width: 720px) {
  .study-panel[data-panel='play'] {
    padding: 6px;
  }
}
@media (max-width: 420px) {
  /* On a phone a game takes most of the page gutter: every pixel helps the pads and tiles. */
  .study-panel[data-panel='play'],
  .learn-play .play-room {
    margin-inline: -14px;
    padding: 4px;
  }
}
@media (max-width: 380px) {
  .hop-crossing-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .hop-boat {
    width: 84px;
  }
  .hop-label {
    padding: 2px 5px;
    font-size: 0.84rem;
  }
  .hop-label.is-long {
    font-size: 0.78rem;
  }
  .hop-label.is-very-long {
    font-size: 0.7rem;
  }
  .hop-label-jp {
    font-size: 1.08rem;
  }
  .hop-piece {
    padding: 1px 6px;
    font-size: 1rem;
  }
  .hop-piece.is-long {
    font-size: 0.9rem;
  }
  .hop-pieces {
    gap: 4px;
  }
  .hop-card {
    padding: 10px 10px 12px;
  }
  .hop-label.is-long .hop-label-jp {
    font-size: 0.92rem;
  }
  .hop-label.is-very-long .hop-label-jp {
    font-size: 0.8rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hop-stage *,
  .hop-stage *::before,
  .hop-stage *::after {
    animation: none !important;
    transition: none !important;
  }
  .hop-shimmer {
    display: none;
  }
  .hop-pad.is-gone .hop-pad-float,
  .hop-pad.is-tipped .hop-pad-float,
  .hop-pad.is-under .hop-pad-float {
    opacity: 0;
  }
  .hop-pad.is-gold .hop-pad-bob::after {
    opacity: 1;
  }
  .hop-card.is-timed .hop-clock-ring {
    opacity: 0;
  }
  .hop-card.is-timed .hop-clock-bar {
    display: block;
  }
}
@media (forced-colors: active) {
  .hop-card,
  .hop-intro,
  .hop-results-card,
  .hop-label {
    box-shadow: none;
  }
}

/* ════ The narrator: speaker buttons and the sound switches (docs/study-audio.md) ════ */
.say-button {
  position: relative;
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 0 0 6px;
  padding: 0;
  vertical-align: middle;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
}
.say-button[hidden] {
  display: none;
}
.say-button .speaker-icon {
  width: 20px;
  height: 20px;
}
.say-button:hover {
  transform: translateY(-1px);
}
.say-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}
.say-button:focus-visible,
.study-switch:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}
/* A ring pulses out while the line is speaking. */
.say-button.is-speaking::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  animation: say-pulse 0.9s ease-out infinite;
}
@keyframes say-pulse {
  from {
    opacity: 0.8;
    transform: scale(0.85);
  }
  to {
    opacity: 0;
    transform: scale(1.25);
  }
}
.say-button--big {
  width: 96px;
  height: 96px;
  margin: 4px auto;
  border-width: 3px;
  box-shadow: 0 4px 0 var(--ink);
}
.say-button--big .speaker-icon {
  width: 48px;
  height: 48px;
}

/* Flashcards: the speaker sits in the top corner; the example's button shows once turned. */
.study-card-say {
  width: 44px;
  height: 44px;
  margin: 0;
}
.study-card-say .speaker-icon {
  width: 24px;
  height: 24px;
}
.study-card:not(.is-flipped) .study-card-say--example {
  display: none;
}
.study-card-say--example {
  width: 36px;
  height: 36px;
  justify-self: center;
  background: var(--paper);
}

/* Grammar: a speaker after the pattern and after each example line */
.study-pattern-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.study-say-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.study-say-line .study-say-jp {
  padding-top: 2px;
}
.study-say-line .say-button,
.study-line .say-button,
.study-list-word .say-button,
.study-list-pattern .say-button,
.study-list-example .say-button,
.study-list-answer .say-button {
  width: 32px;
  height: 32px;
  margin: 0 0 0 4px;
}
/* Before a sentence, the speaker leads the line. */
.study-say-line .say-button,
.study-line .say-button,
.study-list-example .say-button {
  margin: 0 4px 0 0;
}
.study-say-line .say-button .speaker-icon,
.study-line .say-button .speaker-icon,
.study-list-word .say-button .speaker-icon,
.study-list-pattern .say-button .speaker-icon,
.study-list-example .say-button .speaker-icon,
.study-list-answer .say-button .speaker-icon {
  width: 18px;
  height: 18px;
}
.lesson-jp .say-button {
  margin-left: 8px;
}

/* Lily pads: one speaker in the card's top corner, for the prompt or the answer. */
.hop-card-body .hop-say {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  margin: 0;
}
/* Only the lines beside it (the question or verdict, then the English or the word) keep clear of
   the speaker: the romaji and a sentence's pieces below use the card's whole width, so a long
   sentence card stays short enough to leave the pads in view on a small phone. */
.hop-card-body:has(.hop-say) > :nth-child(-n + 2) {
  padding-inline: 42px;
}

/* The Voice and Effects switches under the player title */
.study-switches {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.study-switches[hidden] {
  display: none;
}
.study-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 4px 14px 4px 8px;
  font: 700 0.95rem/1 var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
}
.study-switch .speaker-icon {
  width: 22px;
  height: 22px;
}
.study-switch[aria-pressed='true'] {
  background: var(--yellow);
}
.study-switch[aria-pressed='false'] {
  color: var(--muted);
  text-decoration: line-through;
}
.study-switch[aria-pressed='false'] .speaker-icon {
  opacity: 0.45;
}
@media (prefers-reduced-motion: reduce) {
  .say-button.is-speaking::after {
    animation: none;
    opacity: 0.6;
    transform: none;
  }
  .say-button:hover,
  .say-button:active {
    transform: none;
  }
}
@media (forced-colors: active) {
  .say-button,
  .study-switch {
    border-color: ButtonText;
  }
  .study-switch[aria-pressed='true'] {
    outline: 2px solid Highlight;
  }
}

/* ════ Play: the two games side by side ════ */
.play-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}
.play-picker[hidden],
.play-game[hidden] {
  display: none;
}
.play-tile {
  display: grid;
  grid-template-rows: 150px auto;
  padding: 0;
  overflow: hidden;
  font: inherit;
  color: var(--ink);
  text-align: left;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  transition:
    transform 0.12s var(--ease-out),
    box-shadow 0.12s var(--ease-out);
}
.play-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 var(--ink);
}
.play-tile:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}
.play-tile:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.play-tile:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}
.play-tile-art {
  position: relative;
  display: block;
  overflow: hidden;
  background: #8bd1d6 center / cover no-repeat;
  border-bottom: 3px solid var(--ink);
}
.play-tile--hop .play-tile-art {
  background-image: url('/assets/study/pond-strip-720.webp');
  background-position: center 58%;
}
.play-tile--grab .play-tile-art {
  background-color: #fbe7bd;
  background-image: url('/assets/study/picnic-bank-720.webp');
  background-position: center 34%;
}
.play-tile-art img {
  position: absolute;
  height: auto;
  filter: drop-shadow(0 3px 0 rgba(57, 44, 32, 0.22));
  transition: transform 0.2s var(--ease-spring);
}
.play-tile--hop .play-tile-kero {
  bottom: 10px;
  left: 50%;
  width: 92px;
  margin-left: -46px;
}
.play-tile--grab .play-tile-kero {
  bottom: 8px;
  left: 6%;
  width: 26%;
  max-width: 84px;
}
.play-tile-plate {
  top: 30%;
  left: 31%;
  width: 38%;
}
.play-tile-gyoza {
  top: 27%;
  left: 42%;
  width: 16%;
}
.play-tile-goro {
  right: 6%;
  bottom: 6px;
  width: 27%;
  max-width: 86px;
}
.play-tile:hover .play-tile-kero {
  transform: translateY(-8px) rotate(-4deg);
}
.play-tile-words {
  display: grid;
  gap: 2px;
  padding: 12px 16px 14px;
}
.play-tile-name {
  font: 1.45rem/1.1 var(--heading);
}
.play-tile-line {
  font-weight: 700;
  color: var(--muted);
}
.play-tile-best[hidden] {
  display: none;
}
.play-tile-best {
  display: inline-flex;
  gap: 2px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 0.9rem;
}
.play-tile-best .hop-star {
  width: 20px;
  height: 19px;
}
.play-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0 0 8px;
  padding: 0 14px;
  font: 700 0.95rem var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.play-back:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .play-tiles {
    gap: 10px;
  }
  .play-tile {
    grid-template-rows: 112px auto;
    border-radius: 16px;
  }
  .play-tile-words {
    padding: 8px 10px 10px;
  }
  .play-tile-name {
    font-size: 1.15rem;
  }
  .play-tile-line {
    font-size: 0.85rem;
  }
  .play-tile--hop .play-tile-kero {
    width: 70px;
    margin-left: -35px;
  }
}

/* A Play button on each kana and numbers lesson tile */
.learn-tile-item {
  position: relative;
}
/* Room under the tile's words for its Play button. */
.learn-tile-item > .learn-tile {
  padding-bottom: 54px;
}
.learn-tile-play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 12px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  text-decoration: none;
  background: #3f7a2c;
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 2px 0 var(--ink);
}
.learn-tile-play:hover {
  transform: translateY(-1px);
}
.learn-tile-play:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}
.learn-tile-play .study-play-icon {
  width: 14px;
  height: 14px;
}

/* The Play step on the kana and numbers lessons */
.learn-play {
  margin: 28px 0;
}
.learn-play .learn-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.learn-play .study-switches[hidden],
.play-room[hidden] {
  display: none;
}

/* The hub's Games row: both games with everything learned so far */
.study-games {
  margin-top: 28px;
}
.study-games-title {
  margin: 0 0 4px;
  font-size: 1.4rem;
}
.study-games-note {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--muted);
}
.study-games-note[hidden] {
  display: none;
}
.study-games-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.study-game {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.15s;
}
.study-game:hover {
  transform: translateY(-2px);
}
.study-game.is-waiting {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.study-game-art {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  width: 56px;
}
.study-game-art img {
  width: 100%;
  height: auto;
}
.study-game--grab .study-game-art img.study-game-gyoza {
  position: absolute;
  left: -6px;
  bottom: 0;
  width: 34px;
}
.study-game--grab .study-game-art img.study-game-goro {
  margin-left: 16px;
  width: 40px;
}
.study-game-words {
  display: grid;
  min-width: 0;
}
.study-game-name {
  font: 1.1rem/1.15 var(--heading);
}
.study-game-line {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
}
@media (max-width: 420px) {
  .study-games-row {
    grid-template-columns: 1fr;
  }
}

/* ════ Gyoza Grab ════
 * A picnic on the pond bank: the painted bank is one world layer, with the table's plate, Kero,
 * Goro, the little plates and Goro's chopsticks placed on it in percentages. Kero and Goro move
 * only as whole pictures; the props (gyoza, tiles, chopsticks) may squash and tilt.
 */
.grab-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  /* In rem as well, so with text at 200% the stage grows taller than the screen and the page
     scrolls, rather than a two-row tray running out of room inside it. */
  height: clamp(max(480px, 30rem), calc(100vh - 28px), max(720px, 45rem));
  height: clamp(max(480px, 30rem), calc(100svh - 28px), max(720px, 45rem));
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
  background: linear-gradient(#c4e8f6 0 34%, #fbe6b9 34% 100%);
  border: 3px solid var(--ink);
  border-radius: 20px;
  scroll-margin-top: 10px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.grab-world {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  aspect-ratio: 1080 / 1920;
  pointer-events: none;
  will-change: transform;
}
.grab-bank {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.grab-fx {
  position: absolute;
  inset: 0;
  z-index: 7;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The table's plate: four gyoza in a gentle arc */
.grab-plate {
  position: absolute;
  top: 30.4%;
  left: 29%;
  width: 42%;
  aspect-ratio: 512 / 216;
}
.grab-plate.is-arriving {
  animation: grab-plate-in 0.42s var(--ease-spring);
}
.grab-plate-img {
  display: block;
  width: 100%;
  height: auto;
}
.grab-spot {
  position: absolute;
  width: 27%;
  aspect-ratio: 256 / 143;
}
.grab-spot--1 {
  top: 16%;
  left: 5%;
}
.grab-spot--2 {
  top: 2%;
  left: 26%;
}
.grab-spot--3 {
  top: 2%;
  left: 47%;
}
.grab-spot--4 {
  top: 16%;
  left: 68%;
}
.grab-spot--2,
.grab-spot--3 {
  z-index: 0;
}
.grab-spot--1,
.grab-spot--4 {
  z-index: 1;
}
.grab-gyoza {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 0 rgba(57, 44, 32, 0.22));
  transition:
    transform 0.25s var(--ease-out),
    filter 0.25s;
}
.grab-spot.is-current .grab-gyoza {
  transform: translateY(-14%) scale(1.08);
  filter: drop-shadow(0 0 5px #fff4a8) drop-shadow(0 4px 0 rgba(57, 44, 32, 0.25));
  animation: grab-steaming 1.6s ease-in-out infinite;
}
.grab-gyoza.is-hidden,
.grab-tile.is-hidden {
  visibility: hidden;
}
.grab-flying {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 6;
  pointer-events: none;
}

/* Kero's and Goro's little plates: the live score */
.grab-mine {
  position: absolute;
  top: 44.6%;
  width: 21%;
  aspect-ratio: 512 / 216;
}
.grab-mine--kero {
  left: 5%;
}
.grab-mine--goro {
  right: 5%;
}
.grab-mine-img {
  display: block;
  width: 100%;
  height: auto;
}
.grab-mine-pile {
  position: absolute;
  inset: auto 6% 38%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.grab-mine-pile .grab-gyoza {
  flex: 0 0 auto;
  width: 46%;
  margin: 0 -9%;
}

/* Kero and Goro, standing either side of the table */
.grab-kero,
.grab-goro {
  position: absolute;
  z-index: 1;
}
.grab-kero {
  top: 30%;
  left: 2%;
  width: 27%;
}
.grab-goro {
  top: 29%;
  right: 1%;
  width: 28%;
}
.grab-kero-img,
.grab-goro-img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 100%;
}
.grab-shadow {
  position: absolute;
  bottom: -2%;
  left: 18%;
  width: 64%;
  height: 11%;
  background: rgba(57, 44, 32, 0.24);
  border-radius: 50%;
  transition: transform 0.3s;
}
.grab-stage[data-state='ready'] .grab-kero-img,
.grab-stage[data-state='intro'] .grab-kero-img {
  animation: grab-breathe 2.6s ease-in-out infinite;
}
.grab-stage[data-state='ready'] .grab-goro-img,
.grab-stage[data-state='intro'] .grab-goro-img {
  animation: grab-breathe 2.9s ease-in-out infinite reverse;
}
.grab-kero.is-hopping .grab-kero-img,
.grab-goro.is-hopping .grab-goro-img {
  animation: grab-hop 0.3s var(--ease-out);
}
.grab-kero.is-hopping .grab-shadow {
  animation: grab-shadow-hop 0.3s var(--ease-out);
}
.grab-kero.is-happy .grab-kero-img {
  animation: grab-hop 0.32s var(--ease-out) 3;
}
.grab-goro.is-reaching .grab-goro-img {
  animation: none;
  transform: translateX(-4%) rotate(-5deg);
  transition: transform 0.3s var(--ease-out);
}
.grab-goro.is-jolting .grab-goro-img {
  animation: grab-jolt 0.24s var(--ease-out);
}
.grab-goro.is-laughing .grab-goro-img {
  animation: grab-wobble 0.32s ease-in-out 2;
}
.grab-goro.is-grumbling .grab-goro-img {
  animation: grab-grumble 0.4s ease-in-out;
}
/* A clean build: the tiles in the answer bounce one after another. */
.grab-build.is-clean .grab-placed {
  animation: grab-cheer 0.42s var(--ease-out) both;
}
.grab-build.is-clean .grab-slot:nth-child(2) .grab-placed {
  animation-delay: 0.05s;
}
.grab-build.is-clean .grab-slot:nth-child(3) .grab-placed {
  animation-delay: 0.1s;
}
.grab-build.is-clean .grab-slot:nth-child(4) .grab-placed {
  animation-delay: 0.15s;
}
.grab-build.is-clean .grab-slot:nth-child(5) .grab-placed {
  animation-delay: 0.2s;
}
.grab-build.is-clean .grab-slot:nth-child(6) .grab-placed {
  animation-delay: 0.25s;
}
.grab-build.is-clean .grab-slot:nth-child(n + 7) .grab-placed {
  animation-delay: 0.3s;
}
.grab-goro.is-fuming .grab-goro-img {
  animation: grab-wobble 0.18s linear 4;
}

/* Goro's chopsticks: the clock, sliding from his hand to the gyoza */
.grab-sticks {
  position: absolute;
  top: 26.4%;
  left: 63%;
  z-index: 2;
  width: 30%;
  aspect-ratio: 600 / 85;
  transform-origin: 88% 50%;
}
/* Held up and ready: the tips tilt up until Goro reaches for the gyoza. */
.grab-sticks-img {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(14deg);
  transform-origin: 88% 50%;
}
.grab-sticks.is-snapping .grab-sticks-img {
  animation: grab-snap 0.2s var(--ease-out);
}
.grab-stage[data-clock='off'] .grab-sticks,
.grab-stage[data-clock='waiting'] .grab-sticks {
  transition: transform 0.3s var(--ease-out);
}

/* Heads-up: plate count, streak, sound */
.grab-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  pointer-events: none;
}
.grab-hud > * {
  pointer-events: auto;
}
.grab-hud.is-quiet .grab-plate-count,
.grab-hud.is-quiet .grab-combo,
.grab-stage[data-state='results'] .grab-plate-count,
.grab-stage[data-state='results'] .grab-combo {
  visibility: hidden;
}
.grab-plate-count {
  margin: 0;
  padding: 4px 12px;
  font-weight: 800;
  font-size: 0.9rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.grab-plate-count:empty {
  visibility: hidden;
}
.grab-combo {
  margin: 0 auto 0 0;
  font: 1.3rem/1 var(--heading);
  color: var(--ink);
  text-shadow:
    0 2px 0 var(--paper),
    0 -2px 0 var(--paper),
    2px 0 0 var(--paper),
    -2px 0 0 var(--paper);
}
.grab-combo.is-hot {
  color: #b6382b;
}
.grab-sound {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.grab-sound[hidden],
.hop-sound[hidden] {
  display: none;
}
.grab-sound .speaker-icon {
  width: 24px;
  height: 24px;
}
.grab-sound[aria-pressed='false'] .speaker-waves {
  opacity: 0.15;
}
.grab-sound:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}

/* The prompt card: what to build, never the answer */
.grab-card {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  margin: 58px 10px 0;
  padding: 8px 14px 12px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink);
}
.grab-card[hidden] {
  display: none;
}
.grab-card:focus {
  outline: none;
}
.grab-card:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.grab-card-body {
  display: grid;
  justify-items: center;
  gap: 2px;
}
.grab-card-body.is-new {
  animation: hop-card-in 0.22s var(--ease-out);
}
.grab-ask {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.grab-prompt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
}
.grab-prompt-en {
  font: 1.35rem/1.2 var(--heading);
  overflow-wrap: anywhere;
}
/* How the thing to build is said: its romaji, under its English. */
.grab-prompt-romaji {
  font: 1.08rem/1.2 var(--heading);
  color: var(--red);
  overflow-wrap: anywhere;
}
.grab-prompt-romaji--big {
  font-size: 1.7rem;
}
/* A sentence: a long English line and its romaji take smaller type, so the tray keeps its room
   on a small phone. */
.grab-prompt-en.is-long {
  font-size: 1.15rem;
}
.grab-prompt-en.is-very-long {
  font-size: 1.02rem;
}
.grab-prompt-romaji--line {
  font-size: 0.95rem;
}
/* A letter gyoza: the sound (or a chain of sounds) to pick the kana for. */
.grab-prompt-sound {
  font: clamp(1.9rem, 8vw, 2.5rem)/1.1 var(--heading);
  color: var(--red);
  overflow-wrap: anywhere;
}
.grab-prompt-hint {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.grab-visual {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
}
.grab-visual > *,
.grab-visual img,
.grab-visual svg {
  max-width: 58px;
  max-height: 58px;
  width: auto;
  height: auto;
}
.grab-visual .time-prompt-text {
  display: none;
}
.grab-context {
  display: flex;
  gap: 6px;
  font-size: 0.95rem;
}
.grab-context-name {
  font-weight: 800;
}
.grab-prompt-row .study-face {
  width: 34px;
  height: 34px;
}
.grab-bubble {
  position: absolute;
  top: 4%;
  right: 22%;
  z-index: 4;
  padding: 4px 10px;
  font: 1rem/1.2 var(--heading);
  color: #8f2a1f;
  white-space: nowrap;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px 14px 4px 14px;
  opacity: 0;
  transform: scale(0.6);
  transform-origin: 100% 100%;
}
.grab-bubble.is-showing {
  animation: grab-bubble 1.8s var(--ease-spring) forwards;
}
@keyframes grab-bubble {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  12%,
  80% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}
.grab-clock-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 5px;
  background: #f6c747;
  border-radius: 999px;
  opacity: 0;
  transform-origin: left center;
}
.grab-card.is-timed .grab-clock-bar {
  opacity: 1;
}
.grab-card.is-hurry .grab-clock-bar {
  background: #b6382b;
}

/* The scene shows through this band */
.grab-card[hidden] + .grab-band {
  margin-top: 54px;
}
.grab-band {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 100 / 40;
  pointer-events: none;
}
.grab-badge {
  position: absolute;
  top: 2px;
  left: 22%;
  z-index: 4;
  padding: 2px 10px;
  font: 1.3rem/1.2 var(--heading);
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 999px;
  opacity: 0;
  transform: scale(0.6);
}
.grab-badge.is-popping {
  animation: grab-badge 0.9s var(--ease-spring);
}

/* The build: slots for the answer, the tray of tiles, then the answer once built */
.grab-build {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 10px;
  overflow-y: auto;
}
.grab-build[hidden] {
  display: none;
}
.grab-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 66px;
  margin: 0;
  padding: 7px;
  list-style: none;
  background: rgba(255, 250, 240, 0.94);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 3px 0 var(--ink);
}
.grab-build.is-done .grab-slots {
  background: #fff3ee;
}
.grab-build.is-done.is-clean .grab-slots {
  background: #effae9;
}
.grab-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 52px;
  border: 2px dashed #a58c66;
  border-radius: 12px;
}
/* The build scrolls as a whole on a small phone; its parts never squash. */
.grab-build > * {
  flex-shrink: 0;
}
.grab-slot.is-next {
  border-style: solid;
  border-color: var(--ink);
  background: #fff4cc;
}
.grab-slot.is-filled {
  border: 0;
}
.grab-slot.is-fixed {
  border: 0;
  min-width: 26px;
  color: var(--muted);
}
.grab-slot.is-awaiting > * {
  visibility: hidden;
}
.grab-slot.is-landing {
  animation: grab-settle 0.16s var(--ease-out);
}
/* An empty labelled slot is as wide as its label at any text size (study-grab.ts). */
.grab-slots.is-sentence .grab-slot {
  min-width: max(52px, calc(var(--label-chars, 0) * 0.5rem + 10px));
}
.grab-slot-label {
  position: absolute;
  top: 3px;
  white-space: nowrap;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #8f2a1f;
}
.grab-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding-top: 2px;
}
.grab-tray[hidden] {
  display: none;
}
.grab-tile,
.grab-placed {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 56px;
  padding: 3px 10px;
  font: inherit;
  color: var(--ink);
  background: #fffdf6;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition:
    transform 0.09s var(--ease-out),
    box-shadow 0.09s var(--ease-out);
}
.grab-placed {
  min-width: 46px;
  min-height: 52px;
  background: #fff8dc;
  box-shadow: 0 2px 0 var(--ink);
}
.grab-build.is-done .grab-placed {
  cursor: default;
}
.grab-build.is-done.is-clean .grab-placed {
  background: #dff3d4;
}
.grab-tile:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.grab-tile:focus-visible,
.grab-placed:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}
.grab-tile.is-used {
  visibility: hidden;
}
.grab-tile.is-particle,
.grab-placed.is-particle {
  background: var(--butter);
  border-radius: 999px;
}
.grab-tile-jp {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}
.is-long > .grab-tile-jp {
  font-size: 1.2rem;
}
.is-very-long > .grab-tile-jp {
  font-size: 1rem;
}
.grab-tile.is-hint {
  border-color: #b97a00;
  background: #fff1b8;
  animation: grab-hint 0.9s ease-in-out infinite;
}
.grab-tile.is-shaking {
  animation: grab-shake 0.24s linear;
  background: var(--wrong);
}
.grab-flyer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 6;
  margin: 0;
  pointer-events: none;
}
.grab-flyer.is-wrong {
  background: var(--wrong);
}
.grab-key {
  position: absolute;
  top: -9px;
  left: -9px;
  display: none;
  width: 20px;
  height: 20px;
  font: 700 0.72rem/16px var(--body);
  text-align: center;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--paper);
  border-radius: 50%;
}
@media (hover: hover) and (pointer: fine) {
  .grab-key {
    display: block;
  }
}
.grab-feedback {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 12px 10px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 3px 0 var(--ink);
  animation: hop-card-in 0.22s var(--ease-out);
}
.grab-feedback[hidden] {
  display: none;
}
.grab-feedback p {
  margin: 0;
}
.grab-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 1.15rem/1.2 var(--heading);
}
.grab-verdict svg {
  width: 22px;
  height: 22px;
}
.grab-verdict.is-wrong {
  color: #8f2a1f;
}
.grab-answer {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.grab-answer-jp {
  font-size: 1.5rem;
  font-weight: 700;
}
.grab-answer-romaji {
  font-weight: 700;
  color: var(--muted);
}
.grab-answer-en {
  font-weight: 700;
}
.grab-answer-note {
  font-size: 0.9rem;
  color: var(--muted);
}
.grab-note {
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 34rem;
  font-size: 0.9rem;
  text-align: left;
}
.grab-note-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 0 8px;
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.grab-note-chip span {
  font-size: 0.78rem;
  color: var(--muted);
}
.grab-usual {
  font-size: 0.9rem;
}
.grab-usual-label {
  font-weight: 800;
}
.grab-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
}
.grab-actions [hidden] {
  display: none;
}
.grab-say {
  flex: 0 0 auto;
}

/* Start card and results */
.grab-intro,
.grab-results {
  position: absolute;
  z-index: 6;
  left: 12px;
  right: 12px;
}
.grab-intro {
  bottom: 14px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 16px 18px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
}
.grab-intro[hidden],
.grab-results[hidden] {
  display: none;
}
.grab-intro-title {
  margin: 0;
  font-size: 1.8rem;
}
.grab-intro-title:focus {
  outline: none;
}
.grab-intro-line {
  max-width: 32ch;
  margin: 0;
  font-weight: 700;
}
.grab-best {
  margin: 0;
  font-weight: 700;
}
.grab-best[hidden] {
  display: none;
}
.grab-results {
  top: 56px;
  bottom: 12px;
  display: flex;
  align-items: flex-start;
}
.grab-results-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  max-height: 100%;
  padding: 14px 14px 16px;
  overflow-y: auto;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  animation: hop-card-in 0.3s var(--ease-spring);
}
.grab-results-title {
  margin: 0;
  font-size: 1.6rem;
}
.grab-results-title:focus {
  outline: none;
}
.grab-results-sub {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.grab-score {
  display: flex;
  justify-content: center;
  gap: 18px;
}
.grab-score-side {
  display: grid;
  justify-items: center;
  gap: 2px;
}
.grab-score-face {
  width: 58px;
  height: auto;
}
.grab-score-pile {
  display: flex;
  justify-content: center;
  min-height: 22px;
}
.grab-score-gyoza {
  width: 34px;
  margin: 0 -6px;
}
.grab-score-num {
  font: 1.4rem/1 var(--heading);
}

/* Motion */
@keyframes grab-breathe {
  50% {
    transform: translateY(-2%) scale(1.02);
  }
}
@keyframes grab-hop {
  40% {
    transform: translateY(-18px) rotate(6deg);
  }
  75% {
    transform: translateY(0) rotate(-2deg);
  }
}
@keyframes grab-shadow-hop {
  40% {
    transform: scale(0.7);
  }
}
@keyframes grab-jolt {
  40% {
    transform: translateX(-10%) rotate(-8deg);
  }
}
@keyframes grab-wobble {
  25% {
    transform: rotate(-6deg);
  }
  75% {
    transform: rotate(6deg);
  }
}
@keyframes grab-grumble {
  30% {
    transform: rotate(-4deg) translateY(2%);
  }
  65% {
    transform: rotate(3deg);
  }
}
@keyframes grab-cheer {
  45% {
    transform: translateY(-7px);
  }
}
@keyframes grab-snap {
  50% {
    transform: rotate(14deg) scale(1, 0.5);
  }
}
@keyframes grab-steaming {
  50% {
    transform: translateY(-20%) scale(1.08);
  }
}
@keyframes grab-plate-in {
  from {
    opacity: 0;
    transform: translateY(-18px) scale(0.9);
  }
}
@keyframes grab-badge {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  25%,
  70% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(1);
  }
}
@keyframes grab-settle {
  50% {
    transform: translateY(1px);
  }
}
@keyframes grab-hint {
  50% {
    transform: scale(1.08);
  }
}
@keyframes grab-shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}
@media (max-width: 380px) {
  .grab-plate-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .grab-tile {
    min-width: 48px;
    padding-inline: 8px;
  }
  .grab-tile-jp {
    font-size: 1.35rem;
  }
}
/* On a short phone a kana gap, word gap or sentence gap card (English, romaji and the pieces) is
   tighter, so it never reaches the pads. */
@media (max-height: 720px) {
  .hop-card {
    padding: 8px 12px 12px;
  }
  .hop-card .hop-card-body {
    gap: 1px;
  }
  .hop-card[data-ask='chunk'] .hop-prompt-ask,
  .hop-card[data-ask='line'] .hop-prompt-ask {
    font-size: 0.7rem;
  }
  .hop-card[data-ask='chunk'] .hop-prompt-en,
  .hop-card[data-ask='chunk'] .hop-prompt-en.is-long {
    font-size: 1.15rem;
  }
  .hop-card[data-ask='chunk'] .hop-prompt-en.is-very-long {
    font-size: 1rem;
  }
  .hop-card[data-ask='chunk'] .hop-prompt-romaji,
  .hop-card[data-ask='line'] .hop-prompt-romaji,
  .hop-card[data-ask='gap'] .hop-prompt-romaji {
    font-size: 0.95rem;
  }
  .hop-card .hop-piece {
    padding: 1px 6px;
    font-size: 1rem;
  }
  .hop-card .hop-card-body .hop-say {
    width: 34px;
    height: 34px;
  }
  .hop-card .hop-card-body:has(.hop-say) > :nth-child(-n + 2) {
    padding-inline: 38px;
  }
}
@media (max-height: 620px) {
  .grab-card {
    margin-top: 54px;
    padding-block: 6px 10px;
  }
  .grab-prompt-en {
    font-size: 1.2rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .grab-plate.is-arriving,
  .grab-spot.is-current .grab-gyoza,
  .grab-stage .grab-kero-img,
  .grab-stage .grab-goro-img,
  .grab-kero.is-hopping .grab-shadow,
  .grab-tile.is-hint,
  .grab-tile.is-shaking,
  .grab-slot.is-landing,
  .grab-build.is-clean .grab-placed,
  .grab-sticks.is-snapping .grab-sticks-img,
  .grab-card-body.is-new,
  .grab-feedback,
  .grab-results-card,
  .play-tile,
  .play-tile-art img {
    animation: none !important;
    transition: none !important;
  }
  .grab-goro.is-reaching .grab-goro-img {
    transform: none;
  }
  .grab-badge.is-popping,
  .grab-bubble.is-showing {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .grab-tile.is-hint {
    outline: 3px solid #b97a00;
    outline-offset: 2px;
  }
  .grab-tile.is-shaking {
    outline: 3px solid #8f2a1f;
  }
}

/* ════ Sentence blocks (docs/study-design.md section 3.2) ════ */
.learn-room--study,
.play-room {
  --role-topic: #ffe6a3;
  --role-topic-ink: #6b4e00;
  --role-time: #d3e8f7;
  --role-time-ink: #164e78;
  --role-place: #d6efc7;
  --role-place-ink: #2f5f1f;
  --role-with: #f8d7e4;
  --role-with-ink: #8a2550;
  --role-how: #e4dcf6;
  --role-how-ink: #4f3591;
  --role-object: #ffdcbf;
  --role-object-ink: #8a4300;
  --role-noun: #fffaf0;
  --role-noun-ink: #392c20;
  --role-lead: #ece4d4;
  --role-lead-ink: #4a3a2a;
  --role-end: #f6d2cc;
  --role-end-ink: #8f2a1f;
}
.block-lines {
  display: grid;
  gap: 8px;
}
.blocks {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.block {
  --fill: var(--paper);
  --ink-role: var(--ink);
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 44px;
  padding: 5px 9px 6px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--fill);
  color: var(--ink);
  font: inherit;
  text-align: left;
  line-height: 1.2;
}
.block--topic {
  --fill: var(--role-topic);
  --ink-role: var(--role-topic-ink);
}
.block--time {
  --fill: var(--role-time);
  --ink-role: var(--role-time-ink);
}
.block--place,
.block--goal {
  --fill: var(--role-place);
  --ink-role: var(--role-place-ink);
}
.block--with {
  --fill: var(--role-with);
  --ink-role: var(--role-with-ink);
}
.block--how {
  --fill: var(--role-how);
  --ink-role: var(--role-how-ink);
}
.block--object {
  --fill: var(--role-object);
  --ink-role: var(--role-object-ink);
}
.block--noun {
  --fill: var(--role-noun);
  --ink-role: var(--role-noun-ink);
}
.block--lead {
  --fill: var(--role-lead);
  --ink-role: var(--role-lead-ink);
}
.block--end {
  --fill: var(--role-end);
  --ink-role: var(--role-end-ink);
}
.block--plain {
  --fill: var(--paper);
}
.block-role {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-role);
}
.block-jp {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
}
.block-joint {
  color: var(--ink-role);
}
.block-p {
  margin-left: 4px;
  padding-left: 5px;
  border-left: 2px solid currentColor;
  color: var(--ink-role);
  font-weight: 900;
}
.block-blank {
  display: inline-block;
  min-width: 1.4em;
  border-bottom: 3px dashed var(--ink);
  color: transparent;
}
.block-blank.block-p {
  border-left: 2px solid var(--ink);
}
.block-blank.is-filled {
  color: var(--ink-role);
  border-bottom-style: solid;
}
.block-romaji {
  font-size: 0.8rem;
  color: var(--muted);
}
.block-en {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-role);
}
.block.is-marked {
  outline: 3px dashed var(--red);
  outline-offset: 2px;
}
.block-lines.is-compact .block {
  padding: 3px 7px 4px;
  border-width: 2px;
  border-radius: 10px;
}
.block-lines.is-compact .block-jp {
  font-size: 1rem;
}
.block-lines.is-compact .block-role {
  font-size: 0.6rem;
}
@media (max-width: 380px) {
  .block {
    padding: 4px 7px 5px;
  }
  .block-jp {
    font-size: 1.05rem;
  }
}

/* ════ Questions about sentences: blocks, Tap the part, Build it ════ */
.ask-sentence {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  width: 100%;
}
.ask-sentence .study-face {
  flex: 0 0 auto;
}
.ask-sentence .block-lines {
  justify-items: center;
}
.ask-sentence .blocks {
  justify-content: center;
}
.ask-sentence--en .ask-en {
  text-align: center;
}
.ask-en--small {
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}
.ask-en--job {
  max-width: 30ch;
  font-size: 1.1rem;
  text-align: center;
}
.ask-target--part,
.ask-target--build,
.ask-target--pgap,
.ask-target--sentence {
  padding-inline: 12px;
}
/* A word to build or a sentence to pick has a speaker in the corner: keep the English clear of it. */
.ask-target--build:has(.ask-say),
.ask-target--sentence:has(.ask-say) {
  padding-inline: 46px;
}
.ask-particle {
  display: grid;
  justify-items: center;
  min-width: 96px;
  padding: 6px 18px 8px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--fill, var(--paper));
}
.ask-particle .ask-jp {
  font-size: 2.6rem;
  line-height: 1.1;
  color: var(--ink-role, var(--ink));
}
.ask-choices.is-blocks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.ask-block {
  position: relative;
  min-height: 56px;
  padding-top: 16px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition:
    transform 90ms var(--ease-out, ease-out),
    background 0.15s;
}
.ask-block:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.ask-block .ask-choice-key {
  position: absolute;
  top: 3px;
  right: 6px;
  left: auto;
}
.ask-block.is-right {
  background: var(--right);
}
.ask-block.is-wrong {
  background: var(--wrong);
}
.ask-build {
  display: grid;
  gap: 10px;
}
.ask-build[hidden] {
  display: none;
}
.ask-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: rgb(255 255 255 / 0.55);
  border: 2px dashed var(--ink);
  border-radius: 14px;
}
.ask-slot {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 44px;
  padding: 4px 8px;
  border: 2px dashed rgb(57 44 32 / 0.45);
  border-radius: 10px;
  background: var(--paper);
}
.ask-slot.is-next {
  border-color: var(--ink);
  border-style: solid;
  box-shadow: 0 0 0 3px rgb(246 199 71 / 0.7);
}
.ask-slot.is-filled {
  border: 3px solid var(--ink);
  background: var(--fill, var(--paper));
  animation: slot-pop 220ms var(--ease-spring, ease-out);
}
.ask-slot.is-shown {
  animation: none;
}
/* A piece the learner does not place: the ～ of a suffix card. */
.ask-slot.is-fixed {
  border: 0;
  background: none;
  animation: none;
}
.ask-slot-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.role-ink--topic {
  color: var(--role-topic-ink);
}
.role-ink--time {
  color: var(--role-time-ink);
}
.role-ink--place,
.role-ink--goal {
  color: var(--role-place-ink);
}
.role-ink--with {
  color: var(--role-with-ink);
}
.role-ink--how {
  color: var(--role-how-ink);
}
.role-ink--object {
  color: var(--role-object-ink);
}
.role-ink--noun {
  color: var(--role-noun-ink);
}
.role-ink--end {
  color: var(--role-end-ink);
}
.ask-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.ask-tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 48px;
  padding: 8px 12px 8px 14px;
  color: var(--ink);
  font: inherit;
  background: var(--fill, var(--paper));
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition:
    transform 90ms var(--ease-out, ease-out),
    opacity 0.15s;
}
.ask-tile.block {
  flex-direction: row;
}
.ask-tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.ask-tile .ask-choice-key {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.65rem;
}
.ask-tile-jp {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}
.ask-tile.is-particle .ask-tile-jp {
  font-weight: 900;
}
.ask-tile.is-used {
  opacity: 0.25;
  box-shadow: none;
}
.ask-tile.is-shake {
  animation: tile-shake 240ms ease-in-out;
}
.ask-tile.is-hint {
  animation: tile-hint 0.9s ease-in-out infinite;
}
.ask-build-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.answer-usual {
  margin: 6px 0 0;
  font-size: 0.9rem;
}
.answer-usual-label {
  font-weight: 700;
}
.answer-sheet .block-lines {
  margin-top: 8px;
}
@keyframes slot-pop {
  from {
    transform: scale(0.85);
  }
  to {
    transform: scale(1);
  }
}
@keyframes tile-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px) rotate(-3deg);
  }
  75% {
    transform: translateX(6px) rotate(3deg);
  }
}
@keyframes tile-hint {
  0%,
  100% {
    box-shadow: 0 3px 0 var(--ink);
  }
  50% {
    box-shadow:
      0 3px 0 var(--ink),
      0 0 0 5px rgb(246 199 71 / 0.9);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ask-slot.is-filled,
  .ask-tile.is-shake,
  .ask-tile.is-hint {
    animation: none;
  }
  .ask-tile.is-hint {
    outline: 4px solid var(--yellow);
  }
}

/* Cards: blocks on the back, particle cards */
.study-card-line--blocks {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.study-card-example--blocks {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.flashcard-side .block-lines,
.flashcard-side .blocks {
  justify-content: center;
}
.flashcard-side .block-lines.is-compact .block {
  padding: 2px 6px 3px;
}
.study-card-particle {
  display: grid;
  justify-items: center;
  padding: 4px 18px 6px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--fill, var(--paper));
}
.study-card-particle .study-card-jp {
  color: var(--ink-role, var(--ink));
}

/* Pattern tab: the template and examples in blocks */
.study-pattern-card .block-lines {
  margin: 8px 0;
}
.study-pattern-title {
  margin: 2px 0 6px;
  font: 1.3rem/1.2 var(--heading);
}
.study-say-body .block-lines {
  margin: 4px 0;
}

/* The word lists: blocks under each line, particles and order cards */
.study-line {
  margin: 0 0 8px;
}
.study-line-text {
  margin: 0 0 4px;
}
.study-list-particle p,
.study-list-pattern-head {
  margin: 0 0 4px;
}
.study-list-particle-jp {
  display: inline-grid;
  place-items: center;
  min-width: 2.2em;
  padding: 0 6px;
  font-size: 1.3rem;
  font-weight: 900;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--fill, var(--paper));
  color: var(--ink-role, var(--ink));
}
.study-list-order {
  display: block;
  font-family: var(--heading);
  font-weight: 400;
}
.study-list-answer p {
  margin: 0 0 4px;
}

/* ════ Lesson pages: folding sections, the next step ════ */
.study-section {
  padding: 0;
}
.study-section-fold > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  border-radius: inherit;
}
.study-section-fold > summary::-webkit-details-marker {
  display: none;
}
.study-section-fold > summary::after {
  content: '';
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
.study-section-fold[open] > summary::after {
  transform: rotate(45deg);
}
.study-section-fold > summary:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.study-section-name {
  flex: 1;
  min-width: 0;
}
.study-section-name h3 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}
.study-section-pattern {
  display: block;
}
.study-section-fold > .study-sets,
.study-section-fold > .study-list {
  margin: 0 18px 16px;
}
.study-section-fold > .study-sets {
  margin-top: 4px;
}
.study-section--structure .study-section-number {
  background: var(--role-time);
}
.study-set.is-next {
  background: var(--yellow);
  box-shadow: 0 3px 0 var(--ink);
}
.study-set.is-next .study-set-badge {
  background: var(--ink);
  color: var(--paper);
}
.study-due-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  color: var(--ink);
}
.study-due-link[hidden] {
  display: none;
}
.lesson-next .drawing-button {
  text-decoration: none;
  color: var(--ink);
}
@media (max-width: 520px) {
  /* On a phone the count sits under the section name, so a name like "Jobs and workplaces"
     keeps whole words on a 320 px screen instead of breaking inside them. */
  .study-section-fold > summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      'number name chevron'
      'number count chevron';
    column-gap: 10px;
    row-gap: 2px;
    padding: 12px 14px;
  }
  .study-section-fold > summary .study-section-number {
    grid-area: number;
  }
  .study-section-fold > summary .study-section-name {
    grid-area: name;
  }
  .study-section-fold > summary .study-section-count {
    grid-area: count;
    max-width: none;
    text-align: left;
  }
  .study-section-fold > summary::after {
    grid-area: chevron;
  }
  .study-section-fold > .study-sets,
  .study-section-fold > .study-list {
    margin: 0 12px 14px;
  }
}

/* ════ /study/: Today, Mix it up, the week ════ */
.study-hub-intro {
  margin-bottom: 14px;
}
.study-hub-line {
  max-width: 34rem;
}
/* A first visit: one way in, then the lessons (docs/pm-audit.md B1). */
.study-start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  max-width: 560px;
  margin: 0 auto 22px;
  text-align: center;
}
.study-start[hidden] {
  display: none;
}
.study-start-note {
  color: var(--muted);
  font-weight: 700;
}
/*
 * Today, Mix it up and the week are for a learner who has studied here before. Until the script
 * decides (and without it), the inline flag in the hub picks: a first visit hides them, and a
 * returning learner keeps their space, so the lesson list never jumps (CLS). The script then
 * sets each one's hidden attribute.
 */
.study-hub:not(.is-returning) :is(.today-card, .study-mix, .study-week) {
  display: none;
}
.study-hub.is-returning:not(.is-ready) :is(.today-card, .study-mix, .study-week) {
  visibility: hidden;
}
.study-hub.is-returning:not(.is-ready) .study-start {
  display: none;
}
.today-ring-slot {
  display: inline-flex;
  min-height: 40px;
  min-width: 40px;
}
.study-section-example-en {
  display: block;
  font-family: var(--body);
  font-size: 0.85em;
  font-weight: 700;
  color: var(--muted);
}
.today-card {
  display: grid;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto 18px;
  padding: 16px 18px 14px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 18px 24px 20px;
  box-shadow: 5px 5px 0 var(--ink);
}
.today-card[hidden],
.study-mix[hidden],
.study-scope[hidden],
.study-week[hidden] {
  display: none;
}
.today-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.today-title {
  margin: 0;
  font-size: 1.7rem;
}
.today-streak {
  margin: 0 0 0 auto;
  font-weight: 800;
}
.today-streak:empty {
  display: none;
}
.today-plan {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.today-go {
  justify-self: start;
  text-decoration: none;
}
/* The goal and where new words come from are rarely changed, so they fold away. */
.today-settings {
  padding-top: 8px;
  border-top: 2px dashed rgb(57 44 32 / 0.25);
}
.today-settings[open] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.today-settings-toggle {
  flex: 1 1 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.today-goal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.today-setting-label {
  font-weight: 700;
  font-size: 0.9rem;
}
.today-from {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.today-from select {
  min-height: 44px;
  max-width: 100%;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
}
.goal-ring {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}
.goal-ring-art {
  width: 40px;
  height: 40px;
  transform: rotate(-90deg);
}
.goal-ring-track,
.goal-ring-fill {
  fill: none;
  stroke-width: 6;
}
.goal-ring-track {
  stroke: rgb(57 44 32 / 0.15);
}
.goal-ring-fill {
  stroke: var(--pad-dark);
  stroke-linecap: round;
  transition: stroke-dasharray 0.4s;
}
.goal-ring.is-met .goal-ring-fill {
  stroke: #c99a12;
}
.study-mix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  max-width: 560px;
  margin: 0 auto 16px;
}
.study-mix-go {
  text-decoration: none;
  color: var(--ink);
}
.study-mix-go.is-waiting,
.study-game.is-waiting {
  opacity: 0.55;
}
.study-scope {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.study-scope .study-chip {
  min-width: 44px;
  padding-inline: 10px;
}
.study-scope .study-chip:disabled {
  opacity: 0.4;
  cursor: default;
}
.study-mix-note {
  flex-basis: 100%;
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.study-mix-note[hidden] {
  display: none;
}
.study-week {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto 22px;
}
.study-week-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 16px;
  cursor: pointer;
}
.study-week-more {
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
}
.week-pads {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.week-pad {
  display: grid;
  justify-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 700;
}
.week-pad-dot,
.study-day {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 18px;
  border-radius: 50% 50% 46% 54% / 60% 60% 40% 40%;
  background: rgb(57 44 32 / 0.1);
  border: 2px solid transparent;
}
.week-pad.is-goal .week-pad-dot,
.study-day.is-goal {
  background: #f1b928;
  border-color: var(--ink);
}
.week-pad.is-some .week-pad-dot,
.study-day.is-some {
  background: #9ccf7f;
  border-color: var(--pad-dark);
}
.week-pad.is-rest .week-pad-dot,
.study-day.is-rest {
  background: transparent;
  border: 2px dotted var(--ink);
}
.week-pad.is-today .week-pad-dot,
.study-day.is-today {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.study-counts {
  margin: 0;
  font-weight: 700;
}
.study-month {
  width: 100%;
  padding: 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 16px;
}
.study-month[hidden] {
  display: none;
}
.study-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.study-month-title {
  margin: 0;
  font-size: 1.2rem;
}
.study-month-step {
  min-width: 44px;
  min-height: 44px;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
}
.study-month-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  text-align: center;
}
.study-month-table th {
  padding: 4px 0;
  font-size: 0.8rem;
}
.study-month-table td {
  padding: 3px 0;
}
.study-month-table .study-day {
  width: 34px;
  height: 30px;
  font-size: 0.85rem;
  font-weight: 700;
}
.study-day.is-future {
  background: transparent;
  color: var(--muted);
}
.study-month-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin: 8px 0 0;
  font-size: 0.85rem;
}
.study-month-key-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.study-day--key {
  width: 18px;
  height: 14px;
}
.study-hub-heading {
  margin: 8px 0 12px;
  font-size: 1.5rem;
}

/* ════ Sessions in the player: Today and Mix it up ════ */
.learn-room--study.is-session .study-bar {
  display: none;
}
.session-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 0 0 8px;
}
.session-step {
  margin: 0;
  font-weight: 800;
}
.session-step:empty {
  display: none;
}
.session-screen .week-pads {
  justify-content: center;
  margin: 10px 0;
}
.session-stop {
  text-decoration: none;
  color: var(--ink);
}
.learn-room--study.is-session .study-progress-row,
.learn-room--study.is-session .study-player-range {
  display: none;
}
.session-head .goal-ring-art {
  width: 30px;
  height: 30px;
}
.session-head .goal-ring {
  font-size: 0.9rem;
}
@media (max-width: 400px) {
  .study-tab {
    padding: 6px 8px;
    font-size: 0.85rem;
  }
  .study-tabs {
    gap: 4px;
  }
  .study-scope .study-chip {
    min-width: 40px;
    padding-inline: 8px;
  }
}
.study-say--plain {
  grid-template-columns: minmax(0, 1fr);
}
@media (max-width: 400px) {
  .study-bar {
    gap: 4px;
  }
  .study-tab {
    padding-inline: 7px;
  }
  .study-switches {
    gap: 4px;
  }
  .study-switch {
    width: 40px;
  }
}
/* Gyoza Grab: an empty slot shows its block's role colour while the sentence is new. */
.grab-slot.role-slot--topic {
  background: var(--role-topic);
}
.grab-slot.role-slot--time {
  background: var(--role-time);
}
.grab-slot.role-slot--place,
.grab-slot.role-slot--goal {
  background: var(--role-place);
}
.grab-slot.role-slot--with {
  background: var(--role-with);
}
.grab-slot.role-slot--how {
  background: var(--role-how);
}
.grab-slot.role-slot--object {
  background: var(--role-object);
}
.grab-slot.role-slot--noun {
  background: var(--role-noun);
}
.grab-slot.role-slot--end {
  background: var(--role-end);
}
.grab-tile.block,
.grab-placed.block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--fill);
}
.grab-feedback .block-lines {
  margin: 6px 0;
}
.today-card > * {
  min-width: 0;
}
.today-from {
  flex: 1 1 100%;
  min-width: 0;
}
.today-from select {
  flex: 1 1 12rem;
  width: 100%;
  min-width: 0;
}
/* On /study/, while Today, Mix it up or a game is open, the hub's title shrinks to one line. */
.learn-room--study.is-playing .study-hub-intro {
  margin-bottom: 4px;
}
.learn-room--study.is-playing .study-hub-intro .eyebrow {
  display: none;
}
.learn-room--study.is-playing .study-hub-intro h1 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
}
.study-player-head .eyebrow:empty {
  display: none;
}
/* The smallest phones (320 px): the four tabs and both sound switches share one row. */
@media (max-width: 360px) {
  .study-bar {
    gap: 4px;
  }
  .study-tabs {
    gap: 3px;
  }
  .study-tab {
    padding-inline: 4px;
    font-size: 0.8rem;
  }
  .study-switches {
    gap: 2px;
  }
  .study-switch {
    width: 33px;
  }
  .study-switch .speaker-icon {
    width: 20px;
    height: 20px;
  }
}

/* ════ Lesson 1: building up to sentences (docs/study-design.md section 3) ════ */
.learn-room--study,
.play-room {
  --role-like: #d2efe9;
  --role-like-ink: #1d5c50;
}
.block--like {
  --fill: var(--role-like);
  --ink-role: var(--role-like-ink);
}
.role-ink--like {
  color: var(--role-like-ink);
}

/* The lesson head: the Japanese title, then its romaji. */
.lesson-jp-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 10px;
  margin: 2px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.lesson-jp-romaji,
.study-lesson-romaji {
  font-weight: 700;
  color: var(--red);
}
.study-lesson-romaji {
  font-size: 0.85rem;
}
/* Under the step's sentence (in red), its romaji on a line of its own. */
.study-section-romaji {
  display: block;
  font-family: var(--romaji);
  font-size: 0.82em;
  color: var(--ink);
}

/* Word lists: each example with its romaji and English; the word's class. */
.study-example-jp {
  font-weight: 700;
}
.study-example-romaji {
  font-weight: 700;
  color: var(--red);
}
.study-list-pos,
.study-card-pos {
  display: inline-block;
  padding: 1px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.study-card-pos {
  justify-self: center;
}
.study-list-swap,
.study-list-steps {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding-left: 1.2em;
}
.study-swap-line,
.study-step-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

/* Build up: the phrase so far, with a slot where the next piece goes. */
.ask-target--ladder {
  gap: 8px;
  padding: 14px 12px;
}
.ladder-chain {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ladder-chip,
.ladder-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 46px;
  padding: 4px 9px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
}
.ladder-chip-jp {
  font-size: 1.1rem;
  font-weight: 700;
  word-break: keep-all;
}
.ladder-slot.is-next {
  min-width: 56px;
  border-style: dashed;
  box-shadow: 0 0 0 3px rgb(246 199 71 / 0.7);
}
.ladder-slot.is-filled {
  animation: slot-pop 220ms var(--ease-spring, ease-out);
}
.ladder-chain.is-right .ladder-slot {
  background: var(--right);
}
.ladder-chain.is-wrong .ladder-slot {
  background: var(--butter);
}
.ladder-hint {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}
.ladder-note {
  margin: 0;
  font-weight: 700;
  color: var(--red);
}
.ladder-next {
  justify-self: center;
  min-height: 48px;
}

/* Choose: the lines around the choice, and choices that show their romaji. */
.ask-target--choose {
  justify-items: stretch;
  padding: 12px 14px;
  text-align: left;
}
.choose-lines .ask-en {
  font-size: clamp(1.2rem, 5vw, 1.6rem);
}
.ask-context .study-say-jp {
  font-size: 1.05rem;
}
.ask-target > .ask-context {
  justify-self: stretch;
  text-align: left;
}
.ask-choice-romaji {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--red);
}
.ask-choices.is-lines .ask-choice-jp {
  font-size: 1.15rem;
}

/* Pattern swap: the pieces as chips, and the line the chosen one makes. */
.pattern-swap {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.pattern-swap-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pattern-swap-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-height: 48px;
  padding: 4px 12px;
}
.pattern-swap-jp {
  font-size: 1.05rem;
  font-weight: 700;
}
.pattern-swap-romaji {
  font-size: 0.75rem;
  font-weight: 700;
}
.pattern-swap-line {
  margin: 0;
}

/* Make your own: three rows built in turn, each with its tray. */
.make-stage {
  display: grid;
  gap: 12px;
}
.make-intro {
  margin: 0;
  font-weight: 700;
  text-align: center;
}
.make-rows {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.make-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 2px solid rgb(57 44 32 / 0.35);
  border-radius: 14px;
}
.make-row.is-active {
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 3px rgb(246 199 71 / 0.7);
}
.make-row:not(.is-active, .is-done) {
  background: transparent;
  border-style: dashed;
}
.make-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font: 1.1rem/1.2 var(--heading);
}
.make-row-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 0.95rem;
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.make-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.make-slot {
  display: inline-flex;
  align-items: center;
  min-width: 48px;
  min-height: 44px;
  padding: 4px 10px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
}
.make-slot.is-next {
  border-style: dashed;
}
.make-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.make-tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 52px;
  padding: 4px 10px;
  color: var(--ink);
  font: inherit;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.make-tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.make-tile:disabled {
  opacity: 0.25;
  box-shadow: none;
  cursor: default;
}
.make-tile:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 3px;
}
.make-tile.is-shake {
  animation: tile-shake 240ms ease-in-out;
}
.make-tile--topic,
.make-tile--name {
  background: var(--role-topic);
}
.make-tile--adj {
  background: var(--role-like);
}
.make-tile--desu,
.make-tile--dou,
.make-tile--ask {
  background: var(--role-end);
}
.make-tile--very,
.make-tile--yes,
.make-tile--no {
  background: var(--role-lead);
}
/* Lesson 2: an adjective's "not" and the slip beside it look alike, so the rule decides. */
.make-tile--not,
.make-tile--slip {
  background: var(--role-like);
}
.make-tile-jp {
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}
.make-tile-romaji {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--red);
}
.make-line {
  display: grid;
  gap: 1px;
  margin: 0;
}
.make-line-jp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.make-line-jp {
  font-size: 1.2rem;
  font-weight: 700;
}
.make-line-romaji {
  font-weight: 700;
  color: var(--red);
}
.make-note {
  min-height: 1.4em;
  margin: 0;
  font-weight: 700;
}
.make-note.is-wrong {
  color: var(--red);
}
.make-actions {
  display: flex;
  justify-content: flex-start;
}
.make-exchange {
  display: grid;
  gap: 10px;
  padding: 12px;
  text-align: left;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
}
.make-say-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
}

/* An old lesson's address, on its way to the new lesson. */
.study-moved {
  max-width: 34rem;
  margin: 0 auto;
  text-align: center;
}

/* ════ Words first: the scene, meeting new items, meaning by ear (docs/study-design.md 3.2) ════ */
.ask-scene {
  display: grid;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto;
  padding: 14px;
  text-align: left;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px 16px 22px 18px;
  box-shadow: 4px 4px 0 var(--ink);
}
.ask-scene[hidden] {
  display: none;
}
.ask-scene-title {
  margin: 0;
  font: 1.35rem/1.15 var(--heading);
}
.ask-scene-title:focus {
  outline: none;
}
.talk-scene {
  display: grid;
  gap: 8px;
}
.talk-scene-line {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}
.talk-scene-exchange {
  margin: 4px 0 0;
}
.ask-scene-go,
.ask-meet-next {
  justify-self: center;
  min-width: min(100%, 220px);
  min-height: 52px;
  font-size: 1.1rem;
}
.ask-meet-next[hidden] {
  display: none;
}
.ask-target--meet {
  padding: 14px;
  background: var(--paper);
}
.ask-meet {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 100%;
}
.ask-meet--pattern,
.ask-meet--example,
.ask-meet--drill {
  justify-items: stretch;
  text-align: left;
}
.ask-meet--pattern .study-pattern-card {
  margin: 0;
  box-shadow: none;
  border: 0;
  padding: 0;
  background: none;
}
.ask-meet-lines {
  margin: 0;
}
.ask-meet-visual .learn-art,
.ask-meet-visual .clock,
.ask-meet-visual .visual {
  width: 96px;
  height: 96px;
}
.ask-meet-visual .visual--days,
.ask-meet-visual .visual--span,
.ask-meet-visual .visual--week {
  width: 160px;
  height: auto;
}
.ask-meet-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
}
.ask-meet-head .ask-say {
  position: static;
}
.ask-meet-jp {
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.ask-meet-jp.is-long {
  font-size: clamp(1.6rem, 6.5vw, 2.4rem);
}
.ask-meet-jp.is-very-long {
  font-size: clamp(1.3rem, 5vw, 1.8rem);
}
.ask-meet-romaji {
  font: 1.45rem/1.15 var(--heading);
  color: var(--red);
}
.ask-meet-en {
  font: clamp(1.25rem, 5vw, 1.6rem)/1.2 var(--heading);
}
.ask-meet-note {
  margin: 2px 0 0;
  font-weight: 700;
  color: var(--muted);
}
.ask-meet-example {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 2px dashed rgb(57 44 32 / 0.25);
  width: 100%;
}
.ask-meet-example-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ask-meet-example-jp {
  font-size: 1.15rem;
  font-weight: 700;
}
.ask-meet-example-romaji {
  font-weight: 700;
  color: var(--red);
}
.ask-meet-example-en {
  color: var(--muted);
  font-weight: 700;
}
.ask-listen {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 0;
}
.ask-listen .ask-listen-say {
  width: 72px;
  height: 72px;
}
.ask-listen .ask-listen-say .speaker-icon {
  width: 38px;
  height: 38px;
}
.ask-listen-hint {
  font-weight: 700;
  color: var(--muted);
}
.ask-choice-text {
  display: grid;
  justify-items: center;
  gap: 1px;
}
.ask-piece {
  margin: 4px 0 0;
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.ladder-piece-note {
  margin: 0;
  padding: 4px 10px;
  font-weight: 700;
  background: var(--butter);
  border: 2px solid var(--ink);
  border-radius: 10px;
}

/* Kero and Goro react in the corner of Learn: a hop on a streak, a peek on a miss. */
.ask-cast {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.ask-cast img {
  position: absolute;
  width: 54px;
  height: auto;
  opacity: 0;
}
.ask-cast-kero {
  top: 4px;
  left: 4px;
}
.ask-cast-goro {
  top: 4px;
  right: -60px;
}
.ask-cast-kero.is-hop {
  animation: cast-hop 0.9s var(--ease-out);
}
.ask-cast-goro.is-peek {
  animation: cast-peek 1.4s var(--ease-out);
}
@keyframes cast-hop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  25% {
    opacity: 1;
    transform: translateY(-14px) rotate(-6deg) scale(1.05);
  }
  55% {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(0);
  }
}
@keyframes cast-peek {
  0% {
    opacity: 0;
    transform: translateX(0);
  }
  25%,
  70% {
    opacity: 1;
    transform: translateX(-62px) rotate(-8deg);
  }
  100% {
    opacity: 0;
    transform: translateX(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ask-cast-kero.is-hop,
  .ask-cast-goro.is-peek {
    animation: none;
  }
}

/* Sensei's plain correction of a misread number word. */
.answer-sensei {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  margin: 0;
  padding: 8px 10px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
}
.answer-sensei-face {
  grid-row: 1 / 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--butter);
}
.answer-sensei-name {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.answer-sensei-text {
  font-weight: 700;
}

/* A word's example under its flashcard, with its speaker right beside it. */
.study-card-example-row {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin-top: 12px;
  padding: 10px 12px;
  text-align: center;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
}
.study-card-example-row[hidden] {
  display: none;
}
.study-card-example-said {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.study-card-example-row .study-card-romaji-small,
.study-card-example-en {
  margin: 0;
}
.study-card-example-en {
  font-weight: 700;
  color: var(--muted);
}

/* The scene in a word list, readable without script. */
.study-list-scene {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #fff;
  border: 2px dashed rgb(57 44 32 / 0.4);
  border-radius: 12px;
}

/* ════ Make your own with a clock or a calendar ════ */
.make-setter {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
}
.make-setter-title {
  margin: 0;
  font: 1.1rem/1.2 var(--heading);
}
.make-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.make-clock-face {
  width: 112px;
  height: 112px;
}
.make-clock-time,
.make-date-shown {
  margin: 0;
  font: 1.8rem/1.1 var(--heading);
  text-align: center;
}
.make-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px;
}
.make-chips--minutes,
.make-chips--months {
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
}
.make-chips--half {
  grid-template-columns: repeat(2, minmax(80px, 140px));
  justify-content: center;
}
.make-chip {
  min-height: 44px;
  padding: 4px 6px;
  justify-content: center;
}
.make-tile--time,
.make-tile--hour,
.make-tile--minute,
.make-tile--half,
.make-tile--month,
.make-tile--day {
  background: var(--role-time);
}
.make-tile--desuka {
  background: var(--role-end);
}
.make-tile--wa {
  background: var(--role-topic);
}
.make-line .study-face {
  width: 32px;
  height: 32px;
}
.make-line--reply {
  padding-top: 8px;
  border-top: 2px dashed rgb(57 44 32 / 0.25);
}

/* ════ /learn/vocabulary/: a pack's line under its name, and the link on to more ════ */
.vocab-pack .study-lesson-sub + .study-lesson-sub {
  margin-top: 2px;
}
.vocab-more {
  margin: 18px 0 0;
}
.study-lesson--vocab {
  background: #f1ebfa;
}

/* ════ /learn/numbers/: the path in three parts ════ */
.numbers-part {
  display: grid;
  gap: 10px;
  margin: 26px 0 0;
}
.numbers-part-title {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
}
.numbers-part-number {
  display: block;
  font: 800 0.8rem/1.2 var(--body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}
.numbers-part-line {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.numbers-sections {
  margin: 0;
}
.learn-room--index .today-card--mini {
  margin: 14px 0;
  max-width: 460px;
}
.numbers-section-item {
  position: relative;
}
.numbers-section-item > .numbers-section {
  padding-bottom: 62px;
}
.numbers-section-item > .learn-tile-play {
  min-height: 44px;
  padding: 0 16px;
}

/* A long block (いま すんでいる ところ は) wraps at its spaces in a narrow card, never past it. */
.block {
  max-width: 100%;
}
.block-jp {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
@media (max-width: 400px) {
  .ask-scene {
    padding: 10px 8px;
  }
  .ask-scene .study-example,
  .ask-meet .study-example {
    padding: 8px;
  }
  .ask-target--meet {
    padding: 10px 8px;
  }
  /* A long word such as なんようびですか stays whole on its line, its 。 with it: the face
     sits small beside the speaker's name, and the line takes the card's whole width. */
  .ask-scene .study-say-jp,
  .ask-meet .study-say-jp {
    font-size: 1.1rem;
  }
  .ask-scene .study-say:not(.study-say--plain),
  .ask-meet .study-say:not(.study-say--plain) {
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    row-gap: 2px;
  }
  .ask-scene .study-say:not(.study-say--plain) > .study-say-body,
  .ask-meet .study-say:not(.study-say--plain) > .study-say-body {
    display: contents;
  }
  .ask-scene .study-say-body > :not(.study-say-name),
  .ask-meet .study-say-body > :not(.study-say-name) {
    grid-column: 1 / -1;
  }
  .ask-scene .study-say .study-face,
  .ask-meet .study-say .study-face {
    width: 28px;
    height: 28px;
    font-size: 0.6rem;
  }
}

/* ════ The kana paths (docs/kana-design.md) ════ */
/* Hiragana keeps its butter page and katakana its blue one, in the same player. */
.learn-room--study.learn-room--hiragana {
  --learn-bg: var(--butter);
}
.learn-room--study.learn-room--katakana {
  --learn-bg: var(--blue);
  --muted: #3f3224;
  --red: #7f2219;
}
/* A letter's sound, big: the question "Pick the kana". */
.ask-sound {
  font: clamp(2.4rem, 11vw, 3.6rem)/1.05 var(--heading);
  color: var(--red);
}
/* Read it: the letter or word in kana, big. */
.ask-read-jp {
  font-size: clamp(2.4rem, 11vw, 3.8rem);
  font-weight: 700;
  line-height: 1.15;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.ask-read-jp.is-long {
  font-size: clamp(1.8rem, 7.5vw, 2.6rem);
}
.ask-read-jp.is-very-long {
  font-size: clamp(1.4rem, 5.5vw, 2rem);
}
.ask-choice-reading {
  font: 1.45rem/1.15 var(--heading);
  color: var(--red);
}
/* Meeting a letter: the kana bigger than a word's. */
.ask-meet--kana .ask-meet-jp {
  font-size: clamp(3.2rem, 15vw, 4.8rem);
  line-height: 1.05;
}
.ask-meet--kana .ask-meet-romaji {
  font-size: 1.8rem;
}
.study-card-letter {
  font-size: clamp(3.4rem, 16vw, 5.2rem);
  line-height: 1.05;
}
/* A letter's sound: the whole question on an English-first card, so it fills the card. */
.study-card-letter-sound {
  font-size: clamp(2.8rem, 13vw, 4rem);
}
.study-list-kana {
  font-size: 1.6rem;
}
/* Say it to Kero: the moment, and who speaks first. */
.make-scene {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}
.make-line--cue .study-face {
  width: 32px;
  height: 32px;
}
/* At Kero's café: the menu on the counter. */
.make-menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 118px), 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.make-menu-item {
  display: grid;
  gap: 0;
  padding: 6px 8px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
}
.make-menu-jp {
  font-weight: 700;
  font-size: 1.1rem;
}
.make-menu-romaji {
  font-weight: 700;
  color: var(--red);
}
.make-menu-en {
  font-size: 0.9rem;
  color: var(--muted);
}
.make-tile--dish,
.make-tile--o {
  background: var(--role-object);
}
.make-tile--please {
  background: var(--role-end);
}
.make-tile--kana .make-tile-jp {
  font-size: 1.4rem;
}
/* A rule card on the kana paths reads "How it works". */
.study-pattern-card--rule .study-pattern-jp {
  font-size: clamp(1.6rem, 7vw, 2.4rem);
}

/* ════ Easy, Normal or Hard: one switch on the hubs and in the player ════ */
.level-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 12px 0 0;
}
.level-switch[hidden] {
  display: none;
}
/* With scripts on, the page's switch and the title's speaker hold their place from the first
   paint, hidden until the script shows them, so the path below never jumps down as the page
   loads. Without scripts they stay out. */
@media (scripting: enabled) {
  /* Over the rooms' own [hidden] rule (display: none !important), for these three only. */
  body .level-switch[hidden]:not(.level-switch--player) {
    display: flex !important;
    visibility: hidden;
  }
  body .lesson-jp .say-button[hidden] {
    display: inline-grid !important;
    visibility: hidden;
  }
  body .study-set-play[hidden] {
    display: flex !important;
    visibility: hidden;
  }
}
.level-switch-label {
  font-weight: 700;
}
.level-switch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.level-chip {
  min-width: 64px;
  min-height: 44px;
  padding: 4px 14px;
  font: 700 0.95rem/1.1 var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
  transition:
    transform 0.1s var(--ease-out),
    box-shadow 0.1s var(--ease-out);
}
.level-chip:active {
  transform: translateY(2px);
  box-shadow: none;
}
.level-chip[aria-pressed='true'] {
  color: var(--paper);
  background: var(--ink);
}
.level-chip:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 2px;
}
.level-switch-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
}
.level-switch--player {
  margin-top: 8px;
}
.level-switch--hub {
  margin: 0 0 14px;
}
.study-lesson-bar .level-switch {
  justify-content: center;
}
.study-lesson-bar .level-switch-note {
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .level-chip {
    transition: none;
  }
  .level-chip:active {
    transform: none;
  }
}
@media (forced-colors: active) {
  .level-chip {
    border-color: ButtonText;
  }
  .level-chip[aria-pressed='true'] {
    outline: 2px solid Highlight;
  }
}

/* Easy: Hint lights the next tile, in Learn and in Gyoza Grab. */
.ask-hint[hidden],
.grab-hint[hidden] {
  display: none;
}
.ask-hint,
.grab-hint {
  min-width: 88px;
}
.hop-level-line {
  max-width: 32ch;
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.hop-level-line[hidden] {
  display: none;
}

/* ════ Match: the meaning game ════
 * Cards are dealt face down and flip up. A Japanese card (kana and romaji) pairs with its
 * meaning (English, a numeral, a clock or a calendar). Props may squash and tilt; Kero and Goro
 * move only as whole pictures.
 */
.match-stage {
  position: relative;
  display: grid;
  gap: 10px;
  width: min(100%, 680px);
  margin: 0 auto;
}
.match-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}
.match-hud.is-quiet {
  display: none;
}
.match-round {
  margin: 0;
  font-weight: 700;
}
.match-combo {
  margin: 0;
  font: 1.3rem/1 var(--heading);
  color: var(--red);
}
.match-combo.is-hot {
  animation: hop-twinkle 1.2s ease-in-out infinite;
}
.match-clock {
  margin: 0 0 0 auto;
  padding: 4px 12px;
  font: 1.25rem/1 var(--heading);
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 2px 0 var(--ink);
}
.match-clock[hidden] {
  display: none;
}
.match-kero,
.match-goro {
  flex: 0 0 auto;
  width: 44px;
  height: auto;
}
.match-goro {
  order: 9;
}
.match-kero.is-hop {
  animation: match-kero-hop 0.6s var(--ease-out);
}
.match-goro.is-peek {
  animation: match-goro-glee 0.9s ease-in-out;
}
@keyframes match-kero-hop {
  40% {
    transform: translateY(-12px) rotate(-6deg);
  }
  70% {
    transform: translateY(0) rotate(2deg);
  }
}
@keyframes match-goro-glee {
  20%,
  60% {
    transform: rotate(-8deg) translateY(-4px);
  }
  40%,
  80% {
    transform: rotate(8deg) translateY(-4px);
  }
}
.match-table {
  position: relative;
  padding: 12px;
  background:
    radial-gradient(circle at 12px 12px, rgb(255 255 255 / 0.35) 2px, transparent 2.5px) 0 0 / 24px
      24px,
    #ffe6a3;
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--ink);
}
.match-table[hidden] {
  display: none;
}
.match-board {
  display: grid;
  gap: 10px;
}
.match-board.is-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
}
.match-col {
  display: grid;
  grid-auto-rows: 1fr;
  gap: 10px;
}
.match-board.is-mixed {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 640px) {
  .match-board.is-mixed {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .match-board.is-mixed.is-six {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .match-board.is-columns {
    column-gap: 28px;
  }
}
.match-fx {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.match-card {
  position: relative;
  display: block;
  min-height: 76px;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-align: center;
  background: none;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  perspective: 800px;
  -webkit-tap-highlight-color: transparent;
}
.match-card-inner {
  position: relative;
  display: grid;
  min-height: inherit;
  height: 100%;
  transform-style: preserve-3d;
  transition:
    transform 0.32s var(--ease-out) calc(var(--deal, 0) * 45ms),
    translate 0.12s var(--ease-out);
}
.match-card.is-down .match-card-inner {
  transform: rotateY(180deg);
}
.match-card-face,
.match-card-back {
  grid-area: 1 / 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.match-card-face {
  background: var(--paper);
}
.match-card--en .match-card-face {
  background: #fff4d6;
}
.match-card-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 50%, #8fd0a0 0 30%, transparent 31%) 50% 50% / 34px 34px,
    #5aa64a;
}
.match-jp {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.match-jp.is-long {
  font-size: 1.15rem;
}
.match-jp.is-very-long {
  font-size: 1rem;
}
.match-romaji {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--red);
  overflow-wrap: anywhere;
}
.match-en {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.match-en.is-long {
  font-size: 0.95rem;
}
.match-visual {
  display: grid;
  place-items: center;
  width: min(100%, 120px);
  height: 56px;
}
.match-visual > *,
.match-visual img,
.match-visual svg {
  width: 100%;
  height: 100%;
  max-height: 56px;
  object-fit: contain;
}
.match-visual .time-prompt-text {
  display: none;
}
.match-card:hover:not(:disabled) .match-card-inner {
  translate: 0 -2px;
}
.match-card.is-picked .match-card-inner {
  translate: 0 -4px;
}
.match-card.is-picked .match-card-face {
  background: var(--yellow);
  box-shadow:
    0 6px 0 var(--ink),
    0 0 0 4px rgb(255 255 255 / 0.9);
}
.match-card:focus-visible {
  outline: 3px solid #075693;
  outline-offset: 4px;
}
.match-card.is-wrong .match-card-face {
  background: var(--wrong);
  animation: match-shake 0.36s ease-in-out;
}
.match-card.is-hint .match-card-face {
  background: #fff1a8;
  animation: match-hint 0.8s ease-in-out infinite;
}
.match-card.is-matched {
  cursor: default;
}
.match-card.is-matched .match-card-face {
  background: var(--right);
  box-shadow: 0 2px 0 var(--ink);
  animation: match-pop 0.42s var(--ease-spring);
}
.match-card.is-matched .match-card-inner {
  opacity: 0.72;
  transition: opacity 0.3s ease 0.3s;
}
/* A tick, drawn in CSS, in the corner of a matched card. */
.match-card.is-matched .match-card-face::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 9px;
  width: 7px;
  height: 13px;
  border: solid #2f5f1f;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.match-badge {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  margin: -18px 0 0 -26px;
  padding: 2px 10px;
  font: 1.4rem/1.1 var(--heading);
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  opacity: 0;
  pointer-events: none;
}
.match-badge.is-popping {
  animation: hop-badge 0.9s var(--ease-out) forwards;
}
.match-plus {
  position: absolute;
  top: -8px;
  right: 14px;
  z-index: 4;
  font: 1.2rem/1 var(--heading);
  color: var(--red);
  opacity: 0;
  pointer-events: none;
}
.match-plus.is-showing {
  animation: match-plus 0.9s var(--ease-out);
}
.match-intro {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px 16px 20px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
}
.match-intro[hidden],
.match-results[hidden] {
  display: none;
}
.match-intro-title {
  margin: 0;
  font-size: 1.8rem;
}
.match-intro-art {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 190px;
  height: 84px;
}
.match-intro-card {
  width: 48px;
  height: 66px;
  margin: 0 -6px;
  background:
    radial-gradient(circle at 50% 50%, #8fd0a0 0 30%, transparent 31%) 50% 50% / 24px 24px,
    #5aa64a;
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  animation: match-fan 2.4s ease-in-out infinite;
}
.match-intro-card:nth-child(1) {
  transform: rotate(-12deg);
  animation-delay: -0.4s;
}
.match-intro-card:nth-child(2) {
  transform: translateY(-8px);
  background: var(--paper);
  animation-delay: -0.8s;
}
.match-intro-card:nth-child(3) {
  transform: rotate(12deg);
  animation-delay: -1.2s;
}
.match-intro-kero {
  position: absolute;
  right: -14px;
  bottom: -4px;
  width: 58px;
  height: auto;
}
@keyframes match-fan {
  50% {
    translate: 0 -4px;
  }
}
.match-intro-title:focus {
  outline: none;
}
.match-intro-line {
  max-width: 34ch;
  margin: 0;
  font-weight: 700;
}
.match-intro-level,
.match-best {
  max-width: 36ch;
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}
.match-best[hidden] {
  display: none;
}
.match-start {
  min-width: 170px;
}
@keyframes match-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12) rotate(-2deg);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes match-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px) rotate(-2deg);
  }
  45% {
    transform: translateX(6px) rotate(2deg);
  }
  70% {
    transform: translateX(-4px);
  }
}
@keyframes match-hint {
  0%,
  100% {
    box-shadow: 0 4px 0 var(--ink);
  }
  50% {
    box-shadow:
      0 4px 0 var(--ink),
      0 0 0 6px rgb(246 199 71 / 0.95);
  }
}
@keyframes match-plus {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-18px);
  }
}
@media (max-width: 400px) {
  .match-table {
    padding: 10px 8px;
  }
  .match-board.is-columns {
    column-gap: 8px;
  }
  .match-card {
    min-height: 70px;
  }
  .match-card-face,
  .match-card-back {
    padding: 6px;
  }
  .match-jp {
    font-size: 1.3rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .match-card-inner {
    transition: opacity 0.15s linear;
  }
  .match-card.is-down .match-card-inner {
    transform: none;
    opacity: 0;
  }
  .match-card:hover:not(:disabled) .match-card-inner,
  .match-card.is-picked .match-card-inner {
    translate: none;
  }
  .match-card.is-wrong .match-card-face,
  .match-card.is-matched .match-card-face,
  .match-combo.is-hot,
  .match-kero.is-hop,
  .match-goro.is-peek {
    animation: none;
  }
  .match-card.is-hint .match-card-face {
    animation: none;
    outline: 4px solid var(--yellow);
  }
  .match-badge.is-popping,
  .match-plus.is-showing,
  .match-intro-card {
    animation: none;
  }
}
@media (forced-colors: active) {
  .match-card-face,
  .match-card-back {
    border-color: ButtonText;
  }
  .match-card.is-picked .match-card-face {
    outline: 3px solid Highlight;
  }
  .match-card.is-matched .match-card-face {
    outline: 2px dashed GrayText;
  }
}

/* Match on the Play tab and on the hub's Games row: two little cards, a word and its meaning. */
.play-tile--match .play-tile-art {
  background: #ffe6a3;
}
.play-tile-cards {
  position: absolute;
  inset: 18px 14px 18px 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.play-tile-card {
  display: grid;
  place-items: center;
  min-width: 0;
  max-width: 48%;
  min-height: 70%;
  padding: 6px 8px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
}
.play-tile-card--jp {
  transform: rotate(-5deg);
}
.play-tile-card--en {
  font: 1.6rem/1 var(--heading);
  background: #fff4d6;
  transform: rotate(4deg);
}
.play-tile-card-jp {
  font-size: 1.15rem;
  white-space: nowrap;
}
.play-tile-card-romaji {
  font-size: 0.8rem;
  color: var(--red);
}
.play-tile--match .play-tile-kero {
  bottom: 8px;
  left: 4%;
  width: 30%;
  max-width: 88px;
}
.study-game-cards {
  display: flex;
  gap: 3px;
  width: 100%;
}
.study-game--match .study-game-art {
  width: 66px;
}
.study-game-card {
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-height: 42px;
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  transform: rotate(-4deg);
}
.study-game-card--en {
  background: #fff4d6;
  transform: rotate(4deg);
}
.study-games-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 620px) {
  .study-games-row {
    grid-template-columns: 1fr;
  }
}

/* Three games on the Play tab: side by side on a wide screen, one under another on a phone,
   each with its picture beside its name. */
.play-tiles {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 920px;
}
@media (max-width: 720px) {
  .play-tiles {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .play-tile {
    grid-template-rows: none;
    grid-template-columns: minmax(120px, 38%) 1fr;
    min-height: 108px;
  }
  .play-tile-art {
    border-bottom: 0;
    border-right: 3px solid var(--ink);
  }
  .play-tile-words {
    align-content: center;
    padding: 10px 12px;
  }
  .play-tile--hop .play-tile-kero {
    width: 64px;
    margin-left: -32px;
  }
  .play-tile-cards {
    inset: 12px 4px 12px 36%;
    gap: 4px;
  }
  .play-tile-card {
    max-width: none;
    padding: 4px 6px;
    border-width: 2px;
  }
  .play-tile-card-jp {
    font-size: 0.95rem;
  }
  .play-tile--match .play-tile-kero {
    left: 2%;
    width: 34%;
  }
}
/* In the player the switch keeps to one line, so a whole round still fits on a phone: its note
   is read out, not shown. */
.level-switch--player .level-switch-note {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.study-player-head .level-switch {
  justify-content: center;
}
.match-clock[hidden] + .match-goro {
  margin-left: auto;
}

/* A speaker shown by name ("You") grows with its text, so it never spills out of its circle at
   200% text; a face picture keeps its fixed size. */
.make-line {
  --face: 32px;
}
.grab-prompt-row {
  --face: 34px;
}
.study-face.study-face--text {
  width: auto;
  height: auto;
  min-width: var(--face, 40px);
  min-height: var(--face, 40px);
  padding: 0 0.3em;
  border-radius: 999px;
}
