* {
    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;
    padding: 20px;
    color: #333;
}

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

h1 {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Phases */
.phase {
    display: none;
}

.phase.active {
    display: block;
}

/* Phase de configuration */
#config-phase {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.config-header h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.config-header .info {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Input section */
.card-input-section {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#card-text-input {
    flex: 1;
    padding: 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: border-color 0.3s;
}

#card-text-input:focus {
    outline: none;
    border-color: #667eea;
}

.special-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.special-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

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

.btn-success {
    background: #48bb78;
    color: white;
}

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

.btn-danger {
    background: #f56565;
    color: white;
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Liste des cartes en configuration */
.cards-list {
    min-height: 200px;
    margin-bottom: 20px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
}

.config-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.config-card.special {
    border-color: #fc8181;
    background: #fff5f5;
}

.config-card-content {
    flex: 1;
    margin-right: 15px;
}

.config-card-text {
    font-size: 1rem;
    color: #2d3748;
    word-wrap: break-word;
}

.config-card.special .config-card-text::before {
    content: "⭐ ";
    color: #f56565;
}

.config-actions {
    text-align: center;
}

/* Phase de jeu */
#game-phase {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.game-info {
    color: #666;
    font-size: 1.1rem;
}

/* Plateau de jeu */
.game-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    min-height: 400px;
}

/* Cartes de jeu */
.card {
    aspect-ratio: 3/4;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Dos de la carte */
.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 3rem;
}

/* Face de la carte */
.card-front {
    background: white;
    border: 3px solid #e2e8f0;
    transform: rotateY(180deg);
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
}

.card-front.special {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-color: #fc8181;
}

.card-text {
    font-size: 1.1rem;
    color: #2d3748;
    line-height: 1.5;
}

.card-front.special .card-text::before {
    content: "⭐\A";
    white-space: pre;
    color: #f56565;
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.game-actions {
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    .game-board {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    #config-phase,
    #game-phase {
        padding: 20px;
    }

    .card-text {
        font-size: 0.95rem;
    }

    .card-back {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .input-group {
        gap: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

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

.card {
    animation: fadeIn 0.3s ease-out;
}

.config-card {
    animation: fadeIn 0.3s ease-out;
}
