@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600&display=swap');

:root {
    --bg-gradient-top: #05071f;
    --bg-gradient-bottom: #0b2a4a;
    --accent-blue: #33f5ff;
    --accent-pink: #ff4fff;
    --accent-gold: #ffcc33;
    --text: #ebf5ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Orbitron', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: radial-gradient(circle at center, rgba(51, 245, 255, 0.1), transparent 40%),
                linear-gradient(160deg, var(--bg-gradient-top), var(--bg-gradient-bottom));
    color: var(--text);
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 48px;
}


.game-shell {
    position: relative;
    margin-top: 40px;
    display: inline-block;
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(4, 12, 24, 0.65), 0 0 40px rgba(255, 79, 255, 0.15);
    overflow: hidden;
}

.game-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(4, 11, 22, 0.9), rgba(7, 32, 58, 0.9));
    z-index: 0;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
}

.ui-panel {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 16px 28px;
    border-radius: 22px;
    background: rgba(5, 17, 41, 0.65);
    backdrop-filter: blur(12px);
    box-shadow: inset 0 0 12px rgba(51, 245, 255, 0.15);
}

.title {
    font-size: 24px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-gold);
    text-shadow: 0 0 12px rgba(255, 204, 51, 0.4);
}

.controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mode-group {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    padding: 10px 18px;
    border: 1px solid rgba(51, 245, 255, 0.3);
    border-radius: 16px;
    background: rgba(5, 17, 41, 0.45);
    box-shadow: inset 0 0 12px rgba(51, 245, 255, 0.12);
}

.controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: rgba(235, 245, 255, 0.85);
}

.difficulty {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(235, 245, 255, 0.75);
}

.difficulty label {
    white-space: nowrap;
}

.difficulty select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(51, 245, 255, 0.25);
    background: rgba(5, 17, 41, 0.55);
    color: var(--text);
    padding: 6px 28px 6px 12px;
    border-radius: 14px;
    font-size: 14px;
    font-family: inherit;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: inset 0 0 8px rgba(51, 245, 255, 0.15);
    position: relative;
}

.difficulty select:focus {
    outline: none;
    border-color: rgba(255, 204, 51, 0.6);
    box-shadow: 0 0 0 2px rgba(255, 204, 51, 0.2);
}

.difficulty.disabled {
    opacity: 0.45;
}

.difficulty.disabled select {
    pointer-events: none;
    filter: grayscale(0.15);
}

.controls input[type="radio"] {
    accent-color: var(--accent-pink);
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 14px;
}

.control-button {
    border: none;
    padding: 10px 22px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(5, 17, 41, 0.7);
    border: 1px solid rgba(51, 245, 255, 0.35);
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(51, 245, 255, 0.15);
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(255, 79, 255, 0.35);
    border-color: rgba(255, 204, 51, 0.55);
}

.control-button:disabled,
.control-button:disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: rgba(51, 245, 255, 0.2);
}

.control-button.primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-pink));
    border-color: transparent;
    color: #04111d;
    box-shadow: 0 8px 20px rgba(51, 245, 255, 0.35);
}

.control-button.primary:hover {
    box-shadow: 0 10px 28px rgba(255, 79, 255, 0.45);
}

.control-button.secondary {
    background: rgba(5, 17, 41, 0.75);
    border-color: rgba(255, 79, 255, 0.35);
}

.instructions {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(235, 245, 255, 0.7);
}

.back-link {
    align-self: flex-start;
    margin-top: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(51, 245, 255, 0.35);
    background: rgba(5, 17, 41, 0.55);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
    border-color: rgba(255, 204, 51, 0.55);
    box-shadow: 0 0 16px rgba(255, 79, 255, 0.25);
    transform: translateY(-1px);
    outline: none;
}

.corner-brand {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(51, 245, 255, 0.2), rgba(255, 79, 255, 0.2));
    border: 1px solid rgba(51, 245, 255, 0.35);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-decoration: none;
    text-transform: uppercase;
    box-shadow: 0 8px 22px rgba(4, 12, 24, 0.65);
    z-index: 10;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.corner-brand:hover,
.corner-brand:focus-visible {
    border-color: rgba(255, 204, 51, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(255, 79, 255, 0.35);
    outline: none;
}

.scoreboard {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: clamp(14px, 3vw, 26px);
    font-size: clamp(28px, 5vw, 54px);
    font-weight: 600;
    text-shadow: 0 0 16px rgba(255, 79, 255, 0.55), 0 0 6px rgba(51, 245, 255, 0.75);
    z-index: 2;
    pointer-events: none;
}

.scoreboard span {
    min-width: 48px;
    text-align: center;
}

.scoreboard .divider {
    color: rgba(235, 245, 255, 0.35);
    font-size: 32px;
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
}

.overlay .message {
    padding: 18px 32px;
    border-radius: 18px;
    background: rgba(5, 17, 41, 0.7);
    border: 1px solid rgba(255, 204, 51, 0.4);
    color: var(--accent-gold);
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 3px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.overlay.visible {
    pointer-events: auto;
}

.overlay.visible .message {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1050px) {
    .ui-panel {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        gap: 20px;
    }

    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .difficulty {
        justify-content: center;
    }
}

@media (max-width: 900px) {
    .title {
        font-size: 20px;
    }

    .control-button {
        font-size: 13px;
        padding: 9px 18px;
    }

    .instructions {
        flex-basis: 100%;
    }
}
