/* Rut Bot Weather — web app styles. Mobile-first, dark command-center. */
:root {
  --bg: #0a0e14;
  --panel: #11161f;
  --panel-2: #161d29;
  --border: #232c3d;
  --red: #e63946;
  --red-dark: #a52833;
  --orange: #f4842b;
  --green: #2ecc71;
  --yellow: #ffd166;
  --text: #e8ecf1;
  --muted: #9aa4b2;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

[hidden] { display: none !important; }

/* ---------- Header ---------- */
#brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 8px; }
.nav-ic { width: 25px; height: 25px; border-radius: 7px; object-fit: cover; }
.brand-text { min-width: 0; }
#site-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: 1.5px;
  font-weight: 800;
  white-space: nowrap;
}
#tagline {
  margin: 2px 0 0;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Storm watch mode: header flips when a tornado warning is active */
#brandbar.stormwatch { border-bottom: 2px solid var(--red); }
#brandbar.stormwatch #site-title {
  color: #fff;
  background: var(--red);
  padding: 2px 8px;
  border-radius: 4px;
  animation: pulse-red 1.6s ease-in-out infinite;
}
@keyframes pulse-red {
  0%, 100% { background: var(--red); }
  50% { background: var(--red-dark); }
}

#live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  flex: 0 0 auto;
}
#live-badge .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #555;
}
#live-badge.live-on { color: var(--text); }
#live-badge.live-on .dot {
  background: var(--red);
  animation: blink 1.6s ease-in-out infinite;
}
#live-badge.watching { color: var(--yellow); }
#live-badge.watching .dot {
  background: var(--yellow);
  animation: blink 2.6s ease-in-out infinite;
}
#push-btn {
  flex: 0 0 auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  font-size: 17px;
  line-height: 1;
  padding: 7px 9px;
  cursor: pointer;
  filter: grayscale(1);
  opacity: 0.75;
}
#push-btn.push-on {
  filter: none;
  opacity: 1;
  border-color: var(--yellow);
  box-shadow: 0 0 10px rgba(255,200,60,0.35);
}
#push-btn:disabled { opacity: 0.4; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Views & tab bar ---------- */
#views {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
  padding: 12px 12px 20px;
}
.view.active { display: block; }
#view-radar { padding: 0; overflow: hidden; }

#tabbar {
  flex: 0 0 auto;
  display: flex;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
#tabbar button {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
}
#tabbar button svg { width: 24px; height: 24px; }
#tabbar button.active { color: var(--red); }
#tabbar button:active { background: var(--panel-2); }

/* ---------- Shared bits ---------- */
.sec-title {
  font-size: 14px;
  letter-spacing: 1px;
  margin: 18px 2px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-ic { color: var(--red); }
.loading, .empty { color: var(--muted); font-size: 14px; text-align: center; padding: 14px; }
.err { color: var(--orange); font-size: 14px; text-align: center; padding: 14px; }
.src { font-size: 11px; color: var(--muted); text-align: center; margin: 14px 0 4px; }
.est { font-size: 11px; color: var(--muted); font-style: italic; margin: 6px 0 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card-title { font-weight: 800; letter-spacing: 1px; font-size: 13px; margin-bottom: 8px; }
.card-text { font-size: 14px; margin: 0; line-height: 1.5; white-space: pre-line; }

/* ---------- Home ---------- */
.loc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 2px 10px;
  font-size: 15px;
}
#home-loc { font-weight: 700; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#home-locate {
  font-size: 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
#home-locate:active { background: #1c2432; }

#home-search { position: relative; margin-bottom: 12px; }
#home-search-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#home-search-input::placeholder { color: var(--muted); }
#home-search-input:focus { outline: 2px solid var(--red); border-color: var(--red); }
#home-search-results {
  position: absolute;
  top: 50px; left: 0; right: 0;
  margin: 0; padding: 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 21;
}
#home-search-results li button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
#home-search-results li:last-child button { border-bottom: none; }

.now-card { text-align: center; padding: 10px 0 4px; }
.big-temp { font-size: 84px; font-weight: 800; line-height: 1; letter-spacing: -2px; }
.feels { font-size: 17px; color: var(--text); margin-top: 6px; }
.hilo { font-size: 15px; color: var(--muted); margin-top: 4px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stat-ic { font-size: 20px; }
.stat-label { font-size: 10px; color: var(--muted); }
.stat-val { font-size: 14px; font-weight: 700; }
.stat-sub { font-size: 10px; color: var(--green); }

.hstrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.hcell {
  flex: 0 0 64px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 4px;
  text-align: center;
  font-size: 13px;
}
.hcell .hh { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.hcell .ht { font-weight: 800; font-size: 16px; margin: 4px 0; }
.hcell .hp { color: var(--muted); font-size: 11px; }
.hcell.now { border-color: var(--red); }
.hcell.now .hh { color: var(--red); font-weight: 700; }

.dlist { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.drow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.drow:last-child { border-bottom: none; }
.drow .dd { flex: 0 0 52px; font-weight: 600; }
.drow .di { flex: 0 0 30px; text-align: center; font-size: 18px; }
.drow .ds { flex: 1 1 auto; color: var(--muted); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drow .dt { font-weight: 700; white-space: nowrap; }
.drow .dt .lo { color: var(--muted); font-weight: 400; }

.says {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--red-dark);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 14px;
}
.says-head { color: var(--red); font-weight: 800; letter-spacing: 1px; font-size: 13px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.bot-face { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; vertical-align: -6px; }
.says p { margin: 0; font-size: 15px; line-height: 1.5; }

/* ---------- Radar tab ---------- */
#radar-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 10px 12px 0;
  padding: 12px 14px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: left;
  z-index: 26;
  position: relative;
}
#radar-banner .rb-text { min-width: 0; flex: 1 1 auto; }
#radar-banner .rb-main { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#radar-banner .rb-sub { display: block; font-size: 11px; font-weight: 400; opacity: 0.9; margin-top: 2px; }
#radar-banner .rb-chev { font-size: 30px; font-weight: 300; line-height: 1; opacity: 0.9; flex: 0 0 auto; }
/* Smaller national banner shown under the local one */
#radar-banner-national {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 8px 12px 0;
  padding: 8px 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  z-index: 26;
  position: relative;
}
#radar-banner-national .rb-text { min-width: 0; flex: 1 1 auto; }
#radar-banner-national .rb-main { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#radar-banner-national .rb-kicker { display: block; font-size: 9px; font-weight: 800; letter-spacing: 1px; color: var(--muted); margin-bottom: 2px; }
#radar-banner-national .rb-chev { font-size: 22px; font-weight: 300; line-height: 1; opacity: 0.7; flex: 0 0 auto; }

#map-wrap {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}
#view-radar.has-banner #map-wrap { top: 78px; }
#view-radar.has-national #map-wrap { top: 52px; }
#view-radar.has-banner.has-national #map-wrap { top: 130px; }
#map { position: absolute; inset: 0; }

#searchbar {
  position: absolute;
  top: 10px; left: 12px; right: 12px;
  display: flex;
  gap: 8px;
  z-index: 20;
}
#search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: rgba(17, 22, 31, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#search-input::placeholder { color: var(--muted); }
#search-input:focus { outline: 2px solid var(--red); border-color: var(--red); }

#locate-btn {
  flex: 0 0 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(17, 22, 31, 0.94);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#locate-btn:active { background: var(--panel-2); }

#search-results {
  position: absolute;
  top: 50px; left: 0; right: 52px;
  margin: 0; padding: 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 21;
}
#search-results li button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
#search-results li:last-child button { border-bottom: none; }
#search-results li button:active { background: var(--panel-2); }

#map-controls {
  position: absolute;
  right: 12px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}
#map-controls button {
  width: 46px; height: 46px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  background: rgba(17, 22, 31, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
#map-controls button:active { background: var(--panel-2); }
#play-pause.paused { color: var(--orange); border-color: var(--orange); }
#basemap-toggle { font-size: 13px; letter-spacing: 1px; }
#basemap-toggle.sat-on { color: var(--green); border-color: var(--green); }

#radar-legend {
  position: absolute;
  left: 12px;
  bottom: 14px;
  z-index: 20;
  background: rgba(17, 22, 31, 0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  color: var(--muted);
}
#radar-legend .legend-title { font-weight: 800; color: var(--text); letter-spacing: 1px; margin-right: 6px; }

/* ---------- Storms ---------- */
.meter-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.meter-title { font-weight: 800; letter-spacing: 1px; font-size: 13px; }
.meter-num { font-size: 30px; font-weight: 800; color: var(--red); }
.meter-bar {
  height: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--yellow) 40%, var(--orange) 70%, var(--red));
  transition: width 0.6s ease;
}
.meter-label { font-size: 15px; font-weight: 700; margin-top: 8px; }
.meter-line { font-size: 14px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.meter-sub { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.storm-list { margin: 0; padding: 0; list-style: none; }
.storm-list li { margin-bottom: 10px; }
.storm-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 5px solid var(--muted);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}
.storm-item:active { background: var(--panel-2); }
.storm-item .evt { font-weight: 800; display: block; font-size: 15px; }
.storm-item .area { color: var(--muted); display: block; font-size: 13px; margin-top: 3px; }
.storm-item .timing { color: var(--muted); display: block; font-size: 12px; margin-top: 3px; }
.storm-item.sev-tornado { border-left-color: var(--red); }
.storm-item.sev-thunder { border-left-color: var(--orange); }
.storm-item.sev-flood { border-left-color: var(--green); }
.storm-item.sev-watch { border-left-color: var(--yellow); }

/* ---------- Chat ---------- */
#view-rutbot { display: none; flex-direction: column; }
#view-rutbot.active { display: flex; }
#chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 10px;
  min-height: 0;
}
.msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}
.msg.bot {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  display: flex; gap: 9px; align-items: flex-start;
}
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.msg.user {
  align-self: flex-end;
  background: var(--red-dark);
  border-bottom-right-radius: 4px;
}
#chat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  flex: 0 0 auto;
}
#chat-chips button {
  flex: 0 0 auto;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 18px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}
#chat-chips button:active { border-color: var(--red); }
#chat-form {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  padding-bottom: 4px;
}
#chat-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
}
#chat-input:focus { outline: 2px solid var(--red); border-color: var(--red); }
#chat-form button {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
#chat-form button:active { background: var(--red-dark); }

/* ---------- Alert detail card ---------- */
#alert-detail {
  position: absolute;
  left: 12px; right: 12px;
  bottom: 76px;
  z-index: 40;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 60dvh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}
#detail-close {
  position: absolute;
  top: 6px; right: 10px;
  font-size: 28px;
  background: none; border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
}
#alert-detail h2 { margin: 0 34px 6px 0; font-size: 17px; }
#detail-headline { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
#alert-detail dl { margin: 0; font-size: 14px; }
#alert-detail dl > div { margin-bottom: 8px; }
#alert-detail dt { font-weight: 700; color: var(--orange); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
#alert-detail dd { margin: 2px 0 0; white-space: pre-line; }
.detail-src { font-size: 11px; color: var(--muted); margin: 10px 0 0; }

/* ---------- Toast ---------- */
#toast {
  position: absolute;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  max-width: 90%;
  text-align: center;
}

/* ---------- Footer ---------- */
#attrib {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 3px 8px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 30;
}
#info-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* MapLibre tweaks */
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.locate-marker { pointer-events: none; }

/* ---------- Radar: area chip ---------- */
#area-chip {
  position: absolute;
  top: 64px; left: 12px;
  z-index: 20;
  display: flex; align-items: center; gap: 6px;
  max-width: 62%;
  background: rgba(17, 22, 31, 0.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 13px;
  color: var(--text);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
}
#area-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#area-chip:active { background: var(--panel-2); }

/* ---------- Radar: layers ---------- */
#layers-btn {
  position: absolute;
  top: 64px; right: 12px;
  z-index: 21;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(17, 22, 31, 0.92);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#layers-btn.open { border-color: var(--green); color: var(--green); }
#layers-panel {
  position: absolute;
  top: 114px; right: 12px;
  z-index: 22;
  background: rgba(17, 22, 31, 0.97);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px 12px;
  min-width: 210px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.layers-title { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--muted); margin-bottom: 4px; }
.layer-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; font-size: 13px; color: var(--text); cursor: pointer; border-top: 1px solid var(--border); }
.layer-row:first-of-type { border-top: none; }
.layer-row input { width: 17px; height: 17px; accent-color: var(--green); flex: 0 0 auto; }
.layer-row em { color: var(--muted); font-style: normal; font-size: 11px; }
.layer-row.disabled { opacity: 0.45; cursor: default; }

/* ---------- Radar: Rut Bot bubble ---------- */
#rutbot-bubble {
  position: absolute;
  left: 12px; bottom: 62px;
  z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.bubble-face {
  width: 58px; height: 58px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: 0 3px 12px rgba(0,0,0,0.5);
  animation: bubble-ping 3s ease-out infinite;
}
@keyframes bubble-ping {
  0% { box-shadow: 0 3px 12px rgba(0,0,0,0.5), 0 0 0 0 rgba(244,132,43,0.45); }
  70% { box-shadow: 0 3px 12px rgba(0,0,0,0.5), 0 0 0 10px rgba(244,132,43,0); }
  100% { box-shadow: 0 3px 12px rgba(0,0,0,0.5), 0 0 0 0 rgba(244,132,43,0); }
}
#rutbot-bubble:active .bubble-face { border-color: var(--green); }
.bubble-status {
  display: flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
  color: var(--muted);
  background: rgba(17, 22, 31, 0.9);
  border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 8px;
}
.bubble-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); animation: blink 2.6s ease-in-out infinite; }
#rutbot-bubble.live .bubble-dot { background: var(--red); animation: blink 1.6s ease-in-out infinite; }
#rutbot-bubble.live .bubble-status { color: var(--text); }

/* ---------- Radar: storm FAB ---------- */
#storm-fab {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: 16px;
  z-index: 25;
  display: flex; align-items: center; gap: 8px;
  background: var(--red); color: #fff;
  border: none; border-radius: 26px;
  padding: 13px 22px;
  font-size: 14px; font-weight: 800; letter-spacing: 0.5px;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 18px rgba(230, 57, 70, 0.45);
  animation: fab-pulse 2.2s ease-in-out infinite;
}
@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(230, 57, 70, 0.35); }
  50% { box-shadow: 0 4px 28px rgba(230, 57, 70, 0.75); }
}
#storm-fab:active { transform: translateX(-50%) scale(0.97); }

/* ---------- Radar: frame clock ---------- */
#radar-clock {
  text-align: center;
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  color: var(--green);
  background: rgba(17, 22, 31, 0.94);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 4px;
  line-height: 1.2;
}

/* ---------- Bottom sheets ---------- */
#sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 95;
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 18px 18px 30px;
  max-height: 72vh;
  overflow-y: auto;
  animation: sheet-up 0.22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 14px; letter-spacing: 1px; margin: 0 34px 10px 0; }
.sheet-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.sheet-note { font-size: 11px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
.src-list { margin: 0; }
.src-list > div { display: flex; gap: 10px; margin: 9px 0; font-size: 13px; }
.src-list dt { font-weight: 800; min-width: 92px; color: var(--muted); flex: 0 0 auto; }
.src-list dd { margin: 0; color: var(--text); }
.sheet-btn {
  display: block; width: 100%;
  margin-top: 10px; padding: 13px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text); font-size: 14px; font-weight: 700;
  cursor: pointer; text-align: center;
}
.sheet-btn:active { background: var(--border); }
#areas-list { list-style: none; margin: 0 0 4px; padding: 0; }
#areas-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.area-go {
  flex: 1 1 auto; text-align: left;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 15px; font-weight: 600;
  padding: 10px 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.area-go .area-sub { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.area-del {
  flex: 0 0 auto;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: 13px; cursor: pointer; padding: 7px 10px;
}

/* ============================================================
   RADAR PLATFORM — Phase 1 (2026-09-27)
   Radar-first layout: full-bleed map, compact floating top bar,
   professional bottom info tray, floating panels.
   ============================================================ */

/* Full-bleed map: banners overlay instead of pushing the map down. */
#view-radar.has-banner #map-wrap,
#view-radar.has-national #map-wrap,
#view-radar.has-banner.has-national #map-wrap { top: 0; }
#radar-banner, #radar-banner-national {
  position: absolute; left: 12px; right: 12px; z-index: 24;
  top: 62px; margin: 0; width: auto;
}
#view-radar.has-banner.has-national #radar-banner-national { top: 62px; }
#view-radar.has-banner.has-national #radar-banner { top: 122px; }

/* ---- compact floating top bar ---- */
#radar-topbar {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
}
#radar-topbar > * { pointer-events: auto; }
#radar-logo {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
#radar-topbar #searchbar {
  position: relative; top: auto; left: auto; right: auto;
  flex: 1 1 auto; min-width: 0;
  display: flex; gap: 6px; z-index: 30;
}
#radar-topbar #search-input { height: 40px; font-size: 15px; }
#radar-topbar #locate-btn { flex: 0 0 40px; height: 40px; }
#radar-topbar #search-results { top: 46px; right: 0; }
#product-btn {
  flex: 0 0 auto; height: 40px; padding: 0 12px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(17, 22, 31, 0.94); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 12px; font-weight: 800; letter-spacing: 0.5px; cursor: pointer;
  max-width: 42vw;
}
#product-btn .caret { color: var(--muted); font-size: 10px; }
#product-btn.open { border-color: var(--orange); color: var(--orange); }
#product-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#radar-topbar #layers-btn {
  position: static; top: auto; right: auto;
  width: 40px; height: 40px; flex: 0 0 auto;
}
#alert-count-btn {
  flex: 0 0 auto; height: 40px; padding: 0 12px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(17, 22, 31, 0.94); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted);
  font-size: 13px; font-weight: 800; cursor: pointer;
}
#alert-count-btn.has-alerts { color: #fff; border-color: var(--red); background: rgba(230, 57, 70, 0.9); }
#alert-count { min-width: 14px; text-align: center; }

/* ---- radar product menu ---- */
#product-menu {
  position: absolute; top: 56px; left: 8px; right: 8px; z-index: 31;
  background: rgba(13, 17, 24, 0.98);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
  max-height: 62vh; overflow-y: auto; padding: 10px 12px 12px;
}
.pm-title { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--muted); margin: 2px 0 6px; }
.pm-row {
  display: flex; align-items: stretch; gap: 4px;
  border-top: 1px solid var(--border); padding: 2px 0;
}
.pm-row.pm-active .pm-name { color: var(--orange); }
.pm-star {
  background: none; border: none; cursor: pointer; padding: 8px 6px;
  font-size: 17px; color: #4a5568;
}
.pm-star.on { color: var(--yellow); }
.pm-main {
  flex: 1 1 auto; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 6px; text-align: left;
}
.pm-name { font-size: 14px; font-weight: 700; color: var(--text); }
.pm-live { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; color: var(--green); }
.pm-na-tag { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; color: var(--muted); }
.pm-row.pm-na .pm-name { color: var(--muted); }
.pm-info {
  background: none; border: none; cursor: pointer; padding: 8px 6px;
  font-size: 16px; color: var(--muted);
}
.pm-detail {
  flex: 1 1 100%; font-size: 12.5px; line-height: 1.55; color: var(--text);
  background: rgba(255,255,255,0.03); border-radius: 8px; padding: 10px 12px; margin: 2px 0 8px;
}
.pm-detail p { margin: 6px 0; }
.pm-detail strong { color: var(--orange); }
.pm-why { color: var(--muted); }
.pm-foot { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* ---- layers panel (floating card) ---- */
#radar-topbar ~ #layers-panel, #map-wrap > #layers-panel {
  top: 56px; right: 8px; left: auto;
  max-height: 66vh; overflow-y: auto; min-width: 230px; max-width: 78vw;
}
#layers-panel .layers-title:not(:first-child) { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.slider-row { justify-content: space-between; }
.slider-row input[type="range"] { flex: 1 1 auto; accent-color: var(--orange); }
#opacity-val { font-size: 12px; font-weight: 800; color: var(--orange); min-width: 38px; text-align: right; }
.seg-row { justify-content: space-between; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; font-weight: 800; padding: 7px 14px;
}
.seg button.active { background: var(--orange); color: #fff; }

/* ---- floating controls above the tray ---- */
#map-controls { bottom: 118px; right: 10px; }
#map-controls button { width: 42px; height: 42px; }

/* ---- bottom radar info tray ---- */
#radar-tray {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 26;
  background: rgba(13, 17, 24, 0.94);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
}
.tray-meta {
  display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1 1 auto;
  font-size: 12px; font-weight: 800; letter-spacing: 0.4px;
  overflow: hidden; white-space: nowrap;
}
#tray-site { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.tray-sep { color: var(--muted); }
#tray-product { color: var(--orange); overflow: hidden; text-overflow: ellipsis; }
#tray-scan { color: var(--muted); font-weight: 600; }
#tray-live { font-weight: 800; }
#tray-live.is-live { color: var(--green); }
#tray-live.delayed { color: var(--yellow); }
.tray-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.tray-btns button {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-size: 12px; font-weight: 800; padding: 8px 11px; cursor: pointer;
  white-space: nowrap;
}
.tray-btns button:active { background: var(--panel-2); }
.tray-btns button.open { border-color: var(--orange); color: var(--orange); }
#tray-play.paused { color: var(--orange); border-color: var(--orange); }

/* ---- repositioned floating elements above the tray ---- */
#radar-legend { bottom: 108px; left: 10px; }
#radar-topbar ~ #area-chip, #map-wrap > #area-chip { top: 60px; left: 10px; }
#rutbot-bubble { bottom: 158px; left: 10px; }
#storm-fab { bottom: 108px; }

/* ---- Phase 2: single-site radar ---- */
.tray-site-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text); font: inherit; font-weight: 800; letter-spacing: 0.4px;
  padding: 2px 4px; margin: -2px -4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-bottom: 1px dotted var(--muted);
}
.tray-site-btn:active { color: var(--orange); }
.pm-site-tag {
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  color: var(--orange); border: 1px solid var(--orange);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  vertical-align: 1px;
}
#tray-live.is-bad { color: #ff5a5a; }
#site-search {
  width: 100%; box-sizing: border-box;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 15px; padding: 11px 12px; margin: 4px 0 8px;
}
#site-list { list-style: none; margin: 0; padding: 0; }
#site-list li { border-bottom: 1px solid var(--border); }
.site-go {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 15px; padding: 10px 4px;
}
.site-go strong { color: var(--orange); margin-right: 6px; font-size: 14px; }
.site-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.site-dot.st-live { background: #22c55e; }
.site-dot.st-delayed { background: #eab308; }
.site-dot.st-offline { background: #ef4444; }
.site-dot.st-unknown { background: #6b7280; }

/* Radar tower card */
#tower-card .tower-title { font-size: 20px; font-weight: 800; margin: 2px 0 2px; }
#tower-card .tower-title .tower-city { font-size: 13px; font-weight: 400; color: var(--muted); }
#tower-card .tower-status { display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: 0.5px;
  padding: 4px 10px; border-radius: 20px; margin: 6px 0 2px; }
#tower-card .tower-status.st-live { background: rgba(34,197,94,0.15); color: #4ade80; }
#tower-card .tower-status.st-delayed { background: rgba(234,179,8,0.15); color: #facc15; }
#tower-card .tower-status.st-offline { background: rgba(239,68,68,0.15); color: #f87171; }
#tower-card .tower-status.st-unknown { background: rgba(107,114,128,0.2); color: #9ca3af; }
#tower-card .tower-rows { margin: 10px 0 2px; font-size: 13px; }
#tower-card .tower-rows .tr { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
#tower-card .tower-rows .tr span:first-child { color: var(--muted); min-width: 108px; flex: 0 0 auto; }
#tower-card .tower-pick { margin-top: 10px; font-size: 12px; color: var(--orange); font-weight: 700; }
#tower-card .tower-note { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.site-go .site-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.site-go.site-cur .site-sub { color: var(--green); }
.site-empty { padding: 14px 4px; color: var(--muted); font-size: 14px; }
.layer-note { font-size: 11px; color: var(--muted); margin: 6px 0 2px; line-height: 1.45; }
#palette-select {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 13px; font-weight: 700; padding: 7px 8px; max-width: 62%;
}
.seg button.q-off { opacity: 0.35; }

/* ---------- Accounts / PRO ---------- */
#account-btn.pro {
  border-color: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.45);
}
