/* ═══════════════════════════════════════════════════════════════
   STYLE.CSS - Wordle Español
   ═══════════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #ffffff;
    --bg-secondary: #f5f5f7;
    --text: #1a1a1a;
    --text-dim: #6b7280;
    --border: #d1d5db;
    --accent: #3b82f6;
    --correct: #16a34a;
    --present: #eab308;
    --absent: #9ca3af;
    --cell-bg: #ffffff;
    --key-bg: #e5e7eb;
    --key-text: #1a1a1a;
}

[data-theme="dark"] {
    --bg: #121213;
    --bg-secondary: #1a1a1b;
    --text: #ffffff;
    --text-dim: #818388;
    --border: #3a3a3c;
    --accent: #3b82f6;
    --correct: #538d4e;
    --present: #b59f3b;
    --absent: #3a3a3c;
    --cell-bg: #121213;
    --key-bg: #818388;
    --key-text: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s;
}

/* HEADER */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo span { color: var(--accent); }

.header-actions { display: flex; gap: 8px; }

.icon-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s;
}

.icon-btn:hover { background: var(--border); }

/* TABS */
.tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.tab:hover { background: var(--border); color: var(--text); }

.tab.active {
    background: var(--accent);
    color: #fff;
}

/* MAIN */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* HERO (Home) */
.hero {
    width: 100%;
    text-align: center;
}

.hero h1 {
    font-size: 32px;
    margin-bottom: 24px;
    line-height: 1.2;
}

.hero h1 small {
    display: block;
    color: var(--text-dim);
    font-size: 16px;
    font-weight: 400;
    margin-top: 8px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

.mode-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 20px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
    text-align: left;
}

.mode-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.mode-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.mode-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.mode-card p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.4;
}

/* GAME */
.game-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.mode-title {
    font-size: 20px;
    font-weight: 700;
}

.game-meta {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

/* BOARD */
.board {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 20px 0;
}

.board-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.cell {
    width: 56px;
    height: 56px;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--cell-bg);
    color: var(--text);
    user-select: none;
    transition: transform 0.1s;
}

.cell.filled {
    border-color: var(--text-dim);
    transform: scale(1.05);
}

.cell.revealed {
    color: #fff;
    border-color: transparent;
}

.cell.correct { background: var(--correct); }
.cell.present { background: var(--present); }
.cell.absent { background: var(--absent); }

.cell.flip {
    animation: flip 0.5s ease;
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

.board-row.shake {
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* KEYBOARD */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 500px;
    user-select: none;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.key {
    flex: 1;
    min-width: 28px;
    height: 52px;
    background: var(--key-bg);
    color: var(--key-text);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.key:hover { filter: brightness(1.1); }

.key.wide {
    flex: 1.5;
    font-size: 12px;
}

.key.correct { background: var(--correct); color: #fff; }
.key.present { background: var(--present); color: #fff; }
.key.absent { background: var(--absent); color: #fff; }

/* TOAST */
#toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#toast.show {
    opacity: 1;
}

.game-disabled {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 16px;
}

/* ADS */
.ad-slot {
    width: 100%;
    max-width: 728px;
    margin: 16px auto;
    padding: 8px;
    text-align: center;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .cell {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    .key {
        height: 48px;
        font-size: 13px;
    }
    .hero h1 { font-size: 24px; }
    .mode-grid {
        grid-template-columns: 1fr;
    }
}

/* SEO CONTENT */
.seo-content {
    max-width: 600px;
    margin: 0 auto 30px;
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 15px;
}

.seo-section {
    max-width: 700px;
    margin: 40px auto 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.seo-section h2 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-size: 20px;
    color: var(--text);
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.seo-box {
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
}

.seo-box h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.seo-box p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.4;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-list details {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
}

.faq-list summary {
    font-weight: 600;
    outline: none;
    list-style: none;
}

.faq-list summary::-webkit-details-marker {
    display: none;
}

.faq-list summary::before {
    content: '▶ ';
    font-size: 10px;
    margin-right: 8px;
    display: inline-block;
    transition: transform 0.2s;
}

.faq-list details[open] summary::before {
    transform: rotate(90deg);
}

.faq-list details p {
    margin-top: 10px;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
}

.site-footer {
    margin-top: 40px;
    padding: 30px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.site-footer p {
    margin: 4px 0;
}

/* Logo dinámico */
.logo-link {
    text-decoration: none;
    color: inherit;
}

.site-logo {
    max-height: 40px;
    width: auto;
    display: block;
}

/* SEO Content */
.seo-content {
    max-width: 600px;
    margin: 0 auto 30px;
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 15px;
}

.seo-section {
    max-width: 700px;
    margin: 40px auto 0;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.seo-section h2 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-size: 20px;
    color: var(--text);
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.seo-box {
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
}

.seo-box h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.seo-box p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.4;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-list details {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
}

.faq-list summary {
    font-weight: 600;
    outline: none;
    list-style: none;
}

.faq-list summary::-webkit-details-marker {
    display: none;
}

.faq-list summary::before {
    content: '▶ ';
    font-size: 10px;
    margin-right: 8px;
    display: inline-block;
    transition: transform 0.2s;
}

.faq-list details[open] summary::before {
    transform: rotate(90deg);
}

.faq-list details p {
    margin-top: 10px;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
}

.site-footer {
    margin-top: 40px;
    padding: 30px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.site-footer p {
    margin: 4px 0;
}