/* ===== QUESTION SCREEN ===== */
.quiz-question-screen {
    position: relative;
    padding: 20px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 1;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: transparent;
    /* Base transition for slide animations */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

/* Question slide transitions for navigation */
.quiz-question-screen.slide-exit-left {
    transform: translateX(-40px) scale(0.97);
    opacity: 0;
}

.quiz-question-screen.slide-enter-right {
    transform: translateX(40px) scale(0.97);
    opacity: 0;
    transition: none; /* Instant positioning before animate-in */
}

.quiz-question-screen.slide-enter-active {
    transform: translateX(0) scale(1);
    opacity: 1;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

/* Ma (間) - intentional breathing pause between questions */
.quiz-question-screen.breathing {
    opacity: 0;
    transform: scale(0.99);
    transition: opacity 150ms ease-out, transform 150ms ease-out;
}

/* Styled scrollbar for quiz content */
.quiz-question-screen::-webkit-scrollbar {
    width: 6px;
}

.quiz-question-screen::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.quiz-question-screen::-webkit-scrollbar-thumb {
    background: rgba(var(--quiz-primary-rgb), 0.3);
    border-radius: 3px;
}

.quiz-question-screen::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--quiz-primary-rgb), 0.5);
}

/* Badges row removed — status badge now lives in progress row */

/* Status badge — centered above question text */
.quiz-status-badge {
    font-family: 'Inter', sans-serif;
    font-size: 0.78em;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.3px;
    color: rgba(61, 90, 128, 0.45);
    padding: 6px 0 2px;
}

.quiz-status-badge:empty {
    display: none;
}

.quiz-status-badge[data-status="new"] {
    color: rgba(61, 90, 128, 0.45);
}

.quiz-status-badge[data-status="seen"] {
    color: #8C8578;
}

.quiz-question-text {
    /* Karesansui: no card, text breathes on the washi surface */
    font-size: 1.25em;
    font-weight: 500;
    color: #2C2C2C;
    line-height: 1.7;
    display: block;
    text-align: center;
    padding: 16px 12px 12px;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
}

/* Japanese text in questions - elegant calligraphy */
.quiz-question-text .quiz-jp {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 1.3em;
    color: #44403c;
    letter-spacing: 0.03em;
}

/* 「Bracketed Japanese」 subtle pill */
.jp-phrase {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    color: #44403c;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: rgba(61, 90, 128, 0.06);
    padding: 2px 6px;
    border-radius: 6px;
    border-bottom: 2px solid rgba(61, 90, 128, 0.15);
}

/* 'Quoted English' in question text */
.quiz-quoted {
    font-weight: 700;
    color: #2C4A6E;
}

/* Tip card - warm styled card */
.quiz-hint {
    font-size: 0.95em;
    font-weight: 600;
    color: #2C4A6E;
    text-align: left;
    padding: 14px 18px;
    background: #F0EDE8;
    border: 1.5px solid rgba(61, 90, 128, 0.15);
    border-left: 4px solid #3D5A80;
    border-radius: 12px;
    display: none;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(61, 90, 128, 0.05);
    line-height: 1.6;
}

/* ============================================
   HINT BAR — inline text links
   ============================================ */
.quiz-hint-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 4px 0 12px;
    margin: 0 auto;
    width: fit-content;
}

.quiz-hint-btn {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 4px 2px;
    font-size: 0.84em;
    font-weight: 500;
    color: var(--quiz-text-muted);
    /* Override global button styles from components.css */
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    outline: none;
    transform: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: color 0.15s;
    position: relative;
}

.quiz-hint-btn:hover {
    color: #57534e;
    background: transparent;
    box-shadow: none;
    transform: none;
}

.quiz-hint-btn:active {
    color: #1a1a1a;
    background: transparent;
    box-shadow: none;
    transform: none;
}

.quiz-hint-btn.active {
    color: #44403c;
    font-weight: 600;
    background: transparent;
    box-shadow: none;
    transform: none;
}

/* Underline on active state */
.quiz-hint-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: 1.5px;
    background: #44403c;
    border-radius: 1px;
}

.quiz-hint-btn.hidden {
    display: none;
}

/* Hide the icon prefixes — labels are self-evident */
.quiz-hint-btn .hint-icon {
    display: none;
}

.quiz-hint-btn .hint-label {
    font-size: 1em;
}

.quiz-hint-btn .label-en {
    opacity: 0.7;
}

/* Hidden buttons collapse — gap handles spacing */

/* Hint Content Area */
.quiz-hint-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    flex-shrink: 0;
}

.quiz-hint-content:empty {
    display: none;
}

/* Hint text — inline annotation, not a card */
.quiz-hint-text {
    display: none;
    font-size: 1em;
    font-weight: 400;
    padding: 0 4px;
    line-height: 1.6;
    color: #78716c;
    text-align: center;
    animation: hintFadeIn 0.2s ease-out;
}

.quiz-hint-text.visible {
    display: block;
}

.quiz-hint-inner {
    display: inline;
}

@keyframes hintFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Typography differentiates each reading type */
.quiz-romanized-text {
    font-style: italic;
    color: #a8a29e;
    font-size: 0.9em;
}

.quiz-kanji-text {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 1em;
    font-weight: 500;
    color: #57534e;
}

.quiz-kana-text {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 1em;
    font-weight: 500;
    color: #57534e;
}

.quiz-english-text {
    font-weight: 400;
    color: #78716c;
    font-size: 0.92em;
}

/* Blank slots in readings — lighter than main question blanks */
.quiz-hint-text .quiz-blank {
    border-bottom-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.03);
}

/* Answer Buttons */
.quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0 20px;
    flex: 0 0 auto;
}

/* Deep Mode — hide answers until revealed */
.quiz-answers.deep-mode-hidden {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease;
}

.deep-mode-reveal {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    font-weight: 600;
    color: #3D5A80;
    background: rgba(61, 90, 128, 0.06);
    border: 1.5px dashed rgba(61, 90, 128, 0.25);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.deep-mode-reveal:hover {
    background: rgba(61, 90, 128, 0.12);
    border-color: rgba(61, 90, 128, 0.4);
}

.quiz-answer-btn {
    position: relative;
    padding: 14px 18px;
    background: #FFFDF8;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 14px;
    overflow: hidden;
    min-height: auto;
    box-shadow: none;
}

.quiz-answer-btn .quiz-answer-text {
    font-size: 1.05em;
    font-weight: 500;
    color: #2C2C2C;
    flex: 1;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.quiz-answer-btn .answer-en {
    font-size: 0.82em;
    color: #8C8578;
    margin-left: auto;
}

.quiz-answer-btn:hover:not(:disabled) {
    border-color: rgba(61, 90, 128, 0.18);
    transform: translateY(-1px);
}

.quiz-answer-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

/* Number badge - quiet stone */
.quiz-answer-num {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #F0EDE8;
    color: #8C8578;
    font-size: 0.82em;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
    z-index: 1;
}

.quiz-answer-btn:hover:not(:disabled) .quiz-answer-num {
    background: var(--quiz-num-hover-bg);
    color: var(--quiz-num-hover-text);
}

/* Selected State (before submit) - quiet border change */
.quiz-answer-btn.selected {
    background: var(--quiz-selected-bg);
    border-color: var(--quiz-selected-border);
    color: var(--quiz-selected-text);
}

.quiz-answer-btn.selected .quiz-answer-num {
    background: var(--quiz-num-hover-bg);
    color: var(--quiz-num-hover-text);
}

/* Correct/Incorrect States — quiet color shift */
.quiz-answer-btn.correct {
    background: var(--quiz-correct-bg);
    border-color: var(--quiz-correct-border);
    color: var(--quiz-correct-text);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.quiz-answer-btn.correct .quiz-answer-num {
    background: var(--quiz-correct-num-bg);
    color: var(--quiz-correct-num-text);
}

/* Incorrect - muted terracotta (encouraging, not punishing) */
.quiz-answer-btn.incorrect {
    background: var(--quiz-incorrect-bg);
    border-color: var(--quiz-incorrect-border);
    color: var(--quiz-incorrect-text);
}

.quiz-answer-btn.incorrect .quiz-answer-num {
    background: var(--quiz-incorrect-num-bg);
    color: var(--quiz-incorrect-num-text);
}

.quiz-answer-btn:disabled {
    cursor: default;
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================
   ANSWER CARDS (after submit) - Quiz Results Format
   ============================================ */

/* Switch from 2x2 grid to vertical list */
.quiz-answers.answered-mode {
    display: flex;
    flex-direction: column;
    gap: 0;
    order: 2; /* Move answers below feedback */
    flex: 0 0 auto; /* Don't grow/shrink, use natural size */
    padding-bottom: 24px; /* Visual end indicator */
    animation: answersAppear 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes answersAppear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   COLLAPSIBLE ANSWERS SECTION (matches word stories style)
   ============================================ */
.answers-collapsible {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.answers-collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.answers-collapsible-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

.collapsible-title {
    font-size: 14px;
    font-weight: 600;
    color: #8C8578;
    letter-spacing: 0.02em;
}

/* Expand hint (matches word stories .expand-hint) */
.answers-collapsible .expand-hint {
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.4);
    margin-left: 8px;
}

/* Expanded state */
.answers-collapsible-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 12px;
    max-height: 800px;
    opacity: 1;
    transition: max-height 0.4s ease, opacity 0.3s ease 0.1s, padding 0.3s ease;
}

/* Collapsed state (matches word stories pattern) */
.answers-collapsible.collapsed .answers-collapsible-content {
    max-height: 0;
    padding: 0 12px;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

/* Hide navigation arrows when answered (Continue button replaces them) */
.quiz-question-screen:has(.quiz-answers.answered-mode) .quiz-navigation {
    display: none;
}

/* Move feedback above answers when in answered mode */
.quiz-answers.answered-mode ~ .quiz-feedback {
    order: 1;
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* Hide Tip button after submission (user-suggested) */
.quiz-question-screen:has(.quiz-answers.answered-mode) #quizTipToggle {
    display: none;
}

/* Hide status badge after submission */
.quiz-question-screen:has(.quiz-answers.answered-mode) .quiz-status-badge {
    display: none;
}

/* Hide hint bar after submission */
.quiz-question-screen:has(.quiz-answers.answered-mode) .quiz-hint-bar {
    display: none;
}

/* Ensure hints push content down properly after submission */
.quiz-question-screen:has(.quiz-answers.answered-mode) .quiz-hint-content,
.quiz-question-screen:has(.quiz-answers.answered-mode) .quiz-hint {
    flex-shrink: 0;
}

.quiz-answer-card {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
    will-change: transform;
}

.quiz-answer-card:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Correct answer card */
.quiz-answer-card.correct {
    background: rgba(163, 177, 138, 0.08);
    border-color: rgba(163, 177, 138, 0.3);
}

.quiz-answer-card.correct:hover {
    background: rgba(163, 177, 138, 0.12);
}

/* Incorrect answer card - muted terracotta */
.quiz-answer-card.incorrect {
    background: rgba(194, 130, 114, 0.08);
    border-color: rgba(194, 130, 114, 0.25);
}

.quiz-answer-card.incorrect:hover {
    background: rgba(194, 130, 114, 0.12);
}

/* Compact view - matches quiz results format */
.answer-card-compact {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.answer-card-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--quiz-num-bg, #F0EDE8);
    border-radius: 50%;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--quiz-num-text, #5C5A56);
    flex-shrink: 0;
    margin-top: 2px;
}

.quiz-answer-card.correct .answer-card-num {
    background: rgba(163, 177, 138, 0.15);
    color: var(--quiz-accent-correct, #4E6F3E);
    position: relative;
}

.quiz-answer-card.incorrect .answer-card-num {
    background: rgba(194, 130, 114, 0.15);
    color: #A3604E;
    position: relative;
}

/* Small X indicator on incorrect answer card number */
.quiz-answer-card.incorrect .answer-card-num::after {
    content: '✗';
    position: absolute;
    top: -3px;
    right: -3px;
    font-size: 8px;
    font-weight: 700;
    color: white;
    background: #A3604E;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Correct answer card gets a checkmark badge */
.quiz-answer-card.correct .answer-card-num::after {
    content: '✓';
    position: absolute;
    top: -3px;
    right: -3px;
    font-size: 8px;
    font-weight: 700;
    color: white;
    background: rgba(163, 177, 138, 0.8);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content area - two line layout like quiz results */
.answer-card-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

/* Row 1: Word + meta (pos + dots) */
.answer-card-row1 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.answer-card-word {
    font-size: 1.25em;
    font-weight: 600;
    color: #44403c;
    letter-spacing: 0.01em;
}

.answer-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.answer-card-pos {
    font-size: 0.8em;
    color: var(--quiz-primary-text);
    background: rgba(var(--quiz-primary-rgb), 0.1);
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.answer-card-audio {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 2px 4px;
    border-radius: 6px;
    opacity: 0.45;
    transition: opacity 0.15s, transform 0.15s;
    line-height: 1;
}
.answer-card-audio:hover {
    opacity: 0.8;
    transform: scale(1.15);
}
.answer-card-audio:active {
    transform: scale(0.95);
}

/* Row 2: Roma · English */
.answer-card-row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95em;
    margin-top: 1px;
}

.answer-card-roma {
    color: #78716c;
    font-weight: 500;
    font-style: italic;
}

.answer-card-sep {
    color: rgba(0, 0, 0, 0.2);
}

.answer-card-english {
    color: #57534e;
    font-weight: 500;
}


/* Feedback text animations */
.quiz-feedback.correct {
    animation: feedbackSlideIn 0.3s ease-out forwards;
}

.quiz-feedback.incorrect {
    animation: feedbackSlideIn 0.3s ease-out forwards;
}

@keyframes feedbackSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Confetti container */
.quiz-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 100;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
}

@keyframes confettiBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--end-x), var(--end-y)) rotate(540deg) scale(0.3);
    }
}

/* Results screen celebration confetti - longer, more dramatic */
@keyframes confettiResultsBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--end-x), var(--end-y)) rotate(720deg) scale(0.2);
    }
}

.confetti-results {
    /* Slightly larger for results celebration */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* ===== SAKURA PETAL BURST (replaces confetti on streaks 3+) ===== */
.sakura-petal {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sakura-petal::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: var(--petal-color, #FFB7C5);
    border-radius: 50% 0 50% 50%;
    transform: rotate(-45deg);
}

@keyframes sakuraFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translate(var(--end-x), var(--end-y)) rotate(var(--end-rot, 360deg)) scale(0.4);
    }
}

/* ===== KINTSUGI GOLD-REPAIR (金継ぎ) ===== */
/* Kintsugi 金継ぎ — simplified gold repair */
/* Wrong answer: thin gold bottom-border fades in */
.kintsugi-border {
    border-bottom: 2px solid transparent;
    animation: kintsugiReveal 0.6s ease-out forwards;
}

@keyframes kintsugiReveal {
    from { border-bottom-color: transparent; }
    to   { border-bottom-color: #C9A96E; }
}

/* Redemption shimmer — previously-wrong word answered correctly */
.kintsugi-shimmer {
    position: relative;
    overflow: hidden;
}

.kintsugi-shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, transparent 30%, rgba(201, 169, 110, 0.18) 50%, transparent 70%);
    animation: kintsugiShimmer 0.6s ease-in-out;
    pointer-events: none;
}

@keyframes kintsugiShimmer {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    30% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ===== 墨流し (Suminagashi) — Ink-bleed question reveal ===== */

/* Ink reveal — text fades in with subtle turbulence filter */
.sumi-entering {
    animation: sumiReveal 0.3s ease-out forwards;
    filter: url(#suminagashi);
}

@keyframes sumiReveal {
    from {
        opacity: 0;
        filter: url(#suminagashi) blur(2px);
    }
    to {
        opacity: 1;
        filter: none;
    }
}

/* Text "sets" — settled state, filter removed for perf */
.sumi-set {
    opacity: 1;
    filter: none;
}

/* Ink disperses on wrong answer — blur fade */
.sumi-disperse {
    animation: sumiDisperse 0.4s ease-in forwards;
}

@keyframes sumiDisperse {
    from {
        opacity: 1;
        filter: none;
    }
    50% {
        opacity: 0.6;
        filter: blur(1.5px);
    }
    to {
        opacity: 0.85;
        filter: none;
    }
}

/* Graceful degradation: if SVG filter not available, just use opacity */
@supports not (filter: url(#suminagashi)) {
    .sumi-entering {
        filter: none;
        animation: sumiRevealFallback 0.3s ease-out forwards;
    }
    @keyframes sumiRevealFallback {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .quiz-answer-btn.correct,
    .quiz-answer-btn.incorrect {
        animation: none;
    }

    .quiz-answer-btn:hover:not(:disabled) {
        transform: none;
    }

    .quiz-feedback.correct,
    .quiz-feedback.incorrect {
        animation: none;
    }

    .confetti-piece,
    .sakura-petal {
        display: none;
    }

    .kintsugi-border {
        animation: none;
        border-bottom-color: #C9A96E;
    }

    .kintsugi-shimmer::after {
        animation: none;
    }

    .quiz-modal::before,
    .quiz-modal::after {
        animation: none;
    }

    .quiz-start-icon {
        animation: none;
    }

    .quiz-results-icon {
        animation: none;
    }

    .quiz-streak-fire {
        animation: none;
    }

    .quiz-score-value {
        animation: none;
    }

    .quiz-progress-segment.current {
        animation: none;
        opacity: 0.6;
    }

    .quiz-timer-ring.timer-warning .timer-progress,
    .quiz-timer-ring.timer-critical .timer-progress,
    .quiz-timer-ring.timer-urgent .timer-progress,
    .quiz-timer-ring.timer-critical .timer-seconds,
    .quiz-timer-ring.timer-urgent .timer-seconds,
    .quiz-timer-ring.timer-critical .timer-glow,
    .quiz-timer-ring.timer-urgent .timer-glow,
    .speed-streak .streak-fire {
        animation: none;
    }

    .quiz-start-btn::before {
        display: none;
    }

    .quiz-hint-btn:active {
        transform: none;
    }
}

/* Audio Question Styling */

/* Hide context hint for audio questions — ensō + instruction is self-evident */
.quiz-question-screen.audio-mode .quiz-context-hint {
    display: none;
}

/* Hide character emoji in context hint for audio (scenario text carries its own context) */
.quiz-question-screen.audio-mode .quiz-context-hint .context-character {
    display: none;
}

/* Hide hint bar entirely for audio questions */
.quiz-question-screen.audio-mode .quiz-hint-bar {
    display: none;
}
.quiz-question-screen.audio-mode .quiz-hint {
    display: none;
}

.quiz-audio-question {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 24px 8px;
}

/* Audio player container */
.audio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Wrapper — ensō brushstroke circle + button */
.audio-btn-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensō brushstroke ring (SVG sits behind button) */
.enso-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Subtle pulse on the ensō ring while playing */
.audio-btn-wrapper.playing .enso-ring {
    animation: ensoPulse 2s ease-in-out infinite;
}

@keyframes ensoPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* Play button — transparent, lives inside the ensō */
.quiz-audio-play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
    z-index: 2;
}

.quiz-audio-play-btn:hover {
    transform: scale(1.03);
}

.quiz-audio-play-btn:active {
    transform: scale(0.97);
}

/* Idle icon — SVG speaker */
.quiz-audio-play-btn .audio-icon-idle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-audio-play-btn .audio-icon-idle svg {
    width: 22px;
    height: 22px;
}

/* Playing icon — hidden by default */
.quiz-audio-play-btn .audio-icon-playing {
    display: none;
}

/* State swap when playing */
.audio-btn-wrapper.playing .quiz-audio-play-btn .audio-icon-idle {
    display: none;
}

.audio-btn-wrapper.playing .quiz-audio-play-btn .audio-icon-playing {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Equalizer bars — calmer, 4 bars */
.equalizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}

.eq-bar {
    width: 3px;
    height: 100%;
    background: #3D5A80;
    border-radius: 1.5px;
    transform: scaleY(0.25);
}

.audio-btn-wrapper.playing .eq-bar {
    animation: eqBounce 1s ease-in-out infinite alternate;
}

.audio-btn-wrapper.playing .eq-bar:nth-child(1) { animation-delay: 0s; }
.audio-btn-wrapper.playing .eq-bar:nth-child(2) { animation-delay: 0.2s; }
.audio-btn-wrapper.playing .eq-bar:nth-child(3) { animation-delay: 0.4s; }
.audio-btn-wrapper.playing .eq-bar:nth-child(4) { animation-delay: 0.2s; }

@keyframes eqBounce {
    0%   { transform: scaleY(0.25); }
    100% { transform: scaleY(0.85); }
}

/* Label below the button */
.audio-player .audio-label {
    font-size: 0.7em;
    color: #b0aaa4;
    font-weight: 400;
    min-height: 1.2em;
}

.quiz-audio-instruction {
    font-size: 0.95em;
    color: #57534e;
    text-align: center;
    margin: 0;
}

/* ===== SCENE-FIRST QUESTION ===== */
.quiz-scene-question {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.scene-image-wrap {
    width: 100%;
    max-width: 320px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.scene-image {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.scene-instruction {
    font-size: 1.05em;
    color: var(--quiz-text-muted-hover);
    text-align: center;
    margin: 0;
}

/* Context Hint - warm, quiet */
.quiz-context-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(240, 237, 232, 0.5);
    border-radius: 8px;
    margin: 12px 0 4px;
    animation: fadeInUp 0.3s ease;
}

.quiz-context-hint.hidden {
    display: none;
}

.quiz-context-hint .context-character {
    display: none;
}

.quiz-context-hint .context-text {
    font-size: 0.85em;
    color: #78716c;
    line-height: 1.5;
    font-style: italic;
}

/* Fill-in-the-blank — Ghost slot with thin ? */
/* Karesansui blank: just an underline, no card */
.quiz-blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3em;
    height: 1.4em;
    background: none;
    border-radius: 0;
    vertical-align: middle;
    margin: 0 3px;
    border-bottom: 2px solid rgba(61, 90, 128, 0.25);
    box-shadow: none;
}

.quiz-blank::after {
    display: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== QUIZ FURIGANA (SPAN-BASED) =====
   Uses <span class="ruby-group"> + <span class="ruby-rt"> instead of <ruby>/<rt>.
   Mobile WebKit treats <ruby>/<rt> as magic elements — CSS display, position,
   and flex-direction are silently overridden by native ruby layout.
   Plain <span> elements have no such interference.
   Desktop: inline + absolute positioning (reading floats above base).
   Mobile override in quiz-mobile.css: inline-flex + column-reverse. */

.quiz-question-text .ruby-group,
.quiz-answer-btn .ruby-group,
.quiz-answer-card .ruby-group,
.feedback-block-word .ruby-group,
.feedback-compare-word .ruby-group {
    display: inline;
    position: relative;
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    color: #44403c;
    letter-spacing: 0.03em;
}

.quiz-question-text .ruby-rt,
.quiz-answer-btn .ruby-rt,
.quiz-answer-card .ruby-rt,
.feedback-block-word .ruby-rt,
.feedback-compare-word .ruby-rt {
    display: block;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.6em;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.02em;
    opacity: 1;
    color: #6b6560;
    padding-bottom: 0.05em;
}

/* Extra line-height for ruby annotations between wrapped lines */
.quiz-question-text:has(.ruby-group) {
    line-height: 2.2;
    padding-top: 26px;
}

/* Answer buttons: allow ruby to overflow, add top padding */
.quiz-answer-btn:has(.ruby-group) {
    overflow: visible;
    padding-top: 18px;
}


.quiz-answer-btn .quiz-answer-text:has(.ruby-group) {
    line-height: 2.0;
}

/* Answer cards (post-submission): space for ruby above word text */
.answer-card-word:has(.ruby-group) {
    line-height: 2.0;
    padding-top: 10px;
}

/* Feedback hero word: space for ruby above */
.feedback-block-word:has(.ruby-group),
.feedback-compare-word:has(.ruby-group) {
    line-height: 2.0;
    padding-top: 14px;
}

