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

body {
    background: black;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 10px;
    overflow-x: hidden;
}

.container {
    text-align: center;
    background: white;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    width: 100%;
    max-width: min(95vw, 1100px);
    position: relative;
    margin: auto;
}

h1 {
    color: #333;
    margin-bottom: 5px;
    font-size: clamp(1.5em, 4vw, 2.5em);
    font-weight: bold;
}

.date-display {
    color: #666;
    margin-bottom: 10px;
    font-size: clamp(0.85em, 2vw, 1.1em);
    font-weight: 500;
}

.card-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    background: #f0f0f0;
    margin: 0 auto;
    width: 100%;
    max-width: min(90vw, 90vh, 1024px);
    aspect-ratio: 1 / 1;
}

.hidden-image,
.hidden-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
}

/* Cacher par défaut, sera affiché via JavaScript */
#hiddenImage,
#hiddenVideo,
#scratchImage {
    display: none;
}

.video-active #hiddenImage {
    display: none !important;
}

.video-active #hiddenVideo {
    display: block !important;
}

#scratchCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
    border-radius: 15px;
    touch-action: none;
}

#scratchCanvas:active {
    cursor: grabbing;
}

.progress-section {
    margin: 12px 0 10px 0;
}

.progress-text {
    color: #666;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: clamp(0.9em, 2vw, 1.1em);
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
}

.reset-button,
.archive-button {
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: clamp(0.9em, 2vw, 1em);
    font-weight: bold;
    transition: all 0.3s ease;
    margin: 5px;
}

.reset-button {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.3);
}

.reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(238, 90, 36, 0.4);
}

.archive-button {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    box-shadow: 0 4px 15px rgba(68, 160, 141, 0.3);
}

.archive-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(68, 160, 141, 0.4);
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.voting-container {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.voting-header {
    font-size: clamp(0.95em, 2vw, 1.1em);
    color: #333;
    margin-bottom: 12px;
    font-weight: bold;
}

.voting-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.vote-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: clamp(0.9em, 2vw, 1em);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: 140px;
    justify-content: center;
}

.vote-like {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

.vote-like:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.vote-bad {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
}

.vote-bad:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(238, 90, 36, 0.4);
}

.vote-emoji {
    font-size: 1.5em;
}

.voting-result {
    padding: 12px;
    background: white;
    border-radius: 10px;
    font-size: clamp(0.9em, 2vw, 1em);
    color: #333;
    font-weight: 500;
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
}

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

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    color: white;
    border: 3px solid white;
    padding: 15px 35px;
    border-radius: 50px;
    font-size: clamp(1em, 2.5vw, 1.2em);
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}

.play-button:hover {
    background: rgba(255,255,255,0.95);
    color: #333;
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 12px 35px rgba(0,0,0,0.6);
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.archive-item {
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.archive-item:hover {
    background-color: #f8f9fa;
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.footer {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}

.social-links a img {
    width: 40px;
    height: 40px;
    transition: transform 0.3s ease;
}

.social-links a:hover img {
    transform: scale(1.15);
}

.footer-text {
    font-size: clamp(0.8em, 1.5vw, 0.9em);
    opacity: 0.9;
    margin: 0;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    body {
        padding: 5px;
        justify-content: center;
    }
    
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 3px;
    }
    
    .date-display {
        font-size: 0.9em;
        margin-bottom: 8px;
    }
    
    .card-area {
        max-width: min(95vw, 85vh);
        border-radius: 12px;
    }
    
    #scratchCanvas {
        border-radius: 12px;
    }
    
    .voting-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .vote-button {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .reset-button,
    .archive-button {
        padding: 10px 20px;
        font-size: 0.95em;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
}

/* Responsive - Très petits écrans */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    .card-area {
        border-radius: 10px;
    }
    
    .voting-container {
        padding: 12px;
    }
    
    .footer {
        padding: 12px;
    }
    
    .social-links a img {
        width: 35px;
        height: 35px;
    }
}

/* Responsive - Desktop grand écran */
@media (min-width: 1200px) {
    body {
        padding: 30px 10px;
    }
    
    .card-area {
        max-width: 1024px;
    }
}

/* Optimisation pour tablettes en paysage */
@media (orientation: landscape) and (max-height: 700px) {
    body {
        padding: 5px;
        justify-content: flex-start;
    }
    
    .container {
        padding: 8px;
        margin: 0 auto;
    }
    
    h1 {
        font-size: 1.3em;
        margin-bottom: 2px;
    }
    
    .date-display {
        font-size: 0.85em;
        margin-bottom: 5px;
    }
    
    .card-area {
        max-width: min(60vw, 80vh);
    }
    
    .progress-section {
        margin: 8px 0 6px 0;
    }
    
    .voting-container {
        margin-top: 10px;
        padding: 10px;
    }
}

.loading-state p {
    animation: pulse 1.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Le fond reste noir, pas de changement nécessaire */
}