:root {
  color-scheme: light;
  --bg: #f6f9fc;
  --surface: #ffffff;
  --surface-soft: #edf5fb;
  --ink: #132238;
  --muted: #66758a;
  --line: #dbe5ee;
  --accent: #1769aa;
  --accent-strong: #0d4f84;
  --accent-soft: #e4f2ff;
  --ok: #16815d;
  --shadow: 0 14px 38px rgba(20, 52, 80, 0.10);
  --radius: 22px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 9999;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
}
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.mobile-only { display: none; }

.section-shell { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 800;
  border-bottom: 1px solid rgba(219, 229, 238, .9);
  background: rgba(246, 249, 252, .9);
  backdrop-filter: blur(14px);
}
.header-inner {
  width: min(calc(100% - 40px), var(--max));
  min-height: 66px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 15px; }
.header-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(22, 129, 93, .10); }

.hero { padding: 84px 0 50px; }
.eyebrow, .section-kicker { margin: 0 0 9px; color: var(--accent); font-size: .76rem; font-weight: 850; letter-spacing: .16em; }
h1 { margin: 0; max-width: 850px; font-size: clamp(3rem, 8vw, 6.5rem); line-height: .98; letter-spacing: -.065em; }
.lead { max-width: 690px; margin: 26px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); }
.demo-note { margin-top: 28px; max-width: 760px; display: flex; gap: 12px; padding: 16px 18px; border: 1px solid #cfe1f2; border-radius: 16px; background: var(--accent-soft); color: #31506c; font-size: .92rem; }
.demo-note strong { flex: 0 0 auto; color: var(--accent-strong); }

.section-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.75rem); line-height: 1.12; letter-spacing: -.04em; }
.text-button { min-height: 44px; padding: 8px 4px; border: 0; background: transparent; color: var(--accent); font-weight: 750; cursor: pointer; }

.recommendation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 82px; }
.recommendation-card {
  min-height: 238px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.recommendation-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.rec-icon { font-size: 2rem; }
.score { padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--accent-strong); font-size: .76rem; font-weight: 850; }
.recommendation-card h3 { margin: 24px 0 7px; font-size: 1.35rem; line-height: 1.25; }
.recommendation-card p { margin: 0; color: var(--muted); font-size: .93rem; }
.card-link { margin-top: 18px; display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--accent); font-weight: 780; }
.card-link::after { content: "↗"; }

.map-section { padding: 68px 0 84px; background: #eaf2f8; }
.map-heading-wrap { margin-bottom: 18px; }
.map-title-row { margin-bottom: 16px; }
.count-pill { flex: 0 0 auto; padding: 7px 11px; border-radius: 999px; background: #fff; color: var(--muted); font-size: .82rem; font-weight: 760; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
.filter-chip { min-height: 42px; flex: 0 0 auto; padding: 8px 14px; border: 1px solid #cbdce9; border-radius: 999px; background: #fff; color: #44546a; cursor: pointer; }
.filter-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 16px; }
.map-panel, .camera-panel { overflow: hidden; border: 1px solid #d2e0ea; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
#map { width: 100%; min-height: 650px; background: #dceaf4; }
.map-fallback { min-height: 650px; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 20px; }
.camera-panel { display: flex; flex-direction: column; min-height: 650px; max-height: 650px; }
.search-box { padding: 14px; border-bottom: 1px solid var(--line); }
.search-box input { width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: #f8fbfd; color: var(--ink); outline: none; }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23,105,170,.12); }
.camera-list { overflow-y: auto; padding: 8px; }
.camera-item { width: 100%; padding: 14px; border: 0; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; }
.camera-item:hover, .camera-item:focus-visible { background: var(--surface-soft); outline: none; }
.camera-item.is-active { background: var(--accent-soft); }
.camera-item-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.camera-item strong { display: block; line-height: 1.3; }
.camera-item small { display: block; margin-top: 5px; color: var(--muted); }
.type-tag { font-size: .72rem; padding: 4px 7px; border-radius: 999px; background: #eef2f6; color: #526171; }
.camera-popup { min-width: 220px; }
.camera-popup h3 { margin: 0 0 5px; font-size: 1rem; }
.camera-popup p { margin: 3px 0; color: #5a6979; }
.camera-popup a { display: inline-block; margin-top: 8px; font-weight: 800; color: var(--accent); }

.concept-section { padding: 88px 0 100px; display: grid; grid-template-columns: .9fr 1.1fr; gap: 70px; align-items: start; }
.concept-copy { color: var(--muted); font-size: 1.02rem; }
.concept-copy p:first-child { margin-top: 0; }
.site-footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .86rem; }
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .recommendation-grid { grid-template-columns: 1fr 1fr; }
  .recommendation-card:first-child { grid-column: 1 / -1; }
  .map-layout { grid-template-columns: 1fr; }
  #map { min-height: 470px; }
  .camera-panel { min-height: 430px; max-height: 520px; }
  .concept-section { grid-template-columns: 1fr; gap: 30px; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .section-shell, .header-inner { width: min(calc(100% - 28px), var(--max)); }
  .header-inner { min-height: 58px; }
  .header-meta { font-size: .76rem; }
  .hero { padding: 58px 0 36px; }
  h1 { font-size: clamp(2.85rem, 14vw, 4.2rem); }
  .mobile-only { display: initial; }
  .lead { margin-top: 20px; }
  .demo-note { flex-direction: column; gap: 3px; padding: 14px 15px; }
  .recommendation-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -14px; padding: 0 14px 12px; gap: 12px; }
  .recommendation-card { flex: 0 0 86%; min-height: 222px; scroll-snap-align: start; padding: 20px; }
  .recommendation-card:first-child { grid-column: auto; }
  .map-section { padding-top: 54px; }
  #map { min-height: 390px; border-radius: 0; }
  .map-panel { border-radius: 18px; }
  .camera-panel { min-height: 390px; max-height: 470px; border-radius: 18px; }
  .concept-section { padding: 66px 0 76px; }
  .footer-inner { min-height: 150px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; }
  .mobile-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 900;
    min-height: 58px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid rgba(210,224,234,.95);
    border-radius: 20px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 16px 46px rgba(20,52,80,.22);
    backdrop-filter: blur(16px);
  }
  .mobile-nav a, .mobile-nav button {
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border: 0;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: .7rem;
    cursor: pointer;
  }
  .mobile-nav a span:first-child, .mobile-nav button span:first-child { color: var(--accent); font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


.sources-section { padding: 84px 0 12px; }
.sources-lead { max-width: 760px; margin: -4px 0 20px; color: var(--muted); }
.provider-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.provider-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.provider-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.provider-card small { color: var(--muted); }
.provider-card h3 { margin: 2px 0 0; font-size: 1.04rem; line-height: 1.35; }
.provider-card p { margin: 14px 0; color: var(--muted); font-size: .9rem; }
.provider-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; color: var(--muted); font-size: .82rem; }
.provider-meta a { color: var(--accent); font-weight: 780; text-decoration: none; }
.health-badge { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.health-badge.is-ok { background: #e7f7f0; color: #116a4c; }
.health-badge.is-warn { background: #fff3da; color: #8a5c00; }
.health-badge.is-unknown { background: #eef2f6; color: #586879; }

@media (max-width: 640px) {
  .sources-section { padding-top: 60px; }
  .provider-grid { grid-template-columns: 1fr; }
  .provider-card { padding: 17px; }
  .provider-meta { align-items: flex-start; flex-direction: column; gap: 5px; }
}


/* Phase 3A: live public observations */
.live-section { padding: 16px 0 72px; }
.live-lead { max-width: 820px; margin: -4px 0 20px; color: var(--muted); }
.live-observation-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.live-observation-card { min-height: 220px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.live-observation-card.is-muted { background: #f8fafc; box-shadow: none; }
.live-observation-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 1.5rem; }
.live-state { padding: 5px 8px; border-radius: 999px; background: #eef2f6; color: var(--muted); font-size: .72rem; font-weight: 800; }
.live-state.is-live { background: #e7f7f0; color: #116a4c; }
.live-observation-card h3 { margin: 22px 0 3px; font-size: 1rem; line-height: 1.35; }
.live-value { margin: 0; font-size: 2.1rem; font-weight: 880; letter-spacing: -.04em; }
.live-value small { margin-left: 4px; color: var(--muted); font-size: .8rem; font-weight: 750; }
.live-label, .live-sub { color: var(--muted); font-size: .82rem; }
.live-sub { min-height: 38px; line-height: 1.45; }
.live-observation-card a { color: var(--accent); font-size: .82rem; font-weight: 780; text-decoration: none; }
.signal-note { margin-top: 12px !important; padding: 9px 10px; border-radius: 10px; background: #f2f7fb; font-size: .76rem !important; line-height: 1.45; }
.signal-note strong { display: block; color: var(--accent-strong); }
.type-tag.has-live-signal { background: #e7f7f0; color: #116a4c; }
@media (max-width: 900px) { .live-observation-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .live-section { padding: 8px 0 54px; }
  .live-observation-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -14px; padding: 0 14px 12px; gap: 12px; }
  .live-observation-card { flex: 0 0 82%; min-height: 205px; scroll-snap-align: start; padding: 18px; }
}


/* Phase 3B: official warning/advisory update cards */
.alert-section { padding-top: 12px; }
.alert-lead { margin: 0 0 18px; color: #5e6b78; line-height: 1.75; }
.alert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.alert-card { min-height: 190px; padding: 18px; border: 1px solid #dce5ee; border-radius: 18px; background: #fff; box-shadow: 0 8px 28px rgba(31, 50, 72, .06); display: flex; flex-direction: column; }
.alert-card.is-special, .alert-card.is-urgent { border-width: 2px; }
.alert-card.is-clear { background: #f9fcff; }
.alert-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 1.2rem; }
.alert-level { font-size: .78rem; font-weight: 700; color: #5b6876; background: #f1f5f8; border-radius: 999px; padding: 5px 9px; }
.alert-card h3 { margin: 0 0 7px; font-size: 1.18rem; }
.alert-card p { margin: 0 0 10px; color: #5f6d7a; line-height: 1.65; }
.alert-card .alert-names { color: #27394a; font-weight: 800; }
.alert-card a { margin-top: auto; font-weight: 700; }
@media (max-width: 900px) {
  .alert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .alert-grid { grid-template-columns: 1fr; }
  .alert-card { min-height: 0; }
}

/* Phase 4: server-generated NOW SCORE */
.score-reasons { margin: 10px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }


/* Phase 5E1: full-screen "ながら見" recommendation rotator.
   The site header remains above the viewer (header z=800, viewer z=750).
   Mobile navigation remains above the viewer (mobile-nav z=900). */
.header-watch-button,
.ambient-launch-button {
  min-height: 40px;
  border: 1px solid #bfd5e7;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}
.header-watch-button { padding: 7px 13px; }
.ambient-launch-button { padding: 8px 14px; display: inline-flex; align-items: center; gap: 7px; }
.now-heading-actions { display: flex; align-items: center; gap: 10px; }

body.ambient-open { overflow: hidden; }
.ambient-viewer {
  position: fixed;
  z-index: 750;
  top: 66px;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto 4px;
  background: #071522;
  color: #fff;
}
.ambient-viewer[hidden] { display: none; }
.ambient-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 72px);
  background: linear-gradient(135deg, #0f3450, #071522 68%);
}
.ambient-backdrop {
  position: absolute;
  inset: -10%;
  z-index: -2;
  opacity: .78;
  background:
    radial-gradient(circle at 17% 25%, rgba(43, 151, 216, .55), transparent 34%),
    radial-gradient(circle at 82% 68%, rgba(30, 91, 135, .48), transparent 38%);
}
.ambient-stage[data-category="river"] .ambient-backdrop,
.ambient-stage[data-category="sea"] .ambient-backdrop { background: radial-gradient(circle at 25% 30%, rgba(35,160,214,.65), transparent 35%), linear-gradient(145deg,#0b3956,#071522 70%); }
.ambient-stage[data-category="road"] .ambient-backdrop { background: radial-gradient(circle at 74% 30%, rgba(219,137,52,.52), transparent 34%), linear-gradient(145deg,#3b2a17,#071522 72%); }
.ambient-stage[data-category="mountain"] .ambient-backdrop,
.ambient-stage[data-category="volcano"] .ambient-backdrop { background: radial-gradient(circle at 22% 28%, rgba(118,158,116,.54), transparent 34%), linear-gradient(145deg,#17382e,#071522 72%); }

.ambient-content {
  width: min(1040px, 100%);
  min-height: min(680px, calc(100vh - 190px));
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}
.ambient-badges { display: flex; gap: 8px; margin-bottom: 18px; }
.ambient-badge { padding: 6px 11px; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: rgba(255,255,255,.11); font-size: .8rem; font-weight: 850; backdrop-filter: blur(12px); }
.ambient-badge.is-score { background: rgba(255,255,255,.93); color: #12304a; }
.ambient-icon { font-size: clamp(3.2rem, 9vw, 7rem); line-height: 1; filter: drop-shadow(0 12px 32px rgba(0,0,0,.2)); }
.ambient-eyebrow { margin: 24px 0 4px; color: #9ccded; font-size: .8rem; font-weight: 850; letter-spacing: .14em; }
.ambient-title { max-width: 920px; margin: 0; color: #fff; font-size: clamp(2.2rem, 6vw, 5rem); line-height: 1.03; letter-spacing: -.045em; text-wrap: balance; }
.ambient-location { margin: 16px 0 0; color: #c7dceb; font-size: clamp(.95rem, 2vw, 1.18rem); }
.ambient-signal { max-width: 850px; margin: 18px 0 0; color: #fff; font-size: clamp(1rem, 2.2vw, 1.35rem); font-weight: 760; }
.ambient-reasons { max-width: 900px; margin-top: 15px; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.ambient-reasons span { padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.09); color: #d7e7f2; font-size: .82rem; }
.ambient-media { width: min(760px, 100%); margin-top: 22px; }
.ambient-external-only { min-height: 98px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(6,17,28,.38); color: #d9e9f3; }
.ambient-external-only > span { font-size: 1.45rem; }
.ambient-external-only small { color: #9fb9cb; }
.ambient-site-media { display: block; width: 100%; max-height: min(42vh, 460px); object-fit: contain; border-radius: 18px; background: #000; }
.ambient-actions { margin-top: 18px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
.ambient-official-link { min-height: 46px; display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 999px; background: #fff; color: #0d4f84; font-weight: 850; text-decoration: none; }
.ambient-rights-note { color: #9fb9cb; font-size: .8rem; }

.ambient-controls {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 18px;
  border-top: 1px solid rgba(255,255,255,.11);
  background: rgba(5,15,24,.94);
}
.ambient-controls button,
.ambient-speed select {
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 13px;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
}
.ambient-controls button { min-width: 48px; padding: 7px 13px; font-size: 1.1rem; }
.ambient-controls .ambient-close { min-width: auto; font-size: .85rem; font-weight: 800; }
.ambient-speed { display: flex; align-items: center; gap: 7px; color: #a9c0d0; font-size: .8rem; }
.ambient-speed select { padding: 6px 10px; }
.ambient-position { min-width: 58px; color: #a9c0d0; text-align: center; font-size: .82rem; }
.ambient-progress { height: 4px; background: rgba(255,255,255,.12); }
.ambient-progress span { display: block; width: 0; height: 100%; background: #7dc7f2; transition: width .25s linear; }

@media (max-width: 640px) {
  .header-watch-button { display: none; }
  .now-heading-actions { flex-direction: column; align-items: flex-end; gap: 6px; }
  .ambient-viewer { top: 58px; bottom: calc(78px + env(safe-area-inset-bottom)); }
  .ambient-stage { padding: 22px 16px 14px; }
  .ambient-content { min-height: 0; align-content: center; }
  .ambient-title { font-size: clamp(2rem, 10vw, 3.3rem); }
  .ambient-media { margin-top: 16px; }
  .ambient-external-only { min-height: 78px; }
  .ambient-controls { min-height: 62px; padding: 7px 8px; gap: 6px; overflow-x: auto; justify-content: flex-start; }
  .ambient-controls button { min-width: 44px; }
  .ambient-speed span { display: none; }
  .ambient-position { margin-left: auto; }
  .ambient-rights-note { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-progress span { transition: none; }
}


/* Phase 5E1R1 — smooth ながら見 transition.
   Only the stage content/backdrop moves; menus and controls stay fixed. */
.ambient-content,
.ambient-backdrop {
  transition:
    opacity .45s ease,
    transform .45s cubic-bezier(.22,.61,.36,1),
    filter .45s ease;
  will-change: opacity, transform;
}
.ambient-stage.is-switching-out .ambient-content {
  opacity: 0;
  transform: translateY(8px) scale(.992);
  filter: blur(2px);
}
.ambient-stage.is-switching-out .ambient-backdrop {
  opacity: .34;
  transform: scale(1.025);
}
.ambient-stage.is-switching-in .ambient-content {
  opacity: 0;
  transform: translateY(-6px) scale(.994);
  filter: blur(1px);
}
.ambient-stage.is-switching-in .ambient-backdrop {
  opacity: .34;
  transform: scale(1.02);
}
@media (prefers-reduced-motion: reduce) {
  .ambient-content,
  .ambient-backdrop {
    transition: none !important;
    transform: none !important;
    filter: none !important;
  }
}


/* Phase 6B — runtime stale-safety UI. */
.ops-status-banner {
  width: min(calc(100% - 40px), var(--max));
  margin: 12px auto 0;
  padding: 12px 16px;
  border: 1px solid #e2c46c;
  border-radius: 14px;
  background: #fff7d9;
  color: #6e5510;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
}
.ops-status-banner[data-tone="stale"] {
  border-color: #e3a8a8;
  background: #fff0f0;
  color: #7d2e2e;
}
.ops-status-banner[hidden] { display: none; }

.status-dot.is-warn {
  background: #c48a14;
  box-shadow: 0 0 0 4px rgba(196,138,20,.12);
}
.status-dot.is-stale {
  background: #b34848;
  box-shadow: 0 0 0 4px rgba(179,72,72,.12);
}
.count-pill.is-stale,
.score.is-stale {
  background: #fff0f0;
  color: #8f3636;
}
.recommendation-card.is-stale-state {
  grid-column: 1 / -1;
  min-height: 190px;
  border-style: dashed;
  box-shadow: none;
}


/* ================================================================
   Phase 6E / IMJ19 — one-screen dashboard
   Visible UI = category / map / current recommendations only.
   Weather, alerts, provider health and operational details stay as
   hidden runtime inputs except for a compact stale-warning banner.
   ================================================================ */

html,
body.dashboard-page {
  height: 100%;
}

body.dashboard-page {
  margin: 0;
  overflow: hidden;
  background: #f4f8fb;
}

.dashboard-page .site-header {
  height: 58px;
  min-height: 58px;
  position: relative;
  z-index: 3000;
}

.dashboard-page .header-inner {
  height: 58px;
  max-width: 1600px;
  padding: 0 14px;
}

.dashboard-page .brand {
  font-size: 1.08rem;
  gap: 8px;
}

.dashboard-page .brand-mark {
  font-size: .9rem;
}

.dashboard-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-list-button,
.dashboard-primary-button,
.dashboard-secondary-button,
.dashboard-rec-list-open {
  border: 1px solid #d8e2e9;
  background: #fff;
  color: #183142;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
}

.header-list-button,
.dashboard-page .header-watch-button {
  min-height: 36px;
  padding: 0 13px;
}

.runtime-status-hooks,
.runtime-support {
  display: none !important;
}

.compact-ops-banner:not([hidden]) {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  z-index: 3500;
  padding: 7px 12px;
  border-radius: 0 0 10px 10px;
  font-size: .78rem;
  box-shadow: 0 4px 16px rgba(20,45,60,.12);
}

.dashboard-main {
  height: calc(100dvh - 58px);
  min-height: 0;
  padding: 0;
}

.dashboard-shell {
  width: min(1600px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 10px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 315px;
  gap: 10px;
  min-height: 0;
}

.dashboard-sidebar,
.dashboard-map,
.dashboard-recommendations {
  min-width: 0;
  min-height: 0;
  border: 1px solid #e1e8ed;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(26,59,75,.06);
  overflow: hidden;
}

.dashboard-sidebar {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-sidebar-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 3px 8px;
  border-bottom: 1px solid #edf2f5;
}

.dashboard-sidebar-title strong {
  font-size: .98rem;
}

.dashboard-count {
  color: #667b89;
  font-size: .72rem;
  white-space: nowrap;
}

.dashboard-filter-list {
  display: grid;
  gap: 5px;
  align-content: start;
}

.dashboard-filter-list .filter-chip {
  width: 100%;
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-radius: 9px;
  padding: 7px 9px;
  font-size: .82rem;
  margin: 0;
}

.dashboard-sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 7px;
}

.dashboard-primary-button,
.dashboard-secondary-button {
  min-height: 40px;
  font-size: .82rem;
}

.dashboard-primary-button {
  background: #0f5d83;
  border-color: #0f5d83;
  color: #fff;
}

.dashboard-map {
  position: relative;
}

.dashboard-map #map {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.dashboard-map .leaflet-control-container {
  font-size: .82rem;
}

.dashboard-map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  background: #eef5f8;
}

.dashboard-recommendations {
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.dashboard-recommendation-head {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.dashboard-recommendation-head h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1;
}

.dashboard-refresh {
  color: #6a7d89;
  font-size: .68rem;
  white-space: nowrap;
}

.dashboard-recommendation-grid {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-recommendation-grid .dashboard-rec-card {
  min-height: 0;
  padding: 11px;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
  overflow: hidden;
}

.dashboard-rec-main {
  min-height: 0;
}

.dashboard-rec-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.dashboard-rec-icon {
  font-size: 1rem;
}

.dashboard-rec-card .score {
  font-size: .68rem;
  padding: 3px 7px;
}

.dashboard-rec-card h3 {
  margin: 0;
  font-size: .88rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dashboard-rec-card p {
  margin: 4px 0 0;
  color: #6a7b86;
  font-size: .7rem;
  line-height: 1.25;
}

.dashboard-rec-link,
.dashboard-rec-list-open {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 0 10px;
  border-radius: 8px;
  font-size: .72rem;
  text-decoration: none;
}

.camera-drawer {
  position: fixed;
  top: 58px;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  z-index: 4200;
  background: #fff;
  box-shadow: -10px 0 35px rgba(19,46,61,.18);
  padding: 12px;
  overflow: hidden;
}

.camera-drawer[hidden],
.camera-drawer-backdrop[hidden] {
  display: none !important;
}

.camera-drawer-head {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.camera-drawer-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #eef3f6;
  font-size: 1.2rem;
  cursor: pointer;
}

.camera-drawer-search {
  display: block;
  margin: 4px 0 9px;
}

.camera-drawer-list {
  height: calc(100% - 96px);
  overflow: auto;
}

.camera-drawer-backdrop {
  position: fixed;
  inset: 58px 0 0;
  z-index: 4100;
  border: 0;
  background: rgba(18,36,48,.24);
  cursor: default;
}

.dashboard-page.camera-drawer-open {
  overflow: hidden;
}

/* Remove old long-page presentation from the visible surface. */
.dashboard-page .hero,
.dashboard-page .alert-section,
.dashboard-page .live-section,
.dashboard-page .sources-section,
.dashboard-page .concept-section,
.dashboard-page .site-footer,
.dashboard-page .section-heading-row,
.dashboard-page .demo-note,
.dashboard-page .lead,
.dashboard-page .eyebrow {
  display: none !important;
}

@media (min-width: 901px) {
  .dashboard-page .mobile-nav {
    display: none !important;
  }
}

@media (max-width: 1100px) and (min-width: 901px) {
  .dashboard-shell {
    grid-template-columns: 170px minmax(0,1fr) 270px;
  }

  .dashboard-sidebar {
    padding: 10px 8px;
  }

  .dashboard-filter-list .filter-chip {
    min-height: 36px;
    font-size: .75rem;
  }
}

@media (max-width: 900px) {
  body.dashboard-page {
    overflow: hidden;
  }

  .dashboard-page .site-header,
  .dashboard-page .header-inner {
    height: 54px;
    min-height: 54px;
  }

  .dashboard-header-actions .header-list-button {
    display: none;
  }

  .dashboard-page .header-watch-button {
    min-height: 32px;
    padding: 0 10px;
    font-size: .74rem;
  }

  .compact-ops-banner:not([hidden]) {
    top: 54px;
  }

  .dashboard-main {
    height: calc(100dvh - 54px - 60px);
  }

  .dashboard-shell {
    padding: 6px;
    gap: 6px;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) 30vh;
  }

  .dashboard-sidebar {
    padding: 6px;
    border-radius: 10px;
    display: block;
    overflow: hidden;
  }

  .dashboard-sidebar-title,
  .dashboard-sidebar-actions {
    display: none;
  }

  .dashboard-filter-list {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .dashboard-filter-list::-webkit-scrollbar {
    display: none;
  }

  .dashboard-filter-list .filter-chip {
    flex: 0 0 auto;
    width: auto;
    min-height: 32px;
    padding: 5px 9px;
    font-size: .7rem;
  }

  .dashboard-map,
  .dashboard-recommendations {
    border-radius: 10px;
  }

  .dashboard-recommendations {
    padding: 7px;
  }

  .dashboard-recommendation-head {
    height: 29px;
  }

  .dashboard-recommendation-head h1 {
    font-size: .86rem;
  }

  .dashboard-refresh {
    font-size: .62rem;
  }

  .dashboard-recommendation-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 76%;
    grid-template-columns: none;
    grid-template-rows: 1fr;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .dashboard-recommendation-grid::-webkit-scrollbar {
    display: none;
  }

  .dashboard-rec-card {
    scroll-snap-align: start;
  }

  .dashboard-rec-card h3 {
    font-size: .8rem;
    -webkit-line-clamp: 1;
  }

  .dashboard-rec-card p {
    font-size: .64rem;
  }

  .dashboard-rec-link {
    min-height: 27px;
  }

  .camera-drawer {
    top: 54px;
    bottom: 60px;
    width: 100%;
  }

  .camera-drawer-backdrop {
    inset: 54px 0 60px;
  }

  .dashboard-mobile-nav {
    height: 60px;
    z-index: 5000;
  }

  .ambient-viewer {
    bottom: 60px !important;
  }
}

@media (max-height: 720px) and (min-width: 901px) {
  .dashboard-shell {
    padding: 6px;
    gap: 6px;
  }

  .dashboard-sidebar {
    padding: 8px;
  }

  .dashboard-filter-list .filter-chip {
    min-height: 32px;
    padding: 4px 8px;
  }

  .dashboard-rec-card {
    padding: 8px;
  }
}


/* ================================================================
   Phase 6F / IMJ20 — zoom-aware camera clustering
   Nationwide view uses compact count circles instead of thousands
   of overlapping map pins. Individual cameras appear as small dots.
   ================================================================ */

.map-cluster-icon-wrap {
  background: transparent;
  border: 0;
}

.map-cluster-icon {
  width: 100%;
  height: 100%;
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border: 3px solid rgba(255,255,255,.94);
  background: rgba(20,105,154,.92);
  color: #fff;
  font-weight: 700;
  font-size: .72rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(20,52,70,.24);
}

.map-cluster-digits-3,
.map-cluster-digits-4,
.map-cluster-digits-5 {
  font-size: .66rem;
}

.map-camera-dot {
  stroke: #fff;
  fill: #1678b5;
  filter: drop-shadow(0 1px 2px rgba(18,56,76,.25));
}

.dashboard-map .leaflet-marker-icon.map-cluster-icon-wrap {
  background: transparent;
}

@media (max-width: 900px) {
  .map-cluster-icon {
    min-width: 32px;
    min-height: 32px;
    border-width: 2px;
    font-size: .66rem;
  }
}


/* ================================================================
   Phase 6G / IMJ21 — final dashboard density polish
   ================================================================ */

@media (min-width: 901px) {
  .dashboard-shell {
    grid-template-columns: 190px minmax(0, 1fr) 290px;
  }

  .dashboard-sidebar-actions {
    display: none !important;
  }

  .dashboard-recommendation-grid {
    grid-template-rows: repeat(3, minmax(132px, auto));
    align-content: start;
  }

  .dashboard-recommendation-grid .dashboard-rec-card {
    min-height: 132px;
    max-height: 165px;
  }

  .dashboard-rec-card .card-link::after {
    margin-left: 6px;
  }
}

@media (max-width: 1100px) and (min-width: 901px) {
  .dashboard-shell {
    grid-template-columns: 165px minmax(0, 1fr) 265px;
  }

  .dashboard-recommendation-grid .dashboard-rec-card {
    min-height: 122px;
    max-height: 150px;
  }
}
