:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d2626;
  --muted: #5d6b6a;
  --line: #e4e2dc;
  --brand: #1f6f6b;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0ee;
  --accent: #f2b544;
  --radius: 12px;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121817;
    --surface: #1a2221;
    --text: #e8eeed;
    --muted: #9aa9a7;
    --line: #2c3736;
    --brand: #5fc1b9;
    --brand-ink: #0d1514;
    --brand-soft: #1e3532;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.7; }
a { color: var(--brand); }
h1 { font-size: 1.75rem; line-height: 1.35; margin: 0.4em 0 0.3em; }
h2 { font-size: 1.2rem; margin: 2em 0 0.6em; }
h3 { font-size: 1rem; margin: 1.2em 0 0.4em; color: var(--muted); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lead { color: var(--muted); font-size: 1.05rem; }
.lead strong { color: var(--text); }
.muted { color: var(--muted); }
.count { color: var(--muted); font-size: 0.85em; margin-left: 0.35em; }

/* 頁首頁尾 */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo-tagline { color: var(--brand); font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: 1rem; }
.header-link { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-footer { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.site-footer p { margin: 0.5em 0; }
.crumbs { margin-top: 16px; font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* 首頁 */
.hero { padding: 32px 0 8px; }
.hero h1 { font-size: 2rem; }
.search input { width: 100%; padding: 14px 16px; font-size: 1.05rem; border: 2px solid var(--brand); border-radius: var(--radius); background: var(--surface); color: var(--text); font-family: inherit; }
.search input:focus { outline: 3px solid var(--brand-soft); }
.search-results:empty { display: none; }
.slogan { font-size: 1.25rem; font-weight: 700; color: var(--brand); margin: 0 0 4px; }
.search-big input { padding: 18px 18px; font-size: 1.15rem; border-width: 3px; border-radius: 14px; }
.search-tips { color: var(--muted); font-size: 0.88rem; margin: 6px 2px 0; }
/* 首頁四個入口 */
.entry-grid { list-style: none; padding: 0; margin: 24px 0 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.entry-grid a { display: grid; gap: 4px; justify-items: start; padding: 16px; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.entry-grid a:hover { border-color: var(--brand); }
.entry-grid strong { font-size: 1.05rem; }
.entry-grid span:last-child { color: var(--muted); font-size: 0.85rem; }
.entry-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.entry-grid li:last-child .entry-icon { background: #fff1d6; color: #9a6400; }
.feature-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.feature-grid li { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.feature-grid h3 { margin: 0 0 6px; color: var(--text); font-size: 1rem; }
.feature-grid p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.audience { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.audience h2 { margin-top: 0; }
.steps { padding-left: 1.4em; }
.steps li { margin-bottom: 10px; }
.steps p { margin: 2px 0 0; color: var(--muted); }
@media (max-width: 760px) {
  .entry-grid { grid-template-columns: 1fr 1fr; }
  .feature-grid, .audience { grid-template-columns: 1fr; }
}
.region h3 { margin-top: 1.4em; }

/* 縣市、行政區格子 */
.city-grid, .district-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.city-grid a, .district-grid a { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.city-grid a:hover, .district-grid a:hover { border-color: var(--brand); }

/* 類別標籤 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { display: inline-flex; align-items: baseline; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-size: 0.92rem; cursor: pointer; }
a.chip:hover, button.chip:hover { border-color: var(--brand); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.is-active .count { color: inherit; opacity: 0.8; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); font-size: 0.8rem; white-space: nowrap; }
.tag-muted { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tag-danger { background: #fbe4e2; color: #8c1d18; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* 補習班列表 */
.school-list { list-style: none; padding: 0; margin: 12px 0; border-top: 1px solid var(--line); }
.school-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.school-item[hidden] { display: none; }
.school-item a { text-decoration: none; }
.school-name { font-weight: 600; font-size: 1.02rem; }
.school-item .tag { align-self: start; }
.school-meta { grid-column: 1 / -1; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }

/* 補習班頁 */
.school .official { color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.facts { margin: 20px 0; border-top: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 6em 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts > div.key { background: var(--brand-soft); border-bottom-color: var(--surface); padding: 14px 12px; border-radius: 8px; margin-bottom: 4px; }
.facts > div.key dt { color: var(--brand); font-weight: 700; }
.key-value { font-weight: 600; font-size: 1.05rem; }
.phone { font-weight: 700; font-size: 1.3rem; display: inline-block; padding: 8px 0; min-height: 44px; }
.source { color: var(--muted); font-size: 0.8rem; }
.table-wrap { overflow-x: auto; }
.courses { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.courses th, .courses td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.courses th { color: var(--muted); font-weight: 600; }
.map { margin-top: 20px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.map iframe { display: block; width: 100%; height: 220px; border: 0; }
/* 醒目的行動按鈕：認領、寫評論 */
.button.cta { background: var(--accent); color: #3a2a00; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
.button.cta:hover { filter: brightness(0.95); }
.button.line-button { background: #06c755; color: #fff; margin-top: 8px; }
.footer-contact { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 !important; }
.footer-contact .button { margin-top: 0; }
@media (max-width: 560px) { .footer-contact .button { width: 100%; text-align: center; } }
.button.small { min-height: 40px; padding: 8px 14px; margin-top: 8px; font-size: 0.95rem; }
.claim-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px 0 4px; padding: 12px 16px; border: 2px solid var(--accent); border-radius: var(--radius); background: #fff8e8; font-weight: 600; }
.review-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0 8px; padding: 16px 18px; border: 2px solid var(--accent); border-radius: var(--radius); background: #fff8e8; }
.review-cta p { margin: 0; }
@media (prefers-color-scheme: dark) {
  .claim-bar, .review-cta { background: #2a2414; }
}
@media (max-width: 560px) {
  .claim-bar .button, .review-cta .button { width: 100%; text-align: center; }
  .map iframe { height: 180px; }
}
.claim { margin-top: 24px; padding: 16px 20px; border-radius: var(--radius); background: var(--brand-soft); }
.claim h2 { margin: 0 0 4px; font-size: 1.05rem; }
.claim p { margin: 0; color: var(--muted); }
.note p { color: var(--muted); }

/* 認領後的資料 */
.tag-level { background: #e6eefc; color: #2f5bb7; margin-right: 6px; }
.by-school-home { margin-top: 28px; padding: 18px 20px; border-radius: var(--radius); background: var(--brand-soft); }
.by-school-home h2 { margin-top: 0; }
.by-school-home .search input { border-width: 2px; }
.area-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.area-picker label { display: grid; gap: 4px; font-weight: 600; }
.area-picker select { font: inherit; font-size: 16px; padding: 12px; min-height: 48px; border: 2px solid var(--brand); border-radius: 10px; background: var(--surface); color: var(--text); }
.area-picker select:disabled { border-color: var(--line); color: var(--muted); }
.pick-group h3 { margin: 14px 0 4px; color: var(--text); }
.pick-group .chip { background: var(--surface); }
.school-search { margin-top: 14px; }
.school-search summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.by-school { margin: 8px 0 4px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.by-school summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.tag-verified { background: var(--accent); color: #3a2a00; }
/* 照片排成一列左右滑動，最多 20 張也不會把電話擠到很下面 */
.gallery { display: flex; gap: 8px; margin: 16px 0 4px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.gallery a { flex: 0 0 auto; width: 72%; max-width: 320px; scroll-snap-align: start; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: var(--line); }
.gallery-count { margin: 0 0 12px; font-size: 0.85rem; color: var(--muted); }
.intro p { margin: 0 0 0.8em; }
.offerings { list-style: none; padding: 0; margin: 12px 0; border-top: 1px solid var(--line); }
.offerings li { display: grid; gap: 2px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.facts dd p { margin: 0 0 0.4em; }

/* 按鈕與表單（認領、後台） */
.button { display: inline-block; padding: 10px 18px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); text-decoration: none; font: inherit; font-weight: 600; border: 0; cursor: pointer; }
.button.secondary { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.button.danger { background: #b3261e; color: #fff; }
.form { display: grid; gap: 14px; max-width: 560px; margin: 16px 0; }
.form label { display: grid; gap: 4px; font-weight: 600; }
.form .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.form input[type=text], .form input[type=tel], .form input[type=email], .form input[type=url], .form input[type=date], .form input[type=password], .form textarea, .form select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%;
}
.form textarea { min-height: 96px; }
.form .check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.notice { padding: 12px 16px; border-radius: 8px; background: var(--brand-soft); margin: 12px 0; }
.notice.error { background: #fbe4e2; color: #8c1d18; }
.friend-banner { padding: 14px 18px; border: 2px solid #06c755; border-radius: var(--radius); background: var(--surface); margin: 16px 0; }
.friend-banner p { margin: 6px 0; }
.friend-banner .friend-title { font-weight: 700; font-size: 1.1rem; color: #06a847; }
.friend-banner .button { margin-top: 4px; min-height: 44px; }
.panel { padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 12px 0; }
.panel h3 { margin-top: 0; color: var(--text); }
.inline-form { display: inline; }
.photo-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-admin figure { margin: 0; display: grid; gap: 4px; }
.photo-admin img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.stars-show { color: #e0a100; letter-spacing: 1px; }
.stars { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.stars legend { font-weight: 600; margin-bottom: 6px; }
/* 星等、檢舉類型：整列都可以點，手機好按 */
.stars label.check { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 1.15rem; color: #e0a100; min-height: 48px; }
.stars label.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.form input[type=radio], .form input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.form input[type=file] { font: inherit; padding: 12px; border: 2px dashed var(--line); border-radius: 10px; background: var(--surface); width: 100%; }
.button { min-height: 48px; }
.reviews { list-style: none; padding: 0; margin: 12px 0; border-top: 1px solid var(--line); }
.reviews li { padding: 14px 4px; border-bottom: 1px solid var(--line); }
.reviews p { margin: 0 0 6px; }
.reply { margin-top: 8px; padding: 10px 14px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 4px; }
.reply p { margin: 0; }
.parent-tuition { margin: 8px 0 2px; font-weight: 600; font-size: 0.9rem; }
.tuition-list { margin: 0; padding-left: 1.2em; }
.legal { max-width: 760px; }
.legal h2 { font-size: 1.1rem; margin-top: 1.8em; }
.legal ol { padding-left: 1.4em; }
.legal li { margin: 0.3em 0; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 8px 0; }
.legal-table th, .legal-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.legal-table th { background: var(--brand-soft); }
@media (max-width: 560px) {
  .legal-table, .legal-table tbody, .legal-table tr, .legal-table td { display: block; width: 100%; }
  .legal-table thead { display: none; }
  .legal-table tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
  .legal-table td { border: 0; border-bottom: 1px solid var(--line); }
  .legal-table td:first-child { font-weight: 700; background: var(--brand-soft); }
}
.page-actions { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; }
.page-actions .button { min-height: 44px; }
.page-actions .hint { flex-basis: 100%; margin: 4px 0 0; }
.cert-preview { max-width: 100%; max-height: 520px; border: 1px solid var(--line); border-radius: 8px; }

@media (max-width: 560px) {
  h1, .hero h1 { font-size: 1.5rem; }
  .facts > div { grid-template-columns: 5em 1fr; }
  /* 手機：表單按鈕整排、字不會小到讓 iPhone 自動放大 */
  .form input, .form textarea, .form select { font-size: 16px; }
  .form .button, .claim .button, a.button.secondary { display: block; width: 100%; text-align: center; }
}
