:root {
  --bg: #f4f5f7; --card: #fff; --text: #14171c; --muted: #5d6573; --line: #e3e6eb;
  --accent: #1d4ed8; --accent-soft: #e8eefc; --warn: #b45309; --warn-soft: #fef3e2;
  --ok: #047857; --ok-soft: #e3f6ee; --bad: #b91c1c; --bad-soft: #fde8e8; --grey-soft: #eef0f3;
  --radius: 14px; --tabbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #1a1d23; --text: #eef0f4; --muted: #9aa3b2; --line: #2a2f38;
    --accent: #7aa2ff; --accent-soft: #1d2740; --warn: #f5b25b; --warn-soft: #3a2a14;
    --ok: #5fd3a5; --ok-soft: #13302a; --bad: #ff8a8a; --bad-soft: #3b1a1a; --grey-soft: #252a33;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden; overscroll-behavior-y: contain;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  padding: calc(var(--safe-top) + 10px) 16px 8px; border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h1 { font-size: 21px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.stand { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.icon-btn { border: 0; background: var(--card); border-radius: 50%; width: 38px; height: 38px; flex: none;
  display: grid; place-items: center; color: var(--accent); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search { margin-top: 10px; position: relative; display: flex; align-items: center; background: var(--card);
  border-radius: 11px; box-shadow: 0 0 0 1px var(--line); padding: 0 10px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font-size: 16px; padding: 9px 8px; -webkit-appearance: none; appearance: none; }
.search input::-webkit-search-cancel-button { display: none; }
.q-clear { border: 0; background: var(--grey-soft); width: 22px; height: 22px; border-radius: 50%; line-height: 20px; cursor: pointer; }

.offline { margin-top: 8px; font-size: 13px; background: var(--warn-soft); color: var(--warn); border-radius: 9px; padding: 6px 10px; }

.seg { display: flex; gap: 4px; margin-top: 10px; background: var(--grey-soft); border-radius: 10px; padding: 3px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg:empty { display: none; }
.seg button { flex: 1 0 auto; border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--muted); white-space: nowrap; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg .n { font-size: 12px; opacity: .7; margin-left: 3px; font-variant-numeric: tabular-nums; }

main { padding: 12px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px); max-width: 760px; margin: 0 auto; outline: none; }
.section-intro { font-size: 13px; color: var(--muted); margin: 2px 2px 12px; }
.group-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 4px 8px; }
.group-title:first-child { margin-top: 4px; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 14px 12px; margin-bottom: 10px;
  box-shadow: 0 0 0 1px var(--line); overflow-wrap: anywhere; }
.card h2 { font-size: 16px; line-height: 1.3; margin: 4px 0 6px; font-weight: 600; }
.card h2 a { color: inherit; text-decoration: none; }
.card p { margin: 0 0 8px; font-size: 15px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.meta .dot::before { content: "·"; margin-right: 8px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--grey-soft); color: var(--muted); }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; text-decoration: none; padding: 4px 0; }
.link::after { content: "↗"; font-weight: 400; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 14px; margin: 6px 0 8px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tel { font-weight: 600; text-decoration: none; }
.note { font-size: 13px; color: var(--muted); }
.next { font-size: 13px; margin: 0 0 8px; }
.next b { font-weight: 600; }
.aelter { font-size: 12px; color: var(--warn); font-weight: 600; }
mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 1px; }
@media (prefers-color-scheme: dark) { mark { background: #6b5800; } }

.sos { display: flex; gap: 12px; align-items: center; background: var(--bad-soft); color: var(--bad); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.sos a { color: inherit; font-weight: 700; font-size: 20px; text-decoration: none; background: var(--card); border-radius: 10px; padding: 4px 12px; flex: none; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; }
.chips button { border: 0; background: var(--card); box-shadow: 0 0 0 1px var(--line); padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: none; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.footer-note { font-size: 12px; color: var(--muted); margin: 18px 4px 0; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.tabbar a { flex: 1; min-width: 0; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; -webkit-tap-highlight-color: transparent; }
.tabbar svg { width: 25px; height: 25px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.src { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 2px; }
