:root {
  --sea: #d4ecf7;
  --ink: #1f2a37;
  --muted: #64748b;
  --accent: #e4572e;
  --card: #ffffff;
  --line: #e2e8f0;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  color: var(--ink);
  background: #f6f8fb;
}
.site-header { padding: 18px 24px 8px; background: linear-gradient(90deg, #0e7490, #0891b2); color: #fff; }
.site-header h1 { margin: 0; font-size: 1.7rem; }
.tagline { margin: 4px 0 10px; opacity: .92; font-size: .95rem; }

.toolbar { padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  border: 1px solid var(--line); background: #f1f5f9; color: var(--ink);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: .92rem;
}
.chip[aria-pressed="true"] { background: #0e7490; color: #fff; border-color: #0e7490; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#searchBox { flex: 1 1 260px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
#sortSelect { padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.check { font-size: .92rem; color: var(--muted); }

.layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; padding: 20px 24px; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }

.map-wrap { background: var(--sea); border-radius: var(--radius); padding: 12px; }
.map-hint { margin: 0 0 6px; color: #0f4c5c; font-size: .9rem; }
#twMap { width: 100%; height: auto; display: block; }

.county { stroke: #fff; stroke-width: .8; cursor: pointer; transition: filter .15s, opacity .15s; outline: none; }
.county-group:hover .county, .county-group:focus .county { filter: brightness(1.12) drop-shadow(0 0 4px rgba(0,0,0,.35)); }
.county-group.active .county { stroke: #111; stroke-width: 2; }
.county-group.dim .county { opacity: .45; }
.county-group { cursor: pointer; outline: none; }
.county-label { font-size: 21px; font-weight: 700; fill: #1f2937; pointer-events: none; paint-order: stroke; stroke: rgba(255,255,255,.75); stroke-width: 3px; }
.leader { stroke: #334155; stroke-width: 1; pointer-events: none; }
.badge-circle { fill: var(--accent); stroke: #fff; stroke-width: 2; pointer-events: none; }
.badge-text { fill: #fff; font-size: 13px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.inset-box { fill: rgba(255,255,255,.35); stroke: #475569; stroke-width: 1.2; }

.map-actions { margin-top: 8px; }
.nation-btn {
  width: 100%; padding: 12px; font-size: 1.05rem; font-weight: 700; border: none; border-radius: 10px;
  background: #fff; color: #0e7490; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.nation-btn.active { background: #0e7490; color: #fff; }
.county-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 10px; }
.county-btn {
  border: none; border-radius: 8px; padding: 8px 4px; cursor: pointer; font-size: .9rem; font-weight: 600;
  color: #1f2937; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.county-btn.active { box-shadow: inset 0 0 0 3px #111; }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8rem; }

.panel { background: #fff; border-radius: var(--radius); padding: 16px 18px; min-height: 400px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel-empty { color: var(--muted); text-align: center; padding-top: 80px; }
.panel h2 { margin: 0 0 4px; }
.panel .sub { color: var(--muted); margin: 0 0 14px; font-size: .9rem; }
.group-title { margin: 18px 0 8px; font-size: 1.05rem; border-left: 4px solid #0e7490; padding-left: 8px; }
.deal {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--card);
}
.deal.expired { opacity: .55; }
.deal-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.deal h3 { margin: 0; font-size: 1.02rem; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: #e0f2fe; color: #075985; white-space: nowrap; }
.tag.sample { background: #fef3c7; color: #92400e; }
.tag.urgent { background: #fee2e2; color: #b91c1c; }
.venue { color: var(--muted); font-size: .88rem; margin: 4px 0; }
.price { color: var(--accent); font-weight: 700; }
.deal p { margin: 6px 0; font-size: .93rem; line-height: 1.55; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: .8rem; color: var(--muted); align-items: center; }
.meta a { color: #0e7490; font-weight: 600; }
.nationwide-hint { margin-top: 16px; padding: 10px; background: #f0f9ff; border-radius: 8px; font-size: .9rem; }
.nationwide-hint button { border: none; background: none; color: #0e7490; font-weight: 700; cursor: pointer; text-decoration: underline; }

.tooltip {
  position: fixed; pointer-events: none; background: rgba(15,23,42,.92); color: #fff; padding: 6px 10px;
  border-radius: 6px; font-size: .85rem; z-index: 20; white-space: nowrap;
}
.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 10px 24px 28px; }

.hotel-dir { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.hotel-dir summary { cursor: pointer; font-weight: 700; color: #0e7490; }
.hotel-dir ul { list-style: none; padding: 0; margin: 10px 0 0; max-height: 480px; overflow-y: auto; }
.hotel-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.hotel-row a { color: #0e7490; font-weight: 600; white-space: nowrap; font-size: .88rem; }

.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.jump a { font-size: .85rem; padding: 4px 10px; border-radius: 999px; background: #f0f9ff; color: #0e7490; text-decoration: none; border: 1px solid #bae6fd; }
.group-title { scroll-margin-top: 130px; }
.more-btn { width: 100%; padding: 8px; border: 1px dashed #94a3b8; border-radius: 8px; background: #f8fafc; color: #0e7490; font-weight: 600; cursor: pointer; margin-bottom: 6px; }

/* 右上角「更新資料」 */
.site-header { position: relative; }
.update-box { position: absolute; top: 14px; right: 20px; text-align: right; z-index: 50; }
.update-btn { background: #fff; color: #0e7490; border: 0; border-radius: 999px; padding: 7px 16px; font-weight: 700; font-size: .95rem; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.update-btn:hover { background: #ecfeff; }
.update-btn.busy { background: #fef3c7; color: #92400e; }
.update-when { font-size: .78rem; opacity: .9; margin-top: 4px; }
.update-panel { position: absolute; right: 0; top: 46px; width: min(420px, 92vw); background: #fff; color: #1f2937; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.25); padding: 14px; text-align: left; }
.up-title { margin: 0 0 10px; font-weight: 700; color: #0e7490; }
.up-opt { display: block; width: 100%; text-align: left; margin: 0 0 8px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; cursor: pointer; font: inherit; }
.up-opt:hover { border-color: #0891b2; background: #ecfeff; }
.up-opt strong { display: block; color: #0e7490; }
.up-opt span { font-size: .82rem; color: #475569; }
.up-note { font-size: .8rem; color: #64748b; margin: 6px 0 0; }
.up-bar { height: 4px; width: 132px; margin: 5px 0 0 auto; background: rgba(255,255,255,.35); border-radius: 99px; overflow: hidden; }
#upBarFill { height: 100%; width: 0; background: #fde68a; transition: width .6s; }
@media (max-width: 640px) { .update-box { position: static; text-align: left; margin-bottom: 8px; } .update-panel { left: 0; right: auto; } }
.site-header > h1, .site-header > .tagline { padding-right: 190px; }
@media (max-width: 640px) { .site-header > h1, .site-header > .tagline { padding-right: 0; } }
.up-step { margin: 0; font-weight: 700; color: #0e7490; font-size: .92rem; }
.update-panel.compact { width: 280px; }
/* 更新完成視窗 */
.up-modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.up-modal[hidden] { display: none; }
.up-dialog { background: #fff; border-radius: 14px; width: min(520px, 100%); max-height: 86vh; overflow: auto; padding: 20px 22px; box-shadow: 0 12px 40px rgba(0,0,0,.3); color: #1f2937; }
.up-dialog h2 { margin: 0 0 4px; color: #0e7490; font-size: 1.25rem; }
.up-dialog .up-meta { margin: 0 0 12px; color: #64748b; font-size: .85rem; }
.up-dialog table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 12px; }
.up-dialog th, .up-dialog td { padding: 5px 8px; border-bottom: 1px solid #e2e8f0; text-align: right; }
.up-dialog th:first-child, .up-dialog td:first-child { text-align: left; }
.up-dialog .plus { color: #15803d; font-weight: 700; }
.up-dialog .minus { color: #b91c1c; font-weight: 700; }
.up-dialog details { margin: 8px 0; font-size: .88rem; }
.up-dialog summary { cursor: pointer; font-weight: 700; }
.up-dialog ul { margin: 6px 0 0; padding-left: 20px; max-height: 200px; overflow: auto; }
.up-dialog li { margin: 2px 0; }
.up-dialog .src { color: #64748b; font-size: .8rem; }
.up-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.up-primary { background: #0891b2; color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 700; cursor: pointer; font: inherit; }
.up-secondary { background: #f1f5f9; color: #334155; border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer; font: inherit; }

/* 縣市內的鄉鎮市區地圖 */
.town-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  position: sticky; top: var(--toolbar-h, 0px); z-index: 4; margin: 12px 24px -8px; padding: 8px 14px;
  background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.town-bar[hidden] { display: none; }
.town-bar-town { color: #0e7490; font-weight: 700; }
.back-btn { background: #fff; border: 1px solid #0e7490; color: #0e7490; border-radius: 999px; padding: 5px 12px; cursor: pointer; font: inherit; font-weight: 700; }
.back-btn:hover { background: #ecfeff; }
.town-bar-hint { color: #0f4c5c; font-size: .88rem; }
.town { stroke: #fff; stroke-width: 1.2; cursor: pointer; transition: filter .15s, opacity .15s; }
.town-group { cursor: pointer; outline: none; }
.town-group:hover .town, .town-group:focus .town { filter: brightness(1.1) drop-shadow(0 0 4px rgba(0,0,0,.35)); }
.town-group.empty .town { opacity: .45; }
.town-group.active .town { stroke: #111; stroke-width: 3; }
.town-group.dim .town { opacity: .35; }
.town-label { font-weight: 700; fill: #1f2937; pointer-events: none; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; text-anchor: middle; dominant-baseline: middle; }
.town-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.town-chip { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 999px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: .85rem; }
.town-chip:hover { border-color: #0891b2; background: #ecfeff; }
.town-chip.active { background: #0e7490; border-color: #0e7490; color: #fff; }
.town-chip .n { font-weight: 700; margin-left: 3px; }
.crumb-btn { background: none; border: 0; color: #0e7490; cursor: pointer; font: inherit; font-size: .9rem; padding: 0; text-decoration: underline; }
.tag.link { background: #e0f2fe; color: #075985; }
@media (max-width: 640px) {
  .toolbar { position: static; }  /* 手機版篩選列很高，不固定，以免擋住畫面 */
  .town-bar { margin: 8px 10px -8px; }
  .town-bar-hint { display: none; }
}

/* 快速新增優惠 */
.head-btns { display: flex; gap: 8px; justify-content: flex-end; }
.add-dialog { width: min(640px, 100%); }
.add-dialog form label { display: block; font-size: .85rem; font-weight: 700; color: #334155; margin: 0 0 10px; flex: 1; }
.add-dialog input, .add-dialog select, .add-dialog textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; font-weight: 400; }
.add-dialog textarea { resize: vertical; }
.add-dialog input.auto, .add-dialog select.auto { background: #f0fdf4; border-color: #86efac; }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.add-row label { min-width: 150px; }
.req { color: #dc2626; }
.add-msg { min-height: 1.2em; font-size: .88rem; margin: 4px 0 0; }
.add-msg.err { color: #b91c1c; } .add-msg.ok { color: #15803d; }
.add-warn { background: #fef3c7; color: #92400e; padding: 8px 10px; border-radius: 8px; font-size: .88rem; }
.tag.user { background: #ede9fe; color: #5b21b6; }
.del-btn { background: none; border: 1px solid #fca5a5; color: #b91c1c; border-radius: 6px; padding: 2px 8px; cursor: pointer; font: inherit; font-size: .8rem; }
.del-btn.confirm { background: #b91c1c; color: #fff; }

/* ---------- 線條圖示（js/icons.js） ---------- */
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em; margin-right: .35em; }
[data-icon] { display: inline-flex; }
h1 .ic.logo { width: 1.25em; height: 1.25em; margin-right: .4em; vertical-align: -0.22em; stroke-width: 1.6; }
.update-btn, .back-btn, .nation-btn, .chip, .del-btn, .jump a { display: inline-flex; align-items: center; }
.update-btn .ic { color: #0891b2; }
.update-btn.busy .ic { color: #b45309; }
.ic.spin { animation: ic-spin 1s linear infinite; }
@keyframes ic-spin { to { transform: rotate(360deg); } }
.map-hint .ic, .town-bar-hint .ic { color: #0e7490; width: 1em; height: 1em; }
.chip .ic { width: 1.1em; height: 1.1em; }
.tag { display: inline-flex; align-items: center; }
.tag .ic { width: 1em; height: 1em; margin-right: .25em; }
.group-title .ic { color: #0891b2; width: 1.2em; height: 1.2em; }
.jump a .ic { width: 1em; height: 1em; margin-right: .25em; }
details.hotel-dir summary .ic { width: 1.2em; height: 1.2em; color: #0891b2; }
.meta-item { display: inline-flex; align-items: center; }
.meta-item .ic { width: 1em; height: 1em; color: #64748b; }
a.ext { display: inline-flex; align-items: center; gap: .2em; }
a.ext .ic { width: .95em; height: .95em; margin: 0; }
.venue .ic { width: .95em; height: .95em; margin: 0 .2em 0 0; color: #64748b; }
.up-dialog h2 { display: flex; align-items: center; }
.up-dialog h2 .ic { width: 1.1em; height: 1.1em; }
.up-dialog h2 .ic.ok { color: #16a34a; }
.up-dialog h2 .ic.warn, .up-dialog summary .ic, .up-note .ic, .add-warn .ic { color: #d97706; }
.add-warn { display: flex; align-items: center; gap: .2em; }
/* 刪除按鈕：低調的線框，滑過才變紅 */
.del-btn { gap: .3em; border: 1px solid #e2e8f0; background: #fff; color: #64748b; border-radius: 999px; padding: 3px 10px 3px 8px; font-size: .8rem; transition: all .15s; }
.del-btn .ic { width: 1em; height: 1em; margin: 0; }
.del-btn:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }
.del-btn.confirm { background: #dc2626; border-color: #dc2626; color: #fff; }
.add-warn[hidden], .up-note[hidden], [data-icon][hidden] { display: none; }
.tag.news { background: #fef3c7; color: #92400e; }

/* ---------- 今日精選、收藏、篩選 ---------- */
.picks-btn { background: linear-gradient(90deg, #f59e0b, #f97316); color: #fff; border-color: transparent; margin-bottom: 6px; }
.picks-btn .ic { color: #fff; }
.fav-toggle { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: .9rem; color: #475569; }
.fav-toggle .ic { color: #e11d48; }
.fav-toggle[aria-pressed="true"] { background: #e11d48; border-color: #e11d48; color: #fff; }
.fav-toggle[aria-pressed="true"] .ic { color: #fff; fill: currentColor; }
.fav-toggle .count { margin-left: 4px; font-weight: 700; }
#budgetSelect { padding: 7px 8px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.fav-btn { border: 0; background: none; cursor: pointer; padding: 2px 4px; color: #cbd5e1; display: inline-flex; vertical-align: middle; }
.fav-btn .ic { width: 1.25em; height: 1.25em; margin: 0; }
.fav-btn:hover { color: #fb7185; }
.fav-btn.on { color: #e11d48; }
.fav-btn.on .ic { fill: currentColor; }
.tag.new { background: #dcfce7; color: #166534; }
.variants { margin: 6px 0; font-size: .88rem; }
.variants summary { cursor: pointer; color: #0e7490; font-weight: 700; }
.variants ul { list-style: none; padding: 0; margin: 6px 0 0; max-height: 220px; overflow: auto; }
.variants li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px dashed #e2e8f0; flex-wrap: wrap; }
.variants li span { color: #475569; min-width: 11em; }
.variants li b { color: #c2410c; }
#panel h2 .ic { color: #f59e0b; }
.dash-sec { margin-top: 18px; }
.dash-n { margin-left: 6px; background: #e0f2fe; color: #075985; border-radius: 999px; padding: 0 8px; font-size: .8rem; }
.mini-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.mini { display: flex; gap: 4px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; transition: box-shadow .15s; }
.mini:hover { box-shadow: 0 3px 10px rgba(15,23,42,.08); }
.mini-body { min-width: 0; }
.mini-title { display: block; color: #0f172a; font-weight: 700; text-decoration: none; font-size: .92rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-title:hover { color: #0e7490; text-decoration: underline; }
.mini-meta { font-size: .8rem; color: #64748b; margin-top: 3px; }
.mini-meta .ic { width: .95em; height: .95em; margin-right: .15em; }
.mini-meta b { color: #c2410c; }
.urgent-text { color: #dc2626; font-weight: 700; }
.inline-select { padding: 3px 6px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; font-size: .85rem; }
.tag.legal { background: #dcfce7; color: #166534; font-size: .75rem; }

/* ---------- 通知、行事曆 ---------- */
.alert-n { margin-left: 4px; background: #dc2626; color: #fff; border-radius: 999px; padding: 0 6px; font-size: .75rem; font-weight: 700; }
.alert-n[hidden] { display: none; }
.alert-h { margin: 14px 0 6px; font-size: 1rem; color: #0e7490; display: flex; align-items: center; }
.alert-rules { list-style: none; padding: 0; margin: 0 0 10px; }
.alert-rules li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #e2e8f0; }
.alert-rules code, .add-dialog code { background: #f1f5f9; padding: 0 4px; border-radius: 4px; font-size: .8rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; opacity: 0; transition: all .25s; z-index: 2000; max-width: 90vw; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 640px) {
  /* 手機：類別按鈕改成一行、左右滑動，節省畫面 */
  .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; flex-shrink: 0; }
  .site-header .tagline { font-size: .82rem; }
}

/* 網路版（Cloudflare）：只能看，不顯示更新與新增 */
.online #addBtn, .online #updateBtn, .online #updatePanel, .online #upBar { display: none !important; }
.up-check { display: flex; align-items: center; gap: .4em; font-size: .85rem; margin: .5rem 0 .2rem; cursor: pointer; }
.up-result { padding: .6rem .8rem; border-radius: 8px; background: #ecfdf5; margin: .6rem 0; }
.up-result.err { background: #fef2f2; }
.up-result a { word-break: break-all; }
