:root {
  --brand: #0E7490;
  --brand-soft: rgba(14, 116, 144, 0.08);
  --primary-dark: #155E75;
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --divider: #E2E8F0;
  --success: #15803D;
  --danger: #B91C1C;
  --warning: #B45309;
  --info: #1D4ED8;
  --primary: var(--brand);
  --accent: var(--brand-soft);
  --text: var(--text-primary);
  --text-light: var(--text-muted);
  --card: var(--surface);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif; line-height: 1.6; background: var(--bg); margin: 0; padding: 0; color: var(--text); padding-bottom: 80px; }
.header { background: var(--brand); padding: 10px 15px; color: #FFFFFF; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0,0,0,0.15); display: flex; justify-content: space-between; align-items: center; height: 56px; }
.brand { font-size: 18px; font-weight: 800; letter-spacing: 0.5px; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.brand-text-group { display: flex; flex-direction: row; align-items: baseline; gap: 8px; white-space: nowrap; }
.db-info { font-size: 12px; color: rgba(255, 255, 255, 0.8) !important; font-weight: 400; margin-top: 0; }
@media (max-width: 360px) { .db-info { display: none; } }
.header-tools { display: flex; gap: 10px; }
.btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; border-radius: 4px; transition: 0.2s; color: #FFFFFF !important; user-select: none}
.btn-icon:hover { background: rgba(255, 255, 255, 0.2) !important; }
.container { max-width: 1000px; margin: 0 auto; padding: 15px; }
.section { background: var(--card); margin-bottom: 24px; padding: 24px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); border: 1px solid var(--border); }
.sec-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.sec-title::before { content: ""; width: 4px; height: 16px; background: var(--brand); border-radius: 2px; display: block; }
.park-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.park-btn { padding: 12px 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: 0.2s; white-space: nowrap; }
.park-btn.active { background: var(--brand); color: white; border-color: var(--brand); }
.park-btn[data-id="HSP"] { border-bottom: 3px solid #065F46; }
.park-btn[data-id="CTSP"] { border-bottom: 3px solid #A16207; }
.park-btn[data-id="STSP"] { border-bottom: 3px solid #C2410C; }
.park-btn[data-id="KS"] { border-bottom: 3px solid #991B1B; }
.dist-box { display: none; flex-direction: column; background: var(--bg); border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--border); }
.dist-box.show { display: flex; }
.dist-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--surface-2); border-radius: 8px 8px 0 0; font-weight: 600; font-size: 14px; color: var(--text-primary); border-bottom: 1px solid var(--divider); }
.dist-controls { display: flex; gap: 6px; }
.dist-btn { font-size: 12px; padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--text-secondary); transition: 0.2s; }
.dist-btn:hover { background: var(--surface-2); }
.dist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; max-height: 280px; overflow-y: auto; }
.chk-item { font-size: 13px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; text-align: center; cursor: pointer; user-select: none; color: var(--text-muted); transition: 0.1s; }
.chk-item.checked { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 600; }
.market-switch { display: flex; gap: 8px; margin-bottom: 24px; }
.mk-btn { flex: 1; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; text-align: center; transition: 0.2s; }
.mk-btn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.mk-desc { font-size: 11px; font-weight: normal; margin-top: 4px; display: block; opacity: 0.8; }
.input-group { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.form-input { flex: 1; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--surface); color: var(--text-primary); transition: 0.2s; }
.form-input:focus { border-color: var(--brand); }
.autocomplete-wrapper { position: relative; width: 100%; display: block; margin-bottom: 16px; }
.suggestions-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 300px; overflow-y: auto; z-index: 1000; display: none; }
.suggestion-item { padding: 12px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--divider); transition: background 0.2s; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.highlight { background: var(--surface-2); }
.s-text { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.s-tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-secondary); }
.s-tag.type-name {background: #e0f2fe; color: #0369a1; }
.btn-group { display: flex; gap: 10px; margin-top: 24px; }
.btn-analyze, .btn-reset { flex: 1; padding: 14px; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-analyze { background: var(--brand); color: white; width: 100%; }
.btn-analyze:hover { filter: brightness(0.92); }
.btn-reset { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-reset:hover { background: var(--divider); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.dash-head { display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-weight: 600; color: var(--text-primary); font-size: 15px; border-bottom: 1px solid var(--divider); padding-bottom: 8px; }
.dash-head span { margin-left: 6px; font-size: 12px; color: var(--text-muted); font-weight: normal; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--divider); font-size: 13px; }
.stat-row:last-child { border-bottom: none; }
.stat-lbl { color: var(--text-muted); }
.stat-val { font-weight: 600; color: var(--text-primary); font-family: monospace; font-size: 14px; }
.stat-row.highlight { background: var(--surface-2); border-radius: 4px; padding: 8px; margin: 0 -8px; border-bottom: none; }
.stat-row.highlight .stat-val { color: var(--brand); font-weight: 700; }
.val-max { color: var(--danger); }
.val-min { color: var(--success); }
.chart-section { margin-top: 24px; }
.chart-container { position: relative; height: 400px; margin-bottom: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 16px; background: var(--surface); }
.hot-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; justify-content: center; }
.hot-pill { padding: 6px 12px; background: var(--surface); border: 1px solid var(--brand); color: var(--brand); border-radius: 20px; font-size: 12px; cursor: pointer; font-weight: 500; transition: 0.2s; }
.hot-pill:hover { background: var(--brand); color: #ffffff; }
.view-toggle { display: flex; justify-content: flex-end; margin-bottom: 16px; gap: 8px; }
.toggle-btn { padding: 6px 12px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.toggle-btn.active { background: var(--surface-2); color: var(--text-primary); border-color: var(--border); font-weight: 600; }
.data-table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: 13px; background: var(--surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.data-table th, .data-table td { min-width: 60px; padding: 12px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--divider); }
.data-table th { position: sticky; top: 0; background: var(--surface-2); z-index: 11; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: background 0.2s; user-select: none; }
.data-table th:hover { background: #e2e8f0; }
.data-table th:first-child, .data-table td:first-child { position: sticky; left: 0; z-index: 10; background: inherit; border-right: 1px solid var(--divider); }
.data-table th:first-child { background: var(--surface-2); }
.data-table td:first-child { background: var(--surface); }
.data-table tr:hover td { background: var(--bg); }
.s-ico { font-size: 11px; margin-left: 4px; color: var(--text-muted); opacity: 0.4; transition: 0.2s; display: inline-block; }
.data-table th:hover .s-ico { opacity: 0.8; }
.s-ico.active { opacity: 1; color: var(--brand); font-weight: bold; }
.modal .data-table { min-width: auto; width: 100%; }
.modal .data-table th { width: 30%; white-space: normal; background: var(--surface-2); color: var(--text-secondary); pointer-events: none; }
.modal .data-table td { white-space: normal; word-break: break-all; }
.pagination-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px); padding: 8px 16px; border-radius: 50px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); display: none; gap: 16px; align-items: center; z-index: 90; border: 1px solid var(--border); width: 90%; max-width: 400px; justify-content: space-between; }
.page-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.page-btn:active { transform: scale(0.95); background: var(--surface-2); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 14px; font-weight: 600; font-family: monospace; color: var(--text-primary); }
.modal { display: none; position: fixed; inset: 0; background: rgba(17,24,39,0.7); z-index: 100; justify-content: center; align-items: center; backdrop-filter: blur(4px); }

/* ãUI ä¿®å¾©ãï¼æ°å¢ overflow-y: auto; è®æ±ºç­å¼æç­å½çªå§å®¹éé·æå¯èªç±ä¸ä¸æ»å */
.modal-box { background: var(--surface); width: 90%; max-width: 500px; border-radius: 8px; padding: 24px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); animation: popin 0.2s ease-out; display: flex; flex-direction: column; max-height: 85vh; position: relative; overflow-y: auto; }

.modal-body { overflow-y: auto; margin: 16px 0; }
@keyframes popin { from { transform: scale(0.98); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card-list { display: grid; gap: 16px; }
.data-card { background: var(--surface); padding: 16px; border-radius: 8px; border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.04); cursor: pointer; transition: 0.2s; }
.data-card:hover { border-color: var(--brand); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.9); z-index: 200; display: none; flex-direction: column; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--surface-2); border-top: 3px solid var(--brand); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.site-footer { margin-top: 40px; padding: 30px 15px 40px 15px; background: var(--surface); border-top: 1px solid var(--border); text-align: center; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 20px; max-width: 800px; margin-left: auto; margin-right: auto; }
.footer-nav a { color: var(--text-secondary); text-decoration: none; font-size: 13px; padding: 6px 14px 6px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; transition: all 0.2s ease-out; font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.footer-nav a:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.08); background: var(--surface-2); color: var(--text-primary); }
.link-park { border-left: 4px solid #0E7490 !important; }
.link-ty { border-left: 4px solid #1E3A8A !important; }
.link-hc { border-left: 4px solid #065F46 !important; }
.link-tc { border-left: 4px solid #A16207 !important; }
.link-tn { border-left: 4px solid #C2410C !important; }
.link-kh { border-left: 4px solid #991B1B !important; }
.footer-copyright { font-size: 12px; color: var(--text-muted); line-height: 1.8; }
.footer-copyright a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; transition: color 0.2s; }
.footer-copyright a:hover { color: var(--brand); }
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::before, [data-tooltip]::after { position: absolute; visibility: hidden; opacity: 0; transition: opacity 0.2s, visibility 0.2s; z-index: 1000; pointer-events: none; }
[data-tooltip]::before { content: attr(data-tooltip); background: rgba(17, 24, 39, 0.9); color: #fff; font-size: 12px; padding: 8px 12px; border-radius: 6px; white-space: pre-wrap; width: max-content; max-width: 250px; bottom: 125%; left: 50%; transform: translateX(-50%); box-shadow: 0 4px 6px rgba(0,0,0,0.1); line-height: 1.4; font-weight: normal; }
[data-tooltip]::after { content: ""; border-style: solid; border-width: 6px 6px 0 6px; border-color: rgba(17, 24, 39, 0.9) transparent transparent transparent; bottom: calc(125% - 6px); left: 50%; transform: translateX(-50%); }
[data-tooltip]:hover::before, [data-tooltip]:hover::after { visibility: visible; opacity: 1; }
@media (max-width: 600px) {
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 4px; }
    .dash-grid { gap: 12px; }
    .stat-val { font-size: 13px; }
    .section { padding: 16px; }
    .footer-nav { gap: 8px; }
    .footer-nav a { font-size: 12px; padding: 6px 10px 6px 8px; }
}
