:root {
  --bg: #0c100e;
  --bg-gradient: radial-gradient(circle at 50% 0%, #15221a 0%, #0c100e 70%);
  --panel: #131a16;
  --panel-glass: rgba(19, 26, 22, 0.88);
  --panel2: #1b251f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(212, 175, 55, 0.28);
  --text: #f4f5f0;
  --muted: #9aa39d;
  --gold: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.35);
  --gold-bright: #f5d061;
  --green: #34d399;
  --green-dark: #123623;
  --orange: #f59e0b;
  --red: #ef4444;
  --red-dark: #451316;
  --touch: 50px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ROTLICHT-NACHTSICHTMODUS (WILD- & BLENDSCHUTZ) */
body.night-mode {
  --bg: #050000;
  --bg-gradient: #050000;
  --panel: #150202;
  --panel-glass: rgba(21, 2, 2, 0.94);
  --panel2: #240505;
  --line: rgba(255, 50, 50, 0.16);
  --line-strong: rgba(255, 60, 60, 0.45);
  --text: #ff8b8b;
  --muted: #a63f3f;
  --gold: #ff3b30;
  --gold-glow: rgba(255, 59, 48, 0.4);
  --gold-bright: #ff6961;
  --green: #ff5252;
  --green-dark: #380505;
  --orange: #ff5252;
  --red: #ff3b30;
  --red-dark: #3b0505;
}

body.night-mode #map {
  filter: brightness(0.65) invert(1) contrast(1.4) hue-rotate(150deg) saturate(3.5);
}

* { box-sizing: border-box; }
.hidden, [hidden] { display: none !important; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; cursor: pointer; }

/* HEADER */
.app-header {
  height: calc(74px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(8px, var(--safe-top)) max(16px, var(--safe-right)) 8px max(16px, var(--safe-left));
  background: linear-gradient(180deg, #15221b 0%, #101612 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 1000;
}
.header-main { display: flex; flex-direction: column; gap: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; }

h1 {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
h2 { font-size: 1.35rem; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

.eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  gap: 4px;
}
.pine-branch { font-size: 0.85rem; }

.edition-badge {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #1a1600;
  background: linear-gradient(135deg, #f5d061 0%, #d4af37 100%);
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 0 10px var(--gold-glow);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
  display: inline-block;
}

.header-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}
.header-btn:hover, .header-btn:active {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.15);
}
.header-btn .btn-icon { font-size: 1rem; line-height: 1; }
.header-btn.gift-btn {
  border-color: var(--line-strong);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, rgba(26, 37, 28, 0.4) 100%);
}

.badge {
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.badge.online { background: var(--green-dark); color: #86efac; border: 1px solid rgba(134, 239, 172, 0.3); }
.badge.offline { background: var(--red-dark); color: #fca5a5; border: 1px solid rgba(252, 165, 165, 0.3); }
.badge.warning { background: #3b2f12; color: #fde047; border: 1px solid rgba(253, 224, 71, 0.3); }

/* MAIN CONTENT */
main {
  height: calc(100dvh - 74px - 72px - var(--safe-top) - var(--safe-bottom));
  position: relative;
}
.view { display: none; height: 100%; overflow: auto; }
.view.active { display: block; }
.panel-view {
  padding: 18px 16px 36px;
  max-width: 900px;
  margin: 0 auto;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.section-heading select, .date-pill {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.88rem;
}

/* MAP VIEW & HUD */
#mapView {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

#map,
.leaflet-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: #0c100e !important;
  z-index: 1;
}

.leaflet-tile {
  /* Saubere Kanten-Darstellung bei hochskalierten Kacheln jenseits von Zoom 16 */
  image-rendering: auto;
}

.map-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 700;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.hud-pill {
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}
.hud-label {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--gold);
}
.hud-pill strong {
  font-size: 0.95rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
}

/* LAYER SWITCHER */
.map-layer-switcher {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 750;
  display: flex;
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}
.layer-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 9px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.layer-btn:hover { color: var(--text); }
.layer-btn.active {
  background: var(--gold);
  color: #121714;
  box-shadow: 0 0 10px var(--gold-glow);
}

.map-tools {
  position: absolute;
  right: 14px;
  top: 60px;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.icon-btn {
  width: var(--touch);
  height: var(--touch);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold-bright);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  transition: all 0.2s ease;
}
.icon-btn:hover, .icon-btn:active {
  transform: scale(1.05);
  background: var(--panel2);
  border-color: var(--gold-bright);
}
.icon-btn.active {
  background: var(--gold);
  color: #141a16;
  border-color: #fff;
  box-shadow: 0 0 16px var(--gold-glow);
}
.icon-btn.sos-btn {
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}
.icon-btn.sos-btn:hover {
  background: #3c1214;
  border-color: #ef4444;
  color: #fff;
}
.tool-sym { font-size: 1.35rem; line-height: 1; font-weight: 800; }
.tool-desc { font-size: 0.55rem; font-weight: 900; letter-spacing: 0.05em; }

.map-readout {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 700;
  background: var(--panel-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 14px;
  font: 700 0.78rem var(--font-mono);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.04em;
}

/* RANGEFINDER FLOATING BAR */
.rangefinder-bar {
  position: absolute;
  bottom: 50px;
  left: 14px;
  right: 14px;
  max-width: 540px;
  margin: 0 auto;
  z-index: 800;
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.rf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  margin-bottom: 8px;
}
.rf-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
}
.rf-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.rf-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}
.rf-box.highlight {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(20, 27, 22, 0.4) 100%);
}
.rf-label { display: block; font-size: 0.58rem; font-weight: 800; color: var(--muted); }
.rf-box strong { font-size: 1.15rem; font-family: var(--font-mono); color: var(--text); }
.rf-box.highlight strong { color: var(--gold-bright); font-size: 1.3rem; }
.rf-hint {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

/* CARDS & PANELS */
.card, .notice, .sync-card, .ghe-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.notice { color: var(--muted); margin-bottom: 14px; font-size: 0.88rem; }

.card-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--gold);
  display: block;
}

/* METRICS */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.metric {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 14px;
}
.metric span { display: block; color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.metric strong { display: block; font-size: 1.4rem; font-family: var(--font-mono); margin-top: 4px; }

/* THERMAL CARD */
.thermal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0;
  border-color: var(--line-strong);
}
.thermal-card strong { display: block; font-size: 1.3rem; margin-top: 4px; }
.thermal-card p { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
.thermal-score {
  min-width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel2);
  border: 2px solid var(--line);
  font-weight: 900;
  font-size: 1.35rem;
  font-family: var(--font-mono);
}
.thermal-score.rising {
  background: var(--green-dark);
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.4);
  box-shadow: 0 0 16px rgba(134, 239, 172, 0.2);
}
.thermal-score.falling {
  background: var(--red-dark);
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.4);
  box-shadow: 0 0 16px rgba(252, 165, 165, 0.2);
}

.hunting-tip-box, .mountain-rule-box {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(20, 27, 22, 0.6) 100%);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  margin: 14px 0;
  font-size: 0.84rem;
}
.hunting-tip-box strong, .mountain-rule-box strong { display: block; color: var(--gold-bright); margin-bottom: 2px; }
.hunting-tip-box span, .mountain-rule-box span { color: var(--muted); }
.tip-icon, .rule-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }

/* FORECAST TABLE */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  max-height: 44vh;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}
table { border-collapse: collapse; width: 100%; min-width: 680px; background: var(--panel); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 0.84rem; }
th { position: sticky; top: 0; background: var(--panel2); color: var(--gold-bright); z-index: 1; font-weight: 800; font-size: 0.74rem; letter-spacing: 0.06em; }

/* LIGHT & MOON VIEW */
.light-hero {
  background: radial-gradient(circle at 50% 0%, #4a3812 0%, #171b15 70%);
  border: 1px solid var(--gold);
  border-radius: 20px;
  text-align: center;
  padding: 24px 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.light-hero strong {
  display: block;
  font: 900 clamp(2.4rem, 13vw, 4.4rem)/1 var(--font-mono);
  margin: 12px 0 8px;
  color: var(--gold-bright);
  text-shadow: 0 0 20px var(--gold-glow);
}
.light-hero.good {
  background: radial-gradient(circle at 50% 0%, #1d4029 0%, #111713 70%);
  border-color: #34d399;
}
.light-hero.good strong { color: #86efac; text-shadow: 0 0 20px rgba(134, 239, 172, 0.35); }
.light-hero.bad {
  background: radial-gradient(circle at 50% 0%, #4a1518 0%, #151112 70%);
  border-color: #ef4444;
}
.light-hero.bad strong { color: #fca5a5; text-shadow: 0 0 20px rgba(252, 165, 165, 0.35); }

.timeline {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.timeline div {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.timeline span { display: block; color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.timeline strong { display: block; font-size: 1.25rem; font-family: var(--font-mono); margin-top: 3px; }

/* MOON CARD */
.moon-card {
  margin-top: 14px;
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(27, 37, 31, 0.6) 0%, var(--panel) 100%);
}
.moon-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.moon-badge {
  font-size: 2.6rem;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(245, 208, 97, 0.4));
}
.moon-header strong { font-size: 1.25rem; display: block; margin-top: 2px; }
.moon-header p { font-size: 0.82rem; color: var(--gold-bright); }
.moon-times-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.moon-time-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.moon-time-box span { display: block; font-size: 0.72rem; color: var(--muted); }
.moon-time-box strong { font-size: 1.15rem; font-family: var(--font-mono); }
.moon-advice { font-size: 0.82rem; color: var(--muted); }

/* SHADOW & COMPASS */
.shadow-card {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
}
.compass {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #222b25 0%, #141a16 70%);
  box-shadow: 0 0 14px var(--gold-glow);
}
.compass span { font-size: 2.2rem; color: var(--gold-bright); }
.shadow-card strong { display: block; font-size: 1.2rem; }
.shadow-card p { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

/* BALLISTICS VIEW */
.angle-gauge {
  height: 220px;
  position: relative;
  display: grid;
  place-content: center;
  text-align: center;
  background: radial-gradient(circle, #1a251e 0%, #0d120f 80%);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.angle-reticle {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, transparent 49.5%, rgba(212, 175, 55, 0.25) 50%, transparent 50.5%),
    linear-gradient(to bottom, transparent 49.5%, rgba(212, 175, 55, 0.25) 50%, transparent 50.5%);
  pointer-events: none;
}
.angle-line {
  position: absolute;
  width: 80%;
  height: 4px;
  left: 10%;
  top: 50%;
  background: var(--gold-bright);
  transform: rotate(0deg);
  box-shadow: 0 0 16px var(--gold-glow);
}
.angle-gauge strong {
  font-size: 3.4rem;
  font-family: var(--font-mono);
  font-weight: 900;
  z-index: 1;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
  color: var(--text);
}
.angle-gauge span { z-index: 1; color: var(--gold-bright); font-weight: 700; font-size: 0.88rem; }

.preset-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin: 16px 0 8px;
}
.quick-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.preset-btn {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 0;
  font-size: 0.84rem;
  font-weight: 800;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}
.preset-btn.active, .preset-btn:active {
  border-color: var(--gold);
  background: var(--gold);
  color: #121714;
  box-shadow: 0 0 12px var(--gold-glow);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}
.form-grid label, dialog label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.input-unit { display: flex; margin-top: 6px; }
.input-unit input, dialog input, dialog select, dialog textarea {
  width: 100%;
  background: #0d120f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  min-height: var(--touch);
}
.input-unit input:focus, dialog input:focus, dialog select:focus, dialog textarea:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 10px var(--gold-glow);
}
.input-unit span {
  display: grid;
  place-items: center;
  background: var(--panel2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 0;
  padding: 0 16px;
  border-radius: 0 12px 12px 0;
  font-weight: 700;
  color: var(--gold);
}
.input-unit input { border-radius: 12px 0 0 12px; font-family: var(--font-mono); font-size: 1.15rem; font-weight: 700; }

.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }

.primary, .secondary, .danger {
  min-height: var(--touch);
  border-radius: 12px;
  font-weight: 800;
  padding: 12px 16px;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}
.primary {
  border: 1px solid var(--gold);
  background: linear-gradient(135deg, #f5d061 0%, #c29b2b 100%);
  color: #121714;
  box-shadow: 0 4px 16px var(--gold-glow);
}
.primary:hover, .primary:active {
  background: linear-gradient(135deg, #ffe082 0%, #d4af37 100%);
  transform: translateY(-1px);
}
.secondary {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
}
.secondary:hover, .secondary:active {
  border-color: var(--gold);
}
.danger {
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: var(--red-dark);
  color: #fca5a5;
}
.full { width: 100%; }

.ghe-card {
  text-align: center;
  margin-top: 16px;
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.12) 0%, var(--panel) 100%);
}
.ghe-sub { display: block; color: var(--gold-bright); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; }
.ghe-card strong {
  display: block;
  color: var(--gold-bright);
  font-size: 2.9rem;
  font-family: var(--font-mono);
  font-weight: 900;
  margin: 8px 0;
  text-shadow: 0 0 24px var(--gold-glow);
}
.ghe-formula {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* DATA & SYNC VIEW */
.sync-card { display: flex; align-items: center; gap: 18px; }
.sync-ring {
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--gold) 0%, #202b23 0);
  position: relative;
  box-shadow: 0 0 16px var(--gold-glow);
}
.sync-ring:after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--panel);
}
.sync-ring span { z-index: 1; font-weight: 900; font-family: var(--font-mono); font-size: 1.15rem; color: var(--gold-bright); }
.sync-info strong { display: block; font-size: 1.15rem; }
.sync-info p { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

progress {
  width: 100%;
  height: 12px;
  margin: 18px 0 6px;
  accent-color: var(--gold);
  border-radius: 6px;
  overflow: hidden;
}

.status-list {
  margin: 18px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.status-list div {
  display: flex;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.status-list div:last-child { border-bottom: 0; }
.status-list span { color: var(--muted); }
.status-list strong { font-family: var(--font-mono); }

.marker-backup-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

/* BOTTOM NAVIGATION */
.bottom-nav {
  height: calc(72px + var(--safe-bottom));
  padding: 6px max(6px, var(--safe-right)) max(6px, var(--safe-bottom)) max(6px, var(--safe-left));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: linear-gradient(180deg, #121814 0%, #0c100e 100%);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
}
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 12px;
  transition: all 0.2s ease;
}
.nav-icon { font-size: 1.45rem; line-height: 1; }
.nav-btn.active {
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.14);
}
.nav-btn.active .nav-icon {
  text-shadow: 0 0 10px var(--gold-glow);
}

/* DIALOGS & MODALS */
dialog {
  width: min(92vw, 500px);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.dialog-head button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.8rem;
  display: grid;
  place-items: center;
}
dialog label { display: block; margin-top: 12px; }
dialog select, dialog textarea, dialog input { display: block; margin-top: 6px; }

/* GIFT MODAL (HUBERT STEINDL) */
.gift-dialog {
  border-color: var(--gold);
  background: radial-gradient(circle at 50% 0%, #202b22 0%, #101612 85%);
  box-shadow: 0 0 50px rgba(212, 175, 55, 0.35);
  text-align: center;
}
.gift-crest { font-size: 2.8rem; margin-bottom: 8px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6)); }
.gift-eyebrow {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: var(--gold);
  display: block;
}
.gift-dialog h2 {
  font-size: 1.55rem;
  color: var(--gold-bright);
  margin: 6px 0 10px;
}
.gift-badge {
  display: inline-block;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.gift-text { font-size: 0.88rem; line-height: 1.55; color: #d1d5db; margin-bottom: 16px; text-align: left; }
.gift-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 16px;
  text-align: left;
}
.gift-detail-item {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
}
.gift-detail-item span { display: block; font-size: 0.68rem; color: var(--gold); font-weight: 700; }
.gift-detail-item strong { display: block; font-size: 0.88rem; color: var(--text); }
.gift-motto {
  font-size: 0.84rem;
  color: var(--gold-bright);
  margin-bottom: 18px;
  padding: 10px;
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px dashed var(--line-strong);
}

/* SOS DIALOG */
.sos-dialog {
  border-color: #ef4444;
  background: radial-gradient(circle at 50% 0%, #3a0d10 0%, #140708 85%);
}
.sos-banner {
  background: #ef4444;
  color: #fff;
  font-weight: 900;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 10px;
}
.sos-sub { font-size: 0.84rem; color: #fca5a5; margin-bottom: 14px; }
.sos-coords-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.coord-row { margin-bottom: 10px; }
.coord-row:last-child { margin-bottom: 0; }
.coord-row span { display: block; font-size: 0.65rem; font-weight: 800; color: #fca5a5; }
.coord-row strong { display: block; font-family: var(--font-mono); font-size: 1.15rem; color: #fff; }
.sos-call-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.sos-call-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.sos-call-btn.bergrettung { background: #ef4444; color: #fff; }
.sos-call-btn.euronotruf { background: #2563eb; color: #fff; }
.call-num { font-size: 1.3rem; font-family: var(--font-mono); }
.call-text { font-size: 0.65rem; margin-top: 4px; }
.alpine-signal-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 0.8rem;
}
.alpine-signal-box strong { color: var(--gold-bright); }
.alpine-signal-box p { color: var(--muted); margin: 4px 0 10px; }

/* MAP MARKERS & LEAFLET */
.marker-pin {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
}
.marker-pin span { transform: rotate(45deg); font-size: 18px; line-height: 1; }
.marker-hochsitz { background: #166534; }
.marker-anstand { background: #0284c7; }
.marker-erlegung { background: #9333ea; }
.marker-anschuss { background: #dc2626; }
.marker-salzlecke { background: #d97706; }
.marker-wechsel { background: #0d9488; }
.marker-hinweis { background: #475569; }

.leaflet-container { font: 14px -apple-system, BlinkMacSystemFont, sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel2);
  color: #fff;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.popup-delete {
  border: 1px solid #8c3940;
  background: #431b1f;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.78rem;
  margin-top: 8px;
  cursor: pointer;
}
.terrain-dot {
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.contour-badge {
  background: rgba(45, 28, 12, 0.9);
  border: 1px solid #d4af37;
  color: #fde68a;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  text-align: center;
  border-radius: 4px;
  padding: 1px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  white-space: nowrap;
}

.gps-pulse {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #38bdf8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.35);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6); }
  70% { box-shadow: 0 0 0 14px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.toast {
  position: fixed;
  z-index: 2500;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  background: var(--panel2);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 12px 18px;
  max-width: 88vw;
  text-align: center;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* RESPONSIVE QUERIES */
@media (min-width: 820px) {
  .panel-view { max-width: 960px; margin: auto; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .timeline { grid-template-columns: repeat(4, 1fr); }
  .map-tools { right: 20px; top: 20px; }
  .map-hud { left: 20px; top: 20px; }
}
/* 3D RELIEF OVERLAY */
.icon-btn.btn-3d {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(32, 43, 35, 0.8) 100%);
  border-color: var(--gold);
  color: var(--gold-bright);
}
.view-3d-overlay {
  position: absolute;
  inset: 0;
  z-index: 1500;
  background: #080b09;
  display: flex;
  flex-direction: column;
}
.view-3d-overlay.hidden {
  display: none !important;
}
.v3d-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #131a16 0%, rgba(19, 26, 22, 0.92) 100%);
  border-bottom: 1px solid var(--line-strong);
  z-index: 20;
}
.v3d-title h3 { font-size: 1rem; margin: 0; color: var(--gold-bright); }
.v3d-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.v3d-stand-select {
  background: rgba(12, 18, 14, 0.9);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 10px;
  max-width: 240px;
  cursor: pointer;
}
.v3d-mode-toggles {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
}
.v3d-mode-pill {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.v3d-mode-pill:hover { color: var(--text); }
.v3d-mode-pill.active {
  background: var(--gold);
  color: #0b110e;
  font-weight: 800;
  box-shadow: 0 2px 8px var(--gold-glow);
}

.close-3d-btn {
  background: var(--panel2);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--gold-glow);
  white-space: nowrap;
}

/* 3D EGO HUD & TAKTIK-OVERLAY */
.v3d-ego-hud {
  position: absolute;
  inset: 64px 0 0 0;
  pointer-events: none;
  z-index: 15;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 12px 72px 12px;
}
.v3d-ego-hud.hidden { display: none !important; }
.v3d-top-stack, .v3d-bottom-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

/* 360° SPEKTIV-KOMPASSBAND IN BLICKRICHTUNG */
.v3d-compass-tape {
  position: relative;
  width: min(94vw, 560px);
  height: 36px;
  background: rgba(9, 14, 11, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}
.compass-tape-center-mark {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold-bright);
  font-size: 0.65rem;
  z-index: 3;
  text-shadow: 0 0 6px var(--gold);
}
.compass-tape-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  padding-top: 2px;
}
.compass-tape-track .cardinal-major { color: var(--gold-bright); font-size: 0.8rem; }
.compass-tape-track .compass-marker-wind { color: #38bdf8; }
.compass-tape-track .compass-marker-scent { color: #f87171; }
.compass-tape-track .compass-marker-sun { color: #facc15; }
.compass-wind-tag {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  line-height: 1;
  padding-bottom: 2px;
}

.v3d-hud-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  pointer-events: auto;
  max-width: 100%;
}
.v3d-hud-chip {
  background: rgba(14, 20, 16, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 5px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}
.v3d-hud-chip .hud-icon { font-size: 1rem; line-height: 1; }
.v3d-hud-chip strong { display: block; font-size: 0.75rem; color: var(--text); white-space: nowrap; }
.v3d-hud-chip .hud-sub { display: block; font-size: 0.62rem; color: var(--muted); font-weight: 600; white-space: nowrap; }

.v3d-hud-chip.highlight {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.16);
  cursor: pointer;
}
.v3d-hud-chip.highlight:hover {
  background: rgba(212, 175, 55, 0.28);
}
.v3d-hud-chip.highlight strong { color: var(--gold-bright); }

.v3d-hud-chip.scent-good { border-color: rgba(34, 197, 94, 0.6); background: rgba(34, 197, 94, 0.12); }
.v3d-hud-chip.scent-good strong { color: #4ade80; }

.v3d-hud-chip.scent-warn { border-color: rgba(234, 179, 8, 0.6); background: rgba(234, 179, 8, 0.14); }
.v3d-hud-chip.scent-warn strong { color: #facc15; }

.v3d-hud-chip.scent-danger {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(239, 68, 68, 0.2);
  animation: pulse-danger 1.8s infinite;
}
.v3d-hud-chip.scent-danger strong { color: #f87171; }
@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* SPEKTIV-FADENKREUZ (RETICLE) MIT BALLISTIK-VORHALT */
.v3d-reticle {
  position: absolute;
  top: 47%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 156px;
  height: 156px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.v3d-reticle.hidden { display: none !important; }

.reticle-circle {
  position: absolute;
  width: 132px;
  height: 132px;
  border: 1.5px dashed rgba(212, 175, 55, 0.55);
  border-radius: 50%;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.45);
}
.reticle-h-line {
  position: absolute;
  width: 146px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.15) 0%, #d4af37 35%, #d4af37 65%, rgba(212, 175, 55, 0.15) 100%);
}
.reticle-v-line {
  position: absolute;
  height: 146px;
  width: 1.5px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.15) 0%, #d4af37 35%, #d4af37 65%, rgba(212, 175, 55, 0.15) 100%);
}
.reticle-center-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #ff3b30;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff3b30;
}
.reticle-windage-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.35);
  border-radius: 50%;
  transform: translate(0px, 0px);
  transition: transform 0.15s ease-out;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}
.reticle-mil-left, .reticle-mil-right {
  position: absolute;
  width: 1.5px;
  height: 8px;
  background: var(--gold);
}
.reticle-mil-left { left: 40px; }
.reticle-mil-right { right: 40px; }
.reticle-mil-bottom {
  position: absolute;
  height: 1.5px;
  width: 8px;
  background: var(--gold);
  bottom: 40px;
}
.reticle-label {
  position: absolute;
  bottom: -24px;
  background: rgba(10, 14, 12, 0.9);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.reticle-wind-hint {
  position: absolute;
  bottom: -44px;
  background: rgba(10, 18, 24, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #bae6fd;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ZEIT-SCHIEBEREGLER IM 3D-BLICK (ANSITZ-ZEITVORSCHAU) */
.v3d-time-bar {
  width: min(94vw, 680px);
  background: rgba(10, 14, 12, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}
.time-bar-info {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.72rem;
}
.time-bar-info strong {
  color: var(--gold-bright);
  font-family: var(--font-mono);
}
.time-thermal-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
}
#v3dTimeOffsetRange {
  flex: 1;
  accent-color: var(--gold);
  cursor: pointer;
  height: 6px;
}
.time-reset-btn {
  background: var(--panel2);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-size: 0.66rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
}

/* HÖHENPROFIL-PANEL (SCHNITTGRAFIK) */
.v3d-profile-panel {
  position: relative;
  align-self: center;
  width: min(94vw, 680px);
  background: rgba(10, 14, 12, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 7px 12px;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  transition: all 0.25s ease;
}
.v3d-profile-panel.collapsed {
  max-height: 34px;
  overflow: hidden;
  padding-bottom: 4px;
}
.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-bright);
}
.profile-title strong { color: #fff; }
.profile-hint { font-size: 0.66rem; color: var(--muted); font-weight: 500; display: none; }
@media (min-width: 500px) { .profile-hint { display: inline; } }
.profile-mini-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.7rem;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.profile-canvas-wrap {
  width: 100%;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  background: #060907;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.v3d-profile-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.profile-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 5px;
  font-size: 0.64rem;
  color: var(--muted);
  font-weight: 600;
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.hunter-dot { background: #38bdf8; box-shadow: 0 0 6px #38bdf8; }
.target-dot { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.legend-line { width: 14px; height: 2px; }
.los-line { background: #facc15; border-top: 1px dashed #facc15; }
.scent-line { background: linear-gradient(90deg, #38bdf8, #fbbf24); height: 3px; border-radius: 2px; }
.freeze-line { background: #60a5fa; }

.canvas-3d-wrap {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.canvas-3d-wrap:active { cursor: grabbing; }
.canvas-3d-wrap canvas { width: 100%; height: 100%; display: block; }

.v3d-footer {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 96vw;
  gap: 6px;
  z-index: 20;
}
.v3d-btn {
  background: var(--panel-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  transition: all 0.2s ease;
}
.v3d-btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.v3d-btn.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* BALLISTIK ASV & DRIFT GRID */
.ballistic-asv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  text-align: center;
}
.asv-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px;
}
.asv-box.highlight {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.14);
}
.asv-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.asv-box strong {
  display: block;
  font-size: 1.05rem;
  font-family: var(--font-mono);
  color: var(--text);
  margin-top: 4px;
}
.asv-box.highlight strong {
  color: var(--gold-bright);
}

/* WAKE LOCK & HEADER ACTIVE */
#wakeLockBtn.active, .header-btn.active {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: rgba(245, 208, 97, 0.22);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* PWA INSTALL BANNER */
.pwa-install-banner {
  background: linear-gradient(135deg, #18281f 0%, #0e1511 100%);
  border-bottom: 1px solid var(--line-strong);
  padding: 10px max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: slide-down 0.3s ease-out;
}
@keyframes slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.pwa-install-banner.hidden { display: none !important; }
.pwa-install-info { display: flex; align-items: center; gap: 10px; }
.pwa-install-icon { font-size: 1.5rem; line-height: 1; }
.pwa-install-info strong { display: block; font-size: 0.84rem; color: var(--gold-bright); }
.pwa-install-info p { font-size: 0.72rem; color: var(--muted); margin: 2px 0 0; }
.pwa-install-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pwa-action-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.76rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.pwa-action-btn.primary {
  background: linear-gradient(135deg, #f5d061 0%, #d4af37 100%);
  color: #1a1600;
  box-shadow: 0 0 10px var(--gold-glow);
}
.pwa-action-btn.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  padding: 5px 9px;
}

/* HUD LICHT PILL */
.hud-pill.hud-light-good strong { color: #4ade80; }
.hud-pill.hud-light-dark strong { color: #f87171; }

/* WINKELSCHUSS HOLD BUTTON & BADGE */
.hold-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
  z-index: 2;
  animation: pulse 1.5s infinite;
}
.hold-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: all 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
}
.hold-btn.active, .hold-btn.frozen {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.5) !important;
}

/* GPS TRACKING BUTTON ACTIVE */
#gpsTrackBtn.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: #93c5fd;
  box-shadow: 0 0 14px rgba(96, 165, 250, 0.5);
}

/* SOS ACTIONS ROW (KOPIEREN & SMS) */
.sos-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.sos-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
  cursor: pointer;
  text-align: center;
}
.sos-action-btn.primary {
  background: linear-gradient(135deg, #f5d061 0%, #d4af37 100%);
  color: #1a1600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.sos-action-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.sos-action-btn:active {
  transform: scale(0.98);
}

/* COMPACT MAP TOOLS ON SMALL MOBILE VIEWPORTS */
@media (max-height: 760px) {
  .map-tools {
    gap: 6px;
    top: 54px;
  }
  .map-tools .icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 11px;
  }
  .map-tools .tool-sym { font-size: 1.15rem; }
  .map-tools .tool-desc { font-size: 0.5rem; }
}

/* 3D EGO HUD NIGHT-MODE ADAPTION */
body.night-mode .v3d-hud-chip,
body.night-mode .v3d-compass-tape,
body.night-mode .v3d-time-bar {
  background: rgba(30, 6, 8, 0.92);
  border-color: rgba(255, 59, 48, 0.4);
}
body.night-mode .v3d-hud-chip.highlight {
  border-color: #ff3b30;
  background: rgba(255, 59, 48, 0.22);
}
body.night-mode .v3d-hud-chip.highlight strong {
  color: #ff9999;
}
body.night-mode .reticle-circle {
  border-color: rgba(255, 59, 48, 0.6);
}
body.night-mode .reticle-h-line,
body.night-mode .reticle-v-line,
body.night-mode .reticle-mil-left,
body.night-mode .reticle-mil-right,
body.night-mode .reticle-mil-bottom {
  background: #ff3b30;
}
body.night-mode .reticle-label,
body.night-mode .reticle-wind-hint {
  background: rgba(25, 5, 7, 0.9);
  border-color: #ff3b30;
  color: #ff9999;
}
body.night-mode .v3d-profile-panel {
  background: rgba(20, 4, 6, 0.95);
  border-color: rgba(255, 59, 48, 0.4);
}
body.night-mode .v3d-mode-pill.active {
  background: #ff3b30;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.5);
}

/* GEODATEN: SATELLITEN-OVERLAY, LEGENDE, NOWCAST & SENTINEL-KARTEN */
.leaflet-image-layer.sat-overlay {
  image-rendering: pixelated;
}
.sat-legend {
  position: absolute;
  left: 12px;
  bottom: 92px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  max-width: min(360px, calc(100vw - 90px));
  padding: 8px 11px;
  border-radius: 12px;
  background: rgba(12, 18, 14, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.35);
  backdrop-filter: blur(8px);
  font-size: 0.72rem;
  color: #e5e7eb;
}
.sat-legend strong { color: var(--gold, #f5d061); }
.sat-legend-date { color: #9ca3af; font-size: 0.68rem; }
.sat-legend-date.stale { color: #fbbf24; }
.sat-legend span { display: inline-flex; align-items: center; gap: 4px; }
.sat-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sat-legend em { width: 100%; font-style: normal; color: #cbd5e1; font-size: 0.7rem; }
.sat-legend .ndvi-ramp {
  width: 110px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #8c510a, #d8b365, #c7e978, #5ab43c, #006837);
}
.sat-legend .ndvi-scale { width: 110px; justify-content: space-between; color: #9ca3af; }

.card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.card-meta { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted, #9ca3af); }
.mini-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold, #f5d061);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.nowcast-card, .sat-card { margin: 12px 0; }
.nowcast-table { margin-top: 10px; max-height: 210px; }
.nowcast-table tr.now-row td { color: var(--gold, #f5d061); font-weight: 600; }
.sat-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
body.night-mode .sat-legend {
  background: rgba(25, 5, 7, 0.92);
  border-color: rgba(255, 59, 48, 0.45);
}

/* 3D TEMPERATUR- & THERMIK-FARBSKALA (WELLEN & HANGTHERMIK) */
.v3d-temp-scale-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(11, 17, 13, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.32);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  width: min(680px, 100%);
  margin: 0 auto 4px;
  font-size: 0.68rem;
  color: #e2ebe4;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.temp-scale-title {
  font-weight: 800;
  color: var(--gold, #f5d061);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.temp-scale-gradient {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #2563eb 0%,
    #06b6d4 22%,
    #10b981 44%,
    #eab308 66%,
    #f97316 84%,
    #ef4444 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.temp-scale-val {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.temp-scale-val.cold { color: #7dd3fc; }
.temp-scale-val.mid  { color: #a7f3d0; }
.temp-scale-val.warm { color: #fdba74; }

@media (max-width: 640px) {
  .v3d-temp-scale-bar {
    padding: 4px 8px;
    gap: 5px;
    font-size: 0.62rem;
  }
  .temp-scale-title {
    display: none;
  }
}

body.night-mode .v3d-temp-scale-bar {
  background: rgba(25, 5, 7, 0.92);
  border-color: rgba(255, 59, 48, 0.4);
}




