/* --- Base Styles & Layout --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 20px;
    position: relative;
    overflow-x: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* Hexagonal Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    --s: 200px;
    --c1: #1d1d1d;
    --c2: #4e4f51;
    --c3: #3c3c3c;
    background: repeating-conic-gradient(
        from 30deg,
        #0000 0 120deg,
        var(--c3) 0 180deg
      )
      calc(0.5 * var(--s)) calc(0.5 * var(--s) * 0.577),
    repeating-conic-gradient(
      from 30deg,
      var(--c1) 0 60deg,
      var(--c2) 0 120deg,
      var(--c3) 0 180deg
    );
    background-size: var(--s) calc(var(--s) * 0.577);
}

/* Animated overlay for depth */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(
        circle at 50% 50%,
        rgba(102, 126, 234, 0.1) 0%,
        rgba(118, 75, 162, 0.05) 50%,
        rgba(0, 0, 0, 0.3) 100%
    );
    animation: backgroundPulse 10s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
    0% { opacity: 0.5; }
    100% { opacity: 0.8; }
}

.game-container {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 32px;
    box-shadow:
        0 8px 32px rgba(31, 38, 135, 0.37),
        0 4px 16px rgba(31, 38, 135, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 32px;
    max-width: 1200px;
    width: 100%;
    position: relative;
    overflow: hidden;
    animation: containerEntrance 1s ease-out;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@keyframes containerEntrance {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        #667eea 25%,
        #764ba2 50%,
        #667eea 75%,
        transparent 100%
    );
    animation: topBorderShine 3s ease-in-out infinite;
}

@keyframes topBorderShine {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* --- Header and Stats --- */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: white;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.game-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.stat-item:hover::before {
    left: 100%;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-item span:last-child {
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- Power-ups --- */
.power-ups {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    justify-content: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.power-up {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 18px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 90px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.power-up .power-icon {
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.power-up .power-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.power-up .power-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.power-up .power-uses {
    font-size: 14px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 8px;
    min-width: 24px;
    text-align: center;
}

.power-up:hover {
    transform: translateY(-4px) scale(1.02);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.power-up:active {
    transform: translateY(-4px) scale(1.02);
}

.power-up:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.5);
}

.power-up:disabled:hover {
    transform: none;
    box-shadow:
        0 8px 32px rgba(255, 107, 107, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.power-up::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.8s ease;
}

.power-up:hover::before {
    left: 100%;
}

/* --- Game Board --- */
.game-board-container {
    display: flex;
    justify-content: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.game-board {
    display: grid;
    gap: 2px;
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: 20px;
    margin: 0 auto;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}





.cell {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #2c3e50;
}
.cell:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.cell:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.cell.revealed {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: revealAnimation 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    cursor: default;
    border: 1px solid rgba(255, 255, 255, 0.4);
}
@keyframes revealAnimation {
    0% { transform: scale(0.8) rotate(-10deg); }
    100% { transform: scale(1) rotate(0deg); }
}
.cell.mine {
    background: #e74c3c;
    animation: explode 0.5s ease;
}
@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); background: #ff6b6b; }
    100% { transform: scale(1); }
}
.cell.flagged {
    background: #f39c12;
    color: white;
}
.cell.flagged::after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z' fill='%23e74c3c'/%3E%3Cline x1='4' y1='22' x2='4' y2='2' stroke='%23333' stroke-width='2'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 16px;
    height: 16px;
    display: inline-block;
    animation: flagWave 1s ease-in-out infinite;
}
@keyframes flagWave {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}
.cell[data-number="1"] { color: #3498db; }
.cell[data-number="2"] { color: #27ae60; }
.cell[data-number="3"] { color: #e74c3c; }
.cell[data-number="4"] { color: #8e44ad; }
.cell[data-number="5"] { color: #f39c12; }
.cell[data-number="6"] { color: #e67e22; }
.cell[data-number="7"] { color: #2c3e50; }
.cell[data-number="8"] { color: #95a5a6; }

/* --- Theme Variations --- */
body.dark-theme {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}
body.dark-theme .game-container {
    background: rgba(52, 73, 94, 0.95);
    color: white;
}
body.neon-theme {
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a1a 100%);
}
body.neon-theme .cell {
    border: 1px solid #00ff00;
    background: #000;
    color: #00ff00;
    box-shadow: 0 0 5px #00ff00;
}
body.retro-theme {
    background: repeating-linear-gradient(135deg, #cfcfcf 0 5%, #818181 10% 15%);
}
body.retro-theme .game-container {
    background: #e0dfdf;
    color: #1a1a1a;
}
body.retro-theme .cell {
    background: #f7e9c8;
    border: 2px solid #9a8541;
    color: #9a8541;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .game-container { padding: 20px; margin: 10px; }
    .cell { width: 28px; height: 28px; font-size: 12px; }
    .power-ups { flex-wrap: wrap; gap: 12px; padding: 16px; }
    .notification { right: 10px; left: 10px; transform: translateY(-100px); }
    .notification.show { transform: translateY(0); }
    .game-header { flex-direction: column; gap: 16px; padding: 16px 20px; }
    .game-stats { justify-content: center; gap: 20px; }
    .power-up { padding: 12px; font-size: 11px; min-width: 80px; }
    .game-board-container { padding: 16px; }
}

/* --- Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}
.modal-content {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalAppear 0.3s ease;
    color: #2c3e50;
}
@keyframes modalAppear {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* --- Notification System --- */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1001;
    max-width: 300px;
}
.notification.show { transform: translateX(0); }
.notification-title {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 5px;
}
.notification-message {
    font-size: 14px;
    opacity: 0.9;
}

/* --- Achievements Styles --- */
.achievement {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    margin: 4px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.achievement svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}
.achievement.unlocked {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    transform: scale(1.1);
}
.new-achievement {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    animation: achievementPop 0.5s ease;
}
@keyframes achievementPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Power-up Active State --- */
.power-up.active {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3);
}

/* --- Statistics Display --- */
.stats-display {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}
.stat-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}
.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}
.stat-label {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
}

/* --- Enhanced Animations and Effects --- */
.cell-particles {
    position: absolute;
    pointer-events: none;
    z-index: 100;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffd700;
    border-radius: 50%;
    animation: particleFloat 1s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-50px);
    }
}

.cell.chain-reveal {
    animation: chainReveal 0.4s ease-out;
}

@keyframes chainReveal {
    0% {
        transform: scale(0.7) rotate(-15deg);
        box-shadow: 0 0 20px rgba(52, 152, 219, 0.8);
    }
    50% {
        transform: scale(1.1) rotate(5deg);
        box-shadow: 0 0 30px rgba(52, 152, 219, 0.6);
    }
    100% {
        transform: scale(1) rotate(0deg);
        box-shadow: none;
    }
}

.mine-explosion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 50;
}

.explosion-ring {
    position: absolute;
    border: 3px solid #e74c3c;
    border-radius: 50%;
    animation: explosionRing 0.8s ease-out forwards;
}

@keyframes explosionRing {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

.cell.winning-glow {
    animation: winningGlow 0.5s ease-in-out infinite alternate;
}

@keyframes winningGlow {
    0% {
        box-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
    }
    100% {
        box-shadow: 0 0 20px rgba(46, 204, 113, 1), 0 0 30px rgba(46, 204, 113, 0.5);
    }
}

/* --- Enhanced UI Elements --- */
.game-header {
    position: relative;
    overflow: hidden;
}



.power-up.cooling-down {
    position: relative;
    overflow: hidden;
}

.power-up.cooling-down::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.5) 100%);
    animation: cooldownFill 3s linear forwards;
}

@keyframes cooldownFill {
    0% { height: 100%; }
    100% { height: 0%; }
}

/* --- Improved Tooltips --- */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* --- Enhanced Mobile Gestures --- */
.cell.touch-feedback {
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.2) 0%, rgba(52, 152, 219, 0.1) 100%);
    transform: scale(0.96);
    transition: all 0.15s ease;
    box-shadow:
        inset 0 2px 4px rgba(52, 152, 219, 0.3),
        0 0 8px rgba(52, 152, 219, 0.2);
}

.cell.long-press-active {
    background: linear-gradient(145deg, rgba(231, 76, 60, 0.2) 0%, rgba(231, 76, 60, 0.1) 100%);
    animation: longPressIndicator 0.5s ease-in-out;
    box-shadow:
        inset 0 2px 4px rgba(231, 76, 60, 0.3),
        0 0 12px rgba(231, 76, 60, 0.4);
}

@keyframes longPressIndicator {
    0%, 100% { transform: scale(1); }
    50% {
        transform: scale(1.05);
        box-shadow:
            inset 0 2px 4px rgba(231, 76, 60, 0.4),
            0 0 16px rgba(231, 76, 60, 0.6);
    }
}

/* --- Game State Overlays --- */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-overlay.show {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    animation: overlaySlideIn 0.5s ease-out;
}

@keyframes overlaySlideIn {
    0% {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* --- Leaderboard Styles --- */
.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 15px;
    padding: 10px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
    transition: transform 0.2s ease;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
    background: #e9ecef;
}

.leaderboard-entry .rank {
    font-weight: bold;
    color: #e67e22;
    font-size: 16px;
}

.leaderboard-entry .score {
    font-weight: bold;
    color: #27ae60;
}

.leaderboard-entry .time {
    color: #3498db;
}

.leaderboard-entry .difficulty {
    background: #9b59b6;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.leaderboard-entry .date {
    color: #7f8c8d;
    font-size: 12px;
}

/* --- Enhanced Button Styles --- */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.game-controls > div:first-child {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

#difficulty, #new-game, #leaderboard, #settings {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 10px 20px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#leaderboard {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow:
        0 4px 16px rgba(243, 156, 18, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#new-game {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow:
        0 4px 16px rgba(39, 174, 96, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#settings {
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    box-shadow:
        0 4px 16px rgba(142, 68, 173, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#difficulty, #new-game, #leaderboard, #settings {
    position: relative;
}

#difficulty::before, #new-game::before, #leaderboard::before, #settings::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

#difficulty:hover, #new-game:hover, #leaderboard:hover, #settings:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

#difficulty:hover::before, #new-game:hover::before, #leaderboard:hover::before, #settings:hover::before {
    left: 100%;
}

/* --- Tutorial Styles --- */
.tutorial-overlay {
    z-index: 300;
}

.tutorial-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 15px;
}

.tutorial-controls button {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tutorial-controls button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.tutorial-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.tutorial-controls span {
    color: #7f8c8d;
    font-size: 14px;
}

/* --- Custom Board Configuration --- */
.custom-config {
    display: none;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.custom-config.show {
    display: block;
}

.config-row {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    align-items: center;
}

.config-row label {
    min-width: 80px;
    font-weight: bold;
}

.config-row input {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.config-row input:focus {
    border-color: #3498db;
    outline: none;
}

/* --- Enhanced Responsive Design --- */
@media (max-width: 480px) {
    .cell {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }

    .power-up {
        padding: 8px;
        font-size: 10px;
    }

    .power-icon {
        font-size: 16px;
    }

    .tutorial-controls {
        flex-direction: column;
        gap: 10px;
    }

    .tutorial-controls button {
        width: 100%;
    }

    .leaderboard-entry {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
        font-size: 12px;
    }

    .leaderboard-entry .date,
    .leaderboard-entry .difficulty {
        display: none;
    }
}