/* Common styles shared across all quiz pages */

/* Home button */
.home-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    padding: 8px 12px;
    background: white;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    z-index: 1000;
}

.home-btn:hover {
    background: #f3f4f6;
}

/* Selected state for fuzzy matching */
.selected {
    outline: 3px solid #3b82f6 !important;
    outline-offset: 2px;
    background: #dbeafe !important;
}

/* Common feedback styles */
.feedback {
    text-align: center;
    margin: 20px 0;
    font-size: 18px;
    font-weight: bold;
    min-height: 30px;
}

.feedback.correct {
    color: #28a745;
}

.feedback.incorrect {
    color: #dc3545;
}

/* Common button correct/incorrect states */
.option-btn.correct {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

.option-btn.incorrect {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

.option-btn.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Component breakdown display */
.component-breakdown {
    margin: 12px auto 0;
    max-width: 560px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    text-align: center;
    font-size: 16px;
    color: #374151;
}

.component-breakdown .component-title {
    font-weight: 600;
    font-size: 17px;
    margin-bottom: 8px;
    color: #1f2937;
}

.component-breakdown .component-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
}

.component-label {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #4b5563;
}

.component-tag {
    font-size: 28px;
    padding: 4px 10px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    min-width: 36px;
}

.component-radical {
    background: #fee2e2;
    color: #b91c1c;
}

.component-phonetic {
    background: #dbeafe;
    color: #1d4ed8;
}

.component-other {
    background: #fef3c7;
    color: #b45309;
}

.component-meaning {
    font-size: 15px;
    color: #4b5563;
}

.component-hint {
    margin-top: 10px;
    font-size: 14px;
    color: #6b7280;
}

#hint {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: opacity 0.2s ease;
}

.meaning-question-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin: 24px auto 16px;
    min-height: 260px;
    position: relative;
}

.meaning-question-layout.components-hidden .component-panel {
    display: none;
}

.component-panel {
    width: 180px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.component-panel-left {
    align-items: flex-end;
    text-align: right;
}

.component-panel-right {
    align-items: flex-start;
    text-align: left;
}

.component-chip {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(15, 23, 42, 0.08);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.component-chip-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4b5563;
    margin-bottom: 6px;
}

.component-chip-symbol {
    font-size: 36px;
    line-height: 1;
    font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
    margin-bottom: 6px;
}

.component-chip-meaning {
    font-size: 13px;
    line-height: 1.4;
    color: #1f2937;
}

.component-chip-pinyin {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 6px;
}

.chip-radical .component-chip-pinyin {
    color: #be185d;
}

.chip-phonetic .component-chip-pinyin {
    color: #1d4ed8;
}

.chip-other .component-chip-pinyin {
    color: #b45309;
}

.etymology-note-card {
    width: 260px;
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition: opacity 0.25s ease, transform 0.2s ease, position 0s 0s;
}

.etymology-note-card.hidden {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    position: absolute;
    bottom: 0;
    transition: opacity 0.25s ease, transform 0.2s ease, position 0s 0.25s;
}

.etymology-note-card .etymology-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #64748b;
    margin-bottom: 6px;
}

.etymology-note-card .etymology-header {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 10px;
}

.etymology-note-card .etymology-body {
    margin-top: 10px;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.5;
}

.chip-radical {
    background: #fde7ef;
    border-color: #fbcfe8;
    color: #be185d;
}

.chip-phonetic {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #1d4ed8;
}

.chip-other {
    background: #fef4e6;
    border-color: #fde0b8;
    color: #b45309;
}

.component-hint-chip {
    padding-top: 4px;
    font-size: 13px;
    line-height: 1.4;
    color: #4b5563;
}

.meaning-char-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    padding: 12px 0;
    position: relative;
}

.answer-summary-card {
    width: 260px;
    min-height: 110px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 12px rgba(15, 23, 42, 0.08);
    margin-bottom: 18px;
    opacity: 0;
    position: absolute;
    top: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, position 0s 0.25s;
}

.answer-summary-card.visible {
    opacity: 1;
    position: relative;
    pointer-events: auto;
    transition: opacity 0.25s ease, position 0s 0s;
}

.answer-summary-card.summary-correct {
    border-left: 4px solid #22c55e;
}

.answer-summary-card.summary-incorrect {
    border-left: 4px solid #ef4444;
}

.summary-card-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.summary-card-char {
    font-size: 34px;
    line-height: 1;
    color: #1f2937;
}

.summary-card-pinyin {
    font-size: 18px;
    font-weight: 600;
    color: #1d4ed8;
}

.summary-card-meaning {
    font-size: 15px;
    color: #374151;
    line-height: 1.45;
}

.question-char-display {
    font-size: 160px;
    line-height: 1;
    color: #111827;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 900px) {
    .meaning-question-layout {
        gap: 20px;
    }

    .component-panel {
        width: 45%;
        min-height: 160px;
    }

    .meaning-char-column {
        order: -1;
        min-height: 220px;
    }
}

@media (max-width: 640px) {
    .meaning-question-layout {
        flex-direction: column;
        min-height: 360px;
    }

    .component-panel {
        width: 100%;
        min-height: 0;
        align-items: center;
        text-align: center;
    }

    .question-char-display {
        font-size: 120px;
    }

    .answer-summary-card {
        width: 100%;
    }
}
