/* Pinball — Simple Board Games
   Direction: the screen looks into a cabinet — lacquered aubergine
   playfield, chrome bezel and rails, coloured inserts, arcade type.
   Palette and type are game tokens; the site chrome around it stays
   whatever styles.css decides. */
:root {
    --pl-bg: #0a0710;
    --pl-panel: #150d1e;
    --pl-surface: #1c1228;
    --pl-line: #332540;
    --pl-text: #f2ebdd;
    --pl-muted: #a79c95;
    --pl-amber: #ffb020;
    --pl-amber-deep: #8a4f05;
    --pl-pink: #ff3d7f;
    --pl-lime: #b7f34a;
    --pl-chrome: #9aa8b5;
    --pl-display: 'Arial Black', 'Helvetica Neue', Impact, system-ui, sans-serif;
    --pl-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
}

/* Scoped reset — no `*` rule, it would reach the whole document. */
body,
button,
input {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(ellipse at 50% 0%, #2a1d3f 0%, #130d1e 46%, #0a0710 100%);
    color: var(--pl-text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.pl-container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px;
    text-align: center;
}

/* --- Header --------------------------------------------------------- */

.pl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--pl-line);
}

.pl-back {
    color: var(--pl-pink);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 8px 4px;
}

.pl-back:hover {
    color: var(--pl-amber);
}

.pl-title {
    margin: 0;
    font-family: var(--pl-display);
    font-size: clamp(1.3rem, 5vw, 1.9rem);
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--pl-amber);
    text-shadow: 0 2px 0 var(--pl-amber-deep), 0 0 26px rgba(255, 176, 32, 0.35);
}

.pl-header-right {
    display: flex;
    gap: 6px;
}

.pl-icon-btn {
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #2a1b3d, #160e21);
    border: 1px solid #4a3660;
    color: var(--pl-text);
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 10px;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.pl-icon-btn:active {
    transform: scale(0.94);
}

.pl-ico {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pl-sound-off { display: none; }
body.pl-muted .pl-sound-on { display: none; }
body.pl-muted .pl-sound-off { display: block; }

/* --- Score reel ----------------------------------------------------- */

.pl-hud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.pl-chip {
    position: relative;
    background: linear-gradient(180deg, #251837, #110b1b);
    border: 1px solid #4b3661;
    border-radius: 8px;
    padding: 7px 12px 8px;
    min-width: 96px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -9px 18px rgba(0, 0, 0, 0.35),
        0 5px 16px rgba(0, 0, 0, 0.38);
}

.pl-chip::before {
    position: absolute;
    inset: 0 8px auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 214, 107, 0.5), transparent);
    content: "";
    pointer-events: none;
}

.pl-chip-label {
    font-family: var(--pl-mono);
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    color: var(--pl-muted);
}

.pl-chip-value {
    font-family: var(--pl-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--pl-amber);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    text-shadow: 0 0 12px rgba(255, 176, 32, 0.38);
}

.pl-chip-multi .pl-chip-value {
    color: var(--pl-chrome);
}

.pl-chip-multi .pl-chip-value.is-lit {
    color: var(--pl-lime);
    text-shadow: 0 0 12px rgba(183, 243, 74, 0.65);
}

/* --- Cabinet and playfield ------------------------------------------ */

.pl-stage {
    position: relative;
    width: min(100%, 520px);
    margin-inline: auto;
    border-radius: 22px;
    padding: 18px 14px 20px;
    border: 1px solid #645077;
    background:
        linear-gradient(180deg, rgba(160, 125, 194, 0.2), transparent 13%),
        radial-gradient(ellipse at 50% 0%, #35234a 0%, #1b1228 44%, #0d0815 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 0 0 4px #0b0712,
        inset 0 0 0 5px rgba(199, 212, 224, 0.13),
        inset 0 0 46px rgba(0, 0, 0, 0.5),
        0 36px 80px rgba(0, 0, 0, 0.62),
        0 0 54px rgba(88, 225, 255, 0.07);
    overflow: hidden;
}

.pl-stage::before {
    position: absolute;
    z-index: 1;
    inset: 9px;
    border: 1px solid rgba(199, 212, 224, 0.11);
    border-radius: 16px;
    box-shadow: inset 0 0 38px rgba(0, 0, 0, 0.55);
    content: "";
    pointer-events: none;
}

.pl-stage::after {
    position: absolute;
    z-index: 1;
    inset: 10px;
    border-radius: 15px;
    background:
        radial-gradient(circle at 0 0, rgba(243, 248, 255, 0.34) 0 2px, transparent 3px),
        radial-gradient(circle at 100% 0, rgba(243, 248, 255, 0.34) 0 2px, transparent 3px),
        radial-gradient(circle at 0 100%, rgba(243, 248, 255, 0.24) 0 2px, transparent 3px),
        radial-gradient(circle at 100% 100%, rgba(243, 248, 255, 0.24) 0 2px, transparent 3px);
    content: "";
    pointer-events: none;
}

.pl-board-wrap {
    position: relative;
    width: min(420px, 100%);
    margin: 0 auto;
}

/* Chrome bezel drawn with rings so it never shifts the board layout. */
.pl-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 400 / 620;
    border: 1px solid #0a0d12;
    border-radius: 10px;
    background: var(--pl-bg);
    touch-action: none;
    box-shadow:
        0 0 0 3px #b6c4d0,
        0 0 0 5px #2a323b,
        0 0 0 7px #07050d,
        0 0 34px rgba(88, 225, 255, 0.18),
        0 22px 48px rgba(0, 0, 0, 0.62);
}

.pl-charge {
    height: 8px;
    margin-top: 10px;
    border: 1px solid #453154;
    border-radius: 999px;
    background:
        repeating-linear-gradient(90deg, #120b1a 0 16px, #1d1328 16px 18px);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.65);
    overflow: hidden;
}

.pl-charge-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--pl-pink), var(--pl-amber));
    transition: width 0.06s linear;
    box-shadow: 0 0 12px rgba(255, 176, 32, 0.6);
}

.pl-prompt {
    margin: 8px 0 0;
    font-family: var(--pl-mono);
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    color: var(--pl-amber);
    font-weight: 700;
}

.hidden {
    display: none !important;
}

/* Tap flanks double as playfield inlays: a pink wash where the rubbers are. */
.pl-touch-zones {
    position: absolute;
    inset: 0 0 60px 0;
    display: flex;
    pointer-events: none;
}

.pl-zone {
    flex: 1;
    border: 0;
    background: radial-gradient(ellipse at 50% 78%, rgba(255, 61, 127, 0.14), transparent 66%);
    color: transparent;
    cursor: pointer;
    pointer-events: auto;
    min-width: 0;
    min-height: 0;
    touch-action: none;
}

.pl-zone:active {
    background: radial-gradient(ellipse at 50% 78%, rgba(255, 61, 127, 0.34), transparent 70%);
}

.pl-launch {
    margin-top: 12px;
    border: 1px solid #6b3d00;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffe093 0%, #ffc247 18%, var(--pl-amber) 58%, #dd8708 100%);
    color: #1a0f05;
    font-family: var(--pl-display);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    padding: 13px 18px;
    min-height: 48px;
    cursor: pointer;
    width: 100%;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 4px 0 var(--pl-amber-deep),
        0 12px 28px rgba(255, 176, 32, 0.28),
        0 0 30px rgba(255, 176, 32, 0.12);
}

.pl-launch:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--pl-amber-deep), 0 6px 14px rgba(255, 176, 32, 0.2);
}

/* --- Overlays ------------------------------------------------------- */

.pl-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 34%, rgba(59, 32, 82, 0.72) 0%, rgba(12, 7, 20, 0.94) 62%, rgba(5, 3, 9, 0.97) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    animation: pl-fade 0.25s ease;
}

@keyframes pl-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pl-panel {
    position: relative;
    background-color: var(--pl-panel);
    background-image:
        linear-gradient(90deg, var(--pl-pink), var(--pl-amber) 50%, var(--pl-lime)),
        radial-gradient(ellipse at 50% 0%, rgba(255, 176, 32, 0.15), transparent 68%),
        linear-gradient(180deg, rgba(116, 82, 199, 0.12), transparent 46%);
    background-size: 100% 4px, 100% 100%, 100% 100%;
    background-repeat: no-repeat;
    background-position: top left, center, center;
    border: 1px solid #59416f;
    border-radius: 14px;
    padding: 28px 20px 24px;
    width: min(420px, 100%);
    max-height: 100%;
    overflow-y: auto;
    text-align: center;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.035),
        0 0 46px rgba(255, 61, 127, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pl-logo {
    width: min(300px, 80%);
    height: auto;
    align-self: center;
    max-width: 100%;
    filter: drop-shadow(0 0 22px rgba(88, 225, 255, 0.3)) drop-shadow(0 0 10px rgba(255, 176, 32, 0.35));
}

.pl-panel-title {
    margin: 4px 0 2px;
    font-family: var(--pl-display);
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pl-amber);
    text-shadow: 0 2px 0 var(--pl-amber-deep);
}

.pl-tagline {
    color: var(--pl-muted);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.pl-section {
    text-align: left;
}

.pl-label {
    display: block;
    font-family: var(--pl-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pl-muted);
    margin-bottom: 6px;
}

#playerNameInput {
    width: 100%;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid var(--pl-line);
    background: #0f0917;
    color: var(--pl-text);
    font-size: 1rem;
    min-height: 44px;
}

#playerNameInput:focus-visible {
    outline: 2px solid var(--pl-amber);
    outline-offset: 1px;
    border-color: transparent;
}

.pl-btn {
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 0.98rem;
    font-weight: 700;
    font-family: var(--pl-display);
    letter-spacing: 0.07em;
    cursor: pointer;
    border: 1px solid transparent;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.pl-btn-primary {
    background: linear-gradient(180deg, #ffc756, var(--pl-amber) 55%, #e0890b);
    border-color: var(--pl-amber-deep);
    color: #1a0f05;
    box-shadow: 0 4px 0 var(--pl-amber-deep), 0 12px 24px rgba(255, 176, 32, 0.22);
}

.pl-btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--pl-line);
    color: var(--pl-text);
}

.pl-btn:hover {
    filter: brightness(1.07);
}

.pl-btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--pl-amber-deep), 0 6px 14px rgba(255, 176, 32, 0.18);
}

.pl-btn-ghost:active {
    transform: translateY(2px);
}

.pl-hint {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--pl-muted);
    margin: 0;
}

/* --- Results --------------------------------------------------------- */

.pl-results {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 4px;
}

.pl-result {
    background: #0f0917;
    border: 1px solid var(--pl-line);
    border-radius: 10px;
    padding: 10px 16px;
    min-width: 112px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.pl-result-label {
    font-family: var(--pl-mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    color: var(--pl-muted);
}

.pl-result-value {
    font-family: var(--pl-mono);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--pl-amber);
    font-variant-numeric: tabular-nums;
}

/* --- Accessibility --------------------------------------------------- */

.pl-btn:focus-visible,
.pl-icon-btn:focus-visible,
.pl-launch:focus-visible,
.pl-zone:focus-visible,
.pl-back:focus-visible {
    outline: 2px solid var(--pl-lime);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .pl-overlay {
        animation: none;
    }

    .pl-btn,
    .pl-launch,
    .pl-icon-btn {
        transition: none;
    }
}

/* --- Small screens ---------------------------------------------------- */

@media (max-width: 480px) {
    .pl-container {
        padding: 8px;
    }

    .pl-chip {
        min-width: 74px;
        padding: 6px 8px 7px;
    }

    .pl-chip-value {
        font-size: 1.05rem;
    }

    .pl-stage {
        padding: 10px 6px 14px;
        border-radius: 14px;
    }

    .pl-panel {
        padding: 22px 14px 18px;
    }
}
