/* ═══════════════════════════════════════════════════════════════════
   Look-Alike Characters — rapid-fire confusable-hanzi drill (G8)
   Hero: teal #115e59 → #14b8a6, matching the fa-clone teal used by the
   companion article, and distinct from Tone Pair Arcade's rose.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Hero ────────────────────────────────────────────────────────── */
.lah-hero {
    background: linear-gradient(135deg, #115e59 0%, #0f766e 55%, #14b8a6 100%);
    border-radius: 0.5rem;
}

/* ── HUD row above the stage ─────────────────────────────────────── */
.lah-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.lah-hud-item {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: nowrap;
}

.lah-hud-item small {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
}

.lah-heart {
    color: #ef4444;
    font-size: 1.15rem;
    transition: transform 0.15s, color 0.15s;
}

.lah-heart.lost {
    color: #cbd5e1;
    transform: scale(0.85);
}

.lah-combo-badge {
    display: inline-block;
    min-width: 2.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-size: 0.95rem;
}

/* Round progress */
.lah-progress {
    height: 5px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.3);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.lah-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    transition: width 0.3s ease;
}

/* ── The stage ───────────────────────────────────────────────────── */
.lah-stage {
    position: relative;
    min-height: 380px;
    border-radius: 0.75rem;
    background: linear-gradient(180deg, #f0fdfa 0%, #ecfeff 100%);
    border: 1px solid rgba(15, 118, 110, 0.15);
    padding: 1rem;
    overflow: hidden;
}

/* ── Prompt ──────────────────────────────────────────────────────── */
.lah-prompt {
    text-align: center;
    min-height: 5.2rem;
    padding: 0.5rem 0 0.75rem;
}

.lah-prompt-pinyin {
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    color: #115e59;
}

.lah-prompt-meaning {
    font-size: 1.05rem;
    color: var(--bs-secondary-color);
    margin-top: 0.15rem;
}

/* Countdown bar */
.lah-timer {
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    overflow: hidden;
    margin-bottom: 1rem;
}

.lah-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #14b8a6, #0f766e);
}

.lah-timer-fill.urgent {
    background: linear-gradient(90deg, #f97316, #ef4444);
    animation: lah-pulse 0.6s ease-in-out infinite;
}

@keyframes lah-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* ── Character options ───────────────────────────────────────────── */
.lah-options {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lah-options-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lah-options-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 576px) {
    .lah-options-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.lah-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 6.5rem;
    border: 2px solid rgba(15, 118, 110, 0.25);
    border-radius: 0.75rem;
    background: #fff;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.lah-option:hover:not(:disabled) {
    border-color: #0f766e;
    transform: translateY(-2px);
}

.lah-option:disabled {
    cursor: default;
}

.lah-option-char {
    font-size: clamp(2.6rem, 11vw, 4rem);
    line-height: 1;
    color: #0f172a;
}

.lah-option-key {
    position: absolute;
    top: 0.35rem;
    left: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
    opacity: 0.65;
}

.lah-option.correct {
    border-color: #16a34a;
    background: #dcfce7;
    animation: lah-pop 0.35s ease;
}

.lah-option.wrong {
    border-color: #dc2626;
    background: #fee2e2;
    animation: lah-shake 0.35s ease;
}

.lah-option.faded {
    opacity: 0.4;
}

@keyframes lah-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes lah-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ── Reveal panel ────────────────────────────────────────────────── */
.lah-reveal {
    margin-top: 0.9rem;
    /* Reserved so the stage does not jump when the tip appears. */
    min-height: 8rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lah-reveal.shown {
    opacity: 1;
}

.lah-reveal-head {
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.lah-reveal-head.ok { color: #15803d; }
.lah-reveal-head.bad { color: #b91c1c; }

.lah-reveal-rows {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin-bottom: 0.5rem;
}

.lah-reveal-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.lah-reveal-row.is-target {
    font-weight: 600;
}

.lah-reveal-char {
    font-size: 1.6rem;
    line-height: 1;
}

.lah-speaker {
    border: none;
    background: transparent;
    color: #0f766e;
    padding: 0.1rem 0.3rem;
    cursor: pointer;
    border-radius: 0.25rem;
}

.lah-speaker:hover {
    background: rgba(15, 118, 110, 0.12);
}

.lah-speaker.lah-speaker-loading {
    opacity: 0.45;
    cursor: progress;
}

.lah-reveal-tip {
    font-size: 0.875rem;
    background: rgba(20, 184, 166, 0.1);
    border-left: 3px solid #14b8a6;
    border-radius: 0.25rem;
    padding: 0.5rem 0.65rem;
}

/* Floating score */
.lah-float {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 800;
    font-size: 1.5rem;
    color: #15803d;
    pointer-events: none;
    animation: lah-float-up 0.9s ease-out forwards;
}

@keyframes lah-float-up {
    0% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -60px); }
}

/* ── Overlays ────────────────────────────────────────────────────── */
.lah-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    text-align: center;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(2px);
    z-index: 5;
}

.lah-big-icon {
    font-size: 2.5rem;
    color: #0f766e;
}

.lah-btn-primary {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    border: none;
    color: #fff;
    font-weight: 600;
}

.lah-btn-primary:hover {
    background: linear-gradient(135deg, #115e59, #0f766e);
    color: #fff;
}

/* Level picker on the start screen */
.lah-level-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.lah-level-btn {
    border: 2px solid rgba(15, 118, 110, 0.3);
    background: #fff;
    border-radius: 0.5rem;
    padding: 0.4rem 0.9rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.12s;
}

.lah-level-btn:hover {
    border-color: #0f766e;
}

.lah-level-btn.active {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    border-color: #0f766e;
    color: #fff;
}

.lah-final-score {
    font-size: 2.75rem;
    font-weight: 800;
    color: #0f766e;
    line-height: 1;
}

.lah-final-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.lah-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
}

.lah-chip {
    background: rgba(15, 118, 110, 0.12);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 1rem;
}

/* Sidebar stat rows */
.lah-stat-chars {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Reference table character cells */
.lah-ref-char {
    font-size: 1.5rem;
    line-height: 1.2;
}

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

/* ── Dark mode ───────────────────────────────────────────────────── */
[data-bs-theme="dark"] .lah-stage {
    background: linear-gradient(180deg, #0f2f2c 0%, #0b2429 100%);
    border-color: rgba(20, 184, 166, 0.25);
}

[data-bs-theme="dark"] .lah-prompt-pinyin {
    color: #5eead4;
}

[data-bs-theme="dark"] .lah-option {
    background: #16302f;
    border-color: rgba(20, 184, 166, 0.3);
}

[data-bs-theme="dark"] .lah-option-char {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .lah-option.correct {
    background: rgba(22, 163, 74, 0.28);
    border-color: #22c55e;
}

[data-bs-theme="dark"] .lah-option.wrong {
    background: rgba(220, 38, 38, 0.28);
    border-color: #ef4444;
}

[data-bs-theme="dark"] .lah-overlay {
    background: rgba(15, 23, 42, 0.94);
}

[data-bs-theme="dark"] .lah-level-btn {
    background: #16302f;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .lah-reveal-head.ok { color: #4ade80; }
[data-bs-theme="dark"] .lah-reveal-head.bad { color: #f87171; }

[data-bs-theme="dark"] .lah-float { color: #4ade80; }

[data-bs-theme="dark"] .lah-heart.lost { color: #475569; }

@media (prefers-reduced-motion: reduce) {
    .lah-option,
    .lah-timer-fill,
    .lah-float,
    .lah-progress-fill {
        animation: none !important;
        transition: none !important;
    }
}
