/* ncku.net 品牌色(與 auth.ncku.net、go.ncku.net 共用同一組定義) */
:root {
  --maroon: #420A15;
  --phoenix: #E4002B;
  --dark-grey: #312D33;
  --grey: #555559;
  --sig-red: #A31F34;
  --gold: #8C6E4A;
  --silver: #A6A9AB;
  --white: #FFFFFF;

  --bg: color-mix(in srgb, var(--silver) 12%, var(--white));
  --card: var(--white);
  --text: var(--dark-grey);
  --muted: var(--grey);
  --border: color-mix(in srgb, var(--silver) 40%, var(--white));
  --primary: var(--sig-red);
  --primary-hover: var(--maroon);
  --accent: var(--phoenix);
  --positive: var(--gold);
  --shadow-sm: 0 1px 2px rgb(49 45 51 / 5%), 0 2px 8px rgb(49 45 51 / 5%);
  --shadow-md: 0 2px 4px rgb(49 45 51 / 6%), 0 10px 28px rgb(49 45 51 / 8%);
  --shadow-lg: 0 4px 10px rgb(49 45 51 / 8%), 0 18px 44px rgb(49 45 51 / 12%);
  --ring: color-mix(in srgb, var(--sig-red) 22%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: color-mix(in srgb, var(--dark-grey) 55%, black);
    --card: color-mix(in srgb, var(--dark-grey) 88%, black);
    --text: color-mix(in srgb, var(--white) 92%, var(--silver));
    --muted: var(--silver);
    --border: color-mix(in srgb, var(--grey) 45%, var(--dark-grey));
    --primary: var(--sig-red);
    --primary-hover: var(--phoenix);
    --positive: color-mix(in srgb, var(--gold) 70%, var(--white));
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 25%);
    --shadow-md: 0 2px 6px rgb(0 0 0 / 30%), 0 12px 32px rgb(0 0 0 / 25%);
    --shadow-lg: 0 4px 12px rgb(0 0 0 / 35%), 0 20px 48px rgb(0 0 0 / 30%);
    --ring: color-mix(in srgb, var(--phoenix) 30%, transparent);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 屬性必須永遠贏過任何 display 規則 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 480px at 85% -10%, color-mix(in srgb, var(--sig-red) 6%, transparent), transparent 60%),
    radial-gradient(900px 420px at -10% 100%, color-mix(in srgb, var(--gold) 7%, transparent), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
}

/* ---- 頂欄 ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 3px 0 -1px var(--primary), var(--shadow-sm);
}
.topbar-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .7rem 1.4rem .55rem;
}
.logo {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  color: var(--primary);
  text-decoration: none;
}
.logo span { color: var(--muted); font-weight: 500; }
.logo-mark { width: 26px; height: 26px; margin-right: .45rem; }
.topbar-auth { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.who {
  color: var(--muted);
  font-size: .85rem;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-nav {
  display: flex;
  gap: .2rem;
  padding: 0 1.4rem .5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-nav::-webkit-scrollbar { display: none; }
.nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  padding: .3rem .7rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-link:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.nav-link.active {
  color: var(--primary);
  font-weight: 700;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

/* ---- 版面 ---- */
.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.75rem) clamp(.75rem, 3vw, 1rem) 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}
.container.wide { max-width: 1100px; }
.container.narrow { max-width: 560px; justify-content: center; }
.container.reading { max-width: 720px; }
.container.legal { max-width: 760px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(1rem, 3.5vw, 1.6rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-md);
}
.panel.center { align-items: center; text-align: center; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.panel-note { font-size: .9rem; margin-top: -.5rem; }
.more {
  color: var(--primary);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
}
.more:hover { text-decoration: underline; }

h1 { font-size: 1.35rem; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.1rem; text-wrap: balance; }
p { text-wrap: pretty; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 1.2rem; }
.lede { color: var(--muted); font-size: 1.02rem; max-width: 34rem; }
.small-note { font-size: .84rem; }
.small-note a { color: var(--muted); text-decoration: underline; }
.small-note a:hover { color: var(--primary); }
.error { color: var(--phoenix); font-size: .92rem; }

.page-head { display: flex; flex-direction: column; gap: .4rem; padding: .5rem 0 0; }
.page-head h1 { font-size: clamp(1.4rem, 4.5vw, 1.7rem); }

/* ---- 全站公告 ---- */
.announcement {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  background: color-mix(in srgb, var(--gold) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: .9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.ann-icon { font-size: 1.2rem; line-height: 1.4; }
.ann-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ann-body strong { font-size: .85rem; color: var(--positive); letter-spacing: .04em; }
.ann-body p { white-space: pre-line; overflow-wrap: anywhere; }

/* ---- 首頁 hero ---- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .9rem;
  padding: 2.25rem 1rem .5rem;
}
.hero-mark {
  width: 76px; height: 76px;
  filter: drop-shadow(0 10px 24px color-mix(in srgb, var(--sig-red) 35%, transparent));
}
.hero h1 { font-size: clamp(1.5rem, 5.5vw, 1.9rem); letter-spacing: -.02em; }
.hero .lede { max-width: 30rem; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }

/* ---- 快速入口 ---- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .7rem;
}
.quick {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .8rem .9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 45%, var(--card));
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.quick:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.quick-icon { font-size: 1.35rem; line-height: 1.3; flex-shrink: 0; }
.quick-body { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.quick-title { font-weight: 700; font-size: .95rem; }
.quick-desc {
  color: var(--muted);
  font-size: .81rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- 雙欄(首頁的消息 + 指南) ---- */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

/* ---- 文章卡片 ---- */
.post-list { display: flex; flex-direction: column; gap: .1rem; }
.post-card {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .85rem .6rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.post-card:last-child { border-bottom: 0; }
.post-card:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.post-card:hover .post-title { color: var(--primary); }
.post-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.pin { font-size: .8rem; }
.tag {
  font-size: .74rem;
  font-weight: 600;
  color: var(--positive);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  border-radius: 999px;
  padding: .08rem .55rem;
}
.post-title { font-weight: 700; font-size: 1rem; line-height: 1.45; transition: color .12s; }
.post-summary {
  color: var(--muted);
  font-size: .87rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- 分類篩選 ---- */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  font-size: .86rem;
  padding: .32rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  text-decoration: none;
  transition: color .12s, border-color .12s, background .12s;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.active {
  color: var(--white);
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .chip.active { color: var(--white); }
}

/* ---- 指南章節 ---- */
.chapter-list { list-style: none; counter-reset: chapter; display: flex; flex-direction: column; gap: .1rem; }
.chapter-list li { counter-increment: chapter; }
.chapter-list li a {
  display: flex;
  flex-direction: column;
  gap: .18rem;
  padding: .8rem .6rem .8rem 2.6rem;
  position: relative;
  text-decoration: none;
  color: var(--text);
  border-radius: 10px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.chapter-list li:last-child a { border-bottom: 0; }
.chapter-list li a::before {
  content: counter(chapter);
  position: absolute;
  left: .6rem;
  top: .8rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.chapter-list li a:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.chapter-list li a:hover .chapter-title { color: var(--primary); }
.chapter-title {
  font-weight: 700;
  font-size: .98rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  transition: color .12s;
}
.chapter-desc { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.chapter-list.compact li a { padding-top: .65rem; padding-bottom: .65rem; }
.chapter-list.compact li a::before { top: .65rem; }
.chapter-list li.empty { color: var(--muted); padding: 1.2rem; text-align: center; }

/* ---- 章節前後導覽 ---- */
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.chapter-link {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .15s;
}
.chapter-link:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.chapter-link.next { text-align: right; }
.chapter-dir { font-size: .78rem; color: var(--primary); font-weight: 600; }
.chapter-name { font-size: .92rem; font-weight: 600; }

/* ---- 常用平台 ---- */
.search-row { margin-top: -.35rem; }
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .7rem;
}
.link-card {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .85rem .95rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 40%, var(--card));
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.link-icon { font-size: 1.4rem; line-height: 1.25; flex-shrink: 0; }
.link-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.link-title {
  font-weight: 700;
  font-size: .96rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.link-desc { color: var(--muted); font-size: .84rem; line-height: 1.5; }

/* ---- ncku.net 服務卡 ---- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .75rem;
}
.service {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 40%, var(--card));
}
.service.current { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.service-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.service-icon { font-size: 1.2rem; }
.service-name {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary);
}
.service-desc { color: var(--muted); font-size: .86rem; line-height: 1.5; flex: 1; }

/* ---- 徽章 ---- */
.badge {
  font-size: .72rem;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-weight: 600;
}
.badge.on { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--positive); }
.badge.off { background: color-mix(in srgb, var(--phoenix) 12%, transparent); color: var(--phoenix); }
.badge.here { background: color-mix(in srgb, var(--sig-red) 14%, transparent); color: var(--primary); }
.badge.student { background: color-mix(in srgb, var(--silver) 30%, transparent); color: var(--muted); }
.badge.draft { background: color-mix(in srgb, var(--silver) 30%, transparent); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .badge.here { color: color-mix(in srgb, var(--white) 60%, var(--sig-red)); }
}

/* ---- 文章內頁 ---- */
.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: .88rem;
  align-self: flex-start;
}
.back-link:hover { color: var(--primary); }
.article { gap: 1.4rem; }
.article-head { display: flex; flex-direction: column; gap: .55rem; }
.article-head h1 { font-size: clamp(1.45rem, 5vw, 1.8rem); line-height: 1.35; }
.article-head .lede { font-size: .98rem; max-width: none; }

.article-body { display: flex; flex-direction: column; gap: 1rem; font-size: 1rem; line-height: 1.85; }
.article-body h2 {
  font-size: 1.18rem;
  margin-top: .6rem;
  padding-bottom: .35rem;
  border-bottom: 2px solid color-mix(in srgb, var(--primary) 25%, transparent);
}
.article-body h3 { font-size: 1.05rem; margin-top: .4rem; color: var(--primary); }
.article-body h4 { font-size: .98rem; margin-top: .3rem; }
.article-body ul, .article-body ol { padding-left: 1.5rem; display: flex; flex-direction: column; gap: .4rem; }
.article-body li { line-height: 1.75; }
.article-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.article-body a:hover { color: var(--accent); }
.article-body strong { font-weight: 700; }
.article-body code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: .88em;
  background: color-mix(in srgb, var(--silver) 22%, transparent);
  padding: .1rem .35rem;
  border-radius: 5px;
}
.article-body pre {
  background: color-mix(in srgb, var(--dark-grey) 8%, var(--card));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1rem;
  overflow-x: auto;
}
.article-body pre code { background: none; padding: 0; font-size: .86rem; line-height: 1.6; }
.article-body blockquote {
  border-left: 4px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  border-radius: 0 10px 10px 0;
  padding: .7rem 1rem;
  color: var(--muted);
}
.article-body hr { border: 0; border-top: 1px solid var(--border); }
.article-body table { font-size: .92rem; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .65rem; border-bottom: 1px solid var(--border); }
thead th { white-space: nowrap; }
th {
  color: var(--muted);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: color-mix(in srgb, var(--border) 30%, transparent); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td a { color: var(--primary); text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ---- 表單 ---- */
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row input[type="search"], .row input[type="url"] { flex: 1; min-width: 220px; }
input, button, textarea, select { font: inherit; }
input, textarea, select {
  background: color-mix(in srgb, var(--bg) 60%, var(--card));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .8rem;
  transition: border-color .15s, box-shadow .15s;
  max-width: 100%;
}
textarea { resize: vertical; width: 100%; font-family: ui-monospace, "Cascadia Code", monospace; font-size: .9rem; line-height: 1.65; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.post-form { display: flex; flex-direction: column; gap: .8rem; }
.post-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--muted); }
.post-form label.inline { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }
.post-form label.inline input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.form-actions { padding-top: .2rem; }

.btn {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, var(--white)), var(--primary));
  color: var(--white);
  border: 0;
  border-radius: 10px;
  padding: .65rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-shadow: 0 1px 2px rgb(0 0 0 / 12%), inset 0 1px 0 rgb(255 255 255 / 12%);
  transition: transform .12s, box-shadow .15s, background-color .15s, filter .15s;
}
.btn:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-hover) 92%, var(--white)), var(--primary-hover));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}
.btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }
.btn.big { padding: .8rem 1.9rem; font-size: 1.02rem; border-radius: 12px; }
.btn.small { padding: .42rem .85rem; font-size: .88rem; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn.ghost:hover { background: color-mix(in srgb, var(--border) 55%, transparent); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .2rem .5rem;
  cursor: pointer;
  color: var(--muted);
  transition: color .12s, background .12s, border-color .12s;
}
.icon-btn:hover { color: var(--text); background: color-mix(in srgb, var(--border) 55%, transparent); border-color: var(--muted); }
.actions { display: flex; gap: .35rem; }

/* ---- 後台分頁與統計 ---- */
.tabs {
  display: inline-flex;
  gap: .25rem;
  align-self: flex-start;
  background: color-mix(in srgb, var(--border) 45%, transparent);
  border-radius: 12px;
  padding: .3rem;
}
.tab {
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: .5rem 1.1rem;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  transition: color .15s, background .15s, box-shadow .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.stat {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem .8rem;
  text-align: center;
  background: color-mix(in srgb, var(--bg) 45%, var(--card));
}
.stat .v { font-size: 1.45rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat .k { font-size: .82rem; color: var(--muted); }

.pager { display: flex; align-items: center; gap: .75rem; justify-content: center; color: var(--muted); font-size: .9rem; }

/* ---- 錯誤頁 ---- */
.error-panel { gap: .6rem; padding: 2.5rem 1.5rem; }
.error-code {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
  opacity: .35;
  font-variant-numeric: tabular-nums;
}

/* ---- 頁尾 ---- */
footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--primary); text-decoration: underline; }

/* ---- 法律頁面 ---- */
.legal .panel { scroll-margin-top: 6rem; }
.legal h1 { font-size: 1.5rem; }
.legal-intro p { max-width: 56ch; }
.legal h2 {
  font-size: 1.2rem;
  color: var(--primary);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
}
.legal h2::after {
  content: "";
  width: 2.4rem;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--gold));
}
.legal p, .legal li { line-height: 1.8; font-size: .95rem; }
.legal ol { padding-left: 1.4rem; display: flex; flex-direction: column; gap: .55rem; }
.legal ol ul { padding-left: 1.2rem; margin-top: .35rem; display: flex; flex-direction: column; gap: .25rem; }
.legal a { color: var(--primary); }
.legal code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: .88em;
  background: color-mix(in srgb, var(--silver) 22%, transparent);
  padding: .1rem .35rem;
  border-radius: 5px;
}

.feed-note { text-align: center; }

/* ---- RWD ---- */
@media (max-width: 700px) {
  .chapter-nav { grid-template-columns: 1fr; }
  .chapter-link.next { text-align: left; }
  .hero-actions .btn { flex: 1; min-width: 10rem; }
}

@media (max-width: 560px) {
  .topbar-main { padding: .6rem .9rem .5rem; }
  .topbar-nav { padding: 0 .9rem .5rem; }
  .who { max-width: 45vw; font-size: .8rem; }
  .hero { padding-top: 1.5rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .tabs { display: flex; flex-wrap: wrap; align-self: stretch; }
  .tab { flex: 1; padding: .5rem .6rem; font-size: .9rem; }
  .pager { flex-wrap: wrap; }
  .quick-grid, .link-grid, .service-grid { grid-template-columns: 1fr; }
  .legal h1 { font-size: 1.3rem; }
  .legal h2 { font-size: 1.1rem; }
  .legal p, .legal li { font-size: .9rem; line-height: 1.75; }
  .legal ol { padding-left: 1.1rem; }
  .legal ol ul { padding-left: .9rem; }
  .article-body { font-size: .97rem; }
  footer { line-height: 1.9; padding: 1.2rem .9rem; }
}

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