:root {
  --bg: rgba(12, 16, 22, 0.78);
  --bg2: rgba(25, 32, 42, 0.9);
  --line: rgba(120, 150, 180, 0.25);
  --fg: #d8e2ec;
  --dim: #8a9aab;
  --acc: #ffa640;
  --good: #4cd98a;
  --warn: #ffcc4d;
  --bad: #ff5a5a;
  --blue: #4fc3f7;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  color: var(--fg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.login, .overlay, .errbox, .hud > *, .hangar > * { pointer-events: auto; }
.hud, .hangar { position: absolute; inset: 0; pointer-events: none; }
.hud .toasts, .hud .bigwarn, .hangar .toasts, .vlabels, .map-labels { pointer-events: none; }
button, input, select { font: inherit; color: inherit; }

.btn {
  background: #243142; border: 1px solid #3b4d63; color: var(--fg); padding: 5px 10px; border-radius: 5px;
  cursor: pointer; white-space: nowrap; transition: background 0.1s;
}
.btn:hover { background: #2f4158; }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.on { background: #2f6b4a; border-color: #4cd98a; }
.btn.good { background: #1f5a3c; border-color: #3fae74; }
.btn.good:hover { background: #267049; }
.btn.warn { background: #5a2626; border-color: #a64545; }
.btn.big { padding: 8px 18px; font-size: 15px; font-weight: 600; }
.btn.small { padding: 2px 8px; }
.btn.tiny { padding: 1px 6px; font-size: 11px; }
input, select { background: #151c25; border: 1px solid #3b4d63; border-radius: 5px; padding: 5px 8px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; }
.hint { color: var(--dim); font-size: 11px; font-weight: normal; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

.panel { position: absolute; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; backdrop-filter: blur(4px); }
.panel .title { font-weight: 600; color: var(--acc); margin: 2px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.kv .k { color: var(--dim); }
.kv .v { font-variant-numeric: tabular-nums; text-align: right; }
.kv.bad .v { color: var(--bad); }

/* ---------- Login ---------- */
.login { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; padding: 40px 50px; background: radial-gradient(circle at 50% 30%, #1d2a3d, #0a0e14); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px #000a; }
.logo { font-weight: 800; letter-spacing: 0.25em; color: var(--acc); font-size: 20px; }
.logo span { color: var(--fg); letter-spacing: 0.05em; font-weight: 400; }
.logo.big { font-size: 56px; text-shadow: 0 0 30px #ffa64055; }
.login .sub { color: var(--dim); margin: 6px 0 24px; }
.login .name { width: 220px; font-size: 15px; padding: 8px 12px; }
.login .row { justify-content: center; }
.loginmsg { min-height: 20px; margin-top: 10px; color: var(--warn); }
.features { text-align: left; color: var(--dim); margin: 16px auto 0; max-width: 420px; line-height: 1.7; }

/* ---------- Hangar ---------- */
.hbar { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.hbar .spacer { flex: 1; }
.hbar input.name { width: 200px; }
.palette { top: 58px; left: 10px; bottom: 10px; width: 270px; overflow-y: auto; }
.palette .cat { color: var(--acc); font-size: 11px; text-transform: uppercase; margin: 10px 0 4px; letter-spacing: 0.05em; }
.palette .part { padding: 5px 8px; border-radius: 5px; cursor: pointer; border: 1px solid transparent; }
.palette .part:hover { background: #243142; border-color: #3b4d63; }
.palette .part .pname { display: block; }
.palette .part .pinfo { display: block; font-size: 11px; color: var(--dim); }
.palette .part.radial .pname::after { content: ' ⟂'; color: var(--blue); }
.rightcol { position: absolute; top: 58px; right: 10px; bottom: 10px; width: 380px; display: flex; flex-direction: column; gap: 8px; }
.rightcol .panel { position: relative; min-height: 0; }
.stackpanel { flex: 1 1 58%; display: flex; flex-direction: column; }
.stackpanel .stack { overflow-y: auto; flex: 1; padding-right: 2px; }
.statspanel { flex: 1 1 42%; overflow-y: auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 4px 12px; cursor: pointer; color: var(--dim); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.04em; }
.tab.on { color: var(--acc); border-bottom-color: var(--acc); }
.symsel { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-bottom: 6px; }
.symsel .k { color: var(--dim); font-size: 11px; margin-right: 4px; }
.symsel .btn.on { background: #22344a; border-color: var(--blue); color: var(--blue); }
.subbox { margin: 4px 0 2px 14px; padding: 4px 4px 4px 8px; border-left: 2px solid #35516e; border-radius: 0 6px 6px 0; background: #111a24; cursor: pointer; }
.subbox.sel { border-left-color: var(--blue); background: #16263a; }
.subbox .chip.head { display: inline-flex; margin-bottom: 3px; }
.chip { display: inline-flex; align-items: center; gap: 2px; }
.chip .symbox { padding: 0 2px; font-size: 11px; border-radius: 4px; background: #0f1720; color: var(--blue); border-color: #35516e; }
.chip .dy { color: var(--dim); font-size: 10px; }
.cbtn { cursor: pointer; color: var(--dim); padding: 0 2px; font-size: 10px; }
.cbtn:hover { color: var(--fg); }
.cbtn.on { color: var(--blue); }
.stagehead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; color: var(--dim); }
.stagebox { background: #121b26; border: 1px solid #2a3a4d; border-radius: 6px; padding: 5px 6px; }
.stagebox.over { border-color: var(--acc); background: #20283a; }
.stagetitle { margin-bottom: 4px; }
.stagetitle b { color: var(--acc); }
.schip { display: flex; align-items: center; gap: 6px; padding: 3px 6px; margin: 2px 0; border-radius: 4px; background: #1a2533; border-left: 3px solid #888; cursor: grab; font-size: 12px; }
.schip.eng { border-left-color: var(--acc); }
.schip.dec { border-left-color: var(--warn); }
.schip.chute { border-left-color: var(--blue); }
.schip .grip { color: var(--dim); }
.schip .verb { margin-left: auto; color: var(--dim); font-size: 10px; }
.dropzone { height: 8px; margin: 2px 0; border-radius: 3px; }
.dropzone.over { height: 18px; background: #ffa64033; outline: 1px dashed var(--acc); }
.srow { padding: 4px 6px; border-radius: 5px; cursor: pointer; border: 1px solid transparent; }
.srow:hover { background: #1c2632; }
.srow.sel { background: #22344a; border-color: var(--blue); }
.sline { display: flex; justify-content: space-between; align-items: center; }
.sbtns { display: flex; gap: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chip { background: #1a2a3a; border: 1px solid #35516e; border-radius: 10px; padding: 0 6px; font-size: 11px; }
.chip .sym { color: var(--blue); cursor: pointer; font-weight: 600; }
.chip .x { color: var(--bad); cursor: pointer; }
.stagetable, .tracktable { width: 100%; border-collapse: collapse; margin: 6px 0; font-variant-numeric: tabular-nums; }
.stagetable th, .stagetable td, .tracktable th, .tracktable td { padding: 2px 6px; text-align: right; border-bottom: 1px solid #ffffff10; }
.stagetable th:first-child, .stagetable td:first-child, .tracktable td, .tracktable th { text-align: left; }
.stagetable .bad { color: var(--bad); }
.warns { margin: 8px 0; color: var(--warn); }

/* ---------- Dialoge ---------- */
.overlay { position: absolute; inset: 0; background: #0008; display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.overlay.hidden { display: none; }
.dialog { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; min-width: 320px; max-width: 640px; max-height: 85vh; overflow-y: auto; box-shadow: 0 10px 40px #000c; }
.dialog.wide { max-width: 900px; width: 80vw; }
.dialog h2 { margin: 0 0 10px; color: var(--acc); }
.dialog h3 { margin: 14px 0 4px; color: var(--blue); font-size: 14px; }
.dialog p { line-height: 1.5; color: #c3cfdb; }
.dialog.lost h2 { color: var(--bad); }
.help table td { padding: 2px 10px 2px 0; }
.help td.key { color: var(--acc); font-weight: 600; white-space: nowrap; }
.errbox { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: #400; border: 1px solid var(--bad); padding: 10px; max-width: 80vw; white-space: pre-wrap; font-family: monospace; font-size: 11px; max-height: 40vh; overflow: auto; z-index: 99; }

/* ---------- Meldungen ---------- */
.toasts { position: absolute; top: 118px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.toast { background: var(--bg2); border-left: 3px solid var(--blue); padding: 5px 12px; border-radius: 4px; transition: opacity 1s; }
.toast.good { border-color: var(--good); }
.toast.warn { border-color: var(--warn); }
.toast.bad { border-color: var(--bad); color: #ffc9c9; }
.toast.fade { opacity: 0; }
.bigwarn { position: absolute; top: 32%; left: 50%; transform: translateX(-50%); font-size: 26px; font-weight: 800; color: var(--bad); text-shadow: 0 0 12px #000; animation: blink 0.6s infinite alternate; letter-spacing: 0.08em; }
@keyframes blink { from { opacity: 1; } to { opacity: 0.35; } }

/* ---------- Flug-HUD ---------- */
.top-center { top: 8px; left: 50%; transform: translateX(-50%); text-align: center; min-width: 300px; }
.top-center .row { justify-content: center; }
.ut { font-size: 15px; font-variant-numeric: tabular-nums; min-width: 170px; }
.warp { display: flex; justify-content: center; gap: 3px; margin: 5px 0 3px; }
.pip { min-width: 12px; height: 12px; border-radius: 2px; background: #2a3441; font-size: 10px; line-height: 12px; padding: 0 2px; }
.pip.on { background: var(--good); color: #000; }
.pip.on.rails { background: var(--acc); }
.subspace { font-size: 11px; color: var(--dim); }
.subspace.ahead { color: var(--acc); }
.top-left { top: 10px; left: 10px; width: 250px; }
.flightdata .title { display: flex; justify-content: space-between; text-transform: none; }
.status { color: var(--blue); font-weight: 400; }
.status.good { color: var(--good); }
.left-mid { top: 272px; left: 10px; width: 250px; }
.loadbar { display: grid; grid-template-columns: 70px 1fr; grid-template-rows: auto auto; column-gap: 6px; margin: 3px 0; align-items: center; }
.loadbar .lbl { color: var(--dim); font-size: 11px; }
.loadbar .track { position: relative; height: 8px; background: #1b2430; border-radius: 4px; overflow: hidden; }
.loadbar .fill { height: 100%; width: 0; background: var(--good); transition: width 0.1s; }
.loadbar .fill.mid { background: #b7d94c; }
.loadbar .fill.warn { background: var(--warn); }
.loadbar .fill.crit { background: var(--bad); }
.loadbar .limit { position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: var(--bad); }
.loadbar .val { grid-column: 2; font-size: 10px; color: var(--dim); font-variant-numeric: tabular-nums; }
.loads .note { font-size: 10px; color: var(--dim); margin-top: 4px; }
.bottom-left { bottom: 10px; left: 10px; width: 270px; }
.stages { max-height: 180px; overflow-y: auto; margin-bottom: 6px; }
.stage { padding: 3px 6px; border-radius: 4px; font-size: 11px; color: var(--dim); display: flex; gap: 6px; }
.stage .sn { color: var(--acc); font-weight: 700; min-width: 16px; }
.stage.next { background: #2a3a26; color: var(--fg); border: 1px solid #4a7a3a; }
.bottom-center { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); }
.navwrap { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px 12px 6px 6px; padding: 6px 10px; }
.speedmode { background: #1b2430; padding: 2px 12px; border-radius: 10px; cursor: pointer; font-variant-numeric: tabular-nums; color: var(--good); }
.navball { position: relative; border-radius: 50%; box-shadow: 0 0 0 3px #3b4d63, 0 0 20px #000; overflow: hidden; }
.navball canvas { position: absolute; left: 0; top: 0; }
.throttle { position: relative; width: 16px; height: 170px; background: #1b2430; border-radius: 8px; overflow: hidden; }
.thr-fill { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, #ffa640, #ffd27a); }
.thr-text { position: absolute; bottom: -2px; left: 0; right: 0; font-size: 9px; text-align: center; color: #000; font-weight: 700; }
.sasmodes { display: flex; gap: 2px; }
.btn.mode { padding: 2px 5px; font-size: 13px; min-width: 24px; }
.btn.toggle { width: 44px; }
.hdg { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.actions { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.actions .btn { padding: 3px 8px; font-size: 12px; }
.top-right { top: 10px; right: 10px; width: 290px; max-height: 48vh; display: flex; flex-direction: column; }
.players, .vessellist { overflow-y: auto; }
.vessellist { max-height: 120px; margin-bottom: 6px; }
.player, .vrow { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 4px; }
.player.off { opacity: 0.45; }
.player .pn, .vrow .vn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po { font-size: 11px; color: var(--dim); }
.po.ahead { color: var(--acc); }
.po.behind { color: var(--blue); }
.vrow { cursor: pointer; }
.vrow:hover { background: #1c2632; }
.vrow.tgt { background: #3a1f3a; outline: 1px solid #ff4fd8; }
.vrow.ghost .vn { opacity: 0.55; font-style: italic; }
.vrow .vd { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.chatlog { flex: 1; min-height: 60px; max-height: 140px; overflow-y: auto; font-size: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
.chatline { padding: 1px 0; word-wrap: break-word; }
.chatline i { color: var(--dim); }
.chatin { width: 100%; margin-top: 4px; }
.right-mid { top: calc(48vh + 20px); right: 10px; width: 250px; }
.target .title { color: #ff4fd8; text-transform: none; }
.dockcv { display: block; margin: 6px auto; background: #0b1016; border-radius: 6px; }
.target .note { font-size: 11px; color: var(--warn); margin-bottom: 6px; }
.right-low { bottom: 10px; right: 10px; width: 330px; }
.node .row { margin: 3px 0; }
.node .k { width: 60px; color: var(--dim); }
.nodeinfo { font-size: 12px; margin-bottom: 6px; line-height: 1.5; }
.nodeinfo .rem { color: var(--blue); font-weight: 600; }

/* Schiffsnamen in der 3D-Ansicht */
.vlabels, .map-labels { position: absolute; inset: 0; overflow: hidden; }
.vlabel { position: absolute; left: 0; top: 0; font-size: 11px; background: #000a; border-left: 3px solid #888; padding: 1px 6px; white-space: nowrap; transform-origin: 0 0; }
.vlabel.target { outline: 1px solid #ff4fd8; }

/* Karten-Marker */
.mk { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 11px; display: flex; align-items: center; gap: 4px; margin: -5px 0 0 -5px; }
.mk .dot { width: 10px; height: 10px; border: 2px solid #fff; background: transparent; }
.mk.clickable { pointer-events: auto; cursor: pointer; }
.mk.clickable:hover .lbl { background: #2f4158; }
.mk .lbl { background: #000a; padding: 0 5px; border-radius: 3px; }
.mk.self .dot { border-color: var(--blue); background: var(--blue); }
.mk.vessel .dot { border-color: #ccc; }
.mk.ghost { opacity: 0.55; }
.mk.target .dot { border-color: #ff4fd8; background: #ff4fd8; }
.mk.ap .dot, .mk.pe .dot { border-color: var(--blue); border-radius: 0; transform: rotate(45deg); width: 8px; height: 8px; }
.mk.ap .lbl, .mk.pe .lbl { color: var(--blue); }
.mk.impact .dot { border-color: var(--bad); }
.mk.impact .lbl { color: var(--bad); }
.mk.soi .dot { border-color: var(--acc); }
.mk.soi .lbl { color: var(--acc); }
.mk.body .dot { display: none; }
.mk.body .lbl { color: #9ab; background: none; font-weight: 600; }
.mk.node .dot { border-color: #2f7dff; background: #2f7dff; }
.mk.ca .dot { border-color: #ff4fd8; border-style: dashed; }
.mk.ca .lbl { color: #ff9ae8; }
.palette .symsel { position: sticky; top: -8px; z-index: 2; background: #10161e; margin: 0 -10px 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
