/* Shared design tokens and base styles for the hub and every game. */
:root {
    --bg: #fff8ee;
    --ink: #2b2140;
    --muted: #7a6f8a;
    --card: #ffffff;
    --line: #eadbc6;
    --good: #1f9d58;
    --good-soft: #e3f7ec;
    --good-ink: #137a45;
    --bad: #e5484d;
    --bad-soft: #fde7e8;
    --bad-ink: #b4232a;
    --focus: #6c5ce7;
    --radius: 22px;
    --shadow: 0 6px 0 rgba(43, 33, 64, 0.07), 0 12px 24px rgba(43, 33, 64, 0.08);
    --font-display: 'Fredoka', 'Arial Rounded MT Bold', system-ui, sans-serif;
    --font-body: 'Nunito', system-ui, sans-serif;
}

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

html,
body {
    margin: 0;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    cursor: pointer;
}

:focus-visible {
    outline: 4px solid var(--focus);
    outline-offset: 3px;
}

/* Full-screen overlay used by shared/confetti.js */
.confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Shared components */
.pill-btn {
    display: inline-block;
    border: 0;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.primary-btn {
    border: 0;
    padding: 14px 28px;
    border-radius: 18px;
    background: var(--good);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.child-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 8px;
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.child-chip-avatar {
    font-size: 1.6rem;
    line-height: 1;
}

.child-chip-switch {
    color: var(--focus);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Top bar on game pages: page background with a bottom border, title truly centred. */
.game-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--bg);
    color: var(--ink);
    border-bottom: 2px solid var(--line);
}

.game-bar-start,
.game-bar-end {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-bar-end {
    justify-content: flex-end;
}

.game-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    text-align: center;
}

.bar-btn,
.bar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    transition: background 0.15s;
}

.bar-btn {
    padding: 0 16px;
}

.bar-icon-btn {
    width: 44px;
    padding: 0;
}

.bar-btn:hover,
.bar-icon-btn:hover {
    border-color: var(--muted);
}

.bar-icon-btn svg {
    width: 24px;
    height: 24px;
}

.bar-icon-btn[aria-pressed="true"] .icon-sound-off,
.bar-icon-btn[aria-pressed="false"] .icon-sound-on {
    display: none;
}

.stop-square {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: currentColor;
}

.game-bar .child-chip {
    padding-top: 4px;
    padding-bottom: 4px;
    border: 2px solid var(--line);
    box-shadow: none;
}

@media (max-width: 640px) {
    .game-bar {
        padding: 8px 12px;
        gap: 8px;
    }

    .bar-btn {
        width: 44px;
        padding: 0;
    }

    .bar-btn-label,
    .game-bar .child-chip-name,
    .game-bar .child-chip-switch {
        display: none;
    }

    .game-bar .child-chip {
        padding: 4px 8px;
    }
}
