:root {
    color-scheme: light;
    --bg-canvas: #ffefe3;
    --bg-panel: #ffffff;
    --bg-panel-strong: #ffffff;
    --bg-soft: #f6f8fb;
    --bg-hover: #f7f9fc;
    --bg-selected: #e6f1ff;
    --bg-success: #eaf7ee;
    --bg-warning: #fff4df;
    --bg-danger: #fff0ef;
    --line-soft: rgba(18, 31, 53, 0.1);
    --line-strong: rgba(18, 31, 53, 0.18);
    --text-primary: #172033;
    --text-secondary: rgba(23, 32, 51, 0.74);
    --text-muted: rgba(23, 32, 51, 0.54);
    --text-danger: #b02a37;
    --accent: #0a6fe8;
    --success: #237a45;
    --warning: #a36105;
    --danger: #b02a37;
    --shadow-panel: 0 14px 34px rgba(52, 67, 92, 0.1);
    --shadow-card: 0 8px 22px rgba(30, 42, 64, 0.07);
    --shadow-focus: 0 0 0 4px rgba(88, 156, 255, 0.2);
    --page-gutter: clamp(24px, 5vw, 48px);
    --stack-gap: 16px;
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang TC", "Hiragino Sans CNS", "Noto Sans TC",
        "Microsoft JhengHei UI", "Microsoft JhengHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    color: var(--text-primary);
    background: var(--bg-canvas);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: 3px; }
button { cursor: pointer; }
p, h1, h2 { margin: 0; }
button:focus-visible, a:focus-visible, [tabindex="-1"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 100; }
.skip-link:focus { top: 10px; padding: 10px 16px; background: var(--bg-panel); }
.app-shell { width: min(760px, calc(100% - var(--page-gutter))); margin-inline: auto; }
.site-navbar-inner { width: min(1180px, calc(100% - clamp(1.5rem, 3vw, 2rem))); margin-inline: auto; display: flex; align-items: center; }
.site-breadcrumb { display: flex; align-items: center; gap: 0.38rem; margin: 0; padding: 0; list-style: none; }
.site-breadcrumb-item { min-width: 0; display: inline-flex; align-items: center; gap: 0.38rem; }
.site-breadcrumb-current { flex: 1 1 auto; }
.site-separator { flex: 0 0 auto; color: var(--text-muted); font-size: 0.9rem; line-height: 1; }
.site-brand { display: inline-flex; align-items: center; min-height: 30px; padding: 0 2px; border-radius: 8px; color: var(--text-primary); font-size: 0.86rem; font-weight: 700; text-decoration: none; }
.site-brand:hover { color: var(--accent); }
.site-brand:focus-visible { outline: 0; box-shadow: var(--shadow-focus); }
.site-page-title { min-width: 0; margin: 0; overflow: hidden; color: var(--text-primary); font-size: 1rem; font-weight: 800; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.epds-page .navbar-utility-button:disabled { background: transparent; color: var(--text-muted); cursor: default; transform: none; }
.page-intro { padding: var(--stack-gap) 0; text-align: center; }
.eyebrow { color: var(--accent); font-size: 0.82rem; font-weight: 750; letter-spacing: 0.08em; }
.scale-name { color: var(--text-primary); font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 800; line-height: 1.3; letter-spacing: -0.025em; }
.intro-instruction { color: var(--text-secondary); line-height: 1.8; }
.intro-instruction strong { color: var(--text-primary); font-weight: 700; }
.panel { padding: clamp(18px, 4vw, 28px); border: 1px solid var(--line-soft); border-radius: 18px; background: var(--bg-panel-strong); box-shadow: var(--shadow-card); }
.question-progress {
    --progress-surface: color-mix(in srgb, var(--bg-panel) 72%, var(--bg-canvas));
    --progress-ease: cubic-bezier(0.22, 0.68, 0, 1);
    width: min(100%, 600px);
    margin: 0 auto var(--stack-gap);
    padding: 12px 12px 6px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: var(--progress-surface);
}
.progress-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-inline: 6px; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
#progress-text { color: var(--text-primary); font-weight: 750; }
#answered-count { color: var(--text-secondary); font-size: 0.75rem; }
.is-finished #progress-text { color: var(--accent); }
.progress-track { position: relative; margin-top: 4px; }
.progress-rail { position: absolute; inset: 23px 5% auto; height: 2px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.progress-fill { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--accent); transform: scaleX(var(--progress-complete, 0)); transform-origin: left; transition: transform 280ms var(--progress-ease); }
.progress-dots { position: relative; display: flex; margin: 0; padding: 0; list-style: none; }
.progress-dots li { flex: 1 1 0; min-width: 0; }
.progress-dot { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-width: 24px; height: 48px; padding: 0; border: 0; border-radius: 8px; background: transparent; }
.progress-node { display: block; position: relative; width: 20px; height: 20px; border-radius: 50%; background: var(--line-strong); transform: scale(0.45); transition: transform 220ms var(--progress-ease), background-color 180ms ease, opacity 140ms ease, box-shadow 180ms ease; }
.progress-node::after { content: ""; position: absolute; left: 7px; top: 4px; width: 6px; height: 10px; border: solid var(--bg-panel-strong); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0.6); opacity: 0; transition: transform 220ms var(--progress-ease), opacity 180ms ease; }
.progress-dot.is-complete .progress-node { background: var(--accent); transform: scale(1); }
.progress-dot.is-complete .progress-node::after { transform: rotate(45deg) scale(1); opacity: 1; }
.progress-dot[aria-current="step"] .progress-node { opacity: 0; }
.progress-dot:disabled { cursor: default; }
.progress-dot:focus-visible { outline-offset: -3px; }
.progress-cursor { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; width: 10%; height: 48px; pointer-events: none; transform: translateX(calc(var(--progress-position, 0) * 100%)); transition: transform 280ms var(--progress-ease), opacity 160ms ease; }
.progress-current-number { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); color: var(--bg-panel-strong); box-shadow: 0 0 0 4px var(--progress-surface), 0 3px 10px color-mix(in srgb, var(--accent) 20%, transparent); font-size: 0.82rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.is-finished .progress-cursor { opacity: 0; }
.question-progress.is-empty *, .question-progress.is-empty *::after { transition: none; }
@media (hover: hover) {
    .progress-dot:not(:disabled):hover .progress-node { transform: scale(1.15); box-shadow: 0 0 0 4px var(--bg-selected); }
}
.question-card { min-width: 0; margin: 0; }
.question-card h2 { margin-bottom: 16px; font-size: 1.15rem; line-height: 1.55; font-weight: 750; }
.question-number { margin-right: 9px; color: var(--accent); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.question-options { display: flex; flex-direction: column; gap: 10px; }
.answer-option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 13px 14px; border: 1px solid var(--line-soft); border-radius: 12px; color: var(--text-primary); background: var(--bg-soft); text-align: left; line-height: 1.55; transition: background 120ms ease, border-color 120ms ease; }
.answer-option::before { content: ""; flex: 0 0 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 50%; }
@media (hover: hover) {
    .answer-option:not([aria-disabled="true"]):hover { background: var(--bg-hover); border-color: var(--accent); }
}
.answer-option[aria-pressed="true"] { background: var(--bg-selected); border-color: var(--accent); }
.answer-option[aria-pressed="true"]::before { border: 5px solid var(--accent); }
.answer-option[aria-disabled="true"] { cursor: default; }
.option-label { flex: 1 1 auto; min-width: 0; }
.option-score { flex: 0 0 auto; min-width: 2.25em; color: var(--text-secondary); font-size: 0.78rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.question-navigation { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.question-navigation .button { gap: 6px; min-height: 44px; padding: 8px 5px; font-size: 0.86rem; }
.question-navigation button:disabled { visibility: hidden; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-height: 48px; padding: 11px 19px; border: 1px solid var(--line-strong); border-radius: 12px; font-weight: 750; line-height: 1.5; text-decoration: none; }
.primary-button { background: var(--accent); border-color: var(--accent); color: var(--bg-panel-strong); }
.primary-button:hover { filter: brightness(0.94); }
.secondary-button { color: var(--text-primary); background: var(--bg-soft); }
.secondary-button:hover, .text-button:hover { background: var(--bg-hover); }
.text-button { color: var(--text-secondary); background: transparent; border-color: transparent; }
.result-panel {
    --result-accent: var(--success);
    margin-top: var(--stack-gap);
    scroll-margin-top: 20px;
    border: 0;
    background: var(--bg-success);
}
.result-panel[data-level="attention"] { --result-accent: var(--warning); background: var(--bg-warning); }
.result-panel[data-level="assessment"] { --result-accent: var(--danger); background: var(--bg-danger); }
.result-panel .eyebrow, .result-panel .result-score strong { color: var(--result-accent); }
.result-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding-bottom: 20px; }
.result-date { margin-top: 6px; color: var(--text-secondary); font-size: 0.8rem; }
.result-score { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.result-score strong { font-size: 3rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.result-score span { color: var(--text-secondary); font-size: 0.9rem; }
.result-guidance h2 { margin-bottom: 8px; font-size: 1.2rem; font-weight: 750; line-height: 1.45; }
.result-actions { margin-top: 22px; }
.answers-toggle { gap: 10px; }
.disclosure-icon { flex: 0 0 auto; transition: transform 160ms ease; }
.answers-toggle[aria-expanded="true"] .disclosure-icon { transform: rotate(180deg); }
.answer-details { margin-top: 22px; }
.answer-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.answer-table th, .answer-table td { padding: 8px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.answer-table thead th { color: var(--text-secondary); font-weight: 650; }
.answer-table tbody th { width: 47%; font-weight: 500; }
.answer-table th:last-child, .answer-table td:last-child { width: 3em; text-align: right; white-space: nowrap; }
.answer-cell { display: flex; align-items: center; gap: 8px; }
.answer-text { flex: 1 1 auto; min-width: 0; }
.edit-answer { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-width: 40px; min-height: 44px; padding: 8px 4px; border: 0; border-radius: 8px; color: var(--accent); background: transparent; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.edit-answer:hover { background: var(--bg-hover); }
.edit-icon { display: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.print-only { display: none; }

@media (max-width: 640px) {
    .page-intro { padding-top: 0; }
    .page-intro .scale-name { display: none; }
    .intro-instruction { line-height: 1.25; }
    .answer-table th, .answer-table td { padding-inline: 6px; }
    .answer-table tbody th { width: 40%; }
    .answer-table th:last-child, .answer-table td:last-child { width: 2.25em; }
    .answer-cell { gap: 4px; }
    .edit-answer { min-width: 32px; }
    .edit-label { display: none; }
    .edit-icon { display: block; }
}

@media (max-width: 460px) {
    .intro-instruction { font-size: 0.9rem; }
    .question-card { padding: 18px 16px; }
    .question-card h2 { font-size: 1.05rem; margin-bottom: 12px; }
    .answer-option { min-height: 52px; padding: 11px 12px; }
    .action-row { align-items: stretch; }
    .action-row .primary-button { flex: 1 1 100%; }
    .result-score strong { font-size: 2.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

@page { size: A4; margin: 13mm; }
@media print {
    .screen-only { display: none !important; }
    .print-only { display: block; }
    .epds-page .app-shell { width: 100%; margin: 0; padding: 0; }
    .epds-page { font-size: 10pt; line-height: 1.5; }
    .result-panel { margin: 0; padding: 0; border: none; border-radius: 0; box-shadow: none; }
    .epds-page .result-panel { background: transparent; }
    .print-heading { margin-bottom: 5mm; }
    .print-heading h1 { font-size: 18pt; }
    .print-heading p, .result-date { font-size: 9pt; }
    .result-heading { padding-bottom: 4mm; }
    .result-score strong { font-size: 28pt; }
    .result-guidance { break-inside: avoid; }
    .result-guidance h2 { margin-bottom: 1.5mm; font-size: 12pt; }
    .answer-details { margin-top: 4mm; border: none; }
    #answer-details { display: block !important; }
    .answer-table { font-size: 9pt; }
    .answer-table th, .answer-table td { padding: 2.2mm 2mm; vertical-align: top; }
    .answer-table tbody th { width: 47%; }
    .answer-table th:last-child, .answer-table td:last-child { width: 3em; }
    .answer-cell { display: block; }
    .answer-table tr { break-inside: avoid; }
    .answer-table thead { display: table-header-group; }
    .print-sources { margin-top: 4mm; color: var(--text-secondary); font-size: 7.5pt; break-inside: avoid; }
    .print-sources p + p { margin-top: 1mm; }
    #incomplete-print { margin-top: 20px; }
    a { color: inherit; text-decoration: none; }
}
