/* ============================================================================
   Spelling Adventures 2 — shared design system.
   Claymorphism: soft-3D, chunky, toy-like. Bright but calm, big tap targets,
   visible focus, dyslexia-friendly toggle, reduced-motion respected.
   Class names are a superset of v1 so every game inherits the new look.
   ========================================================================== */

:root {
  /* surfaces */
  --bg1: #dff1ff;
  --bg2: #ffe9f4;
  --bg3: #fff8e1;
  --card: #ffffff;
  --card-soft: #fdfcff;

  /* ink */
  --ink: #2f2a5e;
  --ink-soft: #6f6a99;
  --ink-faint: #a49ecb;

  /* brand + friends */
  --brand: #6c4bd8;
  --brand-dark: #5236b8;
  --brand-deep: #3f2790;
  --accent: #ff8a3d;   --accent-dark: #e06a17;
  --pink: #ff5fa2;     --pink-dark: #de3f84;
  --teal: #14b8b4;     --teal-dark: #0d918e;
  --green: #2fbf71;    --green-dark: #219957;
  --red: #ef5d6b;      --red-dark: #ce3d4c;
  --yellow: #ffc93f;   --yellow-dark: #e0a812;
  --sky: #35a7ff;      --sky-dark: #1f82d6;

  /* clay effect tokens */
  --shadow-col: 80, 60, 160;
  --shadow:    0 10px 26px rgba(var(--shadow-col), .16);
  --shadow-lg: 0 18px 48px rgba(var(--shadow-col), .22);
  --clay-hi: inset 0 3px 0 rgba(255, 255, 255, .85), inset 0 -4px 0 rgba(var(--shadow-col), .07);
  --clay-hi-strong: inset 0 4px 0 rgba(255, 255, 255, .5), inset 0 -5px 0 rgba(0, 0, 0, .14);

  --radius: 26px;
  --radius-sm: 16px;
  --gap: 16px;
  --font: "Baloo 2", "Fredoka", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;

  --focus-ring: 0 0 0 4px rgba(53, 167, 255, .55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 8% -4%,  rgba(157, 205, 255, .55), transparent 62%),
    radial-gradient(820px 540px at 100% 12%, rgba(255, 187, 221, .5),  transparent 60%),
    radial-gradient(760px 620px at 24% 108%, rgba(255, 233, 170, .55), transparent 60%),
    radial-gradient(700px 500px at 88% 96%,  rgba(178, 245, 234, .5),  transparent 62%),
    linear-gradient(165deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* floating pastel clouds — pure decoration, removed for reduced motion */
body::before, body::after {
  content: "";
  position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(2px); opacity: .55; pointer-events: none;
}
body::before {
  width: 240px; height: 90px; top: 12%; left: -60px;
  background: radial-gradient(circle at 30% 30%, #ffffff, #eaf3ff 70%);
  box-shadow: 40vw 22vh 0 -6px #ffffffcc, 70vw 55vh 0 -14px #ffffffb0, 12vw 70vh 0 -10px #ffffffb8;
  animation: drift 60s linear infinite alternate;
}
body::after {
  width: 190px; height: 74px; top: 60%; right: -50px;
  background: radial-gradient(circle at 30% 30%, #ffffff, #fff0f8 70%);
  animation: drift 80s linear infinite alternate-reverse;
}
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(6vw); } }

/* Dyslexia-friendly reading mode (toggle on <body>). */
body.dyslexia {
  --font: "Verdana", "Trebuchet MS", system-ui, sans-serif;
  letter-spacing: .045em;
  word-spacing: .14em;
  line-height: 1.75;
}
body.dyslexia .word-big { letter-spacing: .12em; }

/* ---- Layout ------------------------------------------------------------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 16px clamp(14px, 3vw, 24px) 48px; }

.appbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; margin-bottom: 10px;
}
.appbar .title { font-size: 1.45rem; font-weight: 700; line-height: 1.15; }
.appbar .subtitle { color: var(--ink-soft); font-size: .95rem; margin-top: 0; font-weight: 500; }
.appbar .spacer { flex: 1; }

.coin-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #fffef8, #fff3cf);
  border: 3px solid #fff;
  border-radius: 999px; padding: 8px 18px;
  font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow), var(--clay-hi);
  font-variant-numeric: tabular-nums;
}
.coin-pill .coin { font-size: 1.25rem; }

/* ---- Buttons: chunky clay with a pressed edge ---------------------------- */
.btn {
  --btn-bg: var(--brand); --btn-edge: var(--brand-dark);
  font-family: var(--font); font-size: 1.05rem; font-weight: 700;
  letter-spacing: .01em;
  border: none; border-radius: 999px; padding: 14px 28px;
  color: #fff; cursor: pointer;
  background: var(--btn-bg);
  box-shadow: 0 6px 0 var(--btn-edge), 0 14px 22px rgba(var(--shadow-col), .2), var(--clay-hi-strong);
  transition: transform .12s ease, box-shadow .12s ease, filter .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--btn-edge), 0 4px 8px rgba(var(--shadow-col), .18), var(--clay-hi-strong);
}
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn:focus-visible { outline: none; box-shadow: 0 6px 0 var(--btn-edge), var(--focus-ring); }

.btn.secondary { --btn-bg: #fff; --btn-edge: #ddd3f7; color: var(--brand); }
.btn.accent { --btn-bg: var(--accent); --btn-edge: var(--accent-dark); }
.btn.green  { --btn-bg: var(--green);  --btn-edge: var(--green-dark); }
.btn.pink   { --btn-bg: var(--pink);   --btn-edge: var(--pink-dark); }
.btn.teal   { --btn-bg: var(--teal);   --btn-edge: var(--teal-dark); }
.btn.yellow { --btn-bg: var(--yellow); --btn-edge: var(--yellow-dark); color: #5b4300; }
.btn.ghost {
  --btn-bg: rgba(255,255,255,.6); --btn-edge: rgba(255,255,255,.4);
  color: var(--ink); box-shadow: none; backdrop-filter: blur(4px);
}
.btn.ghost:active { transform: scale(.96); }
.btn.big { font-size: 1.3rem; padding: 18px 36px; }
.btn.round { width: 58px; height: 58px; padding: 0; font-size: 1.4rem; }
.speak-btn { --btn-bg: var(--sky); --btn-edge: var(--sky-dark); }

.back {
  background: #fff; color: var(--brand); border: 3px solid #fff; cursor: pointer;
  width: 52px; height: 52px; border-radius: 50%; font-size: 1.4rem; font-weight: 700;
  box-shadow: var(--shadow), var(--clay-hi); display: grid; place-items: center;
  text-decoration: none; flex: none;
  transition: transform .12s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.back:hover { transform: translateX(-3px); }
.back:active { transform: scale(.92); }
.back:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- Cards & tiles ------------------------------------------------------ */
.card {
  background: linear-gradient(180deg, #ffffff, var(--card-soft));
  border: 3px solid #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--clay-hi);
  padding: clamp(18px, 4vw, 28px);
}
.panel {
  background: rgba(255,255,255,.65);
  border: 3px solid rgba(255,255,255,.8);
  border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(6px);
}

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: var(--gap); }

.tile {
  position: relative; border: none; cursor: pointer; text-align: left;
  border-radius: var(--radius); padding: 18px; min-height: 156px;
  color: #fff; font-family: var(--font);
  box-shadow: var(--shadow), var(--clay-hi-strong);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease;
  text-decoration: none; overflow: hidden;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tile::after { /* soft top sheen */
  content: ""; position: absolute; inset: 0 0 55% 0;
  background: linear-gradient(180deg, rgba(255,255,255,.28), transparent);
  pointer-events: none;
}
.tile:hover { transform: translateY(-6px) rotate(-1deg) scale(1.02); box-shadow: var(--shadow-lg), var(--clay-hi-strong); }
.tile:active { transform: translateY(0) scale(.98); }
.tile:focus-visible { outline: none; box-shadow: var(--shadow-lg), var(--focus-ring); }
.tile .emoji { font-size: 2.7rem; line-height: 1.1; filter: drop-shadow(0 4px 5px rgba(0,0,0,.22)); }
.tile .name { font-size: 1.14rem; font-weight: 700; line-height: 1.2; text-shadow: 0 2px 3px rgba(0,0,0,.14); }
.tile .desc { font-size: .82rem; opacity: .96; margin-top: 2px; font-weight: 500; }
.tile .badge {
  position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.95);
  color: var(--ink); font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15); z-index: 1;
}

/* section labels on the hub */
.section-label {
  display: flex; align-items: center; gap: 10px;
  margin: 30px 0 12px; font-size: 1.25rem; font-weight: 700;
}
.section-label .line { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.75); }
.section-label small { color: var(--ink-soft); font-weight: 500; font-size: .85rem; }

/* ---- Headings ----------------------------------------------------------- */
h1, h2, h3 { line-height: 1.15; }
.hero-title {
  font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; margin: 4px 0;
  background: linear-gradient(100deg, var(--brand) 10%, var(--pink) 50%, var(--accent) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---- Word display / inputs ---------------------------------------------- */
.word-big {
  font-size: clamp(2.2rem, 9vw, 4rem); font-weight: 800; letter-spacing: .04em;
  text-align: center; color: var(--brand-dark);
}
.spell-input {
  font-family: var(--font); font-size: 2rem; text-align: center; font-weight: 700;
  border: 4px solid #e3daf7; border-radius: 18px; padding: 12px 18px;
  width: 100%; max-width: 460px; color: var(--ink); background: #fff;
  letter-spacing: .12em; outline: none;
  box-shadow: inset 0 3px 8px rgba(var(--shadow-col), .1);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.spell-input:focus { border-color: var(--sky); box-shadow: inset 0 3px 8px rgba(var(--shadow-col), .1), 0 0 0 4px rgba(53,167,255,.25); }
.spell-input.good { border-color: var(--green); background: #eafaf0; }
.spell-input.bad  { border-color: var(--red);  background: #fdeef0; animation: shake .4s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

/* ---- Feedback banners --------------------------------------------------- */
.feedback { border-radius: var(--radius-sm); padding: 14px 18px; font-weight: 700; margin-top: 14px; animation: pop-in .25s ease; }
.feedback.good { background: #e2f8ec; color: #17693f; border: 3px solid #bdedd3; }
.feedback.bad  { background: #fff2e6; color: #a1520f; border: 3px solid #ffdfc0; }
.feedback .hook { font-weight: 500; margin-top: 4px; }

/* ---- Progress / stats --------------------------------------------------- */
.stats { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.stat {
  background: linear-gradient(180deg, #fff, var(--card-soft));
  border: 3px solid #fff;
  border-radius: 18px; padding: 10px 20px;
  box-shadow: var(--shadow), var(--clay-hi); text-align: center;
}
.stat b { font-size: 1.4rem; display: block; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }

.progress {
  height: 18px; background: rgba(255,255,255,.7); border-radius: 999px; overflow: hidden;
  border: 3px solid #fff; box-shadow: inset 0 2px 5px rgba(var(--shadow-col), .14);
}
.progress > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  background-size: 200% 100%;
  width: 0; transition: width .4s cubic-bezier(.34,1.3,.64,1);
  border-radius: 999px;
}

.hearts { font-size: 1.5rem; letter-spacing: 2px; }

/* ---- Toast & confetti --------------------------------------------------- */
#toast-layer { position: fixed; left: 0; right: 0; top: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 24px; border-radius: 999px;
  font-weight: 700; box-shadow: var(--shadow-lg), var(--clay-hi-strong);
  animation: toast-in .35s cubic-bezier(.34,1.56,.64,1);
  max-width: min(92vw, 480px); text-align: center;
}
.toast.good { background: var(--green); }
.toast.coin { background: var(--accent); }
.toast.info { background: var(--brand); }
@keyframes toast-in { from { transform: translateY(-16px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.confetti { position: fixed; top: -12px; width: 12px; height: 16px; z-index: 55; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

/* ---- Generic game bits -------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 3px solid #e3daf7; border-radius: 16px;
  padding: 10px 18px; font-weight: 700; font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 4px 0 #e3daf7, 0 8px 14px rgba(var(--shadow-col), .12);
  user-select: none;
  transition: transform .1s ease, box-shadow .1s ease, border-color .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  font-family: var(--font); color: var(--ink);
}
.chip:hover { transform: translateY(-2px); }
.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 #e3daf7; }
.chip:focus-visible { outline: none; box-shadow: 0 4px 0 #e3daf7, var(--focus-ring); }
.chip.selected { border-color: var(--brand); background: #f3eeff; box-shadow: 0 4px 0 #cbb9f2, 0 8px 14px rgba(var(--shadow-col), .12); }
.chip.good { border-color: var(--green); background: #eafaf0; box-shadow: 0 4px 0 #bdedd3; }
.chip.bad  { border-color: var(--red);  background: #fdeef0; box-shadow: 0 4px 0 #f5c6cc; }

.letter-tile {
  width: 54px; height: 62px; display: inline-grid; place-items: center;
  font-size: 1.8rem; font-weight: 800; background: #fff; color: var(--brand-dark);
  border-radius: 14px; cursor: pointer; user-select: none;
  border: 3px solid #fff;
  box-shadow: 0 4px 0 #ddd3f7, 0 8px 14px rgba(var(--shadow-col), .14);
  transition: transform .1s ease, box-shadow .1s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  font-family: var(--font);
}
.letter-tile:hover { transform: translateY(-2px) rotate(-2deg); }
.letter-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 #ddd3f7; }
.letter-tile.silent { background: #2f2a5e; color: var(--yellow); border-color: #453f7d; box-shadow: 0 4px 0 #1d1943, 0 8px 14px rgba(0,0,0,.25); }
.letter-tile.slot {
  background: #efe8ff; color: var(--brand); border: 3px dashed #cbb9f2;
  box-shadow: inset 0 3px 7px rgba(var(--shadow-col), .16);
}

.row-center { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.col-center { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.mt { margin-top: 16px; } .mt2 { margin-top: 28px; }
.hidden { display: none !important; }

.mascot { font-size: 3rem; line-height: 1; }
.mascot.bounce { animation: bounce 2.4s ease infinite; display: inline-block; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.wiggle { animation: wiggle .5s ease; }
@keyframes wiggle {
  0%,100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); }
}
.pop-in { animation: pop-in .3s cubic-bezier(.34,1.56,.64,1); }

/* ---- Hub extras: quests, garden ----------------------------------------- */
.quest-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.quest {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, #fff, var(--card-soft));
  border: 3px solid #fff; border-radius: 20px; padding: 12px 16px;
  box-shadow: var(--shadow), var(--clay-hi);
}
.quest .q-emoji {
  font-size: 1.7rem; width: 52px; height: 52px; flex: none;
  display: grid; place-items: center; border-radius: 16px;
  background: linear-gradient(160deg, #f3eeff, #e7dcff);
  box-shadow: inset 0 2px 4px rgba(var(--shadow-col), .12);
}
.quest.done .q-emoji { background: linear-gradient(160deg, #dff8ea, #bdedd3); }
.quest .q-name { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.quest .q-sub  { font-size: .78rem; color: var(--ink-soft); font-weight: 600; }
.quest .q-tick { margin-left: auto; font-size: 1.3rem; }
.quest.done { border-color: #bdedd3; }

.garden {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end;
  min-height: 64px; padding: 14px 16px 10px;
  background: linear-gradient(180deg, #f0fbff, #e2f8ec);
  border: 3px solid #fff; border-radius: 20px;
  box-shadow: inset 0 3px 8px rgba(var(--shadow-col), .1);
}
.garden .plant { font-size: 1.7rem; line-height: 1; cursor: default; transition: transform .15s ease; }
.garden .plant:hover { transform: scale(1.35) translateY(-4px); }

/* ---- Word Journey: level path --------------------------------------------- */
.journey-row {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 2px; flex-wrap: wrap; row-gap: 14px;
}
.journey-link {
  flex: 1; max-width: 46px; min-width: 14px; height: 6px; border-radius: 4px;
  background: #e7defb; margin-top: 27px;
}
.journey-link.lit { background: linear-gradient(90deg, var(--teal), var(--green)); }
.lvl { position: relative; display: flex; flex-direction: column; align-items: center; width: 86px; text-align: center; }
.lvl-badge {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.7rem; background: linear-gradient(180deg, #fff, #f3eeff);
  border: 3px solid #e3daf7; box-shadow: 0 4px 0 #ddd3f7, 0 8px 14px rgba(var(--shadow-col), .14);
}
.lvl.locked { opacity: .55; }
.lvl.locked .lvl-badge { filter: grayscale(1); font-size: 1.3rem; }
.lvl.current .lvl-badge {
  border-color: var(--yellow); background: linear-gradient(180deg, #fffef8, #fff3cf);
  box-shadow: 0 4px 0 var(--yellow-dark), 0 8px 18px rgba(224, 168, 18, .35);
  animation: lvl-pulse 2.2s ease infinite;
}
.lvl.complete .lvl-badge { border-color: var(--green); background: linear-gradient(180deg, #f2fcf6, #dff8ea); box-shadow: 0 4px 0 #bdedd3, 0 8px 14px rgba(33, 153, 87, .2); }
.lvl-star { position: absolute; top: -8px; right: 6px; font-size: 1rem; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.lvl-name { font-size: .78rem; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.lvl-count { font-size: .72rem; color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes lvl-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* ---- Buzz the coach: speech bubble --------------------------------------- */
.coach-bubble {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  display: flex; align-items: flex-start; gap: 10px;
  max-width: 360px; padding: 14px 14px 14px 12px;
  background: linear-gradient(180deg, #fffef8, #fff6dd);
  border: 3px solid #fff; border-radius: 22px 22px 6px 22px;
  box-shadow: var(--shadow-lg), var(--clay-hi);
  animation: coach-in .35s cubic-bezier(.34,1.56,.64,1);
}
.coach-bubble .cb-bee { font-size: 2rem; line-height: 1; animation: bounce 2.4s ease infinite; }
.coach-bubble .cb-text { font-size: .95rem; font-weight: 600; line-height: 1.45; }
.coach-bubble .cb-actions { display: flex; flex-direction: column; gap: 6px; }
.coach-bubble .cb-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid #fff;
  background: #fff; cursor: pointer; font-size: 1rem; font-family: var(--font);
  box-shadow: 0 3px 0 #eadfc2, 0 6px 10px rgba(var(--shadow-col), .12);
  display: grid; place-items: center; color: var(--ink);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.coach-bubble .cb-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #eadfc2; }
.coach-bubble .cb-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@keyframes coach-in { from { transform: translateY(24px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 520px) {
  .coach-bubble { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ---- Parent panel / dialog --------------------------------------------- */
dialog {
  border: 4px solid #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0; max-width: 580px; width: 92%; color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #faf8ff);
}
dialog::backdrop { background: rgba(47, 42, 94, .5); backdrop-filter: blur(3px); }
.dialog-head { padding: 18px 22px; border-bottom: 2px solid #efeaff; display: flex; align-items: center; }
.dialog-body { padding: 22px; max-height: 72vh; overflow: auto; }
label.field { display: block; margin: 14px 0 4px; font-weight: 700; }
input[type=text], textarea, select {
  font-family: var(--font); font-size: 1rem; width: 100%; padding: 11px 14px;
  border: 3px solid #e3daf7; border-radius: 14px; color: var(--ink); background: #fff;
  outline: none; transition: border-color .15s ease;
}
input[type=text]:focus, textarea:focus, select:focus { border-color: var(--sky); }
textarea { min-height: 90px; resize: vertical; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-weight: 600; }
.switch-row input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--green); cursor: pointer; }

/* ---- Motion safety ------------------------------------------------------- */
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after {
  animation: none !important; transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---- Print (word sheets from the dashboard) ------------------------------ */
@media print {
  body { background: #fff; color: #000; }
  body::before, body::after { display: none; }
  .no-print { display: none !important; }
  .card, .panel { box-shadow: none; border: 2px solid #ccc; }
}

@media (max-width: 620px) {
  .appbar { flex-wrap: wrap; row-gap: 10px; padding: 12px 0; }
  .appbar .title { font-size: 1.15rem; }
  .appbar .subtitle { font-size: .82rem; }
  .coin-pill { padding: 6px 14px; }
}

/* Phones: compress vertical space so a whole game round fits on screen.
   Desktop (>520px) keeps the roomier layout above. */
@media (max-width: 520px) {
  body { font-size: 17px; }
  .letter-tile { width: 46px; height: 54px; font-size: 1.5rem; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  .wrap { padding-top: 6px; padding-bottom: 24px; }
  .appbar { padding: 6px 0; margin-bottom: 4px; gap: 10px; }
  .appbar .title { font-size: 1.05rem; }
  .appbar .subtitle { font-size: .72rem; }
  .back { width: 44px; height: 44px; font-size: 1.2rem; }
  .coin-pill { padding: 4px 12px; font-size: .9rem; }

  .card { padding: 14px 14px 16px; border-radius: 20px; }
  .col-center { gap: 10px; }
  .row-center { gap: 8px; }
  .mt { margin-top: 10px; }
  .mt2 { margin-top: 16px; }
  h2 { font-size: 1.2rem; margin: 8px 0; }

  .word-big { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .spell-input { font-size: 1.5rem; padding: 9px 14px; border-radius: 14px; }
  .btn { padding: 11px 20px; font-size: .98rem; }
  .btn.big { font-size: 1.05rem; padding: 12px 24px; }
  .progress { height: 12px; }
  .feedback { padding: 10px 14px; margin-top: 10px; }
  .mascot { font-size: 2.3rem; }
  .stat { padding: 7px 14px; }
  .stat b { font-size: 1.15rem; }
  .coach-bubble { padding: 10px 12px; }
  .coach-bubble .cb-text { font-size: .88rem; }
}

/* Short screens (laptops, landscape tablets): the viewport is wide but not
   tall, so compress vertical space the same way — a whole game round,
   including the Check/Next row, must fit without scrolling.
   Width-gated so it never doubles up with the phone block above. */
@media (min-width: 521px) and (max-height: 780px) {
  .wrap { padding-top: 6px; padding-bottom: 20px; }
  .appbar { padding: 6px 4px; margin-bottom: 4px; }
  .appbar .title { font-size: 1.2rem; }
  .appbar .subtitle { font-size: .8rem; }
  .back { width: 44px; height: 44px; font-size: 1.2rem; }
  .coin-pill { padding: 5px 14px; }

  .card { padding: 14px 22px 16px; }
  .col-center { gap: 10px; }
  .mt { margin-top: 10px; }
  .mt2 { margin-top: 16px; }
  h2 { font-size: 1.35rem; margin: 8px 0; }

  .word-big { font-size: clamp(1.9rem, 4.5vh, 2.6rem); }
  .spell-input { font-size: 1.5rem; padding: 8px 14px; }
  .btn { padding: 11px 22px; }
  .btn.big { font-size: 1.1rem; padding: 12px 26px; }
  .progress { height: 12px; }
  .feedback { padding: 10px 14px; margin-top: 10px; }
  /* the correction diff (games set 2rem inline) must not push Next off screen */
  .feedback .word-big { font-size: 1.5rem !important; margin-top: 2px !important; }
  .mascot { font-size: 2.3rem; }
  .stat { padding: 7px 14px; }
  .stat b { font-size: 1.15rem; }
  .letter-tile { width: 48px; height: 56px; font-size: 1.6rem; }
}
