/* Word Lab — engine.css — assembled by stitch.sh. DO NOT EDIT (edit the shards). */
/* ===== 00-base.css ===== */
/* @shard engine-loop (00-base.css)
   The shared engine BASE. Loaded FIRST in engine.css; each room's room.css cascades
   AFTER and sets the --wl-* token VALUES (this file declares the token NAMES with
   neutral defaults so the engine renders sanely even before a theme loads). Owns:
   :root --wl-* token names, base layout + the #wl-* mount anchors, the loop's own
   component chrome (.wl-hud-*, .wl-reveal-*, .wl-done-*, .wl-nav, .wl-backlink,
   .wl-skip), >=44px touch targets, WCAG-AA base contrast, and the reduced-motion base.
   Component CSS for each renderer/signature is owned by its own shard (.wl-spell-*,
   .wl-comp-*, .wl-game-*, .wl-sig-*). */

/* ---------------- design tokens (NAMES declared here; rooms set the VALUES) ----------------
   Token vocabulary the rooms are expected to theme:
     --wl-bg --wl-surface --wl-surface-2 --wl-ink --wl-ink-soft --wl-line
     --wl-accent --wl-accent-ink --wl-accent-2 --wl-good --wl-warn --wl-focus
     --wl-radius --wl-radius-sm --wl-gap --wl-touch --wl-maxw --wl-shadow
     --wl-font --wl-font-display
   Neutral defaults below keep contrast AA on a plain light surface. */
:root {
  --wl-bg: #f4f6f9;
  --wl-surface: #ffffff;
  --wl-surface-2: #eaeef4;
  --wl-ink: #1b2230;        /* ~13:1 on --wl-surface */
  --wl-ink-soft: #51607a;   /* ~5.4:1 on --wl-surface */
  --wl-line: #d6dde7;
  --wl-accent: #2f5fe0;     /* white text >= 4.5:1 */
  --wl-accent-ink: #ffffff;
  --wl-accent-2: #0f9d8f;
  --wl-good: #1c8f4f;
  --wl-warn: #b9651b;
  --wl-focus: #ffb000;
  --wl-radius: 16px;
  --wl-radius-sm: 10px;
  --wl-gap: 16px;
  --wl-touch: 44px;         /* minimum touch target */
  --wl-maxw: 720px;
  --wl-shadow: 0 6px 20px rgba(20, 28, 46, 0.10);
  --wl-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --wl-font-display: var(--wl-font);
}

/* ---------------- reset + page ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wl-bg);
  color: var(--wl-ink);
  font-family: var(--wl-font);
  font-size: 18px;
  line-height: 1.5;
}

/* ---------------- skip link + nav + back-link ---------------- */
.wl-skip {
  position: absolute;
  left: -9999px; top: auto;
  background: var(--wl-surface);
  color: var(--wl-ink);
  padding: 10px 14px;
  border-radius: var(--wl-radius-sm);
  box-shadow: var(--wl-shadow);
  z-index: 9999;
}
.wl-skip:focus { left: 8px; top: 8px; }

.wl-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wl-gap);
  flex-wrap: wrap;
}
.wl-backlink {
  display: inline-flex;
  align-items: center;
  min-height: var(--wl-touch);
  padding: 0 14px;
  border-radius: var(--wl-radius-sm);
  color: var(--wl-ink);
  text-decoration: none;
  background: var(--wl-surface);
  box-shadow: var(--wl-shadow);
}
.wl-backlink:hover { background: var(--wl-surface-2); }

/* ---------------- app shell + mount anchors ---------------- */
#wl-app, .wl-app {
  display: flex;
  flex-direction: column;
  gap: var(--wl-gap);
  max-width: var(--wl-maxw);
  margin: 0 auto;
  padding: var(--wl-gap);
  min-height: 100vh;
  min-height: 100dvh;
}

#wl-hud, .wl-hud {
  display: flex;
  gap: var(--wl-gap);
  flex-wrap: wrap;
  align-items: stretch;
}
.wl-hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 8px 14px;
  background: var(--wl-surface);
  border-radius: var(--wl-radius-sm);
  box-shadow: var(--wl-shadow);
}
.wl-hud-stat b {
  font-family: var(--wl-font-display);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--wl-ink);
}
.wl-hud-stat small {
  margin-top: 4px;
  color: var(--wl-ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#wl-stage, .wl-stage {
  background: var(--wl-surface);
  border-radius: var(--wl-radius);
  box-shadow: var(--wl-shadow);
  padding: var(--wl-gap);
  min-height: 220px;
}

#wl-signature, .wl-signature {
  background: var(--wl-surface-2);
  border-radius: var(--wl-radius);
  padding: var(--wl-gap);
}

#wl-hint, .wl-hint {
  min-height: 1.5em;
  padding: 12px 16px;
  border-radius: var(--wl-radius-sm);
  background: var(--wl-surface-2);
  color: var(--wl-ink);
  border-left: 4px solid var(--wl-accent-2);
}
#wl-hint:empty, .wl-hint:empty { display: none; }

#wl-reveal, .wl-reveal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.wl-reveal-btn, .wl-reveal-next {
  min-height: var(--wl-touch);
  min-width: var(--wl-touch);
  padding: 0 18px;
  border: 0;
  border-radius: var(--wl-radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--wl-surface-2);
  color: var(--wl-ink);
  box-shadow: var(--wl-shadow);
}
.wl-reveal-next { background: var(--wl-accent); color: var(--wl-accent-ink); }
.wl-reveal-btn:hover, .wl-reveal-next:hover { filter: brightness(0.97); }
.wl-reveal-answer {
  font-family: var(--wl-font-display);
  font-size: 1.25rem;
  color: var(--wl-ink);
}
.wl-reveal-answer:empty { display: none; }

/* ---------------- end-of-session card (rendered by the loop) ---------------- */
.wl-done { text-align: center; padding: 12px 8px; }
.wl-done-title { font-family: var(--wl-font-display); margin: 0.2em 0; color: var(--wl-ink); }
.wl-done-sub { color: var(--wl-ink-soft); margin: 0.2em 0 1em; }
.wl-done-stats { display: flex; justify-content: center; gap: var(--wl-gap); flex-wrap: wrap; }
.wl-done-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 10px 16px;
  background: var(--wl-surface-2);
  border-radius: var(--wl-radius-sm);
}
.wl-done-stat b { font-family: var(--wl-font-display); font-size: 1.6rem; color: var(--wl-ink); }
.wl-done-stat small {
  margin-top: 4px;
  color: var(--wl-ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------------- focus visibility (WCAG-AA) ---------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--wl-focus);
  outline-offset: 2px;
}

/* ---------------- reduced-motion base (kills motion incl. the reveal animation) ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== render-spell.css ===== */
/* render-spell.css -- owns .wl-spell-* ONLY.
   Spelling item: Hear-it hero, replay pills, accessibility block, syllable-grouped letter
   slots, syllable-tick / wrong-pulse / tricky-shimmer / reveal-bloom keyframes.
   Mobile-first, >=44px touch (the slot overlay input is the target), WCAG-AA, reduced-motion
   safe (no flash >3Hz -- every animation period >=0.5s). Uses --wl-* tokens from 00-base.css
   with safe fallbacks so the module also renders standalone. */

.wl-spell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--wl-gap, 18px);
  width: 100%;
  font-family: var(--wl-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  color: var(--wl-fg, #2a2333);
}

/* ---- Hear-it hero + pulsing accent ring ---- */
.wl-spell-audio { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.wl-spell-hear {
  position: relative;
  width: 96px; height: 96px; min-width: 64px; min-height: 64px;
  border: none; border-radius: 50%; cursor: pointer;
  background: var(--wl-accent, #ff8c61);
  color: var(--wl-accent-ink, #ffffff);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform .15s ease, box-shadow .15s ease;
}
.wl-spell-hear:hover { transform: translateY(-2px); box-shadow: 0 9px 22px rgba(0, 0, 0, 0.22); }
.wl-spell-hear:active { transform: translateY(0); }
.wl-spell-hear:focus-visible { outline: 3px solid var(--wl-focus, #1b6ef3); outline-offset: 3px; }
.wl-spell-hear-ico { font-size: 1.7rem; line-height: 1; }
.wl-spell-hear-txt { font-size: .82rem; letter-spacing: .02em; }
.wl-spell-hear::after {
  content: ''; position: absolute; inset: -8px;
  border-radius: 50%; border: 3px solid var(--wl-accent, #ff8c61);
  opacity: .5; pointer-events: none;
  animation: wl-spell-ring 1.8s ease-out infinite;
}
@keyframes wl-spell-ring {
  0%   { transform: scale(1);    opacity: .5; }
  100% { transform: scale(1.28); opacity: 0; }
}

/* ---- replay pills ---- */
.wl-spell-pills { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.wl-spell-pill {
  min-height: 44px; padding: 0 18px;
  border-radius: 22px; border: 2px solid var(--wl-accent, #ff8c61);
  background: transparent; color: var(--wl-fg, #2a2333);
  font-weight: 600; font-size: .95rem; cursor: pointer;
}
.wl-spell-pill:hover { background: var(--wl-accent-soft, rgba(255, 140, 97, .14)); }
.wl-spell-pill:focus-visible { outline: 3px solid var(--wl-focus, #1b6ef3); outline-offset: 2px; }

/* ---- accessibility block (never audio-only) ---- */
.wl-spell-access {
  max-width: 48ch; text-align: center;
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 16px; border-radius: var(--wl-radius, 12px);
  background: var(--wl-surface-soft, rgba(0, 0, 0, .045));
}
.wl-spell-def, .wl-spell-cloze { margin: 0; font-size: 1rem; line-height: 1.5; }
.wl-spell-access-label { font-weight: 700; color: var(--wl-accent, #ff8c61); margin-right: 4px; }

/* ---- letter-slots + hidden input overlay (the >=44px touch target) ---- */
.wl-spell-entry { position: relative; width: 100%; display: flex; justify-content: center; }
.wl-spell-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; background: transparent;
  color: transparent; caret-color: transparent;
  font-size: 16px; /* >=16px stops iOS zoom-on-focus */
  cursor: pointer; opacity: 0;
}
.wl-spell-slots { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.wl-spell-cell { position: relative; display: flex; gap: 6px; padding: 6px; border-radius: 12px; }
.wl-spell-slot {
  width: 40px; height: 54px; min-width: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--wl-line, #c9c2d6); border-radius: 8px;
  background: var(--wl-surface, #ffffff);
  font-size: 1.7rem; font-weight: 700; line-height: 1;
  color: var(--wl-fg, #2a2333);
}
.wl-spell-slot-filled { border-color: var(--wl-accent, #ff8c61); }

/* correct chunk: green tick, staggered left-to-right via --wl-spell-tick-delay */
.wl-spell-cell-good { background: var(--wl-good-soft, rgba(123, 211, 137, .26)); }
.wl-spell-cell-good .wl-spell-slot { border-color: var(--wl-good, #4caf50); }
.wl-spell-cell-good::after {
  content: '\2713'; position: absolute; top: -8px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--wl-good, #4caf50); color: #fff; font-size: .82rem;
  display: flex; align-items: center; justify-content: center;
  transform: scale(0);
  animation: wl-spell-pop .3s ease forwards;
  animation-delay: var(--wl-spell-tick-delay, 0ms);
}
@keyframes wl-spell-pop { to { transform: scale(1); } }

/* wrong chunk: gentle amber pulse (1.2s x2 = well under 3Hz) */
.wl-spell-cell-warn { background: var(--wl-warn-soft, rgba(240, 160, 32, .22)); }
.wl-spell-cell-warn .wl-spell-slot { border-color: var(--wl-warn, #f0a020); }
.wl-spell-cell-warn { animation: wl-spell-pulse 1.2s ease-in-out 2; }
@keyframes wl-spell-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 160, 32, 0); }
  50%      { box-shadow: 0 0 0 4px var(--wl-warn-soft, rgba(240, 160, 32, .42)); }
}

/* tricky-bit shimmer: flags the trap's POSITION, never the letter */
.wl-spell-slot-tricky {
  border-color: var(--wl-accent, #ff8c61);
  animation: wl-spell-shimmer 1.6s ease-in-out infinite;
}
@keyframes wl-spell-shimmer {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 140, 97, 0); }
  50%      { box-shadow: 0 0 10px 2px var(--wl-accent, #ff8c61); }
}

/* ---- controls ---- */
.wl-spell-controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.wl-spell-btn {
  min-height: 48px; min-width: 44px; padding: 0 22px;
  border-radius: var(--wl-radius, 12px); border: none;
  font-weight: 700; font-size: 1rem; cursor: pointer;
}
.wl-spell-btn:focus-visible { outline: 3px solid var(--wl-focus, #1b6ef3); outline-offset: 2px; }
.wl-spell-check { background: var(--wl-accent, #ff8c61); color: var(--wl-accent-ink, #fff); }
.wl-spell-hint {
  background: var(--wl-surface, #fff); color: var(--wl-fg, #2a2333);
  border: 2px solid var(--wl-line, #c9c2d6);
}
.wl-spell-reveal-btn {
  background: transparent; color: var(--wl-muted, #6b6478);
  border: 2px dashed var(--wl-line, #c9c2d6);
}

/* ---- reveal (the ONLY place the word appears) ---- */
.wl-spell-reveal { text-align: center; }
.wl-spell-reveal-label { display: block; font-size: .9rem; color: var(--wl-muted, #6b6478); margin-bottom: 6px; }
.wl-spell-reveal-word {
  display: inline-flex; font-size: 2.2rem; font-weight: 800;
  letter-spacing: .04em; color: var(--wl-fg, #2a2333);
}
.wl-spell-reveal-ch {
  display: inline-block;
  animation: wl-spell-bloom .5s ease both;
  animation-delay: calc(var(--wl-spell-bloom-i, 0) * 80ms);
}
@keyframes wl-spell-bloom {
  from { opacity: 0; transform: translateY(8px) scale(.7); }
  to   { opacity: 1; transform: none; }
}

/* ---- reduced motion: kill motion, keep meaning (answer still shown instantly) ---- */
@media (prefers-reduced-motion: reduce) {
  .wl-spell-hear::after { animation: none; opacity: .35; }
  .wl-spell-cell-good::after { animation: none; transform: scale(1); }
  .wl-spell-cell-warn { animation: none; }
  .wl-spell-slot-tricky { animation: none; box-shadow: 0 0 0 2px var(--wl-accent, #ff8c61); }
  .wl-spell-reveal-ch { animation: none; }
}
.wl-spell-reduced .wl-spell-hear::after,
.wl-spell-reduced .wl-spell-cell-good::after,
.wl-spell-reduced .wl-spell-cell-warn,
.wl-spell-reduced .wl-spell-slot-tricky,
.wl-spell-reduced .wl-spell-reveal-ch,
.wl-spell-reveal-reduced .wl-spell-reveal-ch { animation: none; }
.wl-spell-reduced .wl-spell-cell-good::after { transform: scale(1); }

/* ===== render-comprehension.css ===== */
/* @shard render-comprehension (CSS) -- owns .wl-comp-* ONLY.
   Reading-card (1.7 line-height, ~60ch measure, serif), A-/A+ stepper, warm-marker
   highlight, question docked beneath (portrait) / beside (wide). Uses --wl-* tokens
   (names declared by 00-base; values per room) with safe fallbacks. Mobile-first,
   >=44px touch targets, WCAG-AA, reduced-motion-safe (no flash >3Hz). */

.wl-comp-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 0.6rem;
  box-sizing: border-box;
}

/* --- toolbar (A-/A+ size stepper) --- */
.wl-comp-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.wl-comp-toolbar-label {
  font-size: 0.85rem;
  opacity: 0.75;
  color: var(--wl-ink, #1f1b16);
}
.wl-comp-step {
  min-height: 44px;
  min-width: 44px;
  padding: 0.4rem 0.7rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--wl-ink, #1f1b16);
  background: var(--wl-surface-2, #f4efe6);
  border: 2px solid var(--wl-line, #d8cfc2);
  border-radius: var(--wl-radius, 12px);
}
.wl-comp-step:disabled { opacity: 0.4; cursor: default; }
.wl-comp-step:focus-visible {
  outline: 3px solid var(--wl-focus, #2a6ef0);
  outline-offset: 2px;
}

/* --- passage reading-card --- */
.wl-comp-passage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.wl-comp-card {
  max-width: 60ch;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  line-height: 1.7;
  font-size: 1.05rem; /* overridden inline by the stepper */
  font-family: var(--wl-font-read, Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif);
  color: var(--wl-ink, #1f1b16);
  background: var(--wl-surface, #ffffff);
  border-radius: var(--wl-radius, 14px);
  box-shadow: var(--wl-shadow, 0 1px 3px rgba(0, 0, 0, 0.12));
}
.wl-comp-para { margin: 0 0 0.9em; }
.wl-comp-para:last-child { margin-bottom: 0; }

/* --- long-press warm-marker highlight --- */
.wl-comp-sentence {
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.wl-comp-sentence:focus-visible {
  outline: 3px solid var(--wl-focus, #2a6ef0);
  outline-offset: 2px;
}
.wl-comp-mark {
  background-image: linear-gradient(var(--wl-marker, #ffe39a), var(--wl-marker, #ffe39a));
  background-repeat: no-repeat;
  background-position: 0 90%;
  background-size: 100% 88%;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  animation: wl-comp-sweep 0.32s ease-out both;
}
@keyframes wl-comp-sweep {
  from { background-size: 0% 88%; }
  to   { background-size: 100% 88%; }
}

/* --- question card (docked beneath in portrait) --- */
.wl-comp-qcard {
  flex: 0 0 auto;
  padding: 0.9rem 1rem;
  background: var(--wl-surface, #ffffff);
  border-radius: var(--wl-radius, 14px);
  box-shadow: var(--wl-shadow, 0 -1px 4px rgba(0, 0, 0, 0.1));
}
.wl-comp-question {
  margin: 0 0 0.7rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--wl-ink, #1f1b16);
}

/* --- answers: MCQ --- */
.wl-comp-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.wl-comp-option {
  min-height: 44px;
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--wl-ink, #1f1b16);
  background: var(--wl-surface, #ffffff);
  border: 2px solid var(--wl-line, #d8cfc2);
  border-radius: var(--wl-radius, 12px);
}
.wl-comp-option-on {
  border-color: var(--wl-accent, #2a6ef0);
  box-shadow: inset 0 0 0 2px var(--wl-accent, #2a6ef0);
}
.wl-comp-option:focus-visible {
  outline: 3px solid var(--wl-focus, #2a6ef0);
  outline-offset: 2px;
}

/* --- answers: short text --- */
.wl-comp-textrow { display: flex; gap: 0.5rem; }
.wl-comp-input {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 0.6rem 0.8rem;
  font-size: 1.05rem;
  color: var(--wl-ink, #1f1b16);
  background: var(--wl-surface, #ffffff);
  border: 2px solid var(--wl-line, #d8cfc2);
  border-radius: var(--wl-radius, 12px);
}
.wl-comp-input:focus-visible {
  outline: 3px solid var(--wl-focus, #2a6ef0);
  outline-offset: 1px;
}
.wl-comp-send {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1.1rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--wl-accent-ink, #ffffff);
  background: var(--wl-accent, #2a6ef0);
  border: 2px solid var(--wl-accent, #2a6ef0);
  border-radius: var(--wl-radius, 12px);
}
.wl-comp-send:focus-visible {
  outline: 3px solid var(--wl-focus, #2a6ef0);
  outline-offset: 2px;
}

/* --- action row (Hint / Show answer) --- */
.wl-comp-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
}
.wl-comp-btn {
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--wl-ink, #1f1b16);
  background: var(--wl-surface-2, #f4efe6);
  border: 2px solid var(--wl-line, #d8cfc2);
  border-radius: var(--wl-radius, 12px);
}
.wl-comp-btn:focus-visible {
  outline: 3px solid var(--wl-focus, #2a6ef0);
  outline-offset: 2px;
}
/* Reveal stays deliberately understated -- revealing should never feel like winning. */
.wl-comp-reveal-btn {
  background: transparent;
  opacity: 0.85;
}

/* --- reveal answer region (written ONLY by revealInto, into #wl-reveal) --- */
.wl-comp-reveal {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.wl-comp-reveal-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  color: var(--wl-ink, #1f1b16);
}
.wl-comp-reveal-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--wl-ink, #1f1b16);
}
.wl-comp-reveal-anim { animation: wl-comp-fade 0.25s ease-out both; }
@keyframes wl-comp-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- wide screens: passage left, question docked beside --- */
@media (min-width: 860px) {
  .wl-comp-root {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 360px);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 1rem;
  }
  .wl-comp-toolbar { grid-column: 1 / -1; }
  .wl-comp-passage { grid-column: 1; grid-row: 2; }
  .wl-comp-qcard {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    overflow-y: auto;
  }
}

/* --- reduced motion: kill the marker sweep + reveal fade (answer still instant) --- */
.wl-comp-rm .wl-comp-mark,
.wl-comp-rm .wl-comp-reveal-anim { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .wl-comp-mark,
  .wl-comp-reveal-anim { animation: none; }
}

/* ===== render-wordgame.css ===== */
/* @shard render-wordgame (CSS) — owns .wl-game-* ONLY.
   Letter tiles / fill-gap slot / morpheme bricks; tap-or-drag-or-keyboard, >=44px.
   Uses --wl-* design tokens (names declared by 00-base.css; VALUES set per room) with
   safe fallbacks so the module also renders standalone. Reduced-motion safe (single-shot
   <=0.3s animations, NO flash >3Hz; .wl-game-rm + the media query kill all motion). */

.wl-game {
  display: flex;
  flex-direction: column;
  gap: var(--wl-gap, 16px);
  color: var(--wl-text, #1b1b2f);
  font-family: var(--wl-font-body, inherit);
}

/* visually-hidden instructions for screen readers */
.wl-game-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.wl-game-prompt {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--wl-text, #1b1b2f);
}

/* ---- the answer line of slots (anagram / morpheme) -------------------- */
.wl-game-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 52px;
}

/* ---- a single drop slot ---------------------------------------------- */
.wl-game-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
  border-radius: var(--wl-radius, 12px);
  border: 2px dashed var(--wl-accent, #5b54d6);
  background: var(--wl-slot-bg, rgba(91, 84, 214, 0.06));
  box-sizing: border-box;
}
.wl-game-slot.wl-game-placed,
.wl-game-slot:has(.wl-game-piece) {
  border-style: solid;
  background: var(--wl-slot-filled-bg, rgba(91, 84, 214, 0.14));
}
.wl-game-slot-locked {
  border-style: solid;
  border-color: var(--wl-muted, #9aa0b4);
  background: var(--wl-surface-2, rgba(0, 0, 0, 0.04));
}

/* the fill-gap inline slot sits in running text */
.wl-game-sentence {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.8;
}
.wl-game-sentence .wl-game-slot {
  vertical-align: middle;
  min-width: 96px;
  margin: 0 4px;
}

/* ---- a draggable piece (letter / word / morpheme brick) -------------- */
.wl-game-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px;
  border-radius: var(--wl-radius, 12px);
  background: var(--wl-surface-2, rgba(0, 0, 0, 0.03));
  min-height: 56px;
}

.wl-game-piece {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--wl-font-display, inherit);
  color: var(--wl-game-tile-fg, var(--wl-text, #1b1b2f));
  background: var(--wl-game-tile-bg, var(--wl-surface, #ffffff));
  border: 2px solid var(--wl-accent, #5b54d6);
  border-radius: var(--wl-radius, 12px);
  box-shadow: 0 2px 0 var(--wl-shadow, rgba(0, 0, 0, 0.18));
  cursor: pointer;
  touch-action: none;        /* let pointer-drag own the gesture, not the scroller */
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow 0.12s ease, background 0.12s ease;
}
/* anagram letters read better uppercased; value uses the raw data-val */
.wl-game-anagram .wl-game-piece { text-transform: uppercase; }

.wl-game-piece:hover { background: var(--wl-surface, #f4f3ff); }
.wl-game-piece:focus-visible {
  outline: 3px solid var(--wl-focus, #1b1b2f);
  outline-offset: 2px;
}
.wl-game-piece.wl-game-dragging {
  z-index: 50;
  box-shadow: 0 8px 18px var(--wl-shadow, rgba(0, 0, 0, 0.28));
  cursor: grabbing;
}
.wl-game-piece-locked {
  cursor: default;
  opacity: 0.92;
  border-style: solid;
  border-color: var(--wl-muted, #9aa0b4);
  box-shadow: none;
}

/* a piece sitting inside a slot loses the lift, gains snugness */
.wl-game-slot .wl-game-piece { box-shadow: none; }

/* ---- typed-gap fallback input ---------------------------------------- */
.wl-game-input {
  min-width: 120px;
  min-height: 44px;
  padding: 6px 12px;
  font-size: 1.15rem;
  font-family: var(--wl-font-display, inherit);
  color: var(--wl-text, #1b1b2f);
  background: var(--wl-surface, #ffffff);
  border: 2px solid var(--wl-accent, #5b54d6);
  border-radius: var(--wl-radius, 12px);
}
.wl-game-input:focus-visible {
  outline: 3px solid var(--wl-focus, #1b1b2f);
  outline-offset: 2px;
}

/* ---- actions row (Check / hint) -------------------------------------- */
.wl-game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.wl-game-check,
.wl-game-hint {
  min-height: 44px;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--wl-radius, 12px);
  cursor: pointer;
}
.wl-game-check {
  color: var(--wl-on-accent, #ffffff);
  background: var(--wl-accent, #5b54d6);
  border: 2px solid var(--wl-accent, #5b54d6);
}
.wl-game-hint {
  color: var(--wl-accent, #5b54d6);
  background: transparent;
  border: 2px solid var(--wl-accent, #5b54d6);
}
.wl-game-check:focus-visible,
.wl-game-hint:focus-visible {
  outline: 3px solid var(--wl-focus, #1b1b2f);
  outline-offset: 2px;
}

/* ---- reveal region (the ONLY place the answer is shown) -------------- */
.wl-game-reveal {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wl-game-reveal-label {
  font-size: 0.85rem;
  color: var(--wl-muted, #6b7080);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wl-game-reveal-word {
  font-size: 1.6rem;
  font-family: var(--wl-font-display, inherit);
  color: var(--wl-text, #1b1b2f);
}

/* ---- placement flourishes (per mode) — single-shot, reduced-motion off */
.wl-game-anagram .wl-game-piece.wl-game-snap,
.wl-game-morpheme .wl-game-piece.wl-game-snap {
  animation: wl-game-bounce 0.26s ease-out;
}
.wl-game-morpheme .wl-game-piece.wl-game-snap {
  animation: wl-game-magnet 0.24s ease-out;
}
.wl-game-fillgap .wl-game-slot.wl-game-placed {
  animation: wl-game-inhale 0.28s ease-out;
}

@keyframes wl-game-bounce {
  0%   { transform: scale(0.82); }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes wl-game-magnet {
  0%   { transform: translateX(-8px); }
  100% { transform: translateX(0); }
}
@keyframes wl-game-inhale {
  0%   { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* reduced-motion: instant placement, no keyframes, no transitions */
.wl-game-rm .wl-game-piece,
.wl-game-rm .wl-game-slot {
  animation: none !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .wl-game-piece,
  .wl-game-slot {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== signature.css ===== */
/* @shard signature-mode (CSS)
   Owns .wl-sig-* with sub-namespaces .wl-sig-garden-* (Autumn meadow, flowers, bee
   mascot) and .wl-sig-detective-* (Annabel noir case-file, red string, Cipher boss).
   SVG/CSS only, no assets. Reduced-motion -> plain fades, no flash > 3Hz.
   Uses --wl-* design tokens (declared by 00-base, valued per-room) with safe
   fallbacks so the scene reads sensibly even before a room theme cascades. */

/* ---- shared base --------------------------------------------------------- */
.wl-sig {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.wl-sig-garden-svg,
.wl-sig-detective-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--wl-radius, 12px);
  overflow: hidden;
}
.wl-sig-garden-title,
.wl-sig-detective-title {
  margin: 0 0 0.3rem;
  font-family: var(--wl-font-display, "Fredoka", "Baloo 2", system-ui, sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.wl-sig-garden-caption,
.wl-sig-detective-caption {
  margin: 0.4rem 0 0;
  font-family: var(--wl-font, system-ui, -apple-system, sans-serif);
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: center;
}

/* ===========================================================================
   SPELLING GARDEN  (Autumn) -- gentle, cumulative, no fail-state
   =========================================================================== */
.wl-sig-garden-title  { color: var(--wl-text, #4a3526); }
.wl-sig-garden-caption{ color: var(--wl-text-soft, var(--wl-text, #6b5746)); }

.wl-sig-garden-sky-top { stop-color: var(--wl-sig-sky-top, #cfeafe); }
.wl-sig-garden-sky-bot { stop-color: var(--wl-sig-sky-bot, #f1fbff); }
.wl-sig-garden-sun  { fill: #ffe07a; }
.wl-sig-garden-hill { fill: #bfe3a0; }
.wl-sig-garden-grass{ fill: #a6d678; }

.wl-sig-garden-stem  { fill: none; stroke: #4f9a36; stroke-width: 1.6; stroke-linecap: round; }
.wl-sig-garden-leaf  { fill: #62b942; }
.wl-sig-garden-core  { fill: #ffce47; }
.wl-sig-garden-petal { stroke: rgba(0, 0, 0, 0.05); stroke-width: 0.3; }

/* five warm petal hues, cycled by index via data-hue */
.wl-sig-garden-bloom[data-hue="0"] .wl-sig-garden-petal { fill: #ff9ec4; }
.wl-sig-garden-bloom[data-hue="1"] .wl-sig-garden-petal { fill: #ff8f6b; }
.wl-sig-garden-bloom[data-hue="2"] .wl-sig-garden-petal { fill: #c79bf0; }
.wl-sig-garden-bloom[data-hue="3"] .wl-sig-garden-petal { fill: #ffd166; }
.wl-sig-garden-bloom[data-hue="4"] .wl-sig-garden-petal { fill: #8fd6ff; }

/* bloom grows up from the ground -- animate the INNER grow group only */
.wl-sig-garden-grow { transform-box: fill-box; transform-origin: 50% 100%; }
.wl-sig-garden-flower.is-blooming .wl-sig-garden-grow {
  animation: wl-sig-bloom 0.85s cubic-bezier(0.2, 0.85, 0.3, 1.15) both;
}
@keyframes wl-sig-bloom {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* bee mascot: gentle float; an extra cheer bob when a new flower blooms */
.wl-sig-garden-bee-body  { fill: #ffcf3f; }
.wl-sig-garden-bee-stripe{ fill: none; stroke: #3a2e16; stroke-width: 1.4; stroke-linecap: round; }
.wl-sig-garden-bee-wing  { fill: rgba(255, 255, 255, 0.78); stroke: #d9c7a0; stroke-width: 0.4; }
.wl-sig-garden-bee-eye   { fill: #2a2113; }
.wl-sig-garden-bee-smile { fill: none; stroke: #2a2113; stroke-width: 1; stroke-linecap: round; }

.wl-sig-garden-bee-fly { transform-box: fill-box; transform-origin: 50% 50%; }
.wl-sig-garden-bee .wl-sig-garden-bee-fly {
  animation: wl-sig-bee-float 3.6s ease-in-out infinite;
}
.wl-sig-garden-bee.is-cheer .wl-sig-garden-bee-fly {
  animation: wl-sig-bee-cheer 0.8s ease-in-out;
}
@keyframes wl-sig-bee-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
@keyframes wl-sig-bee-cheer {
  0%   { transform: translateY(0)    rotate(0deg); }
  25%  { transform: translateY(-6px) rotate(-8deg); }
  50%  { transform: translateY(-2px) rotate(8deg); }
  75%  { transform: translateY(-5px) rotate(-4deg); }
  100% { transform: translateY(0)    rotate(0deg); }
}

/* ===========================================================================
   WORD DETECTIVE  (Annabel) -- noir case board, red string, Cipher boss
   =========================================================================== */
.wl-sig-detective-title  { color: var(--wl-text, #e6edf6); }
.wl-sig-detective-caption{ color: var(--wl-text-soft, var(--wl-text, #aeb9c7)); }

.wl-sig-detective-board { fill: var(--wl-sig-board, #1a2230); stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.wl-sig-detective-string { stroke: var(--wl-sig-string, #d8413b); stroke-width: 1.4; stroke-linecap: round; }

.wl-sig-detective-paper { fill: #ece6d6; stroke: #b6ad97; stroke-width: 0.6; }
.wl-sig-detective-pin   { fill: #d8413b; stroke: #8f231f; stroke-width: 0.5; }
.wl-sig-detective-ink   { stroke: #8c8470; stroke-width: 1.1; stroke-linecap: round; }
.wl-sig-detective-label {
  fill: #34302a;
  font-family: var(--wl-font, system-ui, sans-serif);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

/* the Cipher boss card -- larger, locked until the case is cracked */
.wl-sig-detective-card.is-cipher .wl-sig-detective-paper { fill: #20283a; stroke: #3c4860; }
.wl-sig-detective-card.is-cipher .wl-sig-detective-label { fill: #cdd6e2; }
.wl-sig-detective-lock-body    { fill: #6c7585; }
.wl-sig-detective-lock-shackle { fill: none; stroke: #6c7585; stroke-width: 1.6; }
.wl-sig-detective-card.is-cipher.is-revealed .wl-sig-detective-lock-body { fill: var(--wl-accent, #2ee6c5); }
.wl-sig-detective-card.is-cipher.is-revealed .wl-sig-detective-lock-shackle { stroke: var(--wl-accent, #2ee6c5); }
.wl-sig-detective-card.is-cipher.is-revealed .wl-sig-detective-label { fill: var(--wl-accent, #2ee6c5); }

/* reveal: cards fade in (+ pin-drop on the inner group); strings draw on */
.wl-sig-detective-card { opacity: 0; }
.wl-sig-detective-card.is-revealed { opacity: 1; transition: opacity 0.45s ease; }
.wl-sig-detective-card-inner { transform-box: fill-box; transform-origin: 50% 0; }
.wl-sig-detective-card.is-dropping .wl-sig-detective-card-inner {
  animation: wl-sig-pin 0.55s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
}
@keyframes wl-sig-pin {
  0%   { transform: translateY(-7px) scale(0.92); }
  60%  { transform: translateY(1px)  scale(1.02); }
  100% { transform: translateY(0)    scale(1); }
}

.wl-sig-detective-string { opacity: 0; stroke-dasharray: 1; stroke-dashoffset: 1; }
.wl-sig-detective-string.is-revealed {
  opacity: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s ease, opacity 0.3s ease;
}

/* ===========================================================================
   reduced-motion: kill all motion, keep instant reveals (both signals)
   =========================================================================== */
.wl-sig--reduced .wl-sig-garden-bee-fly,
.wl-sig--reduced .wl-sig-garden-grow,
.wl-sig--reduced .wl-sig-detective-card-inner { animation: none !important; }
.wl-sig--reduced .wl-sig-detective-card.is-revealed,
.wl-sig--reduced .wl-sig-detective-string.is-revealed { transition: opacity 0.2s linear !important; }
.wl-sig--reduced .wl-sig-detective-string.is-revealed { stroke-dashoffset: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  .wl-sig-garden-bee-fly,
  .wl-sig-garden-flower.is-blooming .wl-sig-garden-grow,
  .wl-sig-detective-card.is-dropping .wl-sig-detective-card-inner { animation: none !important; }
  .wl-sig-detective-card.is-revealed,
  .wl-sig-detective-string.is-revealed { transition: opacity 0.2s linear !important; }
  .wl-sig-detective-string.is-revealed { stroke-dashoffset: 0 !important; }
}
