/* ===== RICH FEEDBACK (Mockup v3 style) ===== */
/* ============================================
   FEEDBACK SECTION - Premium Visual Polish
   ============================================ */
.quiz-feedback {
    border-radius: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    animation: shojiIn 0.35s ease-out;
}

.quiz-feedback:empty {
    min-height: 0;
    padding: 0;
    box-shadow: none;
}

/* Correct feedback — transparent, blends into modal surface (Shoji) */
.quiz-feedback.correct {
    background: transparent;
    border: none;
    position: relative;
}

.quiz-feedback.correct::before {
    content: '';
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--quiz-accent-correct, #4E6F3E);
}

/* Incorrect feedback — transparent, blends into modal surface (Shoji) */
.quiz-feedback.incorrect {
    background: transparent;
    border: none;
    position: relative;
}

.quiz-feedback.incorrect::before {
    content: '';
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: #C9A96E;
}

/* Kintsugi gold thread at bottom of incorrect feedback */
.quiz-feedback.incorrect::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #C9A96E, transparent);
    opacity: 0.25;
}

/* Feedback overlay content container */
.feedback-overlay-content {
    padding: 24px;
}

/* Single entrance — no staggered choreography */

/* Feedback header - icon + title */
.feedback-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.feedback-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
}

.feedback-icon.correct {
    background: rgba(163, 177, 138, 0.12);
    color: var(--quiz-accent-correct);
    box-shadow: none;
}

.feedback-icon.wrong {
    background: rgba(194, 130, 114, 0.12);
    color: var(--quiz-accent-incorrect);
    box-shadow: none;
}

.feedback-title {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.feedback-title.correct {
    color: var(--quiz-accent-correct);
}

.feedback-title.wrong {
    color: var(--quiz-accent-incorrect-deep);
}

/* Feedback body - answer + explanation */
.feedback-body {
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
}

.quiz-feedback.correct .feedback-body {
    background: rgba(163, 177, 138, 0.06);
    border-color: rgba(163, 177, 138, 0.12);
}

.quiz-feedback.incorrect .feedback-body {
    background: rgba(194, 130, 114, 0.03);
    border-color: rgba(194, 130, 114, 0.08);
}

/* Answer display */
.feedback-answer {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    color: #374151;
    line-height: 1.7;
}

/* (Legacy card comparison and row layouts removed in v4 cleanup) */

/* Word styling in feedback - Use Klee One for Japanese */
.feedback-word-jp {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 1.6em;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.feedback-word-jp.correct-text {
    color: var(--quiz-accent-correct-deep);
}

/* Wrong text styling */
.feedback-word-jp.wrong-text {
    color: #7c2d12;
}

.feedback-word-roman {
    font-family: 'Inter', sans-serif;
    color: #78716c;
    font-size: 16px;
    font-style: italic;
}

.feedback-word-en {
    font-family: 'Inter', sans-serif;
    color: var(--quiz-primary-text);
    font-size: 16px;
    font-weight: 600;
}

/* Explanation section - learning tip style (enhanced v2) */
.feedback-why {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-top: 18px;
    padding: 16px 18px;
    background: #F0EDE8;
    border-radius: 14px;
    border: 1.5px solid rgba(61, 90, 128, 0.15);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.feedback-why-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.feedback-why-text {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    color: #2C4A6E;
    line-height: 1.7;
}

.feedback-why-text strong {
    color: #1B3A5C;
    font-weight: 700;
}

/* Japanese text in why section */
.feedback-why-text .quiz-jp {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    color: #1f2937;
}

/* Feedback footer - continue button, right-aligned */
.feedback-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    padding-top: 18px;
    margin-top: 4px;
}

.feedback-mascot-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* Mascot avatar — hidden (Kotoba uses no mascot) */
.feedback-mascot-inline .mascot-avatar {
    display: none;
}

.feedback-mascot-inline .mascot-speech-inline {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: #8C8578;
    line-height: 1.45;
    font-weight: 500;
}

.feedback-mascot-inline .mascot-speech-inline.correct {
    color: var(--quiz-accent-correct);
    font-weight: 600;
}

/* Continue button — ghost gold (incorrect default) */
.feedback-continue-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    font-family: 'Klee One', 'Noto Sans JP', 'Inter', sans-serif;
    font-size: 1em;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    border-radius: 12px;
    /* Ghost gold — kintsugi repair accent */
    background: none;
    color: #57534e;
    border: 1px solid rgba(201, 169, 110, 0.35);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.feedback-continue-btn:hover {
    background: rgba(201, 169, 110, 0.1);
    border-color: #C9A96E;
}

.feedback-continue-btn:active {
    background: rgba(201, 169, 110, 0.15);
}

/* Correct — solid moss */
.feedback-continue-btn.correct-btn {
    background: var(--quiz-accent-correct, #4E6F3E);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feedback-continue-btn.correct-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.feedback-continue-btn.correct-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Finish — solid moss (same as correct) */
.feedback-continue-btn.finish {
    background: var(--quiz-accent-correct, #4E6F3E);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* (Minimal feedback layout removed — Karesansui uses only shoji) */

/* (Banner feedback layouts removed — Karesansui uses only shoji) */

/* Shared elements still used by shoji layout */
.feedback-block-pitch {
    display: flex;
    justify-content: center;
    margin: 2px 0 4px;
    opacity: 0.7;
}

.feedback-audio-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #57534e;
    transition: color 0.2s;
    vertical-align: middle;
    margin: 0;
    display: inline-flex;
}
.feedback-audio-btn:hover {
    color: #C9A96E;
}
.feedback-audio-btn svg {
    display: block;
}

.pitch-contour {
    display: block;
}

.feedback-block-word {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 1.6em;
    font-weight: 600;
    color: var(--quiz-accent-correct-deep);
    margin-bottom: 4px;
}

/* ============================================
   SHOJI LAYOUT — Paper Panel, Left-Aligned
   和の感性 feedback redesign
   ============================================ */

.feedback-shoji {
    padding: 24px 28px 20px;
}

/* Header — dot + status text */
.feedback-shoji-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.feedback-shoji-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.quiz-feedback.correct .feedback-shoji-dot {
    background: var(--quiz-accent-correct, #4E6F3E);
}

.quiz-feedback.incorrect .feedback-shoji-dot {
    background: var(--quiz-accent-incorrect, #A3604E);
}

.feedback-shoji-status {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.feedback-shoji-status-jp {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.feedback-shoji-status-jp ruby rt {
    font-size: 0.65em;
}

.feedback-shoji-status-en {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.03em;
    opacity: 0.55;
}

.quiz-feedback.correct .feedback-shoji-status-jp {
    color: var(--quiz-accent-correct, #4E6F3E);
}

.quiz-feedback.correct .feedback-shoji-status-en {
    color: var(--quiz-accent-correct, #4E6F3E);
}

.quiz-feedback.incorrect .feedback-shoji-status-jp {
    color: var(--quiz-accent-incorrect, #A3604E);
}

.quiz-feedback.incorrect .feedback-shoji-status-en {
    color: var(--quiz-accent-incorrect, #A3604E);
}

/* Word area — left-aligned like calligraphy */
.feedback-shoji-word-area {
    margin-bottom: 16px;
}

.feedback-shoji-word {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 1.8em;
    font-weight: 400;
    color: var(--quiz-accent-correct, #4E6F3E);
    letter-spacing: 0.04em;
    margin-bottom: 2px;
    line-height: 1.4;
}

/* Ensure entire word is green — override global .quiz-jp color */
.feedback-shoji-word .quiz-jp {
    color: inherit;
}

/* Ruby positioning in Shoji word + compare displays */
.feedback-shoji-word .ruby-group,
.feedback-shoji-compare-word .ruby-group {
    display: inline;
    position: relative;
}

.feedback-shoji-word .ruby-group .ruby-rt,
.feedback-shoji-compare-word .ruby-group .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;
    color: #8C8578;
    padding-bottom: 0.05em;
}

.feedback-shoji-word:has(.ruby-group) {
    line-height: 2.0;
    padding-top: 10px;
}

.feedback-shoji-compare-word:has(.ruby-group) {
    padding-top: 12px;
    line-height: 1.8;
}

/* Meta row — romanization + pitch + audio inline */
.feedback-shoji-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
    margin-bottom: 2px;
}

.feedback-shoji-roma {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #b0aaa4;
    font-style: italic;
    letter-spacing: 0.02em;
}

/* Inline pitch contour in meta row */
.feedback-shoji-meta .feedback-block-pitch {
    display: inline-flex;
    margin: 0;
    opacity: 0.7;
}

/* Audio button in meta row — inline */
.feedback-shoji-meta .feedback-audio-btn {
    display: inline-flex;
    margin: 0;
    padding: 2px;
}

.feedback-shoji-en {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    color: #57534e;
    margin-top: 2px;
}

/* Fold divider — directional fade */
.feedback-shoji-fold {
    height: 1px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 0%, transparent 100%);
    margin-bottom: 14px;
}

/* Insight text */
.feedback-shoji-insight {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    color: #57534e;
    line-height: 1.7;
    margin-bottom: 18px;
}

.feedback-shoji-insight .quiz-jp {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    color: var(--quiz-accent-correct-deep, #3f5229);
    font-weight: 600;
    background: rgba(163, 177, 138, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
}

.feedback-shoji-insight .quiz-quoted {
    color: #2C4A6E;
    background: rgba(61, 90, 128, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}

/* ─── Compare: side-by-side for incorrect ─── */
.feedback-shoji-compare {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.feedback-shoji-compare-item {
    flex: 1;
}

.feedback-shoji-compare-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}

.feedback-shoji-compare-item.picked .feedback-shoji-compare-label {
    color: #8C8578;
}

.feedback-shoji-compare-item.answer .feedback-shoji-compare-label {
    color: var(--quiz-accent-correct, #4E6F3E);
}

.feedback-shoji-compare-word {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
    font-size: 1.4em;
    font-weight: 500;
    margin-bottom: 2px;
    line-height: 1.4;
}

.feedback-shoji-compare-item.picked .feedback-shoji-compare-word {
    color: #8C8578;
}

.feedback-shoji-compare-item.answer .feedback-shoji-compare-word {
    color: var(--quiz-accent-correct-deep, #3f5229);
}

/* Meta row — romanization + audio inline */
.feedback-shoji-compare-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.feedback-shoji-compare-roma {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #b0aaa4;
    font-style: italic;
    letter-spacing: 0.02em;
}

.feedback-shoji-compare-meta .feedback-audio-btn {
    display: inline-flex;
    margin: 0;
    padding: 2px;
}

.feedback-shoji-compare-en {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: #57534e;
    margin-top: 2px;
}

/* Pitch in compare answer item */
.feedback-shoji-compare-item.answer .feedback-block-pitch {
    display: inline-flex;
    margin: 2px 0;
    opacity: 0.7;
}

/* ─── Shoji footer + button overrides ─── */
.feedback-shoji .feedback-footer {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

/* Incorrect: gold ghost button (kintsugi repair) — full-width */
.feedback-shoji-incorrect .feedback-continue-btn {
    background: none;
    border: 1.5px solid rgba(201, 169, 110, 0.3);
    color: #57534e;
    box-shadow: none;
    font-weight: 600;
}

.feedback-shoji-incorrect .feedback-continue-btn:hover {
    background: rgba(201, 169, 110, 0.08);
    border-color: rgba(201, 169, 110, 0.5);
    color: #2C2C2C;
}

.feedback-shoji-incorrect .feedback-continue-btn:active {
    background: rgba(201, 169, 110, 0.12);
}

/* Word story in Shoji layout */

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

@media (prefers-reduced-motion: reduce) {
    .feedback-shoji-header,
    .feedback-shoji-word-area,
    .feedback-shoji-fold,
    .feedback-shoji-insight,
    .feedback-shoji-compare,
    .feedback-shoji .feedback-footer,
    .feedback-shoji .feedback-story-hint {
        animation: none !important;
    }
}

/* (Celebration feedback layout removed — Karesansui uses only shoji) */

/* Correct continue button — solid moss */
.feedback-continue-btn.correct-btn {
    background: var(--quiz-accent-correct);
}

/* ============================================
   WORD STORY HINT — Collapsible in feedback
   ============================================ */
.feedback-story-hint {
    margin-bottom: 16px;
    border-radius: 0;
    background: none;
    border: none;
    overflow: visible;
}

.feedback-story-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid rgba(201, 169, 110, 0.2);
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Klee One', 'Noto Sans JP', 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #57534e;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.feedback-story-toggle:hover {
    background: rgba(201, 169, 110, 0.06);
    border-color: rgba(201, 169, 110, 0.35);
}


.feedback-story-toggle-text {
    flex: 1;
}

/* Arrow removed — toggle uses expand/collapse text only */

/* Collapsed by default */
.feedback-story-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 14px;
}

.feedback-story-hint.expanded .feedback-story-content {
    max-height: 500px;
    padding: 10px 14px 14px;
}

/* Reuse existing bubble styling, adapted for feedback context */
.feedback-story-bubble {
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.feedback-story-bubble:last-child {
    margin-bottom: 0;
}

.feedback-story-bubble-label {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 4px;
}

.feedback-story-bubble-text {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: #57534e;
}

/* Story bubbles — neutral, differentiated by label text only */
.feedback-story-bubble {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.04);
}
.feedback-story-bubble .feedback-story-bubble-label { color: #57534e; }

/* Japanese text in story bubbles */
.feedback-story-bubble-text .kanji-term {
    font-family: 'Klee One', 'Noto Sans JP', sans-serif;
}
.feedback-story-bubble-text .inline-romaji {
    color: #78716c;
    font-size: 0.9em;
}

