:root {
    color-scheme: dark;
    --panel-bg: rgba(7, 12, 18, 0.65);
    --accent: #f7c948;
    --text: #f7fafc;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: inherit;
    color: var(--text);
    background: radial-gradient(circle at top, #1b2a5b, #050911);
}

#scene-container {
    position: fixed;
    inset: 0;
}

#ui-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: clamp(1rem, 2vw, 2.5rem);
}

#scoreboard {
    width: min(260px, 60vw);
    background: rgba(7, 12, 18, 0.4);
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    backdrop-filter: blur(4px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}

.score-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

.score-line + .score-line {
    margin-top: 0.4rem;
}

.score-line strong {
    font-size: 1.4rem;
}

#instructions {
    max-width: 460px;
    background: rgba(7, 12, 18, 0.35);
    padding: 0.9rem 1.2rem;
    border-radius: 1rem;
    backdrop-filter: blur(4px);
    font-size: 1rem;
}

#control-panel {
    margin-top: auto;
    width: min(460px, 100%);
    background: rgba(2, 5, 9, 0.5);
    border-radius: 1.5rem;
    padding: 0.9rem 1rem 1.1rem;
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: auto;
    align-self: center;
}

.control-block {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.control-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.85);
}

.control-header span:last-child {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e2e8f0;
}

#direction-gauge {
    position: relative;
    height: 70px;
    border-radius: 999px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.6));
    overflow: visible;
}

#direction-gauge .gauge-track {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 90%;
    height: 2px;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

#direction-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #fb7185, #facc15);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.35));
    transition: background 0.2s ease;
}

#power-gauge {
    position: relative;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: visible;
}

#power-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ef4444, #f97316, #facc15, #4ade80);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
}

#power-marker {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
}

#control-button {
    border: none;
    border-radius: 1rem;
    padding: 0.9rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: linear-gradient(120deg, #2563eb, #7c3aed);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

#control-button:active {
    transform: scale(0.98);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

#action-hint {
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
}

#shot-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(2rem, 5vw, 4rem);
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid var(--accent);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#shot-result.visible {
    opacity: 1;
}

#home-button {
    pointer-events: auto;
    align-self: flex-start;
    background: var(--panel-bg);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
}

#home-button a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

#end-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#end-screen.visible {
    opacity: 1;
    pointer-events: auto;
}

#end-screen .panel {
    background: #0e1726;
    padding: 2rem;
    border-radius: 1.5rem;
    width: min(90vw, 400px);
    text-align: center;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
}

#end-screen button {
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #1b1b1b;
    font-weight: 600;
    cursor: pointer;
}

button:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

@media (max-width: 640px) {
    #ui-overlay {
        padding: 0.7rem;
    }

    #scoreboard {
        width: 100%;
        border-radius: 1.25rem;
    }

    #instructions {
        width: 100%;
    }

    #control-panel {
        width: 100%;
        padding: 0.75rem 0.9rem 1rem;
    }
}
