:root {
  color-scheme: dark;
  --bg: #02060b;
  --panel: rgba(7, 18, 31, 0.9);
  --panel-solid: #07121f;
  --panel-line: rgba(90, 150, 205, 0.28);
  --text: #e7f2ff;
  --muted: #8da6bf;
  --faint: #526b83;
  --cyan: #34a8ff;
  --cyan-soft: rgba(52, 168, 255, 0.18);
  --green: #8bdc73;
  --green-soft: rgba(139, 220, 115, 0.18);
  --purple: #bb73ef;
  --amber: #f0c36a;
  --danger: #ff716d;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.44);
  --burn-x: 0px;
  --burn-y: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
table {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 392px;
  grid-template-rows: minmax(0, 1fr) 62px;
  width: 100vw;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(9, 23, 37, 0.95), rgba(2, 6, 11, 1)),
    #02060b;
  transform: translate3d(var(--burn-x), var(--burn-y), 0);
  transition: transform 1200ms ease, grid-template-columns 260ms ease, grid-template-rows 260ms ease;
  will-change: transform;
}

.rail {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 26px;
  border-right: 1px solid rgba(88, 145, 196, 0.22);
  background: linear-gradient(180deg, rgba(4, 13, 23, 0.95), rgba(3, 8, 14, 0.98));
  z-index: 20;
  transition: transform 240ms ease, opacity 240ms ease;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #aac3de;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.rail-button.active,
.rail-button:hover {
  border-color: rgba(52, 168, 255, 0.45);
  background: rgba(17, 91, 143, 0.28);
  color: #6ec7ff;
}

.radar-stage {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid rgba(88, 145, 196, 0.18);
  transition: border-color 240ms ease;
}

#map {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(46, 126, 190, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 126, 190, 0.05) 1px, transparent 1px),
    #07111d;
  background-size: 44px 44px;
}

.leaflet-container {
  background: #07111d;
  font-family: inherit;
}

.leaflet-control-attribution {
  display: none;
}

.leaflet-control-zoom {
  border: 1px solid rgba(126, 166, 204, 0.35) !important;
  box-shadow: var(--shadow);
}

.panel-toggle-button {
  position: absolute;
  top: 168px;
  left: 22px;
  z-index: 650;
  display: grid;
  place-items: center;
  width: 34px;
  height: 46px;
  border: 1px solid rgba(126, 166, 204, 0.32);
  border-radius: 8px;
  background: rgba(4, 14, 24, 0.78);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.panel-toggle-button::before {
  content: "";
  width: 13px;
  height: 12px;
  border-top: 2px solid #b7cde4;
  border-bottom: 2px solid #b7cde4;
  box-shadow: 0 4px 0 #b7cde4;
}

.panel-toggle-button::after {
  content: "";
  position: absolute;
  right: 5px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
  transform: rotate(135deg);
  transition: transform 180ms ease;
}

.panel-toggle-button:hover {
  border-color: rgba(52, 168, 255, 0.65);
}

.leaflet-control-zoom a {
  width: 42px !important;
  height: 42px !important;
  line-height: 40px !important;
  border-color: rgba(126, 166, 204, 0.25) !important;
  background: rgba(5, 15, 26, 0.84) !important;
  color: var(--text) !important;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 74px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(88, 145, 196, 0.22);
  background: linear-gradient(180deg, rgba(2, 7, 13, 0.96), rgba(2, 7, 13, 0.82));
}

.brand-mark {
  position: relative;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(52, 168, 255, 0.58);
  border-radius: 50%;
  box-shadow: inset 0 0 0 8px rgba(52, 168, 255, 0.06), 0 0 24px rgba(52, 168, 255, 0.22);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.brand-mark::before {
  inset: 8px;
  border: 1px dashed rgba(52, 168, 255, 0.75);
}

.brand-mark::after {
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
}

.brand-mark span {
  top: 6px;
  left: 22px;
  width: 22px;
  height: 2px;
  transform-origin: 0 50%;
  transform: rotate(-38deg);
  background: var(--cyan);
}

.brand-copy h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 720;
}

.brand-copy p {
  margin: 4px 0 0;
  color: #49b6ff;
  font-size: 13px;
}

.usen-ticker {
  flex: 1 1 380px;
  min-width: 160px;
  max-width: 560px;
  overflow: hidden;
  border: 1px solid rgba(52, 168, 255, 0.2);
  border-radius: 8px;
  background: rgba(2, 12, 22, 0.46);
  color: #9de8ff;
  white-space: nowrap;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.usen-ticker[hidden],
.usen-ticker.off {
  display: none;
}

.usen-ticker span {
  display: inline-block;
  min-width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.2;
  text-shadow: 0 0 10px rgba(52, 168, 255, 0.45);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.usen-ticker.scrolling span {
  padding-left: 100%;
  animation: usen-scroll 38s linear infinite;
}

@keyframes usen-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-100%, 0, 0);
  }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(126, 166, 204, 0.28);
  border-radius: 8px;
  background: rgba(7, 22, 37, 0.72);
  color: #d9ecff;
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(52, 168, 255, 0.65);
  color: #73caff;
}

.clock-block {
  display: grid;
  min-width: 128px;
  text-align: right;
  line-height: 1.1;
}

.clock-block span:first-child {
  font-size: 21px;
  font-weight: 680;
}

.clock-block span:last-child {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.compass {
  position: absolute;
  top: 96px;
  left: 22px;
  z-index: 500;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px dashed rgba(188, 211, 233, 0.5);
  border-radius: 50%;
  background: rgba(5, 16, 27, 0.62);
  color: #dceeff;
  box-shadow: var(--shadow);
}

.compass span {
  position: absolute;
  top: 7px;
  font-size: 12px;
  font-weight: 700;
}

.compass strong {
  color: var(--cyan);
  font-size: 18px;
}

.legend {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 500;
  display: grid;
  gap: 9px;
  min-width: 168px;
  padding: 14px 15px;
  border: 1px solid rgba(126, 166, 204, 0.24);
  border-radius: 8px;
  background: rgba(5, 15, 26, 0.82);
  box-shadow: var(--shadow);
  color: #c9daec;
  font-size: 12px;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 18px;
}

.legend span {
  display: inline-grid;
  place-items: center;
  width: 15px;
  min-width: 15px;
}

.legend-aircraft {
  color: #eef6ff;
}

.legend-airport {
  color: var(--cyan);
}

.legend-vor {
  color: var(--green);
}

.legend-ndb {
  color: var(--purple);
}

.legend-fix {
  color: #69dfbf;
}

.legend-route {
  height: 1px;
  border-top: 2px dashed rgba(52, 168, 255, 0.9);
}

.legend-low-route {
  height: 1px;
  border-top: 2px dashed rgba(104, 221, 164, 0.9);
}

.legend-terminal-route {
  height: 1px;
  border-top: 2px dashed rgba(240, 195, 106, 0.95);
}

.legend-jr-route {
  height: 1px;
  border-top: 3px solid rgba(240, 195, 106, 0.95);
}

.legend-train {
  width: 14px;
  height: 9px;
  border: 1px solid rgba(240, 195, 106, 0.95);
  border-radius: 3px;
  background: rgba(240, 195, 106, 0.32);
  box-shadow: 0 0 12px rgba(240, 195, 106, 0.35);
}

.legend-weather {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(73, 182, 255, 0.78), rgba(116, 219, 105, 0.74), rgba(240, 195, 106, 0.76));
  box-shadow: 0 0 12px rgba(73, 182, 255, 0.35);
}

.side-panel {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  overflow-y: auto;
  padding: 80px 10px 10px;
  background:
    linear-gradient(180deg, rgba(7, 18, 31, 0.94), rgba(3, 9, 16, 0.98)),
    #07121f;
  transition: transform 260ms ease, opacity 220ms ease;
}

.settings-dialog {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 6, 12, 0.72);
}

.settings-dialog[hidden] {
  display: none;
}

.settings-panel {
  width: min(620px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(90, 150, 205, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(9, 24, 39, 0.98), rgba(3, 10, 18, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.54);
  color: var(--text);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid rgba(126, 166, 204, 0.18);
}

.settings-header span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.settings-header h2 {
  margin: 4px 0 0;
  font-size: 21px;
  line-height: 1.15;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 18px 20px 12px;
}

.settings-grid label {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(126, 166, 204, 0.18);
  border-radius: 8px;
  background: rgba(3, 13, 23, 0.68);
}

.settings-grid label > span {
  color: #d8e8f8;
  font-size: 13px;
  font-weight: 700;
}

.settings-grid input {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(126, 166, 204, 0.28);
  border-radius: 7px;
  background: rgba(1, 7, 13, 0.84);
  color: #ffffff;
  padding: 0 10px;
  font-size: 15px;
}

.settings-grid small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.usen-settings-section {
  margin: 2px 20px 12px;
  border: 1px solid rgba(52, 168, 255, 0.18);
  border-radius: 8px;
  background: rgba(2, 11, 20, 0.42);
}

.settings-subtitle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 13px 0;
}

.settings-subtitle span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 22px;
  border: 1px solid rgba(52, 168, 255, 0.32);
  border-radius: 999px;
  color: #8fdfff;
  font-size: 11px;
  font-weight: 800;
}

.settings-subtitle strong {
  color: #d8e8f8;
  font-size: 13px;
}

.usen-settings-grid {
  padding: 13px;
}

.settings-grid label.wide {
  grid-column: 1 / -1;
}

.settings-check {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.settings-check input[type="checkbox"] {
  width: 42px;
  height: 22px;
  padding: 0;
  appearance: none;
  border-radius: 999px;
  cursor: pointer;
}

.settings-check input[type="checkbox"]::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 2px;
  border-radius: 50%;
  background: #6d8195;
  transition: transform 160ms ease, background 160ms ease;
}

.settings-check input[type="checkbox"]:checked {
  border-color: rgba(52, 168, 255, 0.9);
  background: rgba(52, 168, 255, 0.35);
}

.settings-check input[type="checkbox"]:checked::before {
  transform: translateX(19px);
  background: #ecf7ff;
}

.settings-check small {
  grid-column: 1 / -1;
}

.usen-refresh-box {
  display: grid;
  gap: 8px;
  align-content: center;
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(126, 166, 204, 0.18);
  border-radius: 8px;
  background: rgba(3, 13, 23, 0.68);
}

.usen-refresh-box small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.settings-message {
  min-height: 22px;
  margin: 0;
  padding: 0 20px 14px;
  color: #9eb7d0;
  font-size: 12px;
}

.settings-message.error {
  color: var(--danger);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(126, 166, 204, 0.14);
}

.text-button {
  min-width: 86px;
  height: 36px;
  border: 1px solid rgba(126, 166, 204, 0.28);
  border-radius: 8px;
  background: rgba(7, 22, 37, 0.74);
  color: #d9ecff;
  cursor: pointer;
}

.text-button.primary {
  border-color: rgba(52, 168, 255, 0.72);
  background: rgba(21, 105, 164, 0.52);
  color: #ffffff;
}

.panel-section {
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 31, 51, 0.84), rgba(6, 16, 28, 0.86));
  box-shadow: 0 10px 42px rgba(0, 0, 0, 0.2);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 13px 10px;
  border-bottom: 1px solid rgba(126, 166, 204, 0.16);
}

.section-title span {
  color: #a8c6e3;
}

.section-title h2,
.status-card h2 {
  margin: 0;
  color: #c7d8ea;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.metric {
  min-width: 0;
  padding: 12px 8px 10px;
  border: 1px solid rgba(126, 166, 204, 0.18);
  border-radius: 8px;
  background: rgba(3, 13, 24, 0.42);
  text-align: center;
}

.metric span,
.metric small {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 6px 0 4px;
  color: #58bdff;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1;
}

.status-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px;
}

.status-card > div + div {
  padding-left: 14px;
  border-left: 1px solid rgba(126, 166, 204, 0.16);
}

.status-card p {
  margin: 10px 0 5px;
  color: #cfe2f6;
  font-size: 13px;
}

.status-card small {
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.status-dot.warning {
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
}

.status-dot.danger {
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger);
}

.layer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 12px;
  padding: 13px;
}

.layer-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: #c7d8ea;
  font-size: 12px;
}

.layer-grid input {
  order: 2;
  width: 36px;
  height: 19px;
  margin: 0;
  appearance: none;
  border: 1px solid rgba(126, 166, 204, 0.3);
  border-radius: 999px;
  background: rgba(1, 8, 15, 0.8);
  cursor: pointer;
}

.layer-grid input::before {
  content: "";
  display: block;
  width: 15px;
  height: 15px;
  margin: 1px;
  border-radius: 50%;
  background: #6d8195;
  transition: transform 160ms ease, background 160ms ease;
}

.layer-grid input:checked {
  border-color: rgba(52, 168, 255, 0.9);
  background: rgba(52, 168, 255, 0.35);
}

.layer-grid input:checked::before {
  transform: translateX(17px);
  background: #ecf7ff;
}

.aircraft-list-section {
  min-height: 220px;
}

.aircraft-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.aircraft-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.aircraft-table th,
.aircraft-table td {
  padding: 10px 9px;
  border-bottom: 1px solid rgba(126, 166, 204, 0.12);
  overflow: hidden;
  color: #d8e7f6;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aircraft-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

.aircraft-table td:nth-child(2),
.aircraft-table td:nth-child(3) {
  color: #a9d9ff;
}

.train-table td:nth-child(2) {
  color: #f3d08a;
}

.train-table tr.delay-minor td:nth-child(3) {
  color: var(--amber);
}

.train-table tr.delay-major td:nth-child(3) {
  color: var(--danger);
}

.line-chip {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--line-color);
  box-shadow: 0 0 10px var(--line-color);
  vertical-align: -1px;
}

.bottom-bar {
  grid-column: 2 / 4;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
  padding: 0 28px;
  border-top: 1px solid rgba(88, 145, 196, 0.22);
  background: linear-gradient(180deg, rgba(7, 18, 31, 0.94), rgba(3, 9, 16, 0.98));
  color: #c8d9ea;
  font-size: 12px;
  transition: transform 260ms ease, opacity 220ms ease;
}

.bottom-bar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-bar i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  vertical-align: -1px;
}

.bottom-bar i.warning {
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
}

.bottom-bar i.danger {
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger);
}

.bottom-bar .message {
  margin-left: auto;
  color: #a9bbcd;
}

.aircraft-marker,
.train-marker,
.jr-station-marker,
.airport-marker,
.navaid-marker,
.fix-marker,
.route-label-marker {
  background: transparent;
  border: 0;
}

.aircraft-marker-inner {
  position: relative;
  width: 130px;
  height: 48px;
}

.aircraft-symbol {
  position: absolute;
  top: 8px;
  left: 6px;
  width: 26px;
  height: 26px;
  color: #f2f7ff;
  font-size: 28px;
  line-height: 1;
  text-shadow: 0 0 13px rgba(188, 225, 255, 0.9);
  transform: rotate(var(--heading));
  transform-origin: 50% 50%;
}

.aircraft-label,
.marker-label,
.route-label {
  position: absolute;
  min-width: 76px;
  border: 1px solid rgba(92, 159, 214, 0.28);
  border-radius: 7px;
  background: rgba(2, 10, 18, 0.76);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  color: #e9f5ff;
  pointer-events: none;
}

.aircraft-label {
  top: 0;
  left: 38px;
  padding: 6px 7px;
}

.aircraft-label strong,
.marker-label strong {
  display: block;
  color: #f7fbff;
  font-size: 11px;
  line-height: 1.1;
}

.aircraft-label span,
.marker-label span {
  display: block;
  margin-top: 3px;
  color: #43baff;
  font-size: 10px;
  line-height: 1.1;
}

.facility-marker-inner {
  position: relative;
  width: 126px;
  height: 48px;
}

.facility-pin,
.fix-pin {
  position: absolute;
  top: 8px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 13px;
  line-height: 1;
}

.airport-pin {
  border: 1px solid rgba(52, 168, 255, 0.88);
  border-radius: 50%;
  background: rgba(52, 168, 255, 0.22);
  color: #d8f0ff;
  box-shadow: 0 0 12px rgba(52, 168, 255, 0.38);
}

.vor-pin {
  border: 1px solid rgba(139, 220, 115, 0.9);
  border-radius: 50%;
  color: var(--green);
  box-shadow: 0 0 12px rgba(139, 220, 115, 0.3);
}

.ndb-pin {
  border: 1px solid rgba(187, 115, 239, 0.92);
  border-radius: 50%;
  color: var(--purple);
  box-shadow: 0 0 12px rgba(187, 115, 239, 0.28);
}

.tacan-pin {
  border: 1px solid rgba(240, 195, 106, 0.92);
  border-radius: 50%;
  color: var(--amber);
  box-shadow: 0 0 12px rgba(240, 195, 106, 0.28);
}

.fix-pin {
  top: 11px;
  left: 10px;
  width: 16px;
  height: 16px;
  border: 1px solid #67dfbd;
  background: rgba(39, 150, 125, 0.24);
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(103, 223, 189, 0.28);
}

.marker-label {
  top: 2px;
  left: 38px;
  max-width: 118px;
  padding: 6px 7px;
}

.airport-label span {
  color: #7bcaff;
}

.vor-label span {
  color: #a6eb89;
}

.ndb-label span,
.tacan-label span {
  color: #dda9ff;
}

.fix-label span {
  color: #75e3c2;
}

.route-label {
  position: static;
  display: inline-block;
  min-width: 0;
  padding: 4px 7px;
  color: #7dc7ff;
  font-size: 11px;
  font-weight: 700;
}

.route-label-low {
  border-color: rgba(104, 221, 164, 0.32);
  color: #94e8bd;
}

.route-label-terminal {
  border-color: rgba(240, 195, 106, 0.36);
  color: #f4d58d;
}

.route-line {
  filter: drop-shadow(0 0 5px rgba(52, 168, 255, 0.5));
}

.route-line-low {
  filter: drop-shadow(0 0 5px rgba(104, 221, 164, 0.42));
}

.route-line-terminal {
  filter: drop-shadow(0 0 6px rgba(240, 195, 106, 0.45));
}

.jr-route-line {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jr-route-glow {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jr-route-center {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaflet-marker-icon.train-marker {
  transition: transform 4800ms linear;
  will-change: transform;
}

.leaflet-zoom-anim .leaflet-marker-icon.train-marker,
.leaflet-dragging .leaflet-marker-icon.train-marker {
  transition: none;
}

.train-marker-inner {
  position: relative;
  width: 168px;
  height: 58px;
}

.train-symbol {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--line-color) 72%, #ffffff 12%);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--line-color) 24%, transparent), transparent 66%),
    rgba(3, 17, 28, 0.9);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--line-color) 18%, transparent),
    0 0 20px color-mix(in srgb, var(--line-color) 58%, transparent),
    0 0 44px color-mix(in srgb, var(--line-color) 26%, transparent);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.train-front-icon {
  position: absolute;
  inset: 4px;
  width: 36px;
  height: 36px;
  overflow: visible;
}

.train-track,
.train-frame,
.train-cab,
.train-destination,
.train-window,
.train-nose {
  vector-effect: non-scaling-stroke;
}

.train-track {
  fill: none;
  stroke: color-mix(in srgb, var(--line-color) 60%, #dfffee 40%);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}

.train-frame {
  fill: rgba(6, 25, 36, 0.96);
  stroke: color-mix(in srgb, var(--line-color) 64%, #ffffff 36%);
  stroke-width: 2.8;
}

.train-cab {
  fill: rgba(255, 255, 245, 0.98);
  stroke: color-mix(in srgb, var(--line-color) 50%, #ffffff 50%);
  stroke-width: 1.2;
}

.train-destination {
  fill: color-mix(in srgb, var(--line-dark) 72%, #02111d 28%);
}

.train-window {
  fill: rgba(15, 55, 70, 0.92);
  stroke: color-mix(in srgb, var(--line-color) 36%, #ffffff 20%);
  stroke-width: 1.1;
}

.train-nose {
  fill: none;
  stroke: color-mix(in srgb, var(--line-dark) 72%, #0c1d2a 28%);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.train-headlight {
  fill: color-mix(in srgb, var(--line-color) 52%, #fff7bf 48%);
}

.train-wheel {
  fill: color-mix(in srgb, var(--line-dark) 76%, #06131e 24%);
  stroke: color-mix(in srgb, var(--line-color) 50%, #ffffff 15%);
  stroke-width: 0.7;
}

.train-delay-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 5px;
  border: 2px solid rgba(255, 238, 188, 0.9);
  border-radius: 999px;
  background: rgba(12, 9, 4, 0.94);
  color: #ffe28c;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(240, 195, 106, 0.54);
}

.train-label {
  position: absolute;
  top: 2px;
  left: 58px;
  min-width: 98px;
  max-width: 148px;
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--line-color) 48%, transparent);
  border-radius: 7px;
  background: rgba(2, 10, 18, 0.78);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.train-label strong {
  display: block;
  overflow: hidden;
  color: #fff6db;
  font-size: 11px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.train-label span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--line-color);
  font-size: 10px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.train-marker.delay-minor .train-symbol,
.train-marker.delay-minor .train-label {
  border-color: rgba(240, 195, 106, 0.86);
  box-shadow: 0 0 18px rgba(240, 195, 106, 0.38);
}

.train-marker.delay-major .train-symbol,
.train-marker.delay-major .train-label {
  border-color: rgba(255, 113, 109, 0.86);
  box-shadow: 0 0 16px rgba(255, 113, 109, 0.35);
}

.train-marker:hover .train-symbol,
.train-marker.selected .train-symbol {
  transform: scale(1.09);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--line-color) 42%, transparent),
    0 0 24px color-mix(in srgb, var(--line-color) 82%, transparent),
    0 0 56px color-mix(in srgb, var(--line-color) 42%, transparent);
}

.jr-station-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border: 1px solid var(--line-color, rgba(240, 195, 106, 0.96));
  border-radius: 50%;
  background: rgba(2, 10, 18, 0.92);
  box-shadow: 0 0 12px color-mix(in srgb, var(--line-color, #f0c36a) 48%, transparent);
}

.jr-station-dot.major {
  width: 15px;
  height: 15px;
  background: color-mix(in srgb, var(--line-color, #f0c36a) 30%, transparent);
}

.jr-station-label {
  top: -4px;
  left: 22px;
  border-color: rgba(240, 195, 106, 0.24);
}

.jr-station-label.minor {
  display: none;
}

.jr-station-label span {
  color: #f0c36a;
}

.weather-radar-tile {
  mix-blend-mode: normal;
}

.labels-off .aircraft-label,
.labels-off .train-label,
.labels-off .marker-label,
.labels-off .route-label {
  display: none;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border: 1px solid rgba(126, 166, 204, 0.35);
  background: rgba(3, 12, 22, 0.95);
  color: #dfedfc;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.45);
}

.leaflet-popup-content {
  min-width: 210px;
  margin: 13px 15px;
  font-size: 12px;
}

.popup-title {
  margin: 0 0 9px;
  color: #ffffff;
  font-size: 16px;
}

.popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
}

.popup-grid span {
  color: var(--muted);
}

.popup-grid strong {
  color: #dff2ff;
  font-weight: 650;
}

.panel-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr) 0;
  grid-template-rows: minmax(0, 1fr) 0;
}

.panel-collapsed .rail {
  transform: translateX(-78px);
  opacity: 0;
  pointer-events: none;
}

.panel-collapsed .radar-stage {
  grid-column: 1 / 4;
  border-right-color: transparent;
}

.panel-collapsed .side-panel {
  position: fixed;
  top: 0;
  bottom: 62px;
  left: 0;
  z-index: 680;
  width: min(392px, calc(100vw - 42px));
  padding: 80px 10px 10px;
  transform: translateX(calc(-100% - 16px));
  opacity: 0;
  pointer-events: none;
}

.panel-collapsed .bottom-bar {
  grid-column: 1 / 4;
  transform: translateY(70px);
  opacity: 0;
  pointer-events: none;
}

.panel-collapsed .panel-toggle-button::after {
  transform: rotate(-45deg);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 58px minmax(0, 1fr) 330px;
  }

  .rail-button {
    width: 38px;
    height: 38px;
  }

  .metric-grid,
  .status-card,
  .layer-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .status-card > div + div {
    padding-left: 0;
    padding-top: 12px;
    border-left: 0;
    border-top: 1px solid rgba(126, 166, 204, 0.16);
  }

  .bottom-bar {
    gap: 14px;
    padding: 0 16px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 54px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 54px;
  }

  .side-panel {
    position: absolute;
    grid-column: 1 / -1;
    grid-row: 1;
    top: 78px;
    right: 8px;
    z-index: 650;
    width: min(342px, calc(100vw - 78px));
    max-height: calc(100vh - 148px);
    padding: 0;
    border: 1px solid rgba(90, 150, 205, 0.28);
    border-radius: 8px;
  }

  .bottom-bar {
    grid-column: 2;
  }

  .brand-copy h1 {
    font-size: 20px;
  }

  .clock-block {
    display: none;
  }

  .usen-ticker {
    display: none;
  }

  .legend {
    max-width: 150px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-columns: 46px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 46px;
    transform: none;
  }

  .rail {
    gap: 8px;
    padding-top: 12px;
  }

  .rail-button {
    width: 36px;
    height: 36px;
  }

  .rail-button:not(.active):not(#settingsButton) {
    display: none;
  }

  .topbar {
    height: 60px;
    gap: 8px;
    padding: 9px 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    box-shadow: inset 0 0 0 6px rgba(52, 168, 255, 0.06), 0 0 18px rgba(52, 168, 255, 0.2);
  }

  .brand-mark::before {
    inset: 6px;
  }

  .brand-mark span {
    top: 4px;
    left: 16px;
    width: 17px;
  }

  .brand-copy {
    min-width: 0;
    flex: 1;
  }

  .brand-copy h1 {
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-copy p,
  .legend {
    display: none;
  }

  #map .aircraft-label,
  #map .train-label,
  #map .marker-label,
  #map .route-label {
    display: none;
  }

  .leaflet-marker-icon.aircraft-marker,
  .leaflet-marker-icon.airport-marker,
  .leaflet-marker-icon.navaid-marker,
  .leaflet-marker-icon.fix-marker,
  .leaflet-marker-icon.jr-station-marker {
    width: 38px !important;
    height: 38px !important;
  }

  .leaflet-marker-icon.train-marker {
    width: 48px !important;
    height: 48px !important;
  }

  .aircraft-marker-inner,
  .facility-marker-inner {
    width: 38px;
    height: 38px;
  }

  .train-marker-inner {
    width: 48px;
    height: 48px;
  }

  .train-symbol {
    width: 40px;
    height: 40px;
  }

  .train-front-icon {
    inset: 4px;
    width: 32px;
    height: 32px;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions .icon-button {
    width: 34px;
    height: 34px;
  }

  .panel-toggle-button {
    top: 76px;
    left: 12px;
    width: 38px;
    height: 42px;
  }

  .compass {
    top: 128px;
    left: 12px;
    width: 46px;
    height: 46px;
  }

  .side-panel {
    position: fixed;
    top: auto;
    right: 6px;
    bottom: 52px;
    left: 52px;
    width: auto;
    max-height: 44vh;
    border-radius: 12px 12px 0 0;
    background: rgba(3, 12, 22, 0.96);
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.48);
  }

  body:not(.panel-collapsed) .side-panel {
    transform: none;
    opacity: 1;
    pointer-events: auto;
    transition: none;
  }

  .panel-section {
    padding: 12px;
  }

  .bottom-bar {
    grid-column: 2;
    gap: 8px;
    padding: 0 10px;
    font-size: 10px;
  }

  .bottom-bar #sourceText,
  .bottom-bar #qualityState,
  .bottom-bar #refreshInterval,
  .bottom-bar .message {
    display: none;
  }

  .bottom-bar #connectionState,
  .bottom-bar #lastUpdated {
    flex: 1;
  }

  .leaflet-control-zoom a {
    width: 38px !important;
    height: 38px !important;
    line-height: 36px !important;
  }

  .settings-dialog {
    padding: 8px;
  }

  .settings-panel {
    max-height: calc(100vh - 16px);
    border-radius: 12px;
  }
}
