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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

.game-setup {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    text-align: center;
}

.game-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.game-title h2 {
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.mountain-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.cards-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite reverse;
}

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

.simple-setup p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.btn-large {
    font-size: 1.3rem;
    padding: 15px 40px;
    border-radius: 25px;
}

.player-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.player-section input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 10px;
    transition: border-color 0.3s;
}

.player-section input:focus {
    outline: none;
    border-color: #667eea;
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e1e5e9;
}

.divider span {
    background: white;
    padding: 0 15px;
    color: #999;
    font-weight: 500;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #28a745;
    color: white;
}

.btn-secondary:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.game-area {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.player-info {
    font-weight: 600;
    color: #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-code-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-copy {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-copy:hover {
    background: #0056b3;
}

.btn-copy:active {
    background: #004085;
}

.score {
    font-size: 1.1rem;
    font-weight: 600;
}

.score-row {
    margin: 2px 0;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.score-row span {
    font-weight: 600;
}

.waiting-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.waiting-message p {
    font-size: 1.2rem;
}

.game-board h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    max-width: 100%;
}

.card {
    aspect-ratio: 1;
    background: #f8f9fa;
    border: 3px solid #e1e5e9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    padding: 4px;
    word-wrap: break-word;
    overflow: hidden;
    position: relative;
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.card-word {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.1;
}

.card-symbols {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2px;
}

.symbol {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 2px;
}

.symbol-correct {
    color: #28a745;
}

.symbol-mortel {
    color: #dc3545;
}

.symbol-neutre {
    color: #6c757d;
}

.card-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 10;
    animation: fadeIn 0.3s ease-in;
}

.card-result.correct {
    background: rgba(40, 167, 69, 0.9);
}

.card-result.mortel {
    background: rgba(220, 53, 69, 0.9);
}

.card-result.neutre {
    background: rgba(108, 117, 125, 0.9);
}

.card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.card.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(0.95);
}

.card.winning {
    background: #28a745;
    color: white;
    border-color: #28a745;
    animation: pulse 0.6s ease-in-out;
}

.card.losing {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    opacity: 0.7;
}

.card.revealed {
    cursor: default;
    opacity: 0.8;
}

.card.final {
    cursor: default;
    opacity: 1;
    border-width: 2px;
}

.card.my-correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.card.my-mortel {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.card.my-neutre {
    background: #e2e3e5;
    border-color: #6c757d;
    color: #495057;
}

.card.other-revealed {
    border-style: dashed;
    border-width: 2px;
}

.card.other-revealed .symbol {
    opacity: 0.7;
}

.card.final {
    cursor: not-allowed;
    opacity: 0.9;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card.final:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.game-status {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
    text-align: center;
}

.role-selection h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.role-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.role-buttons .btn {
    flex: 1;
    max-width: 200px;
}

.current-role h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.current-role p {
    color: #666;
    font-style: italic;
}

.game-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.game-controls .btn {
    flex: 1;
    margin-bottom: 0;
    min-width: 120px;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

#stopGuessing {
    display: none;
    margin-left: 10px;
}

#stopGuessing.show {
    display: inline-block !important;
}

.results-area {
    text-align: center;
}

.results-area h3 {
    margin-bottom: 20px;
    color: #333;
}

.final-scores {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 12px;
}

.player-result {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-result span:first-child {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.player-result span:last-child {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.vs {
    font-size: 1.5rem;
    font-weight: bold;
    color: #999;
}

.winner {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.winner.win {
    color: #28a745;
    background: #d4edda;
}

.winner.lose {
    color: #dc3545;
    background: #f8d7da;
}

.winner.tie {
    color: #6c757d;
    background: #e2e3e5;
}

.game-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.rules {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.rules h3 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.rules ul {
    list-style: none;
}

.rules li {
    padding: 8px 0;
    font-size: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.rules li:last-child {
    border-bottom: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.6s ease-in-out;
}

@keyframes cardFlip {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0); }
}

.card-flip {
    animation: cardFlip 0.6s ease-in-out;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .cards-grid {
        gap: 6px;
    }
    
    .card {
        font-size: 0.7rem;
        padding: 2px;
    }
    
    .final-scores {
        flex-direction: column;
        gap: 20px;
    }
    
    .vs {
        transform: rotate(90deg);
    }
    
    .game-controls {
        flex-direction: column;
    }
}

/* Styles pour la grille de fin de partie */
.final-grids-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.player-grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px 0;
}

.player-grid-container h4 {
    text-align: center;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.opponent-grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.opponent-grid-container h4 {
    text-align: center;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.final-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    max-width: 100%;
}

.final-grid .card {
    aspect-ratio: 1;
    font-size: 0.6rem;
    padding: 2px;
}

.final-grid .card-word {
    font-size: 0.5rem;
    line-height: 1;
}

.final-grid .card-symbols {
    font-size: 0.4rem;
    gap: 1px;
}

@media (max-width: 768px) {
    .opponent-grid-container {
        margin: 15px 0;
    }
    
    .final-grid .card {
        font-size: 0.5rem;
    }
    
    .final-grid .card-word {
        font-size: 0.4rem;
    }
}

@media (max-width: 360px) {
    .card {
        font-size: 0.6rem;
    }
    
    .final-grid .card {
        font-size: 0.4rem;
    }
    
    .final-grid .card-word {
        font-size: 0.35rem;
    }
}
