:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #1d2333;
  background: #f7f8fc;
  --accent: #516ad8;
  --accent-soft: #eef2ff;
  --muted: #798399;
  --line: #e3e7f1;
  --surface: #fff;
  --success: #3f9273;
  --danger: #c45862;
  --warning: #c38a3f;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 18% 0%, #eef2ff 0, transparent 33rem), #f7f8fc; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.is-hidden { display: none !important; }

.app-shell { width: min(100%, 1460px); min-height: 100vh; margin: auto; padding: 34px 28px 42px; }
.eyebrow, .card-kicker { color: #7c8497; font-size: .7rem; font-weight: 750; letter-spacing: .14em; }
.home-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.home-header h1 { margin-top: 5px; font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.055em; }
.home-copy { max-width: 560px; margin-top: 12px; color: #778196; line-height: 1.65; }
.preview-tag { padding: 9px 13px; border: 1px solid #dfe4ee; border-radius: 14px; background: #ffffffbd; color: #677287; font-size: .82rem; font-weight: 700; box-shadow: 0 5px 18px #52648312; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 40px; }
.mode-card { min-height: 255px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 30px; border: 1px solid #e3e7f1; border-radius: 28px; background: #fff; color: #1d2333; text-align: left; box-shadow: 0 12px 34px #4b5c7812; transition: transform .18s, box-shadow .18s, border-color .18s; }
.mode-card:hover { transform: translateY(-3px); border-color: #cad3fa; box-shadow: 0 18px 45px #4b5c7820; }
.mode-icon { width: 78px; height: 78px; display: grid; place-items: center; border-radius: 24px; background: var(--accent-soft); color: var(--accent); }
.mode-icon svg { width: 36px; height: 36px; }
.reading-card .mode-icon { background: #eef8f4; color: #3f9273; }
.mode-content { display: grid; gap: 7px; }
.mode-content > strong { font-size: clamp(1.6rem, 3vw, 2.25rem); letter-spacing: -.035em; }
.mode-content > small { color: #657086; font-size: .9rem; font-weight: 700; }
.mode-meta { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; color: #8490a4; font-size: .8rem; }
.mode-meta i { width: 7px; height: 7px; border-radius: 50%; background: #45ad87; box-shadow: 0 0 0 4px #45ad8717; }
.mode-arrow { color: #9aa4b7; font-size: 2.5rem; font-weight: 300; }
.home-note { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; padding: 18px 20px; border: 1px solid #e0e6f8; border-radius: 20px; background: #f5f7ff; }
.home-note strong { color: #5364b7; font-size: .9rem; }
.home-note p { margin-top: 4px; color: #7b859a; font-size: .8rem; }
.note-dot { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px #516ad817; }

.exam-view { min-height: calc(100vh - 76px); }
.exam-topbar { display: grid; grid-template-columns: auto minmax(240px, 1fr) minmax(160px, 280px) auto auto; align-items: center; gap: 14px; margin-bottom: 18px; }
.back-button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: #59647a; box-shadow: 0 5px 18px #52648312; }
.exam-title h1 { margin-top: 3px; font-size: 1.35rem; letter-spacing: -.03em; }
.exam-progress { color: #758097; font-size: .78rem; font-weight: 700; }
.progress-track { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #e7eaf2; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s; }
.exam-clock { color: #5268cc; font-size: 1.42rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.quiet-button { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: #59647a; font-size: .82rem; font-weight: 700; box-shadow: 0 5px 18px #52648310; }

.exam-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(360px, .7fr); gap: 16px; align-items: start; }
.paper-card, .side-card { min-width: 0; border: 1px solid #e4e8f0; border-radius: 24px; background: #fff; box-shadow: 0 8px 30px #4b5c7810; overflow: hidden; }
.panel-heading { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #edf0f5; }
.panel-heading h2 { margin-top: 4px; font-size: 1.08rem; }
.compact-heading { min-height: 72px; }
.open-paper { padding: 7px 0; border-bottom: 1px solid currentColor; color: var(--accent); font-size: .78rem; font-weight: 700; text-decoration: none; }
.paper-frame-wrap { height: calc(100vh - 180px); min-height: 610px; background: #f2f4f8; }
.paper-document { height: 100%; overflow: auto; padding: 18px; scroll-behavior: smooth; }
.paper-question { scroll-margin-top: 16px; margin-bottom: 14px; padding: 22px; border: 1px solid #e2e6ef; border-radius: 18px; background: #fff; box-shadow: 0 5px 18px #5264830d; transition: border-color .2s, box-shadow .2s; }
.paper-question.is-current { border-color: #9faff7; box-shadow: 0 0 0 3px #516ad814, 0 8px 22px #52648314; }
.paper-question > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.paper-question > header span { color: #5268cc; font-size: .78rem; font-weight: 800; letter-spacing: .06em; }
.paper-question > header small { color: #9aa3b3; font-size: .68rem; }
.paper-question h3 { margin-top: 18px; color: #2e374b; font-size: 1rem; line-height: 1.6; }
.question-visual { display: grid; place-items: center; margin: 0; padding: 14px; overflow: hidden; border: 1px solid #e0e4ec; border-radius: 14px; background: #fafbfe; }
.question-visual img { display: block; width: auto; max-width: 100%; max-height: 560px; object-fit: contain; }
.reading-visual img { width: 100%; }
.listening-visual img { max-height: 430px; border-radius: 7px; }
.no-question-visual { padding: 24px 18px; border: 1px dashed #d9deea; border-radius: 13px; background: #f8f9fc; color: #8992a5; font-size: .82rem; text-align: center; }
.paper-options { display: grid; gap: 8px; margin: 13px 0 0; padding: 0; list-style: none; }
.paper-options li { position: relative; padding: 10px 12px 10px 43px; border: 1px solid #e6e9f0; border-radius: 12px; color: #536078; font-size: .84rem; line-height: 1.45; }
.paper-options li::before { content: attr(data-letter); position: absolute; left: 11px; top: 8px; width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; background: #eef2ff; color: #5369cc; font-size: .72rem; font-weight: 800; }
.paper-note { padding: 18px; border-radius: 13px; background: #f7f8fb; color: #818b9e; font-size: .82rem; text-align: center; }
.side-card { position: sticky; top: 16px; }
.question-badge { padding: 7px 10px; border-radius: 11px; background: #f1f4ff; color: #6173cc; font-size: .76rem; }

.audio-section { padding: 17px 19px 15px; border-bottom: 1px solid #edf0f5; }
.audio-name { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.audio-name > span:first-child { min-width: 0; overflow: hidden; color: #38445c; font-size: .82rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.audio-name > span:last-child { color: #8791a3; font-size: .72rem; white-space: nowrap; }
audio { width: 100%; height: 42px; }
.audio-settings { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 10px; margin-top: 12px; color: #657086; font-size: .75rem; }
.audio-settings label { display: flex; align-items: center; gap: 6px; }
.audio-settings input { accent-color: var(--accent); }
.audio-settings select { min-height: 34px; padding: 0 7px; border: 1px solid #dfe4ee; border-radius: 10px; background: #fff; color: #536078; }
.repeat-button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 10px; background: #edf0f7; color: #58647a; font-size: .74rem; font-weight: 700; }
.repeat-button:disabled, button:disabled { cursor: not-allowed; opacity: .55; }
.answer-countdown { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; padding: 9px; border-radius: 11px; background: #fff7e8; color: #9b6e2f; font-size: .76rem; }
.answer-countdown strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.question-picker-section { padding: 16px 19px; border-bottom: 1px solid #edf0f5; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.section-row strong { color: #465168; font-size: .82rem; }
.section-row span { color: #8a93a5; font-size: .72rem; }
.question-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.question-button { min-height: 34px; padding: 0; border: 1px solid #e1e5ed; border-radius: 10px; background: #f8f9fc; color: #667188; font-size: .74rem; font-weight: 700; }
.question-button.current { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 4px 12px #516ad833; }
.question-button.answered:not(.current) { border-color: #a8cfbf; background: #f2faf7; color: #3f8068; }
.question-button.correct { border-color: #8fc5ae; background: #eaf7f1; color: #33775c; }
.question-button.wrong { border-color: #ddaab0; background: #fff0f1; color: #b34f59; }
.question-button.blank { border-color: #e1c493; background: #fff8ec; color: #a6762f; }
.current-answer-section { padding: 16px 19px; }
.answer-choice-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.answer-choice { min-height: 46px; border: 1px solid #dfe4ee; border-radius: 13px; background: #f8f9fc; color: #566178; font-weight: 750; }
.answer-choice.selected { border-color: #aebaff; background: #eef2ff; color: var(--accent); box-shadow: inset 0 0 0 1px #c3ccff; }
.answer-choice.correct { border-color: #8fc5ae; background: #eaf7f1; color: #33775c; }
.answer-choice.wrong { border-color: #ddaab0; background: #fff0f1; color: #b34f59; }

.answer-sheet-head, .answer-row { display: grid; grid-template-columns: 52px repeat(4, 1fr); align-items: center; gap: 7px; }
.answer-sheet-head { position: sticky; top: 0; z-index: 2; padding: 11px 19px; background: #f5f7fc; color: #8a93a5; font-size: .7rem; font-weight: 700; text-align: center; }
.answer-sheet { max-height: calc(100vh - 300px); min-height: 480px; overflow: auto; padding: 7px 13px 13px; }
.answer-row { padding: 6px; border-bottom: 1px solid #f0f2f6; }
.question-jump { min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: #687388; font-size: .78rem; font-weight: 800; }
.question-jump:hover { background: #eef2ff; color: #5268cc; }
.sheet-choice { min-height: 34px; border: 1px solid #e1e5ed; border-radius: 9px; background: #f8f9fc; color: #657086; font-size: .75rem; font-weight: 700; }
.sheet-choice.selected { border-color: #aebaff; background: #eef2ff; color: var(--accent); }
.sheet-choice.correct { border-color: #8fc5ae; background: #eaf7f1; color: #33775c; }
.sheet-choice.wrong { border-color: #ddaab0; background: #fff0f1; color: #b34f59; }
.answer-row.row-wrong .question-jump { color: #b34f59; }
.answer-row.row-correct .question-jump { color: #33775c; }
.answer-row.row-blank .question-jump { color: #a6762f; }

.submit-bar { display: grid; grid-template-columns: .85fr 1.15fr; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid #edf0f5; background: #fff; }
.reset-button, .submit-button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 15px; font-weight: 720; }
.reset-button { background: #e9edf6; color: #526078; }
.submit-button { background: var(--accent); color: #fff; box-shadow: 0 7px 18px #516ad83b; }
.full-button { width: 100%; }
button:active { transform: scale(.985); }

dialog { padding: 0; border: 0; border-radius: 26px; color: #1d2333; box-shadow: 0 30px 70px #17203f50; }
dialog::backdrop { background: #1c254366; backdrop-filter: blur(3px); }
.result-dialog { width: min(calc(100% - 32px), 570px); }
.confirm-dialog { width: min(calc(100% - 32px), 430px); }
.practice-mode-dialog { width: min(calc(100% - 32px), 620px); }
.dialog-content { position: relative; padding: 30px; text-align: center; }
.compact-dialog { text-align: left; }
.dialog-content h2 { margin-top: 7px; font-size: 1.55rem; letter-spacing: -.04em; }
.dialog-close { position: absolute; right: 18px; top: 15px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f0f2f7; color: #59647a; font-size: 1.5rem; }
.score-ring { width: 132px; height: 132px; display: grid; place-content: center; margin: 24px auto 20px; border: 10px solid #eef2ff; border-top-color: var(--accent); border-radius: 50%; }
.score-ring strong { color: #4054b7; font-size: 2.4rem; line-height: 1; }
.score-ring span { margin-top: 5px; color: #8a93a5; font-size: .78rem; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; margin-bottom: 17px; border: 1px solid #e5e8f0; border-radius: 17px; }
.result-stats div { padding: 14px 7px; border-right: 1px solid #e5e8f0; }
.result-stats div:last-child { border: 0; }
.result-stats strong { display: block; color: #354466; font-size: 1.3rem; }
.result-stats span { display: block; margin-top: 3px; color: #8891a1; font-size: .72rem; }
.result-copy { margin: 15px 0 20px; color: #707b90; font-size: .88rem; line-height: 1.65; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mistake-list { max-height: 170px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; overflow: auto; margin-bottom: 14px; text-align: left; }
.mistake-list:empty { display: none; }
.mistake-list button { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 1px solid #ead9dc; border-radius: 10px; background: #fff7f8; color: #9e4d57; font-size: .72rem; }
.mistake-list button span { color: #8e7180; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 8px; }
.result-actions button { min-height: 44px; padding: 0 10px; font-size: .78rem; }
.result-paper-link { display: inline-block; margin-top: 15px; color: #6877bd; font-size: .76rem; font-weight: 700; }
.mode-dialog-content { text-align: left; }
.practice-mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.practice-mode-options button { min-height: 150px; display: grid; align-content: center; gap: 10px; padding: 22px; border: 1px solid #e0e5ef; border-radius: 19px; background: #f9faff; color: #2f394e; text-align: left; }
.practice-mode-options button:hover { border-color: #aebbf5; background: #f3f5ff; }
.practice-mode-options strong { color: #4e63c6; font-size: 1.1rem; }
.practice-mode-options span { color: #778298; font-size: .8rem; line-height: 1.6; }

@media (max-width: 980px) {
  .exam-topbar { grid-template-columns: auto 1fr auto auto; }
  .exam-progress { grid-column: 2 / -1; grid-row: 2; }
  .exam-layout { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .paper-frame-wrap { height: 720px; }
  .answer-sheet { max-height: none; }
}

@media (max-width: 680px) {
  .app-shell { padding: 24px 14px 32px; }
  .mode-grid { grid-template-columns: 1fr; margin-top: 28px; }
  .mode-card { min-height: 200px; padding: 23px; }
  .mode-icon { width: 62px; height: 62px; }
  .exam-topbar { grid-template-columns: auto 1fr auto; }
  .exam-clock { grid-column: 3; grid-row: 1; }
  .quiet-button { grid-column: 2 / -1; grid-row: 2; }
  .exam-progress { grid-column: 1 / -1; grid-row: 3; }
  .paper-frame-wrap { height: 620px; min-height: 500px; }
  .question-grid { grid-template-columns: repeat(7, 1fr); }
  .result-actions { grid-template-columns: 1fr; }
  .practice-mode-options { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .home-header { flex-direction: column; }
  .mode-card { grid-template-columns: auto 1fr; }
  .mode-arrow { display: none; }
  .audio-settings { grid-template-columns: 1fr 1fr; }
  .repeat-button { grid-column: 1 / -1; }
  .question-grid { grid-template-columns: repeat(6, 1fr); }
}
