/* War Monitor: Apple-Maps-like glass panels over a full-screen globe. */
:root {
  --glass: rgba(28, 30, 36, 0.72);
  --glass-border: rgba(255, 255, 255, 0.10);
  --text: #f2f3f5;
  --muted: #9aa0ab;
  --accent: #0a84ff;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --green: #30d158;
  --teal: #64d2ff;
  --purple: #bf5af2;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
body.light {
  --glass: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(0, 0, 0, 0.08);
  --text: #1c1c1e;
  --muted: #6b6f78;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0d12; color: var(--text); font: 14px/1.4 var(--font); }
#map { position: fixed; inset: 0; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.glass {
  position: fixed; z-index: 5;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* Top bar */
.topbar { top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; display: flex; align-items: center; gap: 14px; padding: 8px 10px 8px 14px; }
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 15px; }
.brand .mono { font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block; }
.dot.live { animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.chips button { border: 1px solid var(--glass-border); background: rgba(127, 127, 127, 0.12); border-radius: 999px; padding: 5px 11px; white-space: nowrap; font-size: 13px; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: white; }
.chips button .n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Left panel */
.panel { top: 74px; left: 12px; bottom: 56px; width: 360px; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; }
.tabs button { flex: 1; border: 0; background: none; padding: 7px 4px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; }
.tabs button.on { background: rgba(127, 127, 127, 0.18); color: var(--text); }
.icon { border: 0; background: none; width: 30px; flex: 0 0 30px; font-size: 18px; color: var(--muted); }
.floating { top: 74px; left: 12px; width: 38px; height: 38px; }
.range { display: flex; margin: 8px 10px; background: rgba(127, 127, 127, 0.14); border-radius: 9px; padding: 2px; }
.range button { flex: 1; border: 0; background: none; padding: 4px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
.range button.on { background: rgba(255, 255, 255, 0.16); color: var(--text); }
body.light .range button.on { background: white; }
.list { overflow-y: auto; padding: 0 8px 10px; flex: 1; }
.item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.item:hover { background: rgba(127, 127, 127, 0.12); }
.item .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; }
.item .t { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.item .m { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.pill { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.pill.confirmed { background: rgba(48, 209, 88, .18); color: var(--green); }
.pill.likely { background: rgba(255, 159, 10, .18); color: var(--orange); }
.pill.unconfirmed { background: rgba(154, 160, 171, .18); color: var(--muted); }
.war { padding: 12px 10px; border-radius: 12px; border: 1px solid var(--glass-border); margin: 6px 2px; cursor: pointer; background: none; width: calc(100% - 4px); text-align: left; }
.war:hover { background: rgba(127, 127, 127, 0.10); }
.war h4 { margin: 0 0 4px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.war p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.empty { color: var(--muted); padding: 18px 10px; font-size: 13px; }
.news a { color: var(--text); text-decoration: none; }
.news .item { grid-template-columns: 1fr; }

/* Layers */
.layers { top: 74px; right: 12px; width: 230px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.layers-head { display: flex; justify-content: space-between; align-items: center; }
.layers label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.layers label.sub { padding-left: 24px; color: var(--muted); font-size: 12px; }
.layers i { margin-left: auto; font-style: normal; font-size: 11px; color: var(--muted); }
.layers i.ok::before { content: "● "; color: var(--green); }
.layers i.off::before { content: "● "; color: var(--muted); }
.layers i.err::before { content: "● "; color: var(--orange); }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.sw.ev { background: var(--red); border-radius: 50%; } .sw.air { background: var(--yellow); } .sw.ship { background: var(--teal); }
.sw.base { background: var(--purple); } .sw.fire { background: var(--orange); border-radius: 50%; } .sw.war { background: rgba(255, 69, 58, .45); }

/* Detail card */
.card { right: 12px; bottom: 56px; width: 340px; max-height: 55vh; overflow-y: auto; padding: 14px 16px; }
.card h3 { margin: 0 0 2px; font-size: 17px; overflow-wrap: anywhere; }
.card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.card .close { position: absolute; top: 8px; right: 8px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; font-size: 13px; }
.card dt { color: var(--muted); } .card dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card a { color: var(--accent); }
.card .src { font-size: 12.5px; padding: 6px 0; border-top: 1px solid var(--glass-border); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: rgba(255, 214, 10, .18); color: var(--yellow); margin-right: 4px; }
.badge.red { background: rgba(255, 69, 58, .18); color: var(--red); }

/* Legend */
.legend { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 7px 12px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; align-items: center; }
.legend .muted { margin-left: auto; }
.legend .c { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.c.confirmed { background: var(--green); } .c.likely { background: var(--orange); } .c.unconfirmed { background: var(--muted); }

.maplibregl-ctrl-group { background: var(--glass) !important; backdrop-filter: blur(20px); }
.maplibregl-ctrl-bottom-right { bottom: 48px; }

/* Phone: the map gets the whole screen. Feed and layers open as sheets from two buttons; details slide up from the bottom. */
.mbtn { display: none; }
@media (max-width: 760px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 6px; left: 8px; right: 8px; top: calc(8px + env(safe-area-inset-top, 0px)); padding: 6px 8px; }
  .brand { font-size: 14px; }
  .chips button { font-size: 12px; padding: 4px 9px; }
  .mbtn { display: block; position: absolute; z-index: 5; top: calc(96px + env(safe-area-inset-top, 0px)); padding: 7px 12px; font-size: 13px; border-radius: 999px; }
  #m-feed { left: 8px; } #m-layers { right: 8px; }
  .panel { display: none; top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 62vh; border-radius: 16px 16px 0 0; z-index: 7;
           padding-bottom: env(safe-area-inset-bottom, 0px); }
  body.m-feed .panel { display: flex; }
  .layers { display: none; top: calc(136px + env(safe-area-inset-top, 0px)); right: 8px; width: 200px; max-height: 60vh; overflow-y: auto; font-size: 12.5px; z-index: 7; }
  body.m-layers .layers { display: flex; }
  .card, .card.wide { left: 0; right: 0; bottom: 0; width: auto; max-height: 60vh; border-radius: 16px 16px 0 0; z-index: 8;
                       padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .legend { left: 8px; right: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding: 5px 8px; gap: 8px; font-size: 11px; }
  .legend > span:not(.muted) { display: none; }
  .legend .muted { display: none; }
  #expand, #collapse { display: none !important; }
  .maplibregl-ctrl-bottom-right { display: none; }
  .wm-pop { display: none; }   /* no hover cards on touch screens */
}
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }

/* Cameras & live TV */
.sw.cam { background: #30d158; }
.card.wide { width: 460px; }
.video { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; display: block; margin: 8px 0; }
.snapshot { width: 100%; border-radius: 10px; display: block; margin: 8px 0; background: #000; }
.tv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px 2px; }
.tv button { border: 1px solid var(--glass-border); background: rgba(127,127,127,.12); border-radius: 10px; padding: 12px 8px; font-weight: 600; font-size: 13px; text-align: left; }
.tv button:hover { background: rgba(127,127,127,.22); }
.tv p { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin: 6px 4px 0; }
@media (max-width: 760px) { .card.wide { width: auto; } }
.cam-btn { width: 100%; text-align: left; border: 1px solid rgba(48,209,88,.4); background: rgba(48,209,88,.10); color: var(--text); border-radius: 10px; padding: 8px 10px; margin: 6px 0 10px; font-size: 13px; }
.cam-btn:hover { background: rgba(48,209,88,.2); }
.card { width: 380px; }
.sw.power { background: #ffd60a; border-radius: 50%; } .sw.nuke { background: #ffd60a; }
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat div { background: rgba(127,127,127,.12); border-radius: 10px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.legend .muted:first-child { margin-left: 0; }
.sw.cyber { background: #00c7be; border-radius: 3px; } .sw.sat { background: #64d2ff; border-radius: 50%; box-shadow: 0 0 0 2px rgba(100,210,255,.3); }
.tabs button { font-size: 12px; padding: 7px 2px; }
.sw.sub { background: #30d158; border-radius: 3px; }
.guide-btn { border: 1px solid var(--accent); background: rgba(10,132,255,.18); color: var(--text); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; }
.guide-btn:hover { background: rgba(10,132,255,.32); }
.item .ic { border-radius: 8px; }
.sw.apt { background: #d1d5db; border-radius: 3px; }
.wm-pop .maplibregl-popup-content { background: rgba(22,24,30,.94); color: var(--text); border: 1px solid var(--glass-border); border-radius: 14px;
  padding: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); backdrop-filter: blur(16px); pointer-events: none; }
.wm-pop .maplibregl-popup-tip { display: none; }
.sw.wx { background: linear-gradient(135deg, #e8edf2, #6a8caf); border-radius: 3px; }
.wxbar { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 6px 24px; font-size: 11.5px; }
.wxrow { display: flex; gap: 6px; }
.wxbar button, .wxbar select { font: inherit; font-size: 11.5px; border: 1px solid var(--glass-border); background: rgba(127,127,127,.15); color: var(--text); border-radius: 7px; padding: 3px 7px; }
.wxbar input[type=range] { width: 100%; accent-color: var(--accent); }
.wxbar button { white-space: nowrap; flex: 0 0 auto; }
.wxbar select { flex: 1; min-width: 0; }
.radiobar { left: 50%; transform: translateX(-50%); bottom: calc(60px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; font-size: 13px; max-width: 80vw; z-index: 7; }
.radiobar span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-pick .maplibregl-popup-content { pointer-events: auto; }
.wm-pick .maplibregl-popup-close-button { color: #9aa0ab; font-size: 18px; right: 4px; top: 2px; }

/* Sign-up for news by email: a wide, short bar near the bottom of the screen */
.sub-btn { margin-left: 10px; border: 1px solid rgba(10,132,255,.6); background: rgba(10,132,255,.16); color: #64b5ff; border-radius: 999px; padding: 3px 11px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.sub-modal { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; justify-content: center; padding: 0 12px; pointer-events: none; }
.sub-modal[hidden] { display: none; }
.sub-box { position: relative; pointer-events: auto; width: min(920px, 100%); display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 6px 22px; align-items: center; padding: 14px 44px 12px 18px; }
.sub-box .close { position: absolute; top: 8px; right: 8px; }
.sub-text h3 { margin: 0 0 3px; font-size: 16px; }
.sub-text p { margin: 0; font-size: 12.5px; }
.sub-line { display: flex; gap: 8px; }
.sub-line input { flex: 1; min-width: 0; background: rgba(127,127,127,.12); border: 1px solid var(--glass-border); border-radius: 9px; padding: 10px 12px; color: inherit; font: inherit; font-size: 15px; }
.sub-send { flex: none; border: 0; border-radius: 9px; padding: 10px 20px; background: var(--accent); color: white; font-weight: 600; font-size: 14px; cursor: pointer; }
.chk { display: inline-flex; gap: 7px; align-items: flex-start; cursor: pointer; }
.consent { margin-top: 7px; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.consent input { margin-top: 2px; }
.sub-msg { min-height: 0; font-size: 12.5px; margin-top: 4px; }
.sub-msg:empty { display: none; }
.sub-msg.err { color: #ff6b5e; } .sub-msg.ok { color: #30d158; }
@media (max-width: 760px) {
  .sub-modal { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding: 0 8px; }
  .sub-box { grid-template-columns: 1fr; gap: 8px; padding: 12px 40px 12px 14px; }
  .sub-text p { display: none; }
  .sub-text h3 { font-size: 14.5px; }
  .sub-send { padding: 10px 14px; }
  .sub-btn { margin-left: auto; }
}
.sub-box > * { min-width: 0; }
.sub-box { box-sizing: border-box; }
html, body { touch-action: pan-x pan-y; }   /* no accidental pinch-zoom of the whole page on phones (it makes everything blurry); the map has its own pinch */
@media (max-width: 760px) { .card.compact { max-height: 40vh; } }
