/* 每日猜单词 English Wordle — 棋盘、键盘、统计。
   先写浅色，深色统一放到最后的 [data-bs-theme="dark"]，和 pinyinwordle.css 一致。 */

.ew-hero {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 55%, #db2777 100%);
}

/* ── 棋盘 ───────────────────────────────────────────────────────────── */
.ew-board-wrap {
    display: flex;
    justify-content: center;
    padding: .5rem 0 1rem;
}

.ew-board {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ew-row {
    display: flex;
    gap: 6px;
}

.ew-cell {
    width: 3.1rem;
    height: 3.1rem;
    border: 2px solid #d3d6da;
    border-radius: .35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #212529;
    background: #fff;
    user-select: none;
}

.ew-cell.ew-filled {
    border-color: #878a8c;
    animation: ewPop .1s ease-in-out;
}

.ew-cell[data-state] {
    border-color: transparent;
    color: #fff;
}

.ew-cell[data-state="c"] { background: #6aaa64; }
.ew-cell[data-state="p"] { background: #c9b458; }
.ew-cell[data-state="a"] { background: #787c7e; }

.ew-flip { animation: ewFlip .5s ease both; }

@keyframes ewPop {
    50% { transform: scale(1.12); }
}

@keyframes ewFlip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

.ew-shake { animation: ewShake .4s ease; }

@keyframes ewShake {
    10%, 50%, 90% { transform: translateX(-5px); }
    30%, 70% { transform: translateX(5px); }
}

/* ── 键盘 ───────────────────────────────────────────────────────────── */
.ew-keyboard {
    max-width: 520px;
    margin: 0 auto;
}

.ew-krow {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 6px;
}

.ew-key {
    border: 0;
    border-radius: .3rem;
    background: #d3d6da;
    color: #212529;
    font-weight: 700;
    min-width: 2.15rem;
    height: 3.4rem;
    padding: 0 .35rem;
    font-size: .95rem;
    text-transform: uppercase;
    flex: 1 1 0;
    max-width: 2.9rem;
    cursor: pointer;
    touch-action: manipulation;
}

.ew-key:active { filter: brightness(.9); }

.ew-key-wide {
    max-width: 4.6rem;
    flex-grow: 1.6;
    font-size: .7rem;
}

.ew-key[data-state="c"] { background: #6aaa64; color: #fff; }
.ew-key[data-state="p"] { background: #c9b458; color: #fff; }
.ew-key[data-state="a"] { background: #787c7e; color: #fff; }

/* ── 模式与等级按钮 ─────────────────────────────────────────────────── */
.ew-mode-btn,
.ew-level-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 2rem;
    padding: .35rem 1rem;
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
}

.ew-mode-btn[aria-pressed="true"],
.ew-level-btn[aria-pressed="true"] {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.ew-level-btn { font-size: .875rem; padding: .3rem .85rem; }

/* ── 提示 / 结果 ────────────────────────────────────────────────────── */
.ew-hint {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: .5rem;
    padding: .6rem .9rem;
    text-align: center;
}

.ew-hint-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #c2410c;
}

.ew-result-word {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: #2563eb;
}

.ew-toast {
    position: fixed;
    left: 50%;
    top: 12%;
    transform: translateX(-50%);
    background: #212529;
    color: #fff;
    padding: .55rem 1.1rem;
    border-radius: .4rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1080;
}

.ew-toast-show { opacity: 1; }

/* ── 统计 ───────────────────────────────────────────────────────────── */
.ew-dist-line {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .25rem;
}

.ew-dist-label {
    width: .9rem;
    font-weight: 700;
    font-size: .8rem;
    text-align: right;
}

.ew-dist-bar {
    background: #6aaa64;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    text-align: right;
    padding: .1rem .35rem;
    border-radius: .2rem;
    min-width: 1.2rem;
}

.ew-dist-bar.ew-dist-zero { background: #9ca3af; }

.ew-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (max-width: 420px) {
    .ew-cell { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; }
    .ew-key { height: 3rem; }
}

/* ── 深色主题 ───────────────────────────────────────────────────────── */
[data-bs-theme="dark"] .ew-cell {
    background: #1f2937;
    border-color: #3a3a3c;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .ew-cell.ew-filled { border-color: #565758; }
[data-bs-theme="dark"] .ew-cell[data-state] { border-color: transparent; color: #fff; }
[data-bs-theme="dark"] .ew-cell[data-state="c"] { background: #538d4e; }
[data-bs-theme="dark"] .ew-cell[data-state="p"] { background: #b59f3b; }
[data-bs-theme="dark"] .ew-cell[data-state="a"] { background: #3a3a3c; }

[data-bs-theme="dark"] .ew-key {
    background: #565758;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .ew-key[data-state="c"] { background: #538d4e; color: #fff; }
[data-bs-theme="dark"] .ew-key[data-state="p"] { background: #b59f3b; color: #fff; }
[data-bs-theme="dark"] .ew-key[data-state="a"] { background: #2d2d2f; color: #9ca3af; }

[data-bs-theme="dark"] .ew-mode-btn,
[data-bs-theme="dark"] .ew-level-btn {
    background: #1f2937;
    border-color: #475569;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .ew-mode-btn[aria-pressed="true"],
[data-bs-theme="dark"] .ew-level-btn[aria-pressed="true"] {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

[data-bs-theme="dark"] .ew-hint {
    background: #2a2118;
    border-color: #7c4a1e;
}

[data-bs-theme="dark"] .ew-hint-text { color: #fdba74; }

[data-bs-theme="dark"] .ew-toast {
    background: #e5e7eb;
    color: #111827;
}

[data-bs-theme="dark"] .ew-result-word { color: #93c5fd; }
