/* CP-PRACTICE-01: local practice demo styles. Light Pearl/Pink/Gold surface matching the Word
   Predictor demo; base colours are the approved tokens in docs/DESIGN-SYSTEM.md. No external
   fonts or images, no glow on buttons. Motion is cosmetic and off under reduced motion. */
:root {
  --ac-primary: #6C3BFF;
  --ac-accent: #EC4899;
  --wp-ink: #2A1B3D;
  --wp-ink-muted: #5B4B6B;
  --wp-blush: #FDF2F8;
  --wp-blush-200: #FBCFE8;
  --wp-pink-deep: #DB2777;
  --wp-pink-ink: #BE185D;
  --wp-line: #E7D8EC;
  --wp-edge: #9C86AE;
  --wp-lip: #E3D0EA;
  --wp-primary-gradient: linear-gradient(135deg, #6C3BFF 0%, #A133E8 48%, #DB2777 100%);
  --wp-ring: 0 0 0 2px #FFFFFF, 0 0 0 5px var(--wp-pink-deep);
  --m-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flow-root; /* CP-EMBED-01: keep .game's top margin inside body, so the page is exactly 100vh when content is shorter */
  color: var(--wp-ink);
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif;
  line-height: 1.4;
  background:
    radial-gradient(900px 560px at 0% 0%, #FFE6F1 0%, rgba(255, 230, 241, 0) 60%),
    radial-gradient(900px 600px at 100% 100%, #FFF0CC 0%, rgba(255, 240, 204, 0) 60%),
    linear-gradient(160deg, #FFF9F6 0%, #FDF4F9 45%, #FBF6FF 70%, #FFFAF0 100%);
  background-attachment: fixed;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.game {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

@media (min-width: 600px) {
  .game {
    margin: 16px auto;
    padding: 22px 26px;
    border: 1.5px solid #FFFFFF;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 1px rgba(219, 39, 119, 0.10), 0 40px 80px -44px rgba(190, 24, 93, 0.45);
  }
}

.game-header { text-align: center; }
.eyebrow { margin: 0; color: var(--wp-pink-ink); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
h1 { margin: 2px 0 0; font-size: clamp(1.5rem, 6vw, 2rem); font-weight: 800; letter-spacing: -0.02em; }
.header-meta { margin: 6px 0 0; }
.mode-badge { padding: 2px 10px; border: 1.5px solid var(--wp-blush-200); border-radius: 999px; background: var(--wp-blush); color: var(--wp-pink-ink); font-size: 0.75rem; font-weight: 800; }
.demo-note { color: var(--wp-ink-muted); font-size: 0.8125rem; }
.instructions { margin: 0; color: var(--wp-ink-muted); font-size: 0.875rem; text-align: center; max-width: 34em; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; }
.round-label { font-weight: 700; font-size: 0.875rem; }

select,
.btn {
  min-height: 44px;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
}

select {
  padding: 0 12px;
  border: 1.5px solid var(--wp-line);
  background: #FFFFFF;
  color: var(--wp-ink);
  box-shadow: 0 3px 0 var(--wp-lip);
}

.btn { padding: 0 18px; cursor: pointer; transition: transform 200ms var(--m-spring); }
.btn:active:not(:disabled) { transform: translateY(2px) scale(0.97); }
.btn-secondary { border: 1.5px solid var(--wp-line); background: linear-gradient(180deg, #FFFFFF, #FBF7FC); color: var(--wp-ink); box-shadow: 0 3px 0 var(--wp-lip); }
.btn-primary { border: 1.5px solid rgba(255, 255, 255, 0.35); background: var(--wp-primary-gradient); color: #FFFFFF; box-shadow: 0 3px 0 #5A22C9; }
.btn-ghost { border: 1.5px dashed var(--wp-edge); background: transparent; color: var(--wp-ink-muted); }

:focus-visible { outline: none; box-shadow: var(--wp-ring); }

.stats { display: flex; gap: 8px; margin: 0; }
.stats div { min-width: 92px; padding: 6px 10px; border: 1.5px solid var(--wp-line); border-radius: 12px; background: #FFFFFF; text-align: center; }
.stats dt { color: var(--wp-ink-muted); font-size: 0.75rem; font-weight: 700; }
.stats dd { margin: 0; font-size: 1.1rem; font-weight: 900; }

/* Pattern: wraps on narrow screens so every slot keeps a >= 44px target. */
.stage { position: relative; width: 100%; }
.pattern {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1.5px solid #FFFFFF;
  border-radius: 22px;
  background: linear-gradient(180deg, #FBF4FB, #FDF6F0);
  box-shadow: inset 0 2px 6px rgba(190, 24, 93, 0.08);
}

.slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(44px, 9vw, 56px);
  height: clamp(44px, 9vw, 56px);
  padding: 0;
  border-radius: 14px;
}

.tile,
.choice {
  border: 2px solid var(--wp-line);
  background: linear-gradient(180deg, #FFFFFF, #FBF6FC);
  box-shadow: inset 0 2px 0 #FFFFFF, 0 4px 0 var(--wp-lip), 0 10px 14px -10px rgba(42, 27, 61, 0.35);
}

.tile.locked { border-color: #14B8A6; box-shadow: inset 0 2px 0 #FFFFFF, 0 4px 0 #0B8C80, 0 10px 14px -10px rgba(42, 27, 61, 0.35); }
.tile.revealed { border-style: dashed; border-color: var(--wp-edge); opacity: 0.85; }

.socket {
  border: 2px dashed var(--wp-edge);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.socket.selected {
  border-style: solid;
  border-color: var(--wp-pink-deep);
  background: var(--wp-blush);
  box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.18);
}

.face { display: inline-flex; width: 70%; height: 70%; }
.face svg { width: 100%; height: 100%; fill: var(--kind, var(--wp-ink)); }

.palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.choice {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 72px;
  min-height: 72px;
  padding: 6px 8px;
  border-radius: 16px;
  color: var(--wp-ink);
  font: inherit;
  cursor: pointer;
  transition: transform 200ms var(--m-spring);
}
.choice .face { width: 34px; height: 34px; }
.choice-label { font-size: 0.75rem; font-weight: 700; }
.choice:active:not(:disabled) { transform: translateY(3px) scale(0.95); }
.choice:disabled { opacity: 0.5; cursor: default; }

/* Success: springy lock-in. Failure: shake + muted red flash. Never the same language. */
.slot.lock-in { animation: lock-in 520ms var(--m-spring); }
.slot.deny { animation: deny 460ms ease-in-out; }

@keyframes lock-in {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15) translateY(-4px); }
  100% { transform: scale(1); }
}

@keyframes deny {
  0%, 100% { transform: translateX(0); background: rgba(255, 255, 255, 0.6); }
  20% { transform: translateX(-7px); background: rgba(225, 29, 72, 0.14); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.toast {
  position: absolute;
  top: -20px;
  left: 50%;
  z-index: 2;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--wp-ink);
  color: #FFFFFF;
  font-size: 0.9375rem;
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: linear-gradient(180deg, #BE123C, #9F1239); }

.result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 10px 14px;
  border: 1.5px solid var(--wp-line);
  border-radius: 16px;
  background: #FFFFFF;
}
.result[hidden], .btn[hidden] { display: none; }
.result.is-win { border-color: #F1D27A; background: linear-gradient(180deg, #FFFDF6, #FDF3D0); }
.result-title { margin: 0; font-weight: 800; }

/* ---------------------------------------------------------------- CP-V2 Pattern Logic Lab */
.lab-name { display: block; font-size: 0.55em; font-weight: 800; color: var(--wp-pink-ink); letter-spacing: 0; }
.phase-badge { margin-left: 6px; padding: 2px 10px; border: 1.5px solid var(--wp-line); border-radius: 999px; background: #FFFFFF; font-size: 0.75rem; font-weight: 800; }
.chapter-card { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1.5px solid var(--wp-line); border-radius: 16px; background: #FFFFFF; font-size: 0.875rem; max-width: 34em; }
.chapter-emoji { font-size: 1.4rem; }
.chapter-tip { color: var(--wp-ink-muted); }
.result { flex-direction: column; text-align: center; }
.result-explain { margin: 0; color: var(--wp-ink-muted); font-size: 0.875rem; max-width: 30em; }
.result-explain:empty { display: none; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.offline { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1.5px solid #CBD3DF; border-radius: 14px; background: #F4F6FA; color: #334155; font-size: 0.875rem; font-weight: 700; }
.offline[hidden] { display: none; }

/* Tiles: colour mark letter and arrow orientation are visible non-colour cues. */
.face { position: relative; }
.face svg { transform: rotate(var(--turn, 0deg)); }
.mark { position: absolute; right: -6px; bottom: -6px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #FFFFFF; border: 1px solid var(--wp-line); color: var(--wp-ink); font-size: 10px; font-weight: 900; line-height: 14px; text-align: center; }
.choice { min-width: 84px; }
.choice-label { font-size: 0.6875rem; max-width: 9em; text-align: center; }
.choice.dragging { opacity: 0.45; }
.tile { position: relative; }
.lock-badge { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; background: #0B8C80; color: #FFFFFF; font-size: 10px; font-weight: 900; line-height: 16px; text-align: center; }
.socket.drop-target { border-style: solid; border-color: #0F9488; background: #E7FAF7; }
.socket:hover { border-color: var(--wp-pink-deep); }
.palette { touch-action: none; }

.ghost { position: fixed; left: 0; top: 0; z-index: 20; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--wp-pink-deep); border-radius: 14px; background: #FFFFFF; box-shadow: 0 12px 24px -10px rgba(42, 27, 61, 0.5); pointer-events: none; transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 50%)) rotate(-4deg); opacity: 0.92; }
.ghost[hidden] { display: none; }
.ghost .face { width: 70%; height: 70%; }

.sound-settings { width: 100%; max-width: 30em; font-size: 0.875rem; }
.sound-settings summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.sound-settings label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.sound-settings input[type="checkbox"] { width: 22px; height: 22px; }
.sound-note { margin: 0; color: var(--wp-ink-muted); }

.tutorial { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(42, 27, 61, 0.35); }
.tutorial[hidden] { display: none; }
.tutorial-card { width: min(100%, 420px); padding: 20px; border-radius: 22px; background: #FFFFFF; box-shadow: 0 30px 60px -30px rgba(42, 27, 61, 0.6); }
.tutorial-card h2 { margin: 4px 0 8px; font-size: 1.25rem; }
.tutorial-step { margin: 0; color: var(--wp-pink-ink); font-size: 0.75rem; font-weight: 800; }
.tutorial-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Decorative background phases (calm; movement paused when hidden or under reduced motion). */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; transition: background-color 1200ms ease; }
body[data-phase="curiosity"] .backdrop { background-color: rgba(253, 242, 248, 0.6); }
body[data-phase="discovery"] .backdrop { background-color: rgba(253, 243, 208, 0.55); }
body[data-phase="challenge"] .backdrop { background-color: rgba(237, 233, 254, 0.6); }
body[data-phase="mastery"] .backdrop { background-color: rgba(231, 250, 247, 0.6); }
.drift { position: absolute; font-size: 64px; opacity: 0.12; animation: drift 18s ease-in-out infinite alternate; }
.d1 { top: 8%; left: 6%; }
.d2 { top: 62%; right: 8%; animation-duration: 22s; animation-delay: -6s; }
.d3 { bottom: 6%; left: 18%; font-size: 48px; animation-duration: 26s; animation-delay: -12s; }
body.is-hidden .drift { animation-play-state: paused; }
@keyframes drift { from { transform: translate(0, 0) rotate(-6deg); } to { transform: translate(18px, -22px) rotate(6deg); } }

/* Motion events (namespaced by src/motion-events.ts). Transform/opacity only. */
.m-enter { animation: m-enter 520ms var(--m-spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
.m-select { animation: m-select 180ms ease-out; }
.m-tap { animation: m-tap 150ms ease-out; }
.m-drop-target { transform: scale(1.08); transition: transform 120ms ease-out; }
.m-snap { animation: m-snap 220ms var(--m-spring); }
.m-correct { animation: m-correct 260ms var(--m-spring); }
.m-wrong { animation: m-wrong 220ms ease-in-out; }
.m-lock { animation: m-lock 320ms var(--m-spring); }
.m-insight { animation: m-insight 700ms ease-out; }
.m-cascade { animation: m-cascade 650ms var(--m-spring) both; animation-delay: calc(var(--i, 0) * 50ms); }
.m-chapter { animation: m-chapter 420ms ease-out; }
.m-timeout { animation: m-timeout 400ms ease-out forwards; }
.m-offline { animation: m-offline 240ms ease-out; }
.m-reset { animation: m-reset 260ms ease-in both; animation-delay: calc((12 - var(--i, 0)) * 15ms); }
.m-verified { animation: m-verified 620ms var(--m-spring); }

@keyframes m-enter { from { opacity: 0; transform: translateY(12px) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes m-select { 50% { transform: translateY(-4px); } }
@keyframes m-tap { 50% { transform: scale(0.92); } }
@keyframes m-snap { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes m-correct { 0% { transform: scale(0.7); } 60% { transform: scale(1.12) translateY(-3px); } 100% { transform: none; } }
@keyframes m-wrong { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); opacity: 0.8; } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes m-lock { 0% { opacity: 0; transform: translateY(-6px) scale(0.6); } 100% { opacity: 1; transform: none; } }
@keyframes m-insight { 0% { opacity: 1; } 35% { opacity: 0.75; transform: scale(1.015); } 100% { opacity: 1; transform: none; } }
@keyframes m-cascade { 0%, 100% { transform: none; } 40% { transform: translateY(-10px); } }
@keyframes m-chapter { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes m-timeout { to { opacity: 0.6; } }
@keyframes m-offline { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-reset { to { opacity: 0; transform: scale(0.85); } }
@keyframes m-verified { 0% { opacity: 0; transform: translateY(14px) scale(0.92); } 60% { opacity: 1; transform: scale(1.03); } 100% { transform: none; } }
.toast.is-insight { background: linear-gradient(180deg, #0F9488, #0B7A70); }
.m-wrong { background: rgba(225, 29, 72, 0.12); }

/* Small phones (e.g. 320×568): keep the pattern and the tile choices on one screen. */
@media (max-width: 480px) and (max-height: 640px) {
  .game { gap: 6px; padding-top: 8px; }
  .eyebrow, .chapter-card { display: none; }
  h1 { font-size: 1.3rem; }
  .lab-name { display: inline; margin-left: 4px; }
  .header-meta { margin-top: 2px; font-size: 0.75rem; }
  .round-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .toolbar { gap: 6px; }
  .btn { padding: 0 12px; }
  .stats { gap: 6px; }
  .stats div { min-width: 0; padding: 3px 8px; }
  .stats dt { font-size: 0.6875rem; }
  .stats dd { font-size: 1rem; }
  /* Icon + number only; each choice keeps its full accessible name (e.g. "1: Violet hexagon"). */
  .palette { gap: 6px; }
  .choice { min-width: 52px; min-height: 52px; padding: 4px; }
  .choice-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #how-to { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* CP-VISUAL-01 | owner-approved local premium reference | D-023 / PRD FR-08.
   Static presentation only. The original stylesheet above, including every motion,
   phase, pointer ghost and reduced-motion rule, is intentionally preserved verbatim.
   No new animation, transition, transform or game-content declarations below. */
body {
  background:
    radial-gradient(ellipse at 10% 10%, rgba(236, 72, 153, 0.65), transparent 48%),
    radial-gradient(ellipse at 94% 20%, rgba(108, 59, 255, 0.5), transparent 45%),
    radial-gradient(ellipse at 50% 100%, #FFE6AD, transparent 65%),
    linear-gradient(145deg, #6D367C, #F7ACD0 45%, #FFF0D8);
  background-attachment: fixed;
}

.game {
  width: min(calc(100% - 40px), 940px);
  margin: 28px auto;
  padding: 30px 36px 24px;
  gap: 18px;
  border: 1.5px solid #F1D27A;
  border-radius: 32px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.98), transparent 55%),
    linear-gradient(150deg, #FFF5FB, #FCE2EC 52%, #FFF1D9);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.6),
    0 12px 0 -6px #C887A6, 0 24px 60px -20px rgba(42, 27, 61, 0.48);
}

.game-header { width: 100%; }
.eyebrow {
  display: inline-block;
  padding: 8px 24px;
  border: 1.5px solid #D4AF37;
  border-radius: 12px;
  background: linear-gradient(180deg, #42215D, #241338);
  color: #FFE7A0;
  letter-spacing: 0.2em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 10px rgba(42, 27, 61, 0.14);
}
h1 {
  margin: 14px 0 0;
  color: #FFE6A1;
  font-size: clamp(2.3rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.045em;
  text-shadow: 2px 0 #632354, -2px 0 #632354, 0 -2px #632354,
    0 3px #632354, 0 5px #A43A76, 0 8px 10px rgba(78, 29, 84, 0.2);
}
.lab-name {
  width: fit-content;
  margin: 12px auto 0;
  padding: 8px 30px;
  border: 1.5px solid #B68ACF;
  border-radius: 999px;
  color: #FFFFFF;
  background: linear-gradient(180deg, #542569, #2A173F);
  font-size: clamp(0.95rem, 2.4vw, 1.25rem);
  letter-spacing: -0.015em;
  text-shadow: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 0 #E0B8D0;
}
.header-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 16px; }
.demo-note { font-size: 0.8125rem; }
.mode-badge { background: #FFF7FB; border-color: #DB9BBD; }
.phase-badge { margin-left: 0; background: #FFF9ED; border-color: #D6B66E; }

.toolbar { width: 100%; gap: 12px; }
.round-label { color: #542569; }
select {
  max-width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-color: #C6A155;
  background: linear-gradient(180deg, #FFFEF8, #FFE6AD);
  color: #392147;
  box-shadow: inset 0 2px 0 #FFFFFF, 0 3px 0 #D5B78C;
}
.btn {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 16px;
  font-size: 0.9375rem;
}
.btn-secondary {
  border: 1.5px solid #9D78C7;
  color: #FFFFFF;
  background: linear-gradient(180deg, #8152E0, #5B2BB7 55%, #49218F);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 3px 0 #3B1C69;
}
.btn-primary {
  border: 1.5px solid #B85C8B;
  color: #FFFFFF;
  background: linear-gradient(180deg, #C92874, #AF175D 60%, #94184E);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 3px 0 #7E194A;
}
.btn-ghost {
  border: 1.5px solid #C994B3;
  color: #492453;
  background: linear-gradient(180deg, #FFFFFF, #F9DCEB);
  box-shadow: inset 0 2px 0 #FFFFFF, 0 3px 0 #D9AEC7;
}
#reveal {
  color: #522C27;
  border-color: #C79A49;
  background: linear-gradient(180deg, #FFF8DE, #FFD68C);
  box-shadow: inset 0 2px 0 #FFFFFF, 0 3px 0 #D2A15B;
}
.chapter-card { width: 100%; max-width: none; justify-content: center; background: rgba(255, 255, 255, 0.72); border-color: #DEC0D5; padding: 12px 16px; }
.chapter-tip { display: inline; }

.stats { width: 100%; gap: 12px; }
.stats div {
  flex: 1;
  min-width: 0;
  padding: 14px 10px;
  border: 1.5px solid #FFFFFF;
  border-radius: 20px;
  background: linear-gradient(160deg, #126C75, #124654);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 4px 0 #BDB1B9, 0 8px 14px -10px #542569;
}
.stats div:nth-child(2) { background: linear-gradient(160deg, #C82C74, #921749); }
.stats div:nth-child(3) { background: linear-gradient(160deg, #9C5610, #75390D); }
.stats dt { color: #FFFFFF; font-size: 0.875rem; }
.stats dd { margin-top: 2px; color: #FFFFFF; font-size: 1.8rem; line-height: 1.15; font-variant-numeric: tabular-nums; }

.stage {
  margin-top: 8px;
  padding: 22px 18px;
  border: 1.5px solid #CFA05D;
  border-radius: 26px;
  background: linear-gradient(145deg, #FFF7FA, #F9CDD9 55%, #FFE6BD);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.6), 0 5px 0 #E2AFB9, 0 12px 22px -16px #8B3E65;
}
.pattern { gap: 12px; padding: 18px 10px; background: rgba(255, 255, 255, 0.35); border-color: #FFFFFF; border-radius: 20px; }
.slot { width: 64px; height: 64px; border-radius: 16px; }
.tile:not(:where(.m-wrong, .deny)), .choice {
  border-color: #FFFFFF;
  background: linear-gradient(160deg, #FFFFFF, #FFF7FB 50%, #F1E6F4);
  box-shadow: inset 0 2px 0 #FFFFFF, 0 4px 0 #C6A3C8, 0 8px 12px -6px rgba(74, 30, 83, 0.4);
}
.tile.locked { border-color: #14B8A6; box-shadow: inset 0 2px 0 #FFFFFF, 0 4px 0 #0B8C80, 0 8px 12px -6px rgba(74, 30, 83, 0.3); }
.tile.revealed { border-color: var(--wp-edge); }
.palette { width: 100%; gap: 14px; padding: 18px 14px; border: 1.5px solid #F9F0F5; border-radius: 24px; background: rgba(255, 255, 255, 0.4); }
.choice { min-width: 100px; min-height: 96px; padding: 12px 10px; border-radius: 18px; gap: 8px; }
.choice .face { width: 38px; height: 38px; }
.choice-label { font-size: 0.75rem; max-width: 10em; }
.mark { border-color: #C6A3C8; }

.result { width: 100%; padding: 22px; border-radius: 24px; border-color: #C3A4CE; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 4px 0 #D6B2C7; }
.result.is-win { border-color: #D4AF37; background: linear-gradient(135deg, #502461, #2B193E); color: #FFFFFF; }
.result-title { font-size: 1.35rem; line-height: 1.3; }
.result.is-win .result-title { color: #FFE6A1; }
.result.is-win .result-explain { color: #FFF1FA; }
.result-actions { gap: 12px; }

.sound-settings { max-width: none; padding: 8px 18px; border: 1.5px solid #FFFFFF; border-radius: 20px; background: linear-gradient(145deg, #FFF9FC, #FBE2ED); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45), 0 3px 0 #DEBACD; }
.sound-settings summary { color: #542569; font-size: 1rem; }
.sound-note { margin-bottom: 8px; }
.sound-settings input { accent-color: #BE185D; }
.sound-settings input[type="range"] { min-height: 44px; max-width: 100%; }
.tutorial-card { border: 1.5px solid #D4AF37; background: linear-gradient(145deg, #FFFFFF, #FFF0F7); }

/* A separate outline stays visible even on cards with their own layered shadows. */
:focus-visible { outline: 3px solid #6C3BFF; outline-offset: 4px; }

@media (max-width: 600px) {
  .game { width: calc(100% - 20px); margin: 12px auto; padding: 22px 14px 18px; gap: 14px; border-radius: 24px; }
  h1 { font-size: clamp(2.15rem, 9vw, 3rem); }
  .eyebrow { font-size: 0.6875rem; padding: 7px 14px; }
  .lab-name { padding: 7px 22px; }
  .demo-note { width: 100%; order: 1; }
  .toolbar { gap: 10px; }
  .round-label { width: 100%; text-align: center; }
  select { width: 100%; }
  .toolbar .btn { flex: 1; padding: 0 12px; }
  .chapter-card { padding: 10px; align-items: flex-start; font-size: 0.8125rem; }
  .chapter-tip { display: block; }
  .stats { gap: 8px; }
  .stats div { padding: 12px 4px; border-radius: 16px; }
  .stats dt { font-size: 0.75rem; }
  .stats dd { font-size: 1.5rem; }
  .stage { padding: 16px 10px; border-radius: 22px; }
  .pattern { gap: 10px; padding: 14px 8px; }
  .slot { width: 52px; height: 52px; border-radius: 14px; }
  .palette { gap: 12px; padding: 14px 10px; }
  .choice { min-width: 0; width: calc((100% - 24px) / 3); min-height: 94px; padding: 10px 4px; }
  .choice-label { font-size: 0.6875rem; overflow-wrap: anywhere; }
  .result { padding: 18px 12px; }
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1; padding: 0 12px; }
  .sound-settings { padding: 8px 14px; }
}

/* Keep the original compact-screen content visibility and hit-target behavior. */
@media (max-width: 480px) and (max-height: 640px) {
  .game { gap: 6px; padding: 12px 10px; }
  h1 { font-size: 1.8rem; }
  .lab-name { display: block; margin: 8px auto 0; font-size: 0.875rem; }
  .toolbar { gap: 6px; }
  .stats div { padding: 6px 4px; }
  .stats dd { font-size: 1.15rem; }
  .stage { margin-top: 0; padding: 10px; }
  .pattern { padding: 8px; gap: 8px; }
  .slot { width: 44px; height: 44px; }
  .palette { padding: 10px 8px; gap: 8px; }
  .choice { width: auto; min-width: 52px; min-height: 52px; padding: 4px; }
}
