:root {
  color-scheme: light;
  --bg: #fffaf5;
  --surface: #ffffff;
  --surface-soft: #fff4eb;
  --surface-tint: #fbe5d6;
  --text: #292524;
  --text-soft: #78716c;
  --text-faint: #a8a29e;
  --line: #f1ded2;
  --line-strong: #e8cbbb;
  --accent: #e8875b;
  --accent-strong: #d96c3e;
  --accent-soft: #f7d4c0;
  --ink-inverse: #fffaf5;
  --ok: #4d8a4a;
  --ok-soft: #e3f0df;
  --warn: #c2410c;
  --warn-soft: #fde4d3;
  --shadow: 0 24px 60px rgba(115, 70, 38, 0.1);
  --shadow-soft: 0 12px 30px rgba(115, 70, 38, 0.07);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 10px;
  --container: 1180px;
  --font-display: "Avenir Next", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  --font-body: "Inter", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111111;
  --surface: #1a1a1a;
  --surface-soft: #201714;
  --surface-tint: #3a241c;
  --text: #f5f5f4;
  --text-soft: #a8a29e;
  --text-faint: #78716c;
  --line: #2e2e2e;
  --line-strong: #4a332a;
  --accent: #f59e72;
  --accent-strong: #ffb08d;
  --accent-soft: #5a3022;
  --ink-inverse: #16110f;
  --ok: #7fb57a;
  --ok-soft: #1d2a1c;
  --warn: #ffb08d;
  --warn-soft: #4a2518;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.7; -webkit-font-smoothing: antialiased; transition: background-color 220ms ease, color 220ms ease; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
.container { width: min(calc(100% - 64px), var(--container)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--text); color: var(--bg); transform: translateY(-150%); transition: transform 160ms ease; }
.skip-link:focus { transform: translateY(0); }

/* ----- Header / Nav ----- */
.site-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
.header-inner { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: max-content; }
.brand-mark { position: relative; display: inline-flex; width: 27px; height: 27px; align-items: end; gap: 3px; padding: 4px; border: 1px solid var(--accent); border-radius: 8px; transform: rotate(-8deg); }
.brand-mark span { display: block; width: 4px; border-radius: 3px; background: var(--accent); transform: rotate(8deg); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 15px; opacity: .78; }
.brand-mark span:nth-child(3) { height: 11px; }
.brand-copy { display: grid; gap: 0; line-height: 1.1; }
.brand-copy strong { font-size: .92rem; font-weight: 750; letter-spacing: .01em; }
.brand-copy small { color: var(--text-faint); font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; }
.desktop-nav { display: flex; align-items: center; gap: 34px; margin-left: auto; margin-right: 26px; }
.nav-link { position: relative; color: var(--text-soft); font-size: .8rem; font-weight: 650; letter-spacing: .02em; transition: color 180ms ease; }
.nav-link::after { position: absolute; right: 0; bottom: -8px; left: 0; height: 2px; border-radius: 2px; background: var(--accent); content: ""; transform: scaleX(0); transform-origin: right; transition: transform 180ms ease; }
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); transform-origin: left; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.github-link { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: .78rem; font-weight: 650; transition: color 180ms ease; }
.github-link:hover { color: var(--accent-strong); }
.github-link svg { width: 17px; fill: currentColor; }
.theme-toggle, .mobile-menu-toggle { display: inline-grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.theme-toggle { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; transition: border-color 180ms ease, background 180ms ease; }
.theme-toggle:hover { border-color: var(--accent); background: var(--surface-tint); }
.theme-icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.theme-icon-moon { display: none; fill: currentColor; stroke: none; }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: block; }
.mobile-menu-toggle { display: none; width: 34px; height: 34px; gap: 4px; padding: 7px; }
.mobile-menu-toggle span { display: block; width: 100%; height: 1px; background: var(--text); transition: transform 180ms ease, opacity 180ms ease; }
.mobile-nav { display: none; }

/* ----- Hero ----- */
.page-hero { position: relative; overflow: hidden; padding: 72px 0 56px; border-bottom: 1px solid var(--line); }
.page-hero::before { position: absolute; inset: 0; background-image: linear-gradient(color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px); background-size: 70px 70px; content: ""; mask-image: linear-gradient(to right, black, transparent 78%); opacity: .45; pointer-events: none; }
.page-hero .container { position: relative; }
.section-kicker { margin: 0 0 18px; color: var(--accent-strong); font-size: .68rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.18; }
h1 { margin-bottom: 20px; font-size: clamp(2.6rem, 5.4vw, 4.4rem); font-weight: 750; letter-spacing: -.06em; }
h1 em, h2 em { color: var(--accent-strong); font-style: normal; }
.page-description { max-width: 540px; margin-bottom: 0; color: var(--text-soft); font-size: 1rem; line-height: 1.9; }

/* ----- Status ----- */
.status-section { padding: 52px 0 96px; }
.status-banner { display: flex; align-items: center; gap: 18px; padding: 26px 30px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-soft); }
.status-banner .status-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text-faint); box-shadow: 0 0 0 6px color-mix(in srgb, var(--text-faint) 16%, transparent); }
.status-banner.is-loading .status-dot { background: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent); animation: pulse 1.2s ease-in-out infinite; }
.status-banner.is-none .status-dot { background: var(--ok); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 16%, transparent); }
.status-banner.is-partial .status-dot { background: var(--warn); box-shadow: 0 0 0 6px color-mix(in srgb, var(--warn) 18%, transparent); }
.status-banner.is-error .status-dot { background: var(--text-faint); box-shadow: 0 0 0 6px color-mix(in srgb, var(--text-faint) 16%, transparent); }
.status-copy { min-width: 0; flex: 1; }
.status-copy h2 { margin-bottom: 4px; font-size: 1.35rem; font-weight: 750; letter-spacing: -.01em; }
.status-sub { margin-bottom: 0; color: var(--text-soft); font-size: .88rem; }
.refresh-btn { flex: none; padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: transparent; color: var(--text-soft); font-size: .76rem; font-weight: 650; cursor: pointer; transition: border-color 180ms ease, color 180ms ease, background 180ms ease; }
.refresh-btn:hover { border-color: var(--accent); color: var(--text); background: var(--surface-tint); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.status-meta { display: flex; flex-wrap: wrap; gap: 14px 34px; margin: 26px 0 40px; color: var(--text-faint); font-size: .74rem; letter-spacing: .04em; }
.status-meta strong { color: var(--text); font-weight: 700; }

/* ----- City cards ----- */
.city-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.city-card { padding: 24px 26px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-soft); transition: border-color 180ms ease, transform 180ms ease; }
.city-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.city-name { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 1.12rem; font-weight: 750; }
.city-items { display: grid; gap: 9px; }
.item { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-soft); font-size: .84rem; line-height: 1.55; }
.item .item-place { flex: none; font-weight: 700; }
.item .item-status { color: var(--text-soft); }
.item.stop { background: var(--warn-soft); }
.item.stop .item-place, .item.stop .item-status { color: var(--warn); }
.item.normal { background: var(--ok-soft); }
.item.normal .item-place, .item.normal .item-status { color: var(--ok); }

/* ----- Error ----- */
.error-panel { margin-top: 10px; padding: 26px 30px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); }
.error-panel h3 { margin-bottom: 8px; font-size: 1.1rem; }
.error-message { margin-bottom: 20px; color: var(--text-soft); font-size: .88rem; }
.error-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 13px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 750; letter-spacing: .01em; transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--accent); color: var(--ink-inverse); box-shadow: 0 9px 20px color-mix(in srgb, var(--accent) 24%, transparent); }
.button-primary:hover { background: var(--accent-strong); }
.button-ghost { border-color: var(--line-strong); color: var(--text); }
.button-ghost:hover { border-color: var(--accent); background: var(--surface-tint); }

/* ----- Footer ----- */
.site-footer { padding: 34px 0 20px; background: var(--text); color: var(--bg); }
.footer-top, .footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.footer-brand .brand-copy small { color: color-mix(in srgb, var(--bg) 52%, transparent); }
.footer-brand .brand-mark { border-color: var(--accent); }
.footer-links { display: flex; flex-wrap: wrap; gap: 24px; color: color-mix(in srgb, var(--bg) 70%, transparent); font-size: .72rem; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { margin-top: 55px; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--bg) 16%, transparent); color: color-mix(in srgb, var(--bg) 46%, transparent); font-size: .62rem; letter-spacing: .05em; }

@media (max-width: 700px) {
  .container { width: min(calc(100% - 36px), var(--container)); }
  .header-inner { min-height: 67px; }
  .desktop-nav, .github-link { display: none; }
  .mobile-menu-toggle { display: grid; }
  .mobile-nav { display: grid; max-height: 0; overflow: hidden; padding: 0 18px; border-top: 0 solid var(--line); background: var(--bg); transition: max-height 220ms ease, padding 220ms ease, border-top-width 220ms ease; }
  .mobile-nav.is-open { max-height: 300px; padding: 12px 18px 18px; border-top-width: 1px; }
  .mobile-nav .nav-link { padding: 9px 0; }
  .mobile-nav .nav-link::after { bottom: 4px; right: auto; width: 24px; }
  .mobile-menu-toggle.is-open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .mobile-menu-toggle.is-open span:nth-child(2) { opacity: 0; }
  .mobile-menu-toggle.is-open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  .page-hero { padding: 48px 0 40px; }
  h1 { font-size: clamp(2.3rem, 12vw, 3.4rem); }
  .status-section { padding: 34px 0 64px; }
  .status-banner { align-items: start; flex-wrap: wrap; padding: 22px; }
  .status-copy { flex-basis: calc(100% - 40px); }
  .status-meta { gap: 10px 24px; margin: 20px 0 30px; }
  .city-list { grid-template-columns: 1fr; gap: 16px; }
  .footer-top, .footer-bottom { align-items: start; flex-direction: column; }
  .footer-bottom { margin-top: 36px; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
