:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #16212b;
  --muted: #5b6b78;
  --line: #e2e8ee;
  --brand: #0b3d66;
  --brand-ink: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 33, 43, .06), 0 4px 16px rgba(16, 33, 43, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--brand); color: #fff; padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Header */
.site-header {
  background: var(--brand);
  color: var(--brand-ink);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; }
.brand-mark { font-size: 14px; transform: rotate(90deg); display: inline-block; }
.brand-name { font-size: 17px; letter-spacing: .2px; }
.nav-menu { position: relative; }
.nav-toggle {
  color: #fff; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; min-height: 40px; display: inline-flex; align-items: center; gap: 4px;
  list-style: none; cursor: pointer;
}
.nav-toggle::-webkit-details-marker { display: none; }
.nav-toggle:hover, .nav-menu[open] .nav-toggle { background: rgba(255, 255, 255, .14); }
.nav-panel {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px; display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 2px;
  max-height: 70vh; overflow-y: auto; width: min(92vw, 380px); z-index: 60;
}
.nav-panel a {
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 10px; border-radius: 8px;
}
.nav-panel a:hover { background: #f1f5f8; }
.nav-panel a.active { background: rgba(11, 61, 102, .12); color: var(--brand); }

/* Hero */
.hero { padding: 24px 16px 8px; }
.hero h1 { font-size: 26px; margin: 0 0 6px; line-height: 1.2; }
.hero-sub { color: var(--muted); margin: 0; font-size: 16px; }

/* System blocks */
.systems-grid { display: grid; grid-template-columns: 1fr; gap: 20px; padding-top: 16px; padding-bottom: 8px; }
.system-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.system-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.system-head h2 { margin: 0; font-size: 19px; }
.system-head h2 a { text-decoration: none; color: var(--ink); }
.system-meta { color: var(--muted); font-size: 13px; text-align: right; }
.local-time { white-space: nowrap; }

.summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.summary-pill {
  color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}

/* Line list */
.line-list { list-style: none; margin: 8px 0 0; padding: 0; }
.line-row { border-top: 1px solid var(--line); }
.line-row:first-child { border-top: none; }
.line-row-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  text-decoration: none; color: var(--ink); min-height: 44px;
}
.line-row-link:hover { background: #f7fafc; }
.line-main { display: flex; flex-direction: column; min-width: 0; }
.line-desc { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.line-list-detail .line-desc { color: var(--ink); font-weight: 500; }
.line-reason { color: var(--muted); font-size: 13px; margin-top: 2px; }
.line-list .line-row-link > .line-desc { flex: 1; }

/* Chips (line color badges) */
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px;
  color: #fff; font-weight: 700; font-size: 14px; flex: none;
}
.chip-dark { color: #16212b; }
.chip-lg { min-width: 52px; height: 52px; font-size: 22px; border-radius: 12px; }

/* Status pill */
.pill {
  display: inline-flex; align-items: center; color: #fff; font-weight: 600;
  font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; flex: none; margin-left: auto;
}
.pill-sm { font-size: 11px; padding: 2px 8px; }

.system-more { margin: 12px 0 0; font-size: 14px; }
.system-more a { text-decoration: none; font-weight: 600; }

/* Page head (system/line) */
.page-head { padding: 20px 16px 8px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { text-decoration: none; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.stale-flag { color: #c62828; font-weight: 600; }

.line-hero { display: flex; align-items: center; gap: 14px; }
.line-hero-main h1 { margin: 0 0 4px; }
.line-hero-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.line-hero-status .pill { margin-left: 0; }

.reason-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-top: 16px;
}
.reason-box h2 { margin: 0 0 8px; font-size: 16px; }
.reason-box p { margin: 0; }

/* History */
.history { padding-top: 20px; padding-bottom: 8px; }
.history h2 { font-size: 18px; margin: 20px 0 10px; }
.history-empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.day-bars { list-style: none; margin: 0; padding: 0; }
.day-bar-row { display: grid; grid-template-columns: 54px 1fr 72px; align-items: center; gap: 10px; padding: 4px 0; }
.day-label { font-size: 12px; color: var(--muted); }
.day-bar { display: flex; height: 16px; border-radius: 6px; overflow: hidden; background: #eceff2; }
.day-seg { height: 100%; }
.day-seg-empty { background: #eceff2; }
.day-pct { font-size: 12px; color: var(--muted); text-align: right; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.timeline-item:first-child { border-top: none; }
.timeline-when { color: var(--muted); font-size: 12px; min-width: 120px; }
.timeline-desc { color: var(--ink); flex: 1; min-width: 0; }

/* Copy sections */
.copy-section { padding: 20px 16px 8px; }
.copy-section h1 { font-size: 24px; margin: 8px 0 12px; }
.copy-section h2 { font-size: 18px; margin: 20px 0 8px; }
.copy-section p { margin: 0 0 12px; }
.error-section { text-align: center; }
.btn { display: inline-block; background: var(--brand); color: #fff; text-decoration: none; padding: 10px 18px; border-radius: 10px; font-weight: 600; }

/* Ads */
.ad-wrap { max-width: 960px; margin: 20px auto 0; padding: 0 16px; }
.ezoicad { min-height: 90px; }

/* Footer */
.site-footer { margin-top: 28px; padding: 20px 0 32px; border-top: 1px solid var(--line); background: var(--card); }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.footer-links a { text-decoration: none; font-size: 14px; font-weight: 600; }
.footer-note { color: var(--muted); font-size: 13px; margin: 0; }

/* Featured (local) system */
.featured-section { padding-top: 8px; }
.featured-label {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  margin: 8px 0; font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted);
}
.featured-note { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 13px; }
.featured .system-block { border-color: var(--brand); box-shadow: 0 2px 4px rgba(11, 61, 102, .12), 0 6px 20px rgba(11, 61, 102, .12); }

/* Locations grid (system cards, no line rows) */
.locations-section { padding-top: 20px; padding-bottom: 8px; }
.locations-title { font-size: 18px; margin: 8px 0 12px; }
.locations-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.system-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
  text-decoration: none; color: var(--ink);
}
.system-card:hover { border-color: var(--brand); }
.system-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.system-card-name { margin: 0; font-size: 18px; }
.system-card-place { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.system-card .summary { margin-top: 12px; margin-bottom: 0; }
.system-card .stale-flag { display: inline-block; margin-top: 6px; font-size: 13px; }

/* Browser-language suggestion banner */
.lang-suggest {
  background: rgba(11, 61, 102, .08); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 16px; font-size: .95rem;
}
.lang-suggest a { color: var(--brand); text-decoration: underline; font-weight: 600; }
.lang-suggest-close {
  margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: 1.2rem; line-height: 1; padding: 8px; min-width: 40px; min-height: 40px;
}

/* Desktop two-column */
@media (min-width: 700px) {
  .locations-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

@media (min-width: 900px) {
  .systems-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .hero h1 { font-size: 32px; }
}
