:root {
  --bg: #070b11;
  --panel: rgba(11, 18, 29, .94);
  --panel-2: rgba(14, 24, 38, .96);
  --line: rgba(123, 188, 220, .2);
  --line-strong: rgba(76, 221, 255, .42);
  --text: #dbeaf2;
  --muted: #7893a2;
  --cyan: #46ddff;
  --blue: #4695ff;
  --green: #69f0ad;
  --amber: #ffcc67;
  --magenta: #ff5dcf;
  --danger: #ff6877;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; min-width: 0; color: var(--text); background: radial-gradient(circle at 50% -20%, #152a42 0, #070b11 46%, #04070b 100%); }
button, input { font: inherit; }
a { color: var(--cyan); }
.background-grid { position: fixed; inset: 0; pointer-events: none; opacity: .18; background-image: linear-gradient(rgba(70,221,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(70,221,255,.08) 1px, transparent 1px); background-size: 40px 40px; mask-image: linear-gradient(to bottom, black, transparent 82%); }
.scanline { position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .04; background: repeating-linear-gradient(to bottom, transparent 0 3px, #fff 4px); }
.aprs-shell { position: relative; z-index: 1; width: min(1500px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 36px; }
.topbar, .status-ribbon, .command-bar, .panel, footer { border: 1px solid var(--line); background: var(--panel); box-shadow: inset 0 1px 0 rgba(255,255,255,.025); }
.topbar { min-height: 78px; border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 16px; }
.brand { min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand img { width: 132px; height: auto; display: block; }
.brand span { min-width: 0; display: grid; }
.brand strong { color: var(--cyan); font-size: 1.02rem; letter-spacing: .18em; }
.brand small { color: var(--muted); font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 12px; font-size: .82rem; }
.top-actions a { text-decoration: none; }
.alpha-tag { border: 1px solid rgba(255,93,207,.35); border-radius: 999px; padding: 6px 9px; color: var(--magenta); background: rgba(255,93,207,.08); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.status-ribbon { border-top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 9px 14px; color: var(--muted); font-size: .75rem; letter-spacing: .04em; }
.status-ribbon b { color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 9px; border: 1px solid var(--line); font-size: .67rem; font-weight: 900; letter-spacing: .08em; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.badge.ok { color: var(--green); border-color: rgba(105,240,173,.35); background: rgba(105,240,173,.07); }
.badge.warn { color: var(--amber); border-color: rgba(255,204,103,.3); background: rgba(255,204,103,.06); }
.badge.bad { color: var(--danger); border-color: rgba(255,104,119,.34); background: rgba(255,104,119,.07); }
.command-bar { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 12px; align-items: end; justify-content: space-between; padding: 12px 14px; }
.search-form { min-width: 0; display: grid; grid-template-columns: auto minmax(150px, 240px) auto; align-items: center; gap: 8px; }
.search-form label, .track-tools > span, .detail-block > span { color: var(--muted); font-size: .66rem; font-weight: 900; letter-spacing: .12em; }
input, button { min-height: 42px; border-radius: 10px; border: 1px solid var(--line); color: var(--text); background: #09121d; }
input { width: 100%; padding: 0 12px; font-size: 16px; outline: 0; text-transform: uppercase; }
input:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button { padding: 0 13px; cursor: pointer; font-weight: 750; }
button:hover { border-color: var(--line-strong); color: #fff; }
button.active, button[aria-pressed="true"] { color: var(--cyan); border-color: rgba(70,221,255,.48); background: rgba(70,221,255,.1); }
.command-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.notice { min-height: 20px; margin: 10px 4px; color: var(--muted); font-size: .78rem; }
.notice.error { color: var(--danger); }
.aprs-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 12px; align-items: stretch; }
.panel { min-width: 0; border-radius: var(--radius); overflow: hidden; }
.panel-heading { min-width: 0; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-heading > div { min-width: 0; }
.panel-heading h1, .panel-heading h2 { margin: 2px 0 0; font-size: 1.03rem; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-heading > span { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.eyebrow { display: block; color: var(--cyan); font-size: .62rem; font-weight: 900; letter-spacing: .16em; }
#aprs-map { width: 100%; height: min(61vh, 690px); min-height: 430px; background: #081019; }
.maplibregl-map { font-family: inherit; }
.maplibregl-ctrl-group, .maplibregl-popup-content { color: var(--text); background: #0b1622; border: 1px solid var(--line); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: #0b1622; }
.map-key { display: flex; flex-wrap: wrap; gap: 12px 18px; padding: 10px 14px; color: var(--muted); font-size: .69rem; border-top: 1px solid var(--line); }
.map-key span { display: inline-flex; align-items: center; gap: 6px; }
.map-key i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 10px currentColor; background: currentColor; }
.key-ywd { color: var(--cyan); }
.key-moving { color: var(--green); }
.key-wx { color: var(--amber); }
.key-infra { color: #b9a1ff; }
.key-object { color: var(--magenta); }
.key-station { color: var(--blue); }

/* 42px touch target around a 24px standard APRS symbol. */
.aprs-marker { width: 42px; height: 42px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--blue); position: relative; overflow: visible; }
.aprs-marker::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1px solid currentColor; background: rgba(7,11,17,.34); box-shadow: 0 0 15px currentColor; opacity: .48; }
.aprs-marker::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 2px solid transparent; pointer-events: none; }
.aprs-marker.selected::after { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,.75); }
.aprs-marker .aprs-symbol-layer { position: absolute !important; left: 9px; top: 9px; margin: 0 !important; padding: 0 !important; z-index: 2; transform: translateZ(0); filter: drop-shadow(0 0 4px rgba(0,0,0,.95)); }
.aprs-marker .aprs-symbol-overlay { z-index: 3; }
.aprs-marker .aprs-symbol-fallback { position: absolute; left: 14px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; z-index: 2; }
.aprs-marker.ywd { color: var(--cyan); }
.aprs-marker.moving { color: var(--green); }
.aprs-marker.weather { color: var(--amber); }
.aprs-marker.infrastructure { color: #b9a1ff; }
.aprs-marker.object { color: var(--magenta); }
.aprs-marker:hover::before, .aprs-marker:focus-visible::before { opacity: .78; }

.station-panel { display: flex; flex-direction: column; }
.station-empty { margin: auto; padding: 28px 20px; color: var(--muted); text-align: center; }
.station-detail { padding: 14px; overflow-wrap: anywhere; }
.source-chip { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.detail-list div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); }
.detail-list dt { color: var(--muted); font-size: .63rem; letter-spacing: .07em; text-transform: uppercase; }
.detail-list dd { margin: 4px 0 0; font-size: .85rem; font-weight: 750; overflow-wrap: anywhere; }
.detail-block { margin-top: 10px; }
.detail-block code, .detail-block p { display: block; margin: 5px 0 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: #bfd7e4; background: #071019; font-size: .72rem; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
.track-tools { margin-top: 14px; display: grid; grid-template-columns: 1fr repeat(4, auto); gap: 6px; align-items: center; }
.track-tools button { min-height: 34px; padding: 0 8px; font-size: .7rem; }
.external-link { display: inline-flex; margin-top: 14px; font-size: .75rem; text-decoration: none; }
.lower-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 12px; margin-top: 12px; }
.table-wrap { overflow: auto; max-height: 430px; }
table { width: 100%; border-collapse: collapse; font-size: .76rem; }
th { position: sticky; top: 0; z-index: 2; background: #0d1825; color: var(--muted); text-align: left; font-size: .65rem; letter-spacing: .09em; text-transform: uppercase; }
th, td { padding: 10px 12px; border-bottom: 1px solid rgba(123,188,220,.1); }
tbody tr[data-key] { cursor: pointer; }
tbody tr[data-key]:hover, tbody tr.selected { background: rgba(70,221,255,.06); }
td:first-child { color: var(--cyan); font-weight: 850; }
.packet-feed { max-height: 430px; overflow: auto; padding: 7px 12px 12px; font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; font-size: .7rem; line-height: 1.5; }
.packet-row { display: grid; grid-template-columns: 72px 90px minmax(0,1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(123,188,220,.08); }
.packet-row time { color: var(--muted); }
.packet-row b { color: var(--cyan); }
.packet-row code { color: #a7bdc8; white-space: normal; overflow-wrap: anywhere; }
footer { margin-top: 12px; border-radius: var(--radius); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 18px; padding: 11px 14px; color: var(--muted); font-size: .66rem; }
@media (max-width: 1060px) {
  .aprs-layout { grid-template-columns: minmax(0, 1fr) 310px; }
  .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .aprs-shell { width: min(100% - 16px, 1500px); padding-top: 8px; }
  .topbar { min-height: 68px; }
  .brand img { width: 110px; }
  .brand small { max-width: 180px; }
  .aprs-layout { grid-template-columns: 1fr; }
  #aprs-map { height: 55vh; min-height: 360px; max-height: 560px; }
  .station-panel { min-height: 230px; }
  .station-empty { margin: 0; }
  .command-bar { align-items: stretch; flex-direction: column; }
  .search-form { grid-template-columns: auto minmax(0,1fr) auto; }
  .command-buttons { justify-content: stretch; }
  .command-buttons button { flex: 1 1 130px; }
}
@media (max-width: 540px) {
  .topbar { gap: 8px; padding: 9px 10px; }
  .brand img { width: 92px; }
  .brand strong { font-size: .86rem; }
  .brand small { display: none; }
  .top-actions { gap: 7px; font-size: .72rem; }
  .alpha-tag { padding: 5px 7px; }
  .status-ribbon { gap: 7px 12px; font-size: .69rem; }
  .search-form { grid-template-columns: 1fr auto; }
  .search-form label { grid-column: 1 / -1; }
  #aprs-map { min-height: 340px; }
  .panel-heading { min-height: 58px; padding: 10px 11px; }
  .detail-list { grid-template-columns: 1fr 1fr; }
  .track-tools { grid-template-columns: repeat(4, 1fr); }
  .track-tools > span { grid-column: 1 / -1; }
  th, td { padding: 9px 10px; }
  .packet-row { grid-template-columns: 65px minmax(0,1fr); }
  .packet-row code { grid-column: 1 / -1; }
  footer { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
