:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #4ecdc4;
    --danger-color: #ff6b6b;
    --warning-color: #f9ca24;
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.1);
    --bg-card: rgba(255, 255, 255, 0.15);
    --border-color: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --cell-revealed: rgba(255, 255, 255, 0.9);
    --cell-unrevealed: rgba(255, 255, 255, 0.2);
    --cell-flag: #f9ca24;
    --cell-mine: #ff6b6b;
    --cell-number-1: #0099cc;
    --cell-number-2: #00cc66;
    --cell-number-3: #ff3366;
    --cell-number-4: #6633cc;
    --cell-number-5: #cc0066;
    --cell-number-6: #00cccc;
    --cell-number-7: #000000;
    --cell-number-8: #666666;
}

[data-theme="light"] {
    --text-color: #333333;
    --text-secondary: rgba(51, 51, 51, 0.7);
    --bg-primary: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --bg-secondary: rgba(0, 0, 0, 0.05);
    --bg-card: rgba(255, 255, 255, 0.8);
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.15);
    --cell-revealed: rgba(255, 255, 255, 1);
    --cell-unrevealed: rgba(255, 255, 255, 0.6);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.title {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, var(--accent-color), var(--warning-color), var(--success-color));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px var(--shadow-color);
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.game-interface {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 30px;
    align-items: start;
}

.game-controls {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
}

.difficulty-selector {
    margin-bottom: 25px;
}

.difficulty-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.difficulty-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-selector select:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.game-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
}

.game-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.game-board {
    display: grid;
    gap: 1px;
    background: var(--border-color);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-color);
    backdrop-filter: blur(10px);
}

.cell {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.cell.unrevealed {
    background: var(--cell-unrevealed);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.cell.unrevealed:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.cell.revealed {
    background: var(--cell-revealed);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.cell.flagged {
    background: var(--cell-flag);
    color: white;
    font-size: 16px;
}

.cell.mine {
    background: var(--cell-mine);
    color: white;
    font-size: 16px;
}

.cell.exploded {
    background: #ff3333;
    animation: explode 0.5s ease-out;
}

.cell.number-1 { color: var(--cell-number-1); }
.cell.number-2 { color: var(--cell-number-2); }
.cell.number-3 { color: var(--cell-number-3); }
.cell.number-4 { color: var(--cell-number-4); }
.cell.number-5 { color: var(--cell-number-5); }
.cell.number-6 { color: var(--cell-number-6); }
.cell.number-7 { color: var(--cell-number-7); }
.cell.number-8 { color: var(--cell-number-8); }

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border-radius: 12px;
    z-index: 10;
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 40px;
}

#overlayIcon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: white;
}

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

.overlay-stats {
    font-size: 1.1rem;
    color: var(--success-color);
    margin-top: 15px;
}

.game-instructions {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
}

.instruction-section {
    margin-bottom: 30px;
}

.instruction-section:last-child {
    margin-bottom: 0;
}

.instruction-section h3 {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.instruction-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.instruction-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.instruction-section ul {
    list-style: none;
    padding-left: 0;
}

.instruction-section li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.5;
}

.instruction-section li::before {
    content: "•";
    color: var(--accent-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--shadow-color);
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 25px var(--shadow-color);
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes reveal {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.cell.revealed {
    animation: reveal 0.2s ease-out;
}

@media (max-width: 1024px) {
    .game-interface {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .game-controls,
    .game-instructions {
        order: 1;
    }
    
    .game-container {
        order: 0;
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .game-controls,
    .game-instructions {
        padding: 20px;
    }
    
    .cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .theme-toggle {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    
    .cell {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    
    .game-board {
        padding: 8px;
    }
}