* {
    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;
    --player1-color: #5fc8eb;
    --player2-color: #9fda87;
    --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;
}

#login-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-field {
    width: 100%;
    padding: 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;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(10, 14, 39, 0.8);
}

.input-field::placeholder {
    color: var(--text-gray);
}

/* ============================================
   ÉCRAN DE CONNEXION
   ============================================ */

.login-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;
}

.login-header {
    margin-bottom: 2rem;
}

.login-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
    animation: floatLogo 3s ease-in-out infinite;
}

@keyframes floatLogo {
    0%, 100% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(10px);
    }
}

.login-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 1.2rem;
    color: var(--text-gray);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 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;
}

/* ============================================
   ÉCRAN LOBBY
   ============================================ */

.lobby-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    max-width: 900px;
    width: 100%;
}

.lobby-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.lobby-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.lobby-title span {
    color: var(--primary-blue);
}

.lobby-subtitle {
    font-size: 1.2rem;
    color: var(--text-gray);
}

.lobby-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.action-card {
    background: rgba(10, 14, 39, 0.6);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
}

.action-card p {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

#logout-btn {
    display: block;
    margin: 0 auto;
}

/* ============================================
   ÉCRAN D'ATTENTE
   ============================================ */

.waiting-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;
}

.waiting-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    animation: floatLogo 3s ease-in-out infinite;
}

.waiting-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.game-code-display {
    margin: 2rem 0;
}

.game-code-display p {
    color: var(--text-gray);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.code-box {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid var(--primary-blue);
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--primary-blue);
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--primary-blue);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   ÉCRAN DE JEU
   ============================================ */

.game-container {
    width: 100%;
    max-width: 1200px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 2rem;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    flex: 1;
}

.player-info.player-1 {
    border-color: var(--player1-color);
}

.player-info.player-2 {
    border-color: var(--player2-color);
    flex-direction: row-reverse;
}

.player-token {
    width: 50px;
    height: 50px;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-label {
    font-size: 0.85rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-pseudo {
    font-size: 1.2rem;
    font-weight: 700;
}

.game-status {
    flex: 1;
    text-align: center;
}

.turn-indicator {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--primary-blue);
    border-radius: 16px;
    padding: 1rem 2rem;
}

.turn-indicator.player1-turn {
    border-color: var(--player1-color);
}

.turn-indicator.player2-turn {
    border-color: var(--player2-color);
}

#current-turn-text {
    display: block;
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 0.25rem;
}

#current-player-name {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Plateau de jeu */
.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 3px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.column {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.column:hover {
    transform: translateY(-5px);
}

.column.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.column.disabled:hover {
    transform: none;
}

.cell {
    width: 70px;
    height: 70px;
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.cell.filled {
    border-color: transparent;
}

.cell img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    animation: dropIn 0.5s ease;
}

@keyframes dropIn {
    0% {
        transform: translateY(-500px) scale(0.5);
        opacity: 0;
    }
    60% {
        transform: translateY(10px) scale(1.1);
    }
    80% {
        transform: translateY(-5px) scale(0.95);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.cell.winning {
    animation: pulse 0.8s ease infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 111, 165, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px 10px rgba(74, 111, 165, 0);
    }
}

.game-footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* ============================================
   MODAL DE VICTOIRE
   ============================================ */

.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;
}

.modal-header {
    margin-bottom: 2rem;
}

.winner-token {
    width: 100px;
    height: 100px;
    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);
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
}

/* Responsive Puissance 4 */
@media (max-width: 968px) {
    .game-header {
        flex-direction: column;
        gap: 1rem;
    }

    .player-info {
        width: 100%;
        max-width: 400px;
    }

    .game-status {
        width: 100%;
        max-width: 400px;
    }

    .turn-indicator {
        width: 100%;
    }

    .cell {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 768px) {
    .login-container,
    .lobby-container,
    .waiting-container {
        padding: 2rem;
    }

    .login-title {
        font-size: 2.5rem;
    }

    .lobby-title {
        font-size: 2rem;
    }

    .lobby-actions {
        grid-template-columns: 1fr;
    }

    .cell {
        width: 50px;
        height: 50px;
    }

    .game-board {
        padding: 15px;
        gap: 8px;
    }

    .column {
        gap: 8px;
    }

    .player-token {
        width: 40px;
        height: 40px;
    }

    .player-pseudo {
        font-size: 1rem;
    }

    #current-player-name {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .screen {
        padding: 1rem;
    }

    .login-container,
    .lobby-container,
    .waiting-container,
    .modal-content {
        padding: 1.5rem;
    }

    .login-title {
        font-size: 2rem;
    }

    .lobby-title {
        font-size: 1.5rem;
    }

    .cell {
        width: 40px;
        height: 40px;
    }

    .game-board {
        padding: 10px;
        gap: 6px;
    }

    .column {
        gap: 6px;
    }

    .code-box {
        font-size: 2rem;
        letter-spacing: 4px;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .navbar {
        padding: 1rem;
    }

    .nav-logo {
        font-size: 1.2rem;
    }

    .nav-logo img {
        width: 35px;
        height: 35px;
    }

    footer {
        font-size: 0.75rem;
        padding: 1.5rem 1rem;
    }
}