/* ── 色彩基底：沿用 www.shinder.work 案例頁（cases/case.css）的中性紙色與青綠強調色，
      另外加上報告用的三種狀態色 ── */
:root,
:root[data-theme="light"] {
  --paper: #eceef3;
  --card: #fbfcfe;
  --ink: #171b26;
  --muted: #5c6479;
  --rule: #d4d8e2;
  --accent: #1d6b66;
  --accent-soft: rgba(29, 107, 102, .09);
  --ok: #1d6b66;
  --ok-soft: rgba(29, 107, 102, .09);
  --caution: #8a5a00;
  --caution-soft: rgba(176, 122, 14, .12);
  --bad: #a0432f;
  --bad-soft: rgba(160, 67, 47, .09);
  --code-bg: #f1f3f8;
  --shadow: 0 1px 2px rgba(23, 27, 38, .05), 0 8px 24px -16px rgba(23, 27, 38, .35);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #11141c;
  --card: #171b25;
  --ink: #dfe3ec;
  --muted: #8e97ab;
  --rule: #262c39;
  --accent: #6cc5bb;
  --accent-soft: rgba(108, 197, 187, .1);
  --ok: #6cc5bb;
  --ok-soft: rgba(108, 197, 187, .1);
  --caution: #e0b060;
  --caution-soft: rgba(224, 176, 96, .11);
  --bad: #e88a72;
  --bad-soft: rgba(232, 138, 114, .11);
  --code-bg: #10131a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -16px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11141c;
    --card: #171b25;
    --ink: #dfe3ec;
    --muted: #8e97ab;
    --rule: #262c39;
    --accent: #6cc5bb;
    --accent-soft: rgba(108, 197, 187, .1);
    --ok: #6cc5bb;
    --ok-soft: rgba(108, 197, 187, .1);
    --caution: #e0b060;
    --caution-soft: rgba(224, 176, 96, .11);
    --bad: #e88a72;
    --bad-soft: rgba(232, 138, 114, .11);
    --code-bg: #10131a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -16px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 24px; }

a { color: inherit; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.mono,
code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8125rem;
  letter-spacing: -.01em;
}
.num { font-variant-numeric: tabular-nums; }

/* ── 頁首 ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 0 0;
  color: var(--muted);
}
.topbar a { text-decoration: none; }
.topbar a:hover { color: var(--accent); }
.toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  font: inherit;
  line-height: 1;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
}
.toggle:hover { color: var(--ink); border-color: var(--accent); }
/* 圖示顯示的是「按下去會切換成的主題」：淺色時顯示月亮，深色時顯示太陽 */
.toggle .icon-sun { display: none; }
:root[data-theme="dark"] .toggle .icon-sun { display: block; }
:root[data-theme="dark"] .toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .toggle .icon-moon { display: none; }
}

/* ── Hero ── */
.hero { padding: 52px 0 8px; }
.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: .75rem;
  letter-spacing: .08em;
  border-top: 3px solid var(--accent);
  padding-top: 10px;
}
.hero h1 {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: clamp(2rem, 6.4vw, 3.25rem);
  line-height: 1.2;
  letter-spacing: -.01em;
  margin: 18px 0 0;
}
/* 標題只在詞組之間換行 */
.hero h1 span { display: inline-block; }
.hero .sub {
  margin: 12px 0 0;
  color: var(--accent);
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: clamp(1.125rem, 3.2vw, 1.5rem);
  line-height: 1.5;
}
.hero .lede {
  margin: 24px 0 0;
  max-width: 36em;
  font-size: 1.125rem;
}
.hero .lede strong { font-weight: 700; border-bottom: 2px solid var(--accent); }

/* ── 輸入表單 ── */
.checker {
  margin: 36px 0 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 6px solid var(--accent);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 22px 24px 18px;
}
.checker label {
  display: block;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: 1.0625rem;
  margin-bottom: 10px;
}
.field { display: flex; gap: 10px; }
.field input {
  flex: 1;
  min-width: 0;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9375rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 11px 14px;
}
.field input::placeholder { color: var(--muted); opacity: .75; }
.field input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.field button {
  flex: none;
  font: inherit;
  font-weight: 700;
  color: var(--card);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  padding: 0 22px;
  min-height: 46px;
}
.field button:hover { filter: brightness(1.08); }
.field button:disabled { cursor: progress; opacity: .6; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.7; }
.linkish {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { border-bottom-width: 2px; }

/* ── 進度與錯誤訊息 ── */
.notice {
  margin: 18px 0 0;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 14px 18px;
  font-size: .9375rem;
}
.notice-bad { background: var(--bad-soft); border-left-color: var(--bad); }
.notice strong { display: block; }
.notice .mono { display: block; margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
.progress {
  position: relative;
  height: 3px;
  margin-top: 12px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  background: var(--accent);
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(290%); }
}

/* ── 報告 ── */
.report { padding-top: 52px; }
.report[hidden] { display: none; }
.report-head { padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.report-head h2 {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.35;
  margin: 0;
}
/* 報告標題只是程式移動焦點的落點（給螢幕閱讀器報讀用），不是可操作的元件，不畫外框 */
.report-head h2:focus { outline: none; }
.report-head .target { display: block; margin-top: 8px; color: var(--accent); font-size: .875rem; overflow-wrap: anywhere; }
.report-head .when { margin: 4px 0 0; color: var(--muted); font-size: .8125rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.stats li {
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--tone);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 16px 18px 14px;
}
.stats .big {
  display: block;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.2;
  color: var(--tone);
  font-variant-numeric: tabular-nums;
}
.stats .what { display: block; margin-top: 4px; color: var(--muted); font-size: .875rem; }
.verdict { margin: 18px 0 0; max-width: 40em; }
.todo { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.todo a {
  display: inline-block;
  border: 1px solid var(--tone);
  color: var(--tone);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: .8125rem;
  line-height: 1.7;
  text-decoration: none;
}
.todo a:hover { background: var(--tone-soft); }

[data-status="pass"] { --tone: var(--ok); --tone-soft: var(--ok-soft); }
[data-status="warn"] { --tone: var(--caution); --tone-soft: var(--caution-soft); }
[data-status="fail"] { --tone: var(--bad); --tone-soft: var(--bad-soft); }
[data-status="na"] { --tone: var(--muted); --tone-soft: transparent; }

.group { padding-top: 44px; }
.group-head h3 {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 1.4;
  margin: 0;
}
.group-head p { margin: 4px 0 0; color: var(--muted); font-size: .9375rem; }

.item {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--tone);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 18px 22px 18px;
  scroll-margin-top: 16px;
}
.item-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.item-head h4 {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.5;
  margin: 0;
}
.badge {
  flex: none;
  display: inline-block;
  min-width: 4.4em;
  text-align: center;
  color: var(--tone);
  background: var(--tone-soft);
  border: 1px solid var(--tone);
  border-radius: 3px;
  padding: 0 8px;
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1.75;
  white-space: nowrap;
}
.item .summary { margin: 8px 0 0; }
.details {
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px dashed var(--rule);
  list-style: none;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.75;
}
.details li { padding: 2px 0 2px 1.1em; position: relative; overflow-wrap: anywhere; }
.details li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .8em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule);
}
.details li[data-status]::before { background: var(--tone); }
.details .mark { color: var(--tone); font-weight: 700; margin-right: .5em; }

.fix {
  margin: 14px 0 0;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 14px 16px 16px;
}
.fix-head { display: flex; align-items: center; gap: 10px; }
.fix .lbl {
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: .6875rem;
  letter-spacing: .06em;
}
.fix .where { color: var(--muted); font-size: .8125rem; }
.fix .copy {
  margin-left: auto;
  font: inherit;
  font-size: .8125rem;
  line-height: 1.6;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 12px;
}
.fix .copy:hover { background: var(--accent); color: var(--card); }
.fix p { margin: 6px 0 0; font-size: .9375rem; }
.fix pre {
  margin: 10px 0 0;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8125rem;
  line-height: 1.7;
  tab-size: 2;
}
.fix pre code { font-size: inherit; }

/* ── 說明區塊 ── */
.block { padding: 60px 0 0; }
.block-head { padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.block-head h2 {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.4;
  margin: 0;
}
.block-head p { margin: 6px 0 0; color: var(--muted); font-size: .9375rem; }
.block > p { margin: 20px 0 0; max-width: 40em; }

.points { margin: 8px 0 0; padding: 0; list-style: none; max-width: 42em; }
.points li { padding: 14px 0; border-bottom: 1px dashed var(--rule); }
.points li:last-child { border-bottom: 0; }
.points strong { font-weight: 700; }
.plain { margin: 16px 0 0; padding-left: 1.3em; max-width: 40em; }
.plain li { margin-bottom: 6px; }

.legend { margin: 20px 0 0; padding: 0; list-style: none; max-width: 42em; }
.legend li { display: flex; align-items: baseline; gap: 14px; padding: 6px 0; }

footer {
  margin-top: 56px;
  padding: 24px 0 44px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.7;
}
footer .mono { display: block; margin-bottom: 6px; }
footer a { text-decoration: none; border-bottom: 1px solid var(--rule); }
footer a:hover { color: var(--accent); border-bottom-color: currentColor; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .progress::after { width: 100%; opacity: .5; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 20px; }
  .hero { padding: 36px 0 4px; }
  .checker { padding: 18px 16px 14px; }
  .field { flex-direction: column; }
  .stats { gap: 8px; }
  .stats li { padding: 12px 12px 10px; }
  .stats .big { font-size: 1.625rem; }
  .item { padding: 16px 16px; }
  .block { padding-top: 48px; }
  .report { padding-top: 40px; }
}

@media print {
  .checker, .toggle, .fix .copy, #what, #how, #polite { display: none; }
  body { background: #fff; }
  .item, .stats li { box-shadow: none; break-inside: avoid; }
}
