/*
 * ba-by.ca toy kit: the shared look for every game.
 * Chunky rounded shapes, bright candy colours and big touch targets.
 * Pages set --tint (soft page colour) and use the .kit-* building blocks.
 */
:root {
    --ink: #3D3551;
    --muted: #7A7290;
    --paper: #FFF9F0;
    --tint: #FFE9D6;
    --pink: #FF6B8B;
    --pink-d: #E04870;
    --teal: #3FC9C0;
    --teal-d: #2AA198;
    --sun: #FFD54A;
    --sun-d: #E0A800;
    --blue: #4FB8FF;
    --blue-d: #2E8FD6;
    --purple: #A66BFF;
    --purple-d: #7B45D6;
    --green: #4CC26A;
    --green-d: #2F9E4C;
    --orange: #FF9F43;
    --orange-d: #DB7415;
    --safe-top: max(12px, env(safe-area-inset-top));
    --safe-left: max(12px, env(safe-area-inset-left));
    --safe-right: max(12px, env(safe-area-inset-right));
    --safe-bottom: max(14px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Nunito', system-ui, sans-serif;
    color: var(--ink);
    background: radial-gradient(120% 80% at 50% 0%, #fff 0%, var(--tint) 75%) fixed, var(--paper);
    transition: background-color 0.5s;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 4px solid var(--teal); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.kit-top {
    position: fixed;
    top: var(--safe-top);
    left: var(--safe-left);
    right: var(--safe-right);
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.kit-top > * { pointer-events: auto; }
.kit-spacer { flex: 1; pointer-events: none !important; }
.kit-round {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 4px 0 rgba(61, 53, 81, 0.18), 0 8px 18px rgba(61, 53, 81, 0.12);
    transition: transform 0.1s, box-shadow 0.1s;
}
.kit-round:active { transform: translateY(4px); box-shadow: none; }
.kit-round svg { width: 42px; height: 42px; display: block; }
.kit-top .site-lang-toggle { box-shadow: 0 4px 0 rgba(61, 53, 81, 0.15); }

/* ---------- Screens ---------- */
.kit-screen {
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(var(--safe-top) + 72px) 16px calc(var(--safe-bottom) + 18px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: kit-in 0.35s ease-out;
}
.kit-screen.fit { height: 100vh; height: 100dvh; overflow: hidden; }
.kit-wrap { width: 100%; max-width: 1040px; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.kit-title {
    margin: 0;
    font-family: 'Fredoka One', 'Fredoka', system-ui, sans-serif;
    font-weight: 400;
    font-size: clamp(2.6rem, 11vw, 4.6rem);
    line-height: 1;
    text-align: center;
    color: #fff;
    -webkit-text-stroke: 2px rgba(61, 53, 81, 0.16);
    paint-order: stroke fill;
    text-shadow: 0 6px 0 var(--title-shadow, var(--pink)), 0 14px 26px rgba(61, 53, 81, 0.2);
}
.kit-title .bob { display: inline-block; animation: kit-bob 2.6s ease-in-out infinite; }
.kit-sub { margin: 0; text-align: center; font-weight: 900; font-size: clamp(1rem, 4vw, 1.25rem); color: var(--muted); max-width: 34ch; }

/* ---------- Picture mode cards on the start screen ---------- */
.kit-modes {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}
.kit-mode {
    --c: var(--pink);
    position: relative;
    display: flex;
    flex-direction: column;
    border: 0;
    padding: 0;
    border-radius: 30px;
    background: #fff;
    text-align: left;
    box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 55%, #fff), 0 18px 30px rgba(61, 53, 81, 0.1);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: kit-rise 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.kit-mode:nth-child(2) { animation-delay: 0.06s; }
.kit-mode:nth-child(3) { animation-delay: 0.12s; }
.kit-mode:nth-child(4) { animation-delay: 0.18s; }
.kit-mode:hover { transform: translateY(-6px) rotate(-1deg); }
.kit-mode:active { transform: translateY(5px) scale(0.97); }
.kit-mode-art {
    position: relative;
    height: 150px;
    border-radius: 30px 30px 0 0;
    overflow: hidden;
    display: grid;
    place-items: center;
    font-size: 72px;
    background:
        radial-gradient(circle at 18% 22%, rgba(255,255,255,0.55) 0 10px, transparent 11px),
        radial-gradient(circle at 86% 72%, rgba(255,255,255,0.45) 0 16px, transparent 17px),
        linear-gradient(160deg, color-mix(in srgb, var(--c) 30%, #fff), color-mix(in srgb, var(--c) 65%, #fff));
}
.kit-mode-art > span { filter: drop-shadow(0 8px 6px rgba(61,53,81,0.18)); animation: kit-bob 3s ease-in-out infinite; }
.kit-mode-label { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 2px; }
.kit-mode-label b { font-family: 'Fredoka One', system-ui, sans-serif; font-weight: 400; font-size: 1.45rem; }
.kit-mode-label small { font-weight: 800; color: var(--muted); font-size: 0.95rem; }
.kit-mode .kit-badge {
    position: absolute;
    top: 12px; right: 12px;
    padding: 4px 11px;
    border-radius: 999px;
    background: #fff;
    font-family: 'Fredoka One', system-ui, sans-serif;
    font-size: 0.9rem;
    box-shadow: 0 3px 0 rgba(61,53,81,0.12);
}

/* ---------- Buttons ---------- */
.kit-btn {
    --c: var(--pink);
    --cd: var(--pink-d);
    min-width: 200px;
    border: 0;
    border-radius: 999px;
    padding: 14px 32px;
    font-family: 'Fredoka One', system-ui, sans-serif;
    font-size: clamp(1.3rem, 5vw, 1.7rem);
    color: #fff;
    background: linear-gradient(180deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c));
    box-shadow: 0 7px 0 var(--cd), 0 14px 24px rgba(61, 53, 81, 0.18);
    transition: transform 0.1s, box-shadow 0.1s;
}
.kit-btn:active { transform: translateY(7px); box-shadow: 0 0 0 var(--cd); }
.kit-btn.small { min-width: 0; padding: 10px 22px; font-size: 1.15rem; }
.kit-btn.white { color: var(--ink); background: #fff; box-shadow: 0 6px 0 #DED8EA; }

/* ---------- Play HUD: level badge + stars ---------- */
.kit-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.kit-level {
    padding: 6px 16px;
    border-radius: 999px;
    background: #fff;
    font-family: 'Fredoka One', system-ui, sans-serif;
    font-size: 1.15rem;
    box-shadow: 0 4px 0 rgba(61, 53, 81, 0.12);
}
.kit-stars { display: flex; gap: 3px; font-size: 1.7rem; line-height: 1; }
.kit-stars span { transition: transform 0.2s, filter 0.2s, opacity 0.2s; }
.kit-stars span.off { filter: grayscale(1); opacity: 0.3; }
.kit-stars span.pop { animation: kit-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---------- The spoken prompt bubble ---------- */
.kit-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 640px;
    padding: 10px 12px 10px 22px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 6px 0 rgba(61, 53, 81, 0.1);
    font-family: 'Fredoka One', system-ui, sans-serif;
    font-size: clamp(1.3rem, 5vw, 2rem);
    text-align: center;
    animation: kit-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kit-say {
    flex: none;
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 0;
    background: var(--teal);
    color: #fff;
    font-size: 24px;
    box-shadow: 0 4px 0 var(--teal-d);
}
.kit-say:active { transform: translateY(4px); box-shadow: none; }
.kit-word { color: var(--wc, var(--pink)); }

/* ---------- Cheer banner ---------- */
.kit-cheer {
    position: fixed;
    left: 50%;
    top: 40%;
    z-index: 80;
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
    pointer-events: none;
    padding: 14px 28px;
    border-radius: 28px;
    background: #fff;
    border: 5px solid var(--sun);
    box-shadow: 0 8px 0 var(--sun-d), 0 20px 40px rgba(61, 53, 81, 0.25);
    font-family: 'Fredoka One', system-ui, sans-serif;
    font-size: clamp(1.5rem, 6vw, 2.4rem);
    text-align: center;
    white-space: nowrap;
    transition: opacity 0.2s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kit-cheer.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- Level picker ---------- */
.kit-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; width: 100%; max-width: 640px; }
.kit-tile {
    --c: var(--pink);
    position: relative;
    aspect-ratio: 1;
    border: 0;
    border-radius: 24px;
    background: var(--c);
    color: #fff;
    font-family: 'Fredoka One', system-ui, sans-serif;
    font-size: 2.2rem;
    box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000);
    animation: kit-rise 0.4s backwards;
}
.kit-tile:active { transform: translateY(5px); box-shadow: none; }
.kit-tile.locked { filter: grayscale(0.85); opacity: 0.6; }
.kit-tile.locked::after { content: '🔒'; position: absolute; right: 6px; bottom: 4px; font-size: 1rem; }

/* ---------- Effects layer ---------- */
#kit-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 75; }
.kit-flyer { position: fixed; z-index: 76; pointer-events: none; line-height: 1; transform: translate(-50%, -50%); }

/* ---------- Little animations to reuse ---------- */
.squish { animation: kit-squish 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.wobble { animation: kit-wobble 0.45s ease-in-out; }
.dance { animation: kit-dance 0.9s ease-in-out; }
@keyframes kit-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes kit-rise { from { opacity: 0; transform: translateY(26px) scale(0.92); } }
@keyframes kit-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes kit-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes kit-squish { 30% { transform: scale(1.18, 0.82); } 60% { transform: scale(0.92, 1.1); } 100% { transform: scale(1); } }
@keyframes kit-wobble { 20% { transform: rotate(-9deg); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
@keyframes kit-dance { 25% { transform: rotate(-8deg) translateY(-10px); } 50% { transform: rotate(6deg); } 75% { transform: rotate(-4deg) translateY(-6px); } }

@media (max-width: 560px) {
    .kit-round { width: 46px; height: 46px; }
    .kit-round svg { width: 38px; height: 38px; }
    .kit-screen { padding-top: calc(var(--safe-top) + 64px); }
    .kit-modes { grid-template-columns: 1fr 1fr; gap: 12px; }
    .kit-mode-art { height: 110px; font-size: 54px; }
    .kit-mode-label { padding: 10px 12px 14px; }
    .kit-mode-label b { font-size: 1.15rem; }
    .kit-mode-label small { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
