/*
 * Kanjiru — global styles.
 * Every colour, space, size, radius, shadow and timing comes from the
 * tokens in tokens.js. Breakpoints and z-index are written out on purpose.
 */

/* ── Reset ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* The scrollbar's room is kept even on a page too short to scroll, so the
   layout doesn't shift sideways between pages on a desktop (2026-11-10).
   Overlay scrollbars (phones, macOS) take no room either way. */
html { scrollbar-gutter: stable; }

/* A modal's backdrop, and a header tip's dimming, stop short of that kept
   room, which shows the root's background: while either shows, the root
   takes the same dimming over the page, so the whole screen dims
   (2026-11-11; seen with classic scrollbars, as on Windows). */
html:has(.head-tip) { --gutter-dim: color-mix(in srgb, var(--color-bg-overlay) calc(var(--opacity-soft) * 100%), transparent); }
/* After the tip's, so a modal opened over a tip dims the gutter as its own
   backdrop does. */
html:has(dialog:modal) { --gutter-dim: var(--color-bg-overlay); }
html:is(:has(dialog:modal), :has(.head-tip)) {
  background: linear-gradient(var(--gutter-dim), var(--gutter-dim)), var(--color-bg-page);
}

/* A phone turned on its side enlarges text it thinks is small, unevenly
   (iOS Safari). Sizes stay as the tokens set them; pinch zoom still works. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-md);
  line-height: var(--font-lineHeight-normal);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled { cursor: default; }

:focus-visible {
  outline: var(--stroke-thick) solid var(--color-border-focus);
  outline-offset: var(--stroke-thick);
  border-radius: var(--radius-sm);
}

a {
  color: var(--color-link-default);
  transition: color var(--transition-hover) var(--transition-ease);
}
@media (hover: hover) {
  a:hover { color: var(--color-link-hover); }
}

/* Kanji shown as kanji (tiles, the brand, example words) use the serif.
   Only marked elements: the page itself may be lang="ja" for the Japanese
   interface, which keeps the sans UI font. */
body [lang="ja"], .kanji { font-family: var(--font-family-kanji); }

/* ── Layout ────────────────────────────────────────────────────────── */

.app-header,
.app-main,
.app-footer {
  width: 100%;
  max-width: var(--layout-container);
  margin: 0 auto;
  /* Clear of a phone's notch and rounded corners when it's on its side:
     the page reaches the screen's edges (viewport-fit=cover, index.html). */
  padding-left: max(var(--spacing-md), env(safe-area-inset-left, 0px));
  padding-right: max(var(--spacing-md), env(safe-area-inset-right, 0px));
}

/* Without JavaScript nothing runs, the tokens included: index.html's note. */
.noscript { text-align: center; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-md);
  padding-bottom: var(--spacing-md);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-sm);
  min-width: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-tight);
}

.brand-link {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-sm);
  color: inherit;
  text-decoration: none;
}

@media (hover: hover) {
  .brand-link:hover { color: inherit; }
}

.brand-kanji {
  color: var(--color-text-accent);
  font-weight: var(--font-weight-black);
}

.brand-name { letter-spacing: var(--font-tracking-wide); }

/* On another page the brand is a breadcrumb, 漢 › Points: the mark goes
   home, the page's name follows. */
.brand-mark {
  display: none;
  color: var(--color-text-accent);
  font-weight: var(--font-weight-black);
}

.app-header.is-crumb .brand-mark { display: inline; }
.app-header.is-crumb .brand-kanji,
.app-header.is-crumb .brand-name { display: none; }

.crumb-sep {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
}

.crumb-page { min-width: 0; }

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--spacing-sm);
}

/* Every control in the header looks alike: a bordered pill, layout.headBtn
   high, round when it holds an icon alone. The points and the gear on the
   play page; the hints held and the gear in a game; Close on Points,
   Settings and About (app.js). */
.head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  min-width: var(--layout-headBtn);
  height: var(--layout-headBtn);
  padding: 0 var(--spacing-md) 0 var(--spacing-sm);
  border: var(--stroke-thin) solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-tight);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--transition-hover) var(--transition-ease),
    border-color var(--transition-hover) var(--transition-ease),
    color var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

.head-btn.is-icon {
  width: var(--layout-headBtn);
  padding: 0;
  color: var(--color-text-secondary);
}

@media (hover: hover) {
  .head-btn:hover {
    border-color: var(--color-border-default);
    background: var(--color-interactive-hover);
    color: var(--color-text-primary);
  }
}
.head-btn:active { background: var(--color-interactive-active); }
.head-btn[hidden] { display: none; }

.head-btn svg {
  width: var(--layout-headIcon);
  height: var(--layout-headIcon);
}

.head-icon { display: inline-flex; }
.head-icon.is-accent { color: var(--color-text-accent); }

/* The hints held, in a game: the one control there that helps, so it
   stands out (2026-11-10, the user asked): the skin's tint, a faint accent
   edge with a soft glow round it, and a lit bulb (app.js BULB). The edge
   is faint and the glow blurs it, so the curve reads smooth even where a
   hairline would step (2026-11-11, the user asked). */
#hints-open {
  border-color: color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-disabled) * 100%), transparent);
  background: var(--color-interactive-selected);
  box-shadow: 0 0 var(--spacing-sm) color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-faint) * 100%), transparent);
}
@media (hover: hover) {
  #hints-open:hover {
    border-color: color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-soft) * 100%), transparent);
    background: var(--color-interactive-hover);
  }
}
#hints-open:active { background: var(--color-interactive-active); }

.bulb-rays { stroke: var(--color-text-accent); }
.bulb-glass {
  fill: var(--color-hint-bulb);
  stroke: var(--color-text-primary);
}
.bulb-glint { stroke: var(--color-hint-glint); }
.bulb-base { stroke: var(--color-text-primary); }

/* The control a tip points at (app.js renderHeadTip()) sits above the
   tip's dimming (.head-tip) and calls: a ring in the accent swells out and
   fades, over and over; the hints' bulb glows too (2026-11-11, the user
   asked for the pill to stand out more, then the same for every tip). */
.head-btn.is-calling {
  position: relative;
  z-index: 2;
  color: var(--color-text-primary);
  animation: head-call calc(var(--transition-long) * 2) var(--transition-ease) infinite;
}

#hints-open.is-calling .head-icon {
  animation: bulb-glow calc(var(--transition-long) * 2) var(--transition-ease) infinite;
}

@keyframes head-call {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-strong) * 100%), transparent); }
  100% { box-shadow: 0 0 0 var(--spacing-md) transparent; }
}

@keyframes bulb-glow {
  0%, 100% { filter: none; }
  50%      { filter: drop-shadow(0 0 var(--spacing-xs) var(--color-hint-bulb)); }
}

/* The tooltip (app.js headTip(), one for every tip), hanging from the
   header with an arrow at the control it's about (--tip-arrow: from the
   tip's right edge to its middle): the language tip at the gear
   (.is-small) and the first game's welcome bonus at the hints (.is-card).
   Glass tinted with the skin's accent, so it stands off the page, with a
   soft, thick edge (2026-11-10, the user asked for less sharp, less
   contrasty edges). The rest of the page dims (its shadow's wide spread)
   but the control, which sits above it (.head-btn.is-calling), so the
   arrow's aim is plain (2026-11-11, the user asked). */
.head-tip {
  --tip-fill: color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-tint) * 100%), var(--color-bg-raised));
  --tip-bg: color-mix(in srgb, var(--tip-fill) calc(var(--opacity-strong) * 100%), transparent);
  /* The glass as it looks on the page: the arrow's fill. */
  --tip-solid: color-mix(in srgb, var(--tip-fill) calc(var(--opacity-strong) * 100%), var(--color-bg-page));
  /* The edge, solid, so the tip's and the arrow's are the same colour
     whatever lies behind them (the arrow sits over the page's dimming). */
  --tip-edge: color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-faint) * 100%), var(--tip-solid));
  position: absolute;
  z-index: 1;
  top: calc(100% - var(--spacing-xs));
  right: var(--spacing-md);
  display: flex;
  border: var(--stroke-thick) solid var(--tip-edge);
  border-radius: var(--radius-xl);
  /* The corner nearest the arrow rounds no further than leaves the arrow
     on the straight edge. */
  border-top-right-radius: clamp(var(--radius-sm),
    calc(var(--tip-arrow, var(--spacing-xl)) - var(--layout-tipArrowW) / 2 - var(--stroke-thick)),
    var(--radius-xl));
  background: var(--tip-bg);
  box-shadow:
    var(--shadow-lg),
    0 0 0 100vmax color-mix(in srgb, var(--color-bg-overlay) calc(var(--opacity-soft) * 100%), transparent);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  animation: toast-in var(--transition-slow) var(--transition-bounce) both;
}

/* The arrow (app.js TIP_ARROW): drawn, its line on the middle of the tip's
   top edge and its fill reaching just inside it, so the edge runs up round
   the point and back without a seam. Its fill is solid (the glass as it
   looks on the page), so the edge it covers doesn't show through it
   (2026-11-11, the user saw a line in it, then asked for a tighter shape). */
.head-tip-arrow {
  position: absolute;
  top: 0;
  right: calc(var(--tip-arrow, var(--spacing-xl)) - var(--layout-tipArrowW) / 2 - var(--stroke-thick));
  width: var(--layout-tipArrowW);
  height: var(--layout-tipArrowH);
  overflow: visible;
  transform: translateY(calc(var(--stroke-thick) / 2 - 100%));
  pointer-events: none;
}
.tip-arrow-fill { fill: var(--tip-solid); }
.tip-arrow-edge {
  fill: none;
  stroke: var(--tip-edge);
  stroke-width: var(--stroke-thick);
}

.head-tip-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--spacing-xl);
  height: var(--spacing-xl);
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    background-color var(--transition-hover) var(--transition-ease),
    color var(--transition-hover) var(--transition-ease);
}
@media (hover: hover) {
  .head-tip-close:hover { background: var(--color-interactive-hover); color: var(--color-text-primary); }
}
.head-tip-close svg { width: var(--layout-headIcon); height: var(--layout-headIcon); }

/* The language tip: one line or two, at the gear. It reaches a little
   past the gear, so the arrow clears the rounded corner. */
.head-tip.is-small {
  right: var(--spacing-sm);
  align-items: center;
  gap: var(--spacing-sm);
  width: min(var(--layout-tip), calc(100% - var(--spacing-md) * 2));
  padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) var(--spacing-md);
}

.head-tip-icon { font-size: var(--font-size-lg); }

.head-tip-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: var(--font-lineHeight-snug);
}

/* A card the width of the page, its parts stacked and centred: the
   welcome bonus, about the top third of a phone's screen (the user asked,
   2026-11-10): a glowing coin, the bonus, and Maybe later beside Buy a
   hint, which opens the hints. */
.head-tip.is-card {
  left: var(--spacing-md);
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  text-align: center;
}

.bonus-coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--layout-hintBox);
  height: var(--layout-seal);
  font-size: var(--font-size-3xl);
  line-height: var(--font-lineHeight-tight);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--color-hint-bulb) calc(var(--opacity-soft) * 100%), transparent), transparent);
}

.bonus-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-accent);
}

.bonus-amount {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-black);
  line-height: var(--font-lineHeight-tight);
  font-variant-numeric: tabular-nums;
}

.bonus-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xs);
}

@media (prefers-reduced-motion: reduce) {
  .head-btn.is-calling,
  #hints-open.is-calling .head-icon,
  .head-tip { animation: none; }
}

/* On every page (app.js glass()): the header sticks to the top and turns
   to glass as the page slides under it (--glass): a floating bar, inset
   from the edges, blurring what passes beneath. On the Points page, as the
   wallet's total goes under it, the total fades (.wallet-total) and the
   header's points come in beside Close (--dock, js/points.js). Both follow
   the scroll, 0 to 1. */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: var(--spacing-xs);
  border: var(--stroke-thin) solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-bg-surface) calc(var(--opacity-strong) * 100%), transparent);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(var(--blur-glass));
  backdrop-filter: blur(var(--blur-glass));
  opacity: var(--glass, 0);
  pointer-events: none;
}

.head-points {
  cursor: default;
  opacity: var(--dock, 0);
  transform: translateY(calc((1 - var(--dock, 0)) * var(--spacing-sm)));
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .head-points { transform: none; }
}

/* On phones there's room for one name only: the one in the page's language. */
@media (max-width: 419px) {
  html[lang="en"] .brand-kanji,
  html:not([lang="en"]) .brand-name { display: none; }
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
  padding-bottom: var(--spacing-xl);
}

.app-footer {
  display: flex;
  justify-content: center;
  padding-top: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
}

/* The footer holds only the back-to-apps mark, which shows on the play
   page alone (2026-11-10, the user asked): not in a game, nor on Points,
   Settings or About. app.js sets data-page. */
body:not([data-page="play"]) .app-footer { display: none; }

/* ── Buttons and pills ─────────────────────────────────────────────── */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--spacing-2xl);
  height: var(--spacing-2xl);
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  transition:
    background-color var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

@media (hover: hover) {
  .icon-btn:hover { background: var(--color-interactive-hover); }
}
.icon-btn:active { background: var(--color-interactive-active); }
.icon-btn:disabled { opacity: var(--opacity-disabled); }
.icon-btn svg { width: var(--spacing-lg); height: var(--spacing-lg); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-full);
  background: var(--color-bg-sunken);
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}

/* ── Sections ──────────────────────────────────────────────────────── */

.section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--spacing-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.section-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: none;
  letter-spacing: var(--font-tracking-none);
  font-weight: var(--font-weight-regular);
}

.card {
  background: var(--color-bg-surface);
  border: var(--stroke-thin) solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* ── Play page: the play card ──────────────────────────────────────── */

.play-cards {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.play-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

.play-top {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* The mode's numeral as a hanko seal, in the skin's action colour. */
.play-seal {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--layout-seal);
  height: var(--layout-seal);
  border-radius: var(--radius-lg);
  background: var(--color-action-primary-bg);
  color: var(--color-action-primary-text);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-black);
  line-height: var(--font-lineHeight-tight);
  box-shadow: var(--shadow-sm);
}

.play-card.is-soon .play-seal { opacity: var(--opacity-soft); }

.play-heading {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  min-width: 0;
}

.play-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

/* Where the daily stands, and on its right, the time to the next one. */
.play-status {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.play-line {
  min-width: 0;
  color: var(--color-text-secondary);
  line-height: var(--font-lineHeight-snug);
}

.play-line.is-won {
  color: var(--color-text-accent);
  font-weight: var(--font-weight-bold);
}

/* The Hard and Guided switches, a list under a small title. */
.play-level {
  display: flex;
  flex-direction: column;
  padding-top: var(--spacing-md);
  border-top: var(--stroke-thin) solid var(--color-border-subtle);
}

.sheet-section-title,
.fold-title,
.history-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.play-level .switch-row { padding: var(--spacing-sm) 0; }
.play-level .switch-row:last-child { padding-bottom: 0; }
.play-level .switch-row + .switch-row { border-top: var(--stroke-thin) solid var(--color-border-subtle); }

.play-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

/* Side by side when they fit on one line each, else stacked full width. */
.play-actions .btn {
  flex: 1 1 var(--layout-cardMin);
  white-space: nowrap;
}

/* The flag that ends the game on the go: square, beside Continue. */
.play-actions .play-end {
  flex: 0 0 auto;
  width: var(--spacing-2xl);
  padding: 0;
}
.play-end svg {
  width: var(--layout-headIcon);
  height: var(--layout-headIcon);
}

.play-countdown {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  color: var(--color-text-secondary);
  text-align: end;
}

/* ── Play page: folds (How to play, the install tip) ──────────────── */

/* A <details> card that folds to its title: How to play (open for a new
   player, folded after a game; js/howto.js) and the install tip (always
   folded at first; app.js). */
.fold {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  cursor: pointer;
  list-style: none;
  /* The card's corners, inside its border. Not `inherit`: a <details>
     slots its summary, so it would inherit the slot's square corners
     (the hover showed them, 2026-11-10). Open, the foot is square. */
  border-radius: calc(var(--radius-xl) - var(--stroke-thin));
  transition: background-color var(--transition-hover) var(--transition-ease);
}
.fold[open] > .fold-summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.fold-summary::-webkit-details-marker { display: none; }
@media (hover: hover) {
  .fold-summary:hover { background: var(--color-interactive-hover); }
}

.fold-chevron {
  flex: 0 0 auto;
  width: var(--spacing-sm);
  height: var(--spacing-sm);
  border-right: var(--stroke-thick) solid var(--color-text-muted);
  border-bottom: var(--stroke-thick) solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition-fold) var(--transition-ease);
}

.fold[open] .fold-chevron,
.sheet-fold[open] > .fold-summary .fold-chevron { transform: rotate(-135deg); }

/* A fold easing shut (js/dom.js smoothFold()) is still [open] until its
   body is gone: its chevron turns back as it starts. */
.fold.is-shutting .fold-chevron,
.sheet-fold.is-shutting > .fold-summary .fold-chevron,
.history-fold.is-shutting .fold-chevron { transform: rotate(45deg); }

.fold-body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  /* A gap under the title's hover, so it never touches the content. */
  padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-lg);
}

/* ── Play page: how to play (js/howto.js) ─────────────────────────── */

.howto-lead {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

.howto-text { color: var(--color-text-secondary); }

/* With a mouse, a line under the little game: the keys can be typed. */
.howto-keys {
  display: none;
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  text-align: center;
  color: var(--color-text-secondary);
}

@media (hover: hover) and (pointer: fine) {
  .howto-keys { display: block; }
}

/* Japanese lines break between phrases, not mid-word, where the browser
   can (2026-11-11: 当てよ / う。 read badly). */
.howto :is(.howto-lead, .howto-text, .demo-line, .demo-legend) { word-break: auto-phrase; }

/* The little game: the answer over three rows, a line saying what each
   step shows, and the colours' key under a hairline. Sizes stay put while
   it plays, so nothing below it moves. */
.demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg-page);
}

.demo-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
}

.demo-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.demo-slot {
  display: flex;
  gap: var(--spacing-xs);
}

.demo-answer-row {
  display: flex;
  justify-content: center;
  min-height: var(--layout-cell);
}

.demo-answer {
  font-size: var(--font-size-2xl);
  line-height: var(--layout-cell);
  color: var(--color-text-accent);
  visibility: hidden;
}

.demo-answer.is-shown {
  visibility: visible;
  animation: kanji-in var(--transition-slow) var(--transition-bounce) both;
}

/* A part typed into its cell pops in, as on the board. */
.demo-cell.is-typed {
  border-color: var(--color-border-strong);
  animation: kanji-in var(--transition-base) var(--transition-bounce) both;
}

.demo-line {
  min-height: calc(var(--font-size-md) * var(--font-lineHeight-snug) * 2);
  margin-top: var(--spacing-xs);
  max-width: var(--layout-powerMin);
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  text-align: center;
  color: var(--color-text-secondary);
  opacity: var(--opacity-hidden);
  transition: opacity var(--transition-base) var(--transition-ease);
}

.demo-line.is-shown { opacity: var(--opacity-full); }

/* Three columns, a colour over its words. */
.demo-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--spacing-sm);
  align-self: stretch;
  margin: 0;
  padding: var(--spacing-md) 0 0;
  border-top: var(--stroke-thin) solid var(--color-border-subtle);
  list-style: none;
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  text-align: center;
  color: var(--color-text-secondary);
}

.demo-legend li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
}

.legend-dot {
  display: block;
  width: var(--spacing-md);
  height: var(--spacing-md);
  border-radius: var(--radius-sm);
}

/* ── Play page: every game played (js/history.js) ──────────────────── */

.history {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
}

.history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.history-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The answer, what it means and how it went, then the guesses' squares;
   a tap opens the final board under it. */
.history-item {
  border-top: var(--stroke-thin) solid var(--color-border-subtle);
}

.history-item:first-child { border-top: none; }

.history-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--spacing-md);
  margin: 0 calc(var(--spacing-sm) * -1);
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
  list-style: none;
  transition:
    background-color var(--transition-hover) var(--transition-ease),
    box-shadow var(--transition-hover) var(--transition-ease),
    transform var(--transition-hover) var(--transition-ease);
}

div.history-summary { grid-template-columns: auto minmax(0, 1fr) auto; }

summary.history-summary { cursor: pointer; }
summary.history-summary::-webkit-details-marker { display: none; }
/* On a mouse, a game lifts a little under the pointer (2026-11-11, the
   user asked for a lift on cards). */
@media (hover: hover) {
  summary.history-summary:hover {
    background: var(--color-interactive-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(calc(var(--stroke-thick) * -1));
  }
}

/* A game listed by Show more fades in (app.js renderHistory()). */
.history-item.is-new { animation: motion-fade-in var(--transition-fold) var(--transition-ease) both; }

/* Opened: the final board, then Delete at the foot, on the right; a gap
   above it, so the row's hover doesn't touch the board. */
.history-body {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-sm) 0;
}
.history-actions {
  display: flex;
  justify-content: flex-end;
}

.history-fold[open] .fold-chevron { transform: rotate(-135deg); }

/* The final board (js/history.js): the kanji guide's frames as the game
   ended (js/play/frame.js), over every guess's tiles. */
.history-board {
  --board-frame: var(--layout-cellMd);
  --frame-1: var(--font-size-md);
  --frame-2: var(--font-size-xs);
  --frame-3: var(--font-size-xs);
  --frame-4: var(--font-size-xs);
  --frame-cover: var(--font-size-xl);
  --frame-inner: var(--font-size-xs);
  --frame-inset: var(--spacing-sm);
  --frame-solved: var(--font-size-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) 0 var(--spacing-md);
}

.history-frames {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-md);
}

.history-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
}

.history-rows {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-row,
.history-slot { display: flex; }
.history-row { gap: var(--spacing-md); }
.history-slot { gap: var(--spacing-xs); }

.history-board .tile.is-cell {
  width: var(--layout-cellSm);
  height: var(--layout-cellSm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
}

.history-word {
  min-width: var(--layout-cellMd);
  font-size: var(--font-size-xl);
  line-height: var(--font-lineHeight-tight);
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: var(--stroke-thick);
  min-width: 0;
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
}

.history-gloss {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--color-text-secondary);
}

.history-meta { color: var(--color-text-muted); }

.history-result {
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.history-result.is-won { color: var(--color-text-accent); }

.history-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--spacing-sm));
  gap: var(--stroke-thick);
}

.history-sq {
  width: var(--spacing-sm);
  height: var(--spacing-sm);
  border-radius: var(--stroke-thick);
}

/* ── Tiles ─────────────────────────────────────────────────────────── */

.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--layout-tile);
  height: var(--layout-tile);
  border-radius: var(--radius-md);
  border: var(--stroke-thick) solid var(--color-tile-border);
  background: var(--color-tile-bg);
  color: var(--color-tile-text);
  font-family: var(--font-family-kanji);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-tight);
}

.tile.is-hit,
.tile.is-near,
.tile.is-other,
.tile.is-miss {
  border-color: transparent;
  color: var(--color-feedback-text);
}

.tile.is-hit   { background: var(--color-feedback-hit); }
.tile.is-near  { background: var(--color-feedback-near); }
.tile.is-other { background: var(--color-feedback-other); }
.tile.is-miss  { background: var(--color-feedback-miss); }

.is-hit-bg  { background: var(--color-feedback-hit); }
.is-near-bg { background: var(--color-feedback-near); }
.is-miss-bg { background: var(--color-feedback-miss); }

/* Forced colours (Windows' contrast themes) repaint every background with
   the theme's, which would leave a guess's tiles all alike: green, yellow
   and grey are the game, so scored tiles, the legend's squares and the
   looks' examples keep theirs. Everything else takes the theme's colours. */
@media (forced-colors: active) {
  .tile.is-hit,
  .tile.is-near,
  .tile.is-other,
  .tile.is-miss,
  .is-hit-bg,
  .is-near-bg,
  .is-miss-bg,
  .swatch-preview {
    forced-color-adjust: none;
  }
}

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  min-height: var(--spacing-2xl);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
  transition:
    background-color var(--transition-hover) var(--transition-ease),
    color var(--transition-hover) var(--transition-ease),
    opacity var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

.btn:disabled { opacity: var(--opacity-disabled); }

.btn-large { font-size: var(--font-size-lg); }

.btn-small {
  min-height: var(--spacing-xl);
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-xs);
}

.btn-primary {
  background: var(--color-action-primary-bg);
  color: var(--color-action-primary-text);
}
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: var(--color-action-primary-hover); }
}

.btn-secondary {
  background: var(--color-action-secondary-bg);
  color: var(--color-action-secondary-text);
}
@media (hover: hover) {
  .btn-secondary:hover:not(:disabled) { background: var(--color-action-secondary-hover); }
}

/* Forced colours drop a button's fill, which is all that showed it was
   one: an edge in the text's colour takes its place (a filled button has
   no border of its own to repaint). */
@media (forced-colors: active) {
  .btn-primary,
  .btn-secondary { border: var(--stroke-thin) solid; }
}

/* A link drawn as a button (About in Settings) keeps the button's look. */
a.btn { text-decoration: none; }
@media (hover: hover) {
  a.btn-secondary:hover { color: var(--color-action-secondary-text); }
}

.btn-ghost { color: var(--color-text-secondary); }
@media (hover: hover) {
  .btn-ghost:hover:not(:disabled) { background: var(--color-interactive-hover); }
}

/* Something that can't be undone (Delete all data): outlined in the accent,
   which keeps AA contrast in every skin. */
.btn-danger {
  color: var(--color-text-accent);
  box-shadow: inset 0 0 0 var(--stroke-thick) currentColor;
}
@media (hover: hover) {
  .btn-danger:hover:not(:disabled) { background: var(--color-interactive-hover); }
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

/* ── Settings page, and the modals (.sheet) ──────────────────────── */

/* Settings (js/settings.js): one card of sections, each under a rule but
   the first. */
.settings-card > .sheet-section:first-child {
  padding-top: 0;
  border-top: 0;
}

/* A native <dialog>: showModal() puts it in the top layer, so no z-index. */
.sheet {
  width: 100%;
  max-width: min(var(--layout-container), calc(100% - var(--spacing-md) * 2));
  max-height: calc(100% - var(--spacing-xl) * 2);
  padding: 0;
  border: var(--stroke-thin) solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  background: var(--color-bg-raised);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-lg);
}

.sheet::backdrop { background: var(--color-bg-overlay); }

/* Opening, a sheet rises in as its backdrop fades; closing, the dialog
   goes at once (so the page takes the focus as before) and a copy of it
   fades out on top (js/dom.js closeSheet(), .sheet-ghost). Opened again
   while its copy fades (the next step of a run of asks), it stays put and
   only its content fades in (.is-again). */
.sheet[open] { animation: sheet-in var(--transition-sheetIn) var(--transition-ease) both; }
.sheet[open]::backdrop { animation: motion-fade-in var(--transition-sheetIn) var(--transition-ease) both; }
.sheet.is-again,
.sheet.is-again::backdrop { animation: none; }
.sheet.is-again > *,
.sheet-body.is-swapped { animation: motion-fade-in var(--transition-sheetOut) var(--transition-ease) both; }

.sheet-ghost {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--color-bg-overlay);
  pointer-events: none;
  animation: motion-fade-out var(--transition-sheetOut) var(--transition-exit) both;
}
.sheet-ghost > .sheet {
  overflow: hidden;
  animation: sheet-out var(--transition-sheetOut) var(--transition-exit) both;
}

@keyframes sheet-in {
  from {
    opacity: var(--opacity-hidden);
    transform: translateY(var(--spacing-sm)) scale(var(--scale-enter));
  }
}
@keyframes sheet-out { to { transform: scale(var(--scale-enter)); } }
@keyframes motion-fade-in { from { opacity: var(--opacity-hidden); } }
@keyframes motion-fade-out { to { opacity: var(--opacity-hidden); } }

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  margin: calc(var(--spacing-sm) * -1) calc(var(--spacing-sm) * -1) calc(var(--spacing-md) * -1) 0;
}

.sheet-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

.sheet-intro { color: var(--color-text-secondary); }

.sheet-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-lg);
  border-top: var(--stroke-thin) solid var(--color-border-subtle);
}

/* A row with a title and its control side by side (language, appearance). */
.sheet-row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.sheet-row-note { flex-basis: 100%; }

/* A section that folds to its title (Home screen, Move your progress,
   Start over; js/settings.js fold()): the title row is the toggle, reaching
   a spacing-md beyond the title on every side, so it's easy to tap; the
   body starts a little below its hover, so the two never touch. */
.sheet-fold { gap: 0; }
.sheet-fold > .fold-summary {
  margin: calc(var(--spacing-md) * -1);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
}
.sheet-fold-body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-lg);
}

/* About's title: tapped quickly enough times, it turns debug mode on
   (js/settings.js). No text selection or double-tap zoom in the way. */
.about-title {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Parts of a section (send, receive, save text). */
.sheet-sub {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-sm);
}

.sheet-sub-title {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
}

/* Switches (js/dom.js switchRow): the name, a tag and a note, then a
   sliding toggle; the whole row toggles it. */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  cursor: pointer;
}

.switch-row.is-disabled { cursor: default; opacity: var(--opacity-disabled); }

.switch-text {
  display: flex;
  flex-direction: column;
  gap: var(--stroke-thick);
  min-width: 0;
}

.switch-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--spacing-sm);
  font-weight: var(--font-weight-bold);
}

.switch-tag {
  padding: 0 var(--spacing-xs);
  border-radius: var(--radius-full);
  background: var(--color-interactive-selected);
  color: var(--color-text-accent);
  font-size: var(--font-size-xs);
}

.switch-note {
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  color: var(--color-text-secondary);
}

.switch {
  flex: 0 0 auto;
  position: relative;
  width: var(--layout-switch);
  height: var(--spacing-lg);
  margin: 0;
  border-radius: var(--radius-full);
  /* Off: a sunken track with a strong edge and a strong knob, so the edge
     stands out 3:1 on any card and the knob 3:1 on the track, in every look. */
  background: var(--color-bg-sunken);
  box-shadow: inset 0 0 0 var(--stroke-thin) var(--color-border-strong);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    background-color var(--transition-toggle) var(--transition-ease),
    box-shadow var(--transition-toggle) var(--transition-ease);
}

.switch::before {
  content: '';
  position: absolute;
  top: var(--spacing-xs);
  left: var(--spacing-xs);
  width: var(--spacing-md);
  height: var(--spacing-md);
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-toggle) var(--transition-ease),
    background-color var(--transition-toggle) var(--transition-ease);
}

.switch:checked { background: var(--color-action-primary-bg); box-shadow: none; }
.switch:checked::before {
  background: var(--color-action-primary-text);
  transform: translateX(var(--spacing-md));
}

/* A switch just moved: its page drew it afresh, so it starts drawn the way
   it was and slides from there (js/dom.js switchRow()). */
.switch.is-from,
.switch.is-from::before { transition: none; }
.switch:checked.is-from {
  background: var(--color-bg-sunken);
  box-shadow: inset 0 0 0 var(--stroke-thin) var(--color-border-strong);
}
.switch:checked.is-from::before { background: var(--color-border-strong); transform: none; }
.switch:not(:checked).is-from { background: var(--color-action-primary-bg); box-shadow: none; }
.switch:not(:checked).is-from::before {
  background: var(--color-action-primary-text);
  transform: translateX(var(--spacing-md));
}
.switch:disabled { cursor: default; }
.switch:focus-visible { border-radius: var(--radius-full); }

.sheet-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* One of a few (js/dom.js segmented): the picked one is raised. */
.segmented {
  display: inline-flex;
  gap: var(--stroke-thick);
  padding: var(--stroke-thick);
  border-radius: var(--radius-full);
  background: var(--color-bg-sunken);
}

.segment {
  min-height: var(--spacing-xl);
  padding: 0 var(--spacing-md);
  border-radius: var(--radius-full);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-secondary);
  transition:
    background-color var(--transition-hover) var(--transition-ease),
    color var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

@media (hover: hover) {
  .segment:hover:not(:disabled) { color: var(--color-text-primary); }
}

/* The picked one has an edge, so it stands out 3:1 from the track. */
.segment[aria-pressed="true"] {
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 var(--stroke-thin) var(--color-border-strong), var(--shadow-sm);
}

.segment:disabled { opacity: var(--opacity-disabled); }
.segment:focus-visible { border-radius: var(--radius-full); }

/* ── Device transfer ───────────────────────────────────────────────── */

.transfer-code {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg-sunken);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-tight);
  letter-spacing: var(--font-tracking-caps);
  font-variant-numeric: tabular-nums;
  user-select: all;
  -webkit-user-select: all;
}

.transfer-countdown {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.field-row {
  display: flex;
  gap: var(--spacing-sm);
}

.code-input,
.save-text {
  border: var(--stroke-thick) solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font: inherit;
}

.code-input {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-tracking-caps);
  text-transform: uppercase;
}

.code-input::placeholder,
.save-text::placeholder {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
  letter-spacing: var(--font-tracking-none);
  text-transform: none;
}

.save-text {
  width: 100%;
  padding: var(--spacing-sm);
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  word-break: break-all;
  resize: vertical;
}

.save-text[readonly] {
  background: var(--color-bg-sunken);
  color: var(--color-text-secondary);
}

.code-input:focus-visible,
.save-text:focus-visible {
  outline: var(--stroke-thick) solid var(--color-border-focus);
  outline-offset: 0;
  border-color: transparent;
}

/* Messages keep the readable text colour; the bar at the side says
   whether it went well. */
.transfer-status {
  padding-left: var(--spacing-sm);
  border-left: var(--stroke-thick) solid var(--color-border-default);
  font-size: var(--font-size-xs);
}

.transfer-status:empty { display: none; }
.transfer-status.is-ok { border-left-color: var(--color-status-success); }
.transfer-status.is-error { border-left-color: var(--color-status-danger); }

/* Merge or replace: asked when this device has progress of its own. */
.ask {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg-sunken);
}

.ask-title { font-weight: var(--font-weight-bold); }

.ask-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--layout-powerMin), 1fr));
  gap: var(--spacing-sm);
  width: 100%;
}

.ask-option {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  border: var(--stroke-thick) solid var(--color-border-subtle);
  background: var(--color-bg-surface);
  text-align: left;
  transition:
    border-color var(--transition-hover) var(--transition-ease),
    box-shadow var(--transition-hover) var(--transition-ease),
    opacity var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

/* On a mouse, an option lifts a little under the pointer. */
@media (hover: hover) {
  .ask-option:hover:not(:disabled) {
    border-color: var(--color-border-default);
    box-shadow: var(--shadow-sm);
    transform: translateY(calc(var(--stroke-thick) * -1));
  }
}

.ask-option-name { font-weight: var(--font-weight-bold); }
.ask-option.is-replace .ask-option-name { color: var(--color-text-accent); }

.ask-option-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* The ask before something that can't be undone (js/confirm.js): ending a
   game, resetting achievements, deleting everything. */
.ask-sheet .ask-options { grid-template-columns: 1fr; }
.ask-sheet .ask-option { border-color: var(--color-border-default); }
@media (hover: hover) {
  .ask-sheet .ask-option:hover:not(:disabled) { border-color: var(--color-border-strong); }
}
.ask-option.is-danger .ask-option-name { color: var(--color-text-accent); }
.ask-option:disabled { opacity: var(--opacity-disabled); cursor: not-allowed; }

.ask-sheet-titles {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

/* An × in place of Cancel (End game's ask). */
.ask-close {
  flex: 0 0 auto;
  align-self: flex-start;
}

.ask-step {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.ask-sheet-body { color: var(--color-text-secondary); }

.ask-typed-row {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.ask-typed-hint { font-weight: var(--font-weight-bold); }

/* ── Shared bits ───────────────────────────────────────────────────── */

/* Read by screen readers, not shown. (Clue names above the keyboard too:
   their icons stand in for them, see "Hints".) */
.visually-hidden,
.picker.is-keyboard .clue-label {
  position: absolute;
  width: var(--stroke-thin);
  height: var(--stroke-thin);
  margin: calc(var(--stroke-thin) * -1);
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A short message: the readable text colour, with a bar at the side that
   says whether it went well. */
.status-line {
  padding-left: var(--spacing-sm);
  border-left: var(--stroke-thick) solid var(--color-border-default);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.status-line:empty { display: none; }
.status-line.is-ok { border-left-color: var(--color-status-success); }
.status-line.is-error {
  border-left-color: var(--color-status-danger);
  color: var(--color-text-primary);
}

.loading { color: var(--color-text-muted); }

/* Glyphs the fonts lack, 1em square like text: Noto Serif JP's own outline,
   filled (js/play/glyph.js), or KanjiVG's strokes where there's none. */
.glyph-svg {
  width: 1em;
  height: 1em;
  overflow: visible;
}

.glyph-svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: calc(var(--stroke-thick) * 1.25);
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.glyph-svg.is-outline path {
  fill: currentColor;
  stroke: none;
}

/* ── Game screen ───────────────────────────────────────────────────── */

.game {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.game-count { font-variant-numeric: tabular-nums; }

.game-soon {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
}

/* Game-screen tiles: smaller than the start screen's example. */
.tile.is-cell {
  width: var(--layout-cell);
  height: var(--layout-cell);
  font-size: var(--font-size-lg);
}

/* The Arrows hint: a chevron at a yellow tile's left or right edge, in
   the tile's text colour (so it keeps the text's contrast), pointing the
   way to where its part lies. */
.tile.has-way { position: relative; }
.tile-way {
  position: absolute;
  top: 50%;
  width: var(--spacing-sm);
  height: var(--spacing-sm);
  border: 0 solid currentColor;
  pointer-events: none;
}
.tile-way.is-left {
  --way-dir: -1;
  left: var(--spacing-xs);
  border-width: 0 0 var(--stroke-thick) var(--stroke-thick);
  transform: translateY(-50%) rotate(45deg);
}
.tile-way.is-right {
  --way-dir: 1;
  right: var(--spacing-xs);
  border-width: var(--stroke-thick) var(--stroke-thick) 0 0;
  transform: translateY(-50%) rotate(45deg);
}
/* Used: each arrow slides out from the middle toward its edge and nudges. */
.tile-way.is-pointed {
  animation: way-point var(--transition-reveal) var(--transition-bounce) var(--at, 0ms) both;
}
@keyframes way-point {
  0%   { opacity: 0; translate: calc(var(--way-dir) * -1 * var(--spacing-md)) 0; }
  60%  { opacity: 1; translate: calc(var(--way-dir) * var(--spacing-xs)) 0; }
  100% { opacity: 1; translate: 0 0; }
}

/* Each mark's colour as a variable too, for the reveal below. */
.tile.is-hit  { --mark-bg: var(--color-feedback-hit); }
.tile.is-near { --mark-bg: var(--color-feedback-near); }
.tile.is-other { --mark-bg: var(--color-feedback-other); }
.tile.is-miss { --mark-bg: var(--color-feedback-miss); }

/* ── Board ─────────────────────────────────────────────────────────── */

/* At Normal and Hard, fitBoard() in js/play/screen.js sizes the board:
   data-cell and data-frame pick layout tokens (the largest that fit). */
.board {
  position: relative;   /* the win effect plays over it (.fx-board) */
  --board-cell: var(--layout-cell);
  --board-font: var(--font-size-lg);
  --board-kanji: var(--font-size-2xl);
  --board-frame: var(--layout-frame);
  --frame-1: var(--font-size-lg);
  --frame-2: var(--font-size-md);
  --frame-3: var(--font-size-xs);
  --frame-4: var(--font-size-xs);
  --frame-cover: var(--font-size-3xl);
  --frame-inner: var(--font-size-xs);
  --frame-inset: var(--spacing-md);
  --frame-solved: var(--font-size-2xl);
}

/* The result card's answer row takes the board's cell size too
   (js/play/screen.js sizeResult()). */
.game-result {
  --board-cell: var(--layout-cell);
  --board-font: var(--font-size-lg);
}

:is(.board, .game-result)[data-cell="xs"] {
  --board-cell: var(--layout-cellXs);
  --board-font: var(--font-size-md);
  --board-kanji: var(--font-size-lg);
}

:is(.board, .game-result)[data-cell="sm"] {
  --board-cell: var(--layout-cellSm);
  --board-kanji: var(--font-size-xl);
}

:is(.board, .game-result)[data-cell="md"] {
  --board-cell: var(--layout-cellMd);
  --board-font: var(--font-size-xl);
}

:is(.board, .game-result)[data-cell="lg"] {
  --board-cell: var(--layout-cellLg);
  --board-font: var(--font-size-2xl);
  --board-kanji: var(--font-size-3xl);
}

/* With a mouse and the room (fitBoard()'s DESKTOP_SIZES). */
:is(.board, .game-result)[data-cell="2xl"] {
  --board-cell: var(--layout-cell2xl);
  --board-font: var(--font-size-3xl);
  --board-kanji: var(--font-size-3xl);
}

:is(.board, .game-result)[data-cell="xl"] {
  --board-cell: var(--layout-cellXl);
  --board-font: var(--font-size-2xl);
  --board-kanji: var(--font-size-3xl);
}

.board[data-frame="sm"] {
  --board-frame: var(--layout-frameSm);
  --frame-1: var(--font-size-md);
  --frame-2: var(--font-size-xs);
  --frame-cover: var(--font-size-2xl);
  --frame-inset: var(--spacing-sm);
}


.board-grid,
.board-rows {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.board-rows:empty { display: none; }

.board-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-height: var(--layout-cell);
}

.row-kanji {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--layout-cell);
  height: var(--layout-cell);
  font-size: var(--font-size-2xl);
  line-height: var(--font-lineHeight-tight);
}

.row-tiles {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.row-gap { width: var(--spacing-sm); }

/* Parts levels with places: a gap where the place changes, and the
   places above the board, one label over each run of cells. */
.cell-gap { width: var(--spacing-xs); }

.board-shape:empty { display: none; }
.board-shape .board-row { min-height: 0; }
.board-shape .row-kanji { height: auto; }

.shape-place {
  width: calc(var(--board-cell) * var(--n, 1) + var(--spacing-xs) * (var(--n, 1) - 1));
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  color: var(--color-text-muted);
  text-align: center;
  white-space: nowrap;
}

/* The place of the selected cell: the keys that stay bright are for it. */
.shape-place.is-active {
  color: var(--color-text-accent);
  font-weight: var(--font-weight-bold);
}

/* Parts levels: the rows, centred, like Wordle's grid. Every row is as
   wide as the others, so the cells line up under the frames and places. */
.board.is-parts {
  display: flex;
  justify-content: center;
}

.board.is-parts .board-grid { align-items: flex-start; }
.board.is-parts .board-row { min-height: var(--board-cell); }

/* Grouped by kanji (Guided, or once Layout is used): each kanji's cells
   stay close together, with a wide gap between kanji (fitBoard() counts
   spacing.lg). Rows too wide for the screen wrap between kanji
   (data-wrap), all alike. */
.board.is-parts .row-tiles {
  flex-wrap: nowrap;
  gap: var(--spacing-xs) var(--spacing-lg);
}

.board[data-wrap] .row-tiles { flex-wrap: wrap; }
.board[data-wrap] .board-rows { gap: var(--spacing-md); }
.row-slot,
.shape-place { flex: 0 0 auto; }

.row-slot {
  display: flex;
  gap: var(--spacing-xs);
}

.board.is-parts .tile.is-cell {
  width: var(--board-cell);
  height: var(--board-cell);
  font-size: var(--board-font);
}

.board.is-parts .board-shape .board-row {
  min-height: 0;
  height: var(--spacing-lg);
  align-items: flex-end;
}

.row-meaning {
  flex: 1 1 var(--spacing-3xl);
  min-width: 0;
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The next guess, not scored yet. */
.tile.is-pending { border-style: dashed; }

/* A guess that can't be made (js/play/screen.js sayRow()): the row being
   entered shakes, its cells edged red, and why shows under it, over the
   row below, so nothing moves (2026-11-11, the user asked). */
.board-row.is-next { position: relative; }

.board-row.is-error .tile.is-pending {
  border-style: solid;
  border-color: var(--color-status-danger);
}

.board-row.is-error .tile.is-pending.is-active {
  box-shadow: 0 0 0 var(--stroke-thick) var(--color-status-danger);
}

.board-row.is-shake .row-tiles {
  animation: row-shake var(--transition-slow) var(--transition-ease);
}

@keyframes row-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(calc(var(--spacing-sm) * -1)); }
  40%, 80% { transform: translateX(var(--spacing-sm)); }
}

.row-error {
  position: absolute;
  top: calc(100% + var(--spacing-xs));
  left: 50%;
  z-index: 3;
  width: max-content;
  max-width: calc(100vw - var(--spacing-md) * 2);
  padding: var(--spacing-xs) var(--spacing-sm);
  border: var(--stroke-thin) solid var(--color-border-default);
  border-left: var(--stroke-thick) solid var(--color-status-danger);
  border-radius: var(--radius-sm);
  background: var(--color-bg-raised);
  box-shadow: var(--shadow-md);
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  color: var(--color-text-primary);
  translate: -50% 0;
  pointer-events: none;
  animation: toast-in var(--transition-base) var(--transition-ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .board-row.is-shake .row-tiles,
  .row-error { animation: none; }
}

/* An empty cell where a hint showed a part: the part faintly, as a
   reminder; tapping the selected cell puts it in. */
.tile.is-ghost { border-color: var(--color-feedback-hit); }

.cell-ghost {
  display: inline-flex;
  color: var(--color-text-muted);
}

/* Parts levels: the next row's cells are buttons; the selected one takes
   the next part tapped. Rows not reached yet are faint. */
.tile.is-filled {
  border-style: solid;
  border-color: var(--color-border-strong);
}
@media (hover: hover) {
  .board-row.is-next button.tile:hover { background: var(--color-interactive-selected); }
}
.board-row.is-next button.tile {
  transition:
    background-color var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

/* A part just put in its cell pops (js/play/screen.js addPart()). */
.tile.is-typed { animation: cell-pop var(--transition-press) var(--transition-ease); }
@keyframes cell-pop { 50% { transform: scale(var(--scale-pop)); } }
.tile.is-active {
  border-style: solid;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 var(--stroke-thick) var(--color-border-focus);
}
.tile.is-blank {
  background: transparent;
  border-color: var(--color-border-subtle);
}
/* Hard: the kanji a row's parts make, hanging off its right edge. The
   board centres the rows with that room beside them, so they sit a little
   left of centre and the cells can be bigger (fitBoard). */
.board.has-made .board-grid { padding-right: calc(var(--spacing-sm) + var(--spacing-2xl)); }
.board.has-made .board-row { position: relative; }

.row-made {
  position: absolute;
  top: 50%;
  left: 100%;
  width: var(--spacing-2xl);
  margin-left: var(--spacing-sm);
  transform: translateY(-50%);
  font-size: var(--font-size-md);
  line-height: var(--font-lineHeight-tight);
  color: var(--color-text-secondary);
}

/* The kanji guide above the rows (renderFrame() in js/play/screen.js),
   drawn by js/play/frame.js: a frame per kanji with everything known about
   it. The same frame shows on a hint's card and in history, sized by its
   host (--board-frame and the --frame-* font sizes). Guided lays the frames
   out like a row, so each centres over its kanji's cells: the answer's
   shape, filled in with the parts found green. Top and bottom span it;
   left, inner and right share the middle; an outer part covers it all,
   with the inner inset. Otherwise (.is-centred) they sit in a centred row.
   Stroke count is a line under each frame. */
.board-frames:empty,
.board.is-parts .board-frames:empty { display: none; }

.board.is-parts .board-frames { display: flex; }

/* Room between the guide and the rows, more where the screen is wider
   (fitBoard() reads it, so the cells still fit). */
.board-frames { margin-bottom: var(--spacing-sm); }

@media (min-width: 420px) {
  .board-frames { margin-bottom: var(--spacing-md); }
}

.board-frames.is-centred {
  align-self: stretch;
  justify-content: center;
}

.frame-row {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
}

.frame-row .frame-slot { width: auto; }

/* A frame opens the kanji card (js/play/reveal.js). */
button.frame-slot { cursor: pointer; }

/* A frame opens the kanji card, so with a mouse it lifts under the pointer,
   like the cards elsewhere; the keyboard's focus rings the frame itself
   (2026-11-11). */
@media (hover: hover) {
  button.frame-slot .kanji-frame {
    transition:
      border-color var(--transition-hover) var(--transition-ease),
      box-shadow var(--transition-hover) var(--transition-ease),
      transform var(--transition-hover) var(--transition-ease);
  }
  button.frame-slot:hover .kanji-frame {
    box-shadow: var(--shadow-sm);
    transform: translateY(calc(var(--stroke-thick) * -1));
  }
  button.frame-slot:hover .kanji-frame:not(.is-solved) { border-color: var(--color-border-strong); }
}

button.frame-slot:focus-visible { outline: none; }
button.frame-slot:focus-visible .kanji-frame {
  outline: var(--stroke-thick) solid var(--color-border-focus);
  outline-offset: var(--stroke-thick);
}

.frame-slot {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  width: calc(var(--board-cell) * var(--n, 1) + var(--spacing-xs) * (var(--n, 1) - 1) + var(--spacing-sm) * var(--g, 0));
}

/* A kanji's stroke count, under its frame: one line, the height fitBoard()
   counts. Plain text, never a badge (a red dot reads as a notification). */
.frame-strokes {
  height: var(--spacing-md);
  font-size: var(--font-size-xs);
  line-height: var(--spacing-md);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.frame-strokes-n {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
}

.kanji-frame {
  display: grid;
  gap: var(--spacing-xs);
  width: var(--board-frame);
  height: var(--board-frame);
  padding: var(--spacing-xs);
  border: var(--stroke-thick) solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
}

/* A place: a dashed box, strong enough to read (3:1) since on Layout's
   frames the places are the whole clue. Its parts wrap into another line
   when they don't fit, so a crowded place stays a neat cluster. */
.frame-zone {
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  border: var(--stroke-thin) dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-family-kanji);
  font-size: var(--frame-1);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-tight);
  color: var(--color-feedback-hit);
}

.frame-zone.is-top,
.frame-zone.is-bottom { flex-direction: row; }
.frame-zone[data-n="2"] { font-size: var(--frame-2); }
.frame-zone[data-n="3"] { font-size: var(--frame-3); }
.frame-zone[data-n="4"] { font-size: var(--frame-4); }

/* A place holding the kanji's only part covers the frame; an outer one's
   inner sits inset in it, a box in a box. */
.frame-zone.is-cover {
  z-index: 0;
  grid-area: 1 / 1 / -1 / -1;
  font-size: var(--frame-cover);
}

.kanji-frame.has-outer .frame-zone.is-inner {
  margin: var(--frame-inset);
  font-size: var(--frame-inner);
}

/* Holding two or more, the inner box takes more of the frame, so its
   parts fit (2026-11-11, the user saw its dots squashed). */
.kanji-frame.has-outer .frame-zone.is-inner:not([data-n="1"]) {
  margin: calc(var(--frame-inset) / 2);
}

.frame-part {
  flex: none;
  display: inline-flex;
}

/* A part still hidden: the room its glyph would take (the place's font
   size, which shrinks as the place fills), with a round dot in the middle.
   Never squeezed, so a dot stays round (2026-11-11, the user saw them
   squashed into dashes and bars). */
.frame-part.is-hidden {
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
}

.frame-part.is-hidden::before {
  content: '';
  width: var(--spacing-sm);
  height: var(--spacing-sm);
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
}

/* History's frames are the smallest: in a crowded place (3 parts or
   more), the dots and their room are half the size, so they stay in it. */
.history-board .frame-zone:is([data-n="3"], [data-n="4"]) .frame-part.is-hidden {
  width: var(--spacing-sm);
  height: var(--spacing-sm);
}

.history-board .frame-zone:is([data-n="3"], [data-n="4"]) .frame-part.is-hidden::before {
  width: var(--spacing-xs);
  height: var(--spacing-xs);
}

.kanji-frame.is-solved {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: transparent;
  background: var(--color-feedback-hit);
  color: var(--color-feedback-text);
  font-size: var(--frame-solved);
  line-height: var(--font-lineHeight-tight);
}

/* Nothing known about the kanji yet (another one is): an empty frame. */
.kanji-frame.is-plain { border-style: dashed; }

/* Normal and Hard (quiet, js/play/frame.js): the parts found, each where it
   sits in the kanji; the rest keep their room unseen, and the places show
   only once Layout has told them. */
.kanji-frame.is-bare .frame-zone { border-color: transparent; }
.frame-part.is-blank { visibility: hidden; }

/* Layout's card: the places come in one after another. */
.kanji-frame.is-building .frame-zone {
  animation: zone-in var(--transition-slow) var(--transition-bounce) var(--at, 0ms) both;
}

.frame-part.is-new,
.kanji-frame.is-new {
  animation: kanji-in var(--transition-base) var(--transition-bounce) both;
}

/* Parts levels: the parts as a keyboard pinned to the bottom, as in
   Wordle. Keys stretch to fill each row; Delete and Guess close the last
   one. fitBoard() in js/play/screen.js sets the columns (--key-cols, and
   the span of Guess) and the keys' height (data-keys). */
.picker.is-keyboard {
  --key-height: var(--layout-key);
  position: sticky;
  bottom: 0;
  z-index: 2;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) 0 var(--spacing-md);
  background: var(--color-bg-page);
}

.picker.is-keyboard .picker-choices { gap: var(--spacing-xs); }

/* Under the keys, End game (js/play/screen.js renderPicker()): a quiet
   button, muted, as it's rarely wanted. The keyboard's foot is a little
   shorter to make room. On a phone it's a full touch target; with a mouse
   it sits well apart from the keys (2026-11-11, the user asked). The room
   above it (the keyboard's gap, spacing.sm, and the foot's top) matches
   the room below it (the foot's bottom, clear of a phone's home bar), so
   it sits in the middle (the user asked, the same day). */
.picker.is-keyboard { padding-bottom: 0; }

.picker-foot {
  display: flex;
  justify-content: center;
  padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom, 0px));
}

.picker-end {
  gap: var(--spacing-xs);
  min-height: var(--layout-headBtn);
  padding: var(--spacing-sm) var(--spacing-lg);
  color: var(--color-text-muted);
}

@media (hover: hover) and (pointer: fine) {
  .picker-foot {
    padding-top: var(--spacing-md);
    padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom, 0px));
  }
}

.picker-end svg {
  width: var(--spacing-md);
  height: var(--spacing-md);
}

/* The game is over: the keyboard fades where it is before the result card
   takes its place (showResult() in js/play/screen.js), so nothing jumps. */
.picker.is-keyboard.is-leaving {
  opacity: var(--opacity-hidden);
  transition: opacity var(--transition-base) var(--transition-ease);
}

/* With the keyboard up, a message and the open power bar float just above
   it, over the bottom of the board (.picker-float), so they never move the
   board or make the page scroll. The message goes after a moment (say() in
   js/play/screen.js). The coloured bar on the message's left comes from
   .status-line. */
.picker-float {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-xs);
  pointer-events: none;
}

.picker-float > * { pointer-events: auto; }

.picker.is-keyboard .status-line {
  width: max-content;
  max-width: 100%;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-top: var(--stroke-thin) solid var(--color-border-default);
  border-right: var(--stroke-thin) solid var(--color-border-default);
  border-bottom: var(--stroke-thin) solid var(--color-border-default);
  border-radius: var(--radius-sm);
  background: var(--color-bg-raised);
  box-shadow: var(--shadow-md);
  color: var(--color-text-primary);
}

.picker.is-keyboard[data-keys="sm"] { --key-height: var(--layout-keySm); }
/* With a mouse and the room; the glyphs keep their size, so a key's letter
   has its own room under its part. */
.picker.is-keyboard[data-keys="lg"] { --key-height: var(--layout-keyLg); }

/* Typing (js/play/keys.js): with a mouse, each key shows the letter that
   types it in its bottom-left corner, the one corner free (the other form
   has the top right, debug mode's dots the top left, and a part not in the
   answer is crossed from top left to bottom right); Guess names Enter. The
   letter sits on a chip of the page's surface, so it keeps its contrast
   (4.5:1) on a green, yellow or grey key too. */
.key-letter,
.key-hint { display: none; }

@media (hover: hover) and (pointer: fine) {
  .key-letter {
    position: absolute;
    left: var(--stroke-thick);
    bottom: var(--stroke-thick);
    display: block;
    padding: 0 var(--stroke-thick);
    border-radius: var(--radius-sm);
    background: var(--color-bg-raised);
    font-family: var(--font-family-ui);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    line-height: var(--font-lineHeight-tight);
    color: var(--color-text-muted);
    pointer-events: none;
  }
  /* On Guess only where it's four keys wide (fitKeys(), .is-wide). */
  .key-hint,
  [data-id="guess"]:not(.is-wide) .key-hint { display: none; }
  .result-actions .key-hint,
  [data-id="guess"].is-wide .key-hint {
    display: inline-block;
    margin-left: var(--spacing-sm);
    padding: 0 var(--spacing-xs);
    border: var(--stroke-thin) solid currentColor;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    line-height: var(--font-lineHeight-normal);
  }
}

.picker.is-keyboard .palette {
  display: grid;
  grid-template-columns: repeat(var(--key-cols, auto-fill), minmax(var(--layout-keySm), 1fr));
  gap: var(--spacing-xs);
}

.picker.is-keyboard .palette-tile {
  width: auto;
  height: var(--key-height);
}

.picker.is-keyboard[data-keys="sm"] .palette-tile { font-size: var(--font-size-md); }

/* Delete and Guess, keys like the rest. */
.picker.is-keyboard .palette .btn {
  min-height: 0;
  height: var(--key-height);
  padding: 0 var(--spacing-sm);
  border-radius: var(--radius-md);
}

.key-delete svg {
  width: var(--spacing-lg);
  height: var(--spacing-lg);
}

/* A game fills the screen like Wordle: while the keyboard is up the page's
   bottom padding steps aside, which fitBoard() in js/play/screen.js doesn't
   leave room for. The result card gets it back. (A game has no footer: the
   back-to-apps mark is on the play page only.) The site header keeps the
   spacing it has on every other page (2026-11-10, the user asked; it was
   slimmer in a game). */
body.is-game:has(.picker.is-keyboard) .app-main { padding-bottom: 0; }

/* With the keyboard up the game fills the screen under the header (the
   body is the screen's height, a flex column), so the keyboard sits at the
   bottom even when the cells are as big as the width allows, and the board
   takes the middle of what's left. */
body.is-game:has(.picker.is-keyboard) .game { flex: 1 0 auto; }

body.is-game:has(.picker.is-keyboard) .board.is-parts {
  flex: 1 0 auto;
  align-items: center;
}

/* A game just over: the board keeps the height it had with the keyboard up
   and the rows centred in it, so they stay put as the result card takes
   the keyboard's place (fitBoard() and showResult() in js/play/screen.js;
   --held-h is that height). */
.board.is-parts.is-held {
  min-height: var(--held-h);
  align-items: center;
}

/* Tile reveal (settings.tiles, js/config/skins.js). The same rules play a
   new row on the board (.board-row.is-new), the Points page's preview
   (.look-preview.is-new) and each look's example (.reveal-stage.is-playing).
   The play page's How to play (.demo-row.is-new) and the answer's row on
   the result card (.result-solution.is-new) play it too.
   [data-tiles] on the board, the preview or the example picks the reveal:
   its keyframes (--reveal), how long one tile takes (--reveal-time, which
   js/play/screen.js reads to know when a row is done) and its easing.
   Each tile waits its turn (--i, set in js/play/screen.js and js/points.js),
   after --reveal-wait, if the row has one.
   Every reveal goes from the tile's own colours to its mark's (--mark-bg). */
[data-tiles] {
  --reveal: tile-flip;
  --reveal-time: var(--transition-reveal);
  --reveal-ease: var(--transition-ease);
  --reveal-stagger: var(--transition-base);
}
/* How to play's little board reveals at twice the pace (js/howto.js reads
   both times to know when a row is done). */
.demo[data-tiles] { --reveal-stagger: var(--transition-fast); }
[data-tiles="fade"]  { --reveal: tile-fade; }
[data-tiles="turn"]  { --reveal: tile-turn; }
[data-tiles="drop"]  { --reveal: tile-drop; --reveal-ease: var(--transition-bounce); }
[data-tiles="ink"]   { --reveal: tile-ink; --reveal-time: var(--transition-long); }
[data-tiles="wipe"]  { --reveal: tile-wipe; --reveal-ease: var(--transition-ink); }
[data-tiles="shoji"] { --reveal: tile-shoji; --reveal-time: var(--transition-long); }
[data-tiles="stamp"] { --reveal: tile-stamp; --reveal-ease: var(--transition-bounce); }

:is(.board-row.is-new, .demo-row.is-new, .look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing) .tile {
  position: relative;
  isolation: isolate;
  animation: var(--reveal) var(--reveal-time) var(--reveal-ease) both;
  animation-delay: calc(var(--reveal-wait, 0s) + var(--i, 0) * var(--reveal-stagger));
}

.board-row.is-new .row-kanji {
  animation: kanji-in var(--transition-base) var(--transition-bounce) both;
}

/* The pending look, then the mark's: every reveal's start and end. */
@keyframes tile-flip {
  0% {
    transform: rotateX(0deg);
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
    color: var(--color-tile-text);
  }
  50% {
    transform: rotateX(90deg);
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
    color: var(--color-tile-text);
  }
  51% {
    transform: rotateX(90deg);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
  100% {
    transform: rotateX(0deg);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

/* Fade: the colour comes up through the tile, with a soft swell. */
@keyframes tile-fade {
  0% {
    transform: scale(1);
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
    color: var(--color-tile-text);
  }
  50% { transform: scale(0.94); }
  100% {
    transform: scale(1);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

/* Turn: like Flip, but sideways, as a card turns over. */
@keyframes tile-turn {
  0% {
    transform: rotateY(0deg);
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
    color: var(--color-tile-text);
  }
  50% {
    transform: rotateY(90deg);
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
    color: var(--color-tile-text);
  }
  51% {
    transform: rotateY(-90deg);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
  100% {
    transform: rotateY(0deg);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

/* Drop: each tile falls into its cell in its colour and settles. */
@keyframes tile-drop {
  0% {
    transform: translateY(calc(var(--spacing-lg) * -1));
    opacity: var(--opacity-hidden);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
  40% { opacity: var(--opacity-full); }
  100% {
    transform: translateY(0);
    opacity: var(--opacity-full);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

/* Ink bleed: a drop lands in the middle and the colour spreads out from it
   (the ::before below), slow then quick, like ink in paper. */
@keyframes tile-ink {
  0%, 30% {
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
    color: var(--color-tile-text);
  }
  45%, 99% {
    background-color: var(--color-tile-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
  100% {
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

@keyframes ink-spread {
  0%   { clip-path: circle(0% at 50% 60%); }
  30%  { clip-path: circle(12% at 50% 60%); }
  100% { clip-path: circle(80% at 50% 60%); }
}

/* Brush wipe: the colour is painted across from the left (the ::before). */
@keyframes tile-wipe {
  0%, 99% {
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
  }
  0%, 45% { color: var(--color-tile-text); }
  55% { color: var(--color-feedback-text); }
  100% {
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

@keyframes wipe-across {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* Shoji: two paper panels slide apart to show the colour behind. */
@keyframes tile-shoji {
  0%, 99% {
    background-color: var(--mark-bg);
    border-color: var(--color-tile-border);
  }
  0%, 30% { color: var(--color-tile-text); }
  45% { color: var(--color-feedback-text); }
  100% {
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

@keyframes shoji-left {
  0%, 15% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

@keyframes shoji-right {
  0%, 15% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* Hanko stamp: pressed down hard, like a seal. */
@keyframes tile-stamp {
  0% {
    transform: scale(1.5) rotate(-8deg);
    opacity: var(--opacity-hidden);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
  60% { transform: scale(0.9) rotate(0deg); opacity: var(--opacity-full); }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: var(--opacity-full);
    background-color: var(--mark-bg);
    border-color: transparent;
    color: var(--color-feedback-text);
  }
}

/* The layers some reveals draw under the glyph: ink's spreading colour,
   the brush's painted stroke, and the shoji's two panels. */
:is([data-tiles="ink"] :is(.board-row, .demo-row).is-new, [data-tiles="ink"]:is(.look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing)) .tile::before,
:is([data-tiles="wipe"] :is(.board-row, .demo-row).is-new, [data-tiles="wipe"]:is(.look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing)) .tile::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--mark-bg);
  animation: ink-spread var(--reveal-time) var(--transition-ink) both;
  animation-delay: calc(var(--reveal-wait, 0s) + var(--i, 0) * var(--reveal-stagger));
}

:is([data-tiles="wipe"] :is(.board-row, .demo-row).is-new, [data-tiles="wipe"]:is(.look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing)) .tile::before {
  animation-name: wipe-across;
}

:is([data-tiles="shoji"] :is(.board-row, .demo-row).is-new, [data-tiles="shoji"]:is(.look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing)) .tile { overflow: hidden; }

:is([data-tiles="shoji"] :is(.board-row, .demo-row).is-new, [data-tiles="shoji"]:is(.look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing)) .tile::before,
:is([data-tiles="shoji"] :is(.board-row, .demo-row).is-new, [data-tiles="shoji"]:is(.look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing)) .tile::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 50%;
  z-index: -1;
  background: var(--color-tile-bg);
  box-shadow: inset calc(var(--stroke-thin) * -1) 0 0 var(--color-tile-border);
  animation: shoji-left var(--reveal-time) var(--transition-ease) both;
  animation-delay: calc(var(--reveal-wait, 0s) + var(--i, 0) * var(--reveal-stagger));
}

:is([data-tiles="shoji"] :is(.board-row, .demo-row).is-new, [data-tiles="shoji"]:is(.look-preview.is-new, .result-solution.is-new, .reveal-stage.is-playing)) .tile::after {
  left: 50%;
  box-shadow: inset var(--stroke-thin) 0 0 var(--color-tile-border);
  animation-name: shoji-right;
}

@keyframes kanji-in {
  0% { transform: scale(0.8); opacity: var(--opacity-hidden); }
  100% { transform: scale(1); opacity: var(--opacity-full); }
}

/* ── Hints ─────────────────────────────────────────────────────────── */

.game-hints {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.game-hints:empty { display: none; }

/* What the hints found, above the keyboard (js/play/hints.js renderClues),
   on one line where it fits, since fitBoard() in js/play/screen.js makes
   room for it: every line costs the cells. A box per kanji (its places and
   stroke count, like the cards that showed them), then the meaning taking
   the rest of the line. */
.clues {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--spacing-xs);
}

.clue-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 0;
  min-height: var(--spacing-xl);
  padding: var(--stroke-thick) var(--spacing-sm);
  border: var(--stroke-thin) solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  line-height: var(--font-lineHeight-snug);
}

/* Tapping a clue opens its card again. */
button.clue-chip {
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

@media (hover: hover) {
  button.clue-chip:hover { border-color: var(--color-border-strong); }
}

.clue-chip.is-meaning { flex: 1 1 0; }
.clue-chip.is-soon { font-size: var(--font-size-xs); color: var(--color-text-muted); }

.clue-chip-icon { display: flex; flex: 0 0 auto; }

.clue-chip-body {
  min-width: 0;
  font-weight: var(--font-weight-bold);
}

.clue-tag {
  margin-left: var(--spacing-xs);
  padding: 0 var(--spacing-xs);
  border-radius: var(--radius-full);
  background: var(--color-interactive-selected);
  color: var(--color-text-accent);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
}

.clue-chip .reading-group:last-child { margin-right: 0; }

.part-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.part-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
}

.part-pos {
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-tight);
  color: var(--color-text-muted);
}

.reading-group {
  display: inline-flex;
  align-items: baseline;
  gap: var(--spacing-xs);
  margin-right: var(--spacing-md);
}

.reading-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
}

.okurigana { color: var(--color-text-muted); }

.power-sheet-head {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* ── Hints modal (js/play/hints.js) and the Points page's hint rows ── */

.hints-head .sheet-title { flex: 1; }

.hints-points {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.hint-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Hint icons (js/play/hint-art.js), in the look picked in Points › Looks:
   the hint's emoji; Illustrated, its drawing in the game's own colours;
   Seal, in white on a square in the skin's accent; or Badge, in white on a
   circle in the hint's own colour (tokens.js hint.badge). 32px in rows,
   chips and card titles (the user's smallest, 2026-11-11), 48px in
   confirms. */
.hint-art {
  --art-size: var(--spacing-xl);
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--art-size);
  height: var(--art-size);
  font-size: var(--font-size-xl);
  line-height: var(--font-lineHeight-tight);
  vertical-align: middle;
}
.hint-art.is-lg { --art-size: var(--spacing-2xl); font-size: var(--font-size-3xl); }
.hint-art svg { display: block; width: 100%; height: 100%; overflow: visible; }

.hint-art.is-illustrated { --art-ink: var(--color-text-primary); }
.hint-art.is-seal { --plate: var(--color-action-primary-bg); --art-ink: var(--color-action-primary-text); }
.hint-art.is-badge { --plate: var(--badge); --art-ink: var(--color-hint-glint); }
.hint-art .plate { fill: var(--plate); }
.hint-art .rim,
.hint-art .line,
.hint-art .soft { stroke: var(--art-ink); }
.hint-art .fill,
.hint-art .t-ink { fill: var(--art-ink); }
.hint-art .cut { stroke: var(--plate); }
.hint-art .kan { font-family: var(--font-family-kanji); font-weight: var(--font-weight-black); }
.hint-art .num { font-family: var(--font-family-ui); font-weight: var(--font-weight-bold); }

/* Illustrated's colours: the tiles', the bulb's gold and the accent. Text
   on a tile is the tiles' text colour; on gold, the accent, which reads in
   both schemes. */
.hint-art .accent { stroke: var(--color-text-accent); }
.hint-art .on { stroke: var(--color-feedback-text); }
.hint-art .f-paper { fill: var(--color-tile-bg); }
.hint-art .f-gold { fill: var(--color-hint-bulb); }
.hint-art .f-hit { fill: var(--color-feedback-hit); }
.hint-art .f-near { fill: var(--color-feedback-near); }
.hint-art .f-accent { fill: var(--color-action-primary-bg); }
.hint-art .f-spark { fill: var(--color-text-accent); }
.hint-art .t-on { fill: var(--color-feedback-text); }
.hint-art .t-gold { fill: var(--color-action-primary-bg); }

/* One hint per row: its icon, name, how many you hold and the button on
   the first line; what it does, and why not or what just happened, under
   them across the row. */
.hint-row {
  display: grid;
  grid-template-columns: var(--spacing-xl) minmax(0, 1fr) auto auto;
  grid-template-areas:
    "icon name held action"
    ".    desc desc desc"
    ".    line line line";
  align-items: center;
  column-gap: var(--spacing-sm);
  row-gap: var(--spacing-xs);
  padding: var(--spacing-md) 0;
  border-top: var(--stroke-thin) solid var(--color-border-subtle);
}

.hint-row:first-child { border-top: 0; padding-top: 0; }
.hint-row:last-child { padding-bottom: 0; }

.hint-icon {
  grid-area: icon;
  display: flex;
}

.hint-row.is-off .hint-icon { opacity: var(--opacity-disabled); filter: grayscale(1); }

.hint-name {
  grid-area: name;
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

.hint-held {
  grid-area: held;
  min-width: var(--spacing-xl);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.hint-held.is-held { color: var(--color-text-accent); }

.hint-row > .btn {
  grid-area: action;
  white-space: nowrap;
}

.hint-desc {
  grid-area: desc;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.hint-why,
.hint-note {
  grid-area: line;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.hint-note { color: var(--color-text-accent); }

/* Use's and Buy's confirm, in the same modal. */
.hint-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  text-align: center;
}

.hint-confirm + .btn-row { justify-content: center; }

.hint-confirm-icon { display: flex; }

.hint-confirm-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-height: var(--spacing-xl);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.check-row input {
  width: var(--spacing-md);
  height: var(--spacing-md);
  margin: 0;
  accent-color: var(--color-action-primary-bg);
}

/* ── A hint used (js/play/reveal.js) ───────────────────────────────── */

/* A card over the board for a hint that tells you something: it comes in,
   plays, and stays until Done at its foot (or a tap beside it). */
.board { position: relative; }

.hint-show {
  position: absolute;
  z-index: 3;   /* over the guide's frames, whose places stack inside them */
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg-overlay);
  cursor: pointer;
  animation: hint-fade var(--transition-base) var(--transition-ease) both;
}

.hint-show.is-leaving { animation: hint-fade-out var(--transition-base) var(--transition-ease) both; }

.hint-show-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  max-width: 100%;
  min-width: var(--layout-powerMin);
  padding: var(--spacing-lg);
  border: var(--stroke-thin) solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  background: var(--color-bg-raised);
  box-shadow: var(--shadow-lg);
  cursor: default;
  animation: hint-card-in var(--transition-slow) var(--transition-bounce) both;
}

/* The title on top, Done the width of the card at its foot. */
.hint-show-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.hint-show-icon { display: flex; letter-spacing: normal; }
.hint-show-icon:not(:first-child) { margin-left: var(--spacing-sm); }

.hint-show-done { align-self: stretch; }

/* The kanji guide's frames (js/play/frame.js), bigger: 96 px for one or
   two kanji; three or four take 64 px, so they fit a phone, and four sit
   two by two. With a mouse and the room, the guide over the rows takes the
   same size (fitBoard()'s DESKTOP_SIZES; 2026-11-11), so after a hint's
   card the guide matches it: its frames as far apart as the rows' kanji,
   and its strokes line a step up. */
.reveal-items,
.board[data-frame="lg"] {
  --board-frame: var(--layout-frameLg);
  --frame-1: var(--font-size-2xl);
  --frame-2: var(--font-size-xl);
  --frame-3: var(--font-size-md);
  --frame-4: var(--font-size-xs);
  --frame-cover: var(--font-size-3xl);
  --frame-inner: var(--font-size-md);
  --frame-inset: var(--spacing-lg);
  --frame-solved: var(--font-size-3xl);
}

.board[data-frame="lg"] .frame-row { gap: var(--spacing-lg); }

.board[data-frame="lg"] .frame-strokes {
  height: var(--spacing-lg);
  font-size: var(--font-size-md);
  line-height: var(--spacing-lg);
}

/* Their dots a size up, but never more than half the room a crowded
   place gives each part. */
:is(.reveal-items, .board[data-frame="lg"]) .frame-part.is-hidden::before {
  width: max(var(--spacing-sm), min(var(--layout-dotLg), 0.5em));
  height: max(var(--spacing-sm), min(var(--layout-dotLg), 0.5em));
}

.reveal-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-lg);
}

.reveal-items[data-count="3"],
.reveal-items[data-count="4"] {
  --board-frame: var(--layout-frame);
  --frame-1: var(--font-size-lg);
  --frame-2: var(--font-size-md);
  --frame-3: var(--font-size-xs);
  --frame-cover: var(--font-size-2xl);
  --frame-inner: var(--font-size-xs);
  --frame-inset: var(--spacing-md);
  --frame-solved: var(--font-size-2xl);
  gap: var(--spacing-md);
}

.reveal-items[data-count="4"] {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: center;
  gap: var(--spacing-md) var(--spacing-xl);
}

.reveal-items[data-count="3"] .tally,
.reveal-items[data-count="4"] .tally { max-width: var(--layout-frame); }

.reveal-items .kanji-frame {
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
}

.reveal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}

.reveal-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* The stroke count, as under the board's frames, a size up. */
.reveal-item .frame-strokes {
  height: auto;
  font-size: var(--font-size-md);
  line-height: var(--font-lineHeight-tight);
}

.reveal-item .frame-strokes-n {
  display: inline-block;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-black);
}

.reveal-items[data-count="3"] .frame-strokes,
.reveal-items[data-count="4"] .frame-strokes { font-size: var(--font-size-xs); }
.reveal-items[data-count="3"] .frame-strokes-n,
.reveal-items[data-count="4"] .frame-strokes-n { font-size: var(--font-size-lg); }

.frame-strokes-n.is-done {
  animation: points-pop var(--transition-reveal) var(--transition-bounce) both;
}

/* Stroke count: 正 tally marks, drawn stroke by stroke, the number
   counting up under them. */
.tally {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-xs);
  max-width: var(--layout-frameLg);
  min-height: var(--spacing-lg);
}

.tally-mark {
  width: var(--spacing-lg);
  height: var(--spacing-lg);
  fill: none;
  stroke: var(--color-text-secondary);
  stroke-width: var(--stroke-thick);
  stroke-linecap: round;
}

.tally-mark path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: stroke-draw var(--transition-fast) var(--transition-ink) var(--at, 0ms) forwards;
}

/* Meaning: written in from the left, like a brush. */
.reveal-meaning {
  max-width: calc(var(--layout-hintBox) * 4);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
  text-align: center;
  animation: meaning-wipe var(--transition-long) var(--transition-ink) both;
}

/* Hints that change the board: a part drops into its cell (its key
   flashes), a kanji's cells drop in one by one, a broom sweeps the
   keyboard (below), and an added row grows in. */
.tile.is-dropped {
  animation: cell-drop var(--transition-reveal) var(--transition-bounce) var(--at, 0ms) both;
}

.palette-tile.is-flash {
  animation: key-flash var(--transition-long) var(--transition-ease) both;
}

.picker.is-keyboard .palette { position: relative; }

/* Sweep (2026-11-10, made easier to see): a broom rides a band of the
   accent colour across the keyboard, at an even pace (--sweep-time, after
   --sweep-lead), so it reaches each key when js/play/reveal.js says (--at).
   Each key it clears lights up and shakes off its dust, then greys, and
   its cross-off line is drawn in. A message above the keyboard says how
   many went. */
.palette-tile.is-swept {
  animation: key-sweep var(--transition-reveal) var(--transition-ease) var(--at, 0ms) backwards;
}

.palette-tile.is-swept::after {
  animation: cross-draw var(--transition-slow) var(--transition-ease) calc(var(--at, 0ms) + var(--transition-base)) backwards;
}

.sweep-streak {
  position: absolute;
  z-index: 1;
  top: calc(var(--spacing-xs) * -1);
  bottom: calc(var(--spacing-xs) * -1);
  width: var(--layout-hintBox);
  pointer-events: none;
  animation: sweep-across var(--sweep-time, var(--transition-long)) var(--transition-linear) var(--sweep-lead, 0ms) both;
}

/* The band trails the broom, brightest where the broom is. */
.sweep-streak::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, transparent, var(--color-text-accent));
  opacity: var(--opacity-disabled);
}

.sweep-broom {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  translate: 50% -50%;
  animation: broom-brush var(--transition-slow) var(--transition-ease) infinite alternate;
}

.board-row.is-added {
  transform-origin: top;
  animation: row-grow var(--transition-reveal) var(--transition-bounce) both;
}

/* The clue a card just showed lights up above the keyboard. */
.clue-chip.is-glow {
  animation: clue-glow var(--transition-long) var(--transition-ease);
}

/* The kanji guide's frames, once Stroke count's or Layout's card has gone. */
.kanji-frame.is-glow {
  animation: frame-glow var(--transition-long) var(--transition-ease);
}

@keyframes hint-fade { from { opacity: var(--opacity-hidden); } to { opacity: var(--opacity-full); } }
@keyframes hint-fade-out { from { opacity: var(--opacity-full); } to { opacity: var(--opacity-hidden); } }

@keyframes hint-card-in {
  from { transform: scale(0.8); opacity: var(--opacity-hidden); }
  to   { transform: scale(1); opacity: var(--opacity-full); }
}

@keyframes stroke-draw { to { stroke-dashoffset: 0; } }

@keyframes zone-in {
  from { transform: scale(0.4); opacity: var(--opacity-hidden); }
  to   { transform: scale(1); opacity: var(--opacity-full); }
}

@keyframes meaning-wipe {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

@keyframes cell-drop {
  0%   { transform: translateY(calc(var(--spacing-md) * -1)) scale(1.3); opacity: var(--opacity-hidden); box-shadow: 0 0 0 var(--spacing-sm) var(--color-feedback-hit); }
  60%  { transform: translateY(0) scale(1); opacity: var(--opacity-full); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes key-flash {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.15); box-shadow: 0 0 0 var(--spacing-xs) var(--color-feedback-hit); }
}

@keyframes key-sweep {
  0% {
    background-color: var(--color-tile-bg);
    border-color: var(--color-tile-border);
    color: var(--color-tile-text);
    transform: none;
  }
  25% {
    background-color: var(--color-tile-bg);
    border-color: var(--color-border-focus);
    color: var(--color-tile-text);
    box-shadow: 0 0 0 var(--spacing-xs) var(--color-border-focus);
    transform: translateY(calc(var(--spacing-xs) * -1)) rotate(-10deg) scale(1.1);
  }
  50%  { transform: rotate(8deg); }
  75%  { transform: rotate(-4deg); }
  100% { transform: none; }
}

@keyframes cross-draw {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* The broom's right edge goes from the keyboard's left edge to its right. */
@keyframes sweep-across {
  0%   { left: calc(var(--layout-hintBox) * -1); opacity: var(--opacity-hidden); }
  10%  { opacity: var(--opacity-full); }
  85%  { opacity: var(--opacity-full); }
  100% { left: calc(100% - var(--layout-hintBox)); opacity: var(--opacity-hidden); }
}

@keyframes broom-brush {
  from { rotate: -25deg; }
  to   { rotate: 10deg; }
}

@keyframes row-grow {
  from { transform: scaleY(0); opacity: var(--opacity-hidden); }
  to   { transform: scaleY(1); opacity: var(--opacity-full); }
}

@keyframes frame-glow {
  0%   { box-shadow: 0 0 0 var(--spacing-xs) var(--color-border-focus); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 transparent; transform: scale(1); }
}

@keyframes clue-glow {
  0%   { background: var(--color-interactive-selected); border-color: var(--color-border-focus); transform: scale(1.06); }
  100% { background: var(--color-bg-surface); border-color: var(--color-border-subtle); transform: scale(1); }
}

/* Without motion: the card shows still, the board just changes. */
@media (prefers-reduced-motion: reduce) {
  .hint-show,
  .hint-show-card,
  .reveal-meaning,
  .kanji-frame.is-building .frame-zone,
  .frame-strokes-n.is-done { animation: none; }
  .tally-mark path { animation: none; stroke-dashoffset: 0; }
  .kanji-frame.is-glow,
  .clue-chip.is-glow { animation: none; }
  .palette-tile.is-swept,
  .palette-tile.is-swept::after,
  .sweep-streak { animation: none; }
}

.hint-show.is-still .tally-mark path { animation: none; stroke-dashoffset: 0; }

/* ── Picker ────────────────────────────────────────────────────────── */

.picker,
.picker-choices {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.picker:empty { display: none; }

/* The palette: the keys, fewest strokes first. */
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.palette-tile {
  position: relative;
  transition:
    border-color var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease),
    opacity var(--transition-hover) var(--transition-ease);
}

@media (hover: hover) {
  .palette-tile:hover:not(:disabled) { border-color: var(--color-border-strong); }
}

.palette-tile[aria-pressed="true"] {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 var(--stroke-thick) var(--color-border-focus);
  transform: translateY(calc(var(--stroke-thick) * -1));
}

.palette-tile.is-out { opacity: var(--opacity-faint); }

/* A key found not in the answer: a thin diagonal line across it, corner to
   corner, so it reads as crossed off at a glance. */
.palette-tile.is-miss::after {
  content: '';
  position: absolute;
  inset: var(--spacing-xs);
  pointer-events: none;
  background: linear-gradient(to top right,
    transparent calc(50% - var(--stroke-thin)),
    var(--color-feedback-text) calc(50% - var(--stroke-thin)),
    var(--color-feedback-text) calc(50% + var(--stroke-thin)),
    transparent calc(50% + var(--stroke-thin)));
  opacity: var(--opacity-soft);
}

/* A key's one other form (亻 on 人), tucked into its top-right corner so
   the key's own glyph stays centred and clear (js/engine/palette.js
   keyCorners()). */
.palette-variant {
  position: absolute;
  top: 0;
  right: var(--stroke-thin);
  display: inline-flex;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  line-height: var(--font-lineHeight-tight);
  opacity: var(--opacity-strong);
}

/* Debug mode (Settings): the cells of the answer a key's part fills,
   numbered in writing order, as dots on its top-left corner. */
.key-dots {
  position: absolute;
  top: calc(var(--spacing-xs) * -1);
  left: calc(var(--spacing-xs) * -1);
  z-index: 1;
  display: flex;
  gap: var(--stroke-thick);
  pointer-events: none;
}

.key-dot {
  min-width: var(--spacing-md);
  height: var(--spacing-md);
  padding: 0 var(--stroke-thick);
  border-radius: var(--radius-full);
  background: var(--color-status-info);
  color: var(--color-action-primary-text);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--spacing-md);
  text-align: center;
}

/* ── Result ────────────────────────────────────────────────────────── */

.game-result:empty { display: none; }

/* Just finished: the card rises gently into the keyboard's place, the
   board staying put above it (showResult() in js/play/screen.js); the
   points pop once it's there. */
.game-result.is-arriving > * {
  animation: result-in var(--transition-reveal) var(--transition-ease) backwards;
}

.game-result.is-arriving .result-points.is-new { animation-delay: var(--transition-slow); }

@keyframes result-in {
  from { opacity: var(--opacity-hidden); transform: translateY(var(--spacing-lg)); }
  to   { opacity: var(--opacity-full); transform: none; }
}

.result {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

/* A game not solved: the answer atop the card, its parts as the row the
   board never got (js/play/result.js), on the page's colour like the
   Points page's preview. Its tiles are the board's size (sizeResult() in
   js/play/screen.js), so it runs to the card's edges as a band across its
   top, room for the row the board fits. Each kanji's parts keep together,
   with the board's wide gap between kanji; a long answer wraps between
   them. Just finished, the row waits for the card to rise in and the page
   to glide down to it, then plays the tile reveal in use. */
.result-solution {
  --reveal-wait: var(--transition-long);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-sm) var(--spacing-lg);
  margin: calc(var(--spacing-lg) * -1) calc(var(--spacing-lg) * -1) 0;
  padding: var(--spacing-lg) var(--spacing-sm);
  border-radius: calc(var(--radius-xl) - var(--stroke-thin)) calc(var(--radius-xl) - var(--stroke-thin)) 0 0;
  background: var(--color-bg-page);
}

.result-solution-kanji {
  display: inline-flex;
  gap: var(--spacing-xs);
}

.result-solution .tile.is-cell {
  width: var(--board-cell);
  height: var(--board-cell);
  font-size: var(--board-font);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.result-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

.result-title.is-won { color: var(--color-text-accent); }

.answer {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.answer-kanji {
  flex: 0 0 auto;
  font-size: var(--font-size-display);
  font-weight: var(--font-weight-black);
  line-height: var(--font-lineHeight-tight);
}

.answer-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  min-width: 0;
}

/* A one-kanji answer's word (選 → 選ぶ), over its meaning. */
.answer-form {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-tight);
}

.answer-meanings { font-weight: var(--font-weight-bold); }
.answer-meanings.is-second {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-secondary);
}

.answer-readings {
  display: flex;
  flex-wrap: wrap;
  row-gap: var(--spacing-xs);
}

.answer-parts {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.answer-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
}

.answer-kanji-parts {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

/* Each kanji beside its parts, level with the tiles (as high as one, its
   middle on theirs), not with the place names under them. */
.answer-kanji-parts > .kanji {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: var(--layout-cell);
  font-size: var(--font-size-lg);
  line-height: var(--font-lineHeight-tight);
}

/* The card and, under it, the dictionary credit. */
.result-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

/* The points, a box of their own: paid and the streak side by side, then
   the rewards, then the points you have now, each under a rule. */
.result-box {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--color-bg-sunken);
}

.result-box > * { padding: var(--spacing-md); }
.result-box > * + * { border-top: var(--stroke-thin) solid var(--color-border-subtle); }

/* Side by side even on a phone: the why line wraps instead. */
.result-box-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--spacing-lg);
}

.result-earned,
.result-streak {
  display: flex;
  flex-direction: column;
}

.result-streak {
  grid-column: 2;
  align-items: flex-end;
  text-align: right;
}

.result-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
}

.result-big {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.result-why {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* Just paid: the points pop in. */
.result-points.is-new {
  display: inline-block;
  animation: points-pop var(--transition-reveal) var(--transition-bounce) both;
}

@keyframes points-pop {
  0%   { transform: scale(0.8); opacity: var(--opacity-hidden); }
  100% { transform: scale(1); opacity: var(--opacity-full); }
}

/* A bonus hint, won by a quick solve (js/play/result.js giftPanel(),
   2026-11-13): a panel tinted with the accent, the hint's icon in a glow.
   Just won (.is-new), once the card is in sight (--gift-wait): the panel
   pops in, a gift wiggles, then bursts into the hint as sparks fly out. */
.result-gift {
  --gift-at: calc(var(--gift-wait, 0ms) + var(--transition-reveal));
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border: var(--stroke-thin) solid color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-soft) * 100%), transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-tint) * 100%), var(--color-bg-surface));
}

.gift-burst {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: var(--spacing-3xl);
  height: var(--spacing-3xl);
}

.gift-burst > * { grid-area: 1 / 1; }

.gift-glow {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, color-mix(in srgb, var(--color-text-accent) calc(var(--opacity-faint) * 100%), transparent) 0%, transparent 70%);
}

.gift-box {
  font-size: var(--font-size-3xl);
  line-height: var(--font-lineHeight-tight);
  opacity: var(--opacity-hidden);
}

.gift-spark {
  width: var(--spacing-sm);
  height: var(--spacing-sm);
  border-radius: var(--radius-full);
  background: var(--color-text-accent);
  opacity: var(--opacity-hidden);
}

.gift-spark:nth-of-type(even) { background: var(--color-feedback-near); }

.gift-text {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  min-width: 0;
}

.gift-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-black);
  color: var(--color-text-accent);
}

.gift-name { font-weight: var(--font-weight-bold); }

.gift-why {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.result-gift.is-new {
  animation: gift-in var(--transition-reveal) var(--transition-bounce) var(--gift-wait, 0ms) backwards;
}

.result-gift.is-new .gift-box {
  animation:
    gift-wiggle var(--transition-long) var(--transition-ease) var(--gift-wait, 0ms) backwards,
    gift-open var(--transition-base) var(--transition-exit) calc(var(--gift-at) + var(--transition-slow));
}

.result-gift.is-new .gift-hint {
  animation: gift-hint-in var(--transition-reveal) var(--transition-bounce) calc(var(--gift-at) + var(--transition-reveal)) backwards;
}

.result-gift.is-new .gift-glow {
  animation: gift-glow var(--transition-long) var(--transition-ease) calc(var(--gift-at) + var(--transition-reveal)) backwards;
}

.result-gift.is-new .gift-spark {
  animation: gift-spark var(--transition-long) var(--transition-exit) calc(var(--gift-at) + var(--transition-reveal));
}

.result-gift.is-new .gift-title {
  animation: points-pop var(--transition-reveal) var(--transition-bounce) calc(var(--gift-at) + var(--transition-reveal)) backwards;
}

@keyframes gift-in {
  from { opacity: var(--opacity-hidden); transform: scale(var(--scale-enter)); }
}

/* The gift shows from the start of its wiggle until it opens; the sparks
   only while they fly (no fill: they're hidden until then). */
@keyframes gift-wiggle {
  0%, 100% { opacity: var(--opacity-full); transform: rotate(0); }
  20%      { transform: rotate(-12deg); }
  40%      { transform: rotate(12deg); }
  60%      { transform: rotate(-8deg); }
  80%      { transform: rotate(8deg); }
}

@keyframes gift-open {
  from { opacity: var(--opacity-full); transform: scale(1); }
  to   { opacity: var(--opacity-hidden); transform: scale(1.5); }
}

@keyframes gift-hint-in {
  0%  { opacity: var(--opacity-hidden); transform: scale(0) rotate(-20deg); }
  60% { opacity: var(--opacity-full); transform: scale(1.2) rotate(6deg); }
}

@keyframes gift-glow {
  0%  { transform: scale(0.4); opacity: var(--opacity-hidden); }
  40% { transform: scale(1.3); opacity: var(--opacity-full); }
}

@keyframes gift-spark {
  0%   { opacity: var(--opacity-full); transform: rotate(var(--turn)) translateY(calc(-1 * var(--spacing-md))) scale(1); }
  100% { opacity: var(--opacity-hidden); transform: rotate(var(--turn)) translateY(calc(-1 * var(--spacing-2xl))) scale(0.4); }
}

/* The rewards, a part of the box like the points: its label, then each
   reward (the list itself sits inside the part's padding). */
.result-rewards-part {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.result-rewards {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-reward {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

.result-reward-icon,
.toast-icon,
.achievement-icon {
  flex: 0 0 auto;
  width: var(--spacing-lg);
  font-size: var(--font-size-lg);
  line-height: var(--font-lineHeight-snug);
  text-align: center;
}

.result-reward-text,
.toast-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.result-reward-title,
.toast-title { font-weight: var(--font-weight-bold); }

.result-reward-body,
.toast-body {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* The points you have now, and the way to the Points page to spend them. */
.result-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.result-balance-amount { font-weight: var(--font-weight-bold); }

.result-balance-link {
  font-weight: var(--font-weight-bold);
  color: var(--color-text-accent);
}

/* The dictionary credit, small, under the card (EDRDG's terms). */
.result-source {
  padding: 0 var(--spacing-md);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
}

/* Like the play card: the buttons share the width, and stack when narrow,
   New game (the second) on top. */
.result-actions { flex-wrap: wrap-reverse; }

.result-actions .btn {
  flex: 1 1 var(--layout-cardMin);
  white-space: nowrap;
}

.share {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.share-preview {
  margin: 0;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg-sunken);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-md);
  line-height: var(--font-lineHeight-snug);
  white-space: pre-wrap;
  word-break: break-all;
}

.countdown {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  text-align: center;
}

.countdown-time {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
}

/* ── Points: the header's wallet, and "+50" rising from a total ───── */

/* The coin (js/coin.js): a round gold coin with 金 stamped in it, a little
   over its text's size so it reads as large as the emoji it replaced; each
   place sizes it with its font size. Its colours are tokens (coin.*), the
   same in every skin, on gradients shared by every coin (.coin-defs). */
.coin {
  display: inline-block;
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  line-height: 0;
  vertical-align: -0.25em;
}
.coin svg { display: block; width: 100%; height: 100%; }
.coin-edge { fill: url(#coin-g-edge); }
.coin-ridge {
  fill: none;
  stroke: var(--color-coin-ridge);
  opacity: var(--opacity-soft);
}
.coin-face { fill: url(#coin-g-face); stroke: var(--color-coin-line); }
.coin-field { fill: url(#coin-g-field); stroke: var(--color-coin-line); }
.coin-dot { fill: var(--color-coin-dot); }
.coin-shadow { fill: var(--color-coin-shadow); }
.coin-light { fill: var(--color-coin-mark); }
.coin-mark { fill: url(#coin-g-mark); }
.coin-shine { stroke: var(--color-coin-shine); }

/* The coin's shared gradients and 金: in the page but taking no room.
   Not display: none, which would stop the coins from using them. */
.coin-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.coin-s-face-light { stop-color: var(--color-coin-faceLight); }
.coin-s-face { stop-color: var(--color-coin-face); }
.coin-s-face-deep { stop-color: var(--color-coin-faceDeep); }
.coin-s-field-light { stop-color: var(--color-coin-fieldLight); }
.coin-s-field-deep { stop-color: var(--color-coin-fieldDeep); }
.coin-s-edge { stop-color: var(--color-coin-edge); }
.coin-s-edge-deep { stop-color: var(--color-coin-edgeDeep); }
.coin-s-mark { stop-color: var(--color-coin-mark); }
.coin-s-mark-deep { stop-color: var(--color-coin-markDeep); }

/* The header's points (a .head-btn): the coin, then the total. */
.wallet-amount {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.wallet-icon { font-size: var(--font-size-md); }

.has-bump { position: relative; }

/* js/toast.js bump(): rises and fades; under reduced motion it just shows
   for a moment. */
.points-bump {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 var(--spacing-xs);
  border-radius: var(--radius-full);
  background: var(--color-bg-raised);
  /* The skin's accent: green fell under 4.5:1 on some skins' sheets. */
  color: var(--color-text-accent);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
  pointer-events: none;
  animation: points-rise calc(var(--transition-long) * 2) var(--transition-ease) both;
}

.points-bump.is-spent { color: var(--color-text-secondary); }

@keyframes points-rise {
  0%   { transform: translate(-50%, 0); opacity: var(--opacity-hidden); }
  20%  { transform: translate(-50%, calc(var(--spacing-xs) * -1)); opacity: var(--opacity-full); }
  70%  { opacity: var(--opacity-full); }
  100% { transform: translate(-50%, calc(var(--spacing-lg) * -1)); opacity: var(--opacity-hidden); }
}

/* ── Toasts (js/toast.js) ──────────────────────────────────────────── */

/* A popover where the browser has them (the top layer, over sheets);
   otherwise a fixed box. */
.toasts {
  position: fixed;
  inset: auto;
  top: calc(env(safe-area-inset-top) + var(--spacing-md));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: min(var(--layout-container), calc(100% - var(--spacing-md) * 2));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  pointer-events: none;
}

.toasts:empty { display: none; }

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: var(--stroke-thin) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-bg-raised);
  box-shadow: var(--shadow-lg);
  text-align: start;
  pointer-events: auto;
  animation: toast-in var(--transition-slow) var(--transition-bounce) both;
}

.toast.is-leaving {
  opacity: var(--opacity-hidden);
  transition: opacity var(--transition-base) var(--transition-ease);
}

@keyframes toast-in {
  0%   { transform: translateY(calc(var(--spacing-md) * -1)); opacity: var(--opacity-hidden); }
  100% { transform: translateY(0); opacity: var(--opacity-full); }
}

/* ── Points page (js/points.js) ────────────────────────────────────── */

.page {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

/* The wallet: the points, big, and three small counts under them. */
.wallet-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  text-align: center;
}

.wallet-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.wallet-total {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-sm);
  line-height: var(--font-lineHeight-tight);
  /* Fades and shrinks as it docks in the header (js/points.js). */
  opacity: calc(1 - var(--dock, 0));
  transform: scale(calc(1 - var(--dock, 0) / 4));
}

@media (prefers-reduced-motion: reduce) {
  .wallet-total { transform: none; }
}

.wallet-coin {
  align-self: center;
  font-size: var(--font-size-2xl);
}

.wallet-number {
  font-size: var(--font-size-display);
  font-weight: var(--font-weight-black);
  font-variant-numeric: tabular-nums;
}

.wallet-unit {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-secondary);
}

.wallet-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--spacing-sm);
  width: 100%;
  margin: var(--spacing-sm) 0 0;
}

.wallet-stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
  background: var(--color-bg-sunken);
}

.wallet-stat dt {
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
  color: var(--color-text-muted);
}

.wallet-stat dd {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

/* Looks: the current look on a few tiles, then each slot's choices. */
.looks-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: var(--spacing-md);
}

.look-preview {
  display: flex;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg-page);
}

.look-slot {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.look-slot-name {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-secondary);
}

/* Every card in a slot is the same height (each row as tall as the
   tallest), and each has its state line, so picking one moves nothing
   (2026-11-11, the user asked). */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--layout-swatch), 1fr));
  grid-auto-rows: 1fr;
  gap: var(--spacing-sm);
}

.swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  min-width: 0;
  padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-lg);
  border: var(--stroke-thick) solid var(--color-border-subtle);
  text-align: left;
  transition:
    border-color var(--transition-hover) var(--transition-ease),
    box-shadow var(--transition-hover) var(--transition-ease),
    transform var(--transition-press) var(--transition-ease);
}

/* On a mouse, a look lifts a little under the pointer. */
@media (hover: hover) {
  .swatch:hover {
    border-color: var(--color-border-default);
    box-shadow: var(--shadow-md);
    transform: translateY(calc(var(--stroke-thick) * -1));
  }
}
.swatch.is-open { border-color: var(--color-border-strong); }
.swatch[aria-pressed="true"] { border-color: var(--color-border-focus); }
/* A locked look: its example dimmed until you open it to see it, a lock
   on its corner, and its card on the page's colour, a step back from the
   ones you can pick (2026-11-11, the user asked for locked to read
   plainer). The look in use has a tick there instead, filled with the
   selected edge's colour. */
.swatch.is-locked { background: var(--color-bg-page); }
.swatch.is-locked:not(.is-open) .swatch-preview { opacity: var(--opacity-disabled); }

.swatch-badge {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--layout-headIcon);
  height: var(--layout-headIcon);
  border: var(--stroke-thin) solid var(--color-border-default);
  border-radius: var(--radius-full);
  background: var(--color-bg-raised);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-secondary);
  transform: translate(var(--spacing-xs), calc(var(--spacing-xs) * -1));
}

.swatch-badge.is-on {
  border-color: transparent;
  background: var(--color-border-focus);
  color: var(--color-bg-surface);
}

.swatch-badge svg {
  width: var(--font-size-xs);
  height: var(--font-size-xs);
}

/* Three tiles in the skin's own colours, on its own page colour. One
   height for every example (a tile's, and its padding), whatever it holds,
   so every card is as tall. */
.swatch-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--layout-cellXs) + var(--spacing-sm) * 2 + var(--stroke-thin) * 2);
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-xs);
  border: var(--stroke-thin) solid transparent;
  border-radius: var(--radius-md);
}

/* Hint icons: two hints, 32px, so less padding keeps the same height. */
.icons-preview {
  gap: var(--spacing-sm);
  padding-block: var(--spacing-xs);
}

.swatch-tile {
  flex: 0 1 var(--layout-cellXs);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-tight);
}

.swatch-name,
.swatch-state {
  padding: 0 var(--spacing-xs);
  font-size: var(--font-size-xs);
  line-height: var(--font-lineHeight-snug);
}

.swatch-name { font-weight: var(--font-weight-bold); }

/* In use, the price or the achievement, in a line of its own; empty on a
   look you could pick, but there, so every card is as tall. (The lock or
   tick is on the corner.) */
.swatch-state {
  display: flex;
  align-items: center;
  min-height: var(--spacing-md);
  margin-top: auto;
  color: var(--color-text-muted);
}

.swatch-state.is-on { color: var(--color-text-accent); font-weight: var(--font-weight-bold); }

/* One line each, cut short with an ellipsis where a name runs long (the
   card's label and its open details say it all). */
.swatch-name,
.swatch-state-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The examples of a tile reveal or a win effect: the current colours, on
   the page colour. Each plays when it gets .is-playing (js/points.js). */
.reveal-stage,
.fx-stage {
  position: relative;
  align-items: center;
  overflow: hidden;
  background: var(--color-bg-page);
  border-color: var(--color-border-subtle);
}

.reveal-stage .tile,
.fx-stage .tile {
  flex: 0 1 var(--layout-cellXs);
  width: auto;
  height: auto;
  min-width: 0;
  aspect-ratio: 1;
  border-width: var(--stroke-thin);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
}

/* The tile reveals' examples play the board's own rules ("Tile reveal",
   above): .reveal-stage.is-playing is one of their places. */

/* Win effects (settings.effect; pieces from js/play/effects.js). The same
   rules play over the board when a game is won (.fx-board, in the board's
   corner, the size of the board) and as each look's example here
   (.fx-stage). Both start when they get .is-playing. The container sets the
   sizes: how far pieces fall (--fx-h, the board's height in a game), a
   piece's size (--fx-piece) and how far a burst reaches (--fx-burst). */
.fx-stage {
  --fx-h: var(--spacing-2xl);
  --fx-piece: var(--spacing-sm);
  --fx-burst: var(--spacing-md);
}

.fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.fx-board {
  --fx-h: var(--spacing-3xl);
  --fx-piece: var(--spacing-md);
  --fx-burst: var(--spacing-3xl);
  --fx-time: calc(var(--transition-long) * 3);
  /* The drawn word and the seal sit in the middle of the board. */
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fx-out var(--fx-time) var(--transition-ease) both;
}

/* The board's effect fades out at the end; js/play/effects.js then removes it. */
@keyframes fx-out {
  0%, 85% { opacity: var(--opacity-full); }
  100% { opacity: var(--opacity-hidden); }
}

/* Brush draw: the answer written out from its top left. */
.fx-kanji {
  height: var(--layout-cellXs);
  font-size: var(--font-size-xl);
  line-height: var(--layout-cellXs);
  color: var(--color-text-primary);
}

.is-playing .fx-kanji {
  animation: brush-draw var(--transition-long) var(--transition-ink) both;
}

.fx-board .fx-kanji-card {
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-xl);
  background: var(--color-bg-raised);
  box-shadow: var(--shadow-lg);
  animation: kanji-in var(--transition-slow) var(--transition-ease) both;
}

.fx-board .fx-kanji {
  display: block;
  height: auto;
  font-size: var(--font-size-hero);
  line-height: var(--font-lineHeight-tight);
  white-space: nowrap;
}

/* Three or four kanji: smaller, to fit a phone's board. */
.fx-board .fx-kanji[data-len="3"],
.fx-board .fx-kanji[data-len="4"] { font-size: var(--font-size-display); }

@keyframes brush-draw {
  0%   { clip-path: polygon(0 0, 0 0, 0 0); }
  100% { clip-path: polygon(0 0, 200% 0, 0 200%); }
}

/* Wave: the solved row's tiles hop, one after another. */
.is-playing[data-effect="wave"] .tile,
.board-row.fx-wave .tile {
  animation: tile-hop var(--transition-slow) var(--transition-bounce) both;
  animation-delay: calc(var(--i, 0) * var(--transition-fast));
}

@keyframes tile-hop {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(calc(var(--spacing-sm) * -1)); }
}

/* Gold shine: a band of light sweeps across the solved row. */
.is-playing[data-effect="glow"] .tile,
.board-row.fx-glow .tile {
  position: relative;
  overflow: hidden;
  animation: tile-glow var(--transition-long) var(--transition-ease) both;
  animation-delay: calc(var(--i, 0) * var(--transition-fast));
}

.is-playing[data-effect="glow"] .tile::after,
.board-row.fx-glow .tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, var(--color-effect-shine) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shine-across var(--transition-long) var(--transition-ease) both;
  animation-delay: calc(var(--i, 0) * var(--transition-fast));
}

@keyframes shine-across {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes tile-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 var(--spacing-md) var(--stroke-thick) var(--color-effect-spark); }
}

/* Seal: the game's hanko is stamped beside the solved row. */
.fx-seal {
  position: absolute;
  right: var(--spacing-xs);
  bottom: var(--spacing-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--layout-cellXs);
  height: var(--layout-cellXs);
  border-radius: var(--radius-sm);
  background: var(--color-action-primary-bg);
  color: var(--color-action-primary-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-black);
  line-height: var(--font-lineHeight-tight);
  transform: rotate(-12deg);
  opacity: var(--opacity-hidden);
}

.fx-board .fx-seal {
  position: static;
  width: var(--layout-seal);
  height: var(--layout-seal);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-2xl);
  box-shadow: var(--shadow-md);
}

.is-playing .fx-seal {
  animation: seal-stamp var(--transition-reveal) var(--transition-bounce) both;
  animation-delay: var(--transition-base);
}

@keyframes seal-stamp {
  0%   { transform: scale(2.2) rotate(-30deg); opacity: var(--opacity-hidden); }
  60%  { transform: scale(0.92) rotate(-10deg); opacity: var(--opacity-full); }
  100% { transform: scale(1) rotate(-12deg); opacity: var(--opacity-full); }
}

/* Petal fall: petals drift down across it. */
.fx-petal {
  position: absolute;
  top: calc(var(--fx-piece) * -1);
  left: calc(var(--x) * 1%);
  width: var(--fx-piece);
  height: var(--fx-piece);
  border-radius: 0 var(--radius-full);
  background: var(--color-effect-petal);
  opacity: var(--opacity-hidden);
}

.is-playing .fx-petal {
  animation: petal-fall calc(var(--transition-long) * 2) var(--transition-ease) both;
  animation-delay: calc(var(--i) * var(--transition-slow) / 2);
}

@keyframes petal-fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: var(--opacity-hidden); }
  15%  { opacity: var(--opacity-full); }
  50%  { transform: translate(var(--fx-piece), calc(var(--fx-h) / 2)) rotate(120deg); }
  85%  { opacity: var(--opacity-full); }
  100% { transform: translate(calc(var(--fx-piece) * -1), var(--fx-h)) rotate(240deg); opacity: var(--opacity-hidden); }
}

/* Confetti: paper bits in the game's colours tumble down. */
.fx-bit {
  position: absolute;
  top: calc(var(--fx-piece) * -1);
  left: calc(var(--x) * 1%);
  width: calc(var(--fx-piece) / 2);
  height: var(--fx-piece);
  border-radius: var(--stroke-thin);
  background: var(--color-feedback-hit);
  opacity: var(--opacity-hidden);
}

.fx-bit:nth-child(4n+1) { background: var(--color-feedback-near); }
.fx-bit:nth-child(4n+2) { background: var(--color-action-primary-bg); }
.fx-bit:nth-child(4n+3) { background: var(--color-effect-petal); }

.is-playing .fx-bit {
  animation: bit-fall calc(var(--transition-long) * 2) var(--transition-ease) both;
  animation-delay: calc(var(--i) * var(--transition-fast));
}

@keyframes bit-fall {
  0%   { transform: translateY(0) rotate(var(--a)) rotateX(0deg); opacity: var(--opacity-full); }
  85%  { opacity: var(--opacity-full); }
  100% { transform: translateY(var(--fx-h)) rotate(calc(var(--a) + 180deg)) rotateX(720deg); opacity: var(--opacity-hidden); }
}

/* Hanabi: fireworks burst over it. */
.fx-spark {
  position: absolute;
  top: calc(var(--y) * 1%);
  left: calc(var(--x) * 1%);
  width: var(--stroke-thick);
  height: var(--fx-piece);
  border-radius: var(--radius-full);
  background: var(--color-effect-spark);
  opacity: var(--opacity-hidden);
  transform-origin: 50% 0;
}

.fx-spark:nth-child(3n)   { background: var(--color-effect-petal); }
.fx-spark:nth-child(3n+1) { background: var(--color-action-primary-bg); }

.is-playing .fx-spark {
  animation: spark-out var(--transition-long) var(--transition-bounce) both;
  animation-delay: calc(var(--b) * var(--transition-slow));
}

.fx-board .fx-spark { animation-delay: calc(var(--b) * var(--transition-reveal)); }

@keyframes spark-out {
  0%   { transform: rotate(var(--a)) translateY(0) scaleY(0.2); opacity: var(--opacity-full); }
  70%  { opacity: var(--opacity-full); }
  100% { transform: rotate(var(--a)) translateY(var(--fx-burst)) scaleY(1); opacity: var(--opacity-hidden); }
}

/* Without motion: the reveals show their end, the examples a still picture,
   and a game plays no win effect (js/play/effects.js). */
@media (prefers-reduced-motion: reduce) {
  .reveal-stage.is-playing .tile,
  .reveal-stage.is-playing .tile::before,
  .reveal-stage.is-playing .tile::after,
  .is-playing .fx-kanji,
  .is-playing .fx-petal,
  .is-playing .fx-bit,
  .is-playing .fx-spark,
  .is-playing .fx-seal,
  .is-playing[data-effect] .tile,
  .is-playing[data-effect] .tile::after { animation: none; }

  .fx-petal,
  .fx-bit {
    top: calc(var(--y) * 1%);
    opacity: var(--opacity-strong);
  }

  .fx-spark {
    transform: rotate(var(--a)) translateY(var(--spacing-xs));
    opacity: var(--opacity-strong);
  }

  .fx-seal { opacity: var(--opacity-full); }
}

/* A locked look's details, under its row: how to get it, and Buy. */
.offer {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  background: var(--color-bg-sunken);
}

.offer-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: var(--spacing-sm);
  font-weight: var(--font-weight-bold);
}

.offer-price {
  font-size: var(--font-size-xs);
  color: var(--color-text-accent);
  white-space: nowrap;
}

.offer-line {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* How far along: a bar and the count. */
.offer-progress {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.meter {
  flex: 1;
  height: var(--spacing-xs);
  border-radius: var(--radius-full);
  background: var(--color-border-subtle);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-feedback-hit);
}

/* Hints and powers: one per row (.hint-row), in one card. The confirm
   modal's head keeps .power-icon. */
.power-rows { padding: var(--spacing-md); }

.power-icon {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  min-width: var(--spacing-lg);
  font-size: var(--font-size-lg);
  line-height: var(--font-lineHeight-snug);
}

/* Achievements */
.achievement-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--layout-powerMin), 1fr));
  gap: var(--spacing-sm);
}

.achievement {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
}

.achievement-icon { color: var(--color-text-muted); }

.achievement-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--stroke-thick);
  min-width: 0;
}

.achievement-name { font-weight: var(--font-weight-bold); }

.achievement-desc,
.achievement-reward,
.achievement-state { font-size: var(--font-size-xs); }

.achievement-desc { color: var(--color-text-secondary); }
.achievement-reward { color: var(--color-text-accent); }
.achievement-state { margin-top: var(--spacing-xs); color: var(--color-text-muted); }
.achievement:not(.is-earned) .achievement-name { color: var(--color-text-secondary); }

/* Buying: the confirm that names the price (here and in a game's hint sheet). */
.shop-confirm {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  background: var(--color-bg-sunken);
  font-size: var(--font-size-xs);
}


/* ── Back-to-apps mark ─────────────────────────────────────────────── */

.rw-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rw-back-logo {
  width: var(--spacing-lg);
  height: var(--spacing-lg);
  opacity: var(--opacity-faint);
  transition: opacity var(--transition-base) var(--transition-ease);
}

@media (hover: hover) {
  .rw-back-logo:hover {
    opacity: var(--opacity-soft);
    animation: rw-brush var(--transition-long) var(--transition-ink);
  }
}

/* The mark is redrawn left to right, the way a brush lays down a stroke:
   a clip-path wipe with no movement, slow at the start and quick at the end. */
@keyframes rw-brush {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* ── Moves between states (2026-11-11) ────────────────────────────── */

/* Pressed: a button, key or cell sinks in a little (tokens.js press; the
   user asked). After the hover lifts, so a press wins over a lift. */
.btn:active:not(:disabled),
.head-btn:active,
.icon-btn:active:not(:disabled),
.segment:active:not(:disabled),
.ask-option:active:not(:disabled),
.swatch:active,
button.clue-chip:active,
.palette-tile:active:not(:disabled),
.board-row.is-next button.tile:active { transform: scale(var(--scale-press)); }

/* A tip put away fades (app.js renderHeadTip()), its dimming with it. */
.head-tip.is-leaving {
  pointer-events: none;
  animation: motion-fade-out var(--transition-sheetOut) var(--transition-exit) both;
}

/* The tick on a look just picked pops in (js/points.js). */
.swatch-badge.is-new { animation: badge-pop var(--transition-toggle) var(--transition-bounce) both; }
@keyframes badge-pop {
  from { opacity: var(--opacity-hidden); transform: scale(var(--scale-enter)); }
  60%  { transform: scale(var(--scale-pop)); }
}

/* A new line of news fades in: a transfer's status, a code to send, a
   purchase done (js/settings.js, js/points.js). */
.transfer-status.is-new,
.transfer-code.is-new,
.status-line.is-new { animation: motion-fade-in var(--transition-fold) var(--transition-ease) both; }

/* A change of look or language crossfades where the browser can (js/dom.js
   crossfade()). */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--transition-look);
  animation-timing-function: var(--transition-ease);
}

/* Page moves, like an iPhone (app.js slide(); the user picked it from a
   demo, 2026-11-11). Going deeper, the new page slides in from the right,
   shadowed, over the old, which drifts a quarter of the way left beneath
   it; going back, the page slides away to the right off the one beneath.
   The header stays where it is, its controls fading (named only during a
   move: a name would stop its glass blurring the page). */
html[data-move] .app-header { view-transition-name: app-header; }
html[data-move]::view-transition-old(root),
html[data-move]::view-transition-new(root) {
  animation-duration: var(--transition-page);
  animation-timing-function: var(--transition-ease);
  mix-blend-mode: normal;
}
html[data-move="forward"]::view-transition-old(root) { animation-name: page-drift-left; }
html[data-move="forward"]::view-transition-new(root) {
  animation-name: page-from-right;
  box-shadow: var(--shadow-lg);
}
html[data-move="back"]::view-transition-old(root) {
  z-index: 1;
  animation-name: page-to-right;
  box-shadow: var(--shadow-lg);
}
html[data-move="back"]::view-transition-new(root) { animation-name: page-drift-back; }
html[data-move]::view-transition-old(app-header),
html[data-move]::view-transition-new(app-header) {
  animation-duration: var(--transition-hover);
  animation-timing-function: var(--transition-ease);
}

@keyframes page-from-right { from { transform: translateX(100%); } }
@keyframes page-to-right   { to   { transform: translateX(100%); } }
@keyframes page-drift-left { to   { transform: translateX(-25%); } }
@keyframes page-drift-back { from { transform: translateX(-25%); } }

/* ── Reduced motion ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .rw-back-logo:hover { animation: none; }
  .board-row.is-new .tile,
  .board-row.is-new .tile::before,
  .board-row.is-new .tile::after,
  .look-preview.is-new .tile,
  .look-preview.is-new .tile::before,
  .look-preview.is-new .tile::after,
  .result-solution.is-new .tile,
  .result-solution.is-new .tile::before,
  .result-solution.is-new .tile::after,
  .board-row.is-new .row-kanji,
  .demo-row.is-new .tile,
  .demo-cell.is-typed,
  .demo-answer.is-shown,
  .frame-part.is-new,
  .kanji-frame.is-new { animation: none; }
  .palette-tile[aria-pressed="true"] { transform: none; }
  /* Lifts and presses are movement too. */
  .btn:active:not(:disabled), .head-btn:active, .icon-btn:active:not(:disabled),
  .segment:active:not(:disabled), .ask-option:hover:not(:disabled),
  .ask-option:active:not(:disabled), .swatch:hover, .swatch:active,
  button.clue-chip:active, .palette-tile:active:not(:disabled),
  .board-row.is-next button.tile:active, summary.history-summary:hover,
  button.frame-slot:hover .kanji-frame { transform: none; }
  .tile.is-typed,
  .swatch-badge.is-new,
  .history-item.is-new,
  .sheet[open],
  .sheet[open]::backdrop,
  .sheet.is-again > *,
  .sheet-body.is-swapped,
  .head-tip.is-leaving,
  .transfer-status.is-new,
  .transfer-code.is-new,
  .status-line.is-new { animation: none; }
  .points-bump,
  .toast,
  .result-points.is-new { animation: none; }
  .result-gift.is-new,
  .result-gift.is-new * { animation: none; }
}

/* ── Home-screen tip (app.js) and steps (js/install.js) ────────────── */

.install-body { gap: var(--spacing-sm); }

.install-why { color: var(--color-text-secondary); }

.install-steps {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  margin: 0;
  padding-left: var(--spacing-lg);
  line-height: var(--font-lineHeight-snug);
}

.install-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.install-body .btn-row { margin-top: var(--spacing-xs); }

/* ── About page (js/about.js) ──────────────────────────────────────── */

.about-intro {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
}

.about-by { font-size: var(--font-size-xs); }

.about-lead {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--font-lineHeight-snug);
}

.about-text {
  color: var(--color-text-secondary);
  line-height: var(--font-lineHeight-normal);
}

.about-card {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
}

.credit-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.credit {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  padding: var(--spacing-md);
}

.credit-name { font-weight: var(--font-weight-bold); }

.credit-by,
.credit-links { font-size: var(--font-size-xs); }

.credit-by { color: var(--color-text-secondary); }
.credit-use { line-height: var(--font-lineHeight-snug); }

.credit-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--spacing-xs);
  overflow-wrap: anywhere;
}

/* Each link is a full touch target (24 px high), so two rows of them on a
   narrow phone aren't too close to tap (WCAG 2.5.8). */
.credit-links > * {
  display: inline-flex;
  align-items: center;
  min-height: var(--spacing-lg);
}

.credit-sep { color: var(--color-text-muted); }
