:root {
  --bg: #0b0f14; --panel: rgba(13, 18, 26, 0.88); --panel-border: #1f2a38; --text: #d7dee8; --dim: #7f8ea3; --accent: #4da3ff;
  --sev0: #6f7c8f; --sev1: #ffd23f; --sev2: #ff8c42; --sev3: #ff4f4f;
  --mil: #ff4f4f; --police: #3d8bff; --hems: #ffd93d; --cg: #ff9f1c; --fire: #c04bff; --civil: #8a94a6;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
:root[data-theme="light"] {
  --bg: #eef2f7; --panel: rgba(255,255,255,0.9); --panel-border: #d3dbe6; --text: #1d2733; --dim: #5d6b7c; --accent: #1f6fd6;
  --sev0: #8a97a8; --civil: #6b7686;
}
:root[data-theme="light"] #topbar { background: linear-gradient(to bottom, rgba(255,255,255,0.97), rgba(255,255,255,0.85)); }
:root[data-theme="light"] .counts span b, :root[data-theme="light"] .kv .v, :root[data-theme="light"] .doc h2, :root[data-theme="light"] .hover-card .hc-title, :root[data-theme="light"] .sign-card .cap b { color: #0e1620; }
:root[data-theme="light"] select, :root[data-theme="light"] button { background: #ffffff; border-color: #c5cfdc; color: var(--text); }
:root[data-theme="light"] .panel-head { background: rgba(0,0,0,0.03); color: #41505f; }
:root[data-theme="light"] .layer:hover, :root[data-theme="light"] .alert:hover, :root[data-theme="light"] .sign-card:hover { background: rgba(0,0,0,0.04); }
:root[data-theme="light"] .alert, :root[data-theme="light"] .agroup .ahead { border-bottom-color: rgba(0,0,0,0.06); }
:root[data-theme="light"] .agroup .ahead { background: rgba(0,0,0,0.03); } :root[data-theme="light"] .agroup .ahead .kind { color: #1d2733; }
:root[data-theme="light"] .maplibregl-popup-content, :root[data-theme="light"] .selected, :root[data-theme="light"] .footer, :root[data-theme="light"] .loading { background: var(--panel); color: var(--text); }
:root[data-theme="light"] .maplibregl-popup-tip { border-top-color: #d3dbe6 !important; }
:root[data-theme="light"] .maplibregl-ctrl-group { background: #fff; } :root[data-theme="light"] .maplibregl-ctrl-group button { filter: none; }
:root[data-theme="light"] .maplibregl-ctrl-attrib { background: rgba(255,255,255,0.7) !important; }
:root[data-theme="light"] .scale { background: #dfe6ef; color: #1d2733; }
:root[data-theme="light"] .mixbar { background: #dfe6ef; }
:root[data-theme="light"] .about { color: #41505f; }
:root[data-theme="light"] .sel-actions button.on { background: #e3f6ea; color: #0e4a26; }
:root[data-theme="light"] .toast.ok { background: #e3f6ea; color: #0e4a26; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } :root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; overflow: hidden; }
#map { position: absolute; inset: 0; }
.hidden { display: none !important; }
.dim { color: var(--dim); }

#topbar { position: absolute; top: 0; left: 0; right: 0; height: 40px; display: flex; align-items: center; gap: 18px; padding: 0 14px; background: linear-gradient(to bottom, rgba(8,11,16,0.95), rgba(8,11,16,0.75)); border-bottom: 1px solid var(--panel-border); z-index: 10; }
.brand { font-weight: 700; letter-spacing: 1.5px; font-size: 14px; margin: 0; }
.about { color: var(--dim); text-decoration: none; font-size: 12px; border: 1px solid var(--panel-border); border-radius: 4px; padding: 2px 8px; }
.about:hover { color: #fff; border-color: var(--accent); }
.brand .flag { margin-right: 4px; }
.brand .logo { width: 22px; height: 22px; vertical-align: -5px; margin-right: 6px; border-radius: 5px; }
.counts { display: flex; gap: 14px; flex: 1; font-family: var(--mono); font-size: 12px; }
.counts span b { color: #fff; }
.counts .c-mil b { color: var(--mil); } .counts .c-pol b { color: var(--police); } .counts .c-hems b { color: var(--hems); } .counts .c-cg b { color: var(--cg); } .counts .c-alert b { color: var(--sev3); }
.clock { font-family: var(--mono); font-size: 15px; display: flex; gap: 10px; align-items: baseline; }
.clock .dim { font-size: 12px; }
.conn { font-size: 16px; color: #3bd16f; }
.conn.bad { color: var(--sev3); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.panel { position: absolute; z-index: 9; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px; backdrop-filter: blur(8px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,0.45); }
#left { top: 50px; left: 10px; bottom: 10px; width: 340px; }
#right { top: 50px; right: 10px; width: 300px; max-height: calc(100% - 60px); }
#layers { left: 360px; bottom: 10px; width: 250px; max-height: 60%; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; font-size: 11px; letter-spacing: 1.2px; font-weight: 700; color: #a9b7c9; background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--panel-border); }
.panel-head.sub { border-top: 1px solid var(--panel-border); }
.controls { display: flex; gap: 6px; }
select, button { background: #141c27; color: var(--text); border: 1px solid #2a3647; border-radius: 4px; font-size: 11px; padding: 2px 6px; cursor: pointer; }
button:hover { border-color: var(--accent); }

.list { overflow-y: auto; flex: 1; min-height: 80px; }
.list.news { flex: 0 1 38%; }
.alert { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; display: grid; grid-template-columns: 6px 1fr auto; gap: 8px; }
.alert:hover { background: rgba(255,255,255,0.05); }
.alert .bar { border-radius: 2px; background: var(--sev0); }
.alert.s1 .bar { background: var(--sev1); } .alert.s2 .bar { background: var(--sev2); } .alert.s3 .bar { background: var(--sev3); box-shadow: 0 0 8px var(--sev3); }
.alert .title { font-weight: 600; line-height: 1.3; }
.alert .body { color: var(--dim); font-size: 12px; margin-top: 2px; }
.alert .age { color: var(--dim); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.alert .kind { display: inline-block; font-size: 10px; letter-spacing: 1px; padding: 0 4px; border-radius: 3px; background: rgba(255,255,255,0.08); margin-right: 5px; text-transform: uppercase; }
.empty { padding: 14px; color: var(--dim); text-align: center; font-style: italic; }

.stats { padding: 6px 10px; overflow-y: auto; }
.stat-group { margin-bottom: 8px; }
.stat-group h4 { margin: 4px 0 3px; font-size: 10px; letter-spacing: 1.2px; color: var(--dim); font-weight: 700; }
.kv { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; padding: 1px 0; }
.kv .v { color: #fff; }
.kv .v.warn { color: var(--sev1); } .kv .v.bad { color: var(--sev3); } .kv .v.good { color: #3bd16f; }
.mixbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 4px 0; background: #1a2230; }
.mixbar div { height: 100%; }
.mixlegend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 10px; color: var(--dim); }
.mixlegend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 3px; vertical-align: middle; }
.scale { display: inline-block; width: 22px; text-align: center; border-radius: 3px; font-weight: 700; margin-left: 4px; background: #233041; }
.scale.g1, .scale.g2 { background: #8a6d00; } .scale.g3 { background: #a85a00; } .scale.g4, .scale.g5 { background: #a30000; }

.feeds { padding: 4px 10px 8px; overflow-y: auto; max-height: 30vh; display: grid; grid-template-columns: 1fr 1fr; gap: 1px 10px; }
.feed { display: flex; align-items: center; gap: 6px; font-size: 11px; padding: 1px 0; cursor: default; }
.feed i { width: 7px; height: 7px; border-radius: 50%; background: #3bd16f; flex: none; }
.feed.bad i { background: var(--sev3); } .feed.off i { background: #3a4656; } .feed.stale i { background: var(--sev1); }
.feed span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#layer-list { overflow-y: auto; padding: 4px 0; }
.lgroup { padding: 3px 10px 2px; font-size: 10px; letter-spacing: 1.2px; color: var(--dim); font-weight: 700; margin-top: 4px; }
.layer { display: flex; align-items: center; gap: 7px; padding: 2px 10px; cursor: pointer; font-size: 12px; }
.layer:hover { background: rgba(255,255,255,0.04); }
.layer input { margin: 0; accent-color: var(--accent); }
.layer .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.layer .n { color: var(--dim); font-family: var(--mono); font-size: 10px; margin-left: auto; }
.layer.opt { font-size: 11px; color: var(--dim); }

.footer { position: absolute; z-index: 8; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--dim); background: rgba(8,11,16,0.75); border: 1px solid var(--panel-border); border-radius: 4px; padding: 2px 10px; white-space: nowrap; }
.footer a { color: #a9b7c9; text-decoration: none; }
.footer a:hover { color: #fff; }
@media (max-width: 1100px) { .footer { display: none; } }

.toast { position: absolute; top: 48px; left: 50%; transform: translateX(-50%); z-index: 20; background: #3a0d0d; border: 1px solid var(--sev3); color: #fff; padding: 8px 16px; border-radius: 6px; font-weight: 600; display: none; box-shadow: 0 0 20px rgba(255,79,79,0.5); }
.toast.show { display: block; animation: blink 1.2s 3; }

.selected { position: absolute; z-index: 9; bottom: 10px; left: 620px; right: 320px; max-width: 560px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 6px; padding: 8px 12px; font-size: 12px; backdrop-filter: blur(6px); }
.vms-wrap { margin: 2px 0 8px; }
.ac-photo { float: right; margin: 0 0 6px 12px; max-width: 200px; }
.ac-photo img { display: block; width: 200px; border-radius: 4px; }
.ac-credit { font-size: 9px; color: var(--dim); text-align: right; margin-top: 2px; }
.vms-sign { display: block; width: 100%; max-width: 520px; image-rendering: pixelated; border-radius: 3px; box-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.vms-cap { font-size: 10px; color: var(--dim); margin-top: 3px; }
.selected h3 { margin: 0 0 4px; font-size: 14px; display: flex; justify-content: space-between; }
.selected h3 .close { cursor: pointer; color: var(--dim); }
.selected .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 14px; font-family: var(--mono); font-size: 11px; }
.selected .grid div { min-width: 0; overflow-wrap: anywhere; }
.selected .grid div span { color: var(--dim); margin-right: 6px; }
.selected a { color: var(--accent); }

.hover-card .maplibregl-popup-content { padding: 6px 10px; pointer-events: none; }
.hover-card .hc-title { font-weight: 700; font-size: 13px; color: #fff; }
.hover-card .hc-sub { color: #a9b7c9; font-size: 11px; text-transform: capitalize; }
.hover-card .hc-rows { margin-top: 3px; font-family: var(--mono); font-size: 11px; color: var(--text); }
.hover-card .hc-hint { margin-top: 3px; font-size: 10px; color: var(--dim); }
.hover-card .maplibregl-popup-tip { pointer-events: none; }

.maplibregl-popup-content { background: var(--panel); color: var(--text); border: 1px solid var(--panel-border); font-family: var(--font); font-size: 12px; padding: 8px 10px; border-radius: 6px; max-width: 320px; }
.maplibregl-popup-tip { border-top-color: var(--panel-border) !important; }
.maplibregl-popup-close-button { color: var(--dim); }
.maplibregl-ctrl-attrib { background: rgba(8,11,16,0.7) !important; color: var(--dim); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--dim); }
.maplibregl-ctrl-group { background: #141c27; }
.maplibregl-ctrl-group button { filter: invert(0.85); }

@media (max-width: 1100px) {
  #right { display: none; }
  #layers { left: 10px; bottom: auto; top: 50px; max-height: 45%; width: 220px; }
  #left { top: 50%; bottom: 10px; width: 300px; }
  .selected { left: 320px; right: 10px; }
}

/* ---- motorway sign gallery ---- */
#signs { left: 620px; right: 320px; bottom: 28px; max-height: 190px; }
#signs.collapsed { max-height: 32px; }
#signs.collapsed .signs-strip { display: none; }
#signs .panel-head { cursor: pointer; }
.signs-strip { display: flex; gap: 10px; overflow-x: auto; padding: 8px 10px; scrollbar-width: thin; }
.sign-card { flex: 0 0 auto; width: 170px; cursor: pointer; border-radius: 6px; padding: 4px; transition: background 0.15s; }
.sign-card:hover { background: rgba(255,255,255,0.06); }
.sign-card canvas { display: block; width: 100%; border-radius: 3px; image-rendering: auto; }
.sign-card .cap { font-size: 10px; color: var(--dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign-card .cap b { color: #d7dee8; font-weight: 600; }
@media (max-width: 1100px) { #signs { display: none; } }
.selected { bottom: 36px; }
.layer, .alert, button, select, .about { transition: background 0.15s, border-color 0.15s, color 0.15s; }

/* ---- loading / reconnect ---- */
.loading { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(8,11,16,0.82); color: var(--text); font-size: 14px; letter-spacing: 0.5px; transition: opacity 0.3s; }
.loading.soft { inset: auto; top: 48px; left: 50%; transform: translateX(-50%); background: #3a2a0d; border: 1px solid var(--sev1); border-radius: 6px; padding: 6px 14px; flex-direction: row; gap: 10px; font-size: 12px; }
.loading.soft .spinner { width: 12px; height: 12px; border-width: 2px; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,0.15); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast.ok { background: #0f2a1a; border-color: #3bd16f; box-shadow: 0 0 20px rgba(59,209,111,0.4); animation: none; font-weight: 500; }
body.flash #topbar { animation: flashbar 0.5s 3; }
@keyframes flashbar { 50% { background: #5a0f0f; } }
/* ---- grouped alerts ---- */
.agroup .ahead { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; font-size: 11px; color: var(--dim); position: sticky; top: 0; backdrop-filter: blur(4px); }
.agroup .ahead .kind { color: #d7dee8; }
.agroup .ahead .max { width: 8px; height: 8px; border-radius: 50%; background: var(--sev0); }
.agroup .ahead .max.s1 { background: var(--sev1); } .agroup .ahead .max.s2 { background: var(--sev2); } .agroup .ahead .max.s3 { background: var(--sev3); }
.agroup .ahead .chev { margin-left: auto; }
/* ---- selection actions ---- */
.sel-actions { display: flex; gap: 6px; align-items: center; }
.sel-actions button { font-size: 11px; padding: 1px 8px; }
.sel-actions button.on { background: #1b3a2a; border-color: #3bd16f; color: #fff; }

.spark { vertical-align: middle; margin-right: 6px; }
.radar-time { font-family: var(--mono); font-size: 11px; }
:root[data-theme="light"] .replay { position: absolute; left: 50%; transform: translateX(-50%); bottom: 70px; z-index: 25; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border: 1px solid var(--sev3); border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,0.4); font-family: var(--mono); font-size: 12px; max-width: calc(100vw - 20px); }
.replay.hidden { display: none; }
.replay .badge { background: var(--sev3); color: #fff; font-weight: 700; letter-spacing: 1.5px; padding: 2px 7px; border-radius: 4px; font-size: 11px; animation: replaypulse 2s infinite; }
@keyframes replaypulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.replay button { min-width: 28px; }
.replay .rp-time { font-weight: 600; white-space: nowrap; }
.replay input[type=range] { width: 260px; accent-color: var(--sev3); }
.replay .rp-range { white-space: nowrap; font-size: 10px; }
.replay .live { border-color: #3bd16f; color: #3bd16f; }
body.in-replay #topbar { border-bottom: 2px solid var(--sev3); }
body.in-replay .conn { color: var(--sev3); }
@media (max-width: 760px) { .replay { bottom: 62px; flex-wrap: wrap; justify-content: center; } .replay input[type=range] { width: 100%; order: 10; } .replay .rp-range { display: none; } }
.today { position: absolute; z-index: 12; top: 48px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; max-width: min(560px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--panel-border); border-radius: 999px; box-shadow: 0 4px 16px rgba(0,0,0,0.3); backdrop-filter: blur(8px); font-size: 12.5px; }
.today.hidden { display: none; }
.today-main { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 5px 4px 5px 12px; background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; }
.today-main.fade { animation: tfade 0.5s ease-out; } @keyframes tfade { from { opacity: 0; transform: translateY(-3px); } }
.today-emoji { font-size: 15px; line-height: 1; } .today-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; } .today-text b { font-weight: 600; }
.today-n { font-size: 10.5px; font-variant-numeric: tabular-nums; margin-left: 2px; }
.today-close { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 5px 11px 5px 6px; font-size: 12px; } .today-close:hover { color: var(--text); }
.today-list { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--panel-border); border-radius: 10px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.today-list.hidden { display: none; }
.tl-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 6px; border-radius: 6px; } .tl-row:hover { background: var(--panel); }
.tl-e { font-size: 15px; line-height: 1.2; } .tl-t a { color: var(--text); text-decoration: none; } .tl-t a:hover { color: var(--accent); text-decoration: underline; }
.tl-t small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 1px; } .tl-k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--dim); padding-top: 2px; }
.tl-foot { font-size: 10.5px; padding: 6px 6px 2px; border-top: 1px solid var(--panel-border); margin-top: 4px; }
@media (max-width: 760px) { .today { top: 46px; font-size: 12px; } .today-text .dim { display: none; } }
.welcome { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 6, 10, 0.55); backdrop-filter: blur(2px); }
.welcome.hidden { display: none; }
.wbox { width: min(720px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--bg); color: var(--text); border: 1px solid var(--panel-border); border-top: 3px solid var(--accent); border-radius: 12px; padding: 20px 22px 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); font-size: 13px; line-height: 1.45; animation: wpop 0.25s ease-out; }
@keyframes wpop { from { transform: translateY(10px) scale(0.98); opacity: 0; } }
.whead { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; } .whead img { border-radius: 10px; flex: none; }
.whead h2 { margin: 0 0 3px; font-size: 19px; letter-spacing: 0.2px; } .whead p { margin: 0; color: var(--dim); }
.wgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.wgrid > div { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px; padding: 9px 11px; color: var(--dim); }
.wgrid b { display: block; color: var(--text); margin-bottom: 2px; font-size: 13.5px; }
.wnote { margin: 14px 0 0; padding: 9px 11px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 0 6px 6px 0; }
.wdisc { margin: 12px 0 0; font-size: 11.5px; color: var(--dim); } .wdisc a { color: var(--accent); }
.wbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.wbtns button { padding: 8px 16px; font-size: 13px; border-radius: 6px; cursor: pointer; }
.wbtns .primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 600; }
.wbtns .ghost { background: transparent; border: 1px solid var(--panel-border); color: var(--text); }
@media (max-width: 760px) { .wbox { padding: 16px 14px 12px; } .whead h2 { font-size: 16px; } .wgrid { grid-template-columns: 1fr 1fr; gap: 7px; } .wgrid > div { padding: 7px 9px; font-size: 11.5px; line-height: 1.35; } .wgrid b { font-size: 12.5px; } .wnote { font-size: 12px; } .whead p { font-size: 12px; } .whead img { width: 36px; height: 36px; } .wbtns { flex-direction: column-reverse; } .wbtns button { width: 100%; } }
@media (max-width: 340px) { .wgrid { grid-template-columns: 1fr; } }
.disclaimer { position: absolute; z-index: 28; left: 50%; transform: translateX(-50%); bottom: 36px; max-width: 760px; width: calc(100vw - 24px); display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.5); font-size: 12.5px; line-height: 1.4; }
.disclaimer.hidden { display: none; }
.disclaimer img { border-radius: 8px; flex: none; }
.disclaimer .dtext { flex: 1; } .disclaimer .dtext a { color: var(--accent); }
.disclaimer button { flex: none; padding: 6px 14px; font-weight: 600; border-color: var(--accent); }
@media (max-width: 760px) { .disclaimer { bottom: 58px; flex-wrap: wrap; font-size: 12px; } .disclaimer button { width: 100%; } }
.hc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; padding: 1px 6px; border-radius: 10px; background: rgba(127,142,163,0.18); color: var(--text); white-space: nowrap; }
.chip.src { color: var(--dim); } .chip.em .emblem { width: 14px; height: 14px; }
.chip.al i { width: 8px; height: 8px; border-radius: 50%; background: var(--al, #888); display: inline-block; }
.badge-wrap { display: inline-block; vertical-align: -5px; margin-right: 6px; } .badge-wrap .emblem { width: 22px; height: 22px; }
.legend { flex: none; max-height: 48vh; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 8px; border-bottom: 1px solid var(--panel-border); font-size: 11px; }
#layers .panel-head { flex-wrap: wrap; row-gap: 4px; } #layers .panel-head .controls button { padding: 2px 6px; font-size: 11px; } #layers .panel-head > span:first-child { display: inline-flex; align-items: center; gap: 8px; } #layers .panel-head .pcol { padding: 0 5px; font-size: 9px; line-height: 1.5; }
.legend .lgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; margin: 2px 0 6px; }
.legend .lg { display: flex; align-items: center; gap: 6px; min-height: 22px; color: var(--text); min-width: 0; line-height: 1.15; }
.legend .lg img { width: 20px; height: 20px; flex: none; }
.legend .lg .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; margin: 0 4px; }
.legend .lg .ln { width: 20px; height: 0; border-top: 2px solid #fff; flex: none; } .legend .lg .ln.dash { border-top-style: dashed; } .legend .lg .ln.dest { border-top: 2px dashed #3bd16f; }
#btn-key.on { background: var(--accent); color: #fff; }
.stat-group h4 { cursor: pointer; user-select: none; display: flex; align-items: baseline; gap: 6px; }
.stat-group h4 .chev { margin-left: auto; font-size: 10px; } .stat-group h4 .sumv { color: var(--text); font-weight: 500; letter-spacing: 0; font-size: 11px; text-transform: none; }
.stat-group.collapsed > :not(h4) { display: none; }
.loading { transition: opacity 0.35s, visibility 0.35s; }
.loading.hidden { display: flex !important; opacity: 0; visibility: hidden; pointer-events: none; }
.pcol { padding: 1px 6px; font-size: 10px; line-height: 1.4; }
.edge-tab { position: absolute; z-index: 9; top: 50px; width: 30px; padding: 10px 0; writing-mode: vertical-rl; text-orientation: mixed; font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: #a9b7c9; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px; cursor: pointer; backdrop-filter: blur(8px); }
.edge-tab.left { left: 10px; } .edge-tab.right { right: 10px; transform: rotate(180deg); }
.edge-tab b { color: var(--sev3); margin-top: 6px; } .edge-tab b:empty { display: none; }
.edge-tab:hover { color: #fff; border-color: var(--accent); }
body.lcol #left { display: none; } body.lcol #layers { left: 50px; } body.lcol #signs, body.lcol .selected { left: 310px; }
body.rcol #right { display: none; } body.rcol #signs, body.rcol .selected { right: 50px; }
body.ycol #layers { display: none; } body.ycol #signs, body.ycol .selected { left: 470px; } body.lcol.ycol #signs, body.lcol.ycol .selected { left: 160px; }
.layers-tab { position: absolute; z-index: 10; left: 360px; bottom: 34px; padding: 6px 12px; font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: #a9b7c9; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px; cursor: pointer; } .layers-tab:hover { color: #fff; border-color: var(--accent); } body.lcol .layers-tab { left: 50px; }
@media (max-width: 760px) { .layers-tab { display: none !important; } body.ycol[data-tab="layers"] #layers { display: flex; } }
@media (max-width: 1100px) { body.lcol .selected { left: 10px; } body.lcol #layers { left: 50px; } }
@media (max-width: 760px) { .edge-tab, .pcol { display: none !important; } body.lcol #left, body.rcol #right { display: none; } body.lcol[data-tab="alerts"] #left, body.rcol[data-tab="status"] #right { display: flex; } }
.board { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; margin: 0 0 8px; }
.board td { padding: 2px 6px 2px 0; border-bottom: 1px solid var(--panel-border); white-space: nowrap; } .board td:nth-child(2) { white-space: normal; }
.board tr.warn td:nth-child(4) { color: #ffd23f; } .board tr.bad td { color: #ff8a8a; } .board tr.bad td:nth-child(4) { font-weight: 700; }
.board tr.reason td { color: var(--dim); font-family: var(--sans, inherit); font-size: 10.5px; padding-left: 12px; }
.sun-info { font-family: var(--mono); font-size: 11px; display: flex; gap: 8px; white-space: nowrap; }
.gauge { vertical-align: middle; margin-right: 2px; }
.kv.freq { align-items: center; }
.hover-card .hc-img { display: block; width: 100%; max-width: 220px; border-radius: 4px; margin-bottom: 6px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.cam-wrap { position: relative; margin: -2px 0 8px; }
.cam-wrap .cam-img { display: block; width: 100%; max-height: 240px; object-fit: cover; border-radius: 6px; background: #000; }
.cam-wrap .cam-video { display: block; width: 100%; max-height: 240px; object-fit: cover; border-radius: 6px; margin-top: 4px; background: #000; }
.cam-wrap .cam-video { display: none; } .cam-wrap .cam-video.ready { display: block; }
.tide-wrap { margin: 2px 0 6px; } .tide { display: block; }

/* ---- mobile layout: panels become full-screen sheets picked from a bottom tab bar ---- */
#tabs { display: none; }
@media (max-width: 760px) {
  #topbar { gap: 8px; padding: 0 8px; height: 40px; }
  .brand { font-size: 12px; letter-spacing: 1px; } .counts { display: none; } .clock .dim { display: none; } .clock { font-size: 13px; } .about, .radar-time, .sun-info { display: none; } #btn-replay { display: inline-block; padding: 1px 6px; }
  #left, #right, #layers, #signs, .footer { display: none; }
  body[data-tab="alerts"] #left, body[data-tab="layers"] #layers, body[data-tab="status"] #right { display: flex; top: 44px; left: 6px; right: 6px; bottom: 56px; width: auto; max-height: none; }
  body[data-tab] .selected { display: none; }
  .selected { left: 6px; right: 6px; bottom: 56px; max-width: none; font-size: 12px; max-height: 45%; overflow-y: auto; }
  .selected .grid { grid-template-columns: 1fr 1fr; }
  .ac-photo { float: none; max-width: 100%; } .ac-photo img { width: 100%; }
  #tabs { display: flex; position: absolute; left: 0; right: 0; bottom: 0; height: 50px; z-index: 12; background: var(--panel); border-top: 1px solid var(--panel-border); backdrop-filter: blur(8px); }
  #tabs button { flex: 1; background: none; border: 0; border-radius: 0; color: var(--dim); font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
  #tabs button .ic { font-size: 18px; line-height: 1; }
  #tabs button.on { color: var(--accent); }
  .maplibregl-ctrl-bottom-right { bottom: 56px; }
  .toast { top: 46px; left: 8px; right: 8px; transform: none; font-size: 12px; }
  .loading.soft { top: 46px; }
  .list.news { flex: 0 1 40%; }
}

/* small inline selects inside status rows (e.g. the Agile region) */
.kv select.inline { font: inherit; font-size: 11px; color: var(--text); background: #141c27; border: 1px solid #2a3647; border-radius: 4px; padding: 0 2px; margin-left: 4px; max-width: 150px; color-scheme: dark; }
.kv select.inline option { background: #141c27; color: #e6ecf5; }
:root[data-theme="light"] .kv select.inline { background: #ffffff; border-color: #c5cfdc; color-scheme: light; }
:root[data-theme="light"] .kv select.inline option { background: #ffffff; color: #0e1620; }

/* search */
.search { position: relative; flex: 0 1 230px; min-width: 120px; }
#topbar .brand { white-space: nowrap; } .counts span { white-space: nowrap; }
.search input { width: 100%; box-sizing: border-box; font: inherit; font-size: 12px; padding: 4px 8px; color: var(--text); background: #141c27; border: 1px solid #2a3647; border-radius: 6px; outline: none; }
.search input:focus { border-color: var(--accent); }
:root[data-theme="light"] .search input { background: #ffffff; border-color: #c5cfdc; }
.search-results { position: absolute; top: 32px; left: 0; width: 360px; max-height: 60vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 8px; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.search-results .sr { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 12px; border-bottom: 1px solid var(--panel-border); }
.search-results .sr:last-child { border-bottom: 0; } .search-results .sr:hover, .search-results .sr.active { background: rgba(77,163,255,0.14); }
.search-results .sr img { width: 18px; height: 18px; } .search-results .sr .k { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; min-width: 52px; }
.search-results .sr .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .search-results .sr .t small { color: var(--dim); margin-left: 6px; }
.search-results .sr button { font-size: 10px; padding: 1px 6px; }
.search-results .empty { padding: 8px 10px; }
.near { font-size: 10px; color: var(--dim); display: inline-flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; } .near input { margin: 0; }
.home-head { display: flex; justify-content: space-between; align-items: center; } .home-head button { font-size: 10px; padding: 1px 6px; }
@media (max-width: 1100px) { .search { flex-basis: 180px; } .search input { font-size: 11px; } }
@media (max-width: 760px) { .search { flex-basis: 140px; } .search-results { width: calc(100vw - 20px); } }

.layer.opt.push { display: flex; align-items: center; gap: 6px; font-size: 11px; } .layer.opt.push button { font-size: 10px; padding: 1px 6px; } .layer.opt.push select.inline { font-size: 10px; padding: 0 2px; background: #141c27; color: var(--text); border: 1px solid #2a3647; border-radius: 4px; } :root[data-theme="light"] .layer.opt.push select.inline { background: #fff; border-color: #c5cfdc; }

/* embed mode: just the map */
body.embed #left, body.embed #right, body.embed #layers, body.embed #signs, body.embed #footer, body.embed .edge-tab, body.embed .layers-tab, body.embed #disclaimer, body.embed #btn-replay, body.embed #btn-export, body.embed .search, body.embed #sun-info, body.embed #radar-time { display: none !important; }
body.embed #topbar { height: 32px; gap: 10px; padding: 0 10px; } body.embed #topbar .brand { font-size: 12px; } body.embed .counts { font-size: 11px; gap: 10px; } body.embed .clock { font-size: 12px; }
body.embed .embed-only { display: inline-block !important; }
body.embed .selected { left: 10px; right: 10px; bottom: 10px; }
body.embed .embed-credit { position: absolute; left: 8px; bottom: 6px; z-index: 9; font-size: 10px; color: var(--dim); background: var(--panel); padding: 2px 6px; border-radius: 4px; }
/* clusters */
.cluster-hint { cursor: zoom-in; }
/* api page */
.doc pre { background: #0b0f14; border: 1px solid var(--panel-border); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: 12px; } :root[data-theme="light"] .doc pre { background: #f2f5f9; }
.doc code { font-family: var(--mono); font-size: 12px; }

/* subject focus */
.topic-select { font-size: 11px; padding: 2px 4px; flex: 1 1 100%; max-width: none; margin-bottom: 2px; }
#layers .panel-head .controls { flex-wrap: wrap; row-gap: 4px; }
/* the motorway signs strip is transport detail: hide it in other subject views */
body[data-topic]:not([data-topic="all"]):not([data-topic="transport"]):not([data-topic="emergency"]) #signs { display: none; }
.topic-chip { font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; color: var(--accent); white-space: nowrap; border: 1px solid var(--accent); border-radius: 12px; padding: 1px 4px 1px 9px; display: inline-flex; align-items: center; gap: 5px; }
.topic-chip b { color: var(--text); font-weight: 600; } .topic-chip button { font-size: 10px; padding: 0 5px; border-radius: 10px; line-height: 1.4; }
.trow[hidden], .stat-group[hidden] { display: none !important; }
body.topic-sub #news, body.topic-sub #left .panel-head.sub { display: none; }

/* UK station departure board: amber LEDs on black, regardless of the page theme */
.dmb { position: relative; background: #050505; color: #ffa31a; font-family: 'DotGothic16', 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.45; padding: 8px 10px 6px; margin: 0 0 8px; border: 5px solid #1c1c1c; border-radius: 4px; box-shadow: inset 0 0 12px rgba(0,0,0,0.9), 0 1px 0 #333; text-shadow: 0 0 3px rgba(255,150,0,0.75), 0 0 8px rgba(255,120,0,0.25); overflow: hidden; letter-spacing: 0.3px; }
.dmb::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 50%, transparent 52%, rgba(0,0,0,0.55) 58%) 0 0 / 3px 3px; }
.dmb-row { display: grid; grid-template-columns: 2.4em 3.2em minmax(0, 1fr) auto 5.6em; column-gap: 0.6em; white-space: nowrap; }
.dmb-row .dest { overflow: hidden; text-overflow: clip; } .dmb-row .plat { text-align: right; } .dmb-row .st { text-align: right; }
.tstops { margin: 6px 0 8px; max-height: 170px; overflow-y: auto; font-size: 12px; }
.tstops > div { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; column-gap: 6px; padding: 2px 6px 2px 0; position: relative; }
.tstops > div::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: #ffa31a66; }
.tstops > div:first-child::before { top: 50%; } .tstops > div:last-child::before { bottom: 50%; }
.tstops .dot { position: relative; z-index: 1; width: 10px; height: 10px; margin-left: 3px; border-radius: 50%; border: 2px solid #ffa31a; background: var(--panel, #0b0f14); box-sizing: border-box; }
.tstops .done { opacity: 0.6; } .tstops .done::before { background: #9fd3ff88; } .tstops .done .dot { border-color: #9fd3ff; background: #9fd3ff; }
.tstops .next { font-weight: 600; } .tstops .next .dot { border-color: var(--text, #fff); }
.tstops .dest { position: sticky; bottom: 0; background: var(--bg); font-weight: 600; border-top: 1px solid #ffa31a33; }
.tstops .dest .dot { border-radius: 2px; border-width: 3px; }
.tstops em { font-style: normal; font-weight: 400; font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; margin-left: 4px; }
.tstops .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tstops .tm { font-variant-numeric: tabular-nums; white-space: nowrap; } .tstops .tm.late { color: #ffd23f; } .tstops s { opacity: 0.6; margin-right: 3px; }
.dmb-row.trn { grid-template-columns: 3.4em 3.2em minmax(0, 1fr) auto 5.6em; }
.dmb-row.cx .st { animation: dmb-blink 1.2s steps(2, start) infinite; }
@keyframes dmb-blink { to { visibility: hidden; } }
.dmb-scroll { overflow: hidden; white-space: nowrap; margin: 0 0 1px 3em; }
.dmb-scroll span { display: inline-block; will-change: transform; transform: translate3d(100vw, 0, 0); }
.dmb-scroll.msg { margin-left: 0; color: #ff8c1a; }
.dmb-clock { text-align: center; font-size: 19px; margin-top: 3px; letter-spacing: 1px; }
.dmb-more { font-size: 12px; padding-top: 6px; }
@media (prefers-reduced-motion: reduce) { .dmb-scroll span { transform: none; white-space: normal; } .dmb-row.cx .st { animation: none; } }
@media (max-width: 760px) { .dmb { font-size: 12px; } .dmb-row { grid-template-columns: 2.2em 3em minmax(0, 1fr) auto 5em; column-gap: 0.4em; } }
