:root {
  --ink: #14213d;
  --muted: #6c7890;
  --blue: #2478ed;
  --blue-deep: #1658ba;
  --sky: #eaf3ff;
  --mint: #18ad98;
  --coral: #ed795f;
  --amber: #e9a330;
  --violet: #746be8;
  --paper: #ffffff;
  --line: #dce7f5;
  --shadow: 0 12px 28px rgba(36, 80, 140, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--sky);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--sky); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f6f9fe; }
button, a { font: inherit; letter-spacing: 0; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 120, 237, 0.3); outline-offset: 3px; }

.app-shell { width: min(100%, 1180px); min-height: 100vh; margin: 0 auto; padding-bottom: 88px; background: #f7faff; }
.topbar { height: 72px; padding: 14px clamp(18px, 4vw, 42px); display: flex; align-items: center; justify-content: space-between; background: rgba(234, 243, 255, 0.94); border-bottom: 1px solid rgba(174, 200, 234, 0.45); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); }
.brand { padding: 0; border: 0; background: transparent; color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--blue); color: white; font-weight: 800; box-shadow: 0 7px 14px rgba(36, 120, 237, 0.25); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; font-size: 10px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.install-button { min-height: 34px; padding: 0 12px; border: 1px solid #9fc2ef; border-radius: 8px; background: white; color: var(--blue-deep); font-size: 11px; font-weight: 750; cursor: pointer; }
.version-badge { padding: 6px 9px; border: 1px solid #bdd5f5; border-radius: 8px; color: var(--blue-deep); background: #f6faff; font-size: 10px; font-weight: 700; }
.update-banner { position: sticky; z-index: 19; top: 72px; min-height: 46px; padding: 8px clamp(18px, 4vw, 42px); display: flex; align-items: center; justify-content: center; gap: 12px; background: #14213d; color: white; font-size: 12px; }
.update-banner button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: white; color: var(--blue-deep); font-weight: 750; cursor: pointer; }

main { min-height: calc(100vh - 160px); }
.view { display: none; }
.view.active { display: block; animation: view-in 260ms ease-out both; }
.home-intro { padding: 32px clamp(20px, 5vw, 56px) 30px; background: #eaf3ff; }
.eyebrow { margin: 0 0 7px; font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif; font-size: 11px; font-weight: 800; color: var(--blue); letter-spacing: 0; }
h1, h2, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 38px; line-height: 1.18; }
.home-intro > p:last-of-type, .page-head p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.primary-modules { padding: 22px clamp(18px, 4vw, 42px) 10px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; }
.module-card { min-height: 124px; padding: 20px; display: flex; align-items: center; gap: 14px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); cursor: pointer; transition: transform 170ms ease, box-shadow 170ms ease; }
.module-card:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(36, 80, 140, 0.16); }
.module-icon { width: 58px; height: 58px; flex: 0 0 58px; display: grid; place-items: center; border-radius: 17px; color: white; font-size: 23px; font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 9px 18px rgba(40,80,130,.16); }
.module-icon.blue { background: var(--blue); }
.module-icon.mint { background: var(--mint); }
.module-icon.coral { background: var(--coral); }
.module-copy { min-width: 0; flex: 1; }
.module-copy strong, .module-copy small { display: block; }
.module-copy strong { font-size: 20px; }
.module-copy small { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.round-arrow { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #e7f1ff; color: var(--blue); font-size: 24px; }

.quick-section { padding: 20px clamp(18px, 4vw, 42px) 32px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 13px; }
.section-heading h2 { margin: 0; font-size: 21px; }
.text-action { padding: 8px 0; border: 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 700; cursor: pointer; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-tile { min-height: 132px; padding: 16px; text-align: left; border: 0; border-radius: 8px; cursor: pointer; transition: transform 160ms ease; }
.quick-tile:hover { transform: translateY(-2px); }
.quick-tile span { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 12px; background: rgba(255,255,255,.75); font-weight: 800; }
.quick-tile strong, .quick-tile small { display: block; }
.quick-tile strong { font-size: 15px; }
.quick-tile small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.tile-blue { background: #e5f0ff; }
.tile-green { background: #e2f7f1; }
.tile-amber { background: #fff2d9; }
.tile-violet { background: #efedff; }

.page-head { padding: 28px clamp(18px, 4vw, 42px) 22px; display: flex; gap: 16px; background: #eaf3ff; }
#learn-view { min-height: calc(100vh - 140px); background: #f3fbf8; }
#learn-view .page-head { background: #e3f6ef; }
#learn-view .eyebrow, #learn-list .row-action { color: #118775; }
#learn-list .topic-row { border-color: #d7ece5; }
#learn-list .topic-emblem { background: #ddf5ed; color: #087765; }
.learning-mode .nav-item.active { color: var(--mint); }
.page-head h1 { font-size: 29px; }
.icon-button { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border: 1px solid #c5d9f2; border-radius: 50%; background: white; color: var(--blue); font-size: 28px; cursor: pointer; }
.topic-list { padding: 18px clamp(18px, 4vw, 42px) 34px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.topic-row { width: 100%; min-height: 92px; padding: 15px; display: flex; align-items: center; gap: 13px; text-align: left; border: 1px solid #e1e9f4; border-radius: 8px; background: white; cursor: pointer; box-shadow: 0 6px 16px rgba(50, 80, 120, .07); }
.topic-emblem { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 14px; background: #e7f1ff; color: var(--blue-deep); font-size: 18px; font-weight: 800; }
.topic-row-copy { min-width: 0; flex: 1; }
.topic-row-copy strong, .topic-row-copy small { display: block; }
.topic-row-copy strong { font-size: 15px; line-height: 1.35; }
.topic-row-copy small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.row-action { color: var(--blue); font-size: 22px; }

.empty-state { min-height: calc(100vh - 160px); padding: 70px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state .module-icon { margin-bottom: 25px; }
.empty-state h1 { font-size: 30px; }
.empty-state > p:not(.eyebrow) { color: var(--muted); }
.primary-button { min-height: 48px; padding: 0 22px; border: 0; border-radius: 8px; background: var(--blue); color: white; font-weight: 750; cursor: pointer; box-shadow: 0 8px 18px rgba(36,120,237,.22); }
.secondary-button { min-height: 42px; padding: 0 15px; border: 1px solid #c9dbf1; border-radius: 8px; background: white; color: var(--blue-deep); font-weight: 700; cursor: pointer; }
.hide-quiz .assessment-card, .hide-quiz .quick-section, .hide-quiz .nav-item[data-go="quiz"] { display: none; }
.hide-learn .learning-card, .hide-learn .nav-item[data-go="learn"] { display: none; }
.hide-quiz.hide-learn .primary-modules { display: none; }

.bottom-nav { height: calc(68px + env(safe-area-inset-bottom)); padding: 8px max(16px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-right)); display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; z-index: 30; left: 50%; bottom: 0; width: min(100%, 1180px); transform: translateX(-50%); border-top: 1px solid #dfe8f4; background: rgba(255,255,255,.96); backdrop-filter: blur(18px); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: #8994a7; cursor: pointer; }
.nav-item span { height: 23px; font-size: 22px; line-height: 1; }
.nav-item strong { font-size: 10px; }
.nav-item.active { color: var(--blue); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(20,33,61,.32); backdrop-filter: blur(3px); }
.topic-sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; width: min(100%, 540px); padding: 12px 22px calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%); border-radius: 18px 18px 0 0; background: white; box-shadow: 0 -18px 48px rgba(20,33,61,.22); }
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 18px; border-radius: 2px; background: #d6deea; }
.sheet-close { position: absolute; top: 17px; right: 18px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f0f4f9; color: var(--muted); font-size: 22px; cursor: pointer; }
.topic-sheet .topic-emblem { margin-bottom: 16px; }
.topic-sheet h2 { margin: 0; font-size: 25px; }
.topic-sheet > p:not(.eyebrow) { margin: 8px 0 18px; color: var(--muted); font-size: 13px; }
.sheet-rule { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.sheet-rule span { padding: 11px 8px; border-radius: 8px; background: #f1f6fd; text-align: center; color: var(--blue-deep); font-size: 12px; font-weight: 700; }
.topic-sheet .primary-button { width: 100%; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 84px; max-width: calc(100% - 32px); padding: 11px 16px; transform: translate(-50%, 20px); border-radius: 8px; background: var(--ink); color: white; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.reader-head { background: #e3f6ef; }
.reader-head .eyebrow { color: #118775; }
.reading-progress, .exam-progress { height: 4px; background: #dce7e4; }
.reading-progress { position: static; }
.exam-progress { position: sticky; top: 72px; z-index: 19; }
.reading-progress i, .exam-progress i { display: block; height: 100%; width: 0; background: var(--mint); transition: width 180ms ease; }
.reader-layout { display: grid; grid-template-columns: 230px minmax(0, 720px); justify-content: center; gap: 36px; padding: 28px clamp(18px, 4vw, 42px) 64px; background: #f3fbf8; }
.reader-toc { position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 130px); overflow: auto; padding: 16px; border: 1px solid #d5eae4; border-radius: 8px; background: rgba(255,255,255,.82); }
.reader-toc > strong { display: block; margin-bottom: 10px; font-size: 13px; }
.reader-toc a { display: block; padding: 7px 0; color: #54736d; text-decoration: none; font-size: 12px; line-height: 1.45; }
.reader-toc a:hover { color: #087765; }
.article-content { min-width: 0; padding: 6px 0 28px; font-size: 16px; line-height: 1.9; color: #203a35; }
.article-content h2 { scroll-margin-top: 112px; margin: 42px 0 14px; padding-top: 8px; border-top: 1px solid #d8ebe5; font-size: 24px; line-height: 1.4; }
.article-content h2:first-child { margin-top: 0; border-top: 0; }
.article-content h3 { margin: 28px 0 10px; font-size: 18px; }
.article-content p { margin: 12px 0; }
.article-content ul, .article-content ol { margin: 12px 0; padding-left: 24px; }
.article-content li { margin: 7px 0; }
.article-content blockquote { margin: 18px 0; padding: 12px 16px; border-left: 4px solid var(--mint); background: white; color: #42635d; }
.article-content strong { color: #0d6f61; }

.exam-top { min-height: 94px; padding: 18px clamp(18px, 4vw, 42px); display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; background: #eaf3ff; }
.exam-top h1 { font-size: 24px; }
.exam-counter { text-align: right; }
.exam-counter strong, .exam-counter small { display: block; }
.exam-counter strong { font-size: 18px; color: var(--blue-deep); }
.exam-counter small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.exam-progress { top: 72px; background: #dce7f5; }
.exam-progress i { background: var(--blue); }
.exam-stage { width: min(100%, 760px); margin: 0 auto; padding: 32px clamp(18px, 4vw, 42px) 46px; }
.question-panel { min-height: 470px; }
.question-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--blue-deep); font-size: 12px; font-weight: 750; }
.question-kicker span { padding: 5px 8px; border-radius: 6px; background: #e6f0ff; }
.question-panel h2 { margin: 0 0 24px; font-size: 23px; line-height: 1.55; }
.option-list { display: grid; gap: 11px; }
.option-button { width: 100%; min-height: 60px; padding: 13px 15px; display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 12px; text-align: left; border: 1px solid #d9e4f2; border-radius: 8px; background: white; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.option-button:hover { border-color: #9dc0ec; }
.option-button.selected { border-color: var(--blue); background: #edf5ff; }
.option-label { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #edf2f8; color: var(--muted); font-size: 12px; font-weight: 800; }
.option-button.selected .option-label { background: var(--blue); color: white; }
.option-text { line-height: 1.55; font-size: 14px; }
.exam-actions, .result-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; margin-top: 24px; }
.exam-actions button, .result-actions button { min-height: 50px; }

.result-hero { padding: 34px clamp(20px, 5vw, 56px); display: flex; align-items: center; gap: 24px; background: #eaf3ff; }
.result-ring { width: 112px; height: 112px; flex: 0 0 112px; display: grid; place-items: center; align-content: center; border: 9px solid #83b8f7; border-radius: 50%; background: white; }
.result-ring strong { font-size: 34px; line-height: 1; color: var(--blue-deep); }
.result-ring small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.result-hero h1 { font-size: 30px; }
.result-hero p:last-child { color: var(--muted); }
.result-stats { padding: 20px clamp(18px, 4vw, 42px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.result-stat { min-height: 78px; display: grid; place-items: center; align-content: center; border: 1px solid var(--line); border-radius: 8px; background: white; }
.result-stat strong { font-size: 22px; color: var(--blue-deep); }
.result-stat small { margin-top: 5px; color: var(--muted); }
.review-section { padding: 8px clamp(18px, 4vw, 42px) 20px; }
.review-card { margin-bottom: 12px; padding: 16px; border: 1px solid #e2e9f2; border-radius: 8px; background: white; }
.review-card h3 { margin: 0 0 10px; font-size: 15px; line-height: 1.5; }
.review-card p { margin: 7px 0; color: #526077; font-size: 13px; line-height: 1.6; }
.review-card .correct { color: #087765; font-weight: 700; }
.result-actions { padding: 0 clamp(18px, 4vw, 42px) 34px; }

.focus-mode .topbar, .focus-mode .bottom-nav { display: none; }
.focus-mode .app-shell { padding-bottom: 0; }

@media (max-width: 760px) {
  .reader-layout { display: block; padding-top: 18px; }
  .reader-toc { position: static; max-height: 210px; margin-bottom: 18px; }
  .article-content { font-size: 15px; line-height: 1.85; }
  .article-content h2 { font-size: 21px; }
  .reading-progress, .exam-progress { top: 64px; }
  .exam-stage { padding-top: 24px; }
  .question-panel { min-height: 430px; }
  .question-panel h2 { font-size: 19px; }
  .result-hero { align-items: flex-start; }
  .result-ring { width: 90px; height: 90px; flex-basis: 90px; border-width: 7px; }
  .result-ring strong { font-size: 28px; }
}

@media (max-width: 390px) {
  .result-hero { gap: 14px; }
  .result-hero h1 { font-size: 24px; }
  .result-stats { grid-template-columns: 1fr; }
  .exam-actions, .result-actions { grid-template-columns: 1fr; }
}

@keyframes view-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .topbar { height: 64px; }
  .update-banner { top: 64px; }
  .exam-progress { top: 64px; }
  h1 { font-size: 29px; }
  .home-intro { padding-top: 26px; }
  .primary-modules { grid-template-columns: 1fr; }
  .assessment-card, .learning-card { min-height: 118px; }
  .module-copy strong { font-size: 18px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .topic-list { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .primary-modules { gap: 10px; }
  .module-card { padding: 14px; }
  .module-icon { width: 50px; height: 50px; flex-basis: 50px; border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
