:root {
    --bg-color: #12141a;
    --game-bg: #1e222b;
    --text-primary: #f0f4f8;
    --text-accent: #3b82f6;
    --warning-color: #f59e0b;
    --critical-color: #ef4444;
    --modal-bg: rgba(18, 20, 26, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

#game-container {
    position: relative;
    width: 500px;
    height: 700px;
    background-color: var(--game-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

#score-display {
    display: flex;
    flex-direction: column;
}

#score-display .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
}

#score-value {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#avalanche-warning {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 150px;
}

#avalanche-warning .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 700;
    margin-bottom: 5px;
}

#warning-bar-container {
    width: 100%;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
}

#warning-bar {
    height: 100%;
    width: 0%;
    background-color: var(--warning-color);
    transition: width 0.3s ease, background-color 0.3s ease;
}

.critical #warning-bar {
    background-color: var(--critical-color);
    animation: pulse-critical 0.5s infinite alternate;
}

.critical .label {
    color: var(--critical-color);
    animation: text-pulse 0.5s infinite alternate;
}

@keyframes pulse-critical {
    from { opacity: 1; box-shadow: 0 0 5px var(--critical-color); }
    to { opacity: 0.5; box-shadow: 0 0 15px var(--critical-color); }
}

@keyframes text-pulse {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

/* Modals */
#game-over-modal, #start-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#game-over-modal.hidden, #start-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(255,255,255,0.2);
    letter-spacing: 2px;
}

.modal-content h2 {
    font-size: 3rem;
    font-weight: 900;
    color: var(--critical-color);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.modal-content p {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.modal-content p span {
    font-weight: 700;
    color: var(--text-primary);
}

.instructions {
    font-size: 1rem !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

.instructions.warning {
    color: var(--critical-color) !important;
    font-weight: 700;
    margin-top: 15px;
    margin-bottom: 25px;
}

button {
    margin-top: 25px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
    letter-spacing: 1px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}
