
/* ── Zones de tuiles ─────────────────────────────────────────────────────── */

#tiles-board {
    text-align: center;
    padding: 8px 0;
}

.tiles-zone-label {
    font-size: 0.72rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 10px 0 4px;
}

.tiles-zone {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
    min-height: 68px;
    padding: 8px 12px;
    border-radius: 8px;
}

.tiles-answer-zone {
    background: #fafafa;
    border: 1px dashed #ddd;
    min-width: 100px;
}

/* ── Tuile individuelle ──────────────────────────────────────────────────── */

.scrabble-tile {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 58px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
    cursor: grab;
    user-select: none;
    position: relative;
    touch-action: none;
    transition: transform 0.12s, box-shadow 0.12s;
}

.scrabble-tile:active {
    cursor: grabbing;
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.13);
}

.scrabble-tile.correct {
    background: #f2fbf2;
    border-color: #5cb85c;
    box-shadow: 0 2px 8px rgba(92,184,92,0.2);
}

.scrabble-tile.wrong {
    animation: tile-shake 0.35s ease-in-out;
}

@keyframes tile-shake {
    0%, 100% { transform: translateX(0); }
    25%  { transform: translateX(-5px); }
    75%  { transform: translateX(5px); }
}

.tile-letter {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: #333;
    font-family: 'Open Sans', Arial, sans-serif;
}

.tile-value {
    font-size: 0.58rem;
    font-weight: 700;
    color: #f07c00;
    position: absolute;
    bottom: 4px;
    right: 5px;
}

/* ── Tuiles solution ─────────────────────────────────────────────────────── */

.solution-row {
    margin: 4px 0;
}

.solution-tile {
    cursor: default;
    box-shadow: none;
    opacity: 0.75;
}

.solution-tile:active {
    transform: none;
    box-shadow: none;
}

.solution-hyphen {
    display: flex;
    align-items: center;
    color: #bbb;
    font-size: 1.1rem;
    margin: 0 3px;
    user-select: none;
}

/* ── Score Scrabble ──────────────────────────────────────────────────────── */

#scrabble-score {
    font-size: 0.9rem;
    color: #666;
    margin: 8px 0 2px;
    min-height: 22px;
}

/* ── Input clavier (interface secondaire) ────────────────────────────────── */

#guess_input {
    display: block;
    margin: 4px auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 0.85rem;
    text-align: center;
    width: auto;
    max-width: 280px;
    color: #aaa;
    background: #fafafa;
    letter-spacing: 0.05em;
}

#guess_input:focus {
    outline: none;
    border-color: #aaa;
    color: #444;
}

#guess_input::placeholder {
    color: #ccc;
    font-size: 0.85rem;
}

/* ── Éléments existants conservés ────────────────────────────────────────── */

#solutions {
    display: none;
    margin: auto;
    width: min-content;
}

#score_main {
    padding: 20px;
    font-size: 1.5em;
    font-weight: bold;
}

#play_container {
    padding: 30px;
    text-align: center;
}

#play_container h3 {
    padding: 0;
}

/* ── Timer ───────────────────────────────────────────────────────────────── */

#timer-zone {
    text-align: center;
}

#timer-bar-wrap {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 4px;
    max-width: 400px;
}

#timer-bar {
    height: 100%;
    background: #4caf50;
    border-radius: 4px;
    transition: width 1s linear, background-color 0.5s;
}

#timer-bar.warn {
    background: #ff9800;
}

#timer-bar.danger {
    background: #f44336;
}

#timer-label {
    font-size: 1.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #333;
    display: block;
    line-height: 1.2;
}

/* ── Meilleur score ──────────────────────────────────────────────────────── */

#best-score-display {
    font-size: 0.7em;
    font-weight: 400;
    color: #999;
}

/* ── Overlay game over ───────────────────────────────────────────────────── */

#game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#game-over-box {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 380px;
}

#game-over-box h2 {
    margin-bottom: 1rem;
}

#go-replay {
    background: #f07c00;
    border-color: #f07c00;
    color: #fff;
}

#go-replay:hover {
    background: #d46a00;
    border-color: #d46a00;
    color: #fff;
}

#go-close {
    background: #333;
    border-color: #333;
    color: #fff;
}

#go-close:hover {
    background: #111;
    border-color: #111;
    color: #fff;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .scrabble-tile {
        width: 46px;
        height: 52px;
    }
    .tile-letter {
        font-size: 1.4rem;
    }
    #timer-label {
        font-size: 1.4rem;
    }
    #game-over-box {
        padding: 1.5rem;
    }
}

/* ── Widget tile-input (page de recherche) ───────────────────────────────── */

.search-tiles-board {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 60px;
    background: #fff;
    cursor: text;
    max-width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.search-tiles-board:focus-within {
    border-color: #80bdff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.15);
}

.search-tiles-zone {
    flex-wrap: wrap;
    min-height: 0;
    padding: 0;
    gap: 5px;
    border: none;
    background: transparent;
    justify-content: flex-start;
}

.search-tile {
    cursor: default;
}

.search-tile:active {
    transform: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.search-tiles-text {
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
    font-size: 0.85rem;
    width: 2px;
    min-width: 2px;
    flex: 0 0 2px;
    padding: 0;
    color: transparent;
    caret-color: transparent;
    align-self: center;
}

.search-tiles-text:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.tile-remove {
    position: absolute;
    top: 1px;
    left: 4px;
    font-size: 0.7rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0;
    line-height: 1;
    color: #e74c3c;
    transition: opacity 0.15s;
    min-width: 22px;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-tile:hover .tile-remove {
    opacity: 0.85;
}

/* Tuile caractère non-lettre (espace, tiret, chiffre…) */
.search-tile-special {
    background: #f4f4f4;
    border-color: #ddd;
    box-shadow: none;
}

.search-tile-special .tile-letter {
    color: #aaa;
    font-size: 1.2rem;
}

/* Curseur visuel entre les tuiles */
.tile-cursor {
    display: none;
    width: 2px;
    height: 36px;
    background: #555;
    border-radius: 1px;
    align-self: center;
    flex-shrink: 0;
    animation: tile-cursor-blink 1s step-end infinite;
}

.search-tiles-board:focus-within .tile-cursor {
    display: inline-flex;
}

@keyframes tile-cursor-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

@media (hover: none) {
    .tile-remove {
        opacity: 0.5;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .search-tiles-board {
        padding: 6px 8px;
        min-height: 52px;
    }
}

/* ── Page thème : ligne de micro-stats sous le H1 ────────────────────────── */

.theme-meta-ligne {
    font-size: 0.9rem;
    color: #666;
    margin: 4px 0 10px;
    line-height: 1.5;
}

.theme-meta-ligne strong {
    color: #2c3e50;
    font-weight: 600;
}

.theme-meta-ligne a {
    color: #2c3e50;
    border-bottom: 1px dashed #bbb;
    text-decoration: none;
}

.theme-meta-ligne a:hover {
    color: #007bff;
    border-bottom-color: #007bff;
}

/* ── Titres de section uniformes ─────────────────────────────────────────── */

.theme-section-titre {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 14px;
}

/* ── Top 10 hero : cartes aux couleurs de la catégorie ───────────────────── */

.theme-top-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: box-shadow 0.15s, transform 0.15s;
}

.theme-top-card:hover {
    text-decoration: none;
    color: inherit;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.theme-top-card-icone {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.theme-top-card-icone svg {
    width: 18px;
    height: 18px;
}

.theme-top-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.theme-top-card-mot {
    font-size: 1.05rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.2;
}

.theme-top-card-meta {
    font-size: 0.78rem;
    color: #888;
    margin-top: 1px;
}

.theme-top-card-revele {
    font-size: 0.82rem;
    color: #555;
    font-style: italic;
    margin-top: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Zone Explorer (navigation : index A-Z + autres catégories) ──────────── */

.theme-explorer {
    margin-top: 32px;
    padding: 22px 18px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eef0f2;
}

.theme-explorer .theme-section-titre {
    font-size: 1.05rem;
    color: #4a5563;
    margin-bottom: 12px;
}

/* ── Index alphabétique compact (zone Explorer) ──────────────────────────── */

.theme-index-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.theme-index-puce {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 4px 6px;
    background: #fff;
    border: 1px solid #dde1e5;
    border-radius: 5px;
    text-decoration: none;
    color: #2c3e50;
    line-height: 1;
    transition: border-color 0.15s, background 0.15s;
}

.theme-index-puce:hover {
    text-decoration: none;
    background: var(--theme-bg, #f0f4ff);
    border-color: var(--theme-color, #007bff);
    color: var(--theme-color, #007bff);
}

.theme-index-puce.is-empty {
    color: #c0c4c8;
    background: transparent;
    border-color: #ececec;
    cursor: default;
}

.theme-index-puce.is-active {
    border-color: var(--theme-color, #adb5bd);
    background: var(--theme-bg, #f0f2f4);
    color: var(--theme-color, #2c3e50);
    font-weight: 700;
    cursor: default;
}

.theme-index-lettre {
    font-size: 0.95rem;
    font-weight: 600;
}

.theme-index-n {
    font-size: 0.65rem;
    color: #888;
    margin-top: 2px;
}

/* ── Échantillon aléatoire ───────────────────────────────────────────────── */

.theme-echantillon-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.theme-echantillon-entete .theme-section-titre {
    margin-bottom: 0;
}

.theme-echantillon-refresh {
    background: none;
    border: 1px solid var(--theme-color, #007bff);
    color: var(--theme-color, #007bff);
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}

.theme-echantillon-refresh:hover {
    background: var(--theme-bg, #f0f4ff);
}

.theme-echantillon-refresh:disabled {
    opacity: 0.5;
    cursor: wait;
}

#theme-echantillon {
    transition: opacity 0.2s;
}
