:root {
  --ink: #17252f;
  --muted: #667780;
  --paper: #f8f6ef;
  --line: #dfe3dd;
  --mint: #9bd4c2;
  --sun: #f0cb74;
  --blue: #92b5db;
  --navy: #1f3b54;
  --danger: #b9564d;
  --success: #28755f;
  --card: rgba(255,255,255,.74);
  --shadow-soft: 0 18px 45px rgba(31,59,84,.08);
  --shadow-lift: 0 22px 58px rgba(31,59,84,.13);
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(155,212,194,.24), transparent 30%),
    radial-gradient(circle at 92% 18%, rgba(146,181,219,.24), transparent 32%),
    linear-gradient(180deg, #fbfaf4 0%, var(--paper) 45%, #f4f1e8 100%);
}
button, select, input { font: inherit; }
button { cursor: pointer; }
input::placeholder { color: rgba(102,119,128,.43); }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(40,117,95,.18); outline-offset: 2px; }
.hidden { display: none !important; }
.site-header { height: 74px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(223,227,221,.75); background: rgba(248, 246, 239, .84); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; gap: 12px; align-items: center; border: 0; background: transparent; text-align: left; color: var(--ink); }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; background: var(--navy); color: #fff; border-radius: 50%; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .14em; margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.ghost-button { border: 0; background: transparent; color: var(--muted); font-weight: 700; }
.timer { color: var(--navy); font-weight: 800; font-variant-numeric: tabular-nums; }
main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 72px; }
.eyebrow { color: var(--success); letter-spacing: .13em; font-size: 11px; font-weight: 800; margin: 0 0 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(44px, 7vw, 82px); line-height: 1.07; letter-spacing: -.07em; }
h1 span { color: var(--success); }
h2 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.05em; margin-bottom: 8px; }
h3 { font-size: 22px; margin-bottom: 10px; }
.hero { display: grid; grid-template-columns: 1.4fr .6fr; gap: 34px; align-items: end; padding: 20px 0 54px; }
.hero-copy, .section-heading > p { color: var(--muted); line-height: 1.8; max-width: 620px; }
.home-search { display: flex; gap: 10px; max-width: 620px; margin-top: 22px; }
.home-search input { flex: 1; min-width: 0; min-height: 50px; padding: 12px 16px; border: 1px solid rgba(223,227,221,.9); border-radius: 999px; background: rgba(255,255,255,.76); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 10px 26px rgba(31,59,84,.055); }
.home-search input:focus { background: #fff; border-color: rgba(40,117,95,.45); }
.hero-score { min-height: 230px; border-radius: 28px; padding: 28px; color: #fff; background: linear-gradient(145deg, #244b68 0%, var(--navy) 72%); display: flex; flex-direction: column; justify-content: end; box-shadow: var(--shadow-soft); }
.hero-score small { opacity: .72; }
.hero-score strong { font-size: 72px; letter-spacing: -.08em; }
.hero-score span { font-size: 13px; opacity: .72; }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 76px; }
.stat-card { padding: 18px; border: 1px solid rgba(223,227,221,.9); border-radius: 16px; background: var(--card); box-shadow: 0 8px 24px rgba(31,59,84,.045); backdrop-filter: blur(10px); }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 9px; font-size: 27px; }
.stat-button { color: var(--ink); text-align: left; transition: transform .16s, border-color .16s, box-shadow .16s; }
.stat-button:hover { border-color: rgba(40,117,95,.45); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.stat-button small { display: block; margin-top: 13px; color: var(--success); font-size: 12px; font-weight: 800; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 22px; }
.section-heading > p { max-width: 420px; font-size: 14px; margin-bottom: 5px; }
.session-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.session-card { min-height: 300px; border-radius: 22px; padding: 24px; display: flex; flex-direction: column; box-shadow: var(--shadow-soft); transition: transform .18s, box-shadow .18s; }
.session-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.session-card p { color: #33464f; line-height: 1.65; font-size: 14px; }
.accent-mint { background: var(--mint); }.accent-sun { background: var(--sun); }.accent-blue { background: var(--blue); }
.session-number { font-size: 64px; line-height: 1; font-weight: 900; letter-spacing: -.08em; margin-bottom: 18px; }
.primary-button, .secondary-button { border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 800; transition: transform .15s, box-shadow .15s, background .15s; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(31,59,84,.16); }
.primary-button { margin-top: auto; background: #fff; color: var(--ink); align-self: start; }
.primary-button.dark { color: #fff; background: var(--navy); }
.secondary-button { color: #fff; background: var(--navy); }
.muted-button { color: var(--navy); background: #e6ece9; }
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.tool-card { padding: 25px; border: 1px solid rgba(223,227,221,.9); border-radius: 22px; background: var(--card); box-shadow: var(--shadow-soft); backdrop-filter: blur(10px); }
.inline-actions { display: flex; flex-wrap: wrap; gap: 10px; }
select { max-width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: rgba(255,255,255,.9); }
.tool-copy { color: var(--muted); font-size: 14px; line-height: 1.6; }
.chapter-actions { display: flex; gap: 14px; margin-bottom: 12px; }
.text-button { padding: 0; border: 0; color: var(--success); background: transparent; font-size: 13px; font-weight: 800; }
.chapter-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 280px; padding-right: 4px; overflow-y: auto; }
.chapter-option { display: flex; gap: 9px; align-items: start; padding: 10px; border: 1px solid rgba(223,227,221,.9); border-radius: 12px; background: rgba(255,255,255,.88); cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.chapter-option:hover { border-color: rgba(40,117,95,.4); box-shadow: 0 8px 20px rgba(31,59,84,.06); transform: translateY(-1px); }
.chapter-option input { flex: 0 0 auto; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--success); }
.chapter-option span { min-width: 0; }
.chapter-option strong { display: block; font-size: 13px; line-height: 1.45; }
.chapter-option small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.chapter-summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 14px 0; color: var(--muted); font-size: 13px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(23,37,47,.45); }
.account-modal { position: relative; width: min(100%, 470px); padding: 28px; border-radius: 22px; background: var(--paper); box-shadow: 0 24px 70px rgba(23,37,47,.25); }
.modal-close { position: absolute; top: 12px; right: 16px; border: 0; color: var(--muted); background: transparent; font-size: 30px; line-height: 1; }
.login-form { display: grid; gap: 10px; }
.login-form input { min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.login-message { min-height: 22px; margin: 12px 0 0; color: var(--success); font-size: 13px; }
.quiz-shell { max-width: 900px; margin: 0 auto; }
.quiz-top { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 28px; }
.progress-track { height: 7px; flex: 1; overflow: hidden; border-radius: 99px; background: var(--line); }
.progress-track span { height: 100%; display: block; background: var(--success); transition: width .2s; }
.question-card { padding: clamp(22px, 4vw, 44px); border: 1px solid rgba(223,227,221,.9); border-radius: 24px; background: rgba(255,255,255,.88); box-shadow: var(--shadow-soft); backdrop-filter: blur(10px); }
.question-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.question-text { font-size: clamp(19px, 2.5vw, 25px); line-height: 1.7; margin-bottom: 24px; }
.option-list { display: grid; gap: 11px; }
.option { width: 100%; min-height: 56px; padding: 14px 16px; display: flex; gap: 13px; text-align: left; border: 1px solid rgba(223,227,221,.95); border-radius: 14px; background: rgba(255,255,255,.88); color: var(--ink); line-height: 1.55; overflow-wrap: anywhere; transition: border-color .15s, box-shadow .15s, transform .15s; }
.option:hover { border-color: rgba(31,59,84,.55); box-shadow: 0 8px 20px rgba(31,59,84,.06); transform: translateY(-1px); }
.option-key { flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #edf1ef; font-weight: 800; font-size: 12px; }
.option.selected { border-color: var(--navy); background: #edf4f7; }
.option.correct { border-color: var(--success); background: #e9f6ee; }
.option.wrong { border-color: var(--danger); background: #faece9; }
.feedback { margin-top: 18px; padding: 14px; border-radius: 12px; background: #eef5f2; color: var(--success); font-weight: 700; }
.quiz-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 12px; }
.favorite { border: 0; color: var(--muted); background: transparent; font-weight: 700; }
.favorite.active { color: #9b6e00; }
.result-panel { max-width: 820px; margin: 0 auto; text-align: center; }
.result-score { width: 210px; height: 210px; display: flex; align-items: center; justify-content: center; gap: 7px; margin: 24px auto; border-radius: 50%; color: #fff; background: var(--navy); font-weight: 900; }
.result-score-value { font-size: 66px; line-height: 1; }
.result-score-unit { align-self: center; padding-top: 25px; font-size: 21px; }
.result-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 26px 0; }
.result-grid .stat-card { min-height: 124px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.result-grid .stat-card span { font-size: 14px; }
.result-grid .stat-card strong { margin-top: 12px; font-size: 36px; line-height: 1; }
.review-list { margin-top: 30px; text-align: left; display: grid; gap: 10px; }
.review-item { padding: 16px; border: 1px solid rgba(223,227,221,.9); border-radius: 14px; background: rgba(255,255,255,.88); box-shadow: 0 8px 22px rgba(31,59,84,.045); overflow-wrap: anywhere; }
.review-item strong { color: var(--danger); }
.review-options { display: grid; gap: 7px; margin-top: 13px; }
.review-option { display: flex; gap: 10px; align-items: start; padding: 9px 11px; border-radius: 10px; background: #f7f8f5; color: var(--muted); }
.review-option span { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #e8eeeb; color: var(--ink); font-size: 11px; font-weight: 800; }
.review-option p { margin: 0; line-height: 1.55; }
.review-option.is-answer { background: #e9f6ee; color: var(--success); }
.review-option.is-answer span { color: #fff; background: var(--success); }
.library-shell { max-width: 1040px; margin: 0 auto; }
.library-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 28px; }
.library-heading h1 { margin-bottom: 8px; }
.library-tabs { display: flex; gap: 8px; padding-bottom: 8px; overflow-x: auto; }
.library-tabs button { flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-weight: 800; }
.library-tabs button.active { color: #fff; border-color: var(--navy); background: var(--navy); }
.library-tabs span { margin-left: 7px; opacity: .72; font-size: 12px; }
.library-search { display: grid; gap: 8px; margin: 14px 0; }
.library-search label { color: var(--muted); font-size: 13px; font-weight: 800; }
.library-search > div { display: flex; gap: 9px; align-items: center; }
.library-search input { flex: 1; min-width: 0; min-height: 46px; padding: 11px 14px; border: 1px solid rgba(223,227,221,.9); border-radius: 999px; background: rgba(255,255,255,.78); box-shadow: inset 0 1px 0 rgba(255,255,255,.68); }
.library-search input:focus { background: #fff; border-color: rgba(40,117,95,.45); }
.library-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: 17px 0; padding: 15px; border: 1px solid rgba(223,227,221,.9); border-radius: 14px; background: var(--card); box-shadow: 0 8px 22px rgba(31,59,84,.045); }
.library-practice { display: flex; gap: 9px; }
.library-list { display: grid; gap: 9px; }
.library-item { padding: 16px; border: 1px solid rgba(223,227,221,.9); border-radius: 14px; background: rgba(255,255,255,.88); box-shadow: 0 8px 20px rgba(31,59,84,.04); }
.library-item p { margin: 9px 0 0; line-height: 1.6; }
.library-item-meta, .library-item-status { display: flex; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 12px; }
.library-item-meta strong { color: var(--success); font-size: 14px; }
.library-item-status { margin-top: 12px; }
.danger-text { color: var(--danger); }
.empty-state { padding: 42px 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
@media (max-width: 760px) {
  main { width: min(100% - 28px, 620px); padding-top: 30px; }
  .hero { grid-template-columns: 1fr; padding-bottom: 30px; }
  .hero-score { min-height: 150px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 52px; }
  .section-heading { display: block; }
  .session-grid, .tool-grid { grid-template-columns: 1fr; }
  .session-card { min-height: 245px; }
  .quiz-top { font-size: 13px; }
}
@media (max-width: 480px) {
  .site-header { height: 64px; padding: 0 16px; }
  .brand { gap: 9px; }
  .brand-mark { width: 38px; height: 38px; font-size: 11px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 8px; }
  .timer { font-size: 14px; }
  .ghost-button { min-height: 44px; padding: 0 6px; }
  .account-button { max-width: 68px; font-size: 12px; line-height: 1.25; }
  main { width: min(100% - 24px, 620px); padding: 22px 0 calc(56px + env(safe-area-inset-bottom)); }
  h1 { font-size: 43px; }
  h2 { font-size: 28px; }
  .hero { gap: 18px; padding: 10px 0 24px; }
  .hero-copy { font-size: 14px; line-height: 1.7; }
  .home-search { display: grid; gap: 9px; margin-top: 18px; }
  .home-search input { border-radius: 14px; }
  .hero-score { min-height: 132px; padding: 20px; border-radius: 22px; }
  .hero-score strong { font-size: 58px; }
  .stats-grid { gap: 10px; margin-bottom: 42px; }
  .stat-card { padding: 14px; }
  .stat-card strong { font-size: 24px; }
  .session-card { min-height: 218px; padding: 20px; border-radius: 18px; }
  .session-number { font-size: 58px; margin-bottom: 12px; }
  .tool-card { padding: 20px; border-radius: 18px; }
  .primary-button, .secondary-button { min-height: 46px; padding: 12px 17px; }
  .chapter-options { grid-template-columns: 1fr; max-height: 330px; }
  .chapter-option { min-height: 52px; align-items: center; }
  .chapter-summary { display: grid; }
  .chapter-summary select { width: 100%; min-height: 46px; }
  .quiz-shell { padding-bottom: 68px; }
  .quiz-top { position: sticky; top: 64px; z-index: 5; margin: -22px -12px 16px; padding: 13px 12px; background: rgba(248, 246, 239, .96); }
  .question-card { padding: 20px; border-radius: 20px; }
  .question-meta { display: grid; gap: 5px; margin-bottom: 13px; }
  .question-text { font-size: 20px; line-height: 1.65; margin-bottom: 18px; overflow-wrap: anywhere; }
  .option-list { gap: 9px; }
  .option { min-height: 58px; padding: 13px; }
  .quiz-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; min-height: 68px; margin: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(248, 246, 239, .97); box-shadow: 0 -8px 22px rgba(31,59,84,.08); }
  .favorite { min-height: 44px; text-align: left; }
  .quiz-footer .secondary-button { min-width: 78px; }
  .result-panel h1 { font-size: 38px; }
  .result-score { width: 176px; height: 176px; gap: 5px; }
  .result-score-value { font-size: 56px; }
  .result-score-unit { padding-top: 20px; font-size: 18px; }
  .result-grid { gap: 8px; margin: 20px 0; }
  .result-grid .stat-card { min-height: 98px; padding: 13px 7px; }
  .result-grid .stat-card span { min-height: 36px; font-size: 11px; }
  .result-grid .stat-card strong { margin-top: 6px; font-size: 27px; }
  .review-list { gap: 8px; margin-top: 28px; }
  .review-item { padding: 13px; font-size: 14px; }
  .review-item p { line-height: 1.55; margin-bottom: 0; }
  .library-heading { display: grid; }
  .library-heading h1 { font-size: 44px; }
  .library-search > div { display: grid; }
  .library-search input { border-radius: 14px; }
  .library-toolbar { display: grid; }
  .library-practice { display: grid; grid-template-columns: 1fr auto; }
  .library-practice select { min-width: 0; width: 100%; }
  .library-item { padding: 13px; font-size: 14px; }
}
