:root {
  --ink: #102f39;
  --ink-soft: #264d55;
  --muted: #66777a;
  --paper: #f6f3eb;
  --paper-deep: #e9efeb;
  --white: #fff;
  --line: rgba(16, 47, 57, .15);
  --sea: #dceeed;
  --accent: #1f756f;
  --focus: #0b6f80;
}

* { box-sizing: border-box; }

html { overflow-x: clip; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans TC", sans-serif;
  line-height: 1.8;
  overflow-x: clip;
}

body.toc-open { overflow: hidden; }

a { color: inherit; }

.skip {
  position: fixed;
  z-index: 40;
  left: 12px;
  top: -60px;
  padding: 10px 16px;
  color: var(--white);
  background: var(--ink);
}

.skip:focus { top: 12px; }

.guide-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 max(20px, calc((100vw - 1160px) / 2));
  background: rgba(246, 243, 235, .93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(15px);
}

.guide-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.guide-brand img { width: 38px; height: 38px; border-radius: 12px; }
.guide-brand strong, .guide-brand small { display: block; }
.guide-brand strong { font-size: 14px; letter-spacing: .08em; }
.guide-brand small { color: var(--muted); font-size: 11px; }

.guide-header nav { display: flex; align-items: center; gap: 24px; }
.guide-header nav a, .toc-trigger { font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; }
.toc-trigger { padding: 8px 0; border: 0; color: inherit; background: transparent; cursor: pointer; }
.guide-header nav a:hover, .toc-trigger:hover { color: var(--accent); }

.guide-article { max-width: 1160px; margin: 0 auto; padding: 0 20px 80px; }

.guide-hero {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(72px, 11vw, 140px) 0 clamp(54px, 8vw, 100px);
  text-align: center;
}

.eyebrow, .section-kicker {
  margin: 0 0 15px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
}

.guide-hero h1, .guide-intro h2, .glossary h2, .contents h2, .guide-ending h2, .guide-cta h2 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.guide-hero h1 { font-size: clamp(40px, 7vw, 76px); }
.hero-lead { max-width: 680px; margin: 24px auto 0; color: var(--ink-soft); font-size: clamp(17px, 2vw, 21px); }
.guide-intro, .glossary, .guide-ending {
  max-width: 780px;
  margin: 0 auto;
}

.guide-intro { padding: 42px 0 64px; border-top: 1px solid var(--line); }
.guide-intro h2, .glossary h2, .guide-ending h2 { font-size: clamp(29px, 4vw, 43px); }
.guide-intro p:not(.section-kicker), .guide-ending p:not(.section-kicker) { color: var(--ink-soft); font-size: 17px; }

.guide-figure { margin: 34px 0 42px; text-align: center; }
.guide-figure img { display: block; width: min(100%, 920px); height: auto; max-height: 760px; margin: 0 auto; border-radius: 16px; box-shadow: 0 16px 42px rgba(16, 47, 57, .13); object-fit: contain; }
.guide-figure figcaption, .guide-caption { margin-top: 10px; color: var(--muted); font-size: 13px; text-align: center; }

.glossary { padding: 62px 0; border-top: 1px solid var(--line); }
.section-lead { margin: 14px 0 26px; color: var(--muted); }
.glossary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.glossary details { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .45); }
.glossary summary { min-height: 58px; padding: 13px 16px; cursor: pointer; color: var(--ink); font-size: 16px; font-weight: 800; }
.glossary summary:focus-visible, .toc-trigger:focus-visible, .toc-drawer a:focus-visible, .toc-close:focus-visible, .guide-cta a:focus-visible, .guide-footer a:focus-visible, .back-to-top:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.glossary-detail { padding: 0 16px 16px; color: var(--muted); font-size: 15px; }
.glossary-detail p { margin: 0 0 10px; }
.glossary-detail p:last-child { margin-bottom: 0; }
.glossary-detail ul { margin: 0 0 10px; padding-left: 20px; }

.guide-body { max-width: 780px; margin: 0 auto; }
.guide-body h2 { margin: 78px 0 18px; padding-top: 18px; border-top: 1px solid var(--line); font-family: "Noto Serif TC", serif; font-size: clamp(28px, 4vw, 42px); line-height: 1.35; }
.guide-body h3 { margin: 46px 0 10px; color: var(--ink-soft); font-family: "Noto Serif TC", serif; font-size: clamp(21px, 3vw, 29px); line-height: 1.4; }
.guide-body h4 { margin: 28px 0 8px; color: var(--ink-soft); font-size: clamp(17px, 2vw, 21px); line-height: 1.5; }
.guide-body p { margin: 0 0 18px; color: var(--ink-soft); font-size: 17px; overflow-wrap: anywhere; }
.guide-body h2, .guide-body h3, .guide-body h4, .guide-intro h2 { scroll-margin-top: 92px; }
.guide-body .section-kicker { margin-top: 70px; }
.guide-body .guide-label { margin: 24px 0 8px; color: var(--accent); font-weight: 800; }
.guide-body .guide-list { margin: 12px 0 24px; padding-left: 24px; color: var(--ink-soft); }
.guide-body .guide-list li { margin: 5px 0; padding-left: 3px; }
.guide-body .guide-list li.sub-item { margin-left: 18px; list-style-type: circle; }
.guide-callout { margin: 22px 0; padding: 14px 16px; border-left: 3px solid var(--accent); border-radius: 8px; color: var(--ink-soft); background: rgba(215, 238, 234, .45); }
.guide-callout p { margin: 0; font-size: 16px; }
.guide-callout strong { color: var(--ink); }
.table-scroll { max-width: 100%; margin: 24px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .4); }
.guide-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
.guide-table th, .guide-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.guide-table th { background: var(--paper-deep); font-weight: 800; }
.guide-table tr:last-child td { border-bottom: 0; }

.guide-table-block { margin: 28px 0 34px; }
.guide-table-block .table-scroll { margin: 0; }
.guide-table-block .guide-table { min-width: 0; font-size: 15px; line-height: 1.65; }
.guide-table-block .guide-table caption { padding: 0 0 12px; color: var(--ink); font-size: 18px; font-weight: 800; text-align: left; }
.guide-table-block .guide-table th, .guide-table-block .guide-table td { padding: 14px 16px; }
.guide-table-block .guide-table thead th { color: var(--ink); background: var(--paper-deep); }
.guide-table-mobile { display: none; }
.guide-table-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .58); }
.guide-table-card h4 { margin: 0 0 12px; color: var(--ink); font-size: 18px; }
.guide-table-card dl { display: grid; grid-template-columns: minmax(88px, .38fr) minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.guide-table-card dt { color: var(--muted); font-weight: 800; }
.guide-table-card dd { margin: 0; color: var(--ink-soft); }
.guide-table-card ul { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.guide-table-card li + li { margin-top: 8px; }

.equipment-budget-block { margin: 28px 0 34px; }
.equipment-budget-block .table-scroll { margin: 0; }
.equipment-budget-table { min-width: 780px; line-height: 1.6; }
.equipment-budget-table th, .equipment-budget-table td { padding: 12px 13px; }
.equipment-budget-table thead th { color: var(--ink); background: var(--paper-deep); }
.equipment-budget-table tbody th { white-space: nowrap; }
.equipment-budget-table tbody td:nth-child(4),
.equipment-budget-table tbody td:nth-child(7),
.equipment-budget-table tfoot td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.equipment-budget-table tfoot th,
.equipment-budget-table tfoot td { color: var(--ink); background: var(--sea); font-weight: 800; }
.equipment-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.equipment-tag.optional { border-color: #c8b890; color: #7b5d23; background: #fbf5e7; }
.equipment-budget-mobile { display: none; }
.equipment-budget-plan-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .58); }
.equipment-budget-plan-card h3 { margin: 0 0 18px; color: var(--ink); font-family: "Noto Serif TC", serif; font-size: 23px; }
.equipment-budget-group + .equipment-budget-group { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.equipment-budget-group h4 { margin: 0 0 10px; color: var(--ink-soft); font-size: 17px; }
.equipment-budget-group dl { display: grid; grid-template-columns: minmax(92px, .42fr) minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.equipment-budget-group dt { color: var(--muted); font-weight: 800; }
.equipment-budget-group dd { display: flex; flex-direction: column; gap: 3px; margin: 0; color: var(--ink-soft); }
.equipment-budget-detail { white-space: pre-line; }
.equipment-budget-price { color: var(--ink); font-variant-numeric: tabular-nums; }
.equipment-budget-total { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 20px 0 0; padding-top: 15px; border-top: 2px solid var(--accent); color: var(--ink); font-weight: 800; }
.equipment-budget-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.source-table-image {
  width: min(940px, calc(100vw - 32px));
  margin-right: 50%;
  margin-left: 50%;
  transform: translateX(-50%);
}
.source-table-image img { max-height: none; border-radius: 10px; }

.toc-backdrop { position: fixed; z-index: 45; inset: 0; background: rgba(7, 26, 32, .45); }
.toc-drawer {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  width: min(390px, calc(100vw - 28px));
  height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--paper);
  box-shadow: -20px 0 50px rgba(16, 47, 57, .22);
  transform: translateX(105%);
  transition: transform .22s ease;
}
.toc-drawer[aria-hidden="false"] { transform: translateX(0); }
.toc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-family: "Noto Serif TC", serif;
  font-size: 21px;
}
.toc-close {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 30px;
  cursor: pointer;
}
.toc-drawer-nav {
  height: calc(100dvh - 72px - env(safe-area-inset-bottom, 0px));
  padding: 14px 16px 28px;
  overflow-y: auto;
}
.toc-drawer-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  line-height: 1.45;
  text-decoration: none;
}
.toc-drawer-nav a:hover { color: var(--accent); background: var(--sea); }
.toc-drawer-nav .toc-level-h2 { margin-top: 7px; font-weight: 800; }
.toc-drawer-nav .toc-level-h3 { padding-left: 24px; color: var(--muted); font-size: 14px; }
.toc-article-links { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.toc-article-links strong { display: block; padding: 4px 12px 2px; color: var(--muted); font-size: 13px; letter-spacing: .08em; }

.guide-ending { margin-top: 86px; padding: 56px 0 48px; border-top: 1px solid var(--line); }
.guide-cta { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin: 0 auto; padding: 30px; border-radius: 20px; color: var(--white); background: var(--ink); }
.guide-cta h2 { font-size: clamp(24px, 3.5vw, 36px); }
.guide-cta p:not(.section-kicker) { margin: 10px 0 0; color: #c8d7d7; }
.cta-button { display: inline-flex; flex: 0 0 auto; min-height: 48px; align-items: center; padding: 0 18px; border-radius: 999px; color: var(--ink); background: #d7eeea; font-size: 14px; font-weight: 800; text-decoration: none; }
.cta-button:hover { background: var(--white); }

.back-to-top { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: rgba(255, 255, 255, .9); box-shadow: 0 8px 24px rgba(16, 47, 57, .12); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.back-to-top.visible { opacity: 1; pointer-events: auto; }

.guide-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 38px max(20px, calc((100vw - 1160px) / 2)); color: var(--white); background: var(--ink); }
.guide-footer strong, .guide-footer span { display: block; }
.guide-footer span { color: #9eb2b4; font-size: 12px; }
.guide-footer a { color: #d7eeea; font-size: 13px; font-weight: 700; text-decoration: none; }

@media (max-width: 760px) {
  .guide-header { min-height: 64px; }
  .guide-header nav { gap: 12px; }
  .guide-header nav a:first-child { display: none; }
  .guide-article { padding-right: 16px; padding-left: 16px; }
  .guide-hero { padding-top: 64px; }
  .glossary-grid { grid-template-columns: 1fr; }
  .guide-body h2 { margin-top: 58px; }
  .guide-cta { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 430px) {
  .guide-brand img { width: 34px; height: 34px; }
  .guide-brand strong { font-size: 13px; }
  .guide-header nav a { font-size: 12px; }
  .guide-body p, .guide-intro p:not(.section-kicker), .guide-ending p:not(.section-kicker) { font-size: 17px; line-height: 1.8; }
  .guide-body h2 { font-size: clamp(29px, 8vw, 34px); }
  .guide-body h3 { font-size: clamp(23px, 6.5vw, 27px); }
  .guide-body h4 { font-size: clamp(19px, 5vw, 21px); }
  .source-table-image { overflow-x: auto; }
  .source-table-image img { width: auto; min-width: min(760px, 190vw); max-width: none; }
  .guide-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 680px) {
  .guide-table-block { margin: 24px 0 30px; }
  .guide-table-block[data-mobile-mode] .guide-table { min-width: 560px; }
  .guide-table-block .guide-table-mobile { gap: 12px; }
  .has-guide-table-cards .guide-table-block[data-mobile-mode] .table-scroll { display: none; }
  .has-guide-table-cards .guide-table-block[data-mobile-mode] .guide-table-mobile { display: grid; }
  .guide-table-block .guide-table-mobile { width: 100%; }
  .guide-table-card { padding: 14px; }
  .guide-table-card h4 { font-size: 18px; }
  .guide-table-card dl { grid-template-columns: minmax(82px, .42fr) minmax(0, 1fr); font-size: 15px; line-height: 1.65; }
  .equipment-budget-block .equipment-budget-table { min-width: 780px; }
  .has-equipment-budget-cards .equipment-budget-block .table-scroll { display: none; }
  .has-equipment-budget-cards .equipment-budget-block .equipment-budget-mobile { display: grid; gap: 12px; }
  .equipment-budget-plan-card { padding: 15px; }
  .equipment-budget-plan-card h3 { font-size: 21px; }
  .equipment-budget-group dl { grid-template-columns: minmax(82px, .42fr) minmax(0, 1fr); font-size: 15px; line-height: 1.6; }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top, .toc-drawer { transition: none; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .guide-table-mobile { display: none !important; }
  .equipment-budget-mobile { display: none !important; }
  .guide-table-block .table-scroll { overflow: visible; border-color: #999; }
  .equipment-budget-block .table-scroll { overflow: visible; border-color: #999; }
  .guide-table-block .guide-table { min-width: 0; font-size: 10.5pt; line-height: 1.45; }
  .equipment-budget-block .guide-table { min-width: 0; font-size: 9.5pt; line-height: 1.45; }
  .guide-table-block .guide-table caption { font-size: 13pt; }
  .guide-table-block .guide-table thead { display: table-header-group; }
  .guide-table-block .guide-table tr { break-inside: avoid; page-break-inside: avoid; }
  .equipment-budget-block .guide-table caption { font-size: 13pt; }
  .equipment-budget-block .guide-table thead { display: table-header-group; }
  .equipment-budget-block .guide-table tr { break-inside: avoid; page-break-inside: avoid; }
}
