/* Variables globales */
:root {
    --primary-color: #4299e1;
    --secondary-color: #2b6cb0;
    --success-color: #4CAF50;
    --error-color: #f44336;
    --text-color: #4299e1;
    --bg-color: #f4f4f4;
    --text-on-bg: #ffffff;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --border-radius: 15px;
}

/* Thème clair par défaut */
body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--primary-color);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    width: 100%;
    width: 100dvw;
    margin: 0;
    padding: 0;
}

/* Thème sombre */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--secondary-color);
    }
    
    .screen {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    }
    
    :root {
        --primary-color: #1e293b;
        --secondary-color: #0f172a;
        --success-color: #10b981;
        --error-color: #ef4444;
        --text-color: #f3f4f6;
        --bg-color: #1f2937;
        --white: #374151;
        --text-on-bg: #ffffff;
        --shadow: 0 4px 15px rgba(0,0,0,0.5);
    }
}

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

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in-out;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.screen.active {
    opacity: 1;
    transform: translateX(0);
}

.content {
    text-align: center;
    padding: 2rem;
    max-width: 90%;
    width: 100%;
}

h1 {
    color: var(--text-on-bg);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

h2 {
    color: var(--text-on-bg);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

p {
    color: var(--text-on-bg);
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.main-btn {
    background: var(--white);
    color: var(--text-color);
    border: none;
    padding: 1.2rem 2.5rem;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    min-height: 60px;
    min-width: 280px;
}

.main-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.main-btn:active {
    transform: translateY(-1px);
}

.media-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    margin-left: auto;
    margin-right: auto;
    display: inline-block;
    overflow: hidden;
}

.media-container img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

.media-container video {
    width: 100%;
    height: auto;
    max-height: 100%;
    border-radius: 10px;
    display: block;
}

.year-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

.year-btn {
    background: var(--white);
    color: var(--text-color);
    border: 2px solid var(--white);
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 50px;
}

.year-btn:hover {
    background: var(--text-color);
    color: var(--white);
    transform: scale(1.05);
}

.year-btn:active {
    transform: scale(0.95);
}

.score {
    color: var(--text-on-bg);
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.result-message {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.result-message.success {
    color: #4CAF50;
}

.result-message.error {
    color: #ff9800;
}

.correct-year {
    color: var(--text-on-bg);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.final-score {
    color: var(--text-on-bg);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

/* Responsive adjustments */
@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    p {
        font-size: 1.1rem;
    }
    
    .main-btn {
        padding: 1rem 2rem;
        font-size: 1.2rem;
        min-width: 250px;
    }
    
    .year-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.8rem;
        max-width: 300px;
    }
    
    .year-btn {
        padding: 0.8rem;
        font-size: 1rem;
        min-height: 45px;
    }
    
    .content {
        padding: 1rem;
    }
}

@media (max-height: 700px) {
    .media-container {
        max-height: 40vh;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    p {
        margin-bottom: 1rem;
    }
}

/* Prevent text selection on mobile */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for specific elements */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Desktop specific styles - allow videos to overflow container */
@media (min-width: 768px) {
    .media-container {
        overflow: visible;
        position: relative;
    }
    
    .media-container video {
        position: relative;
        z-index: 10;
        min-width: 100%;
        max-width: none;
        width: auto;
        height: auto;
        max-height: 70vh;
        transform: translateX(-50%);
        left: 50%;
    }
}