/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
    background: #121213;
    color: #fff;
    min-height: 100vh;
}

.header {
    border-bottom: 1px solid #3a3a3c;
    padding: 20px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header .subtitle {
    font-size: 0.9em;
    color: #818384;
    margin-top: 5px;
}

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

.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.5em;
    color: #818384;
}

.error {
    background: #f44336;
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.category-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.2s;
}

.category-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.category-icon {
    font-size: 1.1em;
}

.map-container {
    background: #1a1a1b;
    border: 2px solid #3a3a3c;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    min-height: 400px;
}

.map-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.map-description {
    font-size: 1.1em;
    color: #d7dadc;
    line-height: 1.6;
    max-width: 600px;
    margin-top: 15px;
}

.input-section {
    margin-bottom: 15px;
}

.guess-input {
    width: 100%;
    background: #1a1a1b;
    border: 2px solid #3a3a3c;
    color: #fff;
    padding: 18px;
    font-size: 1.2em;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: border-color 0.2s;
}

.guess-input:focus {
    outline: none;
    border-color: #538d4e;
}

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

.guess-input::placeholder {
    color: #818384;
}

.submit-btn {
    width: 100%;
    background: #538d4e;
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover:not(:disabled) {
    background: #6aaa64;
}

.submit-btn:disabled {
    background: #3a3a3c;
    cursor: not-allowed;
    opacity: 0.6;
}

.new-card-btn {
    width: 100%;
    background: #4a90e2;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
    font-size: 1em;
    transition: background 0.2s;
}

.new-card-btn:hover {
    background: #5aa0f2;
}

.info-btn, .stats-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #818384;
    font-size: 1.5em;
    cursor: pointer;
    padding: 10px;
    transition: color 0.2s;
}

.info-btn:hover, .stats-btn:hover {
    color: #fff;
}

.info-btn {
    left: 20px;
}

.stats-btn {
    right: 20px;
}

.result-box {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    color: white;
    animation: slideIn 0.3s ease;
}

.result-box.correct {
    background: #538d4e;
}

.result-box.incorrect {
    background: #b59f3b;
}

.result-box h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.result-box p {
    margin-bottom: 5px;
    line-height: 1.5;
}

.result-explanation {
    font-size: 0.9em;
    margin-top: 10px;
    opacity: 0.9;
    font-style: italic;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #1a1a1b;
    border-radius: 10px;
    border: 1px solid #3a3a3c;
}

.attempts {
    font-size: 1.1em;
}

.color-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    padding: 12px;
    background: #1a1a1b;
    border-radius: 10px;
    font-size: 0.9em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

.color-box.green {
    background: #538d4e;
}

.color-box.orange {
    background: #ff9500;
}

.color-box.gray {
    background: #3a3a3c;
}

.guess-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.word-badge {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s ease;
    cursor: help;
    position: relative;
    animation: flipIn 0.4s ease;
}

@keyframes flipIn {
    0% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateX(0);
        opacity: 1;
    }
}

.word-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.word-badge.correct {
    background: #538d4e;
    color: white;
    border: 2px solid #538d4e;
}

.word-badge.close {
    background: #ff9500;
    color: white;
    border: 2px solid #ff9500;
}

.word-badge.far {
    background: #3a3a3c;
    color: #818384;
    border: 2px solid #3a3a3c;
}

.word-badge::after {
    content: attr(data-score);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 5px;
}

.word-badge:hover::after {
    opacity: 1;
}

.guesses-list {
    margin-bottom: 25px;
}

.guess-item {
    background: #1a1a1b;
    border: 2px solid #3a3a3c;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.guess-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.guess-number {
    background: #538d4e;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.temperature-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
}

.temperature-score {
    font-size: 1.2em;
}

.temperature-label {
    font-size: 0.85em;
    opacity: 0.9;
}

.result-screen {
    text-align: center;
    padding: 20px;
}

.result-icon {
    font-size: 5em;
    margin-bottom: 20px;
}

.result-title {
    font-size: 2em;
    margin-bottom: 15px;
}

.result-title.win {
    color: #538d4e;
}

.result-title.lose {
    color: #f44336;
}

.answer-reveal {
    background: #1a1a1b;
    border: 2px solid #538d4e;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.answer-label {
    color: #818384;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.answer-text {
    font-size: 1.5em;
    font-weight: bold;
    color: #538d4e;
    margin-bottom: 15px;
}

.explanation {
    color: #d7dadc;
    line-height: 1.6;
    text-align: left;
}

.share-btn {
    background: #538d4e;
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
    transition: all 0.2s;
}

.share-btn:hover {
    opacity: 0.9;
}

.message {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #121213;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    animation: slideDown 0.3s ease;
    z-index: 1000;
}


.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s;
}

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

.modal {
    background: #121213;
    border: 1px solid #3a3a3c;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #818384;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
}

.modal-close:hover {
    color: #fff;
}

.modal h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
}

.modal p {
    color: #d7dadc;
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal ul {
    color: #d7dadc;
    line-height: 1.8;
    margin-left: 20px;
    margin-bottom: 15px;
}


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

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .container {
        padding: 15px;
    }

    .map-container {
        padding: 15px;
        min-height: 300px;
    }

    .map-image {
        max-height: 400px;
    }

    .guess-input {
        font-size: 1em;
        padding: 15px;
    }

    .submit-btn,
    .new-card-btn {
        padding: 12px;
        font-size: 1em;
    }

    .category-badge {
        font-size: 0.8em;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }

    .header .subtitle {
        font-size: 0.8em;
    }

    .map-container {
        min-height: 250px;
    }

    .result-box {
        padding: 15px;
    }

    .result-box h3 {
        font-size: 1.1em;
    }
}

.countdown {
    margin-top: 20px;
    color: #818384;
}

.countdown-timer {
    font-size: 1.5em;
    font-weight: bold;
    color: #fff;
    margin-top: 10px;
}

.language-selector {
    position: relative;
    z-index: 100;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.language-btn:hover {
    background: #2a2a2b;
    border-color: #4a4a4c;
}

.language-btn .flag {
    font-size: 1.2em;
}

.language-btn .lang-code {
    font-weight: 600;
}

.language-btn .chevron {
    font-size: 0.7em;
    opacity: 0.6;
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.language-option:hover {
    background: #2a2a2b;
}

.language-option.active {
    background: #3a3a3b;
}

.language-option .flag {
    font-size: 1.3em;
}

.language-option .lang-name {
    flex: 1;
    font-size: 0.95em;
}

.language-option .check {
    color: #538d4e;
    font-weight: bold;
}

/* Header avec langue */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-title {
    flex: 1;
    text-align: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Mobile */
@media (max-width: 768px) {
    .language-dropdown {
        right: auto;
        left: 0;
    }
    
    .language-option .lang-name {
        font-size: 0.85em;
    }
}

.card-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 10px;
    margin-bottom: 20px;
}

.stats-item {
    text-align: center;
}

.stats-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #538d4e;
}

.stats-label {
    font-size: 0.85em;
    color: #818384;
    margin-top: 4px;
}

.final-stats {
    background: #1a1a1b;
    border: 1px solid #538d4e;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
}

.final-stats p {
    margin: 5px 0;
    color: #d7dadc;
}

@media (max-width: 480px) {
    .card-stats {
        gap: 10px;
        padding: 10px;
    }
    
    .stats-value {
        font-size: 1.4em;
    }
    
    .stats-label {
        font-size: 0.75em;
    }
}

@keyframes badgeReveal {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.badge-reveal {
    animation: badgeReveal 0.5s ease-out;
}

.category-badge.locked {
    background: linear-gradient(135deg, #3a3a3c 0%, #2a2a2c 100%);
    color: #818384;
    opacity: 0.6;
}

.category-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9em;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: #d7dadc;
}

.breadcrumb-arrow {
    color: #538d4e;
    font-weight: bold;
}

.hint-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.9em;
    animation: pulse 2s ease-in-out infinite;
}

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

@media (max-width: 480px) {
    .category-breadcrumb {
        font-size: 0.8em;
        padding: 8px 12px;
    }
    
    .hint-message {
        font-size: 0.85em;
    }
}

.share-section {
    margin-top: 20px;
    padding: 20px;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 12px;
}

.share-title {
    text-align: center;
    color: #d7dadc;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.share-btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.share-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.copied-message {
    background: #538d4e;
    color: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
    animation: slideDown 0.3s ease-out;
}

.share-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.share-btn svg {
    flex-shrink: 0;
}

.share-btn-twitter {
    background: #1DA1F2;
    color: white;
}

.share-btn-twitter:hover {
    background: #1a8cd8;
    transform: scale(1.05);
}

.share-btn-whatsapp {
    background: #25D366;
    color: white;
}

.share-btn-whatsapp:hover {
    background: #20ba5a;
    transform: scale(1.05);
}

.share-btn-telegram {
    background: #0088cc;
    color: white;
}

.share-btn-telegram:hover {
    background: #0077b3;
    transform: scale(1.05);
}

.share-btn-facebook {
    background: #1877F2;
    color: white;
}

.share-btn-facebook:hover {
    background: #1565d8;
    transform: scale(1.05);
}

.share-preview {
    margin-top: 15px;
    cursor: pointer;
}

.share-preview summary {
    color: #818384;
    font-size: 0.9em;
    padding: 10px;
    background: #2a2a2b;
    border-radius: 8px;
    text-align: center;
}

.share-preview-text {
    background: #2a2a2b;
    color: #d7dadc;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@media (max-width: 480px) {
    .share-buttons-grid {
        grid-template-columns: 1fr;
    }
    
    .share-btn {
        font-size: 0.95em;
    }
}

.auth-modal {
    max-width: 400px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.auth-form input {
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-size: 1em;
}

.auth-form button {
    background: #538d4e;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.switch-mode-btn {
    background: none;
    border: none;
    color: #818384;
    cursor: pointer;
    text-decoration: underline;
}

.error-message {
    background: #f44336;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

.user-profile {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.level {
    background: #538d4e;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    padding: 15px;
    min-width: 200px;
    z-index: 100;
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.8em;
    color: #818384;
}

.stat-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #538d4e;
}

.logout-btn {
    width: 100%;
    background: #f44336;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}

.login-btn {
    background: #538d4e;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.card-with-legend {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
}

.main-card {
    width: 100%;
    margin-bottom: 15px;
}

.card-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.toggle-legend-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
}

.toggle-legend-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.toggle-legend-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.legend-container {
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.legend-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.card-source {
    text-align: center;
    margin-top: 15px;
}

.source-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    border: 1px solid #667eea;
    border-radius: 6px;
    transition: all 0.3s;
}

.source-link:hover {
    background: #667eea;
    color: white;
}

.view-legend-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    margin: 20px 0;
    transition: all 0.3s;
}

.view-legend-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.card-legend-modal {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.card-legend-modal h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.card-explanation {
    color: #d7dadc;
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.6;
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-card-image {
    width: 100%;
}

.modal-card-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.legend-toggle {
    display: flex;
    justify-content: center;
}

.modal-legend {
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    padding: 15px;
}

.modal-legend img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.modal-source {
    text-align: center;
    padding: 15px;
    background: #1a1a1b;
    border-radius: 8px;
}

.modal-source a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.modal-source a:hover {
    color: #764ba2;
}

@media (max-width: 768px) {
    .card-legend-modal {
        max-width: 95%;
        margin: 20px auto;
    }
    
    .toggle-legend-btn,
    .view-legend-btn {
        font-size: 0.95em;
        padding: 12px 15px;
    }
}

.card-side-by-side {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    background: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 12px;
    padding: 20px;
}

.card-header {
    text-align: center;
    margin-bottom: 20px;
}

.card-header h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.5em;
}

.card-header .explanation {
    color: #d7dadc;
    font-size: 0.95em;
    line-height: 1.6;
}

.side-by-side-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.side-card,
.side-legend {
    display: flex;
    flex-direction: column;
}

.side-label {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.side-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: #2a2a2b;
    border-radius: 8px;
    color: #818384;
}

.card-footer {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #3a3a3c;
}

.card-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.card-footer a:hover {
    color: #764ba2;
}

@media (max-width: 768px) {
    .side-by-side-container {
        grid-template-columns: 1fr;
    }
}

.view-legend-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    margin: 15px 0;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.view-legend-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.view-legend-btn:active {
    transform: translateY(0);
}

.card-legend-modal {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    background: #1a1a1b;
    border-radius: 12px;
}

.card-legend-modal h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.8em;
}

.card-explanation {
    color: #d7dadc;
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.6;
    padding: 15px;
    background: #2a2a2b;
    border-radius: 8px;
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-card-image {
    width: 100%;
}

.modal-card-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.legend-toggle {
    display: flex;
    justify-content: center;
}

.toggle-legend-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-legend-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modal-legend {
    background: #2a2a2b;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    padding: 15px;
    animation: slideDown 0.3s ease-out;
}

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

.modal-legend img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.modal-legend .loading {
    text-align: center;
    padding: 40px;
    color: #818384;
    font-size: 1.1em;
}

.no-legend {
    text-align: center;
    padding: 30px;
    background: #2a2a2b;
    border-radius: 8px;
    color: #818384;
    font-size: 0.95em;
}

.modal-source {
    text-align: center;
    padding: 20px;
    background: #2a2a2b;
    border-radius: 8px;
    border: 1px solid #3a3a3c;
}

.modal-source a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05em;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.modal-source a:hover {
    color: #764ba2;
    transform: translateX(5px);
}

@media (max-width: 768px) {
    .card-legend-modal {
        max-width: 95%;
        margin: 20px auto;
        max-height: 85vh;
    }
    
    .card-legend-modal h2 {
        font-size: 1.4em;
    }
    
    .view-legend-btn {
        font-size: 1em;
        padding: 12px 16px;
    }
    
    .toggle-legend-btn {
        font-size: 0.9em;
        padding: 10px 20px;
    }
    
    .modal-source a {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .card-legend-modal {
        max-height: 80vh;
    }
    
    .card-explanation {
        font-size: 0.85em;
        padding: 12px;
    }
}

.category-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.category-branch {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid #4CAF50;
}

.category-branch:nth-child(2) {
    border-left-color: #2196F3;
}

.category-branch:nth-child(3) {
    border-left-color: #FF9800;
}

.category-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    white-space: nowrap;
}

.category-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.category-branch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border-left: 3px solid #4CAF50;
    flex-wrap: wrap;
}

.category-branch:nth-child(1) {
    border-left-color: #4CAF50; /* Vert */
}

.category-branch:nth-child(2) {
    border-left-color: #2196F3; /* Bleu */
}

.category-branch:nth-child(3) {
    border-left-color: #FF9800; /* Orange */
}

.category-branch:nth-child(4) {
    border-left-color: #9C27B0; /* Violet */
}

.category-branch:nth-child(5) {
    border-left-color: #F44336; /* Rouge */
}

.category-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.9em;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.category-branch .category-badge:not(:last-child)::after {
    content: '→';
    margin-left: 8px;
    opacity: 0.5;
}

.category-badge.badge-reveal {
    animation: revealBadge 0.5s ease-out;
}

@keyframes revealBadge {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.category-badge.locked {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    opacity: 0.7;
}

@media (max-width: 768px) {
    .category-branch {
        padding: 8px 12px;
        gap: 6px;
    }
    
    .category-badge {
        font-size: 0.85em;
        padding: 5px 10px;
    }
}

.date-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.nav-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

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

.nav-prev {
    border-color: #4CAF50;
}

.nav-today {
    border-color: #2196F3;
}

.current-date {
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    text-align: center;
    min-width: 250px;
}

@media (max-width: 768px) {
    .date-navigation {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .current-date {
        font-size: 1em;
        min-width: auto;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
    }
}

.already-played-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    border-radius: 20px;
    color: #4CAF50;
    font-size: 0.85em;
    margin-left: 10px;
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid;
    border-radius: 20px;
    margin: 10px auto;
    width: fit-content;
    justify-content: center;
}

.difficulty-emoji {
    font-size: 1.1em;
}

.difficulty-label {
    font-weight: 600;
    font-size: 0.95em;
}

.difficulty-badge[style*="#4CAF50"] {
    background: rgba(76, 175, 80, 0.1);
}

.difficulty-badge[style*="#FF9800"] {
    background: rgba(255, 152, 0, 0.1);
}

.difficulty-badge[style*="#F44336"] {
    background: rgba(244, 67, 54, 0.1);
}

/* ============================================
   OPTIMISATIONS MOBILE
   ============================================ */

@media (max-width: 768px) {
    
    /* Header plus compact */
    .header {
        padding: 10px 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .header-title h1 {
        font-size: 1.5em;
        margin: 0;
    }
    
    .card-date {
        font-size: 0.8em;
        margin-top: 2px;
    }
    
    .header-actions {
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
    }
    
    .info-btn, .stats-btn, .login-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    /* Navigation de date plus compacte */
    .date-navigation {
        padding: 8px 10px;
        gap: 10px;
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 0.8em;
        white-space: nowrap;
    }
    
    .current-date {
        font-size: 0.85em;
        min-width: auto;
        flex: 1;
        text-align: center;
    }
    
    /* Badge de difficulté plus compact */
    .difficulty-badge {
        padding: 4px 10px;
        margin: 5px auto;
        font-size: 0.85em;
    }
    
    .difficulty-emoji {
        font-size: 1em;
    }
    
    .difficulty-label {
        font-size: 0.85em;
    }
    
    /* Catégories plus compactes */
    .category-container {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .category-branch {
        padding: 6px 10px;
        gap: 5px;
    }
    
    .category-badge {
        padding: 4px 8px;
        font-size: 0.75em;
    }
    
    .category-branch .category-badge:not(:last-child)::after {
        margin-left: 4px;
        font-size: 0.9em;
    }
    
    /* Breadcrumb caché sur mobile (redondant avec les badges) */
    .category-breadcrumb {
        display: none;
    }
    
    /* Message d'aide caché sur mobile */
    .hint-message {
        display: none;
    }
    
    /* Container plus compact */
    .container {
        padding: 10px 15px;
    }
    
    /* Stats de carte plus compactes */
    .card-stats {
        padding: 8px;
        gap: 10px;
        font-size: 0.85em;
    }
    
    .stats-item {
        min-width: 60px;
    }
    
    .stats-value {
        font-size: 1.2em;
    }
    
    .stats-label {
        font-size: 0.75em;
    }
    
    /* Carte plus compacte */
    .map-container {
        margin-bottom: 15px;
    }
    
    .map-image {
        max-height: 300px;
        object-fit: contain;
    }
    
    /* Section input plus compacte */
    .input-section {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .guess-input {
        padding: 10px 12px;
        font-size: 0.95em;
    }
    
    .submit-btn {
        padding: 10px 16px;
        font-size: 0.95em;
        min-width: 80px;
    }
    
    /* Légende des couleurs plus compacte */
    .color-legend {
        padding: 8px;
        gap: 8px;
        font-size: 0.75em;
    }
    
    .legend-item {
        gap: 4px;
    }
    
    .color-box {
        width: 12px;
        height: 12px;
    }
    
    /* Liste des tentatives plus compacte */
    .guesses-list h3 {
        font-size: 0.95em;
        margin-bottom: 10px;
    }
    
    .guess-item {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .guess-header {
        gap: 8px;
    }
    
    .guess-number {
        font-size: 0.8em;
        padding: 2px 6px;
    }
    
    .temperature-badge {
        gap: 6px;
    }
    
    .temperature-badge span {
        font-size: 1em;
    }
    
    .temperature-score {
        font-size: 0.9em;
    }
    
    .temperature-label {
        font-size: 0.7em;
    }
    
    .guess-words {
        gap: 4px;
    }
    
    .word-badge {
        padding: 3px 6px;
        font-size: 0.75em;
    }
    
    /* Profil utilisateur plus compact */
    .user-profile {
        position: relative;
    }
    
    .profile-btn {
        padding: 6px 10px;
        font-size: 0.85em;
        gap: 4px;
    }
    
    .user-avatar {
        font-size: 1em;
    }
    
    .username {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .level {
        font-size: 0.75em;
    }
    
    /* Sélecteur de langue plus compact */
    .language-selector {
        position: relative;
    }
    
    .language-btn {
        padding: 6px 10px;
        font-size: 0.85em;
        gap: 4px;
    }
    
    .flag {
        font-size: 1em;
    }
    
    .lang-code {
        font-size: 0.8em;
    }
    
    /* Écran de résultat plus compact */
    .result-screen {
        padding: 15px;
    }
    
    .result-icon {
        font-size: 3em;
        margin-bottom: 10px;
    }
    
    .result-title {
        font-size: 1.3em;
        margin-bottom: 10px;
    }
    
    .answer-reveal {
        padding: 12px;
        margin: 12px 0;
    }
    
    .answer-label {
        font-size: 0.85em;
    }
    
    .answer-text {
        font-size: 1.1em;
    }
    
    .explanation {
        font-size: 0.85em;
    }
    
    /* Bouton de partage plus compact */
    .share-section {
        margin-top: 15px;
    }
    
    .share-title {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .share-btn {
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    .share-buttons-grid {
        gap: 8px;
    }
    
    /* Countdown plus compact */
    .countdown {
        margin-top: 15px;
        padding: 12px;
    }
    
    .countdown p {
        font-size: 0.85em;
    }
    
    .countdown-timer {
        font-size: 1.5em;
    }
}

/* ============================================
   TRÈS PETITS ÉCRANS (< 400px)
   ============================================ */

@media (max-width: 400px) {
    
    .header-title h1 {
        font-size: 1.3em;
    }
    
    .current-date {
        font-size: 0.75em;
    }
    
    .category-badge {
        font-size: 0.7em;
        padding: 3px 6px;
    }
    
    .map-image {
        max-height: 250px;
    }
    
    .guess-input {
        font-size: 0.9em;
        padding: 8px 10px;
    }
    
    .submit-btn {
        font-size: 0.9em;
        padding: 8px 12px;
    }
}

/* ============================================
   MODE PAYSAGE MOBILE
   ============================================ */

@media (max-height: 600px) and (orientation: landscape) {
    
    .header {
        padding: 5px 10px;
    }
    
    .header-title h1 {
        font-size: 1.2em;
    }
    
    .card-date {
        display: none; /* Cacher la date en paysage */
    }
    
    .date-navigation {
        padding: 5px;
    }
    
    .difficulty-badge {
        display: none; /* Cacher la difficulté en paysage */
    }
    
    .category-container {
        margin-bottom: 8px;
    }
    
    .map-image {
        max-height: 200px;
    }
    
    .card-stats {
        display: none; /* Cacher les stats en paysage */
    }
}