/**
 * Minesweeper Game Styles
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg, #FFF9E6);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.game-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text, #333);
}

.stats {
    display: flex;
    gap: 0.5rem;
}

.stat-box {
    background: var(--color-bg-secondary, #FFF5D6);
    border: 2px solid var(--color-border, #ddd);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.stat-box .label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-light, #666);
    text-transform: uppercase;
}

.stat-box .value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text, #333);
    font-variant-numeric: tabular-nums;
}

/* Control instructions */
.controls-block {
    width: 100%;
}

.controls-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.control-pill.action {
    background: var(--color-primary, #FFD93D);
    color: #333;
}

.control-pill.special {
    background: var(--color-accent, #FF6B6B);
    color: white;
}

.control-pill .touch {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: inline-block;
}

.best-time {
    color: var(--color-success, #4CAF50);
    font-size: 0.875rem;
    font-weight: 600;
    min-height: 1.25rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    background: var(--color-bg-secondary, #FFF5D6);
    border: 3px solid var(--color-border, #ddd);
    border-radius: 12px;
    padding: 6px;
    width: 100%;
    aspect-ratio: 1;
}

.cell {
    background: var(--color-card-bg, #fff);
    border: 2px solid var(--color-border, #ddd);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
    aspect-ratio: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cell:hover {
    border-color: var(--color-primary, #FFD93D);
    transform: scale(1.05);
}

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

.cell.revealed {
    background: var(--color-bg, #FFF9E6);
    border-color: var(--color-border-light, #eee);
    cursor: default;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cell.revealed:hover {
    transform: none;
    border-color: var(--color-border-light, #eee);
}

.cell.flagged {
    background: var(--color-accent, #FF6B6B);
    border-color: var(--color-accent, #FF6B6B);
}

.cell.mine {
    background: var(--color-accent, #FF6B6B);
    border-color: #dc2626;
}

.cell.mine-clicked {
    background: #dc2626;
    border-color: #991b1b;
    animation: mine-explode 0.3s;
}

@keyframes mine-explode {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Number colors */
.cell[data-count="1"] { color: #3b82f6; }
.cell[data-count="2"] { color: #22c55e; }
.cell[data-count="3"] { color: #ef4444; }
.cell[data-count="4"] { color: #8b5cf6; }
.cell[data-count="5"] { color: #f59e0b; }
.cell[data-count="6"] { color: #06b6d4; }
.cell[data-count="7"] { color: #ec4899; }
.cell[data-count="8"] { color: #6b7280; }

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: var(--color-card-bg, #fff);
    border: 3px solid var(--color-primary, #FFD93D);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 90%;
}

.overlay-content h2 {
    font-size: 1.75rem;
    color: var(--color-text, #333);
    margin-bottom: 0.5rem;
}

.overlay-content h2.win {
    color: var(--color-success, #4CAF50);
}

.overlay-content h2.lose {
    color: var(--color-accent, #FF6B6B);
}

.overlay-content p {
    font-size: 1rem;
    color: var(--color-text-light, #666);
    margin-bottom: 1.5rem;
}

.share-container {
    margin-bottom: 1rem;
}

.restart-btn {
    background: var(--color-primary, #FFD93D);
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.restart-btn:hover {
    background: var(--color-primary-dark, #E6A700);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.restart-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.restart-btn:focus-visible {
    outline: 3px solid var(--color-primary, #FFD93D);
    outline-offset: 2px;
}

/* Home link */
.home-link {
    margin-top: 0.75rem;
    color: var(--color-text-light, #666);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.home-link:hover {
    color: var(--color-text, #333);
    background: var(--color-bg-secondary, #FFF5D6);
    text-decoration: none;
}

.home-link:focus-visible {
    outline: 2px solid var(--color-primary, #FFD93D);
    outline-offset: 2px;
}

/* How to Play section */
.how-to-play {
    width: 100%;
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--color-card-bg, #fff);
    border: 2px solid var(--color-border, #ddd);
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.how-to-play h2 {
    font-size: 1.5rem;
    color: var(--color-text, #333);
    margin-bottom: 0.75rem;
}

.how-to-play h3 {
    font-size: 1.25rem;
    color: var(--color-text, #333);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.how-to-play p {
    color: var(--color-text-light, #666);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.how-to-play ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.how-to-play li {
    color: var(--color-text-light, #666);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.fun-fact {
    background: var(--color-bg-secondary, #FFF5D6);
    border-left: 4px solid var(--color-primary, #FFD93D);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.fun-fact p {
    margin: 0;
}

/* Related Games section */
.related-games {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--color-card-bg, #fff);
    border: 2px solid var(--color-border, #ddd);
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.related-games h3 {
    font-size: 1.25rem;
    color: var(--color-text, #333);
    margin-bottom: 1rem;
}

.related-games-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.related-game-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--color-bg-secondary, #FFF5D6);
    border: 2px solid var(--color-border, #ddd);
    border-radius: 8px;
    color: var(--color-text, #333);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.related-game-link:hover {
    background: var(--color-primary, #FFD93D);
    border-color: var(--color-primary, #FFD93D);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.related-game-emoji {
    font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 400px) {
    .game-container {
        padding: 0.5rem;
    }

    .title {
        font-size: 1.5rem;
    }

    .cell {
        font-size: 0.875rem;
    }

    .how-to-play,
    .related-games {
        padding: 1rem;
    }

    .control-pill {
        font-size: 0.7rem;
        padding: 0.4rem 0.7rem;
    }
}
