:root {
    --bg: #0b1020;
    --ink: #e2e8f0;
    --accent: #febf10;
    --wall: #2b3a67;
    --pellet: #febf10;
    --panel: #0f1530;
    --panel-border: #22305e;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: radial-gradient(1200px 800px at 70% -20%, #1a2240 0%, #0b1020 60%) fixed;
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    display: grid;
    place-items: center;
}

.wrapper {
    display: grid;
    gap: 16px;
    width: min(92vw, 1100px);
    padding: 24px 20px 28px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

h1 {
    font-size: clamp(24px, 2.2vw + 14px, 36px);
    line-height: 1.1;
    margin: 0;
    letter-spacing: 0.4px;
}

.hint {
    opacity: .85;
    font-size: 14px;
}

.hud {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #121a36cc;
    border: 1px solid #22305ecc;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
}

.cta {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #172044;
    border: 1px solid #22305e;
    color: var(--ink);
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    transition: transform .1s ease, background .2s ease;
}

    .cta:hover {
        transform: translateY(-1px);
        background: #1b2754;
    }

.stage {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}

@@media (max-width: 940px) {
    .stage {
        grid-template-columns: 1fr;
    }
}

canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,.45), inset 0 0 0 1px #22305e;
    background: #0a0f1e;
    aspect-ratio: 21 / 15;
}

.leaderboard {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

    .leaderboard h2 {
        margin: 0 0 6px;
        font-size: 16px;
    }

    .leaderboard .sub {
        opacity: .75;
        font-size: 12px;
        margin-bottom: 8px;
    }

    .leaderboard .controls {
        display: flex;
        gap: 8px;
        margin: 6px 0 10px;
    }

.btn {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #2a3a6a;
    background: #132043;
    color: var(--ink);
    font-size: 13px;
}

    .btn:hover {
        background: #18285a;
    }

table.score {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    table.score th, table.score td {
        padding: 6px 8px;
        border-bottom: 1px solid #1d2952;
        text-align: left;
    }

        table.score th:nth-child(1), table.score td:nth-child(1) {
            width: 2ch;
            text-align: right;
            opacity: .9;
        }

        table.score th:nth-child(3), table.score td:nth-child(3) {
            text-align: right;
        }

tr.me {
    background: #1b2754;
}
/* Scroll area for leaderboard (max ~11 rows visible) */
.score-wrap {
    max-height: 380px;
    overflow: auto;
    border-radius: 10px;
}

    .score-wrap::-webkit-scrollbar {
        width: 10px;
    }

    .score-wrap::-webkit-scrollbar-thumb {
        background: #273664;
        border-radius: 8px;
    }

footer {
    opacity: .75;
    font-size: 13px;
    text-align: center;
}

kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    background: #10183b;
    border: 1px solid #25356a;
    padding: 2px 6px;
    border-radius: 6px;
}
