
        /* ===== Site Header / Footer (new design) ===== */
        .site-header {
            /* No colour of its own: the bar is whatever the page behind it
               is, light or dark, on every game. Nothing draws a line under
               it either — no shadow, no border, no change of shade. */
            background: transparent;
            display: flex; justify-content: space-between; align-items: center;
            height: 64px; padding: 0 24px;
            width: 100%; flex-shrink: 0;
        }
        .site-logo { display: flex; align-items: center; gap: 10px; }
        .site-logo img.bigtoe { height: 60px; width: auto; display: block; }
        .site-logo img.logotext { height: 30px; width: auto; display: block; }
        .site-nav { display: flex; align-items: center; gap: 26px; }
        .site-nav a { text-decoration: none; color: #334155; font-weight: 500; font-size: 0.9rem; transition: color 0.2s; }
        .site-nav a:hover { color: #0d9488; }
        .site-nav a.site-play {
            background: #14b8a6; color: #fff; padding: 8px 18px; border-radius: 999px; font-weight: 600;
        }
        .site-nav a.site-play:hover { background: #0d9488; color: #fff; }
        /* Menu hidden for launch — flip this back to show it */
        .site-nav { display: none; }
        /* Language switch */
        .header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
        .lang-switch { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
        .lang-switch button {
            border: 1px solid #d5d5d5; background: #fff; color: #555;
            border-radius: 999px; padding: 4px 12px; font-size: 0.8rem;
            font-weight: 600; cursor: pointer; transition: all 0.15s;
        }
        /* Language burger menu (mobile only) */
        .lang-menu { position: relative; }
        .lang-menu-btn {
            display: none;
            border: 1px solid #d5d5d5; background: #fff; color: #555;
            border-radius: 999px; padding: 4px 12px; font-size: 0.8rem;
            font-weight: 600; cursor: pointer; white-space: nowrap;
            transition: all 0.15s;
        }
        .lang-menu-btn:hover { border-color: #0d9488; color: #0d9488; }
        html.dark .lang-menu-btn { background: #1a1a2e; border-color: #3f3f5a; color: #e8e8f0; }
        html.dark .lang-menu-btn:hover { border-color: #14b8a6; color: #5eead4; }
        .lang-switch button:hover { border-color: #0d9488; color: #0d9488; }
        .lang-switch button.active { background: #14b8a6; border-color: #14b8a6; color: #fff; }
        /* Theme toggle (site-wide dark mode) */
        .theme-toggle {
            border: 1px solid #d5d5d5; background: #fff; color: #555;
            border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; line-height: 1.5;
            font-weight: 600; cursor: pointer; transition: all 0.15s; flex-shrink: 0;
        }
        .theme-toggle:hover { border-color: #0d9488; color: #0d9488; }
        .theme-toggle .icon-dark { display: none; }
        /* Site-wide dark theme */
        html.dark .site-footer { color: #9ca3af; }
        html.dark .site-footer-links a { color: #9ca3af; }
        html.dark .site-footer-links a:hover { color: #5eead4; }
        html.dark .site-nav a { color: #cbd5e1; }
        html.dark .site-nav a:hover { color: #5eead4; }
        html.dark .lang-switch button { background: #1a1a2e; border-color: #3f3f5a; color: #cbd5e1; }
        html.dark .lang-switch button:hover { border-color: #14b8a6; color: #5eead4; }
        html.dark .lang-switch button.active { background: #14b8a6; border-color: #14b8a6; color: #fff; }
        html.dark .theme-toggle { background: #1a1a2e; border-color: #3f3f5a; color: #e8e8f0; }
        html.dark .theme-toggle:hover { border-color: #14b8a6; color: #5eead4; }
        html.dark .theme-toggle .icon-light { display: none; }
        html.dark .theme-toggle .icon-dark { display: inline; }
        /* The wordmark PNG has an opaque white background — invert it in dark mode */
        html.dark .site-logo img.logotext { filter: invert(1) hue-rotate(180deg); }
        .site-footer {
            /* Same as the header: the page's own background, and no rule
               above it. */
            background: transparent;
            padding: 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 4px;
            font-size: 0.85rem; color: #555; width: 100%; flex-shrink: 0; text-align: center;
        }
        .site-footer-links { display: flex; gap: 20px; }
        .site-footer-links a { text-decoration: none; color: #555; }
        .site-footer-links a:hover { color: #5f9bb9; }
        @media (max-width: 720px) {
            .site-nav { display: none; }
            .site-logo img.bigtoe { height: 44px; }
            .site-logo img.logotext { height: 20px; }
            .lang-menu-btn { display: inline-block; }
            .lang-menu-dd {
                display: none;
                position: absolute; right: 0; top: calc(100% + 8px);
                background: #fff; border: 1px solid #d5d5d5; border-radius: 12px;
                box-shadow: 0 8px 24px rgba(0,0,0,0.15);
                padding: 6px; z-index: 500; min-width: 120px;
            }
            .lang-menu-dd.open { display: block; }
            .lang-menu-dd .lang-switch { flex-direction: column; align-items: stretch; gap: 4px; }
            .lang-menu-dd .lang-switch button { display: block; width: 100%; text-align: left; border: none; }
            html.dark .lang-menu-dd { background: #1a1a2e; border-color: #3f3f5a; }
        }

/* =================================================================
   Bongo Box Fun — eight-step drum box
   The palette and the control shapes are the site's own, taken from
   Sudoku (docs/agents.md, "Visual Design"): teal primary, amber accent,
   2px bordered pills at radius 8. The tropical artwork that this page
   started from is gone; only the six instrument icons survive, and only
   on narrow screens where the row labels lose their text.
   ================================================================= */
:root {
    --bg-color: #F5F5F5;
    --surface-color: #FFFFFF;
    --text-color: #212121;
    --text-secondary: #757575;
    --primary: #009688;
    --primary-hover: #00796B;
    --primary-light: #E0F2F1;
    --accent: #FFB300;
    --button-bg: #E0E0E0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: 0.2s ease;
}

html.dark {
    --bg-color: #121212;
    --surface-color: #1E1E1E;
    --text-color: #E0E0E0;
    --text-secondary: #9E9E9E;
    --primary: #00BFA5;
    --primary-hover: #00897B;
    --primary-light: #10332F;
    --accent: #FFCA28;
    --button-bg: #333333;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.app-container {
    width: 100%;
    flex: 1 0 auto;
    display: flex;
    justify-content: center;
    padding: 10px 12px 24px;
}

/* The tropical stage is gone: no panel, no gradient, no shadow. The stage
   itself takes the whole window so a 32-step grid can use it; the reading
   matter inside keeps its own narrower measure. */
.stage {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.game-header, .hint, .credits { max-width: 620px; }
/* Five controls on one line, so a long grid does not leave the kit picker
   stranded on a second row. */
.controls { max-width: 900px; }

/* ---- header ---------------------------------------------------- */
.game-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.game-header .mascot { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.game-header h1 { font-size: 22px; font-weight: 700; line-height: 1.1; }
.game-header .tagline {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* ---- controls ---------------------------------------------------- */
.controls {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 10px;
    margin-bottom: 14px;
}
.ctrl { display: flex; flex-direction: column; gap: 4px; }
.ctrl-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.ctrl select {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    background: var(--surface-color);
    border: 2px solid var(--button-bg);
    border-radius: var(--radius);
    padding: 7px 8px;
    cursor: pointer;
    transition: border-color var(--transition);
}
.ctrl select:hover { border-color: var(--primary); }

.stepper {
    display: inline-flex;
    align-items: center;
    border: 2px solid var(--button-bg);
    border-radius: var(--radius);
    background: var(--surface-color);
    overflow: hidden;
}
.stepper button {
    width: 30px;
    height: 34px;
    border: none;
    background: none;
    color: var(--text-color);
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
}
.stepper button:hover { background: var(--primary-light); color: var(--primary); }
.stepper-value {
    min-width: 76px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

/* An attribute selector out-specifies a bare class, so this has to be
   written input.slider[type=range] to beat input[type=range]. */
input.slider[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 128px;
    height: 34px;
    background: none;
    cursor: pointer;
}
input.slider[type=range]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary) var(--fill, 0%), var(--button-bg) var(--fill, 0%));
}
input.slider[type=range]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary) var(--fill, 0%), var(--button-bg) var(--fill, 0%));
}
input.slider[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface-color);
    box-shadow: var(--shadow);
}
input.slider[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface-color);
}

/* ---- sequencer --------------------------------------------------- */
/* The grid takes the width it is given and stays centred in it. Columns are
   fractions, so eight pads and 32 pads both fill the line; --cell-max stops
   a short pattern from turning into eight dinner plates, and --cell-min is
   the point below which a long one scrolls instead of shrinking further.
   --steps and data-steps are written onto .grid by buildGrid().

   .sequencer is a block, not a centring flex box: a flex child that
   overflows its line is centred by hanging off BOTH ends, and the scrollbar
   cannot reach the left one. The grid centres itself with auto margins,
   which collapse to zero as soon as it is wider than the window. */
.sequencer {
    width: 100%;
    overflow-x: auto;
}
.grid {
    --label-col: clamp(96px, 18vw, 150px);
    --cell-max: 52px;
    --cell-min: 18px;
    --grid-gap: clamp(3px, 0.6vw, 6px);
    /* The bar break is a spacer column, not a margin on the pad: a margin
       comes out of a stretched grid item's width, which made the first pad
       of every bar after the first smaller than its neighbours. A spacer
       track widens the break and leaves every pad the same size. The two
       normal gaps either side of it, plus this half gap, make the break
       add up to the 1.5 gaps the old margin used. */
    --bar-gap: calc(var(--grid-gap) / 2);
    --bars: 0;
    display: grid;
    grid-template-columns: var(--label-col) repeat(var(--steps, 8), minmax(0, 1fr));
    gap: var(--grid-gap);
    align-items: stretch;
    width: 100%;
    min-width: calc(var(--label-col) + var(--steps, 8) * (var(--cell-min) + var(--grid-gap))
        + var(--bars) * (var(--bar-gap) + var(--grid-gap)));
    max-width: calc(var(--label-col) + var(--steps, 8) * (var(--cell-max) + var(--grid-gap))
        + var(--bars) * (var(--bar-gap) + var(--grid-gap)));
    margin-inline: auto;
    /* The playhead is absolutely positioned against the grid, so the pads'
       offsets can place it. */
    position: relative;
}
/* Eight pads to a bar, so every length past eight needs its bar-opening
   spacer tracks spelled out. --bars is how many of them there are;
   buildGrid() appends the blank grid item that fills each one. */
.grid[data-steps="16"] {
    --bars: 1;
    grid-template-columns: var(--label-col) repeat(8, minmax(0, 1fr))
        var(--bar-gap) repeat(8, minmax(0, 1fr));
}
.grid[data-steps="24"] {
    --bars: 2;
    grid-template-columns: var(--label-col) repeat(8, minmax(0, 1fr))
        var(--bar-gap) repeat(8, minmax(0, 1fr)) var(--bar-gap) repeat(8, minmax(0, 1fr));
}
.grid[data-steps="32"] {
    --bars: 3;
    grid-template-columns: var(--label-col) repeat(8, minmax(0, 1fr))
        var(--bar-gap) repeat(8, minmax(0, 1fr)) var(--bar-gap) repeat(8, minmax(0, 1fr))
        var(--bar-gap) repeat(8, minmax(0, 1fr));
}

.step-head {
    align-self: end;
    text-align: center;
    font-size: clamp(9px, 1.1vw, 11px);
    font-weight: 500;
    color: var(--text-secondary);
    overflow: hidden;
}
.step-head.beat { color: var(--text-color); font-weight: 700; }

.row-label {
    /* Sticky so the drum names stay put when 32 pads make the grid scroll. */
    position: sticky;
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 2px solid var(--button-bg);
    border-radius: var(--radius);
    background: var(--surface-color);
    color: var(--text-color);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition);
}
.row-label::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--row-colour, var(--primary));
    flex-shrink: 0;
}
/* The instrument artwork is the loudest thing on the page; the dot above
   carries the same colour coding at a tenth of the ink. */
.row-label img { display: none; }
.row-label:hover { border-color: var(--primary); background: var(--primary-light); }
.row-label.lit { border-color: var(--accent); background: var(--primary-light); }

/* No width here on purpose: the pad stretches to its column, so every pad
   in a row is the same size, bar-opening ones included. */
.cell {
    aspect-ratio: 1;
    /* Stretching is what the row does to the labels; a pad that stretched
       with it would be a rectangle, so it sizes itself and sits centred. */
    align-self: center;
    min-height: 0;
    padding: 0;
    border: 2px solid var(--button-bg);
    /* 25% keeps the corner in proportion once 32 steps shrink the pad to
       16px, where a flat 8px radius would round it into a dot. */
    border-radius: min(var(--radius), 25%);
    background: var(--surface-color);
    cursor: pointer;
    /* Hover and tap feedback only; the playhead no longer restyles pads. */
    transition: background 0.08s ease, border-color 0.06s ease;
}
.cell:hover { border-color: var(--primary); background: var(--primary-light); }
.cell.on { background: var(--primary); border-color: var(--primary); }

/* One element marks the step that is playing. The old version toggled a
   class on every pad in the column, which made the browser restyle the whole
   grid on each step; moving one transform is handed to the compositor.
   buildGrid() appends it, movePlayhead() sets top and transform. */
.playhead {
    position: absolute;
    /* top comes from the first pad row, so the line starts below the step
       numbers instead of striking through them. */
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0;
    pointer-events: none;
    will-change: transform;
    transition: opacity 0.08s ease;
}
.playhead.lit { opacity: 1; }

/* ---- transport ---------------------------------------------------- */
.transport {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.play-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 26px;
    height: 38px;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
}
.play-btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
/* The script only swaps #play-img's src, so the glyph follows the filename
   and the play/stop state needs no JS change. */
.play-btn img { display: none; }
.play-btn .glyph::before { content: '\25B6'; font-size: 13px; }
#play-img[src$="stop.png"] + .glyph::before { content: '\25A0'; }
#play-img[src$="stop.png"] ~ .label-play { display: none; }
.label-stop { display: none; }
#play-img[src$="stop.png"] ~ .label-stop { display: inline; }

.clear-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    border: 2px solid var(--button-bg);
    border-radius: var(--radius);
    background: var(--surface-color);
    color: var(--text-color);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.clear-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.clear-icon { font-size: 14px; }

.hint {
    margin-top: 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.credits {
    margin-top: 10px;
    text-align: center;
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.credits a { color: var(--primary); }

@media (max-width: 620px) {
    .grid { --label-col: 38px; --cell-max: 46px; --cell-min: 16px; }
    .row-label { justify-content: center; padding: 0; }
    .row-label span { display: none; }
    /* A bare dot is too little to name a drum by, so the icon comes back
       when the label text goes. */
    .row-label::before { display: none; }
    .row-label img { display: block; width: 24px; height: auto; }
    .controls { gap: 8px; }
    input.slider[type=range] { width: 104px; }
}
