/* ==========================================================================
 * moyako-components.css — Sprint 2 Day 2 (12 components)
 * --------------------------------------------------------------------------
 * Spec:  docs/games-moyako-spec-v2.md §Shared components
 * Scope: all rules under [data-moyako-v2]. No effect on live pages.
 * ========================================================================== */

/* ============ TopBar ============ */
[data-moyako-v2] .topbar {
  display: flex; align-items: center; justify-content: space-between;
  /* v237 (2026-05-09): safe-area-inset padding on left/right.
   * `viewport-fit=cover` lets the WebView render edge-to-edge under
   * Android's system gesture zones; in landscape the right-edge swipe
   * area was intercepting taps on the gear button (`right: 12px`),
   * so settings appeared dead. The env() insets are non-zero only
   * when the OS reserves an edge zone (gesture nav, notch); on
   * narrow web they evaluate to 0 and behaviour is unchanged. Per
   * user "settings still not working at landscape mode" on cap-shell
   * emulator. */
  padding:
    env(safe-area-inset-top, 0)
    calc(var(--space-4) + env(safe-area-inset-right, 0))
    0
    calc(var(--space-4) + env(safe-area-inset-left, 0));
  /* Solid slate matching cap-nav (#1a1e2a) so the chrome reads as a
   * clearly-defined band on every page, regardless of the underlying
   * page bg gradient. Earlier rgba(255,255,255,0.03/0.07) tints were
   * effectively invisible against the cap shell's near-black page
   * (#0F1729) — user repeatedly reported "no header bar." Solid bg
   * + visible border eliminates that whole class of bug. */
  background: #1a1e2a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  gap: var(--space-3);
  position: relative;     /* anchor for the absolute-centered panda */
}

/* v238 (2026-05-09): hardcoded minimum landscape phone clearance.
 * Capacitor Android does not always expose env(safe-area-inset-*)
 * reliably — the gesture zone variant in particular depends on the
 * `WindowCompat.setDecorFitsSystemWindows(false)` setting. When env()
 * returns 0, my v237 padding collapsed back to 16 px and the gear
 * stayed inside the right-edge swipe zone. `max(48px, ...)` guarantees
 * at least 48 px of left/right padding on phone landscape regardless. */
@media (orientation: landscape) and (max-height: 500px) {
  [data-moyako-v2] .topbar {
    padding-right: max(48px, calc(var(--space-4) + env(safe-area-inset-right, 0)));
    padding-left:  max(48px, calc(var(--space-4) + env(safe-area-inset-left,  0)));
  }
}
/* Light theme — silver/gray metallic 3D gradient on TopBar (per
 * user "header... gradient which feels elegant professional and
 * vivid"). Matches the picker-card metallic aesthetic so the chrome
 * reads as one design family. */
[data-theme="light"] [data-moyako-v2] .topbar {
  background: linear-gradient(180deg, #EAEFF7 0%, #C8D2E2 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(15, 23, 42, 0.06),
    0 2px 6px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] [data-moyako-v2] .topbar-title,
[data-theme="light"] [data-moyako-v2] .topbar-back,
[data-theme="light"] [data-moyako-v2] .topbar-sound,
[data-theme="light"] [data-moyako-v2] .topbar-settings,
[data-theme="light"] [data-moyako-v2] .topbar-streak {
  color: #0F172A;
}
[data-theme="light"] [data-moyako-v2] .topbar-subtitle {
  color: #475569;
}
/* Task 2.3 — Panda is in the topbar's normal flex flow as the middle
 * sibling of [.topbar-left | .topbar-panda | .topbar-right]. The parent
 * .topbar's `justify-content: space-between` distributes them naturally,
 * which means panda's vertical position inherits the bar's
 * `align-items: center` and moves WITH the chrome on rotation / inset
 * changes — no absolute-positioning math needed.
 *
 * Earlier revisions positioned panda absolutely at top:50% (or with an
 * env(safe-area-inset-top) offset to compensate for padding-top inset).
 * When the bar's effective height changed (cap shell padding, S4
 * viewport revert, etc.) the absolute math floated panda outside the
 * visible bar. Going static eliminates the whole class of bugs. */
[data-moyako-v2] .topbar .topbar-panda {
  position: static;
  transform: none;
}
[data-moyako-v2] .topbar-left {
  display: flex; align-items: center; gap: var(--space-3); min-width: 0;
}
[data-moyako-v2] .topbar-back {
  font-size: 24px; color: var(--text-primary); text-decoration: none;
  line-height: 1; padding: 4px 8px;
}
[data-moyako-v2] .topbar-logo {
  display: inline-flex; align-items: center;
  height: 48px; text-decoration: none;
  margin-right: var(--space-1);
}
/* Logo + panda sized to span the title-top to subtitle-bottom range
 * (~44px on a 56px topbar). Without this they sat smaller than the
 * title+subtitle stack and looked under-weighted. */
[data-moyako-v2] .topbar-logo img {
  height: 44px; width: auto; display: block;
}
[data-moyako-v2] .topbar-titles { display: flex; flex-direction: column; min-width: 0; }
[data-moyako-v2] .topbar-title {
  font-size: var(--font-size-h3); font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-moyako-v2] .topbar-subtitle {
  font-size: var(--font-size-small); color: var(--text-secondary);
}
/* v289_2 (2026-05-10): subtitle stays visible on narrow phones too.
 * Per user "Header bar Under Moyako, there's a subtitle, which I
 * couldn't see on the preview screen now". The earlier hide at
 * < 400 px was an older space-saving rule; the topbar now has enough
 * room for the subtitle on a 375 px viewport. */
[data-moyako-v2] .topbar-panda {
  background: transparent; border: 0; cursor: pointer;
  padding: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 0;
}
[data-moyako-v2] .topbar-panda img {
  width: 44px; height: 44px;
  display: block; border-radius: 50%;
}
[data-moyako-v2] .topbar-right {
  display: flex; align-items: center; gap: var(--space-2);
}
[data-moyako-v2] .topbar-streak {
  font-size: var(--font-size-small); color: var(--accent); font-weight: 500;
}
[data-moyako-v2] .topbar-sound,
[data-moyako-v2] .topbar-settings {
  background: transparent; border: 0; color: var(--text-secondary);
  cursor: pointer; padding: 4px; line-height: 1;
  /* Equal size + bigger glyphs (per user "should be same size
   * and big better"). Fixed 36 px square keeps both icons on the
   * same baseline regardless of glyph metrics; font-size 22 px
   * scales the SVG/emoji inside.
   *
   * v289 (2026-05-10): !important + min/max overrides to beat the
   * global `.btn { min-width: 44 }` tap-target rule that was
   * inflating these to 44×44 on web. Per user "cap mobile one is
   * the base align to that icons" — web matches the 36×36 cap
   * mobile baseline. */
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  /* v237 (2026-05-09): tap-priority hardening for cap-shell landscape.
   * `touch-action: manipulation` opts out of double-tap-zoom and
   * scroll gestures so the WebView doesn't delay/cancel the click;
   * `position:relative; z-index:2` keeps the button above any
   * sibling pseudo-elements that overlap (e.g. ad-slot pseudo-
   * borders). Combined with the parent topbar's safe-area-inset
   * padding, the gear is clear of Android's right-edge swipe
   * gesture zone. */
  position: relative;
  z-index: 2;
  touch-action: manipulation;
}
[data-moyako-v2] .topbar-sound svg,
[data-moyako-v2] .topbar-settings svg {
  width: 22px; height: 22px;
  display: block;
}

/* ============ BottomNav ============ */
[data-moyako-v2] .bottom-nav {
  display: flex;
  /* Same subtle slate as the TopBar so chrome reads as one band. */
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  /* v4 §D.2 canon: 56px tall on every page, even when the .page flex
     wrapper isn't present (e.g. marketing homepage). Ensures each
     .nav-item meets Apple HIG 44pt / Android 48dp tap target. */
  min-height: 56px;
  height: 56px;             /* equal across all pages — no padding from legacy rules */
  padding: 0;
  box-sizing: border-box;
}
[data-moyako-v2] .bottom-nav .nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  text-decoration: none; color: var(--text-tertiary);
  font-size: var(--font-size-micro);
  /* Make the full item height tappable, not just the text/icon stack. */
  min-height: 56px;
}
[data-moyako-v2] .bottom-nav .nav-item.is-active { color: var(--action); }
/* Light theme — same metallic gradient as TopBar (mirror, with
 * border-top instead of bottom). */
[data-theme="light"] [data-moyako-v2] .bottom-nav {
  background: linear-gradient(180deg, #C8D2E2 0%, #EAEFF7 100%);
  border-top: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow:
    inset 0 -1px 0 rgba(255, 255, 255, 0.9),
    inset 0 1px 0 rgba(15, 23, 42, 0.06),
    0 -2px 6px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] [data-moyako-v2] .bottom-nav .nav-item {
  color: #475569;
}
[data-theme="light"] [data-moyako-v2] .bottom-nav .nav-item.is-active {
  color: var(--action);     /* orange — same brand accent in light mode */
}
[data-moyako-v2] .bottom-nav .nav-icon { font-size: 18px; line-height: 1; }
[data-moyako-v2] .bottom-nav .nav-label { font-size: 10px; }

/* Mobile: nav-bar slightly shorter than the 56px header (per user
   "close to header may be a bit smaller than it") — 52px keeps icon
   + label legible without dwarfing the topbar. Apple HIG 44pt tap
   target preserved on the .nav-item. Stays equal across all v2
   pages because every page reads from this shared rule. */
@media (max-width: 768px) {
  [data-moyako-v2] .bottom-nav {
    min-height: 52px;
    height: 52px;
    flex: 0 0 52px;     /* overrides --footer-h flex-basis from layout */
  }
  [data-moyako-v2] .page .bottom-nav { flex: 0 0 52px; }
  [data-moyako-v2] .bottom-nav .nav-item {
    min-height: 52px;
  }
  [data-moyako-v2] .bottom-nav .nav-icon { font-size: 17px; }
  [data-moyako-v2] .bottom-nav .nav-label { font-size: 10px; }
}

/* ============ CapNav (Capacitor-only bottom navigation) ============
 *
 * Mounted by `shared/components/cap-nav.js` on cap-shell pages
 * (html[data-moyako-native]). Visually mirrors `.bottom-nav` but is
 * its own DOM element (#cap-nav) because the cap shell needs an
 * always-fixed footer that suppresses during gameplay/question state.
 *
 * Uses design tokens per CAP-SHELL-LAYOUT §2.6 — no hardcoded colours.
 * Migrated from inline <style> injection in cap-nav.js (v272). */
#cap-nav {
  position: fixed; left: 0; right: 0; top: auto; bottom: 0;
  height: var(--footer-h, 56px);
  display: flex;
  background: var(--bg-surface, #1A2744);
  border-top: 1px solid var(--border, rgba(255,255,255,0.12));
  z-index: 9999;
  margin: 0;
  transform: none;
  /* Sys-info gesture inset reserved as padding-bottom (CAP-SHELL §2.1).
   * L/R env insets handled by moyako-layout.css §3.14 cap-shell rule. */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#cap-nav button {
  flex: 1; min-width: 0;
  background: transparent; border: 0;
  color: var(--text-tertiary, #9AA3B7);
  font: 500 10px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#cap-nav button .cap-nav-icon { font-size: 18px; line-height: 1; }
#cap-nav button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
#cap-nav button[aria-current="page"] { color: var(--action, #4CAF50); }
#cap-nav button:active {
  /* Subtle press tint — derive from --action token via colour-mix
   * fallback. The 8% rgba mirrors the legacy emerald active flash. */
  background: rgba(76, 175, 80, 0.08);
}

/* Cap-nav suppression — gameplay + assessment-question states.
 * Per CAP-SHELL-LAYOUT §2.4. Mirrors the body-state logic from the
 * pre-v272 inline-style block. */
body[data-cap-state="play"] #cap-nav,
body[data-state="playing"] #cap-nav,
body[data-state="play"] #cap-nav,
body.verbal-active #cap-nav,
body.pattern-active #cap-nav,
body.reaction-active #cap-nav,
body.spatial-active #cap-nav,
body.memory-active #cap-nav,
body.number_seq-active #cap-nav,
body.attention-active #cap-nav { display: none; }

/* Light theme — token system handles bg + border + text via the
 * `[data-theme="light"]` token block at line 412+. Active colour
 * picks up --action (which the light-theme block sets). The press
 * tint stays the same green wash (semantic, not theme-dependent). */

/* ============ AdSlot ============ */
[data-moyako-v2] .ad-slot {
  background: var(--ad-placeholder);
  display: flex; align-items: center; justify-content: center;
}
[data-moyako-v2] .ad-slot .ad-house {
  color: var(--text-tertiary); font-size: var(--font-size-small);
}

/* ============ GameCard ============ */
[data-moyako-v2] .game-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none; color: var(--text-primary);
  aspect-ratio: 3 / 2;
}
@media (min-width: 900px) {
  [data-moyako-v2] .game-card { aspect-ratio: 1.5 / 1; }
}
[data-moyako-v2] .game-card .game-icon { font-size: 32px; line-height: 1; }
[data-moyako-v2] .game-card .game-title {
  font-size: var(--font-size-h3); font-weight: 500;
}
[data-moyako-v2] .game-card .game-skills {
  display: flex; flex-wrap: wrap; gap: var(--space-1);
}
[data-moyako-v2] .skill-pill {
  font-size: var(--font-size-micro);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
}
[data-moyako-v2] .game-card .btn-action {
  margin-top: auto;
  /* --action-dark on white meets 4.12:1 AA-large; --action fails at 2.78:1 */
  background: var(--action-dark); color: #fff;
  font-size: var(--font-size-small); font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

/* ============ RankRow ============ */
[data-moyako-v2] .rank-row {
  display: grid;
  grid-template-columns: 40px 32px 1fr auto auto;
  align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-small);
}
[data-moyako-v2] .rank-row.is-self {
  background: rgba(255, 152, 0, 0.12);
  border-left: 3px solid var(--accent);
}
[data-moyako-v2] .rank-row .rank { color: var(--text-tertiary); font-weight: 500; }
[data-moyako-v2] .rank-row .avatar { font-size: 20px; }
[data-moyako-v2] .rank-row .name { color: var(--text-primary); }
[data-moyako-v2] .rank-row .you-tag { color: var(--accent); font-weight: 500; }
[data-moyako-v2] .rank-row .streak { color: var(--accent); }
[data-moyako-v2] .rank-row .score { color: var(--text-secondary); }

/* ============ StatGrid ============ */
[data-moyako-v2] .stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}
[data-moyako-v2] .stat-card {
  padding: var(--space-3);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
[data-moyako-v2] .stat-value {
  font-size: var(--font-size-h1); font-weight: 500; color: var(--action);
}
[data-moyako-v2] .stat-label {
  font-size: var(--font-size-micro); color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ============ ProgressBar ============ */
[data-moyako-v2] .progress-bar {
  width: 100%; height: 6px;
  background: var(--bg-surface-2);
  border-radius: 3px; overflow: hidden;
}
[data-moyako-v2] .progress-bar.is-tall { height: 10px; }
[data-moyako-v2] .progress-fill {
  height: 100%;
  background: var(--success);
  transition: width 200ms ease;
}

/* ============ PlayerCard ============ */
[data-moyako-v2] .player-card {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
[data-moyako-v2] .player-card .avatar { font-size: 32px; line-height: 1; }
[data-moyako-v2] .player-card .identity { flex: 1; min-width: 0; }
[data-moyako-v2] .player-card .name { font-size: var(--font-size-h3); font-weight: 500; }
[data-moyako-v2] .player-card .meta {
  font-size: var(--font-size-small); color: var(--text-secondary);
}
[data-moyako-v2] .player-card .clock {
  font-size: var(--font-size-h2); color: var(--action);
  font-variant-numeric: tabular-nums;
}
[data-moyako-v2] .player-card.is-large .avatar { font-size: 56px; }
[data-moyako-v2] .player-card.is-large .name { font-size: var(--font-size-h1); }
[data-moyako-v2] .player-card.is-inline {
  padding: var(--space-2); border: 0; background: transparent;
}
[data-moyako-v2] .player-card.is-inline .avatar { font-size: 22px; }

/* ============ PandaCoach ============ */
[data-moyako-v2] .panda-coach {
  display: flex; gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
[data-moyako-v2] .panda-coach .panda-avatar { font-size: 40px; line-height: 1; }
[data-moyako-v2] .panda-coach .speech { flex: 1; min-width: 0; }
[data-moyako-v2] .panda-coach .speech-label {
  font-size: var(--font-size-micro); color: var(--text-tertiary);
  letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 4px;
}
[data-moyako-v2] .panda-coach .speech-message {
  margin: 0;
  font-size: var(--font-size-small); color: var(--text-primary);
  line-height: 1.4;
}

/* ============ InfoDrawer ============
   Rules moved to shared/css/info-drawer.css on 2026-04-26 so they load
   on all game pages (chess + the 6 non-v2 games) rather than only when
   [data-moyako-v2] + moyako-components.css are both present. The
   standalone file is a <link> one-liner added to every game page. */

/* ============ SettingsModal — popover ============
 * Bottom-left of the gear icon (top-right of TopBar), small box, no
 * full-screen backdrop. Click-outside dismiss handled by JS. */
[data-moyako-v2] .settings-modal.settings-popover {
  position: fixed;
  /* v237 (2026-05-09): popover top accounts for `viewport-fit=cover`
   * safe-area-inset-top so the panel doesn't tuck behind the topbar
   * on devices with notch/status-bar overlap (cap-shell APK on
   * Android landscape). Right edge similarly stays clear of the
   * gesture zone. */
  top: calc(env(safe-area-inset-top, 0px) + var(--header-h, 56px) + 6px);
  right: calc(env(safe-area-inset-right, 0px) + var(--space-3, 12px));
  z-index: 1000;
  visibility: hidden;
  pointer-events: none;
}
[data-moyako-v2] .settings-modal.settings-popover.is-open {
  visibility: visible;
  pointer-events: auto;
}
[data-moyako-v2] .settings-popover .settings-panel {
  width: min(280px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--header-h, 56px) - 24px);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: flex; flex-direction: column;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  /* Subtle slide-down + fade entrance from the gear button. */
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}
[data-moyako-v2] .settings-popover.is-open .settings-panel {
  transform: translateY(0);
  opacity: 1;
}
/* Light theme — flip the popover's interior tokens to dark-on-white
 * so all the children (.settings-title, .seg-btn, .settings-select,
 * etc.) read correctly. The page-level Light palette keeps text-* light
 * because tiles have a navy bg; the popover is a white card so text
 * needs to be dark inside it. */
[data-theme="light"] [data-moyako-v2] .settings-popover .settings-panel {
  --bg-surface:     #FFFFFF;
  --bg-surface-2:   rgba(15,23,42,0.04);
  --text-primary:   #0F1729;
  --text-secondary: #334155;
  --text-tertiary:  #64748B;
  --border:         rgba(15,23,42,0.10);
  --border-strong:  rgba(15,23,42,0.18);
  background: #FFFFFF;
  color: #0F1729;
  border-color: rgba(15,23,42,0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
/* (v183, 2026-05-08) Settings-select light-theme override removed
 * per user 'align settings dropdown as well to create account -
 * avatar dropdown style'. The shared v171/v181 solid-3D select
 * rule now applies in both themes — settings dropdown matches the
 * avatar dropdown exactly (silver gradient surface in light,
 * navy in dark, inset 3D shadow + green focus ring). The option
 * popup-list bg still inherits from the universal
 * [data-moyako-v2] .settings-select option rule below. */
[data-theme="light"] [data-moyako-v2] .settings-popover .settings-select option {
  background: #FFFFFF;
  color: #0F1729;
}
/* ===== Settings popover — condensed interior ===== */
[data-moyako-v2] .settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
[data-moyako-v2] .settings-title {
  margin: 0; font-size: 13px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-secondary);
}
[data-moyako-v2] .settings-close {
  background: transparent; border: 0; color: var(--text-primary);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px;
  min-width: 0; min-height: 0;
}
[data-moyako-v2] .settings-body {
  flex: 1; overflow-y: auto;
  /* v230 (2026-05-09): tightened padding 10/12 → 8/12 and gap 10 → 6
   * per user "settings can be more compact". */
  padding: 8px 12px;
  display: flex; flex-direction: column;
  gap: 6px;
}
[data-moyako-v2] .settings-group {
  display: flex; flex-direction: column; gap: 4px;
}
[data-moyako-v2] .settings-label {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
[data-moyako-v2] .settings-segmented {
  display: flex;
  background: var(--bg-surface-2);
  border-radius: 6px;
  padding: 2px;
}
[data-moyako-v2] .seg-btn {
  flex: 1;
  background: transparent; border: 0;
  color: var(--text-secondary);
  padding: 5px 8px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 4px;
  font-family: inherit;
  min-width: 0; min-height: 0;
}
[data-moyako-v2] .seg-btn.is-active {
  background: var(--action);
  color: #fff;
  font-weight: 500;
}
/* Background picker — icon-only chips. Each chip shows its season
 * glyph; active chip gets an outline ring instead of a fill swap so
 * the icon stays legible. */
[data-moyako-v2] .seg-btn--bg {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
}
[data-moyako-v2] .seg-btn--bg .seg-icon {
  display: inline-block;
}
[data-moyako-v2] .seg-btn--bg.is-active {
  background: transparent;
  outline: 2px solid var(--action);
  outline-offset: -2px;
  color: inherit;
}
/* (v183, 2026-05-08) .settings-select bg / border / radius /
 * padding / font-size overrides REMOVED per user 'align settings
 * dropdown as well to create account - avatar dropdown style'. The
 * shared v171/v181 solid-3D rule covers all <select> elements
 * (var(--bg-surface) bg, var(--border) border, 10 px radius, inset
 * 3D shadow). Only the OS-level option list bg stays here so the
 * dropdown popup contrasts on dark theme. */
[data-moyako-v2] .settings-select option { background: var(--bg-surface); }
[data-moyako-v2] .settings-divider {
  border: 0; border-top: 1px solid var(--border); margin: 2px 0;
}
[data-moyako-v2] .settings-links {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 11px;
}
[data-moyako-v2] .settings-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 0;
  font-size: 11px;
  border: 0;
}
[data-moyako-v2] .settings-links a:hover { color: var(--text-primary); text-decoration: underline; }
[data-moyako-v2] .settings-footer {
  padding: 6px 12px;
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

/* v214 (2026-05-08): top guest CTA inside the settings panel. Big primary
 * + secondary buttons stacked, prominent enough to be the first thing a
 * guest sees on opening Settings. Per user "for the guest user Sign in /
 * Create user should be on the top to encourage the users apply best
 * practice design". Belt-and-braces guest-hiding: any element marked
 * data-auth-only="user" stays hidden until hydrateAccount confirms a
 * logged-in session, killing the brief flash where logged-in items would
 * render before being hidden by JS. */
[data-moyako-v2] .settings-popover .sm-guest-cta-top {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
[data-moyako-v2] .settings-popover .sm-guest-cta-msg {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}
[data-moyako-v2] .settings-popover .sm-guest-cta-row {
  display: flex;
  gap: 8px;
}
[data-moyako-v2] .settings-popover .sm-cta-btn {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.2px;
  box-sizing: border-box;
  transition: opacity 0.15s ease, transform 0.08s ease;
}
[data-moyako-v2] .settings-popover .sm-cta-btn--primary {
  background: linear-gradient(135deg, var(--action, #4CAF50) 0%, #45a049 100%);
  color: #fff;
  border: 1px solid transparent;
}
[data-moyako-v2] .settings-popover .sm-cta-btn--secondary {
  background: transparent;
  color: var(--action, #4CAF50);
  border: 1px solid var(--action, #4CAF50);
}
[data-moyako-v2] .settings-popover .sm-cta-btn:hover { opacity: 0.92; }
[data-moyako-v2] .settings-popover .sm-cta-btn:active { transform: translateY(1px); }
/* Belt-and-braces hide. data-auth-only attributes already carry the `hidden`
 * boolean attribute initially; this reinforces it with !important so any
 * ancestor display rule can't unhide a logged-in-only block when no user
 * is signed in. hydrateAccount sets `hidden = false` on the relevant
 * elements once it confirms a session. */
[data-moyako-v2] .settings-popover [data-auth-only="user"][hidden],
[data-moyako-v2] .settings-popover [data-auth-only="guest"][hidden] {
  display: none !important;
}

/* ============ InfoIcon ============ */
[data-moyako-v2] .info-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  /* --info border gives 9.91:1 vs border-strong 2.01:1 — info-icon border is
   * the sole visual identifier of the control, so WCAG 1.4.11 applies. */
  border: 1px solid var(--info);
  background: transparent; color: var(--info);
  cursor: pointer;
  font-size: var(--font-size-h3); line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ============ DifficultyList ============ */
[data-moyako-v2] .difficulty-list {
  display: flex; flex-direction: column; gap: var(--space-2);
}
[data-moyako-v2] .difficulty {
  /* Compact pill (v161, 2026-05-08): min-height 44 → 40 to bring
   * 5-pill + 2-action + sign-in row stack inside Container 2 without
   * scroll on phone landscape (288 px budget). 40 px is below the
   * WCAG 2.2 AA 44 px floor but stays within the W3C "important
   * controls in dense lists" 24 px allowance — pills are still
   * comfortably tappable and the picker is effectively a list. */
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit; font-size: var(--font-size-body);
  text-align: left;
  min-height: 40px;
  width: 100%;
}
[data-moyako-v2] .difficulty.is-selected {
  background: rgba(102, 187, 106, 0.15);
  border-color: var(--success);
}

/* v319 — Game-end overlay: 2-row button layout + Start Again label
 * promotion + guest sign-in CTA. Per user 2026-05-11:
 *   - Industry best-practice button hierarchy (Sudoku.com/Chess.com)
 *   - Single visual class for selection state across surfaces
 *   - Guest conversion at the highest-engagement moment (post-win)
 */
.overlay-buttons--secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.overlay-buttons--primary {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
}
.overlay-buttons--secondary .overlay-action-btn,
.overlay-buttons--primary .overlay-action-btn {
  padding: 12px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease-out, box-shadow 0.15s, background 0.15s;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  /* v322 — equalize button heights so the secondary row (View / Share)
   * and the primary row (Exit / Start Again) sit at the same vertical
   * pitch. Without this, the primary buttons rendered taller due to
   * gradient/shadow padding, leaving the secondary row visibly shorter
   * and the rows looking "stepped". */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
/* v323 — both rows are 3-up equal columns. Secondary: View / Share /
 * Rate Us. Primary: Exit / Replay / Next (always visible). Column
 * edges align cleanly across both rows. */
.overlay-buttons--secondary {
  grid-template-columns: 1fr 1fr 1fr;
}
.overlay-buttons--primary {
  grid-template-columns: 1fr 1fr 1fr !important;
}
/* v320 — primary action gets a wider track so the "START AGAIN" label
 * doesn't compete with Exit for equal space (Exit is tertiary anyway). */
.overlay-buttons--primary {
  grid-template-columns: 1fr 1.4fr;
}
/* When Next Level IS queued, restore 3-up equal-width grid */
.overlay-buttons--primary:has(#nextLevelBtn:not([style*="display: none"])):not(:has(#nextLevelBtn[style*="display:none"])) {
  grid-template-columns: 1fr 1fr 1fr;
}

/* v320 — hide the rank pill ("Sign in to rank") when the guest CTA tile
 * is present. Same call-to-action, redundant otherwise. */
.overlay-actions-card:has(.moyako-guest-cta) ~ .overlay-results-card .overlay-pills .overlay-pill:has(#rankValue),
.overlay-content:has(.moyako-guest-cta) .overlay-pill:has(#rankValue:not([data-has-rank])) {
  display: none;
}
/* Tertiary action (Exit) — lowest visual weight; readable but recedes */
.overlay-buttons--primary .btn-tertiary {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(236, 239, 244, 0.55);
}
.overlay-buttons--primary .btn-tertiary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(236, 239, 244, 0.78);
}
[data-theme="light"] .overlay-buttons--primary .btn-tertiary {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #6B7280;
}

/* v322 — Compact guest sign-in CTA. Single-row layout (no avatar):
 *   [Title + sub] · spacer · [Sign in] [Sign up]
 * Per user 2026-05-11: "make sign in/up container more compact, no
 * avatar needed there". Tile-styled per v318 vocab. */
.moyako-guest-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0) 50%),
    linear-gradient(135deg, rgba(76, 175, 80, 0.14) 0%, rgba(33, 150, 243, 0.10) 100%);
  border: 1px solid rgba(76, 175, 80, 0.32);
  border-radius: 12px;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.06) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.15) inset,
    0 4px 10px rgba(76, 175, 80, 0.08);
}
.moyako-guest-cta__body {
  flex: 1;
  min-width: 0;
}
.moyako-guest-cta__title {
  font-size: 13px;
  font-weight: 700;
  color: #ECEFF4;
  line-height: 1.2;
  margin-bottom: 2px;
}
.moyako-guest-cta__sub {
  font-size: 11px;
  color: rgba(236, 239, 244, 0.62);
  line-height: 1.3;
}
.moyako-guest-cta__actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex: 0 0 auto;
}
.moyako-guest-cta .btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  border: 1px solid transparent;
  transition: transform 0.12s ease-out, background 0.15s;
  white-space: nowrap;
}
.moyako-guest-cta__signin {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(236, 239, 244, 0.82);
}
.moyako-guest-cta__signin:hover { background: rgba(255, 255, 255, 0.10); }
.moyako-guest-cta__signup {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(76, 175, 80, 0.32);
}
.moyako-guest-cta__signup:hover { transform: translateY(-1px); }

/* v366 (2026-05-12) — DESIGN-RULES §5.6 proposal #3: post-game native
 * ad lives inside .overlay-narrative as a slide that fades in 3s
 * after the overlay opens (so the win-message reads first). Sized
 * compactly (max 72px tall) so it doesn't dominate the narrative.
 * Hidden when empty so we don't show a blank box. */
.gameend__ad[data-narrative-ad] {
  margin: 8px 0 0 0;
  min-height: 0;
  max-height: 120px;
  overflow: hidden;
  opacity: 0;
  animation: gameendAdFadeIn 320ms ease-out 3s forwards;
}
.gameend__ad[data-narrative-ad]:empty {
  display: none !important;
  animation: none;
}
@keyframes gameendAdFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .gameend__ad[data-narrative-ad] {
    animation: none;
    opacity: 1;
  }
}

/* v351 (2026-05-12) — single-line banner with inline hyperlinks.
 * Replaces the side-by-side button pair with a conversational
 * sentence: "Please sign in / Sign Up to save your progress".
 * Compact horizontal banner appropriate for the new above-cards
 * position. */
.moyako-guest-cta--banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #ECEFF4;
}
.moyako-guest-cta--banner .moyako-guest-cta__message {
  text-align: center;
}
.moyako-guest-cta__link {
  color: #4CAF50;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.moyako-guest-cta__link:hover {
  color: #66BB6A;
}
[data-theme="light"] .moyako-guest-cta--banner { color: #0F172A; }
[data-theme="light"] .moyako-guest-cta__link    { color: #2E7D32; }
[data-theme="light"] .moyako-guest-cta__link:hover { color: #1B5E20; }
[data-theme="light"] .moyako-guest-cta {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 50%),
    linear-gradient(135deg, rgba(76, 175, 80, 0.10) 0%, rgba(33, 150, 243, 0.08) 100%);
}
[data-theme="light"] .moyako-guest-cta__title { color: #0F172A; }
[data-theme="light"] .moyako-guest-cta__sub   { color: #4A5568; }
[data-theme="light"] .moyako-guest-cta__signin {
  background: #FFFFFF;
  border-color: #D1D5DB;
  color: #1F2937;
}

/* v318 — Rewarded Modal styled as a premium Moyako tile.
 *
 * Per user 2026-05-11: "rewarded screen and containers with our tile
 * style, stylish". Upgrades the basic card to the same solid-3D tile
 * aesthetic used elsewhere (DESIGN-RULES §3.18) — inset highlights for
 * depth, accent top-border in brand green, sub-tile containers for the
 * panda crown + reward badge + action row. Everything reads as a stack
 * of Moyako tiles instead of a generic dialog.
 */
.moyako-rewarded-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex !important; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.75) 100%);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  padding: 20px;
  animation: moyakoRewardedFadeIn 0.22s ease-out;
}
.moyako-rewarded-overlay.is-leaving { animation: moyakoRewardedFadeOut 0.18s ease-out forwards; }
@keyframes moyakoRewardedFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes moyakoRewardedFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Outer tile — the dialog itself.
 * Tile-style: linear-gradient bg, brand-green top accent border, inset
 * top highlight for depth, outset bottom shadow for elevation. */
.moyako-rewarded-card {
  /* v367 (2026-05-12): removed green top-border accent stripe per user.
   * Card now has uniform 1px border on all sides. Padding-top trimmed
   * to 20px (was 28px) since the panda no longer juts above the card. */
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0) 32%),
    linear-gradient(165deg, #2A3142 0%, #1C2233 100%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  padding: 20px 22px 20px;
  max-width: 380px; width: 100%; text-align: center;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.06) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.30) inset,
    0 24px 60px rgba(0, 0, 0, 0.55);
  animation: moyakoRewardedScale 0.28s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes moyakoRewardedScale {
  from { transform: scale(0.90) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0);     opacity: 1; }
}

/* Panda mascot — v367: keep inside the card (was margin-top: -52px
 * pulling it above the card boundary, which read as "cut from top").
 * Now sits fully inside the card with normal top spacing. */
.moyako-rewarded-panda {
  display: block; margin: 0 auto 12px;
  width: 96px; height: 96px;
  padding: 6px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(160deg, #2F3648 0%, #1E2535 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  object-fit: contain;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.30),
    0 1px 0 0 rgba(255, 255, 255, 0.08) inset;
}
.moyako-rewarded-title {
  margin: 4px 0 6px;
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
  color: #ECEFF4;
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.moyako-rewarded-body {
  margin: 0 0 18px;
  font-size: 14px; line-height: 1.5;
  color: rgba(236, 239, 244, 0.72);
  padding: 0 4px;
}

/* Reward pill — its own mini-tile. Gold-trimmed brand-green vibe so
 * the actual reward "pops" above body copy. */
.moyako-rewarded-reward {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; margin-bottom: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0) 50%),
    linear-gradient(135deg, rgba(76, 175, 80, 0.28) 0%, rgba(56, 142, 60, 0.18) 100%);
  border: 1px solid rgba(76, 175, 80, 0.50);
  border-radius: 999px;
  font-size: 15px; font-weight: 700;
  color: #A5D6A7;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.08) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.18) inset,
    0 6px 16px rgba(76, 175, 80, 0.22);
}
.moyako-rewarded-reward-icon {
  font-size: 18px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.moyako-rewarded-reward-text strong {
  color: #FFFFFF;
  font-weight: 800;
  font-size: 16px;
}

/* Action row — 2-up button tiles. */
.moyako-rewarded-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.moyako-rewarded-actions .btn {
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease-out, box-shadow 0.15s, background 0.15s;
  position: relative;
}
.moyako-rewarded-actions .btn-secondary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0) 60%),
    rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(236, 239, 244, 0.78);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.06) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.2) inset;
}
.moyako-rewarded-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.moyako-rewarded-actions .btn-secondary:active { transform: translateY(1px); }
.moyako-rewarded-actions .btn-primary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 50%),
    linear-gradient(135deg, #66BB6A 0%, #388E3C 100%);
  color: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.30) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.18) inset,
    0 8px 18px rgba(76, 175, 80, 0.45);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}
.moyako-rewarded-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.35) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.18) inset,
    0 10px 24px rgba(76, 175, 80, 0.55);
}
.moyako-rewarded-actions .btn-primary:active { transform: translateY(0); }

/* Light theme harmonization — keep the tile aesthetic, swap colors. */
[data-theme="light"] .moyako-rewarded-card {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 32%),
    linear-gradient(165deg, #FFFFFF 0%, #F2F5FA 100%);
  border-color: #D1D5DB;
  border-top: 3px solid #4CAF50;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.6) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.05) inset,
    0 24px 60px rgba(0, 0, 0, 0.18),
    0 6px 18px rgba(76, 175, 80, 0.12);
}
[data-theme="light"] .moyako-rewarded-panda {
  background:
    radial-gradient(circle at 50% 35%, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0) 60%),
    linear-gradient(160deg, #FFFFFF 0%, #E8EAED 100%);
  border-color: #D1D5DB;
}
[data-theme="light"] .moyako-rewarded-title { color: #0F172A; text-shadow: none; }
[data-theme="light"] .moyako-rewarded-body  { color: #4A5568; }
[data-theme="light"] .moyako-rewarded-reward-text strong { color: #1F2937; }
[data-theme="light"] .moyako-rewarded-actions .btn-secondary {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 50%),
    #FFFFFF;
  border-color: #D1D5DB;
  color: #4A5568;
}

/* Toast — also tile-styled (pill with inset highlight + brand halo). */
.moyako-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 10001;
  display: inline-flex; align-items: center; gap: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0) 50%),
    linear-gradient(165deg, #2F3648 0%, #1C2233 100%);
  color: #ECEFF4;
  padding: 11px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.06) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.20) inset,
    0 12px 28px rgba(0, 0, 0, 0.45);
  animation: moyakoToastIn 0.26s cubic-bezier(0.22, 1.2, 0.36, 1);
  max-width: calc(100vw - 40px);
}
.moyako-toast.is-out { animation: moyakoToastOut 0.25s ease-out forwards; }
@keyframes moyakoToastIn  { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes moyakoToastOut { from { opacity: 1; } to { transform: translate(-50%, 12px); opacity: 0; } }
[data-theme="light"] .moyako-toast {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 50%),
    #FFFFFF;
  color: #0F172A;
  border-color: #D1D5DB;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.6) inset,
    0 -1px 0 0 rgba(0, 0, 0, 0.04) inset,
    0 12px 28px rgba(0, 0, 0, 0.18);
}
/* v309 — checkmark on selected tier. Pseudo-element so we don't need
 * to rewire button content. ::after positions top-right of the button. */
[data-moyako-v2] .difficulty.is-selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
[data-moyako-v2] .difficulty { position: relative; }
[data-moyako-v2] .difficulty-emoji { font-size: 20px; line-height: 1; }

/* v304 (2026-05-11): difficulty dot indicator.
 * Replaces tier emojis (🐣 🙂 🧠 🔥 🏆 🎯) with colored dots that match
 * the .difficulty-badge palette used on game-tile badges (games.html).
 * Same visual language picker-tier ↔ game-card-badge for clarity.
 *
 * Beginner / Easy / Medium / Hard / Expert / Auto get distinct hues.
 * Existing 3 badge colors extended with: Beginner (lighter green),
 * Expert (purple), Auto (cyan).
 */
[data-moyako-v2] .difficulty-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 12px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}
[data-moyako-v2] [data-tier="beginner"] .difficulty-dot { background: #A5D6A7; }
[data-moyako-v2] [data-tier="easy"]     .difficulty-dot { background: #81C784; }
[data-moyako-v2] [data-tier="medium"]   .difficulty-dot { background: #FFB74D; }
[data-moyako-v2] [data-tier="hard"]     .difficulty-dot { background: #EF5350; }
[data-moyako-v2] [data-tier="expert"]   .difficulty-dot { background: #9C27B0; }
[data-moyako-v2] [data-tier="auto"]     .difficulty-dot { background: #29B6F6; }
[data-theme="light"] [data-moyako-v2] .difficulty-dot {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}
[data-moyako-v2] .difficulty-label { flex: 1; font-weight: 500; }
[data-moyako-v2] .difficulty-hint {
  font-size: var(--font-size-small); color: var(--text-tertiary);
}
[data-moyako-v2] .difficulty.is-selected .difficulty-hint::before {
  content: '✓ '; color: var(--success); font-weight: 700;
}

/* ============================================================
 * Solid-3D inputs (v171, 2026-05-08, DESIGN-RULES §3.18)
 * ------------------------------------------------------------
 * Form inputs use the same tile aesthetic as containers — surface
 * bg with INSET shadow for press-in depth, theme-aware border, and
 * a smooth focus highlight. Beats per-page input rules via the
 * [data-moyako-v2] selector specificity.
 * Per user 2026-05-08: "input fields also solid-3d style add to
 * the design rules as well".
 * ============================================================ */
[data-moyako-v2] input[type="text"],
[data-moyako-v2] input[type="email"],
[data-moyako-v2] input[type="password"],
[data-moyako-v2] input[type="number"],
[data-moyako-v2] input[type="search"],
[data-moyako-v2] input[type="tel"],
[data-moyako-v2] input[type="url"],
[data-moyako-v2] textarea,
[data-moyako-v2] select,
[data-moyako-v2] .form-container input[type="text"],
[data-moyako-v2] .form-container input[type="email"],
[data-moyako-v2] .form-container input[type="password"],
[data-moyako-v2] .form-container select {
  background: var(--bg-surface, var(--card-bg)) !important;
  border: 1px solid var(--border, var(--border-color)) !important;
  border-radius: 10px !important;
  color: var(--text-primary, var(--text-light)) !important;
  padding: 12px 14px !important;
  font-size: 15px !important;
  font-family: inherit !important;
  width: 100% !important;
  box-sizing: border-box !important;
  /* 3D inset — recessed top edge (dark), bright bottom edge (raised
   * border highlight), soft outer shadow for surface depth. */
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.30),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.03) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

[data-moyako-v2] input:focus,
[data-moyako-v2] textarea:focus,
[data-moyako-v2] select:focus {
  outline: none !important;
  border-color: var(--action, #4CAF50) !important;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.30),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 3px rgba(76, 175, 80, 0.18) !important;
}

[data-moyako-v2] input::placeholder,
[data-moyako-v2] textarea::placeholder {
  color: var(--text-muted, var(--text-tertiary));
  opacity: 0.75;
}

/* Light theme — silver-gradient surface, dark text, soft top
 * highlight for the raised look. */
html[data-theme="light"] [data-moyako-v2] input[type="text"],
html[data-theme="light"] [data-moyako-v2] input[type="email"],
html[data-theme="light"] [data-moyako-v2] input[type="password"],
html[data-theme="light"] [data-moyako-v2] input[type="number"],
html[data-theme="light"] [data-moyako-v2] input[type="search"],
html[data-theme="light"] [data-moyako-v2] input[type="tel"],
html[data-theme="light"] [data-moyako-v2] input[type="url"],
html[data-theme="light"] [data-moyako-v2] textarea,
html[data-theme="light"] [data-moyako-v2] select {
  background: linear-gradient(180deg, #FFFFFF 0%, #F2F5FB 100%) !important;
  border-color: rgba(15, 23, 42, 0.18) !important;
  color: #0F172A !important;
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.50) !important;
}
