:root {
    --bg-color: #F4F4F2;
    --paper-white: #FFFFFF;
    --text-main: #1A1A1A;
    --text-sub: #555555;
    --accent: #000000;
    --highlight: #FFFF00;
    --danger: #D32F2F;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Noto Serif KR', 'Noto Sans KR', serif;
    line-height: 1.6;
}

#app-container { position: relative; min-height: 100vh; }

/* 전역 진행 바 */
.global-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #EEE;
    z-index: 1000;
}
.global-progress-bar .fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease;
}

/* 페이지 섹션 */
.page-section {
    display: none;
    width: 100vw;
    min-height: 100vh;
    position: relative;
    overflow-y: auto;
    background: var(--bg-color);
    padding-top: 8px;
}
.page-section.active { display: block; }
.page-inner { padding: 30px 20px; max-width: 600px; margin: 0 auto; }

.center-align .page-inner { text-align: center; }
.center-align h1, .center-align h2, .center-align p { text-align: center; }
.full-width { width: 100%; display: block; }

/* 인트로 */
.main-title {
    font-size: clamp(1.8rem, 5vw, 2.2rem);
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.3;
}
.sub-desc {
    font-size: 1.1rem;
    color: var(--text-sub);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}
.info-box {
    background: var(--paper-white);
    border: 2px solid var(--accent);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    text-align: left;
}
.info-box p { margin: 0.35rem 0; font-size: 0.95rem; }

/* 파트 뱃지 & 가이드 */
.phase-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--accent);
    color: white;
    margin-bottom: 1rem;
}
.guide-text {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.7;
    margin: 1rem 0;
}
.sub-text { font-size: 0.9rem; color: var(--text-sub); display: block; margin-top: 0.5rem; }

/* 강조 텍스트 (형광펜) */
.neon-text {
    background-color: var(--highlight);
    padding: 2px 6px;
    font-weight: bold;
    color: #000;
}
.neon-text.big-text { font-size: 1.15rem; padding: 4px 8px; }

/* 지문 영역 */
.passage-counter {
    font-size: 0.9rem;
    color: var(--text-sub);
    margin-bottom: 0.75rem;
}
.passage-text,
.passage-content {
    background: var(--paper-white);
    border: 2px solid var(--accent);
    padding: 25px;
    font-size: 1.05rem;
    text-align: justify;
    line-height: 1.8;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.1);
    margin: 20px 0;
}

/* 타이머 바 (상단 선형) */
.timer-bar-wrap {
    width: 100%;
    height: 8px;
    background: #EEE;
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 10;
}
.timer-bar-fill {
    height: 100%;
    background: var(--accent);
    width: 100%;
    transform-origin: left;
    transition: width 0.1s linear;
}

/* 버튼 */
button {
    border: 2px solid var(--accent);
    border-radius: 0;
    font-weight: 700;
    cursor: pointer;
    transition: 0.1s;
    font-family: inherit;
}
.btn-primary {
    background: var(--accent);
    color: white;
    padding: 18px 24px;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}
.btn-primary:active { background: #333; transform: translate(2px, 2px); }
.btn-primary.disabled,
.btn-primary:disabled {
    background: #DDD;
    border-color: #AAA;
    color: #777;
    cursor: not-allowed;
    transform: none;
}
.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    padding: 18px 24px;
    font-size: 1.1rem;
}
.btn-danger:active { filter: brightness(0.9); transform: translate(2px, 2px); }
.btn-secondary {
    background: var(--paper-white);
    color: var(--accent);
    padding: 14px 20px;
    font-size: 1rem;
}
.btn-secondary:active { background: #EEE; }
.btn-text {
    background: none;
    border: none;
    color: var(--text-sub);
    font-size: 0.9rem;
    margin-top: 1rem;
    text-decoration: underline;
    cursor: pointer;
}

/* 라디오 그리드 (p3 예측) */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin: 30px 0;
}
.radio-item {
    cursor: pointer;
}
.radio-item input { display: none; }
.radio-item span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 55px;
    background: white;
    border: 2px solid var(--accent);
    font-size: 1.3rem;
    font-weight: bold;
}
.radio-item input:checked + span {
    background: var(--accent);
    color: white;
}

/* 스티키 헤더 & 퀴즈 영역 */
.sticky-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--paper-white);
    border-bottom: 2px solid var(--accent);
    z-index: 5;
}
.timer-text { font-weight: 700; font-size: 1.1rem; }
.scroll-y { max-height: calc(100vh - 120px); overflow-y: auto; }
.quiz-list-area { margin: 1rem 0; }
.quiz-list-area .quiz-item {
    margin-bottom: 1.25rem;
    padding: 1rem 0;
    border-bottom: 1px solid #DDD;
}
.quiz-list-area .quiz-item p { margin-bottom: 0.5rem; font-weight: 600; }
.quiz-list-area .quiz-item label {
    display: block;
    margin: 0.35rem 0;
    cursor: pointer;
}

/* 시간 선택 그리드 */
.time-select-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 1.5rem 0;
}
.btn-time {
    padding: 1rem;
    background: var(--paper-white);
    color: var(--text-main);
    font-size: 1rem;
    text-align: center;
}
.btn-time small { display: block; font-size: 0.8rem; color: var(--text-sub); margin-top: 0.25rem; }
.btn-time:hover { background: #EEE; }

/* 파트2 지문 슬라이더 */
.passage-slider-box { margin-bottom: 1.5rem; }
.slider-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.slider-controls button {
    padding: 0.5rem 1rem;
    background: var(--paper-white);
    font-size: 1rem;
}
.slider-controls button:hover { background: #EEE; }

/* 파트3 스피드 퀴즈 */
.top-indicator {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}
.p3-question-box {
    background: var(--paper-white);
    border: 2px solid var(--accent);
    padding: 2rem 1.5rem;
    margin: 1.5rem 0;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.question-text-large {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.5;
}
.options-grid-1col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.options-grid-1col .btn-option-large {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: var(--paper-white);
    border: 2px solid var(--accent);
    font-size: 1.1rem;
    text-align: left;
}
.options-grid-1col .btn-option-large:active {
    background: #EEE;
    transform: translate(2px, 2px);
}

/* p9 모니터 슬라이더 */
.range-wrap {
    margin: 1.5rem 0;
    text-align: center;
}
.range-wrap #p9-val-display {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    min-width: 2rem;
}
.range-wrap input[type="range"] {
    width: 100%;
    max-width: 320px;
    accent-color: var(--accent);
}

/* 로딩 & 광고 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #EEE;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-msg {
    margin-top: 1.25rem;
    font-size: 1rem;
    color: var(--text-sub);
}
/* 광고 영역 (스텔스 모드) */
.ad-container {
    width: 100%;
    min-height: 250px;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 배경색과 글자 제거 -> 광고 로드 전엔 빈 공간만 차지 */
}
.ad-label {
    display: none; /* "SPONSORED" 라벨도 지저분하면 제거 */
}
.ad-container .ad-placeholder {
    min-height: 250px;
    width: 100%;
}

/* 결과 페이지 */
.result-container {
    padding: 1.5rem 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* 결과 리포트 전용 스타일 */
.report-badge {
    background: #000;
    color: #FFF;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 10px;
}
.tag-box { margin-bottom: 20px; }
.result-tag {
    display: inline-block;
    background: #EFEFEF;
    color: #333;
    padding: 5px 10px;
    margin: 3px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* 상세 지표 (Progress Bars) */
.score-detail-box {
    background: #FFF;
    border: 2px solid #000;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}
.score-detail-box h3 { margin-bottom: 15px; border-bottom: 1px solid #DDD; padding-bottom: 10px; }
.score-row { display: flex; align-items: center; margin-bottom: 12px; font-size: 0.9rem; }
.score-label { min-width: 160px; font-weight: bold; flex-shrink: 0; }
.progress-bg { flex-grow: 1; height: 10px; background: #EEE; margin: 0 10px; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: #2E5BFF; width: 0%; transition: width 1s ease-out; }
.score-val { width: 30px; text-align: right; font-weight: bold; }

.result-type-title {
    font-size: 1.5rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 1.5rem;
}
.chart-box {
    border: 2px solid var(--accent);
    background: var(--paper-white);
    padding: 15px;
    margin: 20px 0;
    min-height: 280px;
}
.analysis-text-box { margin: 1.5rem 0; }
.analysis-block {
    background: var(--paper-white);
    border: 2px solid var(--accent);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.analysis-block h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.analysis-block p { font-size: 0.95rem; line-height: 1.7; margin: 0; color: var(--text-main); }
.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 1.5rem;
}

/* 검사 원리 상세 보기 (폭스대학 인지과학 연구소 스타일) */
.theory-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #000;
    text-align: left;
}
.btn-theory-toggle {
    width: 100%;
    padding: 14px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    background: #1a1a1a;
    color: #fff;
    border: 2px solid #000;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}
.btn-theory-toggle:hover {
    background: #2E5BFF;
    color: #fff;
}
.theory-content {
    margin-top: 1rem;
    padding: 0 4px;
}
.theory-content.hidden { display: none; }
.theory-block {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-left: 4px solid #2E5BFF;
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.theory-block h4 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
    color: #1a1a1a;
}
.theory-block p {
    margin: 0;
    line-height: 1.75;
    color: #333;
}

/* 커스텀 확인 모달 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
    background: var(--paper-white);
    border: 3px solid var(--accent);
    padding: 30px;
    text-align: center;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 100%;
}
.modal-box h3 { margin-bottom: 0.75rem; font-size: 1.25rem; }
.modal-box p {
    white-space: pre-line;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: var(--text-sub);
}
.modal-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.btn-modal-no {
    padding: 12px 24px;
    background: var(--paper-white);
    color: var(--accent);
}
.btn-modal-yes {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
}
