/* =====================================================================
   PURE WARDRIVE - UPLOADER HUB
   Style-Mix: wdgwars.pl (Orbitron / Share Tech Mono, Cyan, Scanlines)
            + RocketGod wdgwars-uploader WebUI (Karten, Verlaufstexte, Grid)
   ===================================================================== */

:root {
  --bg: #05070a;
  --bg2: #0a0f16;
  --panel: #0b1119cc;
  --solid: #0b1119;
  --line: #1a2634;
  --line2: #0e1620;

  --cyan: #00e5ff;
  --cyan-dim: #0a8fa3;
  --mag: #ff2d95;
  --amber: #ffb300;
  --green: #25f4a7;
  --red: #ff4d5e;
  --pink: #f0abfc;
  --purple: #a855f7;

  --txt: #c7d6e5;
  --bright: #dfe;
  --muted: #5f7285;
  --grid: rgba(0, 229, 255, .05);

  --mono: "Share Tech Mono", ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --display: "Orbitron", "Share Tech Mono", ui-monospace, sans-serif;

  --radius: 10px;
  --glow: 0 0 18px rgba(0, 229, 255, .25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 34px 34px;
  mask: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .16) 2px 4px);
  opacity: .5;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 20px 70px;
}

/* ----------------------------------------------------------- Kopfzeile */

header.top {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.logo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 18px rgba(0, 229, 255, .4), inset 0 0 12px rgba(0, 229, 255, .25);
}
.logo::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(0, 229, 255, .45);
  border-radius: 50%;
}
.logo::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 2px;
  background: var(--cyan);
  transform-origin: 0 50%;
  box-shadow: 0 0 8px var(--cyan);
  animation: sweep 3s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--mag));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 26px rgba(0, 229, 255, .18);
}
.brand .sub {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

nav.tabs {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}
nav.tabs a {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: .15s;
}
nav.tabs a:hover { color: var(--cyan); border-color: var(--cyan-dim); }
nav.tabs a.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0, 229, 255, .08);
  box-shadow: 0 0 14px rgba(0, 229, 255, .18);
}

/* ------------------------------------------------------------- Layout */

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.card {
  grid-column: span 12;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg2), #070b11);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

/* Spaltenbreiten (nach .card, damit sie gewinnen) */
.card.col-3 { grid-column: span 3; }
.card.col-4 { grid-column: span 4; }
.card.col-6 { grid-column: span 6; }
.card.col-8 { grid-column: span 8; }
.card.col-12 { grid-column: span 12; }

@media (max-width: 1000px) {
  .card.col-3, .card.col-4, .card.col-6, .card.col-8 { grid-column: span 12; }
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 26px; height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.card::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 26px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.card.mag::before, .card.mag::after { background: var(--mag); box-shadow: 0 0 10px var(--mag); }
.card.amber::before, .card.amber::after { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

.card h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}
.card h2 .hint { float: right; font-weight: 400; letter-spacing: 1px; color: var(--cyan-dim); }

/* --------------------------------------------------------- Kennzahlen */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
  background: radial-gradient(circle at 50% 0, rgba(0, 229, 255, .07), transparent 70%);
  text-align: center;
}
.tile.mag { background: radial-gradient(circle at 50% 0, rgba(255, 45, 149, .08), transparent 70%); }
.tile.amber { background: radial-gradient(circle at 50% 0, rgba(255, 179, 0, .08), transparent 70%); }
.tile .num {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 20px rgba(0, 229, 255, .45);
  font-variant-numeric: tabular-nums;
}
.tile.mag .num { color: var(--mag); text-shadow: 0 0 20px rgba(255, 45, 149, .45); }
.tile.amber .num { color: var(--amber); text-shadow: 0 0 20px rgba(255, 179, 0, .4); }
.tile .lbl { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

/* ------------------------------------------------------------ Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--cyan-dim), #0b6f7e);
  color: #001318;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 11px 20px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(0, 229, 255, .25);
  transition: .15s;
  text-decoration: none;
}
.btn:hover { background: linear-gradient(90deg, var(--cyan), #14b9cf); box-shadow: 0 0 26px rgba(0, 229, 255, .5); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--cyan); box-shadow: none; }
.btn.ghost:hover { background: rgba(0, 229, 255, .08); }
.btn.mag { background: linear-gradient(90deg, #9c1c5c, #6f1444); border-color: var(--mag); color: #ffd9ec; box-shadow: 0 0 18px rgba(255, 45, 149, .25); }
.btn.mag:hover { background: linear-gradient(90deg, var(--mag), #c23a7d); box-shadow: 0 0 26px rgba(255, 45, 149, .5); }
.btn.sm { padding: 7px 12px; font-size: 10px; letter-spacing: 1px; }
.btn.amber { background: linear-gradient(90deg, #a06a00, #7a5000); border-color: var(--amber); color: #ffe9b0; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------- Formulare */

label.lbl {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  background: #070c12;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--txt);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, .28);
}
input::placeholder { color: rgba(255, 255, 255, .18); }
textarea { min-height: 74px; resize: vertical; }

.field { margin-bottom: 12px; }
.field .help { font-size: 11px; color: var(--muted); margin-top: 4px; }
.field .help a { color: var(--cyan); text-decoration: none; }
.field .help a:hover { text-shadow: 0 0 8px rgba(0, 229, 255, .5); }

.chk { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--txt); cursor: pointer; }
.chk input { width: auto; accent-color: var(--cyan); }

.form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 700px) { .form2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- Chips */

.pill, .tag, .badge {
  display: inline-block;
  border-radius: 20px;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: uppercase;
}
.tag { border-color: currentColor; }
.tag.ok { color: var(--green); }
.tag.bad { color: var(--red); }
.tag.warn { color: var(--amber); }
.tag.info { color: var(--cyan); }
.tag.mag { color: var(--mag); }
.badge { border-color: var(--cyan); color: var(--cyan); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 2s infinite; }
.dot.warn { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.dot.bad { background: var(--red); box-shadow: 0 0 10px var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* -------------------------------------------------------------- Tabelle */

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #0a1017;
  z-index: 3;
}
td { padding: 6px 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr:hover td { background: rgba(0, 229, 255, .05); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td b { color: var(--bright); }

/* ------------------------------------------------------------ Konsole */

.console {
  font-size: 11px;
  color: var(--muted);
  max-height: 320px;
  overflow: auto;
  background: #070c12;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.console div { padding: 1px 0; border-bottom: 1px dashed #0e1620; }
.console .t { color: var(--cyan-dim); margin-right: 8px; }
.console .ok { color: var(--green); }
.console .warn { color: var(--amber); }
.console .error { color: var(--red); }
.console .info { color: var(--txt); }

/* ------------------------------------------------------------ Zielkarten */

.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }

.tcard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--bg2), #070b11);
  position: relative;
  transition: .15s;
}
.tcard:hover { border-color: var(--cyan-dim); }
.tcard.off { opacity: .5; }
.tcard .tn { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tcard .tn b { font-family: var(--display); font-size: 14px; letter-spacing: 1px; color: var(--bright); }
.tcard .td { font-size: 12px; color: var(--muted); margin: 7px 0 10px; }
.tcard .tf { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tcard.dead { border-color: rgba(255, 77, 94, .35); }

/* Verlinkung auf die jeweilige Seite */
a.tlink {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(0, 229, 255, .45);
  transition: .15s;
}
a.tlink:hover {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 229, 255, .55);
}
a.tlink::after { content: " \2197"; font-size: .8em; opacity: .5; }

/* ------------------------------------------------- Umschalter Datenart */

.kindbar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 229, 255, .04);
}
.kindbar button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: .15s;
}
.kindbar button:hover { color: var(--cyan); }
.kindbar button.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0, 229, 255, .12);
  box-shadow: 0 0 14px rgba(0, 229, 255, .18);
}

.kindhead {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.kindhead .kh { font-family: var(--display); font-size: 13px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }

.plane { transform-origin: center; filter: drop-shadow(0 0 4px rgba(0, 229, 255, .7)); }
.plane svg { display: block; }
.meshdot {
  width: 13px; height: 13px; border-radius: 50%;
  color: var(--mag); background: currentColor;
  box-shadow: 0 0 10px currentColor;
  animation: pulse 2s infinite;
}
.meshdot.mc { color: var(--amber); }
.meshdot.mt { color: var(--mag); }

/* ------------------------------------------------------------- Karte */
#map { position: absolute; inset: 0; background: var(--bg); z-index: 0; }

.maplayout { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - 108px); gap: 0; }
@media (max-width: 900px) { .maplayout { grid-template-columns: 1fr; height: auto; } .mapside { max-height: 320px; } }

.mapside {
  overflow: auto;
  padding-right: 8px;
  padding-bottom: 10px;
}
.mapmain { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 420px; }

.mapbar {
  position: absolute;
  z-index: 500;
  top: 12px; left: 12px; right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  flex-wrap: wrap;
}
.mapbar > * { pointer-events: auto; }
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  backdrop-filter: blur(6px);
  font-size: 12px;
}
.glass.title {
  font-family: var(--display);
  letter-spacing: 2px;
  font-weight: 700;
  color: transparent;
  background: linear-gradient(90deg, var(--cyan), var(--mag));
  -webkit-background-clip: text;
  background-clip: text;
  border-color: #123;
}

.leaflet-popup-content-wrapper { background: #0a1017; color: var(--txt); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 0 24px rgba(0, 229, 255, .15); }
.leaflet-popup-tip { background: #0a1017; border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; font-size: 12px; min-width: 200px; }
.pp h3 { margin: 0 0 4px; font-size: 15px; color: var(--cyan); letter-spacing: 1px; }
.pp .sub { color: var(--muted); margin-bottom: 8px; }
.pp .kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.pp .kv .k { color: var(--muted); }
.pp .kv .v { text-align: right; color: var(--bright); }
.pp a { color: var(--cyan); }

.leaflet-control-layers { background: var(--panel) !important; border: 1px solid var(--line) !important; color: var(--txt); }
.leaflet-bar a { background: #0a1017; color: var(--cyan); border-color: var(--line); }
.leaflet-bar a:hover { background: #12202c; }
.leaflet-control-attribution { background: rgba(5, 7, 10, .75) !important; color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--cyan) !important; }
.leaflet-top.leaflet-right { margin-top: 54px; }

.tlist { display: flex; flex-direction: column; gap: 7px; }
.titem {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #070c12;
  display: flex;
  gap: 9px;
  align-items: center;
  cursor: pointer;
}
.titem:hover { border-color: var(--cyan-dim); }
.titem.on { border-color: var(--cyan); box-shadow: 0 0 12px rgba(0, 229, 255, .15); }
.titem .ti { flex: 1; min-width: 0; }
.titem .ti b { display: block; font-size: 12px; color: var(--bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem .ti span { font-size: 10px; color: var(--muted); }

/* --------------------------------------------------------------- Toast */

#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0a141c;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 11px 20px;
  border-radius: 8px;
  box-shadow: 0 0 22px rgba(0, 229, 255, .35);
  letter-spacing: 1px;
  font-size: 13px;
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { border-color: var(--red); color: var(--red); box-shadow: 0 0 22px rgba(255, 77, 94, .3); }
#toast.ok { border-color: var(--green); color: var(--green); box-shadow: 0 0 22px rgba(37, 244, 167, .3); }

/* -------------------------------------------------------------- Sonstiges */

.muted { color: var(--muted); }
.small { font-size: 11px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
.kv2 { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv2 .k { color: var(--muted); }
.kv2 .v { color: var(--bright); text-align: right; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #070c12; border-radius: 8px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--cyan-dim), #0b6f7e); border: 2px solid #070c12; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--cyan), #0b6f7e); }
* { scrollbar-width: thin; scrollbar-color: #0b6f7e transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
