/* Sopa de Letras – game-specific styles */

/* ===== COLOR PALETTE (10 pastel word-highlight colors) ===== */
:root {
    --ws-color-0: #FFB3BA;
    --ws-color-1: #FFDFBA;
    --ws-color-2: #FFFFBA;
    --ws-color-3: #BAFFC9;
    --ws-color-4: #BAE1FF;
    --ws-color-5: #D4BAFF;
    --ws-color-6: #FFB3F7;
    --ws-color-7: #B3FFF0;
    --ws-color-8: #FFD9B3;
    --ws-color-9: #C9FFB3;
}

/* ===== UTILITY ===== */
.ws-screen { display: none !important; }

/* ===== START SCREEN ===== */
.ws-start-inner {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

.ws-section-label {
    font-weight: bold;
    margin: 16px 0 8px;
    color: #444;
}

#ws-theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.ws-theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    font-size: 0.78rem;
    transition: border-color 0.15s, background 0.15s;
}

.ws-theme-card:hover { border-color: #4a90e2; }
.ws-theme-card.active { border-color: #4a90e2; background: #e8f0fe; }

.ws-theme-icon { font-size: 1.8rem; line-height: 1; }

#ws-difficulty-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.ws-diff-btn {
    flex: 1;
    padding: 9px 6px;
    border-radius: 8px;
    border: 2px solid #ddd;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
}

.ws-diff-btn:hover { border-color: #4a90e2; }
.ws-diff-btn.active { border-color: #4a90e2; background: #e8f0fe; }

#ws-play-btn {
    display: block;
    width: 100%;
    padding: 13px;
    background: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
}
#ws-play-btn:hover { background: #357abd; }

/* ===== GAME SCREEN ===== */
.ws-game-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 8px;
}

/* ===== GRID ===== */
#ws-grid {
    display: grid;
    grid-template-columns: repeat(var(--ws-cols, 10), 1fr);
    gap: 2px;
    flex: 0 0 auto;
    width: min(55vw, 420px);
    aspect-ratio: 1;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 6px;
    overflow: hidden;
}

.ws-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    min-width: 28px;
    min-height: 28px;
    font-weight: bold;
    font-size: clamp(0.5rem, 2vw, 1rem);
    color: #1a1a1a;
    cursor: pointer;
    border-radius: 3px;
    background: #f5f5f5;
    transition: background 0.12s;
}

.ws-cell.selected { background: #aad4f5; }

/* Found colors */
.ws-cell.found.color-0 { background: var(--ws-color-0); color: #1a1a1a; }
.ws-cell.found.color-1 { background: var(--ws-color-1); color: #1a1a1a; }
.ws-cell.found.color-2 { background: var(--ws-color-2); color: #1a1a1a; }
.ws-cell.found.color-3 { background: var(--ws-color-3); color: #1a1a1a; }
.ws-cell.found.color-4 { background: var(--ws-color-4); color: #1a1a1a; }
.ws-cell.found.color-5 { background: var(--ws-color-5); color: #1a1a1a; }
.ws-cell.found.color-6 { background: var(--ws-color-6); color: #1a1a1a; }
.ws-cell.found.color-7 { background: var(--ws-color-7); color: #1a1a1a; }
.ws-cell.found.color-8 { background: var(--ws-color-8); color: #1a1a1a; }
.ws-cell.found.color-9 { background: var(--ws-color-9); color: #1a1a1a; }

/* Shake animation on invalid selection */
@keyframes ws-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.ws-cell.shake { animation: ws-shake 0.35s ease; }

/* Hint flash animation — resalta con fondo naranja vivo, sin tocar la opacidad */
@keyframes ws-hint-flash {
    0%, 100% { background: #f5f5f5; color: #1a1a1a; }
    40%, 60% { background: #FF9800; color: #fff; }
}
.ws-cell.hint {
    animation: ws-hint-flash 0.6s ease 4;
    animation-fill-mode: backwards;
}

/* ===== SIDEBAR ===== */
.ws-sidebar {
    flex: 1 1 0;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ws-hud {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.95rem;
    color: #333;
}

#ws-timer {
    font-size: 1.4rem;
    font-weight: bold;
    color: #4a90e2;
    letter-spacing: 0.05em;
}

#ws-progress { color: #555; }

#ws-hint-btn {
    padding: 7px 10px;
    border-radius: 7px;
    border: 2px solid #ddd;
    cursor: pointer;
    background: #fff;
    font-size: 0.85rem;
    font-weight: bold;
    transition: border-color 0.15s, background 0.15s;
}
#ws-hint-btn:hover:not(:disabled) { border-color: #f5a623; background: #fff8ee; }
#ws-hint-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===== WORD LIST ===== */
#ws-word-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#ws-word-list li {
    padding: 5px 9px;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a1a1a;
    background: #f0f0f0;
    border: 1px solid transparent;
    transition: background 0.15s;
}

#ws-word-list li.color-0 { background: var(--ws-color-0); }
#ws-word-list li.color-1 { background: var(--ws-color-1); }
#ws-word-list li.color-2 { background: var(--ws-color-2); }
#ws-word-list li.color-3 { background: var(--ws-color-3); }
#ws-word-list li.color-4 { background: var(--ws-color-4); }
#ws-word-list li.color-5 { background: var(--ws-color-5); }
#ws-word-list li.color-6 { background: var(--ws-color-6); }
#ws-word-list li.color-7 { background: var(--ws-color-7); }
#ws-word-list li.color-8 { background: var(--ws-color-8); }
#ws-word-list li.color-9 { background: var(--ws-color-9); }

#ws-word-list li.found {
    text-decoration: line-through;
    opacity: 0.65;
}

/* ===== WIN SCREEN ===== */
#ws-win-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px 20px;
    text-align: center;
}

.ws-final-time {
    font-size: 2.6rem;
    font-weight: bold;
    color: #4a90e2;
    letter-spacing: 0.05em;
}

.ws-win-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 280px;
}

.ws-btn-play {
    padding: 11px 16px;
    border-radius: 8px;
    border: none;
    background: #4a90e2;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
}
.ws-btn-play:hover { background: #357abd; }

.ws-btn-change {
    padding: 11px 16px;
    border-radius: 8px;
    border: 2px solid #ccc;
    background: #f7f7f7;
    color: #333;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
}
.ws-btn-change:hover { background: #ececec; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .ws-game-layout {
        flex-direction: column;
        align-items: center;
    }
    #ws-grid {
        width: min(92vw, 420px);
    }
    .ws-sidebar {
        width: 100%;
    }
    #ws-word-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
