:root {
    --void: #050608;
    --panel: rgba(10, 12, 16, 0.92);
    --line: #272c35;
    --text: #f2f4f7;
    --muted: #929aa8;
    --alpha: #50e3c2;
    --beta: #ff5f68;
    --amber: #e3b94f;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--void);
    color: var(--text);
}

body {
    display: grid;
    grid-template-rows: auto 1fr;
    font-family: "Courier New", Courier, monospace;
}

header {
    position: relative;
    z-index: 50;
    background: #080a0e;
}

.game-shell {
    position: relative;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--void);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

.hud {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.hud-session {
    top: 22px;
    left: 24px;
}

.brand-line {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.brand-line h1 {
    margin: 0;
    font-size: clamp(20px, 2vw, 30px);
    line-height: 1;
    letter-spacing: 0;
}

#build-label,
.status-line,
.pilot-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.status-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #555d69;
}

.status-dot.connected {
    background: var(--alpha);
    box-shadow: 0 0 12px rgba(80, 227, 194, 0.55);
}

.pilot-label {
    margin-top: 5px;
}

.pilot-label.alpha {
    color: var(--alpha);
}

.pilot-label.beta {
    color: var(--beta);
}

.hud-score {
    top: 22px;
    left: 50%;
    display: flex;
    gap: 10px;
    align-items: center;
    transform: translateX(-50%);
    font-size: 24px;
    font-weight: 700;
}

.hud-score .alpha {
    color: var(--alpha);
}

.hud-score .beta {
    color: var(--beta);
}

.score-divider {
    color: #59616e;
}

.hud-telemetry {
    top: 22px;
    right: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(105px, auto));
    gap: 8px 20px;
    text-align: right;
}

.hud-telemetry div {
    display: grid;
    gap: 2px;
}

.hud-telemetry span,
.health-copy span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.hud-telemetry strong {
    font-size: 13px;
}

.hud-health {
    right: 24px;
    bottom: 24px;
    width: min(280px, 32vw);
}

.health-copy {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 7px;
}

.health-track {
    height: 7px;
    border: 1px solid #303640;
    background: #0c0e12;
}

.health-track span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--alpha);
    transition: width 120ms linear, background-color 120ms linear;
}

.input-display {
    left: 24px;
    bottom: 24px;
    display: grid;
    gap: 5px;
}

.key-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

kbd {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid #303640;
    border-radius: 3px;
    background: rgba(8, 10, 14, 0.86);
    color: #78818e;
    font: 700 12px/1 "Courier New", monospace;
}

kbd.active {
    border-color: var(--alpha);
    color: var(--text);
    background: rgba(80, 227, 194, 0.17);
}

kbd.space-key {
    width: 100px;
    height: 24px;
    margin-top: 2px;
    font-size: 10px;
}

.match-actions {
    position: absolute;
    z-index: 8;
    left: 50%;
    bottom: 22px;
    display: flex;
    gap: 7px;
    transform: translateX(-50%);
}

.match-actions button,
.dialog-actions button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #0c0f14;
    color: var(--text);
    padding: 0 16px;
    font: 700 13px/1 "Courier New", monospace;
    cursor: pointer;
}

.match-actions button:hover,
.dialog-actions button:hover {
    border-color: #4a5361;
    background: #11161d;
}

.dialog-actions button.primary {
    border-color: var(--alpha);
    color: var(--alpha);
}

.center-message {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    max-width: min(80vw, 620px);
    transform: translate(-50%, -50%);
    color: rgba(242, 244, 247, 0.72);
    font-size: clamp(14px, 2vw, 20px);
    font-weight: 700;
    text-align: center;
}

.lobby-backdrop {
    position: absolute;
    z-index: 20;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 6, 8, 0.66);
    backdrop-filter: blur(3px);
}

.lobby-backdrop[hidden],
.match-actions[hidden],
.toast[hidden] {
    display: none;
}

.lobby-dialog {
    width: min(440px, 100%);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0b0e13;
    padding: 26px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.dialog-heading {
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--alpha);
    font-size: 11px;
    font-weight: 700;
}

.dialog-heading h2 {
    margin: 7px 0 0;
    font-size: 25px;
    letter-spacing: 0;
}

.lobby-dialog label {
    display: grid;
    gap: 7px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.lobby-dialog input {
    width: 100%;
    height: 43px;
    border: 1px solid var(--line);
    border-radius: 4px;
    outline: 0;
    background: #07090d;
    color: var(--text);
    padding: 0 12px;
    font: 700 14px/1 "Courier New", monospace;
}

.lobby-dialog input:focus {
    border-color: var(--alpha);
}

.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 22px;
}

.toast {
    position: absolute;
    z-index: 30;
    left: 50%;
    bottom: 82px;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    padding: 10px 14px;
    color: var(--text);
    font-size: 12px;
}

@media (max-width: 720px) {
    .hud-session {
        top: 14px;
        left: 14px;
    }

    .hud-score {
        top: 72px;
    }

    .hud-telemetry {
        top: 14px;
        right: 14px;
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .hud-telemetry div:nth-child(3),
    .hud-telemetry div:nth-child(4) {
        display: none;
    }

    .input-display {
        left: 14px;
        bottom: 14px;
    }

    .hud-health {
        right: 14px;
        bottom: 14px;
        width: 150px;
    }

    .match-actions {
        bottom: 72px;
    }

    .match-actions button {
        padding: 0 9px;
        font-size: 10px;
    }
}
