/* ========== word-flash 单词速记 ========== */
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0; min-height: 100%;
    background: linear-gradient(160deg, #fef7f0 0%, #eff6ff 60%, #ecfdf5 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Helvetica Neue", "Microsoft YaHei", sans-serif;
    color: #1f2937;
    -webkit-text-size-adjust: 100%;
}
body { overscroll-behavior-y: contain; }

.wf-app {
    display: flex; flex-direction: column;
    min-height: 100vh;
    /* 不限 max-width：让 PC 上撑满屏宽，内部 wf-flash / wf-home 自己控制居中 */
    width: 100%;
}

/* ===== Header ===== */
.wf-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
    position: sticky; top: 0; z-index: 40;
}
.wf-header-inner {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}
@media (min-width: 900px) {
    .wf-header { padding: 14px 24px; }
}
.wf-back {
    display: inline-flex; align-items: center; gap: 4px;
    color: #4b5563; text-decoration: none;
    padding: 6px 10px; border-radius: 8px;
    font-size: 14px;
}
.wf-back:hover { background: rgba(0,0,0,0.04); color: #1f2937; }

.wf-rank {
    flex: 1;
    display: flex; flex-direction: column; align-items: center;
    line-height: 1.1;
}
.wf-rank-tier {
    font-size: 12px; font-weight: 800;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
}
.wf-rank-name {
    font-size: 13px; color: #374151; font-weight: 600;
    margin-top: 1px;
}

.wf-points {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d;
    border-radius: 999px;
    color: #92400e; font-weight: 700; font-size: 14px;
    cursor: pointer;
    transition: transform .1s ease, box-shadow .15s ease;
    user-select: none;
}
.wf-points:hover { box-shadow: 0 3px 10px rgba(245,158,11,0.35); }
.wf-points:active { transform: scale(0.96); }
.wf-points .bi { color: #f59e0b; }
.wf-points.scoring { animation: wf-score-pulse 0.28s ease-out; }
@keyframes wf-score-pulse {
    0%   { transform: scale(1);   }
    40%  { transform: scale(1.25); background: linear-gradient(135deg,#fed7aa,#fdba74); }
    100% { transform: scale(1);   }
}

/* ===== Screens ===== */
.wf-screen { display: none; flex: 1; min-height: 0; }
.wf-screen.active { display: flex; flex-direction: column; }

/* ===== Home ===== */
.wf-home {
    display: flex; flex-direction: column;
    padding: 18px 18px 32px;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    gap: 14px;
}
@media (min-width: 900px) {
    .wf-home { padding: 40px 32px; max-width: 640px; gap: 22px; }
}
.wf-hero {
    text-align: center;
    padding: 8px 0 0;
}
.wf-hero-icon {
    width: 56px; height: 56px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    box-shadow: 0 8px 20px rgba(245,158,11,0.3);
}
.wf-hero-title {
    margin: 0; font-size: 22px; font-weight: 800; color: #111827;
    letter-spacing: 0.5px;
}
.wf-hero-sub {
    margin: 4px 0 0; font-size: 12px; color: #6b7280;
}

.wf-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.wf-stat {
    background: #fff;
    border-radius: 12px;
    padding: 12px 6px;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.wf-stat-num {
    font-size: 22px; font-weight: 800;
    color: #1f2937;
    line-height: 1;
}
.wf-stat-label {
    margin-top: 4px;
    font-size: 12px; color: #6b7280;
}

.wf-rank-progress {
    background: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
}
.wf-rank-progress-label {
    display: flex; justify-content: space-between;
    font-size: 12px; color: #6b7280;
    margin-bottom: 6px;
}
.wf-rank-progress-label > span:first-child {
    color: #1f2937; font-weight: 600;
}
.wf-rank-progress-bar {
    height: 8px; background: #f3f4f6; border-radius: 4px;
    overflow: hidden;
}
.wf-rank-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    transition: width 0.5s ease-out;
}

.wf-start-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    margin-top: 4px;
    padding: 16px;
    border: none; border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 18px; font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37,99,235,0.35);
    transition: transform 0.1s ease;
}
.wf-start-btn:active { transform: scale(0.98); }
.wf-start-btn .bi { font-size: 22px; }

.wf-reset-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 12px;
    padding: 6px;
    cursor: pointer;
    align-self: center;
}
.wf-reset-btn:hover { color: #ef4444; }

/* ===== Lottery 弹窗 ===== */
.wf-lottery-modal {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.55);
    align-items: center; justify-content: center;
    padding: 16px;
}
.wf-lottery-modal.active { display: flex; }
.wf-lottery-box {
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    border-radius: 18px;
    padding: 28px 24px;
    max-width: 360px; width: 100%;
    text-align: center;
}
.wf-lottery-box h3 {
    margin: 0 0 6px;
    color: #78350f; font-size: 22px;
}
.wf-lottery-balance {
    font-size: 13px; color: #92400e;
    margin-bottom: 18px;
}
.wf-lottery-wheel {
    width: 180px; height: 180px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #fff;
    border: 6px solid #fbbf24;
    display: flex; align-items: center; justify-content: center;
    font-size: 70px;
    box-shadow: 0 6px 18px rgba(120,53,15,0.2);
}
.wf-lottery-wheel.spinning { animation: wf-lottery-spin .7s linear infinite; }
@keyframes wf-lottery-spin { to { transform: rotate(360deg); } }
.wf-lottery-result {
    font-size: 17px; color: #78350f; font-weight: 600;
    margin-bottom: 8px; min-height: 24px;
}
.wf-lottery-desc {
    font-size: 13px; color: #92400e;
    margin-bottom: 18px; min-height: 18px;
}
.wf-lottery-actions {
    display: flex; gap: 8px;
}
.wf-lottery-actions button {
    flex: 1; padding: 10px;
    border-radius: 10px;
    border: 1px solid #fbbf24;
    background: #fff;
    color: #78350f;
    font-size: 14px; cursor: pointer;
}
.wf-lottery-actions button.primary {
    background: #f59e0b; color: #fff;
    border-color: #f59e0b;
}
.wf-lottery-actions button:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Flash Screen ===== */
.wf-flash {
    flex: 1;
    display: flex; flex-direction: column;
    padding: 14px 14px calc(24px + env(safe-area-inset-bottom));
    position: relative;
    gap: 14px;
}
@media (min-width: 900px) {
    .wf-flash {
        padding: 40px 24px 32px;
        gap: 28px;
        max-width: 1100px;
        margin: 0 auto;
        width: 100%;
    }
}

.wf-streak {
    align-self: center;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: #fff; font-weight: 700; font-size: 12px;
    border-radius: 999px;
    box-shadow: 0 4px 10px rgba(249,115,22,0.35);
    margin-bottom: 8px;
    animation: wf-streak-in 0.3s ease-out;
}
@keyframes wf-streak-in {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.wf-card {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #fff;
    border-radius: 18px;
    padding: 30px 20px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 8px 30px rgba(0,0,0,0.05);
    position: relative;
    min-height: 200px;
    flex-shrink: 0;
}
@media (min-width: 900px) {
    .wf-card {
        padding: 70px 40px;
        min-height: 360px;
        border-radius: 24px;
    }
}
.wf-card.flip-in { animation: wf-card-in 0.32s cubic-bezier(.34,1.56,.64,1); }
@keyframes wf-card-in {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.wf-replay {
    position: absolute; top: 12px; right: 12px;
    width: 38px; height: 38px;
    border: none; border-radius: 50%;
    background: rgba(59,130,246,0.08);
    color: #3b82f6;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.wf-replay:hover { background: rgba(59,130,246,0.15); }
.wf-replay.playing {
    background: #3b82f6; color: #fff;
    animation: wf-replay-pulse 1.2s ease-in-out infinite;
}
@keyframes wf-replay-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.6); }
    50%     { box-shadow: 0 0 0 8px rgba(59,130,246,0); }
}

.wf-word {
    font-size: clamp(42px, 10vw, 88px);
    font-weight: 800;
    color: #111827;
    text-align: center;
    line-height: 1.1;
    letter-spacing: 0.5px;
    word-break: break-word;
    margin: 12px 0;
}
@media (min-width: 900px) {
    .wf-word { font-size: clamp(72px, 7vw, 120px); margin: 16px 0; }
}

/* ===== Card Screen (答错后的复习卡片) ===== */
.wf-cs {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 18px calc(32px + env(safe-area-inset-bottom));
    gap: 16px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    animation: wf-cs-in 0.3s ease-out;
    position: relative;
}
@media (min-width: 900px) {
    .wf-cs {
        padding: 60px 32px 32px;
        gap: 24px;
        max-width: 820px;
    }
}
@keyframes wf-cs-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wf-cs-wrong-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    background: rgba(239,68,68,0.1);
    color: #dc2626;
    border-radius: 999px;
    font-size: 13px; font-weight: 700;
    letter-spacing: 0.5px;
}
.wf-cs-wrong-badge .bi { font-size: 14px; }

.wf-cs-word {
    font-size: clamp(48px, 13vw, 96px);
    font-weight: 900;
    color: #111827;
    line-height: 1.05;
    letter-spacing: 0.5px;
    word-break: break-word;
    margin: 8px 0;
}
@media (min-width: 900px) {
    .wf-cs-word { font-size: clamp(80px, 8vw, 140px); margin: 12px 0; }
}

/* 右上角浮动喇叭，极简、不抢戏 */
.wf-cs-replay {
    position: absolute;
    top: 8px; right: 12px;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.wf-cs-replay:hover { color: #3b82f6; background: rgba(59,130,246,0.08); }
.wf-cs-replay.playing {
    color: #3b82f6;
    animation: wf-cs-replay-pulse 1.2s ease-in-out infinite;
}
@keyframes wf-cs-replay-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.5); }
    50%     { box-shadow: 0 0 0 8px rgba(59,130,246,0); }
}
@media (min-width: 900px) {
    .wf-cs-replay { top: 14px; right: 18px; width: 44px; height: 44px; font-size: 24px; }
}

.wf-cs-img {
    max-width: min(320px, 80%);
    max-height: 240px;
    border-radius: 14px;
    object-fit: contain;
    background: #f9fafb;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
@media (min-width: 900px) {
    .wf-cs-img { max-width: min(420px, 60%); max-height: 360px; border-radius: 18px; }
}

.wf-cs-trans {
    font-size: 26px;
    color: #111827;
    font-weight: 700;
    line-height: 1.45;
    margin-top: 4px;
    padding: 0 8px;
}
@media (min-width: 900px) {
    .wf-cs-trans { font-size: 36px; margin-top: 12px; }
}

/* ===== 4-Choice options ===== */
.wf-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex-shrink: 0;
}
@media (min-width: 600px)  { .wf-options { gap: 14px; } }
@media (min-width: 900px)  { .wf-options { gap: 18px; } }
.wf-opt {
    padding: 14px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    text-align: center;
    line-height: 1.4;
    min-height: 62px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.08s ease, border-color 0.15s, background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
@media (min-width: 600px) {
    .wf-opt { font-size: 19px; padding: 18px 20px; min-height: 76px; }
}
@media (min-width: 900px) {
    .wf-opt { font-size: 26px; padding: 32px 24px; min-height: 110px; border-radius: 18px; }
}
.wf-opt:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.wf-opt:active { transform: scale(0.98); }
.wf-opt[disabled] { cursor: default; }
.wf-opt[disabled]:hover { border-color: #e5e7eb; background: #fff; }
.wf-opt.correct {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    box-shadow: 0 4px 14px rgba(16,185,129,0.25);
}
.wf-opt.wrong {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    box-shadow: 0 4px 14px rgba(239,68,68,0.25);
}

/* ===== 2-秒等待进度条（按钮出现前的视觉指引） ===== */
.wf-wait {
    width: 100%;
    max-width: 240px;
    height: 4px;
    margin: 8px auto 0;
    background: rgba(0,0,0,0.06);
    border-radius: 999px;
    overflow: hidden;
}
.wf-wait-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #ef4444);
    border-radius: 999px;
    transition: width 2s linear;
}
.wf-wait-fill.go { width: 100%; }

/* ===== Action buttons ===== */
/* 跟内容流走，不再 fixed 在屏幕底部 */
.wf-actions {
    display: grid; grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 480px;
    margin: 56px auto 0;
    /* 渐入 + 上滑 */
    transition: opacity .35s ease-out, transform .35s ease-out;
    opacity: 1;
    transform: translateY(0);
}
.wf-actions.wf-actions--hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}
@media (min-width: 900px) {
    .wf-actions { margin-top: 80px; }
}
.wf-btn {
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 17px; font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    color: #fff;
    transition: transform 0.08s ease;
}
@media (min-width: 900px) {
    .wf-btn { padding: 20px; font-size: 20px; border-radius: 16px; }
}
.wf-btn:active { transform: scale(0.97); }
.wf-btn-next {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 6px 16px rgba(59,130,246,0.35);
}

/* ===== Flying score bubble (4-phase) ===== */
.wf-fly-layer {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 999;
}
.wf-fly {
    position: fixed;
    pointer-events: none;
    color: #f59e0b;
    font-size: 36px; font-weight: 900; letter-spacing: 1px;
    text-shadow:
        0 0 12px rgba(255,255,255,0.9),
        0 0 24px rgba(245,158,11,0.6),
        0 2px 6px rgba(245,158,11,0.5);
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
    transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .12s ease-out;
}
.wf-fly[data-phase="mid"] {
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(1.4);
    opacity: 1;
}
.wf-fly[data-phase="fly"] {
    transition: transform .28s cubic-bezier(.5,0,.5,1), opacity .2s .08s ease-in;
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(.5);
    opacity: 0;
}

/* ===== Rank-up celebration overlay ===== */
.wf-rankup-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.55);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.wf-rankup-overlay.active { display: flex; }
.wf-rankup-box {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px;
    text-align: center;
    width: 100%;
    max-width: 360px;
    animation: wf-rankup-in 0.5s cubic-bezier(.34,1.56,.64,1);
}
@media (min-width: 900px) {
    .wf-rankup-box {
        max-width: 520px;
        padding: 56px 64px;
        border-radius: 28px;
    }
}
@keyframes wf-rankup-in {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.wf-rankup-icon {
    width: 80px; height: 80px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #ef4444);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 40px;
    box-shadow: 0 12px 30px rgba(239,68,68,0.4);
}
@media (min-width: 900px) {
    .wf-rankup-icon { width: 120px; height: 120px; font-size: 60px; margin-bottom: 20px; }
}
.wf-rankup-title {
    font-size: 14px; color: #6b7280;
    margin-bottom: 6px;
    letter-spacing: 1px;
}
@media (min-width: 900px) { .wf-rankup-title { font-size: 16px; margin-bottom: 10px; } }

.wf-rankup-tier {
    font-size: 32px; font-weight: 900;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 6px;
    line-height: 1.1;
}
@media (min-width: 900px) { .wf-rankup-tier { font-size: 56px; margin-bottom: 10px; } }

.wf-rankup-name {
    font-size: 20px; font-weight: 700; color: #1f2937;
    margin-bottom: 22px;
}
@media (min-width: 900px) { .wf-rankup-name { font-size: 28px; margin-bottom: 32px; } }

.wf-rankup-btn {
    padding: 14px 36px;
    border: none; border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff; font-size: 16px; font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease;
}
.wf-rankup-btn:active { transform: scale(0.97); }
@media (min-width: 900px) { .wf-rankup-btn { padding: 18px 56px; font-size: 20px; border-radius: 14px; } }
