h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* ---- App styles ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
:root {
    /* Pastel: soft colours, dark text, gentle shadows; muted sea green as the one strong colour */
    --bg: #fbfaf7;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #5b6577;
    --accent: #4a9a8f;
    --accent-dark: #357a70;
    --ink: #b5ddd6;          /* light accent outlines */
    --ink-soft: #dcefeb;     /* light accent fills */
    --line: #ebe8f0;         /* quiet outlines */
    --ok: #1f9d55;
    --bad: #d64545;
    --border: #e4e1f5;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(30, 41, 59, .04), 0 6px 18px rgba(30, 41, 59, .06);
    --shadow-lift: 0 2px 4px rgba(30, 41, 59, .06), 0 12px 28px rgba(30, 41, 59, .1);
    --font: "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { margin-top: 0; font-size: 2.1rem; font-weight: 800; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: .6rem 1.25rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: .5rem; color: var(--text); font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.brand img { width: 2.1rem; height: 2.1rem; border-radius: 10px; transition: transform .2s; }
.brand:hover img { transform: rotate(-8deg) scale(1.08); }


.content { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.back-home {
    display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .75rem; padding: .2rem .75rem;
    border: 0; border-radius: 999px; background: var(--ink-soft);
    color: var(--accent-dark); font-weight: 700; font-size: .9rem; text-decoration: none;
}
.back-home:hover { background: #c8e6e0; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.2rem; padding: 1.5rem 1rem 2rem; color: var(--muted); font-size: .9rem; }
.site-footer a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.about { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.panel.about-card { width: 100%; padding: 1.4rem 1.6rem; text-align: left; }
.about-card h2 { margin: 0 0 .5rem; font-size: 1.3rem; }
.about-card h3 { margin: 1rem 0 .4rem; font-size: 1.05rem; }
.about-card p { margin: 0; }
.about-card ul { margin: 0; padding-left: 1.2rem; }
.about-card li { margin-bottom: .5rem; }

button, select, input { font: inherit; }

/* Plain buttons stay flat (many game pieces are buttons); the big ones get a small solid bottom edge. */
button, a.button {
    padding: .5rem 1.1rem;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform .1s, box-shadow .1s, filter .15s;
}
a.button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; text-decoration: none; }
button:hover:not(:disabled), a.button:hover { filter: brightness(1.07); }
button:disabled { cursor: default; }
button.big, a.button.big {
    padding: .75rem 1.7rem; font-size: 1.1rem; border-radius: 14px;
    box-shadow: 0 3px 0 var(--accent-dark);
}
button.big:active:not(:disabled), a.button.big:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
button.big.secondary, a.button.big.secondary { border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
button.big.secondary:active:not(:disabled), a.button.big.secondary:active { box-shadow: 0 1px 0 var(--line); }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(74, 154, 143, .45); outline-offset: 2px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin-bottom: 1rem; }

.result { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.result.success { background: #e3f6ea; color: var(--ok); }
.result.fail { background: #fbe7e7; color: var(--bad); }

/* Pairs */
.board { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: .6rem; }
.card {
    aspect-ratio: 1;
    padding: 0;
    border-radius: 10px;
    background: var(--accent);
    font-size: clamp(1.4rem, 6vw, 2.6rem);
    transition: background .2s, transform .2s;
}
.card:disabled { cursor: default; }
.card.flipped { background: var(--surface); border: 2px solid var(--border); color: var(--text); }
.card.matched { background: #e3f6ea; border-color: var(--ok); opacity: .75; }
.card:not(.flipped):hover { transform: scale(1.03); }

/* Numbers */
.panel {
    padding: 2rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.digits { font-size: clamp(2rem, 9vw, 3.5rem); font-weight: 700; letter-spacing: .3em; font-variant-numeric: tabular-nums; word-break: break-all; }
.progress { height: 6px; margin-top: 1.25rem; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--accent); animation: shrink linear forwards; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }
.panel form { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
.answer {
    width: min(100%, 320px);
    padding: .6rem .8rem;
    font-size: 1.6rem;
    text-align: center;
    letter-spacing: .2em;
    border: 2px solid var(--border);
    border-radius: 8px;
}
.answer:focus { outline: none; border-color: var(--accent); }

.stats { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.level-progress strong span { color: var(--border); transition: color .3s; }
.level-progress strong span.on { color: #22c55e; }
.nowrap { white-space: nowrap; }
.toolbar select { padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
h1 { margin-top: 0; }

/* Touch devices: no tap highlight, no double-tap zoom on controls */
button, a, select, input { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Phones */
@media (max-width: 560px) {
    .content { padding: 1rem 1rem 2rem; }
    h1 { font-size: 1.6rem; }

    .toolbar { gap: .6rem; }
    .toolbar .stats { width: 100%; justify-content: space-between; }

    /* Max 4 columns on narrow screens so cards stay tappable */
    .board { --cols: 4 !important; gap: .45rem; }
    .card { font-size: 1.8rem; border-radius: 8px; }

    .panel { padding: 1.5rem .75rem; }
    .digits { letter-spacing: .15em; }
    .panel form { flex-direction: column; align-items: stretch; }
    .answer { width: 100%; }
    button.big { width: 100%; padding: .8rem 1rem; }
}

/* Sequence */
.status { display: flex; flex-direction: column; align-items: center; gap: .75rem; min-height: 3rem; margin-bottom: 1rem; text-align: center; }
.status .result { margin: 0; width: 100%; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 380px; margin: 0 auto; }
.tile3 {
    aspect-ratio: 1;
    padding: 0;
    border-radius: 12px;
    background: hsl(var(--hue) 55% 72%);
    opacity: .45;
    transition: opacity .12s, transform .12s, box-shadow .12s;
}
.tile3:disabled { cursor: default; }
.tile3:not(:disabled) { opacity: .7; }
.tile3:not(:disabled):active { transform: scale(.96); }
.tile3.lit { opacity: 1; transform: scale(1.04); box-shadow: 0 0 0 4px #fff, 0 0 18px hsl(var(--hue) 70% 55%); }
.tile3.wrong { opacity: 1; background: var(--bad); }

/* Words */
.word-list { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1.25rem; }
.word { padding: .5rem .9rem; border-radius: 8px; background: var(--bg); font-size: 1.25rem; font-weight: 600; }
.word-option {
    padding: .5rem .9rem;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.05rem;
}
.word-option.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.word-option.correct { background: #e3f6ea; border-color: var(--ok); color: var(--ok); }
.word-option.wrong { background: #fbe7e7; border-color: var(--bad); color: var(--bad); text-decoration: line-through; }
.word-option.missed { border-color: var(--ok); border-style: dashed; color: var(--ok); }
.word-option:disabled { cursor: default; }
.word-option:not(.correct, .wrong, .missed):disabled { opacity: .5; }
button.big:disabled { opacity: .45; cursor: default; }



/* Grid */
.gridn { display: grid; grid-template-columns: repeat(var(--size), 1fr); gap: .5rem; max-width: 400px; margin: 0 auto; }
.cell {
    aspect-ratio: 1;
    padding: 0;
    border-radius: 8px;
    background: var(--border);
    transition: background .15s, transform .12s;
}
.cell:disabled { cursor: default; }
.cell:not(:disabled):hover { background: #cdd4e6; }
.cell:not(:disabled):active { transform: scale(.95); }
.cell.lit, .cell.found { background: var(--accent); }
.cell.wrong { background: var(--bad); }
.cell.missed { background: var(--surface); box-shadow: inset 0 0 0 3px var(--accent); }

/* What's New */
.emoji-set { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1.25rem; }
.emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.6rem;
    height: 3.6rem;
    padding: 0;
    border-radius: 10px;
    background: var(--bg);
    font-size: 2.2rem;
}
button.emoji { border: 2px solid var(--border); background: var(--surface); }
button.emoji:not(:disabled):active { transform: scale(.94); }
button.emoji:disabled { cursor: default; opacity: .5; }
button.emoji.correct { opacity: 1; border-color: var(--ok); background: #e3f6ea; box-shadow: 0 0 0 2px var(--ok); }
button.emoji.wrong { opacity: 1; border-color: var(--bad); background: #fbe7e7; }
@media (max-width: 560px) {
    .emoji { width: 3.1rem; height: 3.1rem; font-size: 1.9rem; }
}

/* Language switch */
.lang { display: flex; margin-left: auto; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.lang a { padding: .3rem .6rem; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.lang a + a { border-left: 1px solid var(--border); }
.lang a.active { background: var(--accent); color: #fff; }

/* Phones: tighter top bar */
@media (max-width: 560px) {
    .topbar { gap: .5rem; padding: .6rem .75rem; }
}

/* Pairs online */
.button-link {
    padding: .45rem 1rem;
    border-radius: 6px;
    border: 2px solid var(--accent);
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}
.button-link:hover { background: var(--accent); color: #fff; }
.muted { color: var(--muted); }
.share {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: .9rem 1rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px dashed var(--accent);
    border-radius: 10px;
}
.share-row { display: flex; gap: .5rem; }
.share-row input {
    flex: 1;
    min-width: 0;
    padding: .45rem .6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}
.players { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 1rem; list-style: none; }
.players li {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .8rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 999px;
}
.players li.turn { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 154, 143, .2); }
.players li strong { min-width: 1.4rem; text-align: center; padding: 0 .3rem; border-radius: 999px; background: var(--bg); }
.new-game { margin-top: 1rem; justify-content: center; }
@media (max-width: 560px) {
    .toolbar .button-link { width: 100%; text-align: center; }
}
.my-name { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.my-name input {
    width: min(100%, 220px);
    padding: .4rem .6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}
.my-name input:focus { outline: none; border-color: var(--accent); }
.players li.me .player-name { font-weight: 700; }
.players li.me .player-name::after { content: " ★"; color: var(--accent); }

/* Mode switch (solo / with others) */
.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: -.25rem 0 1.25rem; }
.mode {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .9rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.mode:hover { border-color: #b9c3e6; transform: translateY(-1px); }
.mode.active {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(74, 154, 143, .1), rgba(74, 154, 143, .02));
    box-shadow: 0 4px 14px rgba(74, 154, 143, .15);
    pointer-events: none;
}
.mode-icon {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg);
    font-size: 1.4rem;
}
.mode.active .mode-icon { background: var(--accent); }
.mode-text { display: flex; flex-direction: column; min-width: 0; }
.mode-text small { color: var(--muted); line-height: 1.25; }
.mode.active strong { color: var(--accent); }

.lobby { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.lobby p { margin: 0 0 .5rem; }
.countdown { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.countdown-number {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--accent);
    animation: pop 1s ease-out infinite;
}
@keyframes pop { from { transform: scale(1.25); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.race-over { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.restart-race { margin-top: 1rem; text-align: center; }
button.link { background: none; color: var(--muted); padding: .3rem .5rem; text-decoration: underline; }
button.link:hover { color: var(--accent); }

@media (max-width: 560px) {
    .mode-switch { gap: .45rem; }
    .mode { flex-direction: column; text-align: center; gap: .35rem; padding: .6rem .5rem; }
    .mode-icon { width: 2.2rem; height: 2.2rem; font-size: 1.2rem; }
    .mode-text small { font-size: .78rem; }
    .race-over button { width: 100%; }
}
.players .player-status { color: var(--muted); font-size: .85rem; }
.players li.done { border-color: var(--ok); }
.players li.done .player-status { color: var(--ok); }

/* Animal math */
.difficulty-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1.25rem; }
.difficulty {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 7.5rem;
    padding: .6rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}
.difficulty small { color: var(--muted); }
.difficulty.active { border-color: var(--accent); background: rgba(74, 154, 143, .08); }
.difficulty.active strong { color: var(--accent); }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; max-width: 320px; margin: 0 auto .75rem; }
.choice {
    padding: .8rem 0;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 1.6rem;
    font-weight: 700;
}
.choice:disabled { cursor: default; opacity: .5; }
.choice.correct { opacity: 1; border-color: var(--ok); background: #e3f6ea; color: var(--ok); }
.choice.wrong { opacity: 1; border-color: var(--bad); background: #fbe7e7; color: var(--bad); }
.variant-picker { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.variant-picker select { padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.race-over .variant-picker { margin: 0; }

/* N-back */
.nback { max-width: 300px; }
.nback .cell { cursor: default; }
.match-row { display: flex; justify-content: center; margin-top: 1rem; }
button.match { min-width: 12rem; transition: background .15s; }
button.match:disabled { opacity: .55; cursor: default; }
button.match.hit { background: var(--ok); opacity: 1; }
button.match.wrong { background: var(--bad); opacity: 1; }

/* Where was it? */
.spot {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: clamp(1.3rem, 6vw, 2.2rem);
}
.spot:disabled { cursor: default; }
.spot:not(:disabled):hover { border-color: var(--accent); }
.spot:not(:disabled):active { transform: scale(.95); }
.spot.answered { background: #e3f6ea; border-color: var(--ok); }
.spot.wrong { background: #fbe7e7; border-color: var(--bad); }
.spot.target { border-color: var(--ok); box-shadow: inset 0 0 0 3px var(--ok); }
.ask-prompt { display: inline-flex; align-items: center; gap: .4rem; font-size: 1.2rem; }
.ask-item { font-size: 2.4rem; line-height: 1; }

/* Order */
.order-current { display: grid; place-items: center; height: 6rem; font-size: 4.5rem; }
.order-dots { display: flex; justify-content: center; gap: .35rem; margin-top: .75rem; }
.order-dots .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--border); }
.order-dots .dot.on { background: var(--accent); }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-bottom: 1.25rem; }
.slot {
    display: grid;
    place-items: center;
    width: 3.2rem;
    height: 3.2rem;
    border: 2px dashed var(--border);
    border-radius: 10px;
    color: var(--muted);
    font-size: 1rem;
}
.slot.filled, .slot.revealed { border-style: solid; font-size: 1.9rem; color: var(--text); }
.slot.correct { border-color: var(--ok); background: #e3f6ea; }
.slot.revealed { border-color: var(--accent); }
@media (max-width: 560px) {
    .slot { width: 2.8rem; height: 2.8rem; }
    .slot.filled, .slot.revealed { font-size: 1.6rem; }
}
.animal-sum {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .5rem .9rem;
    margin-bottom: 1.25rem;
}
.animal-group {
    display: inline-flex;
    flex-direction: column;
    gap: .15rem;
    padding: .4rem .6rem;
    border-radius: 12px;
    background: var(--bg);
}
.animal-row { font-size: clamp(1.5rem, 6vw, 2.2rem); letter-spacing: .1em; white-space: nowrap; }
.animal-sum .operator { font-size: clamp(1.8rem, 7vw, 2.4rem); font-weight: 700; color: var(--muted); }
.picker-label { margin: 0 0 .4rem; font-weight: 600; color: var(--muted); }

/* Graphic dictation */
.dictation-goal { margin: 0 0 .5rem; font-size: 1.15rem; font-weight: 600; }
.dictation-goal span { font-size: 1.6rem; vertical-align: middle; }
.commands { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-bottom: .9rem; }
.command {
    padding: .25rem .6rem;
    border-radius: 8px;
    background: var(--bg);
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
}
.paper {
    display: block;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    background: #fdfdf8;
    border: 1px solid var(--border);
    border-radius: 8px;
    touch-action: manipulation;
}
.paper .grid-line { stroke: #b9cdf0; stroke-width: .35; }
.paper .figure { font-size: 8px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.paper .drawn-path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.paper .drawn-path.ok { stroke: var(--ok); }
.paper .drawn-path.bad { stroke: var(--bad); }
.paper .target-path { fill: none; stroke: var(--ok); stroke-width: 1.4; stroke-dasharray: 2.5 2; stroke-linecap: round; }
.paper .pen-dot { fill: var(--accent); pointer-events: none; }
.paper .hit { fill: transparent; cursor: pointer; }
.paper .hit.reachable:hover { fill: rgba(74, 154, 143, .18); }
.hint { margin: .6rem 0 0; color: var(--bad); }
.draw-actions { display: flex; justify-content: center; gap: .6rem; margin-top: .9rem; }
button.secondary { background: var(--surface); color: var(--text); border: 2px solid var(--line); }
button.secondary:hover:not(:disabled) { border-color: var(--ink); background: #f4faf9; filter: none; }
.draw-actions button:disabled { opacity: .5; cursor: default; }
.player-names { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1.25rem; }
.player-names input {
    width: min(100%, 160px);
    padding: .4rem .6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}
.player-names input:focus { outline: none; border-color: var(--accent); }
.turn-banner { margin: 0 0 .4rem; font-size: 1.1rem; }
.turn-banner strong { color: var(--accent); }

/* What's missing */
.emoji.gap { border: 2px dashed var(--border); background: transparent; color: var(--muted); font-size: 1.6rem; }

/* How many */
.meadow {
    position: relative;
    max-width: 480px;
    aspect-ratio: 7 / 5;
    margin: 0 auto 1rem;
    background: linear-gradient(#e6f5dc, #cfe9bd);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.meadow-animal {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: clamp(1.4rem, 6vw, 2.2rem);
    line-height: 1;
}
.meadow-animal.asked { filter: drop-shadow(0 0 3px var(--accent)) drop-shadow(0 0 3px var(--accent)); }
.count-question { margin: 0 0 .75rem; font-size: 1.2rem; font-weight: 600; }
.count-question span { font-size: 1.8rem; vertical-align: middle; }

/* Dress the princess */
.dress-up { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.dress-up .stage { position: sticky; top: 1rem; width: min(100%, 360px, 40vh); margin: 0 auto; }
.dress-up .stage svg {
    display: block;
    width: 100%;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.dress-up .stage text { text-anchor: middle; dominant-baseline: central; }
.dress-up .stage .decor { font-size: 16px; }
.wardrobe-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.wardrobe-tab {
    padding: .35rem .75rem;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
}
.wardrobe-tab.active { border-color: var(--accent); background: rgba(74, 154, 143, .08); color: var(--accent); font-weight: 600; }
.wardrobe-items { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.wardrobe-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    min-width: 4.8rem;
    padding: .5rem .4rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}
.wardrobe-item .icon { font-size: 1.6rem; line-height: 1.8rem; }
.wardrobe-item small { font-size: .75rem; }
.wardrobe-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 154, 143, .2); }
.swatch { width: 1.8rem; height: 1.8rem; border: 1px solid rgba(0, 0, 0, .2); border-radius: 50%; }
.wardrobe-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 720px) {
    .dress-up { grid-template-columns: minmax(0, 1fr); }
    .dress-up .stage { position: relative; top: 0; }
}
.curtain {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: 12px;
    background: repeating-linear-gradient(90deg, #be185d 0 18px, #9d174d 18px 36px);
    color: #fff;
    text-align: center;
}
.curtain span { font-size: 4rem; line-height: 1; }
.quiz-question { margin: 0 0 .75rem; font-size: 1.2rem; font-weight: 600; }
.quiz-results { padding: 0; margin: 0 0 1rem; list-style: none; }
.quiz-results li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
.quiz-results li.ok { color: var(--ok); }
.quiz-results li.bad { color: var(--bad); }
.quiz-results li strong { color: var(--text); }
.hide-action { margin-top: 1rem; }
.quiz-results li .muted { margin-left: .35rem; }

/* Build a truck */
.dress-up.wide .stage { width: min(100%, 400px, 46vh); }
.curtain.garage { background: repeating-linear-gradient(180deg, #9ca3af 0 14px, #6b7280 14px 16px); }
.stage .beacon { animation: beacon .8s ease-in-out infinite; }
.stage .beacon.alt { animation-delay: .4s; }
@keyframes beacon { 50% { opacity: .3; } }
.stage .spray { animation: spray .5s linear infinite; }
@keyframes spray { to { stroke-dashoffset: -22; } }
@media (prefers-reduced-motion: reduce) {
    .stage .beacon, .stage .spray { animation: none; }
}
.stage .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flame .6s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scale(1, 1) skewX(-3deg); } to { transform: scale(.92, 1.1) skewX(3deg); } }
.stage .pet-tail { transform-box: fill-box; transform-origin: 0% 100%; animation: pet-wag .5s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) {
    .stage .flame, .stage .pet-tail { animation: none; }
}
.stage .puff { transform-box: fill-box; transform-origin: center; animation: puff 1.4s ease-in-out infinite alternate; }
@keyframes puff { from { transform: translateY(3px) scale(.85); } to { transform: translateY(-3px) scale(1.1); } }
@media (prefers-reduced-motion: reduce) {
    .stage .puff { animation: none; }
}

/* Colourful animals */
.emoji.color-tile { border: 3px solid rgba(0, 0, 0, .15); }
.color-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; max-width: 340px; margin: 0 auto 1rem; }
button.color-choice {
    width: 3.6rem;
    height: 3.6rem;
    padding: 0;
    border: 3px solid rgba(0, 0, 0, .15);
    border-radius: 50%;
}
button.color-choice:active { transform: scale(.92); }

/* Phones: keep the picture in view while picking */
@media (max-width: 720px) {
    /* Tabs on the left edge, the first choice on the right edge, more choices below */
    .dress-up.dressing {
        grid-template-columns: 3.2rem minmax(0, 1fr) 4.2rem;
        grid-template-areas: "tabs stage slots" "more more more" "actions actions actions" "hide hide hide";
        gap: .5rem;
    }
    .dress-up.dressing .wardrobe { display: contents; }
    .dress-up.dressing .stage { grid-area: stage; width: 100%; }
    /* The side rails are as tall as the picture (height 0 + min-height 100% = the row's height) and scroll inside. */
    .dress-up.dressing .wardrobe-tabs,
    .dress-up.dressing .wardrobe-slots { height: 0; min-height: 100%; overflow-y: auto; }
    .dress-up.dressing .wardrobe-tabs { grid-area: tabs; flex-direction: column; flex-wrap: nowrap; margin: 0; }
    .dress-up.dressing .wardrobe-tab { flex-shrink: 0; padding: .4rem 0; border-radius: 12px; font-size: 1.3rem; }
    .dress-up.dressing .tab-name { display: none; }
    .dress-up.dressing .wardrobe-slots { grid-area: slots; }
    .dress-up.dressing .wardrobe-slots .picker-label { margin-bottom: .25rem; font-size: .7rem; text-align: center; }
    .dress-up.dressing .wardrobe-slots .wardrobe-items { flex-direction: column; flex-wrap: nowrap; gap: .35rem; margin-bottom: 0; }
    .dress-up.dressing .wardrobe-slots .wardrobe-item { width: 100%; min-width: 0; padding: .35rem .1rem; }
    .dress-up.dressing .wardrobe-more { grid-area: more; }
    .dress-up.dressing .wardrobe-more .picker-label { margin-bottom: .25rem; font-size: .8rem; }
    .dress-up.dressing .wardrobe-more .wardrobe-items { flex-wrap: nowrap; overflow-x: auto; gap: .35rem; margin-bottom: .5rem; padding-bottom: .2rem; }
    .dress-up.dressing .wardrobe-more .wardrobe-item { flex-shrink: 0; min-width: 3.2rem; padding: .35rem .3rem; }
    .dress-up.dressing .wardrobe-item small { display: none; }
    .dress-up.dressing .wardrobe-actions:not(.hide-action) { grid-area: actions; justify-content: center; }
    .dress-up.dressing .hide-action { grid-area: hide; justify-content: center; margin-top: 0; }

    /* Quiz and results: a smaller picture, so the answers are right below it */
    .dress-up.tall:not(.dressing) .stage { width: min(100%, 26vh); }
    .dress-up.wide:not(.dressing) .stage { width: min(100%, 36vh); }
}

/* ---- Bunny Run ---- */
.runner { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.runner .result { width: 100%; margin: 0; }
.runner-canvas {
    width: 100%; aspect-ratio: 600 / 220; border-radius: 10px;
    touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.runner-canvas:focus { outline: none; }

/* ---- Rainbow Slide ---- */
.rainbow { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.rainbow .result { width: 100%; margin: 0; }
.rainbow-canvas {
    width: 100%; max-width: 720px; aspect-ratio: 600 / 400; border-radius: 10px;
    touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.rainbow-canvas:focus { outline: none; }

/* ---- Dot to Dot ---- */
.dots-game { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.dots-toolbar { display: flex; flex-direction: column; align-items: center; gap: .6rem; width: 100%; }
.dots-options { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; }
.dots-modes { display: flex; gap: .4rem; }
.dots-pictures { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.dots-chip {
    display: flex; flex-direction: column; align-items: center; min-width: 4.4rem; padding: .3rem .4rem;
    border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.dots-chip .icon { font-size: 1.3rem; line-height: 1.6rem; }
.dots-chip small { font-size: .7rem; color: var(--muted); }
.dots-chip.done { background: #f0fdf4; }
.dots-chip.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 154, 143, .2); }
.dots-board { position: relative; width: min(100%, 520px, 62vh); }
.dots-board svg {
    display: block; width: 100%; border-radius: 14px; background: #fffdf7;
    box-shadow: inset 0 0 0 1px var(--border); touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.dots-board.finished svg { background: linear-gradient(#e0f2fe, #fffdf7); }
.dots-lines line { stroke: var(--accent); stroke-width: 1.3; stroke-linecap: round; }
.dots-board.finished .dots-lines { animation: dots-fade 1.2s ease-out forwards; }
.dot { cursor: pointer; }
.dot-hit { fill: transparent; }
.dot-mark { fill: #1f2937; transition: fill .2s, r .2s; }
.dot text { font-size: 4.4px; font-weight: 700; fill: #475569; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.dot.hit .dot-mark { fill: var(--accent); }
.dot.hit text { fill: #a5b4fc; }
.dot.next .dot-mark { fill: #f97316; animation: dots-pulse 1s ease-in-out 4s infinite; transform-box: fill-box; transform-origin: center; }
.dot.next text { fill: #ea580c; }
.dot.wrong .dot-mark { fill: #ef4444; }
.dot.wrong { animation: dots-shake .4s; transform-box: fill-box; transform-origin: center; }
.dots-status { margin: 0; font-size: 1.1rem; }
.dots-after { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
.dots-after p { margin: 0; }
.dots-name { font-size: 1.6rem; font-weight: 800; color: var(--accent); animation: dots-pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.dots-palette { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: .25rem 0; }
.dots-color { width: 2.2rem; height: 2.2rem; padding: 0; border: 2px solid rgba(0, 0, 0, .15); border-radius: 50%; }
.dots-color.active { transform: scale(1.18); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.dots-region { cursor: pointer; transition: fill .25s; }
.dots-details { pointer-events: none; }

/* The finished picture pops in, then keeps moving in its own way */
.dots-art { transform-box: view-box; transform-origin: 50% 50%; animation: dots-reveal .8s cubic-bezier(.3, 1.5, .5, 1) both; }
.dots-art > * { transform-box: view-box; transform-origin: 50% 50%; }
.motion-swim > * { animation: dots-swim 2.4s ease-in-out .8s infinite; }
.motion-rock > * { transform-origin: 50% 80%; animation: dots-rock 3s ease-in-out .8s infinite; }
.motion-flap > * { animation: dots-flap .9s ease-in-out .8s infinite; }
.motion-beat > * { animation: dots-beat 1.1s ease-in-out .8s infinite; }
.motion-twinkle > * { animation: dots-twinkle 2.6s ease-in-out .8s infinite; }
.motion-hover > * { animation: dots-hover 1.6s ease-in-out .8s infinite; }
.motion-drive > * { animation: dots-drive .5s ease-in-out .8s infinite; }
.motion-sway > * { transform-origin: 50% 92%; animation: dots-sway 2.6s ease-in-out .8s infinite; }
.motion-bounce > * { transform-origin: 50% 85%; animation: dots-bounce 1.2s ease-in-out .8s infinite; }
.motion-wobble > * { transform-origin: 50% 92%; animation: dots-wobble 1.8s ease-in-out .8s infinite; }
.motion-crawl > * { animation: dots-crawl 2.2s ease-in-out .8s infinite; }
.dots-details .rain { animation: dots-rain 1s linear infinite both; }
.dots-details .buzz { animation: dots-buzz 3s ease-in-out infinite; }
.dots-details .zzz g { animation: dots-zzz 2.4s ease-in-out infinite both; }
.dots-details .zzz g:nth-child(2) { animation-delay: .4s; }
.dots-details .zzz g:nth-child(3) { animation-delay: .8s; }
.dots-details .spin { transform-box: fill-box; transform-origin: center; animation: dots-spin .8s linear infinite; }
.dots-details .road { animation: dots-road .6s linear infinite; }
.dots-details .flame { transform-box: fill-box; transform-origin: 50% 0; animation: dots-flame .25s ease-in-out infinite alternate; }
.dots-details .smoke { animation: dots-smoke 1.8s ease-out infinite both; transform-box: fill-box; transform-origin: center; }
.dots-details .bubble { animation: dots-bubble 2.1s ease-in infinite both; }
.dots-details .waves { animation: dots-waves 2s linear infinite; }
.dots-details .waves.slow { animation-duration: 3.2s; animation-direction: reverse; }
.dots-details .sparkle { transform-box: fill-box; transform-origin: center; animation: dots-sparkle 1.4s ease-in-out infinite; }
.dots-details .blink { transform-box: fill-box; transform-origin: center; animation: dots-blink 3.5s infinite; }
.dots-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 14px; }
.dots-confetti span {
    position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; opacity: 0;
    animation: dots-confetti 1.8s ease-in forwards;
}
@keyframes dots-pulse { 50% { transform: scale(1.8); } }
@keyframes dots-shake { 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }
@keyframes dots-fade { to { opacity: 0; } }
@keyframes dots-pop { from { transform: scale(.3); opacity: 0; } }
@keyframes dots-reveal { from { transform: scale(.6); opacity: 0; } }
@keyframes dots-swim { 0%, 100% { transform: translateX(-3px) rotate(-3deg); } 50% { transform: translateX(3px) rotate(3deg); } }
@keyframes dots-rock { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes dots-flap { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.78); } }
@keyframes dots-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.1); } 30% { transform: scale(.98); } 45% { transform: scale(1.06); } }
@keyframes dots-twinkle { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.05); } }
@keyframes dots-hover { 0%, 100% { transform: translateY(2px); } 50% { transform: translateY(-3px); } }
@keyframes dots-drive { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1px); } }
@keyframes dots-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes dots-bounce { 0%, 100% { transform: translateY(0) scale(1.03, .97); } 50% { transform: translateY(-4px) scale(.98, 1.02); } }
@keyframes dots-wobble { 0%, 100% { transform: skewX(-4deg); } 50% { transform: skewX(4deg); } }
@keyframes dots-crawl { 0%, 100% { transform: translateX(3px); } 50% { transform: translateX(-3px) rotate(-1deg); } }
@keyframes dots-rain { from { opacity: 0; transform: translateY(-6px); } 30% { opacity: 1; } to { opacity: 0; transform: translateY(14px); } }
@keyframes dots-buzz { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-6px, 4px); } 50% { transform: translate(-2px, -3px); } 75% { transform: translate(4px, 3px); } }
@keyframes dots-zzz { 0%, 100% { opacity: .2; transform: translateY(2px); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes dots-spin { to { transform: rotate(360deg); } }
@keyframes dots-road { to { stroke-dashoffset: 10; } }
@keyframes dots-flame { from { transform: scaleY(.8); } to { transform: scaleY(1.15); } }
@keyframes dots-smoke { from { opacity: .9; transform: translateY(6px) scale(.5); } to { opacity: 0; transform: translateY(-6px) scale(1.3); } }
@keyframes dots-bubble { from { opacity: 1; transform: translateY(10px); } to { opacity: 0; transform: translateY(-10px); } }
@keyframes dots-waves { to { transform: translateX(-24px); } }
@keyframes dots-sparkle { 0%, 100% { transform: scale(.6); opacity: .5; } 50% { transform: scale(1.2); opacity: 1; } }
@keyframes dots-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes dots-confetti {
    0% { opacity: 1; transform: translate(0, 0) rotate(0); }
    100% { opacity: 0; transform: translate(var(--drift), 420px) rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) {
    .dots-art, .dots-art > *, .dots-details *, .dot.next .dot-mark, .dots-confetti span { animation: none !important; }
}

/* ---- Colour by Number ---- */
.cbn { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.cbn-pictures { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.cbn-progress { position: relative; width: min(100%, 900px); height: 1.3rem; border-radius: 999px; background: var(--border); overflow: hidden; }
.cbn-progress .bar { height: 100%; background: linear-gradient(90deg, #f472b6, #facc15, #4ade80); transition: width .3s; }
.cbn-progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #1e293b; }
.cbn-board { position: relative; width: min(100%, 900px); }
.cbn-board svg {
    display: block; width: 100%; max-height: 72vh; border-radius: 14px; background: #fff;
    box-shadow: inset 0 0 0 1px var(--border); touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.cbn-region { stroke: #334155; stroke-width: .5; stroke-linejoin: round; cursor: pointer; transition: fill .25s; }
.mosaic .cbn-region { stroke: #cbd5e1; stroke-width: .4; }
.cbn-board.finished .mosaic .cbn-region { stroke: transparent; }
.cbn-region.wrong { animation: dots-shake .4s; transform-box: fill-box; transform-origin: center; fill: #fecaca; }
.cbn-details, .cbn-labels { pointer-events: none; }
.cbn-labels text { font-weight: 700; fill: #64748b; text-anchor: middle; dominant-baseline: central; }
.cbn-labels .lit text { fill: #c2410c; font-weight: 900; }
.cbn-status { margin: 0; min-height: 1.5em; font-size: 1.1rem; text-align: center; }
.cbn-palette { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; }
.cbn-color {
    width: 3rem; height: 3rem; padding: 0; border: 3px solid rgba(0, 0, 0, .15); border-radius: 50%;
    font-size: 1.2rem; font-weight: 800; transition: transform .15s;
}
.cbn-color.active { transform: scale(1.18); box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent); }
.cbn-color.finished { opacity: .55; }
.cbn-toggle { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; cursor: pointer; }

/* ---- Shop ---- */
.shop { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.shop-shelf { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; }
.shop-item {
    display: flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 7rem; padding: .8rem 1rem .7rem;
    border: 2px solid #fde68a; border-radius: 12px; background: #fffbeb; box-shadow: 0 4px 0 #fde68a;
}
.shop-icon { font-size: 3rem; line-height: 1.1; }
.shop-name { font-weight: 700; }
.shop-price {
    margin-top: .2rem; padding: .05rem .6rem; border: 1.5px dashed #b45309; border-radius: 6px;
    background: #fff; color: #92400e; font-weight: 800; font-size: 1.2rem;
}
.shop-ask { margin: 0; font-size: 1.05rem; }
.shop-counter {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem; width: min(100%, 560px);
    min-height: 4.6rem; padding: .7rem 1rem; border: 2px dashed #a3d3cb; border-radius: 12px; background: #f4faf9;
}
.shop-counter.paid { border-style: solid; border-color: var(--ok); background: #effaf3; }
.shop-counter.shake { animation: dots-shake .4s; }
.shop-counter-label { margin-right: .3rem; color: var(--muted); font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.shop-sum { margin-left: auto; font-size: 1.3rem; font-weight: 800; color: var(--accent-dark); }
.shop-message { min-height: 1.5em; margin: 0; font-size: 1.1rem; font-weight: 600; text-align: center; }
.shop-message.ok { color: var(--ok); }
.shop-message.bad { color: var(--bad); }
.shop-wallet { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem; }

/* Czech coins: 1, 2, 5 steel, 10 copper, 20 brass, 50 brass with a steel ring */
.coin {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; padding: 0;
    width: var(--size, 3rem); height: var(--size, 3rem); border-radius: 50%; border: 2px solid rgba(0, 0, 0, .25);
    font-weight: 900; font-size: 1.05rem; line-height: 1; color: #334155;
    background: radial-gradient(circle at 35% 30%, #fff 0, #e2e8f0 35%, #94a3b8 100%);
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .45), 0 2px 0 rgba(0, 0, 0, .2);
    transition: transform .1s;
}
.coin small { font-size: .55rem; font-weight: 700; }
.coin:active:not(:disabled) { transform: scale(.92); }
.coin:disabled { opacity: 1; cursor: default; }
.coin-1 { --size: 2.6rem; }
.coin-2 { --size: 2.8rem; }
.coin-5 { --size: 3rem; }
.coin-10 { --size: 3.1rem; color: #4a1d0a; background: radial-gradient(circle at 35% 30%, #fed7aa 0, #ea8a4f 40%, #9a3412 100%); }
.coin-20 { --size: 3.3rem; color: #4a3200; background: radial-gradient(circle at 35% 30%, #fef9c3 0, #facc15 40%, #a16207 100%); }
.coin-50 {
    --size: 3.5rem; color: #4a3200;
    background: radial-gradient(circle at 50% 50%, #fde047 0 52%, #94a3b8 54%, #e2e8f0 70%, #94a3b8 100%);
}
.shop-counter .coin { --size: 2.6rem; font-size: .95rem; }

/* ---- What comes next ---- */
.patterns { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pattern-row { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.pattern-cell {
    display: grid; place-items: center; min-width: 4rem; height: 4rem; padding: 0 .5rem;
    border: 2px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow);
    font-size: 2rem; font-weight: 800; color: var(--text);
}
.pattern-cell.stars, .pattern-choice.stars { max-width: 7.5rem; font-size: 1.1rem; letter-spacing: 1px; color: #eab308; line-height: 1.1; word-break: break-all; }
.pattern-cell.hole { border: 2px dashed #a3d3cb; background: #f4faf9; color: var(--accent); animation: pattern-wait 1.6s ease-in-out infinite; }
.pattern-cell.hole.solved { border: 2px solid var(--ok); background: #effaf3; animation: dots-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pattern-wait { 50% { transform: translateY(-4px); } }
.pattern-message { min-height: 1.5em; margin: 0; font-size: 1.1rem; font-weight: 600; text-align: center; }
.pattern-message.ok { color: var(--ok); }
.pattern-message.bad { color: var(--bad); }
.pattern-choices { display: grid; grid-template-columns: repeat(4, minmax(4.5rem, 1fr)); gap: .6rem; }
.pattern-choice {
    min-height: 4.2rem; padding: .3rem .6rem; border: 2px solid var(--ink); border-radius: 12px;
    background: #fff; color: var(--text); font-size: 2rem; font-weight: 800; box-shadow: 0 4px 0 var(--ink-soft);
}
.pattern-choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink-soft); }
.pattern-choice.wrong { opacity: .35; text-decoration: line-through; box-shadow: none; animation: dots-shake .4s; }
@media (max-width: 560px) {
    .pattern-cell { min-width: 3.1rem; height: 3.1rem; font-size: 1.5rem; border-radius: 10px; }
    .pattern-choices { grid-template-columns: repeat(2, 1fr); width: 100%; }
    .shop-item { min-width: 6rem; padding: .6rem; }
    .shop-icon { font-size: 2.4rem; }
}
@media (prefers-reduced-motion: reduce) {
    .pattern-cell.hole { animation: none; }
}

/* ---- Clock ---- */
.clock-game { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.clock-face { width: min(78vw, 300px); height: auto; }
.clock-face text { font-size: 17px; font-weight: 800; fill: #334155; text-anchor: middle; dominant-baseline: central; }
.clock-face .hand { stroke-linecap: round; transform-box: view-box; transform-origin: 0 0; transition: transform .9s cubic-bezier(.4, 1.3, .5, 1); }
.clock-face .hand.hour { stroke: var(--accent-dark); stroke-width: 9; }
.clock-face .hand.minute { stroke: #f97316; stroke-width: 5; }
.clock-message, .maze-message, .shadow-message { min-height: 1.5em; margin: 0; font-size: 1.1rem; font-weight: 600; text-align: center; }
.clock-message.ok, .maze-message.ok, .shadow-message.ok { color: var(--ok); }
.clock-message.bad, .shadow-message.bad { color: var(--bad); }
.clock-choices { display: grid; grid-template-columns: repeat(4, minmax(4.8rem, 1fr)); gap: .6rem; }
.clock-choice {
    padding: .7rem .4rem; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--text);
    font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 0 3px 0 var(--ink-soft);
}
.clock-choice.wrong { opacity: .35; text-decoration: line-through; box-shadow: none; animation: dots-shake .4s; }

/* ---- Maze ---- */
.maze-game { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.maze-wrap { width: min(100%, 480px); border-radius: 12px; outline: none; }
.maze-wrap:focus-visible { box-shadow: 0 0 0 3px var(--ink); }
.maze { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.maze-cell { fill: transparent; cursor: pointer; }
.maze-cell:hover { fill: rgba(74, 154, 143, .1); }
.maze-emoji { text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.maze-bunny { transition: transform .18s ease-out; pointer-events: none; }
.maze-pad { display: grid; grid-template-columns: repeat(3, 3.4rem); grid-template-rows: repeat(2, 3.2rem); gap: .35rem; }
.maze-pad button { padding: 0; font-size: 1.2rem; }
.maze-pad .up { grid-column: 2; grid-row: 1; }
.maze-pad .left { grid-column: 1; grid-row: 2; }
.maze-pad .down { grid-column: 2; grid-row: 2; }
.maze-pad .right { grid-column: 3; grid-row: 2; }

/* ---- Whose shadow ---- */
.shadow-game { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.shadow-ask { margin: 0; font-size: 1.2rem; font-weight: 700; }
.shadow-target {
    display: grid; place-items: center; width: 9rem; height: 9rem; border-radius: 24px; background: #f4faf9; font-size: 6rem; line-height: 1;
}
.silhouette { display: inline-block; filter: brightness(0); opacity: .82; }
.mirror { display: inline-block; transform: scaleX(-1); }
.shadow-options { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(4.5rem, 6rem)); gap: .6rem; justify-content: center; }
.shadow-option {
    display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 2px solid var(--ink); border-radius: 16px;
    background: #fff; font-size: 2.8rem; line-height: 1; box-shadow: 0 3px 0 var(--ink-soft);
}
.shadow-option span { display: inline-block; }
.shadow-option.wrong { opacity: .3; box-shadow: none; animation: dots-shake .4s; }
.shadow-option.right { border-color: var(--ok); background: #effaf3; animation: dots-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
.shadow-option:disabled { cursor: default; }
@media (max-width: 560px) {
    .clock-choices { grid-template-columns: repeat(2, 1fr); width: 100%; }
    .shadow-options { grid-template-columns: repeat(3, 1fr); width: 100%; }
    .shadow-target { width: 7rem; height: 7rem; font-size: 4.6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .clock-face .hand, .maze-bunny { transition: none; }
}

/* ---- Shared message line for the thinking games ---- */
.game-message { min-height: 1.5em; margin: 0; font-size: 1.1rem; font-weight: 600; text-align: center; }
.game-message.ok { color: var(--ok); }
.game-message.bad { color: var(--bad); }

/* ---- More or less ---- */
.compare-game { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.compare-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .8rem; width: 100%; }
.compare-side {
    display: grid; place-items: center; min-height: 8rem; padding: .8rem; border-radius: 16px; background: #f4faf9;
}
.compare-group { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem; max-width: 12rem; font-size: 1.9rem; line-height: 1.15; }
.compare-number { font-size: 2.8rem; font-weight: 900; color: var(--text); white-space: nowrap; }
.compare-sign {
    display: grid; place-items: center; width: 3.6rem; height: 3.6rem; border: 2px dashed var(--ink); border-radius: 50%;
    font-size: 2rem; font-weight: 900; color: var(--accent);
}
.compare-sign.shown { border-style: solid; border-color: var(--ok); background: #effaf3; color: var(--ok); animation: dots-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
.compare-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.compare-choice {
    min-width: 5rem; padding: .7rem 1rem; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--text);
    font-size: 1.05rem; font-weight: 800; box-shadow: 0 3px 0 var(--ink-soft);
}
.compare-choice .sign, .compare-choice.number { font-size: 2rem; line-height: 1; }
.compare-choice.wrong { opacity: .35; text-decoration: line-through; box-shadow: none; animation: dots-shake .4s; }

/* ---- Scales ---- */
.balance-game { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.balance-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.2rem; padding: .4rem .9rem; border-radius: 12px; background: #fffbeb; font-size: 1.3rem; font-weight: 800; }
.balance-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.scale { position: relative; width: min(100%, 520px); height: 16.5rem; margin-top: 1rem; }
.beam {
    position: absolute; left: 5%; right: 5%; top: 1.5rem; height: 8px; border-radius: 4px; background: #64748b;
    display: flex; justify-content: space-between; transition: transform .8s cubic-bezier(.4, 1.4, .5, 1);
}
.pan {
    position: relative; top: 2.4rem; display: flex; align-items: flex-end; width: 42%; min-height: 7rem; padding: .4rem .4rem 1.1rem;
    border: 3px solid #94a3b8; border-top: 0; border-radius: 0 0 45% 45% / 0 0 30% 30%; background: rgba(255, 255, 255, .7);
    transform-origin: 50% -2.4rem; transition: transform .8s cubic-bezier(.4, 1.4, .5, 1);
}
.pan::before, .pan::after { content: ""; position: absolute; top: -2.4rem; width: 2px; height: 2.4rem; background: #94a3b8; }
.pan::before { left: 15%; }
.pan::after { right: 15%; }
.pan-items { display: flex; width: 100%; flex-wrap: wrap-reverse; justify-content: center; align-content: flex-start; gap: .2rem; }
.pan-fruit { font-size: 1.9rem; line-height: 1.1; }
.pan-unknown { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 2px dashed var(--accent); border-radius: 8px; color: var(--accent); font-weight: 900; font-size: 1.3rem; }
.blk { display: inline-block; width: 1.25rem; height: 1.25rem; border-radius: 4px; background: #f59e0b; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); vertical-align: middle; }
.balance-legend .blk { width: 1rem; height: 1rem; }
.stand { position: absolute; left: 50%; top: 1.4rem; bottom: 0; width: 10px; margin-left: -5px; border-radius: 5px; background: #94a3b8; }
.stand::after { content: ""; position: absolute; left: -2.5rem; bottom: 0; width: 5.6rem; height: 10px; border-radius: 5px; background: #94a3b8; }
.balance-ask { margin: 0; font-size: 1.15rem; font-weight: 700; text-align: center; }

/* ---- Picture sudoku ---- */
.sudoku-game { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.sudoku-grid {
    display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, calc(var(--n) * 4.6rem));
    border: 3px solid #475569; border-radius: 12px; overflow: hidden; background: #fff;
}
.sudoku-cell {
    aspect-ratio: 1; padding: 0; border: 0; border-right: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1; border-radius: 0;
    background: #fff; color: var(--text); font-size: clamp(1.4rem, 7vw, 2.2rem); line-height: 1;
}
.sudoku-cell.box-right { border-right: 3px solid #475569; }
.sudoku-cell.box-bottom { border-bottom: 3px solid #475569; }
.sudoku-cell.given { background: #f1f5f9; cursor: default; opacity: 1; }
.sudoku-cell.filled { background: #effaf3; }
.sudoku-cell.near { background: #f4faf9; }
.sudoku-cell.selected { background: var(--ink-soft); box-shadow: inset 0 0 0 3px var(--accent); }
.sudoku-cell.shake { animation: dots-shake .4s; background: #fee2e2; }
.sudoku-grid.done .sudoku-cell { background: #effaf3; }
.sudoku-palette { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.sudoku-symbol {
    width: 3.6rem; height: 3.6rem; padding: 0; border: 2px solid var(--ink); border-radius: 14px; background: #fff;
    font-size: 2rem; line-height: 1; box-shadow: 0 3px 0 var(--ink-soft);
}
.sudoku-symbol:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink-soft); }
@media (max-width: 560px) {
    .compare-row { gap: .4rem; }
    .compare-group { font-size: 1.4rem; }
    .compare-number { font-size: 2rem; }
    .compare-sign { width: 2.8rem; height: 2.8rem; font-size: 1.5rem; }
    .scale { height: 13rem; }
    .pan-fruit { font-size: 1.5rem; }
    .blk { width: 1rem; height: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .beam { transition: none; }
}

/* The drag canvases swallow touches (touch-action: none), so a finger on them cannot scroll the page.
   They are therefore never taller than the screen: on a phone held sideways they shrink to fit under the top bar. */
/* ---- Gears ---- */
.gears { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.gears-canvas {
    display: block; width: 100%; width: min(100%, calc(max(100dvh - 5rem, 220px) * 640 / 424)); aspect-ratio: 640 / 424; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line);
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab;
}
.gears-canvas:active { cursor: grabbing; }
.gears-belt-hint { margin: 0; text-align: center; }
.gears-levels { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.gears-level {
    width: 2.6rem; height: 2.6rem; padding: 0; border: 2px solid var(--line); border-radius: 10px;
    background: #fff; color: var(--text); font-weight: 800;
}
.gears-level.active { border-color: var(--accent); background: var(--ink-soft); }
.gears-level:disabled { opacity: .5; cursor: default; }

/* ---- Decorate a Cake ---- */
.cake { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.cake-canvas {
    display: block; width: 100%; width: min(100%, calc(max(100dvh - 5rem, 220px) * 640 / 484)); aspect-ratio: 640 / 484; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line);
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab;
}
.cake-canvas:active { cursor: grabbing; }
.cake-swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-bottom: .6rem; }
.cake .picker-label, .cake .difficulty-picker { margin-bottom: .2rem; }
.cake .wardrobe-actions { justify-content: center; align-items: center; margin-top: .4rem; }

/* ---- Painting ---- */
.paint { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.paint-canvas {
    display: block; width: 100%; aspect-ratio: 640 / 440; border-radius: 14px; background: #fff;
    box-shadow: inset 0 0 0 2px var(--line); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: crosshair;
}
.paint-board { position: relative; width: 100%; width: min(100%, calc(max(100dvh - 5rem, 220px) * 640 / 440)); }
.paint-guide { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 14px; pointer-events: none; }
.paint .cbn-progress, .paint .game-message { width: 100%; }
.paint-tools, .paint-sizes { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.paint-sizes .wardrobe-item { min-width: 3.2rem; min-height: 3.2rem; justify-content: center; }
.paint-dot { display: block; border-radius: 50%; background: var(--text); }
.paint .wardrobe-actions { justify-content: center; align-items: center; }

/* ---- Beads ---- */
.beads { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.beads-canvas {
    display: block; width: 100%; width: min(100%, calc(max(100dvh - 5rem, 220px) * 640 / 454)); aspect-ratio: 640 / 454; border-radius: 14px;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab;
}
.beads-canvas:active { cursor: grabbing; }
.beads .picker-label, .beads .difficulty-picker { margin-bottom: .2rem; }
.beads .wardrobe-actions { justify-content: center; align-items: center; margin-top: .4rem; }

/* ---- Garden Defence ---- */
.defense { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.defense .result { width: 100%; margin: 0; }
.defense-canvas {
    width: 100%; aspect-ratio: var(--ratio, 600 / 410); border-radius: 10px;
    touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.defense-legend { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; padding: 0; margin: 0 0 1rem; list-style: none; color: var(--muted); }
.defense-legend strong { color: var(--text); }
.defense-levels { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.defense-level {
    display: flex; flex-direction: column; align-items: center; gap: .1rem; width: 6.2rem; padding: .4rem .3rem;
    border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
}
.defense-level .icon { font-size: 1.6rem; line-height: 1.9rem; }
.defense-level strong { font-size: .8rem; line-height: 1.1; }
.defense-level small { font-size: .7rem; letter-spacing: 1px; color: #ca8a04; }
.defense-level.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 154, 143, .2); }
.defense-level:disabled { opacity: .5; cursor: not-allowed; }
.defense-stars { font-size: 1.6rem; letter-spacing: 2px; }
.panel:fullscreen .defense-level, .panel.pseudo-fullscreen .defense-level { width: 5rem; padding: .25rem; }

/* ---- Full screen for the canvas games ----
   The canvas grows as big as the screen allows; the full-screen button and the start / result
   controls float over it so they take no room. .pseudo-fullscreen is the fallback for iPhone. */
.fullscreen-toggle { align-self: flex-end; padding: .3rem .7rem; font-size: .85rem; }
.panel:fullscreen, .panel.pseudo-fullscreen {
    position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin: 0; padding: .25rem; border: 0; border-radius: 0; background: #0f172a;
}
.panel:fullscreen .fullscreen-toggle, .panel.pseudo-fullscreen .fullscreen-toggle {
    position: absolute; top: .4rem; right: .4rem; z-index: 2; opacity: .75;
}
.runner:fullscreen .runner-canvas, .runner.pseudo-fullscreen .runner-canvas { width: min(100%, calc((100dvh - .5rem) * 600 / 220)); }
.rainbow:fullscreen .rainbow-canvas, .rainbow.pseudo-fullscreen .rainbow-canvas { max-width: none; width: min(100%, calc((100dvh - .5rem) * 600 / 400)); }
.defense:fullscreen .defense-canvas, .defense.pseudo-fullscreen .defense-canvas { width: min(100%, calc((100dvh - .5rem) * var(--ratio, 1.46))); }
.game-controls { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: 100%; }
.panel:fullscreen .game-controls, .panel.pseudo-fullscreen .game-controls {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(90%, 460px);
    gap: .6rem; padding: 1rem; border-radius: 14px; background: rgba(255, 255, 255, .94); box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.fullscreen-toggle .fs-exit { display: none; }
.panel:fullscreen .fs-enter, .panel.pseudo-fullscreen .fs-enter { display: none; }
.panel:fullscreen .fs-exit, .panel.pseudo-fullscreen .fs-exit { display: inline; }
/* Only in full screen on an upright phone */
.rotate-hint { display: none; }
@media (orientation: portrait) {
    .panel:fullscreen .rotate-hint, .panel.pseudo-fullscreen .rotate-hint {
        display: block; position: absolute; left: 0; right: 0; bottom: 2rem; margin: 0; color: #e2e8f0; font-size: 1rem;
    }
}

/* ---- My Pet ---- */
.pet-adopt { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pet-preview { width: min(220px, 60vw); }
.pet-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.pet-name { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.pet-name .answer { width: 12rem; }
.pet-header { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .5rem; }
.pet-header h2 { margin: 0; }
.pet-age { color: var(--muted); }
.pet-hearts { margin-left: auto; padding: .2rem .7rem; border-radius: 999px; background: #fce7f3; color: #be185d; font-weight: 700; }
.pet-stage { position: relative; max-width: 560px; margin: 0 auto 1rem; }
.pet-stage svg { display: block; width: 100%; border-radius: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, .08); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.pet-speech {
    position: absolute; top: 4%; right: 3%; max-width: 46%; padding: .45rem .8rem; border-radius: 14px 14px 4px 14px;
    background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); font-weight: 600; font-size: clamp(.8rem, 2.6vw, 1rem); pointer-events: none;
}
.pet-fx { position: absolute; transform: translate(-50%, -50%); pointer-events: none; font-size: clamp(1.2rem, 4vw, 1.8rem); }
.pet-fx.heart { color: #ec4899; animation: pet-float 1.3s ease-out forwards; }
.pet-fx.sparkle { animation: pet-float 1.3s ease-out forwards; font-size: clamp(2rem, 7vw, 3rem); }
.pet-fx.food { animation: pet-food .9s ease-in forwards; }
.pet-fx.ball { animation: pet-ball 1.2s ease-in-out forwards; }
.pet-fx.zzz { color: #e0e7ff; font-weight: 800; animation: pet-zzz 2.4s ease-in-out infinite; }
.pet-fx.zzz.late { animation-delay: 1.2s; font-size: clamp(.9rem, 3vw, 1.3rem); }
@keyframes pet-float { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -260%) scale(1.3); } }
@keyframes pet-food { from { transform: translate(-50%, 60%) scale(1.3); } 80% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -160%) scale(.4); } }
@keyframes pet-ball { 0% { left: 10%; top: 70%; } 30% { left: 35%; top: 35%; } 60% { left: 60%; top: 72%; } 100% { left: 88%; top: 55%; opacity: 0; } }
@keyframes pet-zzz { 0% { opacity: 0; transform: translate(-50%, 0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(0, -160%); } }

.pet-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1.25rem; max-width: 560px; margin: 0 auto 1rem; }
.pet-stat { display: grid; grid-template-columns: auto 4.5rem 1fr; align-items: center; gap: .4rem; }
.pet-stat-icon { font-size: 1.2rem; }
.pet-stat-label { font-size: .9rem; color: var(--muted); }
.pet-bar { height: 12px; border-radius: 999px; background: var(--border); overflow: hidden; }
.pet-bar span { display: block; height: 100%; border-radius: 999px; transition: width .6s, background .6s; }
.pet-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.pet-actions button { padding: .6rem 1rem; font-size: 1rem; }
.pet-footer { display: flex; justify-content: center; align-items: center; gap: .5rem; margin-top: 1.5rem; }
.link-button { background: none; color: var(--muted); padding: .2rem .4rem; text-decoration: underline; }

/* Pet animations, in the pet's own 200 x 200 box */
.pet { transform-origin: 100px 190px; animation: pet-breathe 2.6s ease-in-out infinite; }
.pet.sleep { animation-duration: 4.5s; }
.pet.jump { animation: pet-jump .6s ease-out 2; }
.pet.wash { animation: pet-wiggle .4s ease-in-out; }
.pet .pet-mouth { transform-box: fill-box; transform-origin: center; animation: pet-chomp .2s ease-in-out infinite alternate; }
.pet .pet-tail.wag { transform-origin: 144px 160px; animation: pet-wag .35s ease-in-out infinite alternate; }
.pet .pet-tail.sway { transform-origin: 142px 168px; animation: pet-wag 1.6s ease-in-out infinite alternate; }
.pet .pet-eye { transform-box: fill-box; transform-origin: center; animation: pet-blink 4s infinite; }
.pet-stage .bubble { transform-box: fill-box; transform-origin: center; animation: pop .3s ease-out; }
@keyframes pet-breathe { 50% { transform: scale(1.02, .98); } }
@keyframes pet-jump { 30% { transform: translateY(-34px) scale(.97, 1.04); } 60% { transform: translateY(0) scale(1.05, .94); } 100% { transform: none; } }
@keyframes pet-wiggle { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes pet-chomp { to { transform: scaleY(.3); } }
@keyframes pet-wag { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
@keyframes pet-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@media (prefers-reduced-motion: reduce) {
    .pet, .pet *, .pet-fx { animation: none !important; }
}
@media (max-width: 560px) {
    .pet-stats { grid-template-columns: minmax(0, 1fr); }
}
.pet-name .answer { letter-spacing: normal; font-size: 1.1rem; text-align: left; }

/* ---- Landing page ----
   Wider than the game pages: breaks out of the 820px content column. */
.landing { margin-inline: calc(50% - min(560px, 50vw - 1rem)); }

.hero {
    position: relative;
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    align-items: center;
    gap: 1rem 2rem;
    padding: 2.2rem 2.4rem;
    border: 1px solid #ece8f6;
    border-radius: 24px;
    background: linear-gradient(120deg, #fdf2f8, #eef2ff 55%, #ecfeff);
}
.hero-text { position: relative; z-index: 1; }
.hero h1 { margin: 0 0 .8rem; font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 800; line-height: 1.1; }
.hero-brand { display: inline-block; color: var(--accent); }
.hero p { margin: 0 0 1.4rem; max-width: 34rem; font-size: 1.1rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero a.button.big.secondary { background: #fff; color: var(--text); border-color: #e9e5f5; box-shadow: 0 3px 0 #e9e5f5; }

.hero-art { position: relative; z-index: 1; aspect-ratio: 1; max-width: 230px; width: 100%; justify-self: center; }
.hero-logo {
    position: absolute; inset: 14%; width: 72%; height: 72%; border-radius: 28%;
    box-shadow: 0 10px 24px rgba(74, 154, 143, .15); transform: rotate(-6deg);
}
.hero .float { position: absolute; font-size: clamp(1.8rem, 4vw, 2.4rem); animation: hero-float 7s ease-in-out infinite; }
.hero .f1 { top: 2%; right: 2%; }
.hero .f2 { bottom: -2%; right: 6%; animation-delay: -3s; }
@keyframes hero-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(8deg); } }

.category-chips {
    position: sticky; top: 3.6rem; z-index: 5; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem;
    margin: 2rem 0 .5rem; padding: .5rem; scroll-margin-top: 4rem;
}
.category-chips a {
    padding: .45rem 1rem; border-radius: 999px; font-weight: 700; text-decoration: none;
    color: hsl(var(--hue) 60% 32%); background: hsl(var(--hue) 90% 96% / .94); border: 2px solid hsl(var(--hue) 70% 88%);
    transition: transform .15s, background .15s;
}
.category-chips a:hover { transform: translateY(-2px); background: hsl(var(--hue) 90% 92%); }

.category { margin-top: 2rem; scroll-margin-top: 7.5rem; }
.category header { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.category-icon {
    display: grid; place-items: center; flex: 0 0 auto; width: 3.2rem; height: 3.2rem; border-radius: 16px; font-size: 1.7rem;
    background: hsl(var(--hue) 90% 94%);
}
.category h2 { margin: 0; font-size: 1.5rem; font-weight: 800; color: hsl(var(--hue) 45% 35%); }
.category header p { margin: .1rem 0 0; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; }
.tile {
    position: relative; display: flex; align-items: flex-start; gap: .9rem; padding: 1rem;
    background: hsl(var(--hue) 80% 97%); border-radius: 18px;
    color: var(--text); text-decoration: none; transition: transform .18s, box-shadow .18s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px hsl(var(--hue) 50% 60% / .15); }
.tile-icon {
    display: grid; place-items: center; flex: 0 0 auto; width: 3.4rem; height: 3.4rem; border-radius: 16px; font-size: 2rem;
    background: #fff; transition: transform .25s;
}
.tile:hover .tile-icon { transform: rotate(-6deg) scale(1.05); }
.tile-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; padding-right: 1.6rem; }
.tile-body strong { font-size: 1.05rem; font-weight: 800; }
.tile-text { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.badge { padding: .1rem .45rem; border-radius: 999px; background: #fff; font-size: .8rem; }
.badge.together { position: absolute; top: .6rem; right: .6rem; }
.badge.new {
    position: absolute; top: -.6rem; left: .6rem; transform: rotate(-4deg);
    background: #f472b6; color: #fff; font-weight: 800; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
}

@media (max-width: 760px) {
    .hero { grid-template-columns: 1fr; padding: 1.6rem 1.3rem 1.8rem; border-radius: 20px; text-align: center; }
    .hero-art { order: -1; max-width: 170px; }
    .hero p { margin-inline: auto; font-size: 1rem; }
    .hero-actions { justify-content: center; }
    .hero-actions a.button.big { width: auto; flex: 1 1 10rem; }
    .category-chips { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin-inline: -1rem; padding-inline: 1rem; }
    .category-chips a { flex: 0 0 auto; }
    .tiles { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .tile { flex-direction: column; align-items: center; gap: .5rem; padding: .9rem .6rem; text-align: center; }
    .tile-body { padding-right: 0; }
    .tile-text { display: none; }
    .badge.together { top: .4rem; right: .4rem; }
}
@media (max-width: 560px) {
    .topbar { padding: .5rem .75rem; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .hero .float { animation: none; }
}

/* ---- Cooking ----
   The recipe card sits beside the kitchen; on a phone it shrinks to a row of icons above it. */
.cooking { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.cooking .difficulty-picker { margin-bottom: .2rem; }
.cooking-kitchen { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 1rem; width: 100%; align-items: start; }
.recipe-card {
    display: flex; flex-direction: column; gap: .3rem; margin: 0; padding: .8rem; list-style: none; text-align: left;
    background: #fffbeb; border: 2px dashed #fcd34d; border-radius: 14px;
}
.recipe-card li { display: flex; align-items: center; gap: .45rem; padding: .25rem .4rem; border-radius: 8px; color: var(--muted); font-size: .92rem; line-height: 1.2; }
.recipe-card li.done { opacity: .6; text-decoration: line-through; }
.recipe-card li.now { background: #fde68a; color: var(--text); font-weight: 700; }
.recipe-card .recipe-title { color: var(--text); font-size: 1rem; font-weight: 800; }
.recipe-icon { flex: none; width: 1.5rem; font-size: 1.2rem; text-align: center; }
.cooking-stage { display: flex; flex-direction: column; align-items: center; gap: .5rem; min-width: 0; }
.cooking-task { min-height: 3em; margin: 0; }
.cooking-task strong { display: block; font-size: 1.1rem; }
.cooking-canvas {
    display: block; width: 100%; width: min(100%, calc(max(100dvh - 5rem, 220px) * 640 / 440)); aspect-ratio: 640 / 440; border-radius: 14px;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.cooking .wardrobe-actions { justify-content: center; align-items: center; }
@media (max-width: 720px) {
    .cooking-kitchen { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
    .recipe-card { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: .35rem; }
    .recipe-card .recipe-title, .recipe-card li:not(.now) span:not(.recipe-icon) { display: none; }
}

/* ---- Car Workshop ---- */
.workshop { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.workshop-canvas {
    display: block; width: 100%; width: min(100%, calc(max(100dvh - 5rem, 220px) * 640 / 360)); aspect-ratio: 640 / 360; border-radius: 14px;
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.workshop-track { margin: 0; text-align: center; }
.workshop-track strong { display: block; font-size: 1.15rem; }
.workshop-track span { color: var(--muted); font-size: .92rem; }
.workshop-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .35rem 1rem; width: 100%; margin-bottom: .3rem; }
.workshop-stat { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .9rem; font-weight: 600; color: var(--muted); }
.workshop-bar { display: flex; gap: 3px; }
.workshop-bar i { width: 12px; height: 12px; border-radius: 3px; background: var(--border); }
.workshop-bar i.on { background: #f59e0b; }
.workshop .picker-label { margin: .3rem 0 0; }
.workshop-track-card small { color: var(--muted); font-size: .72rem; }
.workshop-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem .9rem; margin: 0; font-weight: 700; }
.workshop-steps .done { color: var(--ok); }
.workshop-hint { min-height: 3em; margin: 0; text-align: center; }
.workshop-hint small { display: block; color: var(--muted); }
.workshop-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.workshop-tab {
    display: flex; align-items: center; gap: .3rem; padding: .4rem .75rem;
    border: 2px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .92rem;
}
.workshop-tab.active { border-color: var(--accent); background: var(--ink-soft); }
.workshop-icon { font-size: 1.5rem; line-height: 1.8rem; }
.workshop-tracks { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .45rem; width: 100%; }
.workshop-track-card {
    display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .45rem .4rem;
    border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); line-height: 1.2;
}
.workshop-track-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 154, 143, .2); }
.workshop-track-card:disabled { opacity: .45; cursor: not-allowed; }
.workshop-stars { font-size: .85rem; letter-spacing: 1px; }
.workshop .wardrobe-actions { justify-content: center; margin-top: .3rem; }
/* The build sheet sits beside the workshop like the recipe card in the kitchen; on the track the canvas gets the whole width. */
.workshop-kitchen.driving { grid-template-columns: minmax(0, 1fr); }
.workshop-kitchen .cooking-task small { display: block; color: var(--muted); }
/* Room for the longest step text, so the canvas does not jump from step to step */
.workshop-kitchen .cooking-task { min-height: 6.2em; }
/* The steps of the build sheet are buttons: tap one to switch to that job. */
.recipe-step {
    all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .45rem; width: 100%;
    cursor: pointer; border-radius: 6px;
}
.recipe-step:disabled { cursor: default; }
.recipe-step:not(:disabled):hover { background: #fef3c7; }
.recipe-step:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
.recipe-card li.locked { opacity: .45; }
