/*
 The Great Keyboard Adventure (C0362): styles.css.

 One stylesheet, no @import, no remote font, no remote anything. Fonts are the system stack: this unit has
 no copy of the Studio's self-hosted woff2 files, and loading them from an absolute site path would break
 the promise that this folder can be moved as it stands. A @font-face block goes in at the top of this file
 when the folder lands beside /assets/fonts/.

 The accessibility floor from evidence/phase1-architecture-contract.json is implemented here and marked, so
 a reviewer can find each item rather than take it on trust:
   3px focus-visible outlines on every control            -> ":focus-visible" rules, and VK_FOCUS_CSS below
   44px minimum touch targets, 48px preferred             -> "button { min-height: 48px; min-width: 48px }"
   the blanket prefers-reduced-motion rule                -> at the end of the file
   viewport-fit=cover with env(safe-area-inset-*) padding -> body padding
   layered 100vh / 100svh / 100dvh                        -> body min-height
*/

:root {
  --ink: #23262f;
  --ink-soft: #4d5260;
  --paper: #fbf6ec;
  --card: #ffffff;
  --card-edge: #e0d6c2;
  --warm: #d4712f;
  --warm-deep: #9c3f1c;
  --moss: #2f6b46;
  --moss-soft: #e3f1e8;
  --plum: #54306e;
  --plum-soft: #efe6f7;
  --sky-soft: #e4eef8;
  --glow: #f2c75c;
  --radius: 14px;
  --shadow: 0 2px 0 rgba(35, 38, 47, 0.12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.5;
  overscroll-behavior: none;
  padding:
    max(10px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

h1 { font-size: clamp(1.5rem, 4.5vw, 2.2rem); line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: clamp(1.25rem, 3.5vw, 1.6rem); line-height: 1.25; margin: 0 0 8px; }
p { margin: 0 0 10px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  /* The 44px floor applies to the control itself, not only once it is focused: the browser check measures
     it in its resting state. */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
/* The skip link is held to the same 44px floor as every other control. It measured 24px, which the
   post-remediation browser check caught and recorded as a fault rather than hiding. */
.skip:focus-visible {
  left: 8px;
  top: 8px;
  z-index: 20;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 10px 14px;
}

/* ------------------------------------------------------------------ controls */

button {
  font: inherit;
  min-height: 48px;
  min-width: 48px;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:hover { background: #fff8ea; }
button:active { transform: translateY(1px); }

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--plum);
  outline-offset: 3px;
}

button.primary {
  background: var(--moss);
  border-color: #1f4a30;
  color: #fff;
  font-weight: 700;
}
button.primary:hover { background: #387d52; }

button[aria-disabled="true"] {
  cursor: default;
  opacity: 1;
  background: #f1ece1;
  border-style: dashed;
  color: var(--ink-soft);
}
button[aria-disabled="true"]:active { transform: none; }

button[aria-pressed="true"] {
  background: var(--plum-soft);
  border-color: var(--plum);
}

input[type="text"] {
  font: inherit;
  min-height: 48px;
  width: 100%;
  max-width: 22rem;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

/* ------------------------------------------------------------------ chrome */

#topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

#studio-link {
  color: var(--plum);
  font-weight: 700;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 4px 6px;
}

.topbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
.topbar-controls button { font-size: 0.9rem; padding: 8px 12px; }

#profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  background: var(--card);
  border: 2px solid var(--card-edge);
  border-radius: 999px;
  padding: 4px 14px 4px 6px;
  min-height: 44px;
}
.badge-art { display: inline-flex; width: 40px; height: 38px; }
.badge-art svg { width: 100%; height: 100%; }

#banner {
  background: var(--moss-soft);
  border: 2px solid #bcd9c6;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 10px;
  font-weight: 600;
}

.warning {
  background: #fdf1dc;
  border: 2px solid var(--warm);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 10px;
}

/* ------------------------------------------------------------------ screens */

.screen {
  max-width: 62rem;
  margin: 0 auto 16px;
}

[hidden] { display: none !important; }

.lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 44rem; }
.hint-text { font-size: 0.95rem; color: var(--ink-soft); max-width: 44rem; }
.group-label { font-weight: 700; margin: 0 0 6px; }
.field { margin: 0 0 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }

/* ------------------------------------------------------------------ welcome */

.companion-stage {
  display: flex;
  justify-content: center;
  min-height: 160px;
}
.companion-stage svg { max-width: 60vw; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.avatar-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 190px;
  text-align: center;
}
.avatar-art { display: block; width: 92px; height: 86px; }
.avatar-art svg { width: 100%; height: 100%; }
.avatar-name { font-weight: 700; }
.avatar-words { font-size: 0.85rem; color: var(--ink-soft); }
.avatar-choice[aria-pressed="true"] {
  background: var(--glow);
  border-color: var(--warm-deep);
  border-width: 3px;
}

/* ------------------------------------------------------------------ menu */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  min-height: 108px;
  padding: 14px 16px;
}
.menu-card-title { font-size: 1.15rem; font-weight: 700; }
.menu-card-sub { font-size: 0.92rem; color: var(--ink-soft); font-weight: 400; }
.menu-card.primary .menu-card-sub { color: #e8f3ec; }
.menu-card.unbuilt .menu-card-sub strong { color: var(--warm-deep); }

/* ------------------------------------------------------------------ worlds */

.world-list, .lesson-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.world-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 2px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 0 14px 14px;
  overflow: hidden;
}
.world-card.locked { background: #f4f0e6; }
.practice-spelling { max-width: 640px; margin: 20px auto; padding: 20px; border: 2px solid #75998c; border-radius: 18px; background: #f3faf4; color: #203a32; }
.practice-spelling h2 { margin-top: 0; }
.practice-spelling label { display: block; font-weight: 700; margin-bottom: 8px; }
.practice-spelling input { width: 100%; min-width: 0; min-height: 48px; box-sizing: border-box; font: inherit; font-size: 20px; padding: 8px; }
.practice-spelling-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.practice-spelling-actions button { min-height: 48px; }
.practice-spelling [role="status"] { margin-bottom: 0; }
.world-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.world-illustration { grid-column: 1 / -1; margin: 0 -14px 2px; background: #dbe3cd; }
.world-scene { display: block; width: 100%; height: auto; aspect-ratio: 5 / 2; }
.world-view-art { max-width: 700px; margin: 0 0 18px; border-radius: 18px; overflow: hidden; border: 2px solid var(--card-edge); }
.world-name { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 6px; }
@media (max-width: 720px) {
  .world-list { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 420px) {
  .world-card { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; }
  .world-card .world-open, .world-card .world-lock { grid-column: 2; justify-self: start; }
  .world-card .world-number { width: 38px; height: 38px; }
}

.world-number {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--plum-soft);
  border: 2px solid var(--plum);
  font-weight: 700;
}
.world-card.locked .world-number { background: #e8e2d4; border-color: #b6ab93; color: var(--ink-soft); }

.world-body { display: flex; flex-direction: column; flex: 1 1 auto; }
.world-name { font-size: 1.05rem; }
.world-teaches { font-size: 0.9rem; color: var(--ink-soft); }
.world-state { font-size: 0.88rem; color: var(--warm-deep); font-weight: 600; }

.world-lock {
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  border: 2px dashed #b6ab93;
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 44px;
  display: grid;
  place-items: center;
}

/* ------------------------------------------------------------------ lessons */

.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 2px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.lesson-row.locked { background: #f4f0e6; border-style: dashed; }
.lesson-row-body { display: flex; flex-direction: column; flex: 1 1 auto; }
.lesson-row-name { font-weight: 700; }
.lesson-row-note { font-size: 0.88rem; color: var(--ink-soft); }
.lesson-row-state { font-size: 0.88rem; font-weight: 600; color: var(--moss); }

.lesson-head { margin-bottom: 10px; }
.lesson-where, .lesson-count { margin: 0; font-size: 0.95rem; color: var(--ink-soft); }
.lesson-instruction { font-size: 1.15rem; font-weight: 600; }

.voice-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--plum);
  background: var(--plum-soft);
  border: 2px solid var(--plum);
  border-radius: 999px;
  padding: 2px 10px;
}

.prompt-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}
.prompt-heading { font-size: clamp(1.2rem, 4vw, 1.7rem); font-weight: 700; margin: 0 0 6px; }
.prompt-detail { font-size: 1rem; color: var(--ink-soft); margin: 0 0 6px; }
.prompt-big {
  font-size: clamp(2.6rem, 14vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  margin: 6px 0 0;
  letter-spacing: 0.04em;
}

/*
 Where a single lowercase letter is drawn, big and small, rather than printed. See paintBig in main.mjs:
 a lowercase l in a system font is a bare upright bar and a child reads it as a capital I or a 1.
*/
.big-art { display: flex; justify-content: flex-start; margin: 6px 0 0; }
.big-art svg { max-width: 100%; height: auto; }

.tile-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 52px; align-items: center; }

.tile {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 48px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #f4efe4;
  font-weight: 700;
  font-size: 1.2rem;
}
.tile.named { font-size: 0.85rem; }
.tile.extra { border-color: var(--warm-deep); background: #fdf1dc; }
.tile.empty { border-style: dashed; color: var(--ink-soft); background: #fff; }

.typed-area { margin: 0 0 12px; }
.typed-label { font-size: 0.9rem; color: var(--ink-soft); margin: 0 0 4px; }

.feedback {
  border: 2px solid var(--moss);
  background: var(--moss-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 600;
}
.feedback.gentle {
  border-color: var(--warm);
  background: #fdf1dc;
}

.hint-panel {
  border: 3px dashed var(--plum);
  background: var(--plum-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 12px;
}
.hint-step { font-size: 0.85rem; font-weight: 700; color: var(--plum); margin: 0 0 4px; }
.hint-words { margin: 0 0 8px; }
.hint-visual { display: flex; justify-content: center; }
.hint-visual svg { max-width: 100%; }

.lesson-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.physical-note { font-size: 0.95rem; font-weight: 600; color: var(--moss); }

.finished-card {
  background: var(--card);
  border: 3px solid var(--moss);
  border-radius: 18px;
  padding: 16px;
}

/* ------------------------------------------------------------------ keyboard picture */

#keyboard-area {
  max-width: 62rem;
  margin: 0 auto 16px;
  background: var(--sky-soft);
  border: 2px solid #b9cfe4;
  border-radius: var(--radius);
  padding: 10px;
}
.keyboard-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.keyboard-title { font-weight: 700; margin: 0; }
.keyboard-head button { margin-left: auto; font-size: 0.9rem; }
.keyboard-honesty { font-size: 0.9rem; color: var(--ink-soft); margin: 6px 0 10px; }
.keyboard-slide-note { font-size: 0.9rem; font-weight: 600; color: var(--plum); margin: 8px 0 0; }

/*
 The picture of the keyboard scrolls sideways rather than shrinking.

 virtual-keyboard.mjs sets min-width:44px and min-height:48px on every key as an inline style, which is the
 accessibility floor and which a stylesheet cannot lower. A full UK row is 14 keys, so the picture needs
 about 700px and a phone has 390. The choice is therefore between breaking the 44px floor and letting the
 picture slide, and the floor wins: the keys stay 44px and this container scrolls. overscroll-behavior
 keeps that scroll inside the container so the page itself never moves sideways.
*/
#vk-mount {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.ka-vk { user-select: none; min-width: max-content; }
.ka-vk-row { display: flex; gap: 4px; }

.ka-vk-key {
  min-width: 44px;
  min-height: 48px;
  padding: 2px;
  border: 2px solid #41566b;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 2px 0 rgba(35, 38, 47, 0.14);
}

/* Exported from virtual-keyboard.mjs as FOCUS_CSS, so the page and the suite share one source. */
.ka-vk-key:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }

.ka-vk-key[data-pressed="true"] { background: var(--glow); border-color: var(--warm-deep); }
.ka-vk-key[data-asked="true"] { background: var(--moss-soft); border-color: var(--moss); border-width: 3px; }
.ka-vk-key[data-glow="true"] {
  background: var(--glow);
  border-color: var(--warm-deep);
  border-width: 3px;
  box-shadow: 0 0 0 4px rgba(242, 199, 92, 0.55);
  animation: ka-glow 1.4s ease-in-out infinite;
}
.ka-vk-key[aria-disabled="true"] { background: #eceadf; color: var(--ink-soft); }
.ka-vk-note { font-size: 0.92rem; margin: 8px 0 0; min-height: 1.4em; color: var(--plum); font-weight: 600; }

@keyframes ka-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(242, 199, 92, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(242, 199, 92, 0.25); }
}

/* ------------------------------------------------------------------ dialogs */

dialog {
  max-width: 34rem;
  width: calc(100% - 32px);
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  padding: 18px;
}
dialog::backdrop { background: rgba(35, 38, 47, 0.55); }

.setting { margin: 0 0 16px; }
.setting-row { display: flex; flex-wrap: wrap; gap: 6px; }
.setting.danger { border-top: 2px dashed var(--card-edge); padding-top: 14px; }

.profile-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.profile-row { display: flex; gap: 8px; align-items: center; }
.profile-row button { flex: 1 1 auto; justify-content: flex-start; text-align: left; }
.profile-row .remove { flex: 0 0 auto; font-size: 0.85rem; }
.profile-row [aria-pressed="true"] { background: var(--moss-soft); border-color: var(--moss); }

/* ------------------------------------------------------------------ immersive fallback */

/*
 Fullscreen is implemented in this game, glowtrail-arena style: a CSS viewport fallback is applied first,
 then native fullscreen is attempted, and the class is removed when native succeeds. The shared controller
 at /studio/fullscreen.js is not loaded, because it returns immediately unless the slug is added to one of
 its hard-coded arrays, and that file is outside this unit. That is the paint-parade bug and it is avoided
 by not pretending.
*/
html.immersive, html.immersive body {
  height: var(--visible-viewport-height, 100dvh);
  overflow: hidden;
}
html.immersive body {
  padding-top: max(6px, env(safe-area-inset-top));
  overflow-y: auto;
  overscroll-behavior: contain;
}
html.immersive #topbar { position: sticky; top: 0; z-index: 10; background: var(--paper); }
html.immersive #studio-link { font-size: 0.9rem; }

/* A quiet paper-and-ink space beside the keyboard adventure. */
.family-eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 800; color: var(--warm-deep); }
.story-shelf, .report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; margin: 24px 0; }
.story-card { display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: 12px; gap: 8px; border-left: 8px solid var(--moss); }
.story-card canvas { width: 100%; height: auto; border-bottom: 1px solid var(--card-edge); }
.story-card strong { overflow-wrap: anywhere; }
.story-card span { font-size: .85rem; }
.story-paper, .report-card { padding: clamp(14px, 3vw, 26px); background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--radius); }
.story-paper { margin: 20px 0; box-shadow: 4px 5px 0 var(--card-edge); }
.report-card h3 { font-size: 1rem; margin: 18px 0 4px; }
#screen-editor label { display: block; font-weight: 700; margin: 12px 0 6px; }
#story-title, #story-text { width: 100%; max-width: 100%; border: 2px solid var(--card-edge); border-radius: 8px; padding: 12px; font: inherit; color: var(--ink); background: var(--card); }
#story-text { line-height: 1.7; resize: vertical; min-height: 160px; }
#story-drawing { display: block; width: 100%; height: auto; aspect-ratio: 5 / 3; border: 2px solid var(--card-edge); border-radius: 8px; touch-action: none; background: #fffdf8; }
#story-inks [aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 1px; }
#story-text:focus-visible, #story-drawing:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
#screen-editor .story-finish { display: flex; align-items: center; gap: 10px; min-height: 48px; }
#story-finished { width: 24px; height: 24px; flex-shrink: 0; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 520px) {
  body { font-size: 1rem; }
  /* The key size is not touched here. It is the 44px floor and it is set inline by the module. */
  .ka-vk-key { font-size: 0.8rem; padding: 0 2px; }
  .ka-vk-row { gap: 3px; }
  .companion-stage { min-height: 120px; }
  .topbar-controls { width: 100%; margin-left: 0; }
}

/* ------------------------------------------------------------------ reduced motion */

/* The blanket rule, verbatim in the pattern every other first-party game uses. */
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  button:active { transform: none; }
  .ka-vk-key[data-glow="true"] { box-shadow: 0 0 0 5px rgba(242, 199, 92, 0.55); }
}

/*
 The same again, driven by the saved setting rather than by the device, because a grown-up may want less
 movement on a device that has not been told to ask for it.
*/
html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *:before,
html[data-reduced-motion="true"] *:after {
  animation: none !important;
  transition: none !important;
}
html[data-reduced-motion="true"] button:active { transform: none; }
.name-activity { max-width: 720px; margin: 0 auto; }
.name-garden-art { max-width: 440px; margin: 0 auto; }
.name-garden-art svg { width: 100%; height: auto; display: block; }
.name-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px 0; margin: 0; list-style: none; }
.name-slot { display: grid; place-items: center; min-width: 44px; min-height: 62px; padding: 4px 8px; background: #ede2c9; border: 2px solid #8c7953; border-radius: 9px; color: #3b453a; }
.name-slot > span { font: 700 28px Georgia, serif; }
.name-slot small { font-size: 12px; line-height: 1.2; }
.name-slot.lit { background: #fff4be; }
.name-slot.marked { border: 3px solid #255d51; box-shadow: 0 4px 0 #255d51; }
.name-choices { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.name-choices button { min-width: 56px; min-height: 52px; font: 700 28px Georgia, serif; }
.name-choices .name-undo { font-size: 18px; padding: 8px 12px; }
.name-writing { padding: 10px; border-bottom: 2px solid #8c7953; font: 700 26px Georgia, serif; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-height: 500px) { .name-garden-art { display: none; } }
.name-choices .name-picture-choice { flex: 1 1 180px; max-width: 230px; padding: 8px; font-size: 18px; text-align: left; }
.name-picture-choice svg, .name-page-art svg, .story-picture svg, .story-card svg { display: block; width: 100%; height: auto; border-radius: 9px; }
.name-page-art { max-width: 480px; margin: 12px auto; border: 6px solid #fff5d9; box-shadow: 0 3px 8px #243f4230; }
.story-picture { max-width: 600px; margin: 12px auto; }
.name-page-status { font-size: .9rem; padding: 10px; border-left: 3px solid var(--moss); text-align: left; }
@media (max-width: 480px) { .name-choices .name-picture-choice { flex-basis: 100%; max-width: none; display: flex; align-items: center; gap: 8px; } .name-picture-choice svg { width: 45%; flex-shrink: 0; } }

/* The local sound explorer shares the compact name-activity shell. */
#sound-scene { max-width: 250px; margin: 6px auto; }
#sound-scene svg { display: block; width: 100%; height: auto; border-radius: 12px; }
#sound-ready { font-weight: 700; font-size: 15px; margin: 4px 0; }
#sound-progress { font-size: 13px; margin: 4px 0; color: var(--moss); }
#sound-private-cue { font-size: 20px; line-height: 1.5; }
.sound-play #profile-badge { display: none; }
@media (min-width: 650px) and (max-height: 540px) {
  #sound-scene { display: none; }
  .sound-play .prompt-detail { font-size: 12px; }
}
/* World 5: one question and one answer surface, not three repeated instructions. */
body.name-play { padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.name-play #topbar { gap: 4px; margin-bottom: 6px; }
.name-play .topbar-controls { gap: 4px; }
.name-play .topbar-controls button { padding: 4px 8px; min-height: 44px; font-size: 13px; }
.name-play #sound, .name-play #voice { white-space: pre-line; font-size: 12px; line-height: 1.1; padding: 2px 6px; }
.name-play #banner, .name-play .lesson-where, .name-play .lesson-instruction,
.name-play .typed-area, .name-play .physical-note, .name-play .keyboard-honesty,
.name-play .ka-vk-note, .name-play #hint-panel {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.name-play .screen { margin-bottom: 6px; }
.name-play .lesson-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.name-play .lesson-head h1 { font-size: 19px; margin: 0; }
.name-play .lesson-count { font-size: 12px; }
.name-play .prompt-card { padding: 10px; margin-bottom: 6px; border-width: 2px; background: linear-gradient(150deg, #fffef9, #f1f8ed); }
.name-play .prompt-heading { font-size: 21px; line-height: 1.2; margin-bottom: 4px; }
.name-play .prompt-detail { font-size: 13px; line-height: 1.35; margin-bottom: 4px; }
.name-play .name-garden-art { max-width: 150px; }
.name-play #name-activity:has(.name-slot:nth-child(13)) .name-garden-art { display: none; }
.name-play .name-page-art { max-width: 160px; margin: 4px auto; border-width: 3px; }
.name-play .name-slots { gap: 4px; padding: 4px 0; }
.name-play .name-slot { min-width: 25px; min-height: 38px; padding: 1px 4px; border-radius: 6px; }
.name-play .name-slot > span { font-size: 22px; line-height: 1.1; }
.name-play .name-slot small { font-size: 10px; }
.name-play .name-writing { margin: 4px 0 0; padding: 2px 6px; font-size: 22px; line-height: 1.3; }
.name-play .name-choices { gap: 6px; margin: 6px 0; }
.name-play .name-choices button { min-width: 48px; min-height: 48px; padding: 4px 8px; font-size: 24px; }
.name-play .name-choices .name-undo { font-size: 16px; }
.name-play .name-choices .name-picture-choice { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px; max-width: 200px; min-width: 0; padding: 6px; font-size: 16px; }
.name-play .name-picture-choice svg { width: 100%; max-height: 84px; }
.name-play .name-page-status { padding: 2px 6px; margin: 4px 0 0; font-size: 12px; }
.name-play .feedback { padding: 4px 8px; font-size: 14px; line-height: 1.3; margin-bottom: 4px; }
.name-play .hint-panel { padding: 4px 8px; margin-bottom: 4px; font-size: 13px; line-height: 1.3; }
.name-play .hint-step, .name-play .hint-words { margin-bottom: 2px; }
.name-play .hint-visual svg { max-height: 44px; }
.name-play .hint-panel .tile-row { min-height: 28px; gap: 3px; }
.name-play .hint-panel .tile { min-height: 28px; min-width: 24px; padding: 1px 3px; font-size: 15px; }
.name-play .lesson-actions { margin: 4px 0; gap: 6px; }
.name-play .lesson-actions button { min-height: 44px; padding: 4px 12px; font-size: 14px; }
.name-play #keyboard-area { padding: 6px; margin-bottom: 0; }
.name-play .keyboard-head { min-height: 0; }
.name-play .keyboard-title { font-size: 13px; }
.name-play #vk-toggle { display: none; } /* The same preference remains in Settings. */
.name-play #name-keyboard-note, .name-play .keyboard-slide-note { font-size: 12px; line-height: 1.25; margin: 2px 0 4px; }
.name-play #vk-mount { padding-bottom: 2px; }
.name-play .ka-vk { font-size: 14px; line-height: 1.1; }
.name-play #screen-lesson .voice-label { font-size: 12px; }
.name-play #pause-dialog { max-height: calc(var(--visible-viewport-height, 100dvh) - 24px); overflow-y: auto; }
.name-play #pause-dialog .lesson-actions { position: sticky; bottom: 0; background: var(--card); }
@media (max-width: 520px) {
  .name-play #topbar { flex-wrap: nowrap; }
  .name-play #studio-link { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .name-play #studio-link:focus { position: fixed; top: 4px; left: 4px; width: auto; height: auto; clip-path: none; z-index: 20; background: var(--paper); }
  .name-play .topbar-controls { width: 100%; justify-content: space-between; }
}
@media (min-width: 650px) and (max-height: 540px) {
  .name-play .keyboard-head { display: none; }
  .name-play:not(.name-choice-play):not(.name-finished) #game { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 10px; align-items: start; }
  .name-play #screen-lesson, .name-play #keyboard-area { width: 100%; min-width: 0; }
  .name-play .name-page-art { max-width: 96px; }
  .name-play .prompt-heading { font-size: 18px; }
  .name-play .prompt-card { padding: 6px; }
  .name-play .lesson-head { gap: 0 8px; margin-bottom: 4px; }
  .name-play .lesson-head h1 { font-size: 17px; }
  .name-play .name-slots { gap: 3px; }
  .name-play .name-slot { min-height: 32px; min-width: 21px; padding: 1px 3px; }
  .name-play .name-slot > span { font-size: 18px; }
  .name-choice-play .name-picture-choice { max-width: 180px; }
  .name-choice-play .name-picture-choice svg { max-height: 62px; }
}
