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

@font-face {
    font-family: 'Arial Rounded MT';
    src: url('../fonts/ArialRoundedMT-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Arial Rounded MT';
    src: url('../fonts/ArialRoundedMT-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --primary-bg: #0a0e27;
    --text-white: #ffffff;
    --text-gray: #b8c1db;
    --card-bg: rgba(20, 25, 50, 0.8);
    --card-border: rgba(74, 111, 165, 0.3);
    --primary-blue: #4a6fa5;
    --primary-blue-hover: #5a7fb5;
    --success-green: #9fda87;
    --danger-red: #eb5f5f;
    --warning-yellow: #f5d76e;
    --font-family: 'Arial Rounded MT', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background: var(--primary-bg);
    color: var(--text-white);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 70px;
}

/* Neige */
#snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    display: block;
}

/* Navbar */
.navbar {
    background: rgba(10, 14, 39, 0.95);
    padding: 1rem 2rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.nav-logo:hover {
    opacity: 0.8;
}

.nav-logo img {
    width: 40px;
    height: 40px;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-gray);
    font-size: 1.1rem;
    font-weight: 400;
    position: relative;
    z-index: 2;
    margin-top: auto;
    opacity: 40%;
}

/* Screens */
.screen {
    display: none;
    position: relative;
    z-index: 2;
    flex: 1;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.screen.active {
    display: flex;
}

#start-screen.active {
    flex-direction: column;
    gap: 2rem;
}

/* Boutons */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #2b3a87 0%, #4a6fa5 100%);
    color: var(--text-white);
    border: 1px solid rgba(74, 111, 165, 0.3);
    backdrop-filter: blur(5px);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3545a0 0%, #5a80c5 100%);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(74, 111, 165, 0.3);
}

.btn-secondary {
    background: rgba(74, 111, 165, 0.2);
    color: var(--text-white);
    border: 2px solid var(--primary-blue);
}

.btn-secondary:hover {
    background: rgba(74, 111, 165, 0.3);
    transform: translateY(-2px);
}

.btn-text {
    background: transparent;
    color: var(--text-gray);
    padding: 0.5rem 1rem;
}

.btn-text:hover {
    color: var(--text-white);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Input Fields */
.input-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--card-border);
    border-radius: 12px;
    background: rgba(10, 14, 39, 0.6);
    color: var(--text-white);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.input-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(10, 14, 39, 0.8);
}

.input-select option {
    background: var(--primary-bg);
    color: var(--text-white);
}

/* ============================================
   ÉCRAN DE DÉMARRAGE
   ============================================ */

.start-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.start-header {
    margin-bottom: 2rem;
}

.start-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
    animation: floatLogo 3s ease-in-out infinite;
}

.start-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.start-subtitle {
    font-size: 1.2rem;
    color: var(--text-gray);
}

.start-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.difficulty-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-white);
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Section CTA de donation */
.donation-cta {
    margin-top: 0;
    padding: 1.25rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(114, 164, 242, 0.1) 0%, rgba(74, 111, 165, 0.1) 100%);
    border-radius: 16px;
    border: 1px solid rgba(114, 164, 242, 0.2);
    backdrop-filter: blur(10px);
    max-width: 500px;
    width: 100%;
}

.donation-cta h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-white);
}

.donation-cta p {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
}

/* Bouton Ko-fi personnalisé */
.kofi-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #72a4f2 0%, #4a6fa5 100%);
    color: white;
    text-decoration: none;
    padding: 0.65rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(114, 164, 242, 0.3);
}

.kofi-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(114, 164, 242, 0.5);
}

.kofi-icon-svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.game-container {
    width: 100%;
    max-width: 1400px;
}

@keyframes floatLogo {
    0%, 100% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(10px);
    }
}

.game-header {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.game-stats {
    display: flex;
    gap: 1rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Plateau de jeu */
.game-board-container {
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    width: 100%;
}

.game-board {
    display: grid;
    gap: 2px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 3px solid var(--card-border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
    width: fit-content;
}

.game-board.easy {
    grid-template-columns: repeat(8, 1fr);
}

.game-board.medium {
    grid-template-columns: repeat(16, 1fr);
}

.game-board.hard {
    grid-template-columns: repeat(24, 1fr);
}

.cell {
    width: 35px;
    height: 35px;
    background: rgba(74, 111, 165, 0.3);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
}

.cell:hover:not(.revealed):not(.flagged) {
    background: rgba(74, 111, 165, 0.5);
    transform: scale(1.05);
}

.cell.revealed {
    background: rgba(10, 14, 39, 0.6);
    cursor: default;
}

.cell.revealed.mine {
    background: var(--danger-red);
    animation: explode 0.5s ease;
}

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

.cell.flagged {
    background: rgba(94, 200, 235, 0.2);
}

.cell.number-1 { color: #5fc8eb; }
.cell.number-2 { color: #9fda87; }
.cell.number-3 { color: #eb5f5f; }
.cell.number-4 { color: #c77dff; }
.cell.number-5 { color: #f5d76e; }
.cell.number-6 { color: #ff9e64; }
.cell.number-7 { color: #e0e0e0; }
.cell.number-8 { color: #808080; }

/* Game Footer */
.game-footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 3px solid var(--primary-blue);
    border-radius: 24px;
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content.defeat {
    border-color: var(--danger-red);
}

.modal-header {
    margin-bottom: 2rem;
}

.modal-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: floatLogo 3s ease-in-out infinite;
}

.modal-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-body {
    margin-bottom: 2rem;
}

.modal-body p {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
}

/* Responsive */
@media (max-width: 1200px) {
    .cell {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }
}

@media (max-width: 968px) {
    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .difficulty-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .game-stats {
        justify-content: center;
        flex-wrap: wrap;
    }

    .cell {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .start-container,
    .donation-cta {
        padding: 2rem;
    }

    .start-title {
        font-size: 2.5rem;
    }

    .start-logo {
        width: 100px;
        height: 100px;
    }

    .stat-card {
        padding: 0.75rem 1rem;
    }

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

    .stat-value {
        font-size: 1.2rem;
    }

    .cell {
        width: 25px;
        height: 25px;
        font-size: 0.75rem;
    }

    .game-board {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .screen {
        padding: 1rem;
    }

    .start-container,
    .donation-cta {
        padding: 1.5rem;
    }

    .start-title {
        font-size: 2rem;
    }

    .start-logo {
        width: 80px;
        height: 80px;
    }

    .modal-content {
        padding: 2rem 1.5rem;
    }

    .modal-header h2 {
        font-size: 2rem;
    }

    .modal-icon {
        font-size: 3.5rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .cell {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }

    .game-board {
        padding: 6px;
        gap: 1px;
    }

    footer {
        font-size: 0.75rem;
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 1rem;
    }

    .nav-logo {
        font-size: 1.2rem;
    }

    .nav-logo img {
        width: 35px;
        height: 35px;
    }
}
