:root {
    --bg-color: #0c0a09;
    --panel-color: #1c1917;
    --teal: #2dd4bf;
    --copper: #d97706;
    --gold: #fcd34d;
    --ice: #67e8f9;
    --danger: #ef4444;
    --text-main: #e7e5e4;
    --font-stack: 'Inter', system-ui, -apple-system, sans-serif;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    overflow: hidden;
    font-family: var(--font-stack);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0d141b;
    background-image:
        radial-gradient(ellipse at 50% 40%, rgba(45, 212, 191, 0.07) 0%, transparent 46%),
        radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 22%, rgba(4, 8, 12, 0.84) 100%),
        linear-gradient(rgba(103, 232, 249, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(103, 232, 249, 0.045) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 56px 56px, 56px 56px;
    transition: background-color 0.5s;
}

#game-container::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 16% 20%, rgba(103, 232, 249, 0.08), transparent 22%),
        radial-gradient(circle at 84% 78%, rgba(45, 212, 191, 0.06), transparent 24%),
        radial-gradient(circle at 70% 18%, rgba(217, 119, 6, 0.05), transparent 18%),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 255, 255, 0.018) 3px);
    opacity: 0.75;
}

#game-container.frozen-bg {
    background-color: #0b1a2e;
}

#game-container.frozen-bg::before {
    opacity: 1;
    background-image:
        radial-gradient(circle at 50% 45%, rgba(103, 232, 249, 0.16), transparent 48%),
        radial-gradient(circle at 18% 22%, rgba(125, 211, 252, 0.1), transparent 24%),
        radial-gradient(circle at 82% 76%, rgba(45, 212, 191, 0.1), transparent 26%),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(186, 230, 253, 0.03) 3px);
}

#game-container.frozen-bg #layer-floor {
    filter: saturate(1.35) brightness(1.08);
}

#game-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    will-change: transform;
}

.high-quality #game-layer {
    filter: drop-shadow(0 0 3px rgba(45, 212, 191, 0.3));
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px;
    box-sizing: border-box;
}

.hud-panel {
    display: flex;
    justify-content: space-between;
    color: var(--text-main);
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    font-weight: 700;
    font-size: 16px;
    pointer-events: none;
    letter-spacing: 1px;
}

.bar-wrapper {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.bar-container {
    height: 10px;
    background: #292524;
    border: 1px solid #57534e;
    position: relative;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 50px;
}

#hp-bar {
    width: 100%;
    height: 100%;
    background-color: var(--danger);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

.bar-container.overhealed {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(252, 211, 77, 0.4);
}
.bar-container.overhealed #hp-bar {
    background: linear-gradient(90deg, var(--danger), #f59e0b);
}

#hp-text {
    font-size: 10px;
    margin-left: 8px;
    color: #a8a29e;
}

#score-display {
    text-align: right;
    color: var(--copper);
    font-size: 22px;
    font-family: monospace;
}

#stats-display {
    text-align: right;
    font-size: 11px;
    color: var(--teal);
    margin-top: 4px;
    opacity: 0.8;
}

#wave-display {
    text-align: center;
    color: var(--teal);
    font-size: 24px;
    font-weight: 800;
    position: absolute;
    width: 100%;
    top: 60px;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s;
    text-shadow: 0 0 10px rgba(45, 212, 191, 0.5);
    letter-spacing: 3px;
}

#joystick-zone {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5;
    touch-action: none;
}

#joystick-base {
    position: absolute;
    width: 100px; height: 100px;
    border: 2px solid rgba(217, 119, 6, 0.3);
    border-radius: 50%;
    display: none; pointer-events: none;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
#joystick-knob {
    position: absolute; top: 50%; left: 50%;
    width: 40px; height: 40px;
    background: rgba(217, 119, 6, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255,255,255,0.2);
}

.screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(12, 10, 9, 0.95);
    z-index: 20;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    pointer-events: auto;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s;
}
.hidden { display: none !important; opacity: 0; pointer-events: none; }

h1 {
    color: var(--copper); text-transform: uppercase;
    letter-spacing: 4px; margin: 0 0 10px;
    font-size: 32px; text-align: center;
    border-bottom: 2px solid var(--teal); padding-bottom: 10px;
}

.menu-kicker {
    color: var(--teal);
    letter-spacing: 5px;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    margin: 0 0 8px;
}

.start-hero {
    width: 72px;
    height: 58px;
    margin: 0 0 6px;
    overflow: visible;
}

.start-mark {
    width: 72px;
    height: 72px;
    margin-bottom: 10px;
    overflow: visible;
}

.music-credit {
    margin-top: 16px;
    font-size: 10px;
    line-height: 1.5;
    color: #78716c;
    opacity: 0.75;
    text-align: center;
    max-width: 82%;
    font-style: normal;
}

.relic-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    margin: 8px 0 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    max-width: 88%;
}

.mine-hint {
    color: var(--copper);
    font-style: normal;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.mine-hint svg {
    width: 22px;
    height: 22px;
    overflow: visible;
}

#wave-hud {
    margin-top: 8px;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--teal);
    font-weight: 700;
    opacity: 0.9;
}

.btn {
    background: linear-gradient(to bottom, #44403c, #292524);
    color: var(--copper); border: 1px solid #78350f;
    padding: 15px 50px; font-size: 18px; font-weight: bold;
    text-transform: uppercase; cursor: pointer;
    margin-top: 25px; transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border-radius: 2px;
}
.btn:active { transform: scale(0.96); background: var(--copper); color: #000; }

.info-text {
    color: #a8a29e; margin-top: 10px; font-size: 13px;
    text-align: center; max-width: 80%; font-style: italic;
}

#debug-fps { display: none; }

#pause-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: var(--copper);
    border: 2px solid var(--copper);
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
#pause-btn:hover { background: rgba(217, 119, 6, 0.2); border-color: var(--gold); }
#pause-btn:active { transform: scale(0.95); }
#pause-btn svg { width: 24px; height: 24px; fill: #E8E8E8; }

.audio-toggle-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: var(--copper);
    border: 2px solid var(--copper);
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.audio-toggle-btn:hover { 
    background: var(--copper) !important; 
    border-color: var(--gold); 
}
.audio-toggle-btn:active { 
    transform: scale(0.95); 
    background: var(--copper) !important;
}
.audio-toggle-btn:focus {
    background: var(--copper) !important;
    outline: none;
}
.audio-toggle-btn svg { 
    width: 24px; 
    height: 24px; 
}

.music-toggle-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: var(--copper);
    border: 2px solid var(--copper);
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.music-toggle-btn:hover { 
    background: var(--copper) !important; 
    border-color: var(--gold); 
}
.music-toggle-btn:active { 
    transform: scale(0.95); 
    background: var(--copper) !important;
}
.music-toggle-btn:focus {
    background: var(--copper) !important;
    outline: none;
}
.music-toggle-btn svg { 
    width: 24px; 
    height: 24px; 
}


@keyframes shake {
    0% { transform: translate(1px, 1px); }
    50% { transform: translate(-1px, 2px); }
    100% { transform: translate(0, 0); }
}
.shake-screen { animation: shake 0.3s cubic-bezier(.36,.07,.19,.97) both; }

.floating-text {
    position: absolute;
    font-weight: bold;
    font-size: 14px;
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 15;
    text-shadow: 0 1px 2px black;
}

@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-40px); opacity: 0; }
}
    