:root {
    --hud-bg: rgba(8, 12, 22, 0.68);
    --hud-stroke: rgba(160, 206, 255, 0.42);
    --hud-text: rgb(237, 245, 255);
    --hud-muted: rgba(203, 216, 234, 0.9);
    --hud-accent: rgb(255, 165, 48);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body {
    overflow: hidden;
    font-family: "Rajdhani", "Trebuchet MS", "Arial Narrow", sans-serif;
    background:
        radial-gradient(circle at 16% 12%, rgba(76, 128, 214, 0.33), transparent 48%),
        radial-gradient(circle at 82% 8%, rgba(216, 92, 35, 0.24), transparent 44%),
        linear-gradient(180deg, rgb(11, 18, 34) 0%, rgb(7, 11, 20) 100%);
}

.noscript-message {
    margin: 0;
    padding: 0.8rem 1rem;
    background: rgb(252, 217, 170);
    color: rgb(60, 33, 10);
    font-weight: 700;
    text-align: center;
}

.game-shell {
    position: relative;
    width: 100vw;
    height: 100dvh;
    isolation: isolate;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.hud {
    position: absolute;
    left: 1.4rem;
    top: 1.2rem;
    display: grid;
    gap: 0.55rem;
    min-width: min(20rem, 74vw);
    padding: 0.95rem 1.15rem;
    border-radius: 0.9rem;
    background:
        linear-gradient(162deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        var(--hud-bg);
    border: 1px solid var(--hud-stroke);
    color: var(--hud-text);
    box-shadow: 0 0.8rem 1.8rem rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(7px);
    z-index: 2;
}

.hud h1 {
    margin: 0;
    font-family: "Bebas Neue", "Arial Black", sans-serif;
    letter-spacing: 0.08em;
    font-size: clamp(1.42rem, 2.3vw, 1.95rem);
    line-height: 1;
}

.hud p {
    margin: 0;
    color: var(--hud-muted);
    font-size: clamp(0.95rem, 1.8vw, 1.08rem);
}

.hud-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-family: "Bebas Neue", "Arial Black", sans-serif;
    font-size: clamp(1rem, 2.25vw, 1.25rem);
    letter-spacing: 0.06em;
}

.hud-stats span {
    color: var(--hud-accent);
    text-shadow: 0 0 8px rgba(255, 140, 20, 0.35);
}

.hud-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    font-size: clamp(0.88rem, 1.6vw, 0.98rem);
    color: rgba(224, 234, 250, 0.94);
    letter-spacing: 0.04em;
}

.power-widget {
    display: grid;
    gap: 0.38rem;
    margin-top: 0.12rem;
}

.power-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: clamp(0.82rem, 1.55vw, 0.95rem);
    color: rgba(218, 232, 250, 0.95);
    letter-spacing: 0.05em;
}

.power-track {
    position: relative;
    height: 0.62rem;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(17, 25, 41, 0.8);
    border: 1px solid rgba(165, 196, 232, 0.26);
}

.power-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgb(103, 215, 255) 0%, rgb(255, 197, 71) 56%, rgb(255, 101, 59) 100%);
    box-shadow: 0 0 10px rgba(100, 196, 255, 0.35);
    transition: width 80ms linear;
}

.hint-label {
    margin: 0.15rem 0 0;
    min-height: 1.2rem;
    color: rgba(233, 243, 255, 0.86);
    font-size: clamp(0.84rem, 1.65vw, 0.95rem);
    letter-spacing: 0.03em;
}

@media (max-width: 760px) {
    .hud {
        left: 0.7rem;
        right: 0.7rem;
        top: 0.6rem;
        min-width: 0;
    }

    .settings-toggle {
        right: 0.7rem;
        top: 0.6rem;
    }

    .settings-panel {
        right: 0.7rem;
        top: 3.2rem;
        min-width: min(18rem, 80vw);
    }
}

.settings-toggle {
    position: absolute;
    right: 1.4rem;
    top: 1.2rem;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--hud-stroke);
    border-radius: 0.6rem;
    background: var(--hud-bg);
    color: var(--hud-muted);
    cursor: pointer;
    backdrop-filter: blur(7px);
    transition: background 0.15s, color 0.15s;
}

.settings-toggle:hover,
.settings-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: var(--hud-text);
}

.settings-panel {
    position: absolute;
    right: 1.4rem;
    top: 3.8rem;
    z-index: 3;
    display: none;
    flex-direction: column;
    gap: 0.7rem;
    min-width: min(20rem, 74vw);
    padding: 0.95rem 1.15rem;
    border-radius: 0.9rem;
    background:
        linear-gradient(162deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        var(--hud-bg);
    border: 1px solid var(--hud-stroke);
    color: var(--hud-text);
    box-shadow: 0 0.8rem 1.8rem rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(7px);
}

.settings-panel.open {
    display: flex;
}

.settings-panel h2 {
    margin: 0;
    font-family: "Bebas Neue", "Arial Black", sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    letter-spacing: 0.06em;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: clamp(0.82rem, 1.5vw, 0.95rem);
    color: rgba(218, 232, 250, 0.95);
    letter-spacing: 0.04em;
    cursor: pointer;
}

.settings-row span:first-child {
    min-width: 5.5rem;
    flex-shrink: 0;
}

.settings-row select {
    flex: 1;
    padding: 0.25rem 0.4rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(165, 196, 232, 0.26);
    background: rgba(17, 25, 41, 0.8);
    color: var(--hud-text);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.settings-row select:focus {
    outline: 1px solid var(--hud-accent);
}

.settings-row input[type="range"] {
    flex: 1;
    height: 0.5rem;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(17, 25, 41, 0.8);
    border: 1px solid rgba(165, 196, 232, 0.26);
    border-radius: 999px;
    cursor: pointer;
}

.settings-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--hud-accent);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.settings-row input[type="range"]::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--hud-accent);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.slider-value {
    min-width: 2.2rem;
    text-align: right;
    font-family: "Bebas Neue", "Arial Black", sans-serif;
    font-size: clamp(0.82rem, 1.5vw, 0.95rem);
    color: var(--hud-accent);
}
