* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #020617;
    color: #e5f6ff;
    font-family: Arial, Helvetica, sans-serif;
    /* Mobile: kein Bounce-Scrolling */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: none;
}

body {
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 72% 24%, rgba(14, 165, 233, .22), transparent 30%),
        radial-gradient(circle at 22% 78%, rgba(168, 85, 247, .18), transparent 28%),
        linear-gradient(135deg, #020617, #050816 52%, #020617);
}

.game-shell {
    width: min(1180px, 96vw);
    aspect-ratio: 16 / 9;
    position: relative;
    border: 1px solid rgba(56, 189, 248, .35);
    border-radius: 22px;
    overflow: hidden;
    background: #020617;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .04),
        0 28px 90px rgba(0, 0, 0, .65),
        0 0 80px rgba(14, 165, 233, .16);
    transition: border-radius .3s ease, border .3s ease;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    /* Touch: Browser-Gesten unterbinden */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(2, 6, 23, .9), rgba(7, 12, 36, .72));
    transition: opacity .25s ease, visibility .25s ease;
}

.overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.menu-card {
    width: min(560px, 86%);
    padding: 34px;
    border: 1px solid rgba(56, 189, 248, .36);
    border-radius: 24px;
    background: rgba(2, 8, 23, .82);
    box-shadow: 0 20px 70px rgba(0, 0, 0, .55);
    text-align: center;
}

.eyebrow {
    margin: 0 0 10px;
    color: #38bdf8;
    font-weight: 800;
    letter-spacing: .22em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(42px, 7vw, 84px);
    line-height: .9;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #f8fafc;
    text-shadow:
        0 0 14px rgba(56, 189, 248, .75),
        0 0 34px rgba(249, 115, 22, .55);
}

.subtitle {
    margin: 18px 0 28px;
    color: #bae6fd;
    line-height: 1.55;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
}

button {
    border: 0;
    border-radius: 999px;
    padding: 14px 26px;
    background: linear-gradient(135deg, #f97316, #facc15);
    color: #1f1300;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
}

.hint {
    margin-top: 18px;
    color: rgba(226, 246, 255, .74);
    font-size: 14px;
}

.hud-note {
    position: absolute;
    left: 18px;
    bottom: 14px;
    color: rgba(226, 246, 255, .58);
    font-size: 13px;
    pointer-events: none;
}

/* Fullscreen Button */
.fs-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(56, 189, 248, .4);
    border-radius: 8px;
    background: rgba(2, 6, 23, .7);
    color: #38bdf8;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, border-color .2s;
    letter-spacing: 0;
    text-transform: none;
}

.fs-btn:hover {
    background: rgba(56, 189, 248, .2);
    border-color: #38bdf8;
}

/* ===================== HIGHSCORE TABLE ===================== */
.highscore-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(2, 6, 23, .92), rgba(7, 12, 36, .85));
    transition: opacity .3s ease, visibility .3s ease;
    z-index: 20;
    padding: 20px;
}

.highscore-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.highscore-overlay h2 {
    text-shadow: 0 0 12px rgba(250, 204, 21, .5);
}

.hs-table {
    width: min(520px, 90%);
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 8px;
}

.hs-table thead th {
    color: #38bdf8;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 10px;
    border-bottom: 2px solid rgba(56, 189, 248, .3);
    text-align: center;
    font-size: 12px;
}

.hs-table tbody td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
    color: #e5f6ff;
}

.hs-row-top td {
    color: #facc15;
    font-weight: 800;
}

.hs-rank {
    font-weight: 900;
    color: #94a3b8;
}

.hs-row-top .hs-rank {
    color: #facc15;
}

.hs-name {
    font-weight: 900;
    letter-spacing: 0.15em;
    font-size: 16px;
    color: #f8fafc;
}

.hs-score {
    font-family: monospace;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: 0.05em;
}

.hs-level,
.hs-combo {
    color: #94a3b8;
    font-size: 13px;
}

.hs-date {
    color: #64748b;
    font-size: 12px;
}

/* ===================== MOBILE ===================== */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .game-shell {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        aspect-ratio: auto;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    /* Fullscreen-Button auf Mobile verstecken (ist im HUD) */
    .fs-btn {
        display: none;
    }

    .hud-note {
        display: none;
    }

    .menu-card {
        padding: 22px;
        border-radius: 18px;
    }

    h1 {
        font-size: clamp(32px, 9vw, 56px);
    }

    .hint {
        font-size: 12px;
    }

    .subtitle {
        font-size: 13px;
        margin: 12px 0 20px;
    }

    .hs-table {
        font-size: 11px;
    }

    .hs-table thead th {
        font-size: 10px;
        padding: 6px 6px;
    }

    .hs-table tbody td {
        padding: 6px 6px;
        font-size: 11px;
    }

    .hs-name {
        font-size: 13px;
    }

    .highscore-overlay {
        padding: 12px;
    }
}

/* Fullscreen Mode */
.game-shell:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

/* Safari Webkit Fullscreen */
.game-shell:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
    border: none;
    box-shadow: none;
}
