/* ========================================
   FGamesTV - Styles principaux
   ======================================== */

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #22c55e;
    --accent: #f59e0b;
    --danger: #ef4444;
    --dark: #1e1e2e;
    --darker: #11111b;
    --light: #cdd6f4;
    --muted: #6c7086;
    --surface: #313244;
    --surface-light: #45475a;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   Composants communs
   ======================================== */

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.btn-large {
    padding: 20px 50px;
    font-size: 1.4rem;
}

.card {
    background: var(--surface);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Page d'accueil
   ======================================== */

.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 20px;
}

.logo {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 60px rgba(99, 102, 241, 0.5);
}

.tagline {
    font-size: 1.3rem;
    color: var(--muted);
    margin-bottom: 50px;
}

.home-buttons {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.home-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 40px 60px;
    background: var(--surface);
    border-radius: 20px;
    text-decoration: none;
    color: var(--light);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.home-btn:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
}

.home-btn-icon {
    font-size: 4rem;
}

.home-btn-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.home-btn-desc {
    color: var(--muted);
    font-size: 0.95rem;
}

/* ========================================
   Interface TV
   ======================================== */

.tv-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: var(--surface);
}

.room-code {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 8px;
}

.tv-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* Lobby */
.lobby-container {
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.qr-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    margin: 40px 0;
}

.qr-code {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.qr-code img {
    width: 200px;
    height: 200px;
}

.join-info h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.join-url {
    font-size: 1.3rem;
    color: var(--primary);
    background: var(--darker);
    padding: 15px 25px;
    border-radius: 10px;
    font-family: monospace;
}

.players-section {
    margin-top: 50px;
}

.players-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--muted);
}

.players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--surface);
    padding: 15px 25px;
    border-radius: 50px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.player-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
}

.player-name {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Sélection de jeu */
.game-selection {
    margin-top: 40px;
}

.game-selection h3 {
    font-size: 1.3rem;
    margin-bottom: 25px;
    color: var(--muted);
}

.game-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.game-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 25px 40px;
    background: var(--surface-light);
    border: 2px solid var(--surface-light);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--light);
}

.game-btn:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.game-btn-icon {
    font-size: 2.5rem;
}

.game-btn-name {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Zone de jeu TV */
.game-area {
    width: 100%;
    max-width: 1000px;
    text-align: center;
}

.round-info {
    font-size: 1.2rem;
    color: var(--muted);
    margin-bottom: 20px;
}

.question-container {
    background: var(--surface);
    padding: 50px;
    border-radius: 20px;
    margin-bottom: 30px;
}

.question-text {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.4;
}

.choices-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.choice-card {
    background: var(--surface-light);
    padding: 30px;
    border-radius: 16px;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 20px;
}

.choice-letter {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.timer-bar {
    width: 100%;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    margin-top: 30px;
    overflow: hidden;
}

.timer-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--accent), var(--danger));
    transition: width 0.1s linear;
}

/* Réponses des joueurs */
.answers-status {
    margin-top: 30px;
    font-size: 1.2rem;
    color: var(--muted);
}

/* Résultats */
.results-container {
    width: 100%;
    max-width: 800px;
}

.correct-answer {
    background: var(--secondary);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 30px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--surface);
    padding: 20px 30px;
    border-radius: 12px;
}

.result-rank {
    font-size: 1.5rem;
    font-weight: 800;
    width: 50px;
}

.result-rank.gold { color: #ffd700; }
.result-rank.silver { color: #c0c0c0; }
.result-rank.bronze { color: #cd7f32; }

.result-player {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.result-answer {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.result-answer.correct {
    background: var(--secondary);
    color: white;
}

.result-answer.wrong {
    background: var(--danger);
    color: white;
}

.result-points {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
}

.result-total {
    font-size: 1rem;
    color: var(--muted);
}

/* Écran final */
.final-results {
    text-align: center;
}

.winner-section {
    margin-bottom: 50px;
}

.winner-crown {
    font-size: 5rem;
    animation: bounce 1s ease infinite;
}

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

.winner-name {
    font-size: 3rem;
    font-weight: 800;
    margin: 20px 0;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.winner-score {
    font-size: 2rem;
    color: var(--muted);
}

.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin: 40px 0;
}

.podium-place {
    text-align: center;
    padding: 20px;
    border-radius: 16px 16px 0 0;
}

.podium-place.first {
    background: linear-gradient(180deg, #ffd700 0%, #b8860b 100%);
    height: 180px;
    order: 2;
}

.podium-place.second {
    background: linear-gradient(180deg, #c0c0c0 0%, #808080 100%);
    height: 140px;
    order: 1;
}

.podium-place.third {
    background: linear-gradient(180deg, #cd7f32 0%, #8b4513 100%);
    height: 100px;
    order: 3;
}

.podium-player {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.podium-score {
    font-size: 1.5rem;
    font-weight: 800;
}

/* ========================================
   Interface Mobile (Joueur)
   ======================================== */

.mobile-container {
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.mobile-header {
    text-align: center;
    padding: 15px;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 20px;
}

.mobile-room {
    font-size: 0.9rem;
    color: var(--muted);
}

.mobile-player {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Formulaire de join */
.join-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--surface-light);
    border-radius: 12px;
    background: var(--surface);
    color: var(--light);
    font-size: 1.1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-option {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-option:hover,
.color-option.selected {
    transform: scale(1.15);
    border-color: white;
}

/* Zone de jeu mobile */
.mobile-game {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mobile-question {
    background: var(--surface);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    text-align: center;
    line-height: 1.5;
}

.mobile-choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.mobile-choice {
    padding: 20px;
    background: var(--surface);
    border: 2px solid var(--surface-light);
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-choice:active {
    transform: scale(0.98);
}

.mobile-choice.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.mobile-choice.correct {
    border-color: var(--secondary);
    background: rgba(34, 197, 94, 0.2);
}

.mobile-choice.wrong {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
}

.choice-index {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--surface-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Jeu de rapidité mobile */
.speed-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.speed-instruction {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.speed-instruction.visible {
    opacity: 1;
}

.speed-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: none;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.speed-button.visible {
    opacity: 1;
    transform: scale(1);
}

.speed-button:active {
    transform: scale(0.95);
}

/* Jeu de mémoire mobile */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
}

.memory-cell {
    aspect-ratio: 1;
    border-radius: 12px;
    background: var(--surface);
    border: 3px solid var(--surface-light);
    cursor: pointer;
    transition: all 0.2s;
}

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

.memory-cell.lit {
    border-color: white;
    box-shadow: 0 0 20px currentColor;
}

/* Attente */
.waiting-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px;
}

.waiting-icon {
    font-size: 4rem;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.waiting-text {
    font-size: 1.3rem;
    color: var(--muted);
}

/* Score mobile */
.mobile-score {
    background: var(--surface);
    padding: 15px 25px;
    border-radius: 12px;
    text-align: center;
    margin-top: auto;
}

.score-label {
    font-size: 0.9rem;
    color: var(--muted);
}

.score-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}

/* ========================================
   Animations
   ======================================== */

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .logo {
        font-size: 2.5rem;
    }

    .home-btn {
        padding: 30px 40px;
    }

    .qr-container {
        flex-direction: column;
        gap: 30px;
    }

    .question-text {
        font-size: 1.5rem;
    }

    .choices-grid {
        grid-template-columns: 1fr;
    }

    .room-code {
        font-size: 1.8rem;
    }
}
