* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { width: 100%; height: 100%; overflow: hidden; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: #aad3df; }

#map { position: absolute; inset: 0; z-index: 0; }

.leaflet-container { background: #b5d0d0; }

#hud {
  position: absolute; top: 12px; left: 12px; z-index: 1000;
  background: rgba(8, 20, 32, 0.82);
  color: #d7f4ff; border: 1px solid rgba(120, 220, 255, 0.35);
  border-radius: 10px; padding: 10px 12px; min-width: 300px;
  backdrop-filter: blur(4px); box-shadow: 0 4px 18px rgba(0,0,0,0.35);
  pointer-events: none;
}
.hud-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid rgba(120,220,255,0.25); padding-bottom: 6px; margin-bottom: 8px;
}
.callsign { font-weight: 700; letter-spacing: 2px; font-size: 15px; color: #7be0ff; }
.mode { font-size: 12px; color: #9ff09f; background: rgba(40,120,60,0.35); padding: 2px 8px; border-radius: 20px; }
.hud-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
}
.stat { display: flex; align-items: baseline; justify-content: space-between; }
.stat label { font-size: 11px; color: #8fb6c8; }
.stat span { font-size: 14px; font-weight: 600; color: #eaffff; font-variant-numeric: tabular-nums; }
.stat small { font-size: 10px; color: #8fb6c8; margin-left: 2px; }

#controls {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1000; background: rgba(8, 20, 32, 0.85);
  border: 1px solid rgba(120,220,255,0.35); border-radius: 10px;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 8px;
  width: min(560px, 94vw); color: #d7f4ff; backdrop-filter: blur(4px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}
.ctrl-row { display: flex; align-items: center; gap: 10px; }
.ctrl-row label { font-size: 13px; color: #9fd0e2; width: 40px; }
#controls button {
  background: rgba(60, 130, 170, 0.35); color: #e8fbff; border: 1px solid rgba(120,220,255,0.4);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  transition: background 0.15s; font-family: inherit;
}
#controls button:hover { background: rgba(90, 180, 220, 0.5); }
#controls button:active { transform: translateY(1px); }
input[type="range"] { flex: 1; accent-color: #3fc8ff; }

#feed {
  position: absolute; right: 12px; top: 12px; bottom: 12px; z-index: 1000;
  width: min(300px, 30vw); background: rgba(8, 20, 32, 0.82);
  border: 1px solid rgba(120,220,255,0.3); border-radius: 10px;
  display: flex; flex-direction: column; backdrop-filter: blur(4px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.3); overflow: hidden;
}
.feed-title {
  padding: 8px 12px; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: #7be0ff; border-bottom: 1px solid rgba(120,220,255,0.2);
}
#feed-list { flex: 1; overflow-y: auto; padding: 8px 10px; }
.feed-item {
  background: rgba(255,255,255,0.05); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px; font-size: 12px;
  border-left: 3px solid #3fc8ff; animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.feed-item.highlight { border-left-color: #ffb03f; background: rgba(255,176,63,0.1); }
.feed-handle { color: #7be0ff; font-weight: 600; margin-right: 6px; }
.feed-time { color: #7a9db0; font-size: 10px; }
.feed-text { color: #dfeef4; margin-top: 3px; line-height: 1.45; }

#feed-list::-webkit-scrollbar { width: 6px; }
#feed-list::-webkit-scrollbar-thumb { background: rgba(120,220,255,0.3); border-radius: 3px; }

#telemetry {
  position: absolute; left: 12px; bottom: 12px; z-index: 1000;
  width: 320px; background: rgba(8, 20, 32, 0.85);
  border: 1px solid rgba(120,220,255,0.35); border-radius: 10px;
  display: flex; flex-direction: column; backdrop-filter: blur(4px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.35); overflow: hidden;
}
.tabbar { display: flex; border-bottom: 1px solid rgba(120,220,255,0.2); }
.tab {
  flex: 1; background: transparent; border: none; color: #9fd0e2;
  padding: 8px 0; font-size: 12px; cursor: pointer; font-family: inherit;
  letter-spacing: 1px; transition: background 0.15s, color 0.15s;
}
.tab:hover { background: rgba(60,130,170,0.25); }
.tab.active { color: #7be0ff; background: rgba(63,200,255,0.12); border-bottom: 2px solid #3fc8ff; }
.tabpanel { padding: 10px 12px; min-height: 108px; }
.tabpanel.hidden { display: none; }
.xpdr-code {
  font-size: 34px; font-weight: 800; letter-spacing: 4px; color: #ffd23f;
  font-variant-numeric: tabular-nums; text-align: center;
  text-shadow: 0 0 12px rgba(255,210,63,0.4);
}
.xpdr-msg { font-size: 13px; color: #eaffff; text-align: center; margin: 4px 0 8px; min-height: 18px; }
.xpdr-meta { display: flex; justify-content: space-between; font-size: 11px; color: #8fb6c8; }
.xpdr-meta b { color: #d7f4ff; }
#log-list { max-height: 108px; overflow-y: auto; }
#log-list::-webkit-scrollbar { width: 6px; }
#log-list::-webkit-scrollbar-thumb { background: rgba(120,220,255,0.3); border-radius: 3px; }
.log-item { font-size: 11px; color: #bcd6e2; padding: 3px 0; border-bottom: 1px dashed rgba(120,220,255,0.1); }
.log-item .t { color: #7a9db0; margin-right: 6px; }
.log-item mark { background: transparent; color: #ffd23f; }

@media (max-width: 860px) {
  #hud { min-width: 0; width: 92vw; }
  #feed { position: static; width: 92vw; max-height: 26vh; margin: 10px auto 0; order: 2; }
  #telemetry { position: static; width: 92vw; margin: 10px auto 0; order: 4; }
  body { display: flex; flex-direction: column; }
  #controls { position: static; transform: none; margin: 10px auto 0; order: 3; width: 92vw; }
}
