:root {
    color-scheme: light;
    --ap-ink: #1d2a1c;
    --ap-muted: #667261;
    --ap-green: #536b43;
    --ap-green-dark: #31492b;
    --ap-green-light: #e5eddd;
    --ap-lime: #c8dc8d;
    --ap-cream: #f7f5ed;
    --ap-paper: #fffef9;
    --ap-line: rgba(59, 77, 49, .15);
    --ap-orange: #d88244;
    --ap-red: #a7443d;
    --ap-blue: #4c7480;
    --ap-shadow: 0 20px 60px rgba(38, 54, 32, .11);
    --ap-radius: 24px;
    --ap-font: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ap-cream); }
body { margin: 0; color: var(--ap-ink); background: var(--ap-cream); font-family: var(--ap-font); line-height: 1.65; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
[hidden] { display: none !important; }

.ap-skip-link { position: fixed; top: 8px; left: 8px; z-index: 9999; transform: translateY(-150%); padding: 10px 16px; color: white; background: var(--ap-green-dark); border-radius: 10px; }
.ap-skip-link:focus { transform: none; }
.ap-container { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.ap-hero { position: relative; overflow: hidden; padding: 112px 0 72px; background: radial-gradient(circle at 72% 18%, rgba(198, 221, 139, .55), transparent 35%), linear-gradient(140deg, #f4f2e7 0%, #e9f0e2 58%, #dfe9d5 100%); border-bottom: 1px solid var(--ap-line); }
.ap-hero::before { content: ""; position: absolute; inset: 0; opacity: .36; background-image: linear-gradient(rgba(83, 107, 67, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(83, 107, 67, .06) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(to bottom, black, transparent); }
.ap-hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: clamp(48px, 7vw, 96px); align-items: center; }
.ap-hero-copy h1 { margin: 14px 0 20px; max-width: 730px; font-size: clamp(42px, 6vw, 76px); line-height: 1.08; letter-spacing: -.055em; font-weight: 800; }
.ap-hero-copy h1 span { display: inline-block; color: var(--ap-green); font-size: .82em; white-space: nowrap; }
.ap-eyebrow, .ap-kicker { margin: 0; color: var(--ap-green); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ap-eyebrow { display: inline-flex; align-items: center; padding: 7px 12px; border: 1px solid rgba(83, 107, 67, .2); border-radius: 999px; background: rgba(255, 255, 255, .56); letter-spacing: .08em; }
.ap-lead { max-width: 680px; margin: 0 0 28px; color: #4d594a; font-size: clamp(17px, 2vw, 20px); }
.ap-hero-actions, .ap-inline-actions, .ap-result-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ap-privacy-note { margin: 18px 0 0; color: var(--ap-muted); font-size: 13px; }
.ap-button { min-height: 46px; padding: 11px 18px; border: 1px solid transparent; border-radius: 14px; font-weight: 750; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease; }
.ap-button:hover:not(:disabled) { transform: translateY(-2px); }
.ap-button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .ap-action-card:focus-visible, .ap-topic-card:focus-visible { outline: 3px solid rgba(76, 116, 128, .35); outline-offset: 3px; }
.ap-button-primary { color: white; background: var(--ap-green-dark); box-shadow: 0 12px 28px rgba(49, 73, 43, .22); }
.ap-button-primary:hover:not(:disabled) { background: #263c22; box-shadow: 0 16px 34px rgba(49, 73, 43, .28); }
.ap-button-secondary { color: var(--ap-green-dark); background: rgba(255, 255, 255, .7); border-color: rgba(49, 73, 43, .22); }
.ap-button-ghost { color: var(--ap-green-dark); background: transparent; border-color: var(--ap-line); }
.ap-button-danger { color: var(--ap-red); background: rgba(167, 68, 61, .06); border-color: rgba(167, 68, 61, .2); }

.ap-hero-card { position: relative; padding: 20px; border: 1px solid rgba(255, 255, 255, .8); border-radius: 30px; background: rgba(255, 254, 249, .72); box-shadow: 0 30px 70px rgba(49, 73, 43, .17); backdrop-filter: blur(18px); }
.ap-hero-card::after { content: ""; position: absolute; inset: 8px; z-index: -1; border-radius: 24px; border: 1px solid rgba(83, 107, 67, .09); }
.ap-hero-card-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; }
.ap-live-dot { color: var(--ap-green); }
.ap-radar { max-width: 320px; margin: 8px auto 2px; }
.ap-radar svg { display: block; width: 100%; overflow: visible; }
.ap-radar-grid polygon, .ap-radar-grid line { fill: none; stroke: rgba(83, 107, 67, .18); stroke-width: 1; }
.ap-radar-value { fill: rgba(83, 107, 67, .23); stroke: var(--ap-green); stroke-width: 2; transition: points .5s ease; }
.ap-radar-labels { fill: var(--ap-muted); font-size: 11px; font-weight: 700; }
.ap-hero-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 16px; border-top: 1px solid var(--ap-line); }
.ap-hero-metrics div { display: flex; flex-direction: column; text-align: center; }
.ap-hero-metrics strong { font-size: 22px; }
.ap-hero-metrics span { color: var(--ap-muted); font-size: 11px; }
.ap-view { padding: 72px 0 96px; }
body[data-practice-view="session"] .ap-hero,
body[data-practice-view="result"] .ap-hero { display: none; }
.ap-section-heading, .ap-panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.ap-section-heading h2, .ap-panel-heading h2, .ap-teacher-copy h2, .ap-insight-panel h2, .ap-data-tools h2 { margin: 4px 0 6px; font-size: clamp(25px, 3vw, 34px); line-height: 1.25; letter-spacing: -.025em; }
.ap-section-heading p:last-child, .ap-data-tools p { margin: 0; color: var(--ap-muted); }
.ap-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
.ap-action-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 15px; min-height: 104px; padding: 20px; text-align: left; color: var(--ap-ink); border: 1px solid var(--ap-line); border-radius: 20px; background: var(--ap-paper); box-shadow: 0 8px 24px rgba(38, 54, 32, .04); transition: .2s ease; }
.ap-action-card:hover:not(:disabled) { transform: translateY(-3px); border-color: rgba(83, 107, 67, .35); box-shadow: var(--ap-shadow); }
.ap-action-daily { color: white; border-color: transparent; background: linear-gradient(135deg, #4d673e, #2d482a); }
.ap-action-daily small { color: rgba(255, 255, 255, .72) !important; }
.ap-action-card strong, .ap-action-card small { display: block; }
.ap-action-card strong { font-size: 17px; }
.ap-action-card small { margin-top: 3px; color: var(--ap-muted); }
.ap-action-count { padding: 5px 9px; border-radius: 999px; background: rgba(255, 255, 255, .13); font-size: 12px; font-weight: 800; white-space: nowrap; }
.ap-action-card:not(.ap-action-daily) .ap-action-count { color: var(--ap-green); background: var(--ap-green-light); }

.ap-learning-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr); gap: 20px; align-items: start; }
.ap-panel { padding: 28px; border: 1px solid var(--ap-line); border-radius: var(--ap-radius); background: var(--ap-paper); box-shadow: 0 12px 35px rgba(38, 54, 32, .05); }
.ap-topic-area + .ap-topic-area { margin-top: 24px; }
.ap-topic-area-header { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; color: var(--ap-muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.ap-topic-area-header::after { content: ""; height: 1px; flex: 1; background: var(--ap-line); }
.ap-topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ap-topic-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; min-height: 72px; padding: 12px 14px; text-align: left; border: 1px solid var(--ap-line); border-radius: 15px; color: var(--ap-ink); background: #fbfaf5; transition: .18s ease; }
.ap-topic-card:hover { border-color: rgba(83, 107, 67, .35); background: white; transform: translateY(-1px); }
.ap-topic-name { min-width: 0; }
.ap-topic-name strong, .ap-topic-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-topic-name small { color: var(--ap-muted); font-size: 11px; }
.ap-topic-progress { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: conic-gradient(var(--ap-green) var(--progress, 0%), #e5e7e0 0); }
.ap-topic-progress::after { content: ""; position: absolute; width: 30px; height: 30px; border-radius: 50%; background: #fbfaf5; }
.ap-topic-progress span { position: relative; z-index: 1; font-size: 9px; font-weight: 800; }
.ap-topic-card.is-due { border-color: rgba(216, 130, 68, .35); background: #fff9f2; }
.ap-insight-panel { position: sticky; top: 84px; }
.ap-next-insight { padding: 16px; margin: 18px 0 20px; border-radius: 16px; background: var(--ap-green-light); }
.ap-next-insight strong { display: block; }
.ap-next-insight p { margin: 4px 0 0; color: var(--ap-muted); font-size: 13px; }
.ap-learning-details { border-top: 1px solid var(--ap-line); }
.ap-learning-details summary { padding: 12px 0; color: var(--ap-green-dark); font-size: 13px; font-weight: 800; cursor: pointer; }
.ap-seven-day-plan { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.ap-seven-day-plan li { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; padding: 10px 11px; border-radius: 11px; background: #f3f5ee; }
.ap-seven-day-plan time { grid-row: span 2; color: var(--ap-green); font-size: 11px; font-weight: 800; }
.ap-seven-day-plan strong { font-size: 13px; }
.ap-seven-day-plan span { color: var(--ap-muted); font-size: 11px; }
.ap-weekly-report { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.ap-weekly-report div { padding: 10px; border-radius: 11px; background: #f3f5ee; }
.ap-weekly-report strong, .ap-weekly-report span { display: block; }
.ap-weekly-report strong { font-size: 18px; }
.ap-weekly-report span { color: var(--ap-muted); font-size: 10px; }
.ap-weekly-report p { grid-column: 1 / -1; margin: 2px 0 0; color: var(--ap-muted); font-size: 12px; }
.ap-mini-stats { margin: 0; }
.ap-mini-stats div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--ap-line); }
.ap-mini-stats dt { color: var(--ap-muted); }
.ap-mini-stats dd { margin: 0; font-weight: 800; }

.ap-teacher-panel { display: grid; grid-template-columns: .8fr 1.2fr; gap: 42px; margin-top: 20px; background: linear-gradient(145deg, #fefdf8, #edf3e7); }
.ap-teacher-copy p { color: var(--ap-muted); }
.ap-teacher-copy ul { padding-left: 20px; }
.ap-teacher-form fieldset, .ap-dialog fieldset { margin: 0 0 18px; padding: 0; border: 0; }
.ap-teacher-form legend, .ap-dialog legend { margin-bottom: 8px; font-size: 13px; font-weight: 800; }
.ap-compact-topic-list, .ap-dialog-topic-list { display: flex; flex-wrap: wrap; gap: 7px; }
.ap-topic-check { position: relative; }
.ap-topic-check input { position: absolute; opacity: 0; pointer-events: none; }
.ap-topic-check span { display: inline-flex; align-items: center; min-height: 36px; padding: 7px 11px; border: 1px solid var(--ap-line); border-radius: 999px; color: var(--ap-muted); background: rgba(255, 255, 255, .65); font-size: 12px; font-weight: 700; cursor: pointer; }
.ap-topic-check input:checked + span { color: white; border-color: var(--ap-green); background: var(--ap-green); }
.ap-topic-check input:focus-visible + span { outline: 3px solid rgba(76, 116, 128, .35); outline-offset: 2px; }
.ap-form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ap-form-row label, .ap-challenge-result label, .ap-dialog label { display: grid; gap: 6px; color: var(--ap-muted); font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ap-ink); border: 1px solid rgba(59, 77, 49, .22); border-radius: 11px; background: rgba(255, 255, 255, .85); }
textarea { resize: vertical; }
.ap-challenge-result { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--ap-line); }
.ap-challenge-result textarea { margin-bottom: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.ap-data-tools { display: flex; justify-content: space-between; gap: 28px; align-items: center; margin-top: 20px; padding: 24px 28px; border: 1px dashed rgba(83, 107, 67, .28); border-radius: 20px; }
.ap-data-tools h2 { font-size: 20px; }

.ap-session-view { min-height: 100vh; padding-top: 104px; background: radial-gradient(circle at top right, rgba(200, 220, 141, .22), transparent 32%), var(--ap-cream); }
.ap-session-container { max-width: 900px; }
.ap-session-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.ap-quit-button { white-space: nowrap; }
.ap-session-title-wrap h1 { margin: 2px 0 0; font-size: 25px; }
.ap-session-counter { display: flex; align-items: baseline; gap: 4px; color: var(--ap-muted); }
.ap-session-counter strong { color: var(--ap-ink); font-size: 26px; }
.ap-progress-track { height: 7px; margin: 18px 0 24px; overflow: hidden; border-radius: 99px; background: #dfe4da; }
.ap-progress-track div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ap-green), #91ad61); transition: width .35s ease; }
.ap-question-card { padding: clamp(24px, 5vw, 48px); border: 1px solid var(--ap-line); border-radius: 28px; background: var(--ap-paper); box-shadow: var(--ap-shadow); }
.ap-question-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.ap-question-meta span { padding: 5px 9px; border-radius: 999px; color: var(--ap-green); background: var(--ap-green-light); font-size: 11px; font-weight: 800; }
.ap-question-meta span:nth-child(2) { color: #805b37; background: #f6ead8; }
.ap-question-card > h2 { margin: 0; font-size: clamp(22px, 4vw, 31px); line-height: 1.5; letter-spacing: -.018em; }
.ap-question-context { color: var(--ap-muted); }
.ap-equation { margin: 20px 0; padding: 17px; overflow-x: auto; border-left: 4px solid var(--ap-green); border-radius: 0 12px 12px 0; background: #f2f5ed; font-size: 19px; text-align: center; }
.ap-question-visual { margin: 22px 0; padding: 16px; border: 1px solid var(--ap-line); border-radius: 16px; background: white; }
.ap-question-visual svg { display: block; width: min(100%, 520px); height: auto; margin: auto; }
.ap-answer-form { margin: 28px 0 8px; }
.ap-choice-list { display: grid; gap: 10px; }
.ap-choice { position: relative; }
.ap-choice input { position: absolute; opacity: 0; }
.ap-choice span { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 12px 15px; border: 1px solid var(--ap-line); border-radius: 14px; background: white; cursor: pointer; transition: .15s ease; }
.ap-choice span::before { content: ""; flex: 0 0 18px; height: 18px; border: 2px solid #aeb7a8; border-radius: 50%; background: transparent; }
.ap-choice input:checked + span { border-color: var(--ap-green); background: #f0f5eb; }
.ap-choice input:checked + span::before { border-color: var(--ap-green); background: var(--ap-green); box-shadow: inset 0 0 0 4px var(--ap-paper); }
.ap-choice input:focus-visible + span { outline: 3px solid rgba(76, 116, 128, .35); outline-offset: 2px; }
.ap-numeric-answer { display: grid; gap: 7px; color: var(--ap-muted); font-size: 13px; font-weight: 750; }
.ap-numeric-answer input { min-height: 58px; font-size: 20px; }
.ap-answer-help { margin: 8px 0 15px; color: var(--ap-muted); font-size: 12px; }
.ap-submit-answer { width: 100%; }
.ap-feedback { margin: 18px 0; padding: 15px 17px; border-radius: 14px; font-weight: 700; }
.ap-feedback.is-correct { color: #2e5c2b; background: #e2f0dd; border: 1px solid #bed5b5; }
.ap-feedback.is-wrong { color: #85403a; background: #fbebe8; border: 1px solid #e8c4bf; }
.ap-feedback.is-info { color: #315f6b; background: #e5f0f2; border: 1px solid #bfd3d8; }
.ap-hint-section { margin-top: 26px; padding: 20px 0; border-top: 1px solid var(--ap-line); border-bottom: 1px solid var(--ap-line); }
.ap-hint-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ap-hint-heading h3 { margin: 0; font-size: 16px; }
.ap-hint-heading span { color: var(--ap-muted); font-size: 12px; }
.ap-hint-list { display: grid; gap: 8px; margin-bottom: 10px; }
.ap-hint-item { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: #f2f4ed; animation: ap-reveal .25s ease both; }
.ap-hint-item strong { color: var(--ap-green); }
.ap-solution { margin-top: 28px; padding: 22px; border-radius: 18px; background: #f0f4eb; }
.ap-solution h3 { margin: 3px 0 15px; }
.ap-solution ol { display: grid; gap: 8px; margin: 0; padding-left: 24px; }
.ap-misconceptions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.ap-misconceptions span { padding: 5px 9px; border-radius: 999px; color: #83573c; background: #f4e6da; font-size: 11px; }
.ap-extension-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--ap-line); }
.ap-extension-links a { padding: 8px 12px; border-radius: 10px; color: var(--ap-green-dark); background: white; font-weight: 750; text-decoration: none; }
.ap-extension-links a:hover { text-decoration: underline; }
.ap-question-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.ap-result-view { min-height: 100vh; display: grid; align-items: center; padding-top: 110px; background: radial-gradient(circle at 50% 10%, rgba(200, 220, 141, .4), transparent 34%), var(--ap-cream); }
.ap-result-container { max-width: 760px; text-align: center; }
.ap-result-container h1 { margin: 7px 0; font-size: clamp(34px, 6vw, 56px); letter-spacing: -.04em; }
.ap-result-container > p:not(.ap-kicker) { color: var(--ap-muted); }
.ap-result-score { display: flex; flex-direction: column; margin: 30px auto 24px; }
.ap-result-score strong { color: var(--ap-green); font-size: 64px; line-height: 1; }
.ap-result-score span { margin-top: 7px; color: var(--ap-muted); }
.ap-result-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.ap-result-metrics div { display: flex; flex-direction: column-reverse; padding: 16px 8px; border: 1px solid var(--ap-line); border-radius: 15px; background: var(--ap-paper); }
.ap-result-metrics span { color: var(--ap-muted); font-size: 11px; }
.ap-result-metrics strong { font-size: 20px; }
.ap-diagnostic-report { margin: 28px 0 20px; padding: 24px; text-align: left; border: 1px solid var(--ap-line); border-radius: 20px; background: var(--ap-paper); }
.ap-diagnostic-report h2 { margin: 4px 0 16px; font-size: 24px; }
.ap-diagnostic-report h3 { margin: 20px 0 10px; font-size: 16px; }
.ap-diagnostic-report > p:not(.ap-kicker) { margin: 10px 0; color: var(--ap-muted); font-size: 13px; }
.ap-diagnostic-weak { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ap-diagnostic-weak article { padding: 12px; border-radius: 13px; background: var(--ap-green-light); }
.ap-diagnostic-weak strong, .ap-diagnostic-weak span { display: block; }
.ap-diagnostic-weak span { margin-top: 3px; color: var(--ap-muted); font-size: 11px; }
.ap-result-skills { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 22px 0; }
.ap-result-skills span { padding: 6px 10px; border-radius: 99px; background: var(--ap-green-light); font-size: 12px; }
.ap-result-actions { justify-content: center; }

.ap-dialog { width: min(720px, calc(100% - 28px)); max-height: min(86vh, 800px); padding: 30px; overflow: auto; border: 1px solid var(--ap-line); border-radius: 24px; color: var(--ap-ink); background: var(--ap-paper); box-shadow: 0 30px 100px rgba(20, 35, 17, .28); }
.ap-dialog::backdrop { background: rgba(24, 34, 22, .45); backdrop-filter: blur(5px); }
.ap-dialog h2 { margin: 4px 0 5px; font-size: 28px; }
.ap-dialog > form > p:not(.ap-kicker, .ap-form-error) { color: var(--ap-muted); }
.ap-dialog-close-form { position: sticky; top: 0; z-index: 2; height: 0; text-align: right; }
.ap-dialog-close-form button { min-width: 56px; height: 38px; padding: 0 12px; border: 1px solid var(--ap-line); border-radius: 10px; color: var(--ap-muted); background: white; font-size: 13px; font-weight: 700; }
.ap-dialog-topic-list { max-height: 280px; padding: 13px; overflow: auto; border: 1px solid var(--ap-line); border-radius: 14px; }
.ap-form-error { margin: 9px 0; color: var(--ap-red); font-weight: 700; }
.ap-code-dialog { max-width: 560px; }

.ap-toast { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 9999; max-width: min(420px, calc(100% - 36px)); padding: 13px 17px; border-radius: 13px; color: white; background: #23321f; box-shadow: var(--ap-shadow); animation: ap-reveal .2s ease both; }
.ap-print-sheet { display: none; }

@keyframes ap-reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
    .ap-hero-grid { grid-template-columns: 1fr; }
    .ap-hero-card { width: min(520px, 100%); }
    .ap-learning-layout { grid-template-columns: 1fr; }
    .ap-insight-panel { position: static; }
    .ap-teacher-panel { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .ap-container { width: min(100% - 24px, 1180px); }
    .ap-hero { padding: 92px 0 48px; }
    .ap-hero-copy h1 { font-size: clamp(38px, 12vw, 52px); }
    .ap-hero-copy h1 span { font-size: .86em; white-space: normal; }
    .ap-hero-actions .ap-button { width: 100%; }
    .ap-action-grid, .ap-topic-grid { grid-template-columns: 1fr; }
    .ap-section-heading, .ap-panel-heading { align-items: flex-start; flex-direction: column; }
    .ap-map-legend { justify-content: flex-start; }
    .ap-panel, .ap-question-card { padding: 20px; border-radius: 20px; }
    .ap-form-row { grid-template-columns: 1fr; }
    .ap-data-tools { align-items: stretch; flex-direction: column; }
    .ap-data-tools .ap-inline-actions .ap-button { flex: 1 1 45%; }
    .ap-session-view { padding-top: 88px; }
    .ap-session-header { grid-template-columns: auto 1fr auto; }
    .ap-session-title-wrap h1 { font-size: 18px; }
    .ap-result-metrics { grid-template-columns: repeat(2, 1fr); }
    .ap-diagnostic-weak { grid-template-columns: 1fr; }
    .ap-result-actions .ap-button { width: 100%; }
    .ap-question-footer .ap-button { width: 100%; }
}

html[data-theme="dark"] { color-scheme: dark; --ap-ink: #e8ede4; --ap-muted: #aeb8a9; --ap-cream: #151b14; --ap-paper: #1d251c; --ap-line: rgba(221, 233, 215, .13); --ap-green: #9bb879; --ap-green-light: #293726; --ap-shadow: 0 20px 60px rgba(0, 0, 0, .28); }
html[data-theme="dark"] .ap-hero { background: radial-gradient(circle at 72% 18%, rgba(102, 128, 72, .3), transparent 35%), linear-gradient(140deg, #1a2118, #202b1e); }
html[data-theme="dark"] .ap-lead,
html[data-theme="dark"] .ap-section-heading p:last-child,
html[data-theme="dark"] .ap-data-tools p { color: var(--ap-muted); }
html[data-theme="dark"] .ap-hero-card { background: rgba(29, 37, 28, .8); border-color: rgba(255,255,255,.12); }
html[data-theme="dark"] .ap-action-card:not(.ap-action-daily),
html[data-theme="dark"] .ap-topic-card,
html[data-theme="dark"] .ap-choice span,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #222b20; }
html[data-theme="dark"] .ap-topic-progress::after { background: #222b20; }
html[data-theme="dark"] .ap-teacher-panel { background: linear-gradient(145deg, #1d251c, #222e20); }
html[data-theme="dark"] .ap-equation,
html[data-theme="dark"] .ap-hint-item,
html[data-theme="dark"] .ap-solution,
html[data-theme="dark"] .ap-seven-day-plan li,
html[data-theme="dark"] .ap-weekly-report div { background: #263124; }
html[data-theme="dark"] .ap-question-visual { background: #20291e; }
html[data-theme="dark"] .ap-extension-links a { background: #1b241a; }
html[data-theme="dark"] .ap-extension-links a,
html[data-theme="dark"] .ap-button-secondary,
html[data-theme="dark"] .ap-button-ghost { color: #dcebd0; }
html[data-theme="dark"] .ap-dialog { background: #1d251c; }
html[data-theme="dark"] .ap-diagnostic-report { background: #1d251c; }
html[data-theme="dark"] .ap-dialog-close-form button { color: var(--ap-ink); background: #222b20; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
    @page { size: A4; margin: 15mm; }
    body { color: #111 !important; background: white !important; font-family: "Noto Sans TC", sans-serif; }
    body > *:not(#printSheet) { display: none !important; }
    #printSheet { display: block !important; }
    .ap-print-sheet header { margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid #222; }
    .ap-print-sheet header h1 { margin: 0 0 5px; font-size: 22px; }
    .ap-print-sheet header p { margin: 0 0 12px; }
    .ap-print-question { break-inside: avoid; margin: 0 0 18px; }
    .ap-print-question h2 { font-size: 15px; line-height: 1.6; }
    .ap-print-question ol { margin-top: 6px; }
    .ap-print-space { height: 50px; border-bottom: 1px dotted #aaa; }
    .ap-print-answer { padding: 8px 12px; border-left: 3px solid #444; background: #f2f2f2 !important; }
    body[data-print-mode="questions"] .ap-print-answer { display: none !important; }
}
