:root {
  --brand: #0f4c5c;
  --brand-hover: #0a3844;
  --brand-light: #e7f3f6;
  --brand-border: #bfd9e0;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --pub: #1d4ed8;
  --pub-bg: #dbeafe;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);
  --max-w: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: clip;
  font-feature-settings: "tnum" 1;
}
.num { font-variant-numeric: tabular-nums; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* Layout containers */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 6px; z-index: 1000;
}
.skip-link:focus { left: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 1200;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 12px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, #196b80 100%);
  color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 1rem;
  flex-shrink: 0;
}
.brand-sub { display: block; font-size: 0.72rem; font-weight: 500; color: var(--text-subtle); line-height: 1.1; }
.nav-links {
  display: none; align-items: center; gap: 6px;
}
.nav-links a {
  padding: 8px 14px; border-radius: 8px; color: var(--text-muted); font-weight: 600; font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--brand-light); color: var(--brand); text-decoration: none;
}
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text); font-size: 1.25rem; cursor: pointer;
}
@media (min-width: 860px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
}
.mobile-drawer {
  display: none; border-top: 1px solid var(--border); background: #fff; padding: 12px 16px 16px;
}
.mobile-drawer.open { display: block; }
.mobile-drawer a {
  display: block; padding: 12px 14px; border-radius: 8px; color: var(--text); font-weight: 600;
}
.mobile-drawer a:hover { background: var(--brand-light); text-decoration: none; }

/* Compliance / YMYL Trust Ribbon */
.trust-ribbon {
  background: #eff6f8; border-bottom: 1px solid var(--brand-border);
  font-size: 0.82rem; color: var(--brand); padding: 7px 0;
}
.trust-ribbon-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 0.86rem; color: var(--text-subtle); margin: 16px 0 12px; padding: 0; list-style: none;
}
.breadcrumb li::after { content: "›"; margin-left: 6px; color: #94a3b8; }
.breadcrumb li:last-child::after { content: ""; margin: 0; }
.breadcrumb a { color: var(--text-muted); }

/* Hero */
.hero {
  background: linear-gradient(160deg, #0b3946 0%, #0f4c5c 52%, #156275 100%);
  color: #fff; padding: 40px 0 46px;
}
@media (min-width: 768px) { .hero { padding: 54px 0 60px; } }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 5px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; margin-bottom: 14px;
}
.hero h1 {
  margin: 0 0 12px; font-size: clamp(1.65rem, 3.6vw, 2.5rem); line-height: 1.25; font-weight: 800; letter-spacing: -0.02em;
}
.hero p.lead {
  margin: 0 0 24px; max-width: 740px; font-size: 1.02rem; color: rgba(255, 255, 255, 0.9);
}

/* Search Box */
.search-shell { position: relative; max-width: 760px; }
.search-bar {
  display: flex; gap: 8px; background: #fff; padding: 6px; border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.search-bar input {
  flex: 1; border: 0; outline: none; padding: 12px 14px; font-size: 1rem; color: var(--text);
  min-width: 0; background: transparent;
}
.search-bar button {
  background: var(--brand); color: #fff; border: 0; border-radius: 10px;
  padding: 0 20px; min-height: 46px; font-weight: 700; font-size: 0.95rem; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
}
.search-bar button:hover { background: var(--brand-hover); }
.search-results-dropdown {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 1150;
  background: #fff; color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 14px; box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto;
}
.search-results-dropdown.open { display: block; }
.search-hit {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); color: var(--text);
}
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover { background: var(--brand-light); text-decoration: none; }
.search-hit-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.search-hit-meta { font-size: 0.84rem; color: var(--text-muted); }

/* Quick chips */
.quick-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.quick-chips-label { font-size: 0.84rem; color: rgba(255, 255, 255, 0.8); margin-right: 4px; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 5px 13px;
  border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.15); color: #fff; border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.15s;
}
.chip:hover { background: rgba(255, 255, 255, 0.28); text-decoration: none; }

/* KPI Strip */
.kpi-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0 28px;
}
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.kpi-value { font-size: 1.65rem; font-weight: 800; color: var(--brand); line-height: 1.2; }
.kpi-label { font-size: 0.84rem; color: var(--text-muted); margin-top: 4px; }
.kpi-sub { font-size: 0.76rem; color: var(--text-subtle); margin-top: 2px; }

/* Sections & Cards */
.section { padding: 28px 0; }
.section-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 18px;
}
.section-title { margin: 0; font-size: 1.38rem; font-weight: 800; letter-spacing: -0.01em; }
.section-sub { margin: 4px 0 0; font-size: 0.92rem; color: var(--text-muted); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}

/* County Grid */
.region-group { margin-bottom: 22px; }
.region-label {
  font-size: 0.86rem; font-weight: 700; color: var(--text-subtle); text-transform: uppercase;
  letter-spacing: 0.04em; margin: 0 0 10px;
}
.county-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 640px) { .county-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .county-grid { grid-template-columns: repeat(6, 1fr); } }
.county-card {
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; color: var(--text); transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  min-height: 92px;
}
.county-card:hover {
  border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none;
}
.county-name { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.county-count { font-size: 0.86rem; color: var(--brand); font-weight: 700; margin-top: 4px; }
.county-tag {
  display: inline-block; margin-top: 6px; font-size: 0.72rem; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; background: var(--pub-bg); color: var(--pub); width: fit-content;
}
.county-tag.police { background: var(--ok-bg); color: var(--ok); }
.county-tag.muted { background: #f1f5f9; color: var(--text-subtle); }

/* Badges */
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; line-height: 1.3;
}
.badge-pub { background: var(--pub-bg); color: var(--pub); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-moea { background: #e0f2fe; color: #0369a1; }
.badge-guild { background: #ede9fe; color: #5b21b6; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: #f1f5f9; color: var(--text-muted); }

/* Buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 10px; font-weight: 700; font-size: 0.9rem;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-outline { background: #fff; color: var(--brand); border-color: var(--brand-border); }
.btn-outline:hover { background: var(--brand-light); }
.btn-ghost { background: #f1f5f9; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #e2e8f0; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 0.84rem; }

/* District pills */
.district-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 20px; }
.dist-pill {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 38px; padding: 6px 13px; border-radius: 999px;
  background: #fff; border: 1px solid var(--border); color: var(--text);
  font-size: 0.86rem; font-weight: 600;
}
.dist-pill:hover, .dist-pill.active {
  background: var(--brand); color: #fff; border-color: var(--brand); text-decoration: none;
}
.dist-pill .cnt { font-size: 0.78rem; opacity: 0.8; }

/* Filter Bar */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px;
}
.filter-input {
  flex: 1 1 200px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 0.94rem; outline: none;
}
.filter-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.filter-btn {
  min-height: 40px; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-muted);
  font-size: 0.84rem; font-weight: 700; cursor: pointer;
}
.filter-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Split Layout (Directory + Sticky Map) */
.directory-split {
  display: grid; grid-template-columns: 1fr; gap: 20px; align-items: stretch;
}
@media (min-width: 1024px) {
  .directory-split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
  .directory-split .map-col { align-self: stretch; }
}
.store-list { display: flex; flex-direction: column; gap: 12px; }
.store-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s;
}
.store-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.store-card.is-public { border-left: 4px solid var(--pub); background: #fbfdff; }
.store-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.store-card h3 { margin: 0; font-size: 1.08rem; font-weight: 800; line-height: 1.35; }
.store-card h3 a { color: var(--text); }
.store-card h3 a:hover { color: var(--brand); }
.store-meta-grid {
  display: grid; grid-template-columns: 1fr; gap: 4px; margin: 10px 0 0; font-size: 0.88rem; color: var(--text-muted);
}
@media (min-width: 640px) { .store-meta-grid { grid-template-columns: 1fr 1fr; gap: 4px 14px; } }
.store-meta-item strong { color: var(--text); font-weight: 600; }

/* Map Panel */
.map-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
@media (min-width: 1024px) {
  .map-panel.sticky-map { position: sticky; top: 80px; }
}
.map-canvas { width: 100%; height: 460px; background: #e8eef2; }
.map-canvas.tall { height: 560px; }
.map-canvas.small { height: 320px; }
.map-caption {
  padding: 10px 14px; font-size: 0.78rem; color: var(--text-subtle);
  background: #f8fafc; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px;
}

/* Mobile Map/List Toggle */
@media (max-width: 1023px) {
  .directory-split[data-mobile-view="list"] .map-col { display: none; }
  .directory-split[data-mobile-view="map"] .list-col { display: none; }
}
.mobile-view-fab {
  display: none; position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 1150;
  background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 22px; font-size: 0.92rem; font-weight: 800; box-shadow: var(--shadow-lg);
  cursor: pointer; min-height: 46px;
}
@media (max-width: 1023px) { .mobile-view-fab.visible { display: inline-flex; align-items: center; gap: 6px; } }

/* Notice / Callout Boxes */
.callout {
  border-radius: var(--radius); padding: 16px 18px; margin: 16px 0;
  border: 1px solid var(--border); background: #fff;
}
.callout-info { background: #eff6ff; border-color: #bfdbfe; }
.callout-warn { background: #fffbeb; border-color: #fde68a; }
.callout-ok { background: #f0fdf4; border-color: #bbf7d0; }
.callout h2, .callout h3 { margin: 0 0 8px; font-size: 1.05rem; }

/* Calculator */
.calc-grid {
  display: grid; grid-template-columns: 1fr; gap: 20px;
}
@media (min-width: 860px) { .calc-grid { grid-template-columns: 1fr 1fr; } }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.form-control {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 1rem; background: #fff; color: var(--text);
}
.calc-result-box {
  background: var(--brand-light); border: 1px solid var(--brand-border); border-radius: var(--radius);
  padding: 18px;
}
.calc-big-num { font-size: 2rem; font-weight: 900; color: var(--brand); line-height: 1.2; }
.compare-table {
  width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.9rem; background: #fff;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--border);
}
.compare-table th, .compare-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top;
}
.compare-table th { background: #f1f5f9; font-weight: 700; color: var(--text); }
.compare-table tr:last-child td { border-bottom: 0; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Article Prose */
.article-layout {
  display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start;
}
@media (min-width: 1024px) { .article-layout { grid-template-columns: minmax(0, 1fr) 310px; } }
.prose { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
@media (min-width: 768px) { .prose { padding: 34px 38px; } }
.prose h2 { margin: 28px 0 12px; font-size: 1.32rem; border-bottom: 2px solid var(--brand-light); padding-bottom: 6px; color: var(--text); }
.prose h3 { margin: 20px 0 8px; font-size: 1.08rem; color: var(--brand); }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose blockquote {
  margin: 16px 0; padding: 12px 16px; background: var(--warn-bg); border-left: 4px solid var(--warn); border-radius: 0 8px 8px 0;
}

/* FAQ Accordion */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
details.faq-item {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
}
details.faq-item summary {
  font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
details.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--brand); flex-shrink: 0; }
details.faq-item[open] summary::after { content: "−"; }
details.faq-item p { margin: 10px 0 0; color: var(--text-muted); font-size: 0.94rem; }

/* Detail Key-Value Table */
.kv-grid {
  display: grid; grid-template-columns: 1fr; gap: 10px;
}
@media (min-width: 640px) { .kv-grid { grid-template-columns: repeat(2, 1fr); } }
.kv-item {
  background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
}
.kv-label { font-size: 0.78rem; color: var(--text-subtle); font-weight: 600; }
.kv-val { font-size: 0.96rem; font-weight: 700; color: var(--text); margin-top: 2px; word-break: break-word; }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.checklist li {
  display: flex; align-items: flex-start; gap: 8px; font-size: 0.92rem;
  background: #f8fafc; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
}

/* Footer */
.site-footer {
  margin-top: 48px; background: #0f172a; color: #cbd5e1; padding: 38px 0 28px; font-size: 0.88rem;
}
.footer-grid {
  display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 24px;
}
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; } }
.site-footer h4 { color: #fff; margin: 0 0 10px; font-size: 0.95rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #1e293b; padding-top: 16px; font-size: 0.8rem; color: #94a3b8;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
}

/* Article Grid */
.article-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .article-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .article-grid { grid-template-columns: repeat(3, 1fr); } }
.article-card {
  display: flex; flex-direction: column; justify-content: space-between;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
.article-card:hover { border-color: var(--brand); box-shadow: var(--shadow); text-decoration: none; }
.article-card h3 { margin: 8px 0 8px; font-size: 1.08rem; line-height: 1.4; color: var(--text); }
.article-card p { margin: 0 0 14px; font-size: 0.88rem; color: var(--text-muted); }

/* Pagination / Load More */
.load-more-wrap { text-align: center; margin-top: 16px; }
.hidden { display: none !important; }
