/* Spellbound: child friendly look. Self hosted fonts, no external requests. */
@font-face { font-family: "Fredoka"; src: url("/fonts/fredoka-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("/fonts/fredoka-latin-600-normal.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Andika"; src: url("/fonts/andika-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("/fonts/andika-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "OpenDyslexic"; src: url("/fonts/opendyslexic-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "OpenDyslexic"; src: url("/fonts/opendyslexic-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
/* Sassoon Primary Infant is licensed. If it is installed on the device, or the licensed files are put in /fonts/, it is used first. */
@font-face {
  font-family: "Sassoon Primary Infant";
  src: local("Sassoon Primary Infant"), local("SassoonPrimaryInfant"), local("Sassoon Primary Infant Regular"),
       url("/fonts/SassoonPrimaryInfant.woff2") format("woff2"), url("/fonts/SassoonPrimaryInfant.woff") format("woff");
  font-display: swap;
}

:root {
  --bg: #eaf7ff; --bg2: #fff6dd; --card: #ffffff; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5;
  --brand: #6b4eff; --brand-dark: #4a30d6; --brand-ink: #ffffff; --brand-soft: #efeaff;
  --sun: #ffb703; --sun-dark: #d98f00; --leaf: #2bb673; --leaf-dark: #1b8a54; --coral: #ff6b6b; --coral-dark: #d94b4b; --sky: #3ec1f3;
  --good: #137a45; --bad: #c62f2f; --gold: #f2a900;
  --radius: 22px;
  --word-font: "Sassoon Primary Infant", "Sassoon Primary", "Sassoon Infant", "Andika", "Comic Sans MS", "Century Gothic", system-ui, sans-serif;
  --head-font: "Fredoka", "Andika", "Comic Sans MS", system-ui, sans-serif;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --scale: 1;
}
html[data-font="dyslexic"] { --word-font: "OpenDyslexic", "Andika", sans-serif; --head-font: "OpenDyslexic", "Andika", sans-serif; }
html[data-size="large"] { --scale: 1.18; }
html[data-tint="cream"]  { --bg: #fbf1cf; --bg2: #fbf1cf; --card: #fffbea; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5; --brand-soft: #efeaff; --good: #16824c; --bad: #c62f2f; }
html[data-tint="blue"]   { --bg: #d9ecfb; --bg2: #d9ecfb; --card: #f1f9ff; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5; --brand-soft: #efeaff; --good: #16824c; --bad: #c62f2f; }
html[data-tint="green"]  { --bg: #daf2de; --bg2: #daf2de; --card: #f2fbf3; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5; --brand-soft: #efeaff; --good: #16824c; --bad: #c62f2f; }
html[data-tint="pink"]   { --bg: #fadbe8; --bg2: #fadbe8; --card: #fff3f7; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5; --brand-soft: #efeaff; --good: #16824c; --bad: #c62f2f; }
html[data-tint="yellow"] { --bg: #fff39a; --bg2: #fff39a; --card: #fffbd2; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5; --brand-soft: #efeaff; --good: #16824c; --bad: #c62f2f; }
html[data-tint="peach"]  { --bg: #ffe1c9; --bg2: #ffe1c9; --card: #fff4ea; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5; --brand-soft: #efeaff; --good: #16824c; --bad: #c62f2f; }
html[data-tint="grey"]   { --bg: #e4e4e4; --bg2: #e4e4e4; --card: #f6f6f6; --ink: #2a2350; --muted: #5f5a83; --line: #e2dcf5; --brand-soft: #efeaff; --good: #16824c; --bad: #c62f2f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-tint]) { --bg: #171433; --bg2: #1d1a40; --card: #25224d; --ink: #f1eeff; --muted: #b6b0dd; --line: #3a3670; --brand: #9a85ff; --brand-dark: #6f58f0; --brand-ink: #14102e; --brand-soft: #332f66; --good: #46d890; --bad: #ff8a8a; }
}
* { box-sizing: border-box; }
html { font-size: calc(17px * var(--scale)); }
body { margin: 0; font-family: var(--ui-font); line-height: 1.5; color: var(--ink); background: var(--bg); background-image: linear-gradient(180deg, var(--bg) 0, var(--bg2) 100%); background-attachment: fixed; min-height: 100vh; }
body.is-pupil { font-family: var(--word-font); }
h1, h2, h3 { font-family: var(--head-font); font-weight: 600; letter-spacing: .01em; margin: 0 0 .4em; }
h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { text-align: center; }
.hidden-view { display: none !important; } .printonly { display: none; }
.sr { position: absolute; left: -9999px; }
a { color: var(--brand-dark); }
:focus-visible { outline: 4px solid var(--sun); outline-offset: 2px; }

/* top bar */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: var(--card); border-bottom: 3px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head-font); font-weight: 600; font-size: 1.1rem; }
.brand svg { width: 40px; height: 40px; flex: none; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--ink); border-radius: 99px; padding: 4px 12px; font-size: .9rem; font-weight: 600; }
main { max-width: 1040px; margin: 0 auto; padding: 18px 14px 80px; }

/* cards and buttons */
.card { background: var(--card); border: 3px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: 0 6px 0 rgba(60, 40, 140, .07); }
button, .btn { font: inherit; font-weight: 600; color: var(--ink); background: var(--card); border: 3px solid var(--line); border-bottom-width: 6px; padding: 8px 16px; border-radius: 16px; cursor: pointer; min-height: 48px; transition: transform .08s; }
button:hover:not(:disabled) { border-color: var(--brand); }
button:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 3px; margin-bottom: 3px; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand-dark); }
button.primary:hover:not(:disabled) { background: var(--brand-dark); }
button.good { background: var(--leaf); border-color: var(--leaf-dark); color: #fff; }
button.sun { background: var(--sun); border-color: var(--sun-dark); color: #3a2a00; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.mini { min-height: 36px; padding: 2px 12px; font-size: .88rem; border-bottom-width: 4px; border-radius: 12px; }
button.big { font-size: 1.25rem; min-height: 60px; padding: 10px 26px; }
button.icon { min-width: 48px; padding: 6px 12px; font-size: 1.2rem; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 3px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); width: 100%; min-height: 46px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 4px var(--brand-soft); }
textarea { min-height: 150px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > * { flex: 1 1 160px; } .row > .shrink { flex: 0 0 auto; }
.err { color: var(--bad); min-height: 1.4em; margin: 8px 0 0; font-weight: 600; }
.ok { color: var(--good); font-weight: 700; } .bad { color: var(--bad); font-weight: 700; }
.star { color: var(--gold); }
.pill { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .78rem; border: 2px solid var(--line); background: var(--card); }
.pill.warn { border-color: var(--bad); color: var(--bad); } .pill.good { border-color: var(--good); color: var(--good); }
.progress { height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), #7ed957); border-radius: 99px; transition: width .4s; }

/* login */
.login-wrap { max-width: 440px; margin: 4vh auto 0; text-align: center; }
.login-wrap .hero-sprout svg { width: 150px; height: 150px; animation: bob 3s ease-in-out infinite; }
.login-wrap h1 { font-size: 2.2rem; margin-bottom: 0; }
.login-wrap form { text-align: left; }
.login-wrap input { font-size: 1.3rem; }

/* pupil home */
.hero { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, var(--card), var(--brand-soft)); }
.hero svg { width: 120px; height: 120px; flex: none; }
.hero h2 { font-size: 1.9rem; margin: 0 0 4px; }
.bubble { position: relative; background: var(--card); border: 3px solid var(--line); border-radius: 18px; padding: 10px 14px; font-size: 1.05rem; }
.hero .bubble::before { content: ""; position: absolute; left: -12px; top: 28px; border: 9px solid transparent; border-right-color: var(--line); }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.weekbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.weekbar button { min-height: 40px; min-width: 44px; padding: 2px 10px; font-size: .95rem; border-bottom-width: 4px; }
.weekbar button[aria-current="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand-dark); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; font-size: 1.1rem; border-radius: 20px; border-bottom-width: 7px; font-family: var(--head-font); }
.tile .ico { font-size: 2rem; line-height: 1.1; }
.tile[aria-selected="true"] { background: var(--sun); border-color: var(--sun-dark); color: #3a2a00; transform: translateY(-2px); }
.garden-bed { background: linear-gradient(180deg, var(--bed1, #e9f9d6), var(--bed2, #cdeeb0)); border: 3px solid var(--bedline, #b8e08c); border-radius: 20px; padding: 12px 14px; }
html[data-tint] .garden-bed { background: var(--card); }
.plants { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 1.6rem; }
.plants span { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.7); border-radius: 14px; padding: 2px 10px; color: #2a2350; font-family: var(--head-font); }
.journey .bars { display: flex; gap: 8px; align-items: flex-end; margin: 6px 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.journey .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 40px; flex: none; }
.journey .col { width: 100%; height: 70px; display: flex; align-items: flex-end; background: rgba(255,255,255,.6); border-radius: 10px; overflow: hidden; }
.journey .col i { display: block; width: 100%; background: linear-gradient(0deg, var(--leaf), #7ed957); border-radius: 8px 8px 0 0; }
.journey .face { font-size: 1.1rem; min-height: 1.4rem; } .journey .lab { font-size: .72rem; color: var(--muted); }

/* words */
.wordcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 14px; }
.wordcard { border: 3px solid var(--line); border-radius: 20px; padding: 14px 16px; background: var(--card); display: flex; flex-direction: column; }
.wordcard .tip { flex: 1 1 auto; }
.wordcard .btns { margin-top: auto; }
@supports (grid-template-rows: subgrid) {
  .wordcards { row-gap: 0; }
  .wordcard { display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; margin-bottom: 14px; align-content: start; }
  .wordcard .tip { flex: none; align-self: stretch; }
}
.wc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bigword { overflow-wrap: break-word; min-width: 0; font-family: var(--word-font); font-size: clamp(1.5rem, 7vw, 2.1rem); font-weight: 700; letter-spacing: .03em; }
.pupil.little .bigword { font-size: clamp(1.7rem, 8vw, 2.6rem); }
.stage { font-size: 1.8rem; }
.sentence { font-family: var(--word-font); font-size: 1.3rem; line-height: 1.55; margin: 8px 0; }
.sentence strong { color: var(--brand-dark); background: var(--brand-soft); border-radius: 8px; padding: 0 6px; }
.tip { background: #fff7d6; border: 2px dashed var(--sun); border-radius: 14px; padding: 6px 12px; margin: 8px 0; font-size: 1rem; color: #3a2a00; }
html[data-tint] .tip, html[data-font="dyslexic"] .tip { background: var(--card); color: var(--ink); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rule { background: var(--brand-soft); border-radius: 16px; padding: 10px 14px; margin: 0 0 12px; }
.gap { display: inline-block; min-width: 3.4em; border-bottom: 4px solid var(--brand); margin: 0 .15em; }
.big { overflow-wrap: anywhere; font-family: var(--word-font); font-size: clamp(1.9rem, 10vw, 3.2rem); font-weight: 700; text-align: center; letter-spacing: .05em; margin: 14px 0; min-height: 4rem; }
.big.hidden { color: transparent; user-select: none; }
.answer { font-family: var(--word-font); font-size: 2rem; text-align: center; max-width: 440px; margin: 0 auto; display: block; border-radius: 18px; }
.levels { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 8px 0 14px; }
.levels button[aria-pressed="true"] { background: var(--sun); border-color: var(--sun-dark); color: #3a2a00; }
.blanks { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0; font-family: var(--word-font); }
.blanks span { width: 2.2rem; height: 2.8rem; border-bottom: 5px solid var(--brand); display: inline-flex; align-items: flex-end; justify-content: center; font-size: 2rem; font-weight: 700; color: var(--brand-dark); }
.faces { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.face-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 18px; min-width: 130px; border-radius: 22px; font-family: var(--word-font); font-size: 1.05rem; }
.face-btn .emoji { font-size: 3rem; line-height: 1; }
.scorebig { font-size: 3rem; margin: 0 0 6px; color: var(--brand-dark); }
.growth { background: var(--brand-soft); border-radius: 16px; padding: 4px 14px; margin: 12px 0; }
.trickylist { text-align: left; max-width: 560px; margin: 10px auto; }
.trickylist li { margin: 8px 0; }
.pop { animation: pop .5s ease; }
.mascot-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.mascot-row svg { width: 90px; height: 90px; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* settings panel */
.modal-bg { position: fixed; inset: 0; background: rgba(30, 20, 80, .55); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 20px 12px; overflow-y: auto; }
.modal-bg.peek { background: rgba(30, 20, 80, .12); align-items: flex-end; padding: 0 8px 8px; pointer-events: none; overflow: visible; }
.modal-bg.peek .modal { pointer-events: auto; max-height: 52vh; overflow-y: auto; box-shadow: 0 -6px 24px rgba(30, 20, 80, .3); }
.modal { background: var(--card); border-radius: 26px; border: 3px solid var(--line); max-width: 560px; width: 100%; padding: 20px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand-dark); color: var(--brand-ink); }
.swatch { width: 44px; height: 44px; padding: 0 !important; border-radius: 14px; }

/* teacher console */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand-dark); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 2px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tablewrap { overflow-x: auto; }
.alert { border-left: 8px solid var(--coral); padding: 8px 12px; background: var(--card); border-radius: 12px; margin: 6px 0; }
.alert.win { border-left-color: var(--leaf); }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.bar-cell .progress { flex: 1; height: 12px; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: .85rem; }
.heat th.w { height: 110px; vertical-align: bottom; padding: 0 2px; }
.heat th.w span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: .85rem; text-transform: none; color: var(--ink); letter-spacing: 0; font-family: var(--word-font); }
.heat td { padding: 0; border: 0; }
.heat td.c { width: 32px; height: 30px; text-align: center; border-radius: 8px; font-size: 1rem; }
.heat td.name { white-space: nowrap; padding-right: 10px; font-weight: 600; position: sticky; left: 0; background: var(--card); }
.c0 { background: #ece9f7; } .c1 { background: #ffe0a8; } .c2 { background: #d4f0a8; } .c3 { background: #9fe0a0; } .c4 { background: #5fcf86; } .cx { background: #ffb4b4; }
.live-q { font-size: 3rem; font-family: var(--word-font); font-weight: 700; }
.bigstat { font-family: var(--head-font); font-size: 2.2rem; color: var(--brand-dark); line-height: 1; }

/* print */
@media print {
  body { background: #fff !important; color: #000; }
  header.top, .noprint, .tabs, .confetti { display: none !important; }
  .printonly { display: block; }
  .card { border: 0; padding: 0; box-shadow: none; }
  .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .logincard { border: 2px dashed #666; padding: 12px; border-radius: 12px; page-break-inside: avoid; font-size: 13pt; display: flex; gap: 12px; align-items: center; }
  .logincard svg.qr { width: 110px; height: 110px; flex: none; }
  .sheet { page-break-after: always; font-family: var(--word-font); }
  .sheet table { font-size: 12pt; } .sheet td, .sheet th { border: 1px solid #888; padding: 6px 8px; color: #000; }
  .sheet .grid td { height: 34px; }
}
@media (max-width: 560px) {
  .hero { flex-direction: column; text-align: center; }
  .hero .bubble::before { display: none; }
  header.top { padding: 8px 10px; }
}
.blanks b { display: inline-flex; align-items: flex-end; font-size: 2rem; padding: 0 2px; color: var(--ink); }
.blanks span:empty::after { content: "\00a0"; }
body.print-only > header, body.print-only > main { display: none !important; }
body.print-only #printArea { display: block !important; }
body.print-only { background: #fff !important; }
.login-wrap, .login-wrap input, .login-wrap button, .login-wrap label { font-family: var(--word-font); }
svg.qr { width: 110px; height: 110px; flex: none; }
.heat { width: auto; }
@media (max-width: 560px) {
  #schoolTitle { display: none; }
  header.top { flex-wrap: nowrap; }
  .who { flex-wrap: nowrap; gap: 6px; }
  .who .chip { font-size: .8rem; padding: 2px 8px; }
  .who button.mini { padding: 2px 8px; }
  .cta-row button { flex: 1 1 100%; }
  .hero svg { width: 96px; height: 96px; }
}

.wordcard, .wc-top { min-width: 0; }
.wc-top { gap: 8px; }
@media (max-width: 560px) { .row > .shrink { flex: 1 1 100%; max-width: 100%; min-width: 0; } .row > .shrink button { width: 100%; max-width: 100%; } }
@media (max-width: 380px) { #whoami { display: none; } .journey { max-width: 100%; overflow-x: auto; } #topbar .who { gap: 4px; flex-wrap: nowrap; } }
.row > * { min-width: 0; } .journey { max-width: 100%; }

/* ---------- Pupil themes (Garden is the base look above) ---------- */
html[data-theme="space"] { --brand: #9a8cff; --brand-dark: #6f5ff0; --brand-ink: #14102e; --bed1: #232a6b; --bed2: #161c58; --bedline: #4650b8; }
html[data-theme="football"] { --brand: #14833b; --brand-dark: #0c5f2a; --brand-ink: #fff; --bed1: #d8f5c8; --bed2: #b4e69a; --bedline: #8fd070; }
html[data-theme="ocean"] { --brand: #0a7ea8; --brand-dark: #065a7b; --brand-ink: #fff; --bed1: #c6edf9; --bed2: #94d8ef; --bedline: #6cc0e0; }
html[data-theme="arcade"] { --brand: #2fd68f; --brand-dark: #1aa56c; --brand-ink: #04140d; --bed1: #272736; --bed2: #181824; --bedline: #2fd68f; }
html[data-theme="magic"] { --brand: #6b3fc4; --brand-dark: #4f2a9e; --brand-ink: #fff; --bed1: #ece0ff; --bed2: #d7c1ff; --bedline: #b794f4; }
html[data-theme="music"] { --brand: #d6336c; --brand-dark: #a61e4d; --brand-ink: #fff; --bed1: #ffe3ee; --bed2: #ffc6db; --bedline: #ff9fc0; }
:root[data-theme="space"]:not([data-tint]) { --bg: #0e1030; --bg2: #1a1450; --card: #1f2457; --ink: #f3f1ff; --muted: #bdbae8; --line: #373d86; --brand-soft: #2b2f78; --good: #46d890; --bad: #ff8a8a; }
:root[data-theme="football"]:not([data-tint]) { --bg: #e8f8e0; --bg2: #d2f0c0; --card: #ffffff; --ink: #16301c; --muted: #4d6b52; --line: #cfe6c6; --brand-soft: #dff5d8; --good: #16824c; --bad: #c62f2f; }
:root[data-theme="ocean"]:not([data-tint]) { --bg: #dff6ff; --bg2: #bfeaf8; --card: #ffffff; --ink: #0c2d4a; --muted: #476b85; --line: #bfe3f2; --brand-soft: #d4f1fb; --good: #16824c; --bad: #c62f2f; }
:root[data-theme="arcade"]:not([data-tint]) { --bg: #121218; --bg2: #1d1830; --card: #23232f; --ink: #f4f4ff; --muted: #b3b3d6; --line: #3a3a55; --brand-soft: #1e3a33; --good: #46d890; --bad: #ff8a8a; }
:root[data-theme="magic"]:not([data-tint]) { --bg: #f4ecff; --bg2: #e4d4ff; --card: #ffffff; --ink: #2a1457; --muted: #64508f; --line: #dccbf5; --brand-soft: #ece0ff; --good: #16824c; --bad: #c62f2f; }
:root[data-theme="music"]:not([data-tint]) { --bg: #fff0e6; --bg2: #ffdbe8; --card: #ffffff; --ink: #3a1747; --muted: #7a5a85; --line: #f2d3e0; --brand-soft: #ffe3ee; --good: #16824c; --bad: #c62f2f; }
html[data-theme="space"]:not([data-tint]) .progress, html[data-theme="arcade"]:not([data-tint]) .progress { background: rgba(255,255,255,.12); }
html[data-theme="arcade"] .tile, html[data-theme="space"] .tile { color: var(--ink); }
.plants span { background: rgba(255,255,255,.85); }
html[data-theme="space"]:not([data-tint]) .garden-bed, html[data-theme="arcade"]:not([data-tint]) .garden-bed { color: var(--ink); }
html[data-theme="space"]:not([data-tint]) .garden-bed .small, html[data-theme="arcade"]:not([data-tint]) .garden-bed .small { color: var(--ink) !important; }

/* theme picker */
.themegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 10px; }
.themecard { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; min-height: 78px; padding: 12px 14px; }
.themecard[aria-pressed="true"] { background: var(--brand); border-color: var(--brand-dark); color: var(--brand-ink); }
.tc-top { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.tc-icon { font-size: 1.9rem; line-height: 1; }
.tc-steps { font-size: 1.15rem; letter-spacing: .12em; }
#themeBtn { padding-left: 10px; padding-right: 10px; }
html[data-theme="arcade"][data-tint] { --brand: #0f8a5f; --brand-dark: #0a6644; --brand-ink: #ffffff; }
html[data-theme="arcade"][data-tint] .garden-bed { color: #2a2350; }
html[data-theme="space"][data-tint] { --brand: #5a47e0; --brand-dark: #4a39c9; --brand-ink: #ffffff; }
.tc-steps { letter-spacing: 0; word-spacing: .2em; white-space: nowrap; font-size: 1.05rem; }

/* Long words stay in one piece: smaller type and tighter spacing before any break is allowed. */
.wordcard .bigword { font-size: clamp(1.4rem, 5.5vw, 1.9rem); letter-spacing: .01em; }
.pupil.little .wordcard .bigword { font-size: clamp(1.5rem, 6vw, 2.2rem); }
html[data-size="large"] .wordcard .bigword { font-size: clamp(1.4rem, 5vw, 2rem); }
.wordcard .wc-top { flex-wrap: nowrap; }
.wordcard .wc-top .bigword { flex: 1 1 auto; overflow: hidden; }
.wordcard .stage { flex: none; }
