:root {
  --ok: #16a34a; --limited: #f59e0b; --down: #dc2626; --none: #9ca3af;
  --bg: #ffffff; --fg: #111827; --muted: #6b7280; --line: #e5e7eb; --accent: #2563eb;
  --shadow: 0 4px 18px rgba(0,0,0,.14);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); }
#map { position: fixed; inset: 0; background: #eef1f4; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; padding: 10px 10px 6px;
  padding-top: max(10px, env(safe-area-inset-top)); display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: linear-gradient(#fffffff2, #ffffffcc 70%, #fff0); }
.brand { display: flex; align-items: center; gap: 6px; font-size: 17px; margin-right: auto; }
.logo { font-size: 20px; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--none); }
.live.on { background: var(--ok); box-shadow: 0 0 0 3px #16a34a33; }
.seg { display: inline-flex; background: #f3f4f6; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.15); font-weight: 600; }
.chips { display: flex; gap: 6px; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
.chips button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px;
  font: inherit; font-size: 14px; cursor: pointer; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.region { position: fixed; z-index: 5; left: 10px; right: 10px; top: 112px; padding: 10px 12px; border-radius: 12px;
  background: #fff7ed; border: 1px solid #fed7aa; box-shadow: var(--shadow); font-size: 14px; }
.region.down { background: #fef2f2; border-color: #fecaca; }
.region.ok { background: #f0fdf4; border-color: #bbf7d0; }
.region a { color: inherit; }

.legend { position: fixed; z-index: 4; right: 10px; bottom: calc(34vh + 12px); background: #fffffff0; border-radius: 10px;
  padding: 6px 10px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; box-shadow: var(--shadow); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot.ok { background: var(--ok); } .dot.limited { background: var(--limited); }
.dot.down { background: var(--down); } .dot.none { background: var(--none); }

.sheet { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; height: 34vh; background: var(--bg);
  border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.15); overflow-y: auto;
  padding: 6px 16px calc(16px + env(safe-area-inset-bottom)); transition: height .25s; }
.sheet.full { height: 78vh; }
.handle { width: 44px; height: 5px; border-radius: 3px; background: #d1d5db; margin: 4px auto 10px; cursor: pointer; }
.sheet h2 { margin: 2px 0 6px; font-size: 19px; }
.sheet h3 { margin: 16px 0 8px; font-size: 15px; }

.row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row .name { flex: 1; }
.row .when { font-size: 12px; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.badge.ok { background: var(--ok); } .badge.limited { background: var(--limited); }
.badge.down { background: var(--down); } .badge.none { background: var(--none); }
.badge.low { opacity: .65; }

table.ops { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ops td, table.ops th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.ops th { font-weight: 500; color: var(--muted); font-size: 12px; }

.report { background: #f9fafb; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.report select { font: inherit; padding: 6px; border-radius: 8px; border: 1px solid var(--line); margin: 0 6px 8px 0; }
.report .btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.report .btns button { border: 0; border-radius: 10px; padding: 12px 6px; font: inherit; font-weight: 600; color: #fff; cursor: pointer; }
.report .btns .ok { background: var(--ok); } .report .btns .limited { background: var(--limited); } .report .btns .down { background: var(--down); }
.report .msg { margin-top: 8px; font-size: 13px; }

.post { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; margin: 8px 0; font-size: 14px; }
.post .meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.post .meta a { color: var(--accent); text-decoration: none; }
.post .txt { white-space: pre-wrap; max-height: 7.2em; overflow: hidden; }
.back { border: 0; background: none; color: var(--accent); font: inherit; padding: 0; cursor: pointer; margin-bottom: 4px; }

.maplibregl-popup-content { padding: 6px 10px; border-radius: 10px; }

@media (min-width: 820px) {
  .sheet { left: 12px; right: auto; width: 400px; bottom: 12px; top: 128px; height: auto; border-radius: 16px; }
  .sheet.full { height: auto; }
  .legend { bottom: 24px; }
  .region { left: 424px; right: 12px; top: 100px; }
  .chips { width: auto; }
}

.bell { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; font: inherit; cursor: pointer; position: relative; }
.bell span:not(:empty) { position: absolute; top: -6px; right: -6px; background: var(--down); color: #fff; border-radius: 999px; font-size: 11px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; }
.follow { width: 100%; margin: 10px 0 2px; border: 1px solid var(--accent); color: var(--accent); background: #fff; border-radius: 10px; padding: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.follow.on { background: var(--accent); color: #fff; }
.notif label { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.notif select { font: inherit; padding: 6px; border-radius: 8px; border: 1px solid var(--line); }
.notif .x { margin-left: auto; border: 0; background: none; color: var(--down); font-size: 18px; cursor: pointer; }
.notif .off { margin-top: 12px; border: 0; background: none; color: var(--down); font: inherit; cursor: pointer; padding: 0; }
