/*=============================================================================
  markdown-fixer 官網樣式
  設計語言：活版印刷的雙色印刷品。紙白、墨黑、硃砂三色，沒有第四種顏色。
  硃砂只出現在「被修正或被回報的地方」，其餘一律靠字級、字重、細線與留白。
  =============================================================================*/

/* ---------- 1. 色彩與字級 ---------- */

:root {
  color-scheme: light;

  --paper: #ffffff;
  --ink: #17181a;
  --muted: #5b5e63;

  --hair: rgba(23, 24, 26, 0.16);
  --hair-strong: rgba(23, 24, 26, 0.4);

  --seal: #a82a1c;
  --focus: var(--ink);

  --slab-bg: #17181a;
  --slab-fg: #ffffff;
  --slab-muted: rgba(255, 255, 255, 0.72);
  --slab-hair: rgba(255, 255, 255, 0.24);
  --slab-seal: #ff8a70;

  --fs-body: 1.0625rem;
  --fs-sm: 0.9375rem;
  --fs-xs: 0.8125rem;
  --fs-display: clamp(2.4rem, 5.6vw, 4.4rem);

  --serif: "Noto Serif TC", "Songti TC", "Noto Serif CJK TC", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --head-h: 3.85rem;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --paper: #131416;
  --ink: #f2f1ec;
  --muted: #a2a4a6;

  --hair: rgba(242, 241, 236, 0.18);
  --hair-strong: rgba(242, 241, 236, 0.44);

  --seal: #ef6a4e;
  --focus: var(--ink);

  --slab-bg: #1c1e21;
  --slab-fg: #f2f1ec;
  --slab-muted: rgba(242, 241, 236, 0.72);
  --slab-hair: rgba(242, 241, 236, 0.22);
  --slab-seal: #ff8a70;
}

/* ---------- 2. 基礎 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head-h) + 1rem);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.9;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1,
h2,
h3,
p,
figure,
ul,
ol,
dl,
dd,
pre,
table {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-thickness: 2px;
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.88em;
}

/* 行內程式碼不在連字號斷行，避免 --write 被拆成兩行 */
:not(pre) > code,
:not(pre) > kbd {
  white-space: nowrap;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.shell {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 40;
  transform: translate(-50%, -120%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.55rem 1.1rem;
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: transform 0.16s var(--ease);
}

.skip-link:focus {
  transform: translate(-50%, 0);
  color: var(--paper);
}

/* ---------- 3. 頁首 ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
}

.masthead[data-scrolled="true"] {
  border-bottom-color: var(--hair-strong);
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.25rem);
  min-height: var(--head-h);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--ink);
}

.wordmark__hash {
  color: var(--seal);
  font-weight: 600;
}

.nav {
  margin-left: auto;
}

.nav ul {
  display: flex;
  align-items: baseline;
  gap: clamp(0.85rem, 2vw, 1.6rem);
}

.nav a {
  display: inline-block;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.15rem;
  border-bottom: 1px solid transparent;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.themer {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--hair-strong);
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.themer:hover {
  background: var(--ink);
  color: var(--paper);
}

.themer svg {
  width: 1rem;
  height: 1rem;
}

.themer .icon-sun {
  display: none;
}

:root[data-theme="dark"] .themer .icon-sun {
  display: block;
}

:root[data-theme="dark"] .themer .icon-moon {
  display: none;
}

html:not(.js) .themer {
  display: none;
}

/* ---------- 4. 首屏 ---------- */

.hero {
  padding-block: clamp(2.75rem, 7vw, 5.5rem) clamp(2rem, 4vw, 3.25rem);
  border-bottom: 3px double var(--ink);
}

.hero h1 {
  font-size: var(--fs-display);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.hero h1 span {
  display: block;
}

.hero__sub {
  margin-top: clamp(1rem, 2vw, 1.5rem);
  max-width: 30em;
  color: var(--muted);
}

.hero__act {
  margin-top: clamp(1.75rem, 3.5vw, 2.5rem);
  padding-top: 1.1rem;
  border-top: 1px solid var(--ink);
  max-width: 34rem;
}

/* ---------- 5. 指令與複製 ---------- */

.install {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--hair-strong);
  background: var(--paper);
}

.install code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.62rem 0.85rem;
  font-size: var(--fs-sm);
  line-height: 1.55;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.install code::-webkit-scrollbar {
  display: none;
}

.prompt {
  color: var(--muted);
}

.copy {
  flex: none;
  border: 0;
  border-left: 1px solid var(--hair-strong);
  background: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  padding: 0 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.copy:hover {
  background: var(--ink);
  color: var(--paper);
}

.copy[data-copied="true"] {
  background: var(--seal);
  color: var(--paper);
}

/* ---------- 6. 區塊 ---------- */

.section {
  padding-block: clamp(2.75rem, 5.5vw, 4.5rem);
  border-top: 1px solid var(--hair);
}

.section--flush {
  border-top: 0;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: clamp(1rem, 4vw, 3rem);
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}

.section h2 {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  font-weight: 900;
  line-height: 1.22;
  letter-spacing: -0.008em;
  text-wrap: balance;
}

.section__note {
  flex: none;
  max-width: 22rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-align: right;
  text-wrap: balance;
}

.lead {
  max-width: 46em;
  color: var(--muted);
  text-wrap: pretty;
}

.note {
  max-width: 46em;
  margin-top: 1.25rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- 7. 示範：校樣 ---------- */

.proof {
  display: grid;
  gap: 1.15rem;
  padding-block: clamp(1.75rem, 3vw, 2.5rem);
  border-top: 1px solid var(--hair);
}

.proof:first-child {
  border-top: 2px solid var(--ink);
  padding-top: 1.25rem;
}

.proof__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
}

.proof__head h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.proof__head h3 code {
  margin-left: 0.65rem;
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
}

.proof__rules {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.proof__rules b {
  font-weight: 500;
  color: var(--seal);
}

.proof__lead {
  max-width: 40em;
  color: var(--muted);
}

.proof__sheets {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--hair-strong);
}

.sheet {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.sheet + .sheet {
  border-left: 1px solid var(--hair);
}

.sheet figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--hair);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.sheet figcaption .file {
  font-family: var(--mono);
}

.code {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  align-items: stretch;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.8;
  padding-block: 0.75rem;
}

.gutter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-right: 0.45rem;
  border-right: 1px solid var(--hair);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.8;
  opacity: 0.72;
  user-select: none;
}

.gutter span {
  height: 1.8em;
}

.gutter .dead {
  color: var(--seal);
  text-decoration: line-through;
  opacity: 1;
}

.code pre {
  margin: 0;
  padding: 0 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: inherit;
}

/* 校對痕跡 */

mark {
  background: none;
  color: inherit;
}

mark.bad {
  text-decoration: underline;
  text-decoration-color: var(--seal);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

del.ws {
  color: var(--seal);
  text-decoration: line-through;
  text-decoration-color: var(--seal);
}

ins {
  text-decoration: none;
}

.ins {
  background: var(--seal);
  color: var(--paper);
  padding: 0 0.1em;
}

.ins-space {
  display: inline-block;
  width: 0.28em;
  height: 1.05em;
  background: var(--seal);
  vertical-align: -0.12em;
}

/* 終端輸出 */

.term {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.72;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hair);
  background: var(--paper);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  tab-size: 2;
}

/* 每行輸出各自成塊：續行才能對齊訊息欄，而不是掉回最左邊。
   行與行之間原始碼的換行只含空白，flex 不會把它算成一個項目。 */

.term code {
  display: flex;
  flex-direction: column;
  white-space: pre-wrap;
}

.term .t:empty {
  min-height: 1.72em;
}

/* 位置＋等級＋規則編號固定佔 29 個字元，續行縮排對齊訊息開頭 */
.term .t.m {
  padding-left: 29ch;
  text-indent: -29ch;
}

.term .p {
  color: var(--muted);
}

.term .sev {
  color: var(--muted);
}

.term .fx {
  color: var(--seal);
}

/* ---------- 8. 墨色帶：安全契約 ---------- */

.slab {
  margin: 0;
  padding-block: clamp(2.75rem, 5.5vw, 4.5rem);
  background: var(--slab-bg);
  color: var(--slab-fg);
}

.slab h2 {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  font-weight: 900;
  line-height: 1.22;
  letter-spacing: -0.008em;
  text-wrap: balance;
}

.slab .lead {
  margin-top: 1.1rem;
  color: var(--slab-muted);
}

.slab__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.25rem);
  margin-top: clamp(1.75rem, 3.5vw, 2.75rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--slab-hair);
}

.slab h3 {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.14em;
  margin-bottom: 0.85rem;
}

.slab ul li {
  padding-block: 0.42rem;
  border-bottom: 1px solid var(--slab-hair);
  font-size: var(--fs-sm);
}

.slab ul li:last-child {
  border-bottom: 0;
}

.slab ul.rules-list li {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.rid {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--slab-seal);
}

.slab .note {
  color: var(--slab-muted);
}

.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
  padding-top: 1.35rem;
  border-top: 1px solid var(--slab-hair);
  font-size: var(--fs-sm);
}

.chain li {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.chain li + li::before {
  content: "→";
  color: var(--slab-muted);
}

/* ---------- 9. 規則表 ---------- */

.table-wrap {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border-top: 2px solid var(--ink);
}

table.rules {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  line-height: 1.7;
}

table.rules caption {
  text-align: left;
}

table.rules th {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--ink);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-align: left;
  white-space: nowrap;
}

table.rules th.n {
  text-align: right;
}

table.rules td {
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid var(--hair);
  vertical-align: baseline;
}

table.rules tbody tr:last-child td {
  border-bottom: 1px solid var(--ink);
}

table.rules .name {
  font-weight: 600;
  white-space: nowrap;
}

table.rules .n {
  text-align: right;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

table.rules .fix {
  color: var(--seal);
}

table.rules .fix.zero {
  color: var(--muted);
}

table.rules .ids {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ---------- 10. 用法 ---------- */

.iface {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  padding-block: clamp(1.75rem, 3vw, 2.5rem);
  border-top: 1px solid var(--hair);
}

.iface:first-of-type {
  border-top: 2px solid var(--ink);
}

.iface h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.iface__note {
  margin-top: 0.6rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}

figure.code-figure {
  border: 1px solid var(--hair-strong);
}

figure.code-figure + figure.code-figure {
  margin-top: 1rem;
}

figure.code-figure figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.4rem 0.4rem 0.85rem;
  border-bottom: 1px solid var(--hair);
  font-size: var(--fs-xs);
  color: var(--muted);
}

figure.code-figure figcaption .copy {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--hair-strong);
  font-size: var(--fs-xs);
}

figure.code-figure pre {
  margin: 0;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.75;
}

.c {
  color: var(--muted);
}

/* 語言關鍵字只加重、不上色：硃砂留給被修正與被回報的地方。 */
.k {
  color: var(--ink);
  font-weight: 600;
}

.exit {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.15rem;
  font-size: var(--fs-sm);
}

.exit li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.exit .code {
  display: block;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--ink);
  text-align: center;
  border: 1px solid var(--hair-strong);
  padding-block: 0.05rem;
}

.exit .desc {
  color: var(--muted);
}

/* ---------- 11. 效能 ---------- */

.ledger {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  max-width: 44rem;
  border-top: 2px solid var(--ink);
}

.ledger > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: baseline;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--hair);
}

.ledger dt {
  font-size: var(--fs-body);
}

.ledger dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.3rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.ledger .unit {
  margin-left: 0.2rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.hotkey {
  display: grid;
  gap: 0.85rem;
  margin-top: clamp(1.75rem, 3vw, 2.25rem);
  padding-top: 1.35rem;
  border-top: 1px solid var(--hair);
  max-width: 48rem;
}

.hotkey a {
  justify-self: start;
  font-size: var(--fs-sm);
}

kbd {
  display: inline-block;
  padding: 0.05em 0.4em;
  border: 1px solid var(--hair-strong);
  font-size: 0.82em;
  line-height: 1.5;
}

/* ---------- 12. 安裝 ---------- */

.cmd-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  max-width: 38rem;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}

.cmd {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--hair-strong);
}

.cmd code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.62rem 0.85rem;
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.cmd code::-webkit-scrollbar {
  display: none;
}

.install-actions {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.75rem;
  max-width: 46rem;
}

.btn {
  justify-self: start;
  display: inline-block;
  padding: 0.5rem 1.15rem;
  border: 1px solid var(--ink);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.planned {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.docs {
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
}

.docs h3 {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.14em;
  margin-bottom: 0.75rem;
}

.docs li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding-block: 0.45rem;
  border-bottom: 1px solid var(--hair);
  font-size: var(--fs-sm);
}

.docs li:last-child {
  border-bottom: 1px solid var(--ink);
}

.docs a {
  text-decoration: none;
  white-space: nowrap;
}

.docs a:hover {
  text-decoration: underline;
}

.leader {
  flex: 1 1 auto;
  min-width: 1.5rem;
  border-bottom: 1px dotted var(--hair-strong);
  transform: translateY(-0.3em);
}

.docs .tag {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- 13. 印刷裝飾 ---------- */

/* 兩張 ornament 的像素只有單一墨色加上 alpha，所以當遮罩用，
   顏色交給 background-color: currentColor。
   一般區塊吃到 --ink，墨色帶吃到 --slab-fg，不必另做白色版本。 */
.ornament {
  display: block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.ornament--fleuron {
  width: 2.6rem;
  aspect-ratio: 83 / 112;
  margin-bottom: 1.4rem;
  -webkit-mask-image: url("../img/ornament-fleuron.png");
  mask-image: url("../img/ornament-fleuron.png");
}

.ornament--tailpiece {
  width: min(16.25rem, 72vw);
  aspect-ratio: 520 / 228;
  -webkit-mask-image: url("../img/ornament-tailpiece.png");
  mask-image: url("../img/ornament-tailpiece.png");
}

.endmark {
  margin-top: clamp(2.5rem, 5vw, 3.25rem);
  margin-inline: auto;
}

@media (forced-colors: active) {
  .ornament {
    background-color: CanvasText;
  }
}

/* ---------- 14. 頁尾 ---------- */

.foot {
  border-top: 3px double var(--ink);
  padding-block: 2rem 3rem;
}

.foot__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 1.3fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.foot__brand {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.foot .ver {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.foot__licence {
  margin-top: 0.5rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.foot nav ul {
  display: grid;
  gap: 0.4rem;
  font-size: var(--fs-sm);
}

.foot nav a {
  text-decoration: none;
}

.foot nav a:hover {
  text-decoration: underline;
}

.foot__meta {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.8;
}

/* ---------- 15. 響應式 ---------- */

@media (max-width: 60rem) {
  .slab__cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .iface {
    grid-template-columns: minmax(0, 1fr);
  }

  .foot__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 48rem) {
  :root {
    --head-h: 3.35rem;
  }

  .masthead__inner {
    flex-wrap: wrap;
    gap: 0 1rem;
    padding-block: 0.55rem;
  }

  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav ul {
    gap: 1.1rem;
    width: max-content;
    padding-bottom: 0.15rem;
  }

  .nav a {
    white-space: nowrap;
  }

  .themer {
    margin-left: auto;
  }

  html {
    scroll-padding-top: 6rem;
  }

  .section__head {
    display: block;
  }

  .section__note {
    margin-top: 0.6rem;
    max-width: none;
    text-align: left;
  }

  .proof__sheets {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet + .sheet {
    border-left: 0;
    border-top: 1px solid var(--hair-strong);
  }

  .proof__head {
    display: block;
  }

  .proof__rules {
    display: block;
    margin-top: 0.35rem;
  }

  .hero {
    padding-block: 2.25rem 1.75rem;
  }

  .hero__act {
    max-width: none;
  }

  /* 規則表改為堆疊 */

  table.rules,
  table.rules tbody,
  table.rules tr,
  table.rules td {
    display: block;
  }

  table.rules thead {
    display: none;
  }

  table.rules tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 0.75rem;
    padding-block: 0.7rem;
    border-bottom: 1px solid var(--hair);
  }

  table.rules tbody tr:last-child {
    border-bottom: 1px solid var(--ink);
  }

  table.rules td {
    padding: 0;
    border: 0;
  }

  table.rules .name {
    grid-column: 1 / -1;
    font-size: var(--fs-body);
    font-weight: 600;
    margin-bottom: 0.2rem;
  }

  table.rules .n {
    text-align: left;
    font-size: var(--fs-sm);
  }

  table.rules .n::before {
    content: attr(data-label) "　";
    font-family: var(--serif);
    font-size: var(--fs-xs);
    color: var(--muted);
  }

  table.rules .ids {
    grid-column: 1 / -1;
    margin-top: 0.3rem;
    line-height: 1.7;
    word-spacing: 0.1em;
  }

  /* 窄螢幕：等寬內容改為折行，不讓指令與輸出被切掉 */

  .install code,
  .cmd code {
    white-space: pre-wrap;
    overflow-wrap: normal;
  }

  .term,
  figure.code-figure pre {
    white-space: pre-wrap;
    overflow-wrap: normal;
  }

  /* 窄螢幕放不下 29 字元的懸掛縮排；續行齊左，靠相鄰關係讀成同一則訊息 */
  .term .t.m {
    padding-left: 0;
    text-indent: 0;
  }

  /* 旗標整體換行，不在連字號處斷開（例：--locked） */

  .nb {
    white-space: nowrap;
  }
}

@media (max-width: 30rem) {
  .foot__grid {
    gap: 1.25rem;
  }

  .ledger dd {
    font-size: 1.15rem;
  }

  .install code,
  .cmd code {
    font-size: var(--fs-xs);
  }
}

/* ---------- 16. 動態偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
