/* ================================================
 * Reading Result 통합 스타일
 * 기준: 디자인 레퍼런스 파일 (daily1, daily2, academic 해설.txt)
 * prefix: rd-
 * 적용 대상: #daily1ExplainScreen, #daily2ExplainScreen, #academicExplainScreen
 * ================================================ */

/* ── 변수 ── */
#daily1ExplainScreen,
#daily2ExplainScreen,
#academicExplainScreen {
    --rd-purple: #9480c5;
    --rd-purple-light: #b3a4d9;
    --rd-green: #77bf7e;
    --rd-green-dark: #5a9a60;
    --rd-bg: #f1f4f8;
    --rd-white: #ffffff;
    --rd-text: #2d3436;
    --rd-gray: #636e72;
    --rd-red: #e57373;
    --rd-red-dark: #c65e5e;
    --rd-shadow: 0 8px 24px rgba(149, 157, 165, 0.1);
    --rd-ambient: 0 12px 32px rgba(148, 128, 197, 0.05);
    --rd-radius: 16px;
    --rd-card-radius: 20px;
    padding: 24px 48px;
}

/* ── 레이아웃 ── */
#daily1ExplainScreen .test-content,
#daily2ExplainScreen .test-content,
#academicExplainScreen .test-content {
    width: 100%;
}

#daily1ExplainScreen .result-container,
#daily2ExplainScreen .result-container,
#academicExplainScreen .result-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0;
}

/* ── 헤더 섹션 ── */
#daily1ExplainScreen .result-header,
#daily2ExplainScreen .result-header,
#academicExplainScreen .result-header {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    text-align: left;
    display: block;
    margin-bottom: 16px;
    border-bottom: none;
}

#daily1ResultDayTitle,
#daily2ResultDayTitle,
#academicResultDayTitle {
    margin: 0 0 24px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--rd-purple);
    letter-spacing: -0.02em;
}

#daily1ExplainScreen .result-summary,
#daily2ExplainScreen .result-summary,
#academicExplainScreen .result-summary {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    gap: 16px;
    width: 100%;
}

#daily1ExplainScreen .result-score-card,
#daily2ExplainScreen .result-score-card,
#academicExplainScreen .result-score-card {
    background: var(--rd-purple);
    color: white;
    padding: 32px 24px;
    border-radius: 24px;
    flex: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 12px 24px rgba(148, 128, 197, 0.2);
    border: none;
    margin-bottom: 0;
}

#daily1ExplainScreen .score-label,
#daily2ExplainScreen .score-label,
#academicExplainScreen .score-label {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 8px;
}

#daily1ExplainScreen .score-value,
#daily2ExplainScreen .score-value,
#academicExplainScreen .score-value {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

#daily1ExplainScreen .result-score-card .score-value,
#daily2ExplainScreen .result-score-card .score-value,
#academicExplainScreen .result-score-card .score-value {
    color: white;
}

#daily1ExplainScreen .result-stats,
#daily2ExplainScreen .result-stats,
#academicExplainScreen .result-stats {
    flex: 2.8;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

#daily1ExplainScreen .stat-item,
#daily2ExplainScreen .stat-item,
#academicExplainScreen .stat-item {
    background: var(--rd-white);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-shadow: var(--rd-ambient);
    border: none;
}

#daily1ExplainScreen .stat-label,
#daily2ExplainScreen .stat-label,
#academicExplainScreen .stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--rd-gray);
    margin-bottom: 12px;
}

#daily1ExplainScreen .stat-value,
#daily2ExplainScreen .stat-value,
#academicExplainScreen .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--rd-text);
}

#daily1ExplainScreen .stat-value.correct,
#daily2ExplainScreen .stat-value.correct,
#academicExplainScreen .stat-value.correct {
    color: var(--rd-green);
}

#daily1ExplainScreen .stat-value.incorrect,
#daily2ExplainScreen .stat-value.incorrect,
#academicExplainScreen .stat-value.incorrect {
    color: var(--rd-red);
}

/* ── 세트 섹션 ── */
#daily1ExplainScreen .result-set-section,
#daily2ExplainScreen .result-set-section,
#academicExplainScreen .result-set-section {
    margin-top: 24px;
    margin-bottom: 0;
}

#daily1ExplainScreen .result-section-title,
#daily2ExplainScreen .result-section-title,
#academicExplainScreen .result-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--rd-text);
    padding-bottom: 0;
    border-bottom: none;
    letter-spacing: -0.02em;
}

#daily1ExplainScreen .result-section-title i,
#daily2ExplainScreen .result-section-title i,
#academicExplainScreen .result-section-title i {
    color: var(--rd-purple);
}

/* ── 지문 패널 ── */
.rd-passage-panel {
    background: var(--rd-white);
    padding: 32px;
    border-radius: var(--rd-radius);
    box-shadow: var(--rd-shadow);
    margin-bottom: 24px;
}

.result-passage-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 24px;
    color: var(--rd-text);
    text-align: center;
    letter-spacing: -0.02em;
}

.sentence-translations {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sentence-pair {
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f4f8;
}

.sentence-pair:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sentence-original {
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: var(--rd-text);
}

.sentence-translation {
    font-size: 0.95rem;
    color: var(--rd-gray);
}

/* ── 인터랙티브 단어 ── */
.interactive-word {
    color: var(--rd-purple);
    font-weight: 600;
    text-decoration: underline;
    cursor: help;
    padding: 0 2px;
    transition: all 0.15s;
}

.interactive-word:hover {
    background: rgba(148, 128, 197, 0.1);
}

/* ── 툴팁 ── */
.rd-tooltip {
    position: absolute;
    z-index: 1000;
    background: #ffffff;
    color: #2d3436;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    max-width: 280px;
    font-size: 13px;
    line-height: 1.5;
    pointer-events: none;
}

.tooltip-translation {
    font-weight: 600;
    margin-bottom: 4px;
    color: #2d3436;
}

.tooltip-explanation {
    font-size: 12px;
    color: #636e72;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #e5e7eb;
}

/* ── 문제 카드 ── */
.rd-result-item {
    background: var(--rd-white);
    border-radius: var(--rd-radius);
    box-shadow: var(--rd-shadow);
    margin-bottom: 16px;
    padding: 24px;
    display: flex;
    gap: 20px;
    border: none;
}

.rd-result-item.correct {
    background: var(--rd-white);
}

.rd-result-item.incorrect {
    background: var(--rd-white);
}

.rd-result-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.rd-result-item.correct .rd-result-icon {
    color: var(--rd-purple);
}

.rd-result-item.incorrect .rd-result-icon {
    color: var(--rd-red);
}

.rd-result-content {
    flex-grow: 1;
}

/* ── 문제 텍스트 ── */
.rd-question-text {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--rd-text);
}

.rd-question-text strong {
    font-weight: 700;
    margin-right: 8px;
}

/* ── 문제 해석 ── */
.question-translation {
    font-size: 0.9rem;
    color: var(--rd-gray);
    background: #f8f9fa;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.question-translation i {
    display: inline;
}

/* ── 답변 영역 ── */
.rd-answer-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
}

.rd-answer-label {
    color: var(--rd-gray);
}

.rd-answer-value {
    color: var(--rd-text);
}

.rd-answer-value.correct {
    color: var(--rd-purple);
}

.rd-answer-value.incorrect {
    color: var(--rd-red);
}

/* ── 보기 해설 아코디언 ── */
.options-explanation-container {
    margin-top: 24px;
}

.btn-toggle-options {
    background: #f1f4f8;
    border: 1px solid transparent;
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--rd-gray);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-toggle-options:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.btn-toggle-options:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-toggle-options.is-active {
    background: var(--rd-white);
    box-shadow: 0 4px 12px rgba(148, 128, 197, 0.1);
    border-color: rgba(148, 128, 197, 0.2);
    color: var(--rd-purple);
}

.btn-toggle-options i {
    font-size: 12px;
    transition: transform 0.2s;
}

.options-explanation-content {
    margin-top: 12px;
    padding: 24px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

/* ── 보기 아이템 ── */
.option-item {
    margin-bottom: 32px;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.option-label {
    font-weight: 700;
    color: var(--rd-purple);
    font-size: 1.1rem;
}

.option-text {
    flex-grow: 1;
    color: var(--rd-text);
    font-size: 1.05rem;
    font-weight: 600;
}

.option-badge {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.correct-badge {
    background: rgba(148, 128, 197, 0.1);
    color: var(--rd-purple);
}

.incorrect-badge {
    background: rgba(229, 115, 115, 0.1);
    color: var(--rd-red);
}

/* ── 보기 번역 ── */
.option-translation {
    font-size: 0.9rem;
    color: var(--rd-gray);
    margin-bottom: 14px;
    padding-left: 28px;
    font-style: italic;
    opacity: 0.85;
}

/* ── 보기 해설 ── */
.option-explanation {
    padding: 18px 22px;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.7;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.option-explanation.correct {
    background: rgba(119, 191, 126, 0.08);
    color: var(--rd-green-dark);
}

.option-explanation.incorrect {
    background: rgba(229, 115, 115, 0.06);
    color: var(--rd-red-dark);
}

.option-explanation strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: inherit;
    font-weight: 700;
}

.option-explanation strong i {
    font-size: 0.9rem;
}

/* ── 반응형 ── */
@media (max-width: 768px) {
    #daily1ExplainScreen,
    #daily2ExplainScreen,
    #academicExplainScreen {
        padding: 16px;
    }

    #daily1ExplainScreen .result-summary,
    #daily2ExplainScreen .result-summary,
    #academicExplainScreen .result-summary {
        flex-direction: column;
        align-items: stretch;
    }

    #daily1ExplainScreen .result-stats,
    #daily2ExplainScreen .result-stats,
    #academicExplainScreen .result-stats {
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }

    #daily1ExplainScreen .result-score-card,
    #daily2ExplainScreen .result-score-card,
    #academicExplainScreen .result-score-card {
        width: 100%;
    }

    .rd-result-item {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .option-explanation {
        margin-left: 0;
    }

    .option-translation {
        padding-left: 20px;
    }

    .btn-toggle-options {
        padding: 12px 14px;
    }

    .rd-tooltip {
        max-width: 240px;
        font-size: 12px;
    }

    .rd-passage-panel {
        padding: 20px;
    }

    #daily1ExplainScreen .result-section-title,
    #daily2ExplainScreen .result-section-title,
    #academicExplainScreen .result-section-title {
        font-size: 1.1rem;
    }

    .rd-question-text {
        font-size: 1rem;
    }

    .sentence-original {
        font-size: 0.95rem;
    }

    .sentence-translation {
        font-size: 0.85rem;
    }

    .question-translation {
        font-size: 0.85rem;
    }

    .option-header {
        flex-wrap: wrap;
    }
}

/* ============================================
   재풀이 (Retry) UI
   ============================================ */

.retry-section {
    margin-top: 12px;
    padding: 16px;
    background: #f8f7fc;
    border-radius: 12px;
    border: 1.5px solid #e8e4f0;
}

.retry-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: #7c6bb5;
    margin-bottom: 12px;
}

.retry-header i {
    margin-right: 6px;
}

.retry-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.retry-option-btn {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1.5px solid #e0dce8;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 0.92rem;
    color: #2d3436;
    transition: all 0.15s ease;
    line-height: 1.5;
}

.retry-option-btn:hover:not(:disabled) {
    border-color: #9480c5;
    background: #f5f3fa;
}

.retry-option-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.retry-option-label {
    font-weight: 600;
    color: #7c6bb5;
    flex-shrink: 0;
}

.retry-option-text {
    flex: 1;
}

/* 비활성 (이미 선택한 오답) */
.retry-option-btn.retry-disabled {
    cursor: default;
    opacity: 0.5;
}

.retry-option-btn.retry-wrong-selected {
    border-color: #e57373;
    background: #fef2f2;
    text-decoration: line-through;
    opacity: 0.6;
}

/* 정답 맞춘 보기 */
.retry-option-btn.retry-correct-selected {
    border-color: #77bf7e;
    background: #f0faf0;
    opacity: 1;
}

/* 잠금 영역 (정답행 + 해설) */
.retry-locked-area {
    margin-top: 12px;
}

.retry-locked-area .rd-answer-row {
    font-size: 0.92rem;
}

/* 피드백 메시지 */
.retry-feedback {
    min-height: 0;
    margin-bottom: 8px;
}

.retry-feedback:empty {
    display: none;
}

.retry-feedback-correct {
    color: #2d9a3e;
    font-weight: 600;
    font-size: 0.9rem;
}

.retry-feedback-correct i {
    margin-right: 4px;
}

.retry-feedback-wrong {
    color: #d32f2f;
    font-weight: 600;
    font-size: 0.9rem;
}

.retry-feedback-wrong i {
    margin-right: 4px;
}

/* 모바일 */
@media (max-width: 768px) {
    .retry-section {
        padding: 12px;
    }
    
    .retry-option-btn {
        padding: 10px 12px;
        font-size: 0.88rem;
    }
}

/* ============================================
   Academic Result — 유형별 해설 스타일
   v2: 뱃지, 지문확인 버튼, 마커 하이라이트, insertion 재풀이
   ============================================ */

/* ── 유형 뱃지 ── */
.ac-res-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-right: 8px;
    position: relative;
    top: -1px;
}

.ac-res-badge-highlight {
    background: rgba(148, 128, 197, 0.12);
    color: #7c6bb5;
    border: 1px solid rgba(148, 128, 197, 0.25);
}

.ac-res-badge-simplification {
    background: rgba(80, 201, 255, 0.12);
    color: #2a8ab5;
    border: 1px solid rgba(80, 201, 255, 0.25);
}

.ac-res-badge-insertion {
    background: rgba(0, 102, 136, 0.1);
    color: #006688;
    border: 1px solid rgba(0, 102, 136, 0.2);
}

.ac-res-badge-select_sentence {
    background: rgba(34, 139, 34, 0.1);
    color: #1a7a1a;
    border: 1px solid rgba(34, 139, 34, 0.2);
}

/* ── "지문에서 확인하기" / "지문에서 다시 풀기" 버튼 ── */
.ac-res-btn-passage {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin: 12px 0;
    background: #f5f3fa;
    color: #7c6bb5;
    border: 1.5px solid #e0dce8;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ac-res-btn-passage:hover {
    background: #ebe7f5;
    border-color: #9480c5;
    transform: translateY(-1px);
}

.ac-res-btn-passage:active {
    transform: translateY(0);
}

.ac-res-btn-passage i {
    font-size: 0.85rem;
}

.ac-res-btn-retry-insertion {
    background: rgba(0, 102, 136, 0.06);
    color: #006688;
    border-color: rgba(0, 102, 136, 0.2);
}

.ac-res-btn-retry-insertion:hover {
    background: rgba(0, 102, 136, 0.12);
    border-color: #006688;
}

/* ── 지문 마커 레이어 ── */
.ac-passage-marker-layer {
    padding: 20px 24px;
    margin-bottom: 20px;
    background: #faf9fd;
    border-radius: 12px;
    border: 1px solid #eae7f2;
    font-size: 1.02rem;
    line-height: 1.85;
    color: #2d3436;
}

/* ── 마커 기본 (숨김) ── */
.ac-res-highlight-word,
.ac-res-simplification,
.ac-res-insertion-marker,
.ac-res-ss-marker {
    /* 기본: 일반 텍스트처럼 보임 */
    transition: all 0.3s ease;
}

/* ── highlight 활성화 ── */
.ac-res-highlight-word.ac-res-highlight-active {
    background-color: rgba(148, 128, 197, 0.2);
    color: #5a4a8a;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 4px;
    border-bottom: 2px solid #9480c5;
}

/* ── simplification 활성화 ── */
.ac-res-simplification.ac-res-simplification-active {
    background-color: rgba(80, 201, 255, 0.2);
    color: #1a6a8a;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 4px;
}

/* ── insertion/select_sentence 마커 기본 (숨김) ── */
.ac-res-insertion-marker,
.ac-res-ss-marker {
    display: none;
}

/* ── 마커 활성화 (보임) ── */
.ac-res-insertion-marker.ac-res-marker-active,
.ac-res-ss-marker.ac-res-marker-active {
    display: inline-block;
    background: rgba(100, 100, 120, 0.08);
    color: #555;
    font-weight: 600;
    padding: 2px 10px;
    border: 1.5px dashed rgba(100, 100, 120, 0.3);
    border-radius: 5px;
    margin: 0 3px;
    font-size: 0.9em;
    line-height: inherit;
    vertical-align: baseline;
}

/* ── 마커 클릭 가능 (insertion 재풀이) ── */
.ac-res-insertion-marker.ac-res-marker-clickable {
    cursor: pointer;
    border-style: dashed;
    border-color: #006688;
    color: #006688;
    background: rgba(0, 102, 136, 0.06);
}

.ac-res-insertion-marker.ac-res-marker-clickable:hover {
    background: rgba(0, 102, 136, 0.15);
    border-style: solid;
    transform: scale(1.05);
}

/* ── 마커 정답 (초록) ── */
.ac-res-insertion-marker.ac-res-marker-correct,
.ac-res-ss-marker.ac-res-marker-correct {
    background: rgba(77, 175, 80, 0.15);
    color: #2e7d32;
    border: 1.5px solid #4caf50;
    font-weight: 700;
}

/* ── 마커 오답 (빨강) ── */
.ac-res-insertion-marker.ac-res-marker-wrong,
.ac-res-ss-marker.ac-res-marker-wrong {
    background: rgba(229, 115, 115, 0.15);
    color: #c62828;
    border: 1.5px solid #e57373;
    font-weight: 600;
    text-decoration: line-through;
}

/* ── insertion 삽입 문장 박스 (문제 카드 안) ── */
.ac-res-insertion-box {
    margin: 12px 0 16px;
    padding: 16px 20px;
    background: rgba(0, 102, 136, 0.04);
    border: 1px solid rgba(0, 102, 136, 0.15);
    border-radius: 10px;
    border-left: 3px solid #006688;
}

.ac-res-insertion-box-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #006688;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.ac-res-insertion-box-label i {
    margin-right: 4px;
}

.ac-res-insertion-box-text {
    font-size: 0.98rem;
    line-height: 1.7;
    color: #2d3436;
}

/* ── insertion 재풀이 안내 ── */
.ac-res-insertion-retry-guide {
    margin-top: 12px;
    text-align: center;
}

.ac-res-insertion-retry-guide p {
    font-size: 0.9rem;
    color: #636e72;
    margin: 0 0 12px 0;
}

/* ── 플로팅 삽입 문장 (지문 상단) ── */
.ac-res-floating-sentence {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 0 16px 0;
    padding: 14px 20px;
    background: linear-gradient(135deg, #006688 0%, #007fa3 100%);
    color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 102, 136, 0.25);
}

.ac-res-floating-label {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: 6px;
    letter-spacing: 0.03em;
}

.ac-res-floating-label i {
    margin-right: 4px;
}

.ac-res-floating-text {
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 500;
}

/* ── 반응형 ── */
@media (max-width: 768px) {
    .ac-res-type-badge {
        font-size: 0.65rem;
        padding: 2px 8px;
    }

    .ac-res-btn-passage {
        font-size: 0.82rem;
        padding: 7px 12px;
    }

    .ac-passage-marker-layer {
        padding: 14px 16px;
        font-size: 0.95rem;
    }

    .ac-res-insertion-box {
        padding: 12px 14px;
    }

    .ac-res-floating-sentence {
        padding: 10px 14px;
    }

    .ac-res-floating-text {
        font-size: 0.88rem;
    }

    .ac-res-insertion-marker.ac-res-marker-active,
    .ac-res-ss-marker.ac-res-marker-active {
        padding: 2px 7px;
        font-size: 0.85em;
    }
}
