/* ═══════════════════════════════════════════════════════════════════
   Cloze in Context — fill-the-gap Chinese vocabulary drill (D75)
   Hero: slate → violet (#0f172a → #6d28d9 → #a855f7). Deliberately distinct
   from Grammar Gauntlet's cyan, Look-Alike's teal, Tone Pair Arcade's rose
   and Character Builder's indigo — every game hero reads as its own place.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Hero ────────────────────────────────────────────────────────── */
.cz-hero {
    background: linear-gradient(135deg, #0f172a 0%, #6d28d9 55%, #a855f7 100%);
    border-radius: 0.5rem;
}

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

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

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

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

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

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

/* Round progress */
.cz-progress {
    height: 4px;
    border-radius: 999px;
    background: var(--bs-secondary-bg);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.cz-progress-fill {
    height: 100%;
    width: 0;
    background: #a855f7;
    transition: width 0.25s ease;
}

/* ── The stage ───────────────────────────────────────────────────── */
.cz-stage {
    position: relative;
    min-height: 22rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cz-prompt {
    text-align: center;
    padding: 0.5rem 0.25rem 0;
}

.cz-sentence {
    font-size: clamp(1.35rem, 4.5vw, 1.9rem);
    line-height: 1.9;
    font-weight: 600;
    margin-bottom: 0.35rem;
    word-break: break-word;
}

/* The gap. Sized so the sentence does not reflow when the answer drops in. */
.cz-blank {
    display: inline-block;
    min-width: 2.6em;
    margin: 0 0.15em;
    padding: 0 0.2em;
    border-bottom: 3px solid #a855f7;
    border-radius: 3px 3px 0 0;
    background: rgba(168, 85, 247, 0.12);
    color: #7c3aed;
    text-align: center;
}

.cz-gloss {
    font-size: 0.95rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0;
}

/* ── Timer ───────────────────────────────────────────────────────── */
.cz-timer {
    height: 8px;
    border-radius: 999px;
    background: var(--bs-secondary-bg);
    overflow: hidden;
}

.cz-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #a855f7, #f59e0b);
}

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

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

.cz-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 3.6rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--bs-border-color);
    border-radius: 0.6rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-weight: 600;
    transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}

.cz-option:hover:not(:disabled) {
    border-color: #a855f7;
    transform: translateY(-1px);
}

.cz-option:disabled {
    opacity: 1;
}

.cz-option-key {
    position: absolute;
    top: 0.25rem;
    left: 0.4rem;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--bs-secondary-color);
}

.cz-option-hanzi {
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
}

.cz-option.correct {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.12);
}

.cz-option.wrong {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.12);
}

/* ── Reveal ──────────────────────────────────────────────────────── */
.cz-reveal {
    display: none;
}

.cz-reveal.shown {
    display: block;
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.75rem;
}

.cz-verdict {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.cz-verdict.right { color: #16a34a; }
.cz-verdict.wrong { color: #dc2626; }

.cz-reveal-sentence {
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: 0.15rem;
    word-break: break-word;
}

.cz-filled {
    color: #7c3aed;
    border-bottom: 2px solid #a855f7;
}

.cz-reveal-pinyin {
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.5rem;
}

.cz-speak {
    padding: 0.1rem 0.4rem;
    vertical-align: middle;
}

/* All four options translated — the wrong ones are where a missed question
   turns into a word, so each is a link to its dictionary entry. */
.cz-meanings {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
    display: grid;
    gap: 0.2rem;
    font-size: 0.88rem;
}

@media (min-width: 768px) {
    .cz-meanings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 1rem;
    }
}

.cz-meanings li {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.15rem 0.35rem;
    border-radius: 0.3rem;
}

.cz-meanings li.is-answer {
    background: rgba(22, 163, 74, 0.1);
}

.cz-meaning-word {
    font-weight: 700;
    white-space: nowrap;
}

.cz-meaning-pinyin {
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.cz-meaning-gloss {
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cz-source {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

/* The reveal is dismissed by hand, so the way out of it has to be the most obvious
   thing on the panel — nothing else here is a filled button. */
.cz-next-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.cz-next {
    padding: 0.5rem 1.4rem;
}

.cz-next-hint {
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}

@media (max-width: 575.98px) {
    .cz-next {
        flex: 1 1 100%;
    }

    .cz-next-hint {
        display: none;
    }
}

/* ── Overlays ────────────────────────────────────────────────────── */
.cz-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
    padding: 1rem;
    background: var(--bs-body-bg);
    border-radius: 0.5rem;
}

.cz-big-icon {
    font-size: 2.5rem;
    color: #a855f7;
}

.cz-btn-primary {
    background: linear-gradient(135deg, #6d28d9, #a855f7);
    border: none;
    color: #fff;
    font-weight: 600;
}

.cz-btn-primary:hover,
.cz-btn-primary:focus {
    background: linear-gradient(135deg, #5b21b6, #9333ea);
    color: #fff;
}

.cz-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.cz-picker-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
    margin-right: 0.15rem;
}

.cz-pick-btn {
    padding: 0.2rem 0.7rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: transparent;
    color: var(--bs-body-color);
    font-size: 0.85rem;
}

.cz-pick-btn.active {
    background: #6d28d9;
    border-color: #6d28d9;
    color: #fff;
}

.cz-final-score {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1;
    color: #7c3aed;
}

.cz-final-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1rem;
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
}

.cz-final-missed {
    font-size: 0.85rem;
}

/* ── Worked examples (server-rendered, JavaScript-off half) ──────── */
.cz-example-sentence {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.cz-example-blank {
    padding: 0 0.15em;
    border-bottom: 2px solid #a855f7;
    color: #7c3aed;
    font-weight: 700;
}

.cz-example-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.cz-example-option {
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.4rem;
    font-size: 0.88rem;
}

.cz-example-option.correct {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
    font-weight: 600;
}

.cz-chip {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
}

.cz-chip-beginner { background: #16a34a; }
.cz-chip-intermediate { background: #d97706; }
.cz-chip-advanced { background: #6d28d9; }

/* ── Sidebar study list ──────────────────────────────────────────── */
.cz-missed-row {
    padding: 0.35rem 0.4rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.cz-missed-row:last-child {
    border-bottom: none;
}

.cz-missed-row a,
.cz-missed-row > span {
    font-size: 1.05rem;
    font-weight: 700;
}

/* ── Accessibility ───────────────────────────────────────────────── */
.cz-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .cz-option,
    .cz-progress-fill,
    .cz-heart {
        transition: none;
    }
}
