/* ── Wordle Page ── */
.wordle-section {
    max-width: 600px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
}

.wordle-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.wordle-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.wordle-header p {
    color: var(--gray);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.wordle-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--gray);
}

.legend-item { display: flex; align-items: center; gap: 0.4rem; }

.legend-box {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
}

.correct-bg { background: #538d4e; }
.present-bg { background: #b59f3b; }
.absent-bg  { background: #3a3a3c; }

/* ── Game ── */
.wordle-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

/* ── Board ── */
.wordle-board {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wordle-row {
    display: flex;
    gap: 6px;
}

.wordle-tile {
    width: 62px;
    height: 62px;
    border: 2px solid var(--light-pink);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    text-transform: uppercase;
    transition: border-color 0.1s;
    background: var(--white);
    user-select: none;
}

.wordle-tile.filled {
    border-color: var(--pink);
    animation: pop 0.1s ease;
}

.wordle-tile.flip {
    animation: flip 0.5s ease forwards;
}

.wordle-tile.correct {
    background: #538d4e;
    border-color: #538d4e;
    color: white;
}

.wordle-tile.present {
    background: #b59f3b;
    border-color: #b59f3b;
    color: white;
}

.wordle-tile.absent {
    background: #3a3a3c;
    border-color: #3a3a3c;
    color: white;
}

/* ── Message ── */
.wordle-message {
    min-height: 2rem;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: all 0.3s;
}

.wordle-message.success { background: #C6F6D5; color: #276749; }
.wordle-message.error   { background: #FED7D7; color: #C53030; }
.wordle-message.warning { background: #FEEBC8; color: #7B341E; }
.wordle-message.hint    { background: var(--light-yellow); color: var(--dark); }

/* ── Keyboard ── */
.wordle-keyboard {
    width: 100%;
    max-width: 500px;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
}

.kb-key {
    height: 56px;
    min-width: 40px;
    padding: 0 8px;
    border: none;
    border-radius: 8px;
    background: var(--light-pink);
    color: var(--dark);
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.kb-key.kb-wide { min-width: 64px; font-size: 0.75rem; }

.kb-key:hover { transform: scale(1.05); }
.kb-key:active { transform: scale(0.95); }

.kb-key.correct { background: #538d4e; color: white; }
.kb-key.present { background: #b59f3b; color: white; }
.kb-key.absent  { background: #3a3a3c; color: #888; }

/* ── Actions ── */
.wordle-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
}

.wordle-btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--pink) 0%, var(--yellow) 100%);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.wordle-btn.secondary {
    background: var(--light-pink);
    color: var(--dark);
}

.wordle-btn:hover { transform: scale(1.05); }

/* ── Stats ── */
.wordle-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-box {
    text-align: center;
    background: var(--white);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    min-width: 70px;
}

.stat-num {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--pink) 0%, var(--yellow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-lbl { font-size: 0.75rem; color: var(--gray); margin-top: 0.2rem; }

/* ── Definition Panel ── */
.word-definition-panel {
    width: 100%;
    background: var(--white);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
}

.definition-loading { color: var(--gray); text-align: center; }

.def-word {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.def-phonetic { font-size: 1rem; color: var(--gray); font-weight: 400; }

.def-audio-btn {
    background: var(--light-pink);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s;
}

.def-audio-btn:hover { transform: scale(1.1); }

.def-part {
    display: inline-block;
    background: linear-gradient(135deg, var(--pink) 0%, var(--yellow) 100%);
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0.5rem 0 0.3rem;
    font-style: italic;
}

.def-text { font-size: 0.9rem; color: var(--dark); margin-bottom: 0.3rem; }
.def-example { font-size: 0.85rem; color: var(--gray); font-style: italic; margin-bottom: 0.3rem; padding-left: 1rem; }
.def-synonyms { font-size: 0.82rem; color: var(--pink); margin-top: 0.3rem; }

/* ── Animations ── */
@keyframes pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes flip {
    0%   { transform: rotateX(0deg); }
    50%  { transform: rotateX(-90deg); }
    100% { transform: rotateX(0deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.shake { animation: shake 0.5s ease; }

/* ── Dark Mode ── */
.dark-mode .wordle-tile { background: #1a1a2e; border-color: #444; color: #eee; }
.dark-mode .wordle-tile.filled { border-color: var(--pink); }
.dark-mode .kb-key { background: #2d2d44; color: #eee; }
.dark-mode .kb-key.absent { background: #1a1a1a; color: #555; }
.dark-mode .word-definition-panel { background: #1a1a2e; }
.dark-mode .def-word { color: #eee; }
.dark-mode .def-text { color: #ccc; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .wordle-tile { width: 52px; height: 52px; font-size: 1.5rem; }
    .kb-key { height: 48px; min-width: 32px; font-size: 0.75rem; }
    .kb-key.kb-wide { min-width: 52px; }
    .wordle-header h1 { font-size: 2rem; }
}
