:root {
    --bg-color: #0A1022;
    --primary: #3B82F6;
    --secondary: #60A5FA;
    --accent: #F59E0B;
    --text: #F8FAFC;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: #000;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    color: var(--text);
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--bg-color);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.2);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: optimizeSpeed;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 34, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 24px;
    text-align: center;
    transition: opacity 0.3s;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--text), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.overlay > p {
    color: var(--secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.controls-panel {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 320px;
    text-align: left;
}

.controls-panel h3 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1rem;
    letter-spacing: 1.5px;
}

.controls-panel p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 8px;
    color: rgba(248, 250, 252, 0.8);
}

.controls-panel span {
    color: var(--accent);
    font-weight: 600;
}

.mt-2 { margin-top: 16px; font-style: italic; color: var(--secondary) !important; }

button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 16px 48px;
    font-size: 1.25rem;
    font-weight: 800;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
}

button:active { transform: scale(0.96); }
button:hover { box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6); }

.stats-panel {
    width: 100%;
    max-width: 320px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1.1rem;
}
.stat-row:last-child { margin-bottom: 0; }
.stat-row .label { color: var(--secondary); }
.stat-row span:last-child { font-family: monospace; font-weight: 600; font-size: 1.3rem; }

.highlight {
    color: var(--accent);
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 24px;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.05); opacity: 1; text-shadow: 0 0 20px rgba(245, 158, 11, 0.8); }
}

#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

.hud-top, .hud-bottom {
    display: flex;
    justify-content: space-between;
}

.hud-bottom { align-items: flex-end; }

.stat-box {
    display: flex;
    flex-direction: column;
    background: rgba(10, 16, 34, 0.5);
    padding: 8px 12px;
    border-radius: 8px;
}

.stat-box .label {
    font-size: 0.65rem;
    color: var(--secondary);
    letter-spacing: 1px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    margin-bottom: 2px;
}

.stat-box .value {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

#boss-warning {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--danger);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 2px;
    text-align: center;
    background: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--danger);
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    animation: flash 0.5s infinite alternate;
}

@keyframes flash {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}
