/* kit.css — the smashkit shared shell, lifted from blocksmash/bs.css.
 *
 * `bs-` renamed to `kit-` throughout. Everything game-specific was left
 * behind on purpose: ammo pips, the debug panel, the level picker and lane
 * labels, the crosshair, and the records strip are all BlockSmash's own
 * input model and campaign UI, not a shared-kit concern. Each game keeps its
 * own stylesheet for its own HUD and links this one first.
 *
 * Portrait, phone-first, same as BlockSmash: the canvas fills the viewport on
 * a phone and is capped to a portrait column on desktop, so one layout serves
 * both.
 */

/* The `hidden` attribute only sets `display: none` at the very bottom of the
 * cascade, so ANY later `display` rule silently defeats it. That shipped as a
 * real bug on 2026-09-03: both cornhole's and pool's start menus were
 * `display: flex` with no [hidden] guard, so the menu and its Start button
 * painted the instant the stylesheet loaded, long before boot() had finished
 * awaiting 2.8 MB of Rapier WASM and bound a click handler to it. The button
 * was visible and dead, and there was nothing on screen to say why.
 * This rule makes `hidden` mean hidden for every game on the kit. Toggle
 * visibility with `el.hidden`, never by editing `style.display`. */
[hidden] { display: none !important; }

:root {
    --bg: #12161d;
    --panel: #1b2028;
    --edge: #2c3440;
    --ink: #e8eaee;
    --muted: #98a1ae;
    --accent: #e0a33e;
    --win: #5fbf7d;
    --lose: #d2695f;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    overscroll-behavior: none;
}

body {
    display: flex;
    justify-content: center;
    align-items: stretch;
}

#kit-app {
    position: relative;
    width: 100%;
    max-width: 560px;          /* portrait column on desktop */
    height: 100dvh;
    overflow: hidden;
    background: #1b2434;
}

#kit-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;        /* the game handles all gestures itself */
    cursor: crosshair;
}

/* ------------------------------------------------------------------- hud */

#kit-top, #kit-bottom {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem .85rem;
    pointer-events: none;      /* the canvas underneath must stay tappable */
}

#kit-top {
    top: 0;
    padding-top: max(.6rem, env(safe-area-inset-top));
    font-size: .82rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}

#kit-top b { color: var(--ink); }

#kit-bottom {
    bottom: 0;
    padding-bottom: max(.6rem, env(safe-area-inset-bottom));
}

.kit-buttons {
    display: flex;
    gap: .45rem;
    pointer-events: auto;
}

.kit-buttons button {
    font: inherit;
    font-size: .8rem;
    color: var(--ink);
    background: rgba(27, 32, 40, .88);
    border: 1px solid var(--edge);
    border-radius: 7px;
    padding: .42rem .8rem;
    cursor: pointer;
}

.kit-buttons button:hover { background: #262d38; border-color: #3c4756; }
.kit-buttons button:active { transform: translateY(1px); }

/* A toggle button in its "on" state — sound, endless mode, whatever the
   game needs. Add/remove the `.on` class in script. */
.kit-buttons button.on { color: #12161d; background: var(--accent); border-color: #f3c579; }

/* ---------------------------------------------------------------- banner */

.kit-banner {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: .85rem 1.6rem;
    border-radius: 11px;
    background: rgba(18, 22, 29, .93);
    border: 1px solid var(--edge);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
    pointer-events: none;
    animation: kit-pop .22s ease-out;
}

.kit-banner.win { color: var(--win); border-color: #35543f; }
.kit-banner.lose { color: var(--lose); border-color: #56342f; }

@keyframes kit-pop {
    from { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* --------------------------------------------------------------- loading */

#kit-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: #141b26;
    color: var(--muted);
    font-size: .9rem;
    z-index: 30;
}

#kit-loading[hidden] { display: none; }

.kit-noscript {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
}
