* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}
.header {
    width: 100%;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 15, 0.9);
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f5f5f5;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}
.logo span { font-size: 1.3rem; }
.back-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.3s ease;
}
.back-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4); }
.game-container {
    position: relative;
    margin: 20px auto;
    padding: 10px;
}
#gameCanvas {
    border: 3px solid #8b5cf6;
    border-radius: 12px;
    background: linear-gradient(180deg, #0f0f23 0%, #1a1a3e 30%, #2a2a4e 100%);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
    cursor: crosshair;
    max-width: 100%;
}
.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}
.bar-container span { width: 20px; text-align: center; }
.bar {
    width: 150px;
    height: 18px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 9px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}
.bar-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.2s ease;
}
.hp-fill { background: linear-gradient(90deg, #ef4444, #dc2626); }
.mana-fill { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.xp-fill { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.stats {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
    color: #f5f5f5;
    font-size: 0.9rem;
}
.stats div { margin-bottom: 5px; }
.stats .label { color: #9ca3af; font-size: 0.75rem; text-transform: uppercase; }
.stats .value { font-weight: 700; color: #10b981; font-size: 1.1rem; }
.skeleton-count {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f5f5f5;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 8px;
}
.skeleton-count .emoji { font-size: 1.5rem; }
.controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: #9ca3af;
    font-size: 0.75rem;
    text-align: right;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 8px;
}
.controls strong { color: #8b5cf6; }
.phase-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: #10b981;
    text-shadow: 0 0 30px rgba(16, 185, 129, 0.8);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 50;
}
.phase-indicator.show { opacity: 1; }
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 100;
    padding: 20px;
}
.overlay h1 {
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    color: #8b5cf6;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
    text-align: center;
}
.overlay .subtitle { color: #10b981; font-size: 1.1rem; margin-bottom: 25px; text-align: center; }
.overlay p { color: #9ca3af; margin-bottom: 12px; max-width: 400px; text-align: center; font-size: 0.95rem; line-height: 1.5; }
.btn {
    padding: 14px 35px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s ease;
    margin: 5px;
}
.btn-start {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}
.btn-start:hover { transform: scale(1.05); box-shadow: 0 6px 30px rgba(139, 92, 246, 0.5); }
.btn-menu {
    background: transparent;
    color: #f5f5f5;
    border: 2px solid #8b5cf6;
}
.btn-menu:hover { background: rgba(139, 92, 246, 0.2); }
.upgrade-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(16, 185, 129, 0.1));
    border: 2px solid #8b5cf6;
    border-radius: 12px;
    padding: 20px;
    margin: 10px;
    min-width: 180px;
    cursor: pointer;
    transition: 0.3s ease;
    text-align: center;
}
.upgrade-card:hover { transform: translateY(-5px); border-color: #10b981; box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3); }
.upgrade-card .emoji { font-size: 2.2rem; margin-bottom: 10px; display: block; }
.upgrade-card h3 { color: #f5f5f5; margin-bottom: 8px; font-size: 0.95rem; }
.upgrade-card p { color: #9ca3af; font-size: 0.8rem; }
.upgrades-grid { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; margin: 20px 0; }
.hidden { display: none !important; }
.game-title { color: #6b7280; margin: 20px 0 30px; font-size: 0.9rem; }
.instructions { display: flex; gap: 25px; margin: 20px 0; justify-content: center; flex-wrap: wrap; }
.instruction { text-align: center; color: #9ca3af; }
.instruction .key { 
    display: block; 
    font-size: 1.6rem; 
    margin-bottom: 5px;
    background: rgba(139, 92, 246, 0.2);
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #8b5cf6;
}
@media (max-width: 850px) {
    #gameCanvas { width: 100%; height: auto; }
    .controls { font-size: 0.65rem; padding: 8px 10px; }
    .bar { width: 100px; }
    .overlay h1 { font-size: 1.8rem; }
    .instruction .key { font-size: 1.2rem; padding: 5px 10px; }
}
