:root {
  --bg: #0d1b2a;
  --ink: #e8eef4;
  --muted: #9fb3c8;
  --accent: #f5c518;
  --accent-ink: #1a1400;
  --hp: #58d68d;
  --hp-enemy: #ff6b57;
  --panel: rgba(8, 18, 30, 0.55);
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.df-noscript { position: fixed; inset: 0; display: grid; place-items: center; }

/* HUD */
.df-hud { position: fixed; inset: 0; pointer-events: none; user-select: none; }
.df-hud[hidden] { display: none; }
.df-crosshair { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); border: 1.5px solid rgba(245, 197, 24, 0.85); border-radius: 50%; }
.df-crosshair span { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; background: var(--accent); transform: translate(-50%, -50%); border-radius: 50%; }
.df-crosshair::before, .df-crosshair::after { content: ''; position: absolute; background: rgba(245, 197, 24, 0.85); }
.df-crosshair::before { left: -14px; right: -14px; top: 50%; height: 1px; }
.df-crosshair::after { top: -14px; bottom: -14px; left: 50%; width: 1px; }
.df-target { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border: 2px solid var(--hp-enemy); border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4); }
.df-target[hidden] { display: none; }
.df-target small { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--hp-enemy); text-shadow: 0 1px 2px #000; white-space: nowrap; }
.df-target-arrow { position: absolute; font-size: 30px; color: var(--hp-enemy); text-shadow: 0 1px 3px #000; transform-origin: center; }
.df-target-arrow[hidden] { display: none; }

/* Suchkopf der Sidewinder: Raute = sucht/folgt, roter Kreis = aufgeschaltet */
.df-seeker { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.df-seeker i { position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border: 2px solid rgba(245, 197, 24, 0.55); transform: rotate(45deg); transition: left 0.12s, top 0.12s, width 0.12s, height 0.12s, border-radius 0.12s; }
.df-seeker.track i { border-color: #ffe066; border-width: 2.5px; }
.df-seeker.lock i { left: -27px; top: -27px; width: 54px; height: 54px; border-radius: 50%; transform: none; border: 2.5px solid var(--hp-enemy); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.df-seeker b { position: absolute; left: 0; top: -50px; transform: translateX(-50%); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--hp-enemy); text-shadow: 0 1px 2px #000; white-space: nowrap; }
#hudMsl { font-size: 16px; letter-spacing: 0.08em; color: var(--accent); }

.df-panel { position: absolute; bottom: 22px; padding: 12px 16px; background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; backdrop-filter: blur(6px); min-width: 180px; }
.df-left { left: 22px; }
.df-right { right: 22px; bottom: 30px; }
.df-stat { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 6px; margin: 2px 0; }
.df-stat small { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.df-stat b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.df-stat em { font-style: normal; color: var(--muted); font-size: 12px; }
.df-bar { grid-column: 2 / 4; width: 110px; height: 8px; background: rgba(255, 255, 255, 0.12); border-radius: 4px; overflow: hidden; align-self: center; }
.df-bar i { display: block; height: 100%; width: 50%; background: var(--accent); transition: width 0.15s; }
.df-bar i.burn { background: #ff6b57; box-shadow: 0 0 8px #ff6b57; }
.tc-small #tcBurn.on { background: rgba(255, 107, 87, 0.75); color: #fff; }
.df-hp i { background: var(--hp); }
.df-hp-enemy i { background: var(--hp-enemy); }

.df-top { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 22px; padding: 8px 18px; background: var(--panel); border-radius: 999px; font-weight: 500; font-size: 14px; }
.df-radar { position: absolute; top: 18px; right: 22px; width: 160px; height: 160px; border-radius: 50%; background: rgba(8, 18, 30, 0.6); border: 1px solid rgba(255, 255, 255, 0.12); }
.df-live { position: absolute; top: 188px; right: 22px; width: 240px; font-size: 12px; line-height: 1.35; color: var(--ink); text-shadow: 0 1px 2px #000; text-align: right; }
.df-live small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.df-live b { color: var(--accent); }
.df-live-dir { white-space: nowrap; }
.df-msg { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); font-size: 20px; font-weight: 700; text-shadow: 0 2px 6px #000; opacity: 0; transition: opacity 0.4s; text-align: center; max-width: 80vw; }
.df-msg.show { opacity: 1; }
.df-warn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, 70px); color: var(--hp-enemy); font-weight: 700; font-size: 18px; letter-spacing: 0.12em; text-transform: uppercase; text-shadow: 0 1px 4px #000; animation: df-blink 0.6s steps(2) infinite; }
.df-warn[hidden] { display: none; }
@keyframes df-blink { to { opacity: 0.25; } }
.df-attrib { position: absolute; bottom: 6px; right: 10px; font-size: 10px; color: rgba(255,255,255,0.75); text-shadow: 0 1px 2px #000; }
.df-hint { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Menü */
.df-menu { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 30%, rgba(13, 27, 42, 0.55), rgba(13, 27, 42, 0.92)); padding: 20px; overflow: auto; z-index: 5; }
.df-menu[hidden] { display: none; }
.df-menu-inner { width: min(760px, 100%); background: rgba(10, 20, 32, 0.85); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 18px; padding: 30px 34px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.df-kicker { color: var(--accent); text-decoration: none; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; }
.df-menu h1 { margin: 6px 0 4px; font-size: clamp(26px, 4vw, 40px); line-height: 1.1; }
.df-tagline { color: var(--muted); margin: 0 0 18px; font-size: 16px; }
.df-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.df-menu h2 { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.df-keys { border-collapse: collapse; font-size: 14px; }
.df-keys td { padding: 3px 10px 3px 0; vertical-align: top; }
kbd { display: inline-block; min-width: 24px; padding: 1px 6px; border: 1px solid rgba(255, 255, 255, 0.25); border-bottom-width: 3px; border-radius: 5px; background: rgba(255, 255, 255, 0.07); font: 600 12px/1.6 var(--font); text-align: center; }
.df-tips { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.df-tips li { margin-bottom: 4px; }
.df-opt { display: block; margin-top: 10px; font-size: 13px; color: var(--muted); }
.df-opt-sel select { margin-left: 8px; padding: 5px 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.08); color: var(--ink); font: 500 13px var(--font); }
.df-opt-sel option { color: #111; }
.df-start { display: block; width: 100%; margin: 22px 0 8px; padding: 14px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: 700 18px var(--font); cursor: pointer; }
.df-starts { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; margin: 22px 0 8px; }
.df-starts .df-start { margin: 0; }
.df-free { background: rgba(255, 255, 255, 0.1); color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.3); }
@media (max-width: 520px) { .df-starts { grid-template-columns: 1fr; } }
.df-ort { color: var(--muted); max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Landefrage / Landeautomatik */
.df-land { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: min(640px, 92vw); padding: 10px 14px; background: rgba(8, 18, 30, 0.78); border: 1px solid rgba(245, 197, 24, 0.5); border-radius: 12px; pointer-events: auto; font-size: 14px; z-index: 4; }
.df-land span { font-weight: 500; }
.df-land button { padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.08); color: var(--ink); font: 600 13px var(--font); cursor: pointer; }
.df-land #landYes { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
body.touch .df-land { top: 54px; font-size: 13px; padding: 7px 10px; }
.df-land:not([hidden]) ~ .df-msg { top: 128px; }
/* Tageszeit und Wetter */
.df-wxs { color: var(--muted); white-space: nowrap; }
.df-wx { position: absolute; top: 188px; right: 22px; width: 240px; font-size: 12px; line-height: 1.35; text-align: right; color: var(--ink); text-shadow: 0 1px 2px #000; }
.df-wx:not([hidden]) ~ .df-live { top: 236px; }
body.touch .df-wx { display: none; }
@media (max-width: 720px) { .df-wx { display: none; } .df-wxs { display: none; } }
/* Sprechfunk */
.df-voices { display: block; margin-left: 22px; font-size: 11px; opacity: 0.8; }
.df-funk { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); width: min(640px, 56vw); padding: 8px 12px; background: rgba(8, 18, 30, 0.62); border-left: 3px solid rgba(120, 200, 230, 0.8); border-radius: 8px; font-size: 13px; line-height: 1.4; }
.df-funk small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 2px; }
.df-funk div { opacity: 0.6; }
.df-funk div.fk-now { opacity: 1; }
.df-funk .fk-pilot b { color: var(--accent); }
.df-funk .fk-atc b { color: #8fd3ef; }
body.touch .df-funk { bottom: auto; top: 108px; width: min(560px, 62vw); font-size: 11px; padding: 5px 9px; }
body.touch .df-funk div:not(.fk-now) { display: none; }
@media (max-width: 720px) { .df-funk { width: 92vw; bottom: 150px; font-size: 11px; } }
/* Freiflug: keine Waffen- und Gegneranzeigen */
body.free .df-foe, body.free:not(.armed) .df-arm, body.free:not(.armed) .tc-fire, body.free:not(.armed) .tc-msl, body.free:not(.armed) .tc-flare, body.free:not(.armed) #seeker { display: none !important; }
.df-start:disabled { background: rgba(255, 255, 255, 0.15); color: var(--muted); cursor: wait; }
.df-load { margin: 0; font-size: 13px; color: var(--muted); text-align: center; min-height: 1.4em; }
.df-credit { margin: 14px 0 0; font-size: 11px; color: var(--muted); text-align: center; }
.df-credit a { color: var(--muted); }
.df-over .df-menu-inner { text-align: center; }

@media (max-width: 720px) {
  .df-cols { grid-template-columns: 1fr; }
  .df-menu-inner { padding: 22px 18px; }
  .df-panel { min-width: 0; padding: 8px 10px; bottom: 30px; }
  .df-left { left: 8px; } .df-right { right: 8px; }
  .df-stat b { font-size: 18px; }
  .df-bar { width: 70px; }
  .df-radar { width: 100px; height: 100px; right: 8px; }
  .df-live { display: none; }
  .df-hint { display: none; }
}

/* Mehrspieler */
.df-mp { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.df-mp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.df-mp-btn { padding: 10px 16px; border: 1px solid rgba(245, 197, 24, 0.6); border-radius: 10px; background: rgba(245, 197, 24, 0.12); color: var(--ink); font: 600 14px var(--font); cursor: pointer; }
.df-mp-btn:disabled { opacity: 0.5; cursor: wait; }
.df-mp-or { color: var(--muted); font-size: 13px; }
.df-mp-join { display: flex; gap: 8px; }
.df-mp-join input { width: 80px; padding: 9px 10px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: var(--ink); font: 700 18px var(--font); letter-spacing: 0.2em; text-align: center; }
.df-mp-active { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.df-mp-code { padding: 8px 18px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); text-align: center; }
.df-mp-code small { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.df-mp-code b { display: block; font-size: 40px; letter-spacing: 0.25em; line-height: 1.1; }
.df-mp-info p { margin: 0 0 4px; font-size: 14px; }
.df-mp-link { padding: 0; border: 0; background: none; color: var(--muted); font: 13px var(--font); text-decoration: underline; cursor: pointer; }
.df-mp-status { margin: 8px 0 0; min-height: 1.3em; font-size: 13px; color: var(--accent); }
.df-mp-note { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
#hudMp { color: var(--accent); }
#hudMp[hidden] { display: none; }

/* Touch-Steuerung */
.tc { position: fixed; inset: 0; pointer-events: none; z-index: 3; touch-action: none; user-select: none; -webkit-user-select: none; }
.tc[hidden] { display: none; }
.tc > * { pointer-events: auto; touch-action: none; }
.tc-stick { position: absolute; left: 24px; bottom: 24px; width: 150px; height: 150px; border-radius: 50%; background: rgba(8, 18, 30, 0.45); border: 2px solid rgba(255, 255, 255, 0.25); }
.tc-stick.dim { opacity: 0.35; }
.tc-stick::before { content: ''; position: absolute; left: 50%; top: 50%; width: 2px; height: 100%; background: rgba(255,255,255,0.12); transform: translate(-50%, -50%); }
.tc-stick::after { content: ''; position: absolute; left: 50%; top: 50%; width: 100%; height: 2px; background: rgba(255,255,255,0.12); transform: translate(-50%, -50%); }
.tc-knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(245, 197, 24, 0.85); box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.tc-throttle { position: absolute; right: 24px; bottom: 150px; width: 54px; height: 200px; border-radius: 27px; background: rgba(8, 18, 30, 0.45); border: 2px solid rgba(255, 255, 255, 0.25); overflow: visible; }
.tc-thr-fill { position: absolute; left: 6px; right: 6px; bottom: 6px; border-radius: 20px; background: rgba(245, 197, 24, 0.5); }
.tc-thr-knob { position: absolute; left: -4px; right: -4px; height: 28px; border-radius: 14px; background: var(--accent); box-shadow: 0 3px 8px rgba(0,0,0,0.5); }
.tc-throttle span { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.tc-fire { position: absolute; right: 24px; bottom: 24px; width: 108px; height: 108px; border-radius: 50%; border: 3px solid rgba(255, 107, 87, 0.8); background: rgba(255, 107, 87, 0.25); color: #fff; font: 800 18px var(--font); letter-spacing: 0.08em; text-shadow: 0 1px 2px #000; }
.tc-fire.on { background: rgba(255, 107, 87, 0.75); }
.tc-msl, .tc-flare { position: absolute; right: 146px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font: 800 13px/1.1 var(--font); letter-spacing: 0.05em; text-shadow: 0 1px 2px #000; }
.tc-msl small, .tc-flare small { font-size: 12px; font-weight: 600; opacity: 0.85; }
.tc-msl { bottom: 24px; width: 80px; height: 80px; border: 3px solid rgba(245, 197, 24, 0.8); background: rgba(245, 197, 24, 0.2); }
.tc-msl.lock { background: rgba(255, 107, 87, 0.75); border-color: #ff6b57; }
.tc-msl.empty { opacity: 0.35; }
.tc-flare { bottom: 116px; width: 66px; height: 66px; border: 2px solid rgba(255, 255, 255, 0.45); background: rgba(8, 18, 30, 0.5); font-size: 11px; }
.tc-flare.on { background: rgba(255, 241, 194, 0.7); color: #1a1400; text-shadow: none; }
.tc-small { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 10px; }
.tc-small button { padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(8, 18, 30, 0.55); color: var(--ink); font: 600 13px var(--font); }
.tc-small button.on { background: rgba(245, 197, 24, 0.85); color: var(--accent-ink); }
.df-touchnote { margin: -10px 0 16px; font-size: 13px; color: var(--accent); }
.df-touchnote[hidden] { display: none; }
/* HUD auf Touch-Geräten: Anzeigen nach oben, Daumenzonen frei */
body.touch .df-left { left: 12px; top: 12px; bottom: auto; padding: 8px 12px; min-width: 0; }
body.touch .df-right { right: 12px; top: 184px; bottom: auto; padding: 8px 12px; min-width: 0; }
body.touch .df-stat b { font-size: 18px; }
body.touch .df-bar { width: 80px; }
body.touch .df-radar { width: 120px; height: 120px; top: 12px; right: 12px; }
body.touch .df-live { display: none; }
body.touch .df-hint { display: none; }
body.touch .df-attrib { bottom: auto; top: 4px; left: 50%; right: auto; transform: translateX(-50%); font-size: 9px; white-space: nowrap; }
body.touch .df-top { top: 18px; left: 50%; font-size: 12px; padding: 6px 12px; }
body.touch .df-warn { transform: translate(-50%, 50px); font-size: 15px; }
body.touch .df-msg { top: 56px; font-size: 16px; }
@media (max-height: 500px) {
  body.touch .tc-stick { width: 120px; height: 120px; bottom: 14px; left: 14px; }
  body.touch .tc-knob { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  body.touch .tc-throttle { height: 140px; bottom: 120px; right: 14px; }
  body.touch .tc-fire { width: 88px; height: 88px; bottom: 14px; right: 14px; font-size: 15px; }
  body.touch .tc-msl { width: 66px; height: 66px; right: 112px; bottom: 14px; font-size: 12px; }
  body.touch .tc-flare { width: 54px; height: 54px; right: 112px; bottom: 88px; font-size: 10px; }
  body.touch .df-right { top: 120px; right: 84px; }
  body.touch .df-radar { width: 100px; height: 100px; }
  body.touch .df-top { top: 14px; }
}
