/* 台灣法律知識通 — 全站樣式（取代 bootstrap.css / icon.css / style.css） */

:root {
  --brand: #b51616;
  --brand-dark: #8f1010;
  --brand-soft: #fbeceb;
  --brand-strong: #b51616;
  --logo-filter: none;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #6b6762;
  --border: #e5e1db;
  --chip: #f0ede8;
  --bar: #3a3a3a;
  --mark: #ffe58a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .05);
  --show-sun: none;
  --show-moon: inline-block;
  --law-fs: 17px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #f07070;
    --brand-dark: #ff8f8f;
    --brand-soft: #3a1f1f;
    --brand-strong: #a8231f;
    --logo-filter: invert(1) brightness(1.6);
    --bg: #121212;
    --surface: #1c1c1c;
    --text: #e8e6e3;
    --muted: #a39f99;
    --border: #333230;
    --chip: #2a2928;
    --bar: #242424;
    --mark: #6d5b00;
    --shadow: none;
    --show-sun: inline-block;
    --show-moon: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --brand: #f07070;
  --brand-dark: #ff8f8f;
  --brand-soft: #3a1f1f;
  --brand-strong: #a8231f;
  --logo-filter: invert(1) brightness(1.6);
  --bg: #121212;
  --surface: #1c1c1c;
  --text: #e8e6e3;
  --muted: #a39f99;
  --border: #333230;
  --chip: #2a2928;
  --bar: #242424;
  --mark: #6d5b00;
  --shadow: none;
  --show-sun: inline-block;
  --show-moon: none;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
  letter-spacing: .02em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main { flex: 1 0 auto; }

h1, h2, h3, h4 { line-height: 1.35; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
ul.plain, ol.plain { list-style: none; margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.ic {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  vertical-align: -0.18em;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-sun { display: var(--show-sun); }
.ic-moon { display: var(--show-moon); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--brand-strong); color: #fff; padding: 8px 14px; border-radius: 6px;
}
.skip-link:focus { top: 8px; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 860px; }

/* ---------------------------------------------------------------- 頁首 */

.topbar { background: var(--surface); border-top: 4px solid var(--brand); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; flex-wrap: wrap; align-items: center; min-height: 56px; }

.brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 800; font-size: 1.15rem; letter-spacing: .12em;
}
.brand img { border-radius: 6px; filter: var(--logo-filter); }
.brand:hover { color: var(--brand); }

.topbar-actions { margin-left: auto; display: flex; gap: 2px; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--chip); color: var(--brand); }
.icon-btn .ic { width: 20px; height: 20px; }

.site-nav { order: 3; width: 100%; display: none; padding-bottom: 8px; }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.site-nav a {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: var(--text); font-weight: 600; letter-spacing: .1em;
}
.site-nav a:hover { background: var(--brand-soft); color: var(--brand); }
.site-nav a.active { color: var(--brand); background: var(--brand-soft); }

@media (min-width: 960px) {
  .site-nav { order: 2; width: auto; display: block; margin-left: auto; padding: 0; }
  .site-nav ul { flex-direction: row; }
  .site-nav a { padding: 16px 14px; border-radius: 0; }
  .site-nav a.active { background: transparent; box-shadow: inset 0 -3px 0 var(--brand); }
  .topbar-actions { order: 3; margin-left: 8px; }
  .nav-toggle { display: none; }
}

.searchbar { background: var(--bar); padding: 14px 0 10px; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8a8a8a; pointer-events: none; }
.search-field input {
  width: 100%; height: 44px; padding: 0 12px 0 38px;
  border: 0; border-radius: 8px; background: #fff; color: #222;
  font-size: 16px;
}
.search-field input::placeholder { color: #8d8d8d; }
:root[data-theme="dark"] .search-field input { background: #2d2d2d; color: #eee; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .search-field input { background: #2d2d2d; color: #eee; }
}
.adv-link { color: #e3e3e3; font-size: .9rem; white-space: nowrap; }
.adv-link:hover { color: #fff; text-decoration: underline; }

.hot-keys {
  display: flex; gap: 4px 12px; align-items: center;
  margin-top: 8px; font-size: .85rem; color: #b9b9b9;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.hot-keys::-webkit-scrollbar { display: none; }
.hot-keys a { color: #f1f1f1; }
.hot-keys a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 480px) {
  .adv-link { display: none; }
  .search-form .btn { padding: 0 14px; }
}

/* ------------------------------------------------------------ 自動完成 */

.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); max-height: 60vh; overflow: auto;
}
.ac-list a { display: flex; align-items: baseline; gap: 8px; padding: 9px 12px; border-radius: 6px; color: var(--text); }
.ac-list a small { margin-left: auto; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.ac-list a.active, .ac-list a:hover { background: var(--brand-soft); color: var(--brand); }
.ac-list .ac-all { color: var(--muted); font-size: .88rem; }

/* ---------------------------------------------------------------- 元件 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 700; letter-spacing: .1em; cursor: pointer; white-space: nowrap;
  text-decoration: none !important;
}
.btn-primary { background: var(--brand-strong); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); filter: brightness(.88); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { height: 34px; padding: 0 12px; font-size: .88rem; letter-spacing: .04em; font-weight: 600; }
.btn.is-on { color: var(--brand); border-color: var(--brand); }
.btn.is-on .ic { fill: currentColor; }

.breadcrumb ol {
  list-style: none; margin: 0; padding: 12px 0;
  display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: .85rem; color: var(--muted);
}
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb li[aria-current] { color: var(--text); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; background: var(--brand-strong); color: #fff;
}
.card-head h2, .card-head h1 { margin: 0; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; letter-spacing: .08em; }
.card-head a { color: #fff; font-size: .85rem; white-space: nowrap; opacity: .92; }
.card-head a:hover { opacity: 1; text-decoration: underline; }
.card-head.soft { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); }
.card-head.soft h2 .ic { color: var(--brand); }
.card-head.soft a { color: var(--brand); }
.card-body { padding: 16px; }

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li + li { border-top: 1px dashed var(--border); }
.link-list a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; color: var(--text);
}
.link-list a:hover { background: var(--brand-soft); color: var(--brand); }
.link-list .grow { flex: 1; min-width: 0; }
.link-list .meta { margin-left: auto; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.link-list .sub { display: block; font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-list .chev { color: var(--muted); }

.rank {
  flex: none; min-width: 26px; height: 26px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; background: var(--chip); font-size: .8rem; font-weight: 800; color: var(--muted);
}
li:nth-child(-n+3) > a > .rank { background: var(--brand-strong); color: #fff; }

.tag {
  display: inline-block; font-size: .74rem; line-height: 1.6; padding: 1px 8px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; white-space: nowrap; letter-spacing: .04em;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; background: var(--chip); color: var(--text); font-size: .9rem;
}
.chip:hover { background: var(--brand-soft); color: var(--brand); }
.chip .count { font-size: .75rem; color: var(--muted); }

.grid-2 { display: grid; gap: 20px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.layout-side { display: grid; gap: 20px; align-items: start; }
.layout-side > .side { order: 2; }
@media (min-width: 960px) {
  .layout-side { grid-template-columns: 300px minmax(0, 1fr); }
  .layout-side > .side { order: 0; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
}

.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mt-0 { margin-top: 0; }
.center { text-align: center; }
.no-js-hide { display: none; }

mark { background: var(--mark); color: inherit; padding: 0 1px; border-radius: 2px; }

.text-input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
  font-size: 16px;
}
.text-input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; background: var(--brand-soft); color: var(--text); font-size: .92rem;
}
.notice .ic { color: var(--brand); margin-top: 3px; }

/* ---------------------------------------------------------------- 首頁 */

.hero { padding: 26px 0 6px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(1.4rem, 3.6vw, 2rem); letter-spacing: .12em; }
.hero p { margin: 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 8px; text-align: center; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: clamp(1.15rem, 4vw, 1.7rem); color: var(--brand); letter-spacing: .02em; }
.stat span { font-size: .85rem; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font-weight: 700;
}
.tile .ic { color: var(--brand); }
.tile:hover { border-color: var(--brand); color: var(--brand); }
.tile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.daily-list .txt { display: block; font-size: .88rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-list .ttl { font-weight: 700; }

/* ------------------------------------------------------------ 分類樹 */

.tree { padding: 8px; font-size: .95rem; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.tree > ul { padding-left: 0; }
.tree summary {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer; list-style: none; font-weight: 600;
}
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s;
}
.tree details[open] > summary::before { transform: rotate(45deg); }
.tree summary:hover, .tree a:hover { background: var(--chip); }
.tree a { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 7px; color: var(--text); }
.tree a.current { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.tree .count {
  margin-left: auto; padding: 0 8px; border-radius: 999px; background: var(--chip);
  font-size: .74rem; color: var(--muted); font-weight: 600;
}

.list-filter { padding: 12px 16px; border-bottom: 1px solid var(--border); }

.subcats { display: grid; gap: 14px; padding: 16px; }
.subcat h3 { margin: 0 0 8px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.subcat h3 a { color: var(--text); }
.subcat h3 a:hover { color: var(--brand); }

/* ---------------------------------------------------------- 法規全文 */

.law-header { padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
.law-header h1 { margin: 0 0 8px; font-size: clamp(1.3rem, 3.2vw, 1.75rem); letter-spacing: .06em; }
.law-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .88rem; color: var(--muted); margin: 0; }
.law-meta a { color: var(--brand); }
.law-meta dt { display: inline; font-weight: 600; }
.law-meta dd { display: inline; margin: 0; }

.law-tools {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.law-tools .tool-input { position: relative; flex: 1 1 200px; min-width: 150px; }
.law-tools .tool-input .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.law-tools .tool-input input { height: 36px; padding-left: 32px; font-size: 15px; }
.law-tools .jump input { width: 92px; height: 36px; font-size: 15px; }
.law-tools .jump { display: flex; gap: 4px; }
.law-tools .group { display: flex; gap: 4px; }
.filter-status { font-size: .82rem; color: var(--muted); width: 100%; }
@media (min-width: 720px) { .law-tools { position: sticky; top: 0; z-index: 20; } }
@media (max-width: 719px) {
  .law-tools { padding: 10px 12px; gap: 6px; }
  .law-tools .tool-input { flex-basis: 100%; }
  .law-tools .jump { flex: 1; }
  .law-tools .jump input { flex: 1; width: auto; min-width: 0; }
  .law-tools .group { flex-wrap: wrap; }
  .law-tools .group .icon-btn { width: 36px; height: 36px; }
}
.filter-status:empty { display: none; }

.law-body { padding: 4px 16px 24px; font-size: var(--law-fs); line-height: 1.95; }

.law-h { margin: 1.8em 0 .5em; color: var(--brand); font-weight: 800; scroll-margin-top: 80px; letter-spacing: .08em; }
.law-h.l1 { font-size: 1.28em; text-align: center; }
.law-h.l2 { font-size: 1.14em; }
.law-h.l3 { font-size: 1.04em; color: var(--text); }
.law-h.l4 { font-size: 1em; color: var(--muted); }
.preamble { margin: 1em 0; padding: 12px 16px; border-radius: 10px; background: var(--chip); }

.art {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px;
  padding: 12px 0; border-bottom: 1px dashed var(--border); scroll-margin-top: 80px;
}
.art-no { font-weight: 800; white-space: nowrap; }
.art-no a { color: var(--brand); }
/* 按鈕由 JS 延遲產生；::after 先佔住同一格，避免按鈕出現時版面跳動 */
.art-act, .art::after { grid-row: 1; grid-column: 2; }
.art-act { display: flex; gap: 2px; }
.art::after { content: ""; width: 66px; height: 32px; pointer-events: none; }
.art-txt { grid-column: 1 / -1; word-break: break-word; }
.art-act .icon-btn { width: 32px; height: 32px; color: var(--muted); }
.art-act .icon-btn .ic { width: 17px; height: 17px; }
.art-act .icon-btn.is-on { color: var(--brand); }
.art-act .icon-btn.is-on .ic { fill: currentColor; }
.art.deleted .art-txt { color: var(--muted); }
.art.flash, .art:target { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 30% { background: var(--brand-soft); } 100% { background: transparent; } }
.is-filtered-out { display: none !important; }

@media (min-width: 720px) {
  .art { grid-template-columns: 6.2em minmax(0, 1fr) auto; gap: 4px 14px; }
  .art-no { grid-column: 1; }
  .art-txt { grid-column: 2; grid-row: 1; }
  .art-act, .art::after { grid-column: 3; }
  .art-act { opacity: .35; transition: opacity .15s; }
  .art:hover .art-act, .art:focus-within .art-act { opacity: 1; }
}

.toc { font-size: .92rem; }
.toc summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-weight: 800; cursor: pointer; list-style: none; letter-spacing: .08em; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary .ic { color: var(--brand); }
.toc ol { list-style: none; margin: 0; padding: 0 8px 10px; }
.toc a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); line-height: 1.5; }
.toc a:hover { background: var(--chip); color: var(--brand); }
.toc a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.toc .t2 { padding-left: 22px; }
.toc .t3 { padding-left: 34px; font-size: .88rem; }
.toc .t4 { padding-left: 46px; font-size: .85rem; color: var(--muted); }

/* ---------------------------------------------------------- 單一條文 */

.article-main { padding: 20px 16px 8px; }
.article-main .art-label { font-size: 1.05rem; font-weight: 800; color: var(--brand); margin: 0 0 6px; }
.article-main .art-chapter { font-size: .88rem; color: var(--muted); margin: 0 0 12px; }
.article-text { font-size: calc(var(--law-fs) + 1px); line-height: 2; margin: 0 0 18px; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 18px; }

.art-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 20px; }
.art-nav > a, .art-nav > span {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
}
.art-nav > a:hover { border-color: var(--brand); }
.art-nav small { color: var(--muted); display: flex; align-items: center; gap: 4px; }
.art-nav b { color: var(--brand); }
.art-nav .next { text-align: right; align-items: flex-end; }
.art-nav > span { opacity: .45; }
.art-nav .prev-txt, .art-nav .next-txt { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------------------------------------------------------------- 搜尋 */

.search-summary { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 12px 16px; font-size: .9rem; color: var(--muted); }
.search-summary b { color: var(--text); }

.jump-card { border: 2px solid var(--brand); }
.jump-card .card-body { display: grid; gap: 8px; }
.jump-card .ttl { font-size: 1.1rem; font-weight: 800; }

.results { list-style: none; margin: 0; padding: 0; }
.results > li + li { border-top: 1px solid var(--border); }
.results a { display: block; padding: 12px 16px; color: var(--text); }
.results a:hover { background: var(--brand-soft); }
.results .r-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 800; }
.results .r-title .no { color: var(--brand); }
.results .r-snip { display: block; margin-top: 4px; color: var(--muted); font-size: .94rem; line-height: 1.75; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 16px; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager .cur { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; font-weight: 700; }
.pager .gap { border: 0; background: transparent; min-width: 20px; }

.form-row { margin-bottom: 20px; }
.form-label { display: block; font-weight: 800; margin-bottom: 8px; letter-spacing: .08em; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.check {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--surface);
}
.check:hover { border-color: var(--brand); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.form-actions .btn { min-width: 160px; }
.tips { margin: 0; padding-left: 1.3em; color: var(--muted); font-size: .9rem; line-height: 1.9; }

/* ------------------------------------------------------- 收藏 / 歷史 */

.fav-list { list-style: none; margin: 0; padding: 0; }
.fav-list li { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 0; }
.fav-list li + li { border-top: 1px dashed var(--border); }
.fav-list a { flex: 1; min-width: 0; display: block; padding: 11px 16px; color: var(--text); }
.fav-list a:hover { color: var(--brand); }
.fav-list .sub { display: block; font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .btn-sm { height: 30px; background: rgba(255, 255, 255, .16); color: #fff; border: 0; }
.card-head .btn-sm:hover { background: rgba(255, 255, 255, .28); color: #fff; }

/* ----------------------------------------------------------- 內容頁 */

.prose { padding: 8px 20px 20px; line-height: 1.95; }
.prose h2 { font-size: 1.15rem; margin: 1.6em 0 .6em; padding-left: 10px; border-left: 4px solid var(--brand); letter-spacing: .08em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

.notfound { text-align: center; padding: 40px 20px; margin-top: 24px; }
.notfound-code { font-size: 4.5rem; font-weight: 900; line-height: 1; color: var(--brand); letter-spacing: .05em; }
.notfound h1 { margin: 12px 0 6px; font-size: 1.4rem; }
.notfound p { color: var(--muted); }
.inline-search { display: flex; gap: 8px; max-width: 480px; margin: 18px auto; }
.inline-search input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 16px; }
.notfound-links { display: flex; justify-content: center; gap: 18px; }

/* ---------------------------------------------------------------- 頁尾 */

.site-footer { margin-top: 36px; padding: 30px 0 18px; background: #2b2b2b; color: #c9c9c9; font-size: .9rem; }
.site-footer a { color: #ececec; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; gap: 22px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1.6fr; } }
.footer-brand { font-size: 1.1rem; font-weight: 800; color: #fff; letter-spacing: .12em; margin-bottom: 6px; }
.footer-note { margin: 0; line-height: 1.8; color: #b3b3b3; }
.footer-note a { color: #ffd36b; }
.footer-title { font-weight: 800; color: #fff; margin-bottom: 8px; letter-spacing: .1em; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footer-friends { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: .85rem; }
.copyright { margin-top: 22px; padding-top: 14px; border-top: 1px solid #444; font-size: .8rem; color: #9a9a9a; text-align: center; }

.back-to-top {
  position: fixed; right: 16px; bottom: 20px; z-index: 40;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-strong); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.back-to-top.show { opacity: .92; visibility: visible; transform: none; }
.back-to-top:hover { opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90;
  transform: translate(-50%, 16px); padding: 10px 18px; border-radius: 10px;
  background: #222; color: #fff; font-size: .92rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* ---------------------------------------------------------------- 列印 */

@media print {
  .site-header, .site-footer, .breadcrumb, .law-tools, .art-act, .actions, .back-to-top, .toast,
  .toc, .side, .art-nav, .no-print, .skip-link { display: none !important; }
  body { background: #fff; color: #000; display: block; }
  .card { border: 0; box-shadow: none; }
  .layout-side { display: block; }
  .law-body, .article-text { font-size: 12pt; }
  a { color: #000; }
  .art { break-inside: avoid; }
}

/* 法規全文頁：手機版目錄放在內容前面 */
.side > .card { margin-bottom: 16px; }
@media (max-width: 959px) { .side > .card { margin-bottom: 0; } }
.layout-side > .side.side-first { order: 0; }
@media (max-width: 959px) { .hide-sm { display: none !important; } }
