/* ==========================================================================
   Nordic Aurora Radar — Visual Design System
   Calm OLED dark hierarchy, 3-column bento metrics, minimal border noise,
   and true scotopic deep-red night-vision mode for Arctic field viewing.
   ========================================================================== */

:root {
  --bg: #040912;
  --surface: rgba(15, 24, 41, 0.86);
  --surface-2: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #f2f7ff;
  --muted: #8ea6c4;
  --green: #34f0b0;
  --green-bg: rgba(52, 240, 176, 0.10);
  --amber: #ffcf5c;
  --amber-bg: rgba(255, 207, 92, 0.10);
  --red: #ff6b7b;
  --red-bg: rgba(255, 107, 123, 0.11);
  --blue: #66bdff;
  --blue-bg: rgba(102, 189, 255, 0.10);
  --sheet-bg: #0b1424;
  --backdrop: rgba(2, 6, 14, 0.72);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse 90% 38% at 50% -6%, rgba(20, 118, 108, 0.22), transparent 64%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}
/* Dynamic status-bar shield for iOS/Android standalone PWA (0px in normal browser, exact notch/Dynamic Island height in PWA) */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: env(safe-area-inset-top, 0px);
  background: linear-gradient(180deg, rgba(4, 9, 18, 0.96) 72%, rgba(4, 9, 18, 0));
  pointer-events: none;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 10px 14px 18px; }

/* ====== Top App Header (Quiet Monochrome Ghost Controls) ====== */
.hdr { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 0.96rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--green); box-shadow: 0 0 10px var(--green); }
.hdr-tools { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.icon-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: inherit; font-size: 0.82rem; font-weight: 800;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn:disabled { opacity: 0.5; cursor: wait; }
.icon-btn svg { width: 19px; height: 19px; display: block; }
.icon-btn.spinning svg, .meta-ref-btn.spinning { animation: spin 0.9s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.icon-btn.alert-on { color: var(--green); border-color: rgba(52, 240, 176, 0.45); background: var(--green-bg); }
.icon-btn.alert-on::after {
  content: ''; position: absolute; top: 7px; right: 7px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green);
}
.icon-btn.red-on { color: #ff3b30; border-color: rgba(255, 59, 48, 0.55); background: rgba(220, 38, 38, 0.18); }

.btn {
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-size: 0.84rem; font-weight: 700; padding: 10px 14px; min-height: 44px; border-radius: 11px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-family: inherit; transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: rgba(255,255,255,0.28); }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-ghost { background: rgba(255,255,255,0.045); border-color: var(--border); color: var(--text); padding: 7px 12px; min-height: 38px; font-size: 0.8rem; border-radius: 10px; }
.btn-blue { background: var(--blue-bg); border-color: rgba(102,189,255,0.34); color: #d8efff; }

.line-tip, .offline-tip {
  display: none; border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-size: 0.8rem;
}
.line-tip { background: var(--blue-bg); border: 1px solid rgba(102,189,255,0.3); color: #d6eeff; }
.offline-tip { background: var(--red-bg); border: 1px solid rgba(255,107,123,0.4); color: #ffd4d9; font-weight: 700; }

/* ====== Slim Location Header ====== */
.loc-card {
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: 2px 2px 10px; margin-bottom: 12px;
}
.loc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.loc-name-btn {
  background: none; border: none; padding: 4px 0; min-height: 40px; color: var(--text); font: inherit;
  font-size: 1.24rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; min-width: 0; text-align: left;
}
.loc-name-btn .chev { color: var(--muted); font-size: 0.85rem; transition: transform 0.15s ease; }
.loc-name-btn.open .chev { transform: rotate(180deg); }
.loc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.loc-icon-btn { width: 40px; height: 40px; border-radius: 11px; }
.loc-icon-btn svg { width: 18px; height: 18px; }
.loc-icon-btn.gps-live { color: var(--green); border-color: rgba(52, 240, 176, 0.4); background: var(--green-bg); }
.loc-meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.meta-ref-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 9px; width: 36px; height: 36px; padding: 0; cursor: pointer;
  font-size: 0.92rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.meta-ref-btn:hover { color: var(--text); border-color: var(--border-strong); }
.gps-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.gps-dot.live { background: var(--green); box-shadow: 0 0 6px var(--green); }
.gps-dot.manual { background: var(--amber); }
.gps-dot.err { background: var(--red); }

.picker { display: none; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border); }
.picker.open { display: block; }
.picker-grp { margin-bottom: 9px; }
.picker-lbl { font-size: 0.72rem; font-weight: 800; color: var(--muted); letter-spacing: 0.03em; margin-bottom: 6px; text-transform: uppercase; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.chip {
  padding: 8px 12px; min-height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); font-size: 0.82rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.chip.on { background: rgba(102,189,255,0.18); border-color: rgba(102,189,255,0.55); color: #fff; }
.search-row { display: flex; gap: 6px; margin-top: 8px; }
.search-row input {
  flex: 1; min-width: 0; padding: 10px 12px; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: rgba(4,9,18,0.85); color: var(--text); font-size: 0.88rem; font-family: inherit;
}

/* ====== Slim Flighty-Style Official NOAA G1-G5 Storm Ribbon ====== */
.storm-banner {
  display: none; text-decoration: none; margin-bottom: 12px; padding: 9px 12px;
  border-radius: 0 11px 11px 0; border: 1px solid var(--border); border-left: 3px solid var(--amber);
  background: rgba(255, 207, 92, 0.08); color: #f6e7be;
  font-size: 0.82rem; font-weight: 700; align-items: center; justify-content: space-between; gap: 8px;
}
.storm-banner.severe { border-left-color: var(--red); background: rgba(255, 107, 123, 0.11); color: #ffe1e6; }
.storm-pill {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 0.7rem; font-weight: 800;
  background: rgba(255,207,92,0.18); color: var(--amber); margin-right: 7px; font-variant-numeric: tabular-nums;
}
.storm-banner.severe .storm-pill { background: rgba(255,107,123,0.22); color: #ff8e9b; }

/* ====== Hero Sky Visualizer + 3-Column Bento Metrics ====== */
.sky-hero {
  border-radius: 22px; overflow: hidden; border: 1px solid rgba(255,255,255,0.10);
  background: var(--surface); margin-bottom: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}
.sky-stage {
  position: relative; width: 100%; min-height: 212px; height: auto; overflow: hidden;
  background: linear-gradient(180deg, #030a16 0%, #0d223d 100%);
}
.sky-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.sky-overlay {
  position: relative; z-index: 1; min-height: 212px; padding: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(90deg, rgba(4,9,18,0.78) 0%, rgba(4,9,18,0.30) 56%, rgba(4,9,18,0.68) 100%);
}
.sky-text { flex: 1; min-width: 0; }
.sky-title { margin: 0 0 6px; font-size: 1.34rem; font-weight: 800; line-height: 1.24; letter-spacing: -0.02em; text-shadow: 0 2px 10px rgba(0,0,0,0.8); }
.sky-lead { margin: 0; font-size: 0.9rem; line-height: 1.48; color: #dbe9fa; text-shadow: 0 1px 6px rgba(0,0,0,0.85); }

.ring-wrap { position: relative; width: 118px; height: 118px; flex-shrink: 0; }
.ring-svg { width: 118px; height: 118px; transform: rotate(-90deg); overflow: visible; }
.ring-bg-disc { fill: rgba(4, 9, 18, 0.74); }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 9; }
.ring-prog {
  fill: none; stroke: var(--amber); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 310;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s ease;
}
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.ring-num { font-size: 2.15rem; font-weight: 900; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-sub { font-size: 0.74rem; color: var(--muted); font-weight: 700; margin-top: 3px; }
.ring-grade { margin-top: 2px; font-size: 0.74rem; font-weight: 800; white-space: nowrap; max-width: 92px; text-align: center; }

@keyframes auroraWave {
  0%, 100% { transform: translateX(0px) scaleY(1); opacity: 0.85; }
  50% { transform: translateX(12px) scaleY(1.08); opacity: 1; }
}
.aur-anim { animation: auroraWave 6s ease-in-out infinite; transform-origin: center; }

.sky-body { padding: 12px 14px 13px; }

/* Unified 3-column bento bar (saves ~140px on mobile & eliminates nested card borders) */
.factors {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  background: rgba(255, 255, 255, 0.035); border-radius: 14px; padding: 11px 2px;
}
.f-box {
  background: transparent; border: none; border-right: 1px solid var(--border);
  border-radius: 0; padding: 2px 9px; min-width: 0;
}
.f-box:last-child { border-right: none; }
.f-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.f-lbl { font-size: 0.78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.f-val { font-size: 1.14rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.f-track { height: 4px; background: rgba(255, 255, 255, 0.09); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.f-fill { height: 100%; border-radius: 99px; transition: width 0.55s ease; }
.f-sub { font-size: 0.77rem; color: var(--muted); line-height: 1.35; word-break: break-word; }

.fc-strip {
  margin-top: 9px; padding: 9px 11px; border-radius: 10px;
  background: rgba(102, 189, 255, 0.06); border: none;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  font-size: 0.86rem; color: #dbeeff;
}
.fc-strip strong { color: var(--green); }

.tpill { padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); font-weight: 700; font-size: 0.78rem; color: var(--muted); }
.tpill-link { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; transition: border-color 0.15s ease, color 0.15s ease; }
.tpill-link:hover { border-color: rgba(102,189,255,0.45); color: #e2f2ff; }
.src-link { color: inherit; text-decoration: none; border-bottom: 1px dashed rgba(142,166,196,0.4); transition: color 0.15s ease, border-color 0.15s ease; }
.src-link:hover { color: var(--blue); border-bottom-color: var(--blue); }

/* ====== Views, Cards & Quiet Left-Accented Callouts ====== */
.view { display: none; }
.view.on { display: block; animation: fadeUp 0.16s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 15px; margin-bottom: 12px;
}
.card h2 {
  margin: 0 0 10px; font-size: 1.08rem; font-weight: 800; letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-sub { margin: 0 0 10px; font-size: 0.86rem; color: var(--muted); }

.callout {
  border: none; border-left: 3px solid var(--border-strong);
  border-radius: 0 10px 10px 0; background: rgba(255,255,255,0.03);
  padding: 9px 12px; margin-bottom: 11px; font-size: 0.9rem; line-height: 1.48; color: var(--text);
}
.callout.good { border-left-color: var(--green); background: rgba(52,240,176,0.06); color: #d8fff0; }
.callout.warn { border-left-color: var(--amber); background: rgba(255,207,92,0.06); color: #f6e7c2; }

.chart-box {
  width: 100%; background: rgba(4, 9, 18, 0.65); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px 6px 4px; overflow: hidden;
}
.chart-svg { width: 100%; height: auto; display: block; }

.hr-detail {
  margin-top: 8px; padding: 9px 11px; border-radius: 10px;
  background: var(--surface-2); border: none;
  font-size: 0.84rem; color: #d7e7f9; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px;
}
.hr-detail strong { color: var(--green); }
.hr-legend { margin-top: 7px; font-size: 0.78rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; align-items: center; }
.leg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* ====== Unified Borderless 3-Night Outlook Strip ====== */
.outlook-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  background: rgba(255,255,255,0.03); border-radius: 14px; padding: 11px 2px;
}
.outlook-day {
  padding: 2px 7px; text-align: center; border-right: 1px solid var(--border);
}
.outlook-day:last-child { border-right: none; }
.od-date { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.od-badge { font-size: 0.9rem; font-weight: 800; margin-bottom: 4px; display: inline-flex; align-items: center; gap: 4px; }
.od-stat { font-size: 0.77rem; color: var(--muted); line-height: 1.45; font-variant-numeric: tabular-nums; }
.od-best { border-radius: 10px; background: rgba(52,240,176,0.06); }

/* ====== Sky Radar, Live Map & Photo/Tools ====== */
.radar-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.radar-svg { width: 100%; max-width: 300px; height: auto; display: block; }
.radar-sector { transition: opacity 0.15s ease; }
.radar-leg { font-size: 0.79rem; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.sw-badge {
  font-size: 0.75rem; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 3px 8px; border-radius: 99px; flex-shrink: 0; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.sw-badge:empty { display: none; }
.sw-badge.sw-good { color: var(--green); background: var(--green-bg); border-color: rgba(52,240,176,0.45); }
.sw-badge.sw-warn { color: var(--amber); background: var(--amber-bg); border-color: rgba(255,207,92,0.42); }

.sat-img-wrap {
  position: relative; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); background: #030811;
}
.sat-img { width: 100%; display: block; height: auto; }
.sat-cap { padding: 8px 10px; font-size: 0.8rem; color: var(--muted); background: rgba(4,9,18,0.9); }

.dir {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  padding: 10px 12px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap;
}
.dir > div { min-width: 0; }
.dir .btn { flex-shrink: 0; white-space: nowrap; padding: 7px 11px; font-size: 0.8rem; }
.dir.best { border-color: rgba(52,240,176,0.45); background: rgba(52,240,176,0.07); }
.dir.hazard { border-color: rgba(255,107,123,0.45); background: rgba(255,107,123,0.08); }
.dir.sea { opacity: 0.76; border-style: dashed; }
.dir-note { display: inline-block; margin-top: 2px; font-size: 0.72rem; color: var(--amber); font-weight: 700; }
.c-green { color: var(--green); } .c-amber { color: var(--amber); } .c-red { color: var(--red); } .c-blue { color: var(--blue); }

/* ====== Bottom Navigation (Monochrome Inline SVGs) ====== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(4, 9, 18, 0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 7px max(6px, env(safe-area-inset-right, 0px)) calc(11px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
}
.bottom-inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nav-btn {
  background: transparent; border: none; color: var(--muted);
  padding: 7px 4px 5px; min-height: 48px; border-radius: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: inherit; font-weight: 700; font-size: 12px; line-height: 1.2; position: relative;
}
.nav-btn svg { width: 21px; height: 21px; display: block; }
.nav-btn.on { color: var(--green); }
.nav-btn.on::before {
  content: ''; position: absolute; top: 0; width: 24px; height: 2.5px;
  border-radius: 99px; background: var(--green);
}

.hero-cta {
  margin-top: 9px; padding: 8px 13px; min-height: 38px; border-radius: 10px;
  border: 1px solid rgba(52, 240, 176, 0.45); background: rgba(52, 240, 176, 0.15);
  color: var(--green); font-family: inherit; font-size: 0.82rem; font-weight: 800; cursor: pointer;
}
.fc-conf-btn {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-strong); color: #dbeeff;
  border-radius: 9px; padding: 5px 11px; min-height: 34px; font-family: inherit; font-size: 0.78rem; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.fc-conf-btn:hover { border-color: rgba(102, 189, 255, 0.45); background: var(--blue-bg); }
.fc-conf-btn.warn {
  background: var(--amber-bg); border-color: rgba(255, 207, 92, 0.42); color: var(--amber);
}
.road-links {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
}
.road-links .tpill { min-height: 36px; padding: 6px 11px; font-size: 0.8rem; }
.road-lbl { font-size: 0.76rem; color: var(--muted); font-weight: 700; }
.ts-raw-row {
  margin-top: 7px; font-size: 0.74rem; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums;
}
.ts-src-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.ts-pwa-tip { margin: 8px 0 0; font-size: 0.75rem; color: var(--muted); line-height: 1.5; }
.ts-legal-foot { margin: 6px 0 0; font-size: 0.74rem; color: var(--muted); line-height: 1.5; }

.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%) translateY(28px); opacity: 0;
  background: #0d322a; color: #eafff7; border: 1px solid rgba(52,240,176,0.55);
  padding: 9px 15px; border-radius: 12px; font-weight: 700; font-size: 0.85rem;
  pointer-events: none; transition: all 0.2s ease; z-index: 99; max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ====== True Scotopic Red-Light Night-Vision Mode ======
   Pure red-channel tokens + monochrome SVG inheritance eliminate blue-light
   leakage so dark-adapted eyes preserve scotopic sensitivity in the field. */
body.red-mode {
  --bg: #040000;
  --surface: #120202;
  --surface-2: rgba(255, 30, 30, 0.06);
  --border: rgba(255, 42, 42, 0.18);
  --border-strong: rgba(255, 52, 52, 0.34);
  --text: #f03232;
  --muted: #b52a2a;
  --green: #ff3b2f;
  --green-bg: rgba(255, 40, 30, 0.14);
  --amber: #d42822;
  --amber-bg: rgba(204, 36, 31, 0.14);
  --red: #a81c1c;
  --red-bg: rgba(153, 24, 24, 0.16);
  --blue: #c42828;
  --blue-bg: rgba(184, 34, 34, 0.14);
  --sheet-bg: #0c0101;
  --backdrop: rgba(4, 0, 0, 0.84);
  background-image: none;
}
body.red-mode .btn-blue,
body.red-mode .callout,
body.red-mode .fc-strip,
body.red-mode .hr-detail,
body.red-mode .storm-banner,
body.red-mode .sky-lead,
body.red-mode .hero-cta,
body.red-mode .fc-conf-btn,
body.red-mode .toast { color: #f03232; }
body.red-mode .toast { background: #1e0303; border-color: #cc241f; }
body.red-mode::before { background: linear-gradient(180deg, rgba(4, 0, 0, 0.98) 72%, rgba(4, 0, 0, 0)); }
body.red-mode .bottom-nav { background: rgba(8, 0, 0, 0.98); }
@media (display-mode: standalone) {
  body { padding-top: max(env(safe-area-inset-top, 0px), 20px); }
  body::before { height: max(env(safe-area-inset-top, 0px), 20px); }
}
body.red-mode .sky-svg,
body.red-mode .chart-svg,
body.red-mode .radar-svg,
body.red-mode .ring-svg,
body.red-mode .sat-img,
body.red-mode #windyFrame {
  filter: sepia(100%) saturate(720%) hue-rotate(-52deg) brightness(0.62) contrast(1.08);
}

/* ====== Score-Ring Trigger Affordances ====== */
.ring-btn {
  padding: 0; border: none; background: transparent; color: inherit; font: inherit;
  cursor: pointer; border-radius: 50%; display: block;
  transition: transform 0.16s ease;
}
.ring-btn:active { transform: scale(0.96); }
.ring-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.hr-legend-top { margin-top: 0; margin-bottom: 8px; }

/* ====== Trust & Score Bottom-Sheet Modal (100% CSS-Variable, Red-Mode Safe) ====== */
body.sheet-open { overflow: hidden; }
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: var(--backdrop); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.sheet-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; }

.sheet-panel {
  width: 100%; max-width: 640px; max-height: min(85dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 20px));
  background: var(--sheet-bg); border: 1px solid var(--border-strong); border-bottom: none;
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -12px 36px var(--backdrop);
}
.sheet-backdrop.open .sheet-panel { transform: translateY(0); }

.sheet-hdr {
  position: sticky; top: 0; z-index: 2; background: var(--sheet-bg);
  border-bottom: 1px solid var(--border); padding: 8px 16px 11px; flex-shrink: 0;
  touch-action: none;
}
.sheet-handle {
  width: 36px; height: 4px; border-radius: 99px;
  background: var(--border-strong); margin: 0 auto 9px;
}
.sheet-hdr-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.sheet-close {
  width: 42px; height: 42px; border-radius: 11px; padding: 0;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  font-size: 1rem; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.sheet-close:hover { color: var(--text); border-color: var(--border-strong); }

.sheet-body {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 13px 15px calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 12px;
}

.ts-sec {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 15px; padding: 11px 12px;
}
.ts-live { border-color: var(--border-strong); }
.ts-h3 { margin: 0 0 8px; font-size: 0.92rem; font-weight: 800; color: var(--text); }
.ts-sec-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap;
  font-size: 0.92rem; font-weight: 800; color: var(--text); margin-bottom: 8px;
}
.ts-badge {
  font-size: 0.76rem; font-weight: 800; padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted);
}
.ts-badge.ok { color: var(--green); background: var(--green-bg); border-color: var(--green); }
.ts-badge.warn { color: var(--amber); background: var(--amber-bg); border-color: var(--amber); }
.ts-badge.block { color: var(--red); background: var(--red-bg); border-color: var(--red); }
.ts-badge.info { color: var(--blue); background: var(--blue-bg); border-color: var(--blue); }

.ts-eq {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center; gap: 4px; text-align: center;
  background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 9px 6px;
}
.ts-eq-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ts-eq-lbl { font-size: 0.73rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.ts-eq-cell strong { font-size: 1.1rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.12; }
.ts-op { font-size: 0.82rem; font-weight: 800; color: var(--muted); }
.ts-diag { margin: 9px 0 0; font-size: 0.83rem; color: var(--text); line-height: 1.5; }
.ts-conf-row {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 0.79rem; color: var(--muted); line-height: 1.48; font-variant-numeric: tabular-nums;
}

.ts-tiers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 10px; }
.ts-tier {
  display: flex; align-items: center; gap: 6px; font-size: 0.81rem; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 6px 8px;
}
.ts-tier b { color: var(--text); font-variant-numeric: tabular-nums; }
.ts-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ts-dot.t-high { background: var(--green); box-shadow: 0 0 6px var(--green); }
.ts-dot.t-good { border: 2px solid var(--green); background: var(--green-bg); }
.ts-dot.t-mid  { background: var(--amber); }
.ts-dot.t-low  { background: var(--red); }

.ts-pillars { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.ts-pillars strong { color: var(--text); }

.ts-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 9px; }
.ts-stat {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 9px; display: flex; flex-direction: column; gap: 3px;
}
.ts-stat strong { font-size: 0.85rem; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.ts-stat span { font-size: 0.76rem; color: var(--muted); line-height: 1.35; }
.ts-note {
  margin: 0; padding: 9px 11px; border-left: 3px solid var(--amber);
  border-radius: 0 9px 9px 0; background: var(--amber-bg);
  font-size: 0.79rem; line-height: 1.5; color: var(--text);
}
.ts-note ul { margin: 5px 0 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; }

.ts-seal-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-seal {
  font-size: 0.78rem; font-weight: 700; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border); border-radius: 99px;
  padding: 5px 10px; text-decoration: none;
}
.ts-seal-link { color: var(--blue); border-color: var(--border-strong); }
.ts-seal-link:hover { color: var(--text); border-color: var(--blue); }

@media (prefers-reduced-motion: reduce) {
  .sheet-backdrop, .sheet-panel, .ring-btn { transition: none; }
}
