* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.container {
    max-width: 900px;
    width: 100%;
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: clamp(20px, 5vw, 28px);
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: clamp(13px, 3vw, 15px);
    line-height: 1.6;
    padding: 0 10px;
}

.grille-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 20px 0;
    padding: 10px 0;
    display: flex;
    justify-content: center;
}

.grille {
    display: grid;
    grid-template-columns: repeat(10, 48px);
    gap: 3px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 15px;
    width: fit-content;
}

.case {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: bold;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.case:hover {
    transform: scale(1.05);
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.case:active {
    transform: scale(0.95);
}

.case.barre {
    background-color: #e8e8e8;
    color: #999;
    text-decoration: line-through;
    border-color: #ccc;
}

.case.message {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: white;
    border-color: #ff8c00;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

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

    50% {
        transform: scale(1.05);
    }
}

.controls {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

button {
    padding: 12px 24px;
    font-size: clamp(14px, 3vw, 15px);
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: #ef4444;
    color: white;
}

button:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.overlay.show {
    display: flex;
}

.popup {
    position: relative;
    text-align: center;
    padding: 40px 50px;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: popIn 0.4s ease-out;
    max-width: 90vw;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    color: white;
    font-size: 22px;
    padding: 5px 10px;
    cursor: pointer;
}

.popup-close:hover {
    background: none;
    transform: none;
    opacity: 0.7;
}

.popup h2 {
    font-size: clamp(24px, 6vw, 36px);
    color: white;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.popup p {
    font-size: clamp(14px, 4vw, 18px);
    color: #fff;
    margin: 10px 0 0 0;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mots {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: #fff9e6;
    border-radius: 15px;
    border: 2px solid #ffc107;
}

.mots h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: clamp(16px, 4vw, 20px);
}

.mots p {
    color: #555;
    line-height: 1.8;
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 500;
}

.mot-trouve {
    text-decoration: line-through;
    color: #9e1212 !important;
}

.progress {
    text-align: center;
    margin: 15px 0;
    font-size: clamp(14px, 3vw, 16px);
    color: #666;
    font-weight: 600;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .grille-wrapper {
        margin: 15px -15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 12px;
        border-radius: 15px;
    }

    .grille-wrapper {
        margin: 10px -12px;
    }
}
