:root {
    --bg: #111;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    display: grid;
    place-items: center;
    background-color: var(--bg);
    color: #eee;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background: radial-gradient(1200px 1200px at 50% 55%, rgba(255,255,255,0.05), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
}

#game {
    background: #1f1f1f;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
    transform: scale(0.9);
    transform-origin: center center;
    border: none;
    outline: 1px solid #2a2a2a;
    outline-offset: 0;
    transform-origin: center center;
}

#hud {
    position: fixed;
    top: 16px;
    left: 16px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    opacity: 0.92;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 14px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

#hud.hidden {
    opacity: 0;
    transform: translateY(-4px);
}

#menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 14px 16px;
    width: auto;
    min-width: 240px;
    max-width: 320px;
    display: grid;
    gap: 10px;
    justify-items: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    opacity: 0;

    background: rgba(40, 40, 40, 0.8);
    backdrop-filter: blur(6px) brightness(0.1);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;

    transition: filter 1s, opacity 1s;
}

#menu h1 {
    color: #ff5757;
    text-shadow: 0 0 12px #ff575782;
}
#menu .summary {
    display: grid;
    grid-template-columns: auto auto;
    gap: 6px 10px;
    font-weight: 600;
}
#menu .summary .label { opacity: 0.8; }
#menu .highscores {
    width: 100%;
}
#menu .highscores h2 {
    margin: 4px 0 6px 0;
    font-size: 14px;
    font-weight: 700;
    opacity: 0.9;
}
#menu ol {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}
#menu li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 8px;
}
#menu li:nth-child(odd) { background: rgba(255,255,255,0.04); }
#menu li .meta { opacity: 0.8; font-size: 12px; }

#menu button {
    appearance: none;
    border: 1px solid #3a3a3a;
    background: rgba(255,255,255,0.06);
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    color: #eee;
    cursor: pointer;
}
#menu button:hover { filter: brightness(1.1); }
#menu button:active { transform: translateY(1px); }

#menu li.current {
    color: #ff5757;
    font-weight: 700;
}

#bg {
    position: fixed;
    inset: 0;
    z-index: -1; /* behind everything */
    display: block;
    filter: blur(60px) saturate(1.05);
    background: radial-gradient(1200px 1200px at 50% 55%, rgba(255,255,255,0.04), transparent 60%),
                linear-gradient(var(--bg), var(--bg));
}