@font-face {
    font-family: "PrintChar21";
    src: url("./pr/PrintChar21.ttf") format("truetype");
}

@font-face {
    font-family: "PRNumber3";
    src: url("./pr/PRNumber3.ttf") format("truetype");
}

:root {
    --bg: #040607;
    --bg-deep: #010203;
    --panel: rgba(8, 16, 14, 0.92);
    --line: rgba(126, 255, 195, 0.22);
    --glow: #98ffb4;
    --amber: #ffb54d;
    --danger: #ff6666;
    --text: #dcffe8;
    --muted: #9ec9af;
    --shadow: rgba(0, 0, 0, 0.45);
    --crt-w: 1200px;
    --crt-h: 900px;
    --bezel-pad: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    background:
        radial-gradient(circle at top, rgba(43, 95, 71, 0.22), transparent 38%),
        radial-gradient(circle at bottom, rgba(255, 181, 77, 0.14), transparent 28%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
    color: var(--text);
    font-family: "PrintChar21", monospace;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 4px, 4px 100%;
    opacity: 0.18;
}

.cabinet {
    width: min(var(--crt-w), calc(100vw - 16px));
    margin: 0 auto;
    padding: 12px 0 20px;
    display: flex;
    flex-direction: column;
}

.playfield-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bezel {
    position: relative;
    box-sizing: border-box;
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(var(--crt-w), calc(100vw - 16px));
    height: auto;
    aspect-ratio: 800 / 600;
    max-height: min(var(--crt-h), calc((100vw - 16px) * 600 / 800));
    padding: var(--bezel-pad);
    border-radius: 20px;
    background:
        radial-gradient(circle at top, rgba(152, 255, 180, 0.08), transparent 30%),
        linear-gradient(180deg, #0f1715 0%, #030505 100%);
    border: 1px solid rgba(152, 255, 180, 0.18);
    box-shadow:
        0 28px 80px var(--shadow),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

#game {
    display: block;
    box-sizing: border-box;
    width: min(
        calc(100cqw - 2 * var(--bezel-pad)),
        calc((100cqh - 2 * var(--bezel-pad)) * 7 / 8)
    );
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 7 / 8;
    margin: 0 auto;
    background: #020302;
    border: 4px solid #111a16;
    border-radius: 14px;
    image-rendering: pixelated;
    box-shadow:
        0 0 0 1px rgba(152, 255, 180, 0.08),
        inset 0 0 24px rgba(152, 255, 180, 0.05);
}

.crt-lines {
    position: absolute;
    inset: var(--bezel-pad);
    border-radius: 14px;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0,
        rgba(255, 255, 255, 0.015) 50%,
        rgba(0, 0, 0, 0.15) 51%,
        rgba(255, 255, 255, 0.01) 100%
    );
    background-size: 100% 4px;
    mix-blend-mode: screen;
    opacity: 0.2;
}

.control-deck {
    flex-shrink: 0;
    margin-top: 14px;
    padding: 16px 18px 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(18, 28, 24, 0.98), rgba(6, 12, 11, 0.98)),
        var(--panel);
    box-shadow:
        0 18px 48px var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.control-deck-inner {
    max-width: min(var(--crt-w), 100%);
    margin: 0 auto;
}

.control-hints {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 28px;
    margin: 0;
    padding: 0 4px;
    text-align: center;
}

.control-hints p {
    margin: 0;
    color: var(--muted);
    font-size: clamp(0.72rem, 1.5vw, 0.88rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.control-hints kbd {
    display: inline-block;
    padding: 3px 8px;
    margin: 0 2px;
    border: 1px solid rgba(152, 255, 180, 0.28);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--glow);
    font-family: "PRNumber3", monospace;
    font-size: 0.95em;
}

@media (max-width: 720px) {
    .cabinet {
        width: min(100vw - 12px, 100%);
        padding-top: 8px;
    }

    :root {
        --bezel-pad: 12px;
    }

    .bezel {
        border-radius: 16px;
    }

    .control-hints {
        flex-direction: column;
        gap: 6px;
    }
}
