/* ============================================
   Wni Mots en Pagaille - Feuille de styles
   Inspirée du design Pulse Pattern
   ============================================ */

#game-main {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100dvh;
    padding: 10px 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

#game-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 15px;
    gap: 8px;
}

/* --- En-tête --- */
#game-header {
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

#game-title {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #7b2ff7, #ff6fd8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.theme-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #7b2ff7, #ff6fd8);
    color: #fff;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(123, 47, 247, 0.3);
    min-height: 26px;
    line-height: 1.2;
}

.theme-badge:empty {
    display: none;
}

/* --- Barre d'informations --- */
#info-bar {
    width: 100%;
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 6px 10px;
    flex-shrink: 0;
}

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

.info-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

#score-value {
    color: #00d2ff;
}

#best-score-value {
    color: #ff6fd8;
}

#timer-value {
    color: #00e676;
}

#progress-value {
    color: #ff9800;
}

/* --- Message d'état --- */
#message-container {
    width: 100%;
    text-align: center;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#game-message {
    font-size: 0.9rem;
    font-weight: 500;
    color: #b0b0ff;
    transition: opacity 0.3s ease;
}

/* --- Grille de jeu --- */
#grid-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

#gridCanvas {
    touch-action: none;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    max-width: 100%;
}

/* --- Boutons de contrôle --- */
#controls-container {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}

.game-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    min-height: 44px;
    min-width: 70px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    touch-action: manipulation;
}

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

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

.btn-play { background: linear-gradient(135deg, #00d2ff, #7b2ff7); }
.btn-stop { background: linear-gradient(135deg, #ff5252, #d50000); }
.btn-gomme { background: linear-gradient(135deg, #7b2ff7, #ff6fd8); }
.btn-rules { background: linear-gradient(135deg, #2d4059, #3d5a73); }
.btn-scores { background: linear-gradient(135deg, #00c853, #009624); }
.btn-close { background: linear-gradient(135deg, #555, #777); }

/* --- Liste des mots --- */
#word-list-panel {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px 12px;
    flex-shrink: 0;
}

#word-list-panel h2 {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    text-align: center;
}

#wordList {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

#wordList li {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ccc;
    transition: all 0.3s;
    letter-spacing: 1px;
}

#wordList li.found {
    background: linear-gradient(135deg, #00c853, #00e676);
    color: #fff;
    text-decoration: line-through;
    opacity: 0.8;
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a1a3e, #2a2a5e);
    border: 2px solid rgba(123, 47, 247, 0.4);
    border-radius: 16px;
    padding: 20px;
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}

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

.modal-title {
    color: #00d2ff;
    margin-bottom: 12px;
    font-size: 1.2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-body {
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.6;
}

.modal-body ul {
    padding-left: 20px;
    margin: 8px 0;
}

.modal-body li {
    margin-bottom: 4px;
}

.modal-body p {
    margin-bottom: 8px;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* Scores */
.scores-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.scores-table th {
    color: #00d2ff;
    padding: 6px 4px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.scores-table td {
    padding: 6px 4px;
    border-bottom: 1px solid #222;
    color: #ccc;
}

.scores-table tr:first-child td {
    color: #ffd700;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 360px) {
    #game-title {
        font-size: 1.15rem;
    }
    .info-value {
        font-size: 0.85rem;
    }
    .game-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        min-width: 60px;
    }
}
