:root {
    --bg-color: #050510;
    --grid-bg: #0a0a20;
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ff;
    --neon-green: #00ff41;
    --neon-red: #ff3131;
    --neon-yellow: #ffee00;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --cell-size: 30px;
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(0, 243, 255, 0.05) 0%, transparent 50%),
        linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
}

#game-container {
    width: 100%;
    max-width: 600px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    z-index: 10;
    position: relative;
}

/* Header & HUD */
header {
    text-align: center;
    padding: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1);
}

.neon-title {
    font-family: 'Orbitron', sans-serif;
    margin: 5px 0 15px 0;
    font-size: 2.5em;
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue);
    letter-spacing: 2px;
}

.flicker {
    animation: flicker 2s infinite;
}

#hud {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.hud-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--neon-blue);
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 0.8em;
    color: var(--neon-blue);
    margin-bottom: 5px;
}

.hud-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.5em;
    color: #fff;
}

#controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    border: none;
    outline: none;
    transition: all 0.2s;
}

.neon-btn {
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 0.9em;
    text-shadow: 0 0 5px var(--neon-pink);
    box-shadow: 0 0 5px var(--neon-pink), inset 0 0 5px var(--neon-pink);
}

.neon-btn:hover {
    background: var(--neon-pink);
    color: #000;
}

.difficulty-select {
    display: flex;
    gap: 5px;
}

.diff-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
}

.diff-btn.active {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 10px var(--neon-blue);
}

/* Grid */
#grid-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 10px;
}

#grid {
    display: grid;
    gap: 2px;
    background: rgba(0,0,0,0.5);
    padding: 5px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.1s, transform 0.1s;
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cell.revealed {
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
    cursor: default;
}

.cell.flagged::after {
    content: '🚩';
    font-size: 0.8em;
    filter: drop-shadow(0 0 2px var(--neon-red));
}

.cell.mine.revealed {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid var(--neon-red);
}

.cell.mine.revealed::after {
    content: '💣';
    font-size: 0.8em;
}

/* Numbers Colors */
.cell[data-num="1"] { color: var(--neon-blue); text-shadow: 0 0 5px var(--neon-blue); }
.cell[data-num="2"] { color: var(--neon-green); text-shadow: 0 0 5px var(--neon-green); }
.cell[data-num="3"] { color: var(--neon-red); text-shadow: 0 0 5px var(--neon-red); }
.cell[data-num="4"] { color: var(--neon-pink); text-shadow: 0 0 5px var(--neon-pink); }
.cell[data-num="5"] { color: var(--neon-yellow); }

/* Modals */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal {
    background: rgba(10, 10, 20, 0.95);
    border: 2px solid var(--glass-border);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    min-width: 300px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hidden {
    display: none !important;
}

.neon-text-red { color: var(--neon-red); text-shadow: 0 0 10px var(--neon-red); }
.neon-text-green { color: var(--neon-green); text-shadow: 0 0 10px var(--neon-green); }
.neon-text-yellow { color: var(--neon-yellow); text-shadow: 0 0 10px var(--neon-yellow); }

/* Defusal Specifics */
.wire-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.wire {
    width: 60px;
    height: 150px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    position: relative;
    box-shadow: 0 0 15px currentColor;
    transition: transform 0.1s;
}

.wire:active { transform: scale(0.95); }

.wire.red { background: var(--neon-red); color: var(--neon-red); }
.wire.blue { background: var(--neon-blue); color: var(--neon-blue); }
.wire.green { background: var(--neon-green); color: var(--neon-green); }

.wire.cut {
    height: 70px; /* Visually cut */
    opacity: 0.5;
    box-shadow: none;
    pointer-events: none;
}

#defusal-timer {
    font-size: 3em;
    font-family: 'Orbitron', monospace;
    color: var(--neon-red);
    margin: 10px 0;
}

/* Animations */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    5%, 10% { opacity: 0.8; }
    15% { opacity: 1; }
    20% { opacity: 0.1; }
    25% { opacity: 1; }
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Mobile Tweaks */
@media (max-width: 480px) {
    .neon-title { font-size: 1.8em; }
    #hud { gap: 10px; }
    .hud-item { min-width: 60px; padding: 5px; }
    .hud-value { font-size: 1.2em; }
    .wire { width: 50px; height: 120px; }
}
