/* ── Word Factory — Magenta Theme ── */
:root {
    --wf-accent: #D946EF;
    --wf-accent-light: #F0ABFC;
    --wf-accent-dark: #86198F;
    --wf-bg: #1A0820;
    --wf-surface: #2A1234;
    --wf-surface-light: #3A1A48;
    --wf-text: #FAE8FF;
    --wf-text-dim: #C4A1D4;
    --wf-border: #4C2358;
    --wf-success: #34D399;
    --wf-gold: #FACC15;
    --wf-danger: #F87171;
    --wf-glow: rgba(240, 171, 252, 0.5);
}

.wf-layout {
    display: flex; justify-content: center; gap: 20px;
    max-width: 1200px; margin: 0 auto; padding: 20px;
    min-height: calc(100vh - 80px);
}
.ad-slot { width: 160px; flex-shrink: 0; }
.ad-slot--left, .ad-slot--right { display: flex; align-items: flex-start; }
.ad-placeholder--vertical {
    width: 160px; height: 600px;
    background: var(--wf-surface);
    border: 1px dashed var(--wf-text-dim);
    display: flex; align-items: center; justify-content: center;
    color: var(--wf-text-dim); font-size: 12px; border-radius: 8px;
}
#wordfactory-app { flex: 1; max-width: 760px; min-width: 320px; color: var(--wf-text); }

.screen { display: none; }
.screen.active { display: block; animation: wfFade 0.3s ease; }
@keyframes wfFade { from {opacity:0;transform:translateY(8px);} to {opacity:1;transform:translateY(0);} }

.wf-header { text-align: center; padding: 36px 0 24px; }
.wf-logo {
    display: inline-flex; gap: 4px;
    background: var(--wf-surface);
    padding: 8px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid var(--wf-border);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 1.6rem;
}
.wf-logo span {
    color: var(--wf-accent-light);
    text-shadow: 0 0 12px var(--wf-glow);
    animation: wfBlink 2s ease-in-out infinite;
}
.wf-logo span:nth-child(2) { animation-delay: 0.2s; }
.wf-logo span:nth-child(3) { animation-delay: 0.4s; }
.wf-logo span:nth-child(4) { animation-delay: 0.6s; }
@keyframes wfBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.wf-header h1 {
    font-family: 'Syne', sans-serif;
    font-size: 2.6rem; font-weight: 800;
    color: var(--wf-accent-light);
    letter-spacing: 4px; margin: 0;
    text-shadow: 0 0 26px var(--wf-glow);
}
.subtitle { color: var(--wf-text-dim); font-size: 1rem; margin-top: 8px; }

.card {
    background: var(--wf-surface);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--wf-border);
}
.card__title {
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--wf-accent-light);
    margin-bottom: 14px;
}

.difficulty-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.diff-btn {
    background: var(--wf-surface-light);
    border: 1.5px solid transparent;
    color: var(--wf-text);
    padding: 14px 8px;
    border-radius: 10px;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
}
.diff-btn:hover { transform: translateY(-2px); border-color: var(--wf-accent); }
.diff-btn.selected {
    background: linear-gradient(135deg, var(--wf-accent-dark), var(--wf-accent));
    border-color: var(--wf-accent-light);
    box-shadow: 0 0 16px rgba(217, 70, 239, 0.45);
}
.diff-icon { font-size: 1rem; font-weight: 700; color: var(--wf-accent-light); }
.diff-btn.selected .diff-icon { color: #fff; }
.diff-desc { font-size: 0.72rem; color: var(--wf-text-dim); font-family: 'JetBrains Mono', monospace; }
.diff-btn.selected .diff-desc { color: rgba(255,255,255,0.85); }

.wf-rules {
    margin: 0; padding-left: 1.1rem;
    color: var(--wf-text-dim);
    font-size: 0.92rem; line-height: 1.6;
}
.wf-rules li + li { margin-top: 6px; }

.btn {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    border-radius: 10px; border: none;
    cursor: pointer;
    padding: 12px 22px;
    transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
    font-size: 0.95rem;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
    background: linear-gradient(135deg, var(--wf-accent), var(--wf-accent-light));
    color: #fff;
    box-shadow: 0 6px 18px rgba(217, 70, 239, 0.35);
}
.btn--primary:hover { box-shadow: 0 10px 24px rgba(217, 70, 239, 0.5); }
.btn--outline {
    background: transparent;
    border: 1.5px solid var(--wf-accent);
    color: var(--wf-accent-light);
}
.btn--outline:hover { background: rgba(217, 70, 239, 0.12); }
.btn--ghost { background: transparent; color: var(--wf-text-dim); }
.btn--ghost:hover { color: var(--wf-accent-light); }
.btn--lg { padding: 16px 36px; font-size: 1.05rem; }
.btn--sm { padding: 8px 14px; font-size: 0.85rem; }

.menu-actions {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; margin-top: 18px;
}

#game-hud {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    background: var(--wf-surface); padding: 14px;
    border-radius: 12px; border: 1px solid var(--wf-border);
    margin-bottom: 18px;
}
.hud__cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud__label {
    font-size: 0.7rem; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--wf-text-dim);
}
.hud__value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem; font-weight: 700;
    color: var(--wf-accent-light);
}
.hud__timer { color: var(--wf-gold); }

.wf-stage {
    display: flex; flex-direction: column;
    gap: 14px;
}

.wf-input-area {
    background: var(--wf-surface);
    border-radius: 12px;
    border: 1px solid var(--wf-border);
    padding: 16px;
}
#wf-current {
    min-height: 56px;
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center; align-items: center;
    background: var(--wf-bg);
    border: 1.5px dashed var(--wf-border);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
}
.wf-cur-tile {
    background: var(--wf-accent-dark);
    color: #fff;
    width: 36px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.4rem;
    border: 1px solid var(--wf-accent);
}
.wf-cur-empty {
    color: var(--wf-text-dim);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}
.wf-input-actions {
    display: flex; gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

#wf-letters {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    max-width: 480px;
    margin: 0 auto;
}
.wf-tile {
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--wf-surface-light), var(--wf-surface));
    border: 1.5px solid var(--wf-border);
    color: var(--wf-text);
    border-radius: 12px;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.6rem;
    transition: transform 0.12s, background 0.15s, border-color 0.15s;
    user-select: none;
    position: relative;
}
.wf-tile:hover { transform: translateY(-2px); border-color: var(--wf-accent); }
.wf-tile.used { opacity: 0.3; cursor: not-allowed; transform: none; }
.wf-tile .pts {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.6rem;
    color: var(--wf-text-dim);
    margin-top: 4px;
}

.wf-feedback {
    text-align: center;
    min-height: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 600;
}
.wf-feedback.ok { color: var(--wf-success); }
.wf-feedback.bad { color: var(--wf-danger); }

.wf-words {
    background: var(--wf-surface);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--wf-border);
    min-height: 60px;
}
.wf-words__title {
    font-family: 'Syne', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.78rem;
    color: var(--wf-accent-light);
    margin-bottom: 10px;
}
#wf-word-list {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.word-chip {
    background: var(--wf-surface-light);
    border: 1px solid var(--wf-border);
    color: var(--wf-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}
.word-chip .score {
    color: var(--wf-gold);
    margin-left: 6px;
    font-size: 0.75rem;
}

.wf-actions { display: flex; justify-content: center; margin-top: 16px; }

.result-card, .lb-card {
    background: var(--wf-surface);
    border-radius: 16px;
    padding: 36px 28px;
    border: 1px solid var(--wf-border);
    text-align: center;
    max-width: 480px;
    margin: 40px auto;
    box-shadow: 0 18px 36px rgba(0,0,0,0.4);
}
.result-card h2 {
    font-family: 'Syne', sans-serif;
    font-size: 2rem;
    color: var(--wf-accent-light);
    letter-spacing: 4px;
    margin: 0 0 12px;
    text-shadow: 0 0 24px var(--wf-glow);
}
.result-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3rem; font-weight: 700;
    color: var(--wf-gold);
    margin: 8px 0;
}
.result-detail {
    color: var(--wf-text-dim);
    font-size: 0.95rem; line-height: 1.6;
    margin-bottom: 18px;
}
#nickname {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--wf-bg);
    color: var(--wf-text);
    border: 1.5px solid var(--wf-border);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    margin-bottom: 12px;
    box-sizing: border-box;
}
#nickname:focus { outline: none; border-color: var(--wf-accent); }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }

.lb-card h2 {
    font-family: 'Syne', sans-serif;
    color: var(--wf-accent-light);
    letter-spacing: 4px;
    margin-bottom: 18px;
    text-shadow: 0 0 24px var(--wf-glow);
}
#leaderboard-list { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; counter-reset: lb; }
#leaderboard-list li {
    counter-increment: lb;
    display: flex; justify-content: space-between;
    padding: 10px 14px;
    background: var(--wf-bg);
    margin-bottom: 6px;
    border-radius: 8px;
    border: 1px solid var(--wf-border);
    font-family: 'DM Sans', sans-serif;
}
#leaderboard-list li::before {
    content: counter(lb);
    color: var(--wf-accent-light);
    font-weight: 700;
    margin-right: 10px;
    min-width: 24px;
}
#leaderboard-list li:nth-child(1) { border-color: var(--wf-gold); }
#leaderboard-list li:nth-child(1)::before { color: var(--wf-gold); }
#leaderboard-list .lb-score {
    font-family: 'JetBrains Mono', monospace;
    color: var(--wf-accent-light);
    font-weight: 600;
}

@media (max-width: 900px) {
    .wf-layout { flex-direction: column; padding: 12px; }
    .ad-slot { width: 100%; }
    .ad-placeholder--vertical { width: 100%; height: 90px; }
    .difficulty-grid { grid-template-columns: repeat(2, 1fr); }
    .wf-header h1 { font-size: 2rem; letter-spacing: 2px; }
    .wf-tile { font-size: 1.3rem; }
}
