* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: white;
}

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

.access-card,
.admin-card {
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 420px;
    width: 100%;
}

.admin-card h2,
.access-card h2 {
    margin-bottom: 15px;
}

.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-row label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.admin-row input {
    width: 90px;
    padding: 8px;
    border-radius: 6px;
    border: none;
    text-align: center;
}

.admin-actions {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.admin-output {
    margin-top: 15px;
}

.admin-output input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: none;
    text-align: center;
}

.game-screen.hidden {
    display: none;
}

/* Popup de sélection d'équipe */
.team-select-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.team-select-overlay.hidden {
    display: none;
}

.team-select-popup {
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    width: 90%;
}

.team-select-popup h2 {
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.team-select-popup input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: none;
    border-radius: 10px;
    margin-bottom: 25px;
    text-align: center;
}

/* Options de grille */
.grid-options {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.grid-options h3 {
    margin-bottom: 12px;
    font-size: 1rem;
    color: #bdc3c7;
}

.grid-size-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.grid-size-inputs input {
    width: 60px;
    padding: 10px;
    font-size: 1.2rem;
    text-align: center;
    border: none;
    border-radius: 8px;
}

.grid-size-inputs span {
    font-size: 1.5rem;
    font-weight: bold;
}

.grid-presets {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.preset-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.preset-btn.active {
    background: #3498db;
}

.team-options {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.team-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-column h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.team-column-blue h3 {
    color: #3498db;
}

.team-column-red h3 {
    color: #e74c3c;
}

.team-btn {
    padding: 15px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.team-btn:hover {
    transform: scale(1.05);
}

.blue-spy {
    background: #2980b9;
    color: white;
}

.blue-spy:hover {
    background: #3498db;
}

.blue-agent {
    background: #5dade2;
    color: white;
}

.blue-agent:hover {
    background: #85c1e9;
}

.red-spy {
    background: #c0392b;
    color: white;
}

.red-spy:hover {
    background: #e74c3c;
}

.red-agent {
    background: #e74c3c;
    color: white;
}

.red-agent:hover {
    background: #ec7063;
}

/* Layout principal */
.game-layout {
    display: flex;
    min-height: 100vh;
}

.main-area {
    flex: 1;
    padding: 20px 15px 30px;
    max-width: calc(100% - 220px);
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 100vh;
    justify-content: center;
}

.icon-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.05);
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.settings-overlay.hidden {
    display: none;
}

.settings-popup {
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 360px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-popup h2 {
    margin-bottom: 5px;
    font-size: 1.4rem;
}

.settings-popup h3 {
    margin: 5px 0 10px;
    font-size: 1.1rem;
}

.admin-only.hidden {
    display: none;
}

.admin-players {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.admin-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.admin-player-row button {
    padding: 6px 10px;
    font-size: 0.7rem;
}

.kick-btn {
    background: #e74c3c;
    color: white;
}
.volume-control {
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.8;
}

#volumeRange {
    width: 100%;
}

/* Panneau de récap - réduit */
.recap-panel {
    width: 220px;
    background: rgba(0, 0, 0, 0.4);
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    overflow-y: auto;
    max-height: 100vh;
    position: sticky;
    top: 0;
}

.recap-panel h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}

.recap-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Entrée d'historique */
.history-entry {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px;
    border-left: 3px solid #666;
}

.history-entry.team-red {
    border-left-color: #e74c3c;
}

.history-entry.team-blue {
    border-left-color: #3498db;
}

.history-clue {
    font-size: 0.95rem;
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-clue .clue-word {
    text-transform: uppercase;
}

.history-clue .clue-number {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.history-guesses {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-guess {
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-guess.correct {
    background: rgba(46, 204, 113, 0.3);
}

.history-guess.wrong {
    background: rgba(231, 76, 60, 0.3);
}

.history-guess.neutral {
    background: rgba(189, 195, 199, 0.3);
}

.history-guess.assassin {
    background: rgba(0, 0, 0, 0.5);
    color: #e74c3c;
    font-weight: bold;
}

.history-guess::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.history-guess.correct::before {
    background: #2ecc71;
}

.history-guess.wrong::before {
    background: #e74c3c;
}

.history-guess.neutral::before {
    background: #bdc3c7;
}

.history-guess.assassin::before {
    background: #000;
    border: 2px solid #e74c3c;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 15px;
}

h1 {
    font-size: 2rem;
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

button {
    padding: 8px 16px;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
}

button:disabled,
input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#newGameBtn {
    background: #4CAF50;
    color: white;
}

#newGameBtn:hover {
    background: #45a049;
    transform: scale(1.05);
}

#toggleViewBtn {
    background: #9c27b0;
    color: white;
}

#toggleViewBtn:hover {
    background: #7b1fa2;
    transform: scale(1.05);
}

#toggleViewBtn.spy-mode {
    background: #ff9800;
}

#changeTeamBtn {
    background: #607d8b;
    color: white;
}

#changeTeamBtn:hover {
    background: #546e7a;
    transform: scale(1.05);
}

.score {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.score-red {
    color: #e74c3c;
    font-weight: bold;
}

.score-blue {
    color: #3498db;
    font-weight: bold;
}

.turn-indicator {
    font-size: 1rem;
}

.team-red {
    color: #e74c3c;
    font-weight: bold;
}

.team-blue {
    color: #3498db;
    font-weight: bold;
}

/* Zone d'indice */
.clue-area {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 900px;
}

.clue-input-section {
    display: flex;
    gap: 8px;
    align-items: center;
}

.clue-input-section input[type="text"] {
    padding: 8px 12px;
    font-size: 0.95rem;
    border: none;
    border-radius: 6px;
    width: 150px;
    text-transform: uppercase;
}

.clue-input-section input[type="number"] {
    padding: 8px;
    font-size: 0.95rem;
    border: none;
    border-radius: 6px;
    width: 50px;
    text-align: center;
}

#giveClueBtn {
    background: #3498db;
    color: white;
    padding: 8px 16px;
}

#giveClueBtn:hover {
    background: #2980b9;
}

#clueInfinityBtn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    min-width: 42px;
}

#clueInfinityBtn.active {
    background: #ff9800;
    color: #1a1a1a;
}

.current-clue {
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    min-width: 120px;
    text-align: center;
    display: none;
}

.current-clue.active {
    display: block;
}

.end-turn-btn {
    background: #e67e22;
    color: white;
    display: none;
}

.end-turn-btn.active {
    display: block;
}

.end-turn-btn:hover {
    background: #d35400;
}

/* Zone de jeu avec équipes */
.game-area {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    width: 100%;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.team-status {
    font-size: 0.85rem;
    font-weight: bold;
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    text-align: center;
}

/* Boîtes d'équipes */
.team-box {
    width: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 10px;
    flex-shrink: 0;
    min-width: 120px;
}

.team-box h3 {
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.team-box-blue {
    border: 2px solid #3498db;
}

.team-box-blue h3 {
    color: #3498db;
}

.team-box-red {
    border: 2px solid #e74c3c;
}

.team-box-red h3 {
    color: #e74c3c;
}

.team-members {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.team-member {
    font-size: 0.75rem;
    padding: 5px 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 5px;
}

.team-member.spy {
    font-weight: bold;
}

.team-member.spy::before {
    content: '🕵️';
    font-size: 0.7rem;
}

.team-member.agent::before {
    content: '👤';
    font-size: 0.7rem;
}

.team-member.current-player {
    border: 1px solid #fff;
}

/* Grille de jeu */
.board {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-width: 900px;
    min-width: 320px;
}

.board.guess-disabled .card:not(.revealed) {
    pointer-events: none;
    cursor: not-allowed;
}

/* Cartes */
.card {
    aspect-ratio: 1.4;
    background: #f5f5dc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.card:hover:not(.revealed) {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.4);
}

.card-word {
    font-size: 0.6rem;
    font-weight: bold;
    color: #333;
    text-align: center;
    padding: 4px;
    text-transform: uppercase;
    z-index: 1;
}

/* Mode espion - bordures colorées */
.spy-mode .card.type-red {
    border: 3px solid #e74c3c;
    background: #e74c3c;
}

.spy-mode .card.type-blue {
    border: 3px solid #3498db;
    background: #3498db;
}

.spy-mode .card.type-black {
    border: 3px solid #2c3e50;
    background: #e0e3e7;
}

.spy-mode .card.type-neutral {
    border: 3px solid #bdc3c7;
    background: #f0f2f3;
}

.spy-mode .card.type-red .card-word,
.spy-mode .card.type-blue .card-word {
    color: white;
}

/* Cartes révélées */
.card.revealed {
    cursor: pointer;
}

.card.raised {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.4);
}

.card.revealed .card-word {
    opacity: 0.7;
}

.card.revealed.type-red {
    background: #e74c3c;
}

.card.revealed.type-red .card-word {
    color: white;
}

.card.revealed.type-blue {
    background: #3498db;
}

.card.revealed.type-blue .card-word {
    color: white;
}

.card.revealed.type-black {
    background: #2c3e50;
}

.card.revealed.type-black .card-word {
    color: white;
}

.card.revealed.type-neutral {
    background: #bdc3c7;
}

/* Image d'acteur superposée */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2;
}

.card.revealed .card-overlay {
    opacity: 1;
}

.card.revealed.peek-word .card-overlay {
    opacity: 0;
}

/* Teinte colorée transparente */
.card-tint {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 3;
    pointer-events: none;
}

.card.revealed .card-tint {
    opacity: 1;
}

.card.revealed.peek-word .card-tint {
    opacity: 0;
}

.card.revealed.peek-word .card-word {
    opacity: 1;
}

.card.revealed.type-red .card-tint {
    background: rgba(231, 76, 60, 0.4);
}

.card.revealed.type-blue .card-tint {
    background: rgba(52, 152, 219, 0.4);
}

.card.revealed.type-black .card-tint {
    background: rgba(0, 0, 0, 0.5);
}

.card.revealed.type-neutral .card-tint {
    background: rgba(189, 195, 199, 0.35);
}

/* Animation de révélation */
@keyframes revealCard {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.card.revealing {
    animation: revealCard 0.6s ease;
}

/* Bannière de fin de partie */
.game-over-banner {
    display: none;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    margin-top: 15px;
    border: 3px solid #fff;
}

.game-over-banner.active {
    display: block;
}

.game-over-banner h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.game-over-banner p {
    margin-bottom: 15px;
    font-size: 1rem;
    opacity: 0.8;
}

#restartBtn {
    background: #4CAF50;
    color: white;
    padding: 12px 25px;
    font-size: 1rem;
}

#restartBtn:hover {
    background: #45a049;
}

/* Responsive */
@media (max-width: 1200px) {
    .team-box {
        width: 100px;
    }

    .card-word {
        font-size: 0.55rem;
    }
}

@media (max-width: 1000px) {
    .game-layout {
        flex-direction: column;
    }

    .main-area {
        max-width: 100%;
    }

    .recap-panel {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 2px solid rgba(255, 255, 255, 0.1);
    }

    .team-box {
        width: 100%;
        flex-direction: row;
    }

    .team-members {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
        letter-spacing: 5px;
    }

    .board {
        gap: 3px;
    }

    .card-word {
        font-size: 0.45rem;
        padding: 2px;
    }

    .controls {
        gap: 8px;
    }

    button {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .score {
        font-size: 1rem;
    }

    .clue-area {
        flex-direction: column;
        gap: 8px;
    }

    .clue-input-section {
        flex-wrap: wrap;
        justify-content: center;
    }

    .team-select-popup {
        padding: 25px;
    }

    .team-options {
        flex-direction: column;
    }

}
