
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Orbitron:wght@400;700;900&display=swap');

:root {
  --red: #cc2233;
  --red-bright: #ff2244;
  --bg: #1c1c1c;
  --bg-panel: #242424;
  --bg-dark: #141414;
  --border-red: #cc2233;
  --border-dim: #333;
  --text: #ffffff;
  --text-dim: #bbbbbb;
  --text-muted: #777777;
}

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

html {
  height: 100%;
}

body {
  min-height: 100vh;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  display: flex;
  flex-direction: column;
}

/* SCANLINE */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.025) 3px, rgba(0,0,0,0.025) 6px);
  pointer-events: none;
  z-index: 9999;
}

/* HEADER */
header {
  background: var(--bg-dark);
  border-bottom: 3px solid var(--border-red);
  box-shadow: 0 2px 16px rgba(200,30,50,0.3);
  flex-shrink: 0;
}

.header-main {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  align-items: center;
  padding: 12px 28px;
  gap: 16px;
}

.logo-area { display: flex; align-items: center; gap: 12px; }

.logo-wings {
  width: 60px; height: 60px; flex-shrink: 0;
}
.logo-wings svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.4));
}

.logo-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 15px; font-weight: 900;
  color: var(--text); letter-spacing: 2px;
}
.logo-sub { font-size: 9px; color: var(--red-bright); letter-spacing: 1.5px; margin-top: 3px; }

.header-center { text-align: center; }

.site-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 42px; font-weight: 900;
  color: var(--text); letter-spacing: 8px;
  position: relative; display: inline-block;
}

.site-title::after {
  content: attr(data-text);
  position: absolute; left: 3px; top: 2px;
  color: var(--red); opacity: 0;
  clip-path: inset(100% 0 0 0);
  animation: glitch 5s infinite;
}

@keyframes glitch {
  0%,88%,100% { opacity: 0; clip-path: inset(100% 0 0 0); }
  90% { opacity: 0.4; clip-path: inset(15% 0 65% 0); left: -2px; }
  93% { opacity: 0.3; clip-path: inset(55% 0 15% 0); left: 3px; }
  96% { opacity: 0.25; clip-path: inset(35% 0 40% 0); left: -1px; }
}

.header-right {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 16px; font-size: 13px; color: var(--text-dim);
}

.user-badge { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 12px; letter-spacing: 1px; }
.search-icon { cursor: pointer; }

/* NAV */
nav {
  display: flex; justify-content: center;
  border-top: 1px solid var(--border-dim);
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px; letter-spacing: 1.5px;
  padding: 10px 24px;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

nav a:hover { color: var(--text); border-bottom-color: rgba(204,34,51,0.4); }

nav a.active {
  color: var(--red-bright);
  border-bottom-color: var(--red-bright);
}

/* HERO BANNER */
.hero-banner {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-dim);
  padding: 10px 28px;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}

.hero-headline {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--text); letter-spacing: 1px;
}
.hero-headline .sep { color: var(--text-muted); margin: 0 8px; }
.hero-headline .subtitle { font-family: 'Share Tech Mono', monospace; font-size: 13px; font-weight: 400; color: var(--text-dim); }

.ops-label {
  color: var(--text); font-size: 12px; letter-spacing: 2px;
  border: 1px solid var(--border-dim); padding: 4px 14px;
  background: rgba(255,255,255,0.03);
}

/* MAIN LAYOUT */
.main-wrap {
  display: grid;
  grid-template-columns: 240px 1fr 260px;
  gap: 14px;
  padding: 14px 28px;
  flex: 1;
  min-height: 0;
}

.sidebar-left, .sidebar-right {
  display: flex; flex-direction: column; gap: 12px;
  min-height: 0;
}

/* stretch last fill-panel to take remaining space */
.fill-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.fill-panel .panel-body {
  display: flex; flex-direction: column; gap: 6px;
}

/* PANELS */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  display: flex; flex-direction: column;
}

.panel-hdr {
  color: var(--text); font-size: 12px; letter-spacing: 2px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-dim);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

.panel-body { padding: 12px 14px; flex: 1; }

.sys-line { font-size: 12px; color: var(--text-dim); margin: 4px 0; }
.sys-line span { color: var(--text); }

.graph-area {
  background: var(--bg-panel); border: 1px solid var(--border-dim);
  padding: 10px; height: 90px; overflow: hidden; flex-shrink: 0;
}
.graph-area svg { width: 100%; height: 100%; }

.user-panel {
  background: var(--bg-panel); border: 1px solid var(--border-dim);
  padding: 14px; flex-shrink: 0;
}
.user-label { font-size: 11px; color: var(--text-muted); letter-spacing: 2px; margin-bottom: 10px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; background: var(--border-dim);
  border: 1px solid var(--border-dim); border-radius: 2px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.user-name { color: var(--text); font-size: 13px; }
.user-status { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

.intel-item {
  font-size: 11px; color: var(--text-dim);
  padding: 5px 0; border-bottom: 1px solid rgba(50,50,50,0.6);
}
.intel-item:last-child { border-bottom: none; }

/* CENTER */
.center-content { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.hero-card {
  background: var(--bg-panel);
  border: 2px solid var(--border-red);
  box-shadow: 0 0 18px rgba(204,34,51,0.2);
  overflow: hidden; flex-shrink: 0;
}

.hero-title-bar {
  padding: 10px 16px; border-bottom: 1px solid var(--border-dim); background: var(--bg-dark);
}
.hero-main-title {
  font-family: 'Orbitron', sans-serif; font-size: 14px; font-weight: 700;
  color: var(--text); letter-spacing: 1px;
}
.hero-sub-title { color: var(--text-dim); font-size: 12px; margin-top: 3px; }

.hero-img {
  width: 100%; height: 240px;
  background: linear-gradient(135deg, #1c1c1c 0%, #222 50%, #181818 100%);
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.hero-img::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 60%, rgba(204,34,51,0.06) 0%, transparent 70%);
}
.hero-placeholder {
  font-family: 'Orbitron', sans-serif; font-size: 48px;
  color: rgba(255,255,255,0.06); letter-spacing: 10px;
}
.hero-overlay-tags {
  position: absolute; bottom: 12px; right: 12px; display: flex; gap: 8px;
}
.tag {
  font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 900;
  letter-spacing: 2px; padding: 3px 10px; color: var(--text);
  border: 1px solid rgba(255,255,255,0.25);
}

/* NEWS GRID */
.news-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; flex-shrink: 0;
}
.news-card {
  background: var(--bg-panel); border: 1px solid var(--border-red);
  padding: 10px; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column; gap: 6px;
}
.news-card:hover { background: #2a1a1c; box-shadow: 0 0 10px rgba(204,34,51,0.2); }
.news-thumb {
  width: 100%; height: 56px;
  background: linear-gradient(135deg, #2a1a1c, #221418);
  border: 1px solid var(--border-red);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.news-source { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.news-headline { font-size: 11px; color: var(--text); line-height: 1.5; }
.news-time { font-size: 10px; color: var(--text-muted); margin-top: auto; }

/* ARTICLE LIST */
.article-list { flex: 1; display: flex; flex-direction: column; gap: 1px; min-height: 0; }
.article-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px;
  background: var(--bg-panel);
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--border-dim);
  cursor: pointer; transition: border-left-color 0.2s, background 0.2s;
  flex: 1;
}
.article-item:hover { border-left-color: var(--red); background: #262020; }
.article-dot { color: var(--red-bright); font-size: 13px; margin-top: 1px; flex-shrink: 0; }
.article-title { font-size: 13px; color: var(--text); line-height: 1.4; }
.article-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* RIGHT SIDEBAR */
.panel-item {
  font-size: 11px; color: var(--text-dim);
  padding: 7px 0; border-bottom: 1px solid rgba(55,55,55,0.5);
  cursor: pointer; transition: color 0.2s;
  line-height: 1.5;
}
.panel-item:hover { color: var(--text); }
.panel-item:last-child { border-bottom: none; }
.panel-item.hi { color: var(--text); }

.msg-item {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid rgba(55,55,55,0.5);
  font-size: 11px; cursor: pointer;
}
.msg-item:last-child { border-bottom: none; }
.msg-icon {
  width: 22px; height: 18px; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; flex-shrink: 0; color: var(--text-dim);
}
.msg-title { color: var(--text); margin-bottom: 3px; }
.msg-preview { color: var(--text-muted); }

/* BOTTOM TICKER */
.bottom-ticker {
  background: var(--bg-dark);
  border-top: 3px solid var(--border-red);
  padding: 9px 0;
  overflow: hidden; white-space: nowrap;
  box-shadow: 0 -4px 16px rgba(204,34,51,0.2);
  flex-shrink: 0;
}
.ticker-track {
  display: inline-block;
  animation: scroll-left 40s linear infinite;
  font-size: 13px; color: var(--text); letter-spacing: 1.5px;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes scroll-left {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}
.ticker-label { color: var(--red-bright); font-weight: bold; margin-right: 8px; }
.ticker-sep { color: var(--text-muted); margin: 0 18px; }

/* Leaflet Map Fix */
#map {
  width: 100% !important;
  height: 600px !important;
  min-height: 600px !important;
  flex: none !important;
  display: block !important;
}

/* CHAT */
.chat-box { display:flex; flex-direction:column; height:200px; }
.chat-messages { flex:1; overflow-y:auto; font-size:11px; color:var(--text-dim); margin-bottom:8px; line-height:1.6; }
.chat-messages .cm { margin-bottom:3px; padding-bottom:3px; border-bottom:1px solid rgba(55,55,55,0.4); }
.chat-messages .cm:last-child { border-bottom:none; }
.chat-messages .cn { color:var(--red-bright); font-weight:bold; }
.chat-name-row { margin-bottom:6px; }
.chat-name-row input,
.chat-input-row input {
  background:var(--bg-dark);
  border:1px solid var(--border-dim);
  color:var(--text);
  padding:5px 8px;
  font-size:11px;
  font-family:'Share Tech Mono', monospace;
  width:100%;
  box-sizing:border-box;
}
.chat-name-row input:focus,
.chat-input-row input:focus { border-color:var(--red); outline:none; }
.chat-input-row { display:flex; gap:4px; }
.chat-input-row input { width:auto; flex:1; }
.chat-input-row button {
  background:none;
  border:1px solid var(--red);
  color:var(--red);
  padding:5px 10px;
  cursor:pointer;
  font-size:10px;
  letter-spacing:1px;
  font-family:'Share Tech Mono', monospace;
  transition:background 0.2s, color 0.2s;
}
.chat-input-row button:hover { background:var(--red); color:var(--text); }

/* =========================================
   ANTI-MARKIERUNG (NATIVE APP FEELING)
   ========================================= */
.nomark {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Verhindert global, dass Bilder & Logos per Drag & Drop gezogen werden */
img, svg {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* =========================================
   LIVE TERMINAL LOGS
   ========================================= */
.log-container {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  height: 120px;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.log-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  animation: logFadeIn 0.3s forwards;
}
.log-ok { color: #22cc44; }
.log-warn { color: #cc2233; }
.log-info { color: #888; }

@keyframes logFadeIn {
  from { opacity: 0; transform: translateX(-5px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =========================================
   LIVE SYSTEM LOGS
   ========================================= */
.log-container {
  height: 120px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse; /* Neue Logs erscheinen oben */
  gap: 4px;
}
.log-line {
  font-size: 10px;
  font-family: 'Share Tech Mono', monospace;
  white-space: nowrap;
  letter-spacing: 0.5px;
  opacity: 0.9;
  animation: logFadeIn 0.3s ease-out forwards;
}
@keyframes logFadeIn {
  from { opacity: 0; transform: translateX(-5px); }
  to { opacity: 0.9; transform: translateX(0); }
}
.log-ts { color: #555; margin-right: 5px; }
.log-tag-ok { color: #22cc44; font-weight: bold; }
.log-tag-warn { color: #ccaa22; font-weight: bold; }
.log-tag-err { color: #cc2233; font-weight: bold; }
.log-msg { color: #aaa; }

/* =========================================
   FIX: LIVE SYSTEM LOGS (Kein Überlappen)
   ========================================= */
.log-container {
  height: 140px; /* Etwas mehr Platz */
  overflow: hidden;
  display: flex;
  flex-direction: column; /* Normaler Fluss von oben nach unten */
  gap: 6px; /* Klarer Abstand zwischen den Zeilen */
  padding: 5px 0;
}

.log-line {
  font-size: 10px;
  line-height: 1.4; /* Sorgt für vertikalen Platz */
  font-family: 'Share Tech Mono', monospace;
  white-space: nowrap;
  letter-spacing: 0.5px;
  opacity: 0.9;
  flex-shrink: 0; /* WICHTIG: Verhindert, dass Zeilen gequetscht werden */
  animation: logFadeIn 0.3s ease-out forwards;
}

@keyframes logFadeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 0.9; transform: translateX(0); }
}

.log-ts { color: #555; margin-right: 6px; font-weight: normal; }
.log-tag-ok { color: #22cc44; font-weight: bold; margin-right: 4px; }
.log-tag-warn { color: #ccaa22; font-weight: bold; margin-right: 4px; }
.log-tag-err { color: #cc2233; font-weight: bold; margin-right: 4px; }
.log-msg { color: #aaa; }

/* =========================================
   MOBILE & TABLET RESPONSIVE PATCH
   ========================================= */

/* Tablet-Ansicht (bis 1100px Breite) */
@media (max-width: 1100px) {
  /* News-Bereich auf 2 statt 4 Spalten reduzieren */
  .news-grid { 
    grid-template-columns: repeat(2, 1fr); 
  }
}

/* Smartphone-Ansicht (bis 900px Breite) */
@media (max-width: 900px) {
  /* Verhindert horizontales Scrollen durch die Partikel-Canvas */
  html, body { 
    overflow-x: hidden; 
  }

  /* 1. Header anpassen */
  .header-main {
    grid-template-columns: 1fr; /* Alles in eine Spalte */
    justify-content: center;
    text-align: center;
    padding: 15px;
    gap: 12px;
  }
  .logo-area { 
    justify-content: center; 
  }
  .header-right { 
    justify-content: center; 
  }
  .site-title { 
    font-size: 26px; /* Schrift auf dem Handy etwas kleiner */
    letter-spacing: 4px;
  }

  /* 2. Navigation flexibel machen */
  nav {
    flex-wrap: wrap; /* Erlaubt Umbrüche in die nächste Zeile */
    padding: 5px;
  }
  nav a {
    padding: 8px 12px;
    font-size: 11px;
    flex: 1 1 auto; /* Tasten passen sich dem Platz an */
    text-align: center;
  }

  /* 3. Main-Bereich stapeln (Flexbox) */
  .main-wrap {
    display: flex;
    flex-direction: column; /* Spalten werden zu Zeilen */
    padding: 10px;
    gap: 20px;
  }

  /* Wir sortieren das Layout für das Handy logisch um: */
  /* Content (Mitte) ganz oben, dann System Logs (Links), dann Chat (Rechts) */
  .center-content { order: 1; }
  .sidebar-left   { order: 2; }
  .sidebar-right  { order: 3; }

  /* 4. Hero Banner (Active Ops) */
  .hero-banner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  .hero-img { 
    height: 160px; /* Bild nicht ganz so hoch auf dem Handy */
  }

  /* 5. News Grid auf 1 Spalte reduzieren */
  .news-grid { 
    grid-template-columns: 1fr; 
  }
  
  /* 6. Die Sidebar-Panels den kompletten Platz nutzen lassen */
  .fill-panel {
    min-height: auto;
  }
}

/* =========================================
   MOBILE PATCH V2 (ÜBERSCHREIBT ALTE FEHLER)
   ========================================= */
@media (max-width: 900px) {
  /* 1. Body-Höhe freigeben (Fixt die Ticker-Überlappung) */
  html, body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
  }

  /* 2. Main Wrap flexibel machen (Erlaubt Scrollen) */
  .main-wrap {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px !important;
  }

  /* 3. Alle Spalten auf 100% Breite und Auto-Höhe */
  .sidebar-left, .center-content, .sidebar-right {
    width: 100% !important;
    height: auto !important;
    min-height: min-content !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* 4. Die Boxen (Panels) reparieren, damit nichts ausbricht */
  .panel, .fill-panel {
    flex: none !important;
    height: auto !important;
    min-height: min-content !important;
    overflow: visible !important;
  }
  .panel-body {
    height: auto !important;
    overflow: visible !important;
  }

  /* 5. Navigation zu sauberen Kacheln umbauen */
  nav {
    flex-wrap: wrap !important;
    padding: 5px !important;
  }
  nav a {
    flex: 1 1 30% !important; /* 3 Buttons pro Reihe */
    padding: 12px 5px !important;
    font-size: 11px !important;
    text-align: center !important;
    border-bottom: 1px solid var(--border-dim) !important;
  }

  /* 6. Chat und Logs genug Platz geben */
  .chat-box {
    height: 350px !important;
  }
  .log-container {
    height: 180px !important;
  }
}

/* =========================================
   MOBILE CLEANUP (Schlankes Terminal)
   ========================================= */
@media (max-width: 900px) {
  /* 1. Unnötigen Vibe ausblenden (Graph & Intel Feed) */
  .graph-area,
  .fill-panel {
    display: none !important;
  }

  /* 2. Security Logs stark komprimieren (Nur 3 Zeilen zeigen) */
  .log-container {
    height: 70px !important;
  }
  
  /* 3. System Status kompakter machen */
  .sys-line {
    margin: 2px 0 !important;
    font-size: 11px !important;
  }
  
  /* 4. Chat etwas kompakter halten */
  .chat-box {
    height: 250px !important; /* Etwas weniger wuchtig als auf dem Desktop */
  }
}

/* =========================================
   MOBILE CLEANUP V2 (RADIKAL-KUR)
   ========================================= */
@media (max-width: 900px) {
  /* Killt die Security Logs (Das 4. Element in der linken Sidebar) */
  .sidebar-left > div:nth-child(4) {
    display: none !important;
  }
  
  /* Killt die Active Ops Liste (Das 1. Element in der rechten Sidebar) */
  .sidebar-right > div:first-child {
    display: none !important;
  }
}

/* =========================================
   MOBILE PATCH V3 (NEWS.PHP OPTIMIERUNG)
   ========================================= */
@media (max-width: 900px) {
  /* 1. News-Raster auf dem Handy erzwingen (1 Spalte) */
  .news-grid-page {
    grid-template-columns: 1fr !important; /* Nur noch eine News-Kachel pro Zeile */
    padding: 15px !important; /* Weniger Rand außen */
    gap: 12px !important;
  }

  /* 2. Artikel-Modal für kleine Screens optimieren */
  .modal-news-inner {
    max-height: 95vh !important; /* Fast die ganze Höhe nutzen */
  }
  
  .news-art-body {
    padding: 15px !important; /* Weniger Platz verschwenden */
  }

  .news-art-title {
    font-size: 16px !important; /* Titel etwas kleiner */
    line-height: 1.3 !important;
  }
  
  .news-art-content {
    font-size: 12px !important; /* Text leicht verkleinern, damit mehr raufpasst */
    padding-top: 12px !important;
  }
  
  /* Bild im Artikel anpassen */
  .news-art-img img {
    max-height: 35vh !important; /* Bild darf nicht den halben Text verdecken */
  }
}

/* =========================================
   MOBILE PATCH V4 (MEDIA SWIPE CAROUSEL)
   ========================================= */
@media (max-width: 900px) {
  /* 1. Grid in ein horizontales, scrollbares Flex-Layout umwandeln */
  .media-grid {
    display: flex !important;
    flex-wrap: nowrap !important; /* Verhindert Zeilenumbruch */
    overflow-x: auto !important;  /* Erlaubt horizontales Scrollen */
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch; /* Flüssiges Scrollen auf iOS */
    scroll-snap-type: x mandatory; /* "Einrasten" beim Wischen */
    padding: 15px 20px 25px 20px !important; /* Etwas Platz unten für Schatten */
    gap: 15px !important;
  }

  /* 2. Scrollbar verstecken für den cleanen App-Look */
  .media-grid::-webkit-scrollbar {
    display: none;
  }
  .media-grid {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
  }

  /* 3. Kacheln anpassen (ca. 85% Breite, damit die nächste andeutet) */
  .media-grid .media-card {
    flex: 0 0 85% !important; /* Nimmt 85% der Breite ein */
    max-width: 320px !important;
    scroll-snap-align: center; /* Rastet mittig ein */
  }

  /* 4. Abstände der Überschriften verkleinern */
  .page-header h2 {
    margin-top: 30px !important;
    padding-bottom: 8px !important;
    font-size: 13px !important;
  }
  .page-header.first-section h2 {
    margin-top: 10px !important;
  }

  /* 5. Modal & Video Player fürs Handy anpassen */
  .media-modal-inner {
    max-height: 95vh !important;
  }
  .yt-frame {
    height: 240px !important; /* Verhindert, dass das Video auf dem Handy zu hoch ist */
  }
  .media-modal-body {
    padding: 15px !important;
  }
  .media-modal-title {
    font-size: 16px !important;
    line-height: 1.3 !important;
  }
  .media-modal-desc {
    font-size: 12px !important;
    padding-top: 10px !important;
  }
}

/* =========================================
   MOBILE PATCH V5 (EDITORIAL FORM FIX)
   ========================================= */
@media (max-width: 900px) {
  /* 1. Erzwingt einen sauberen Rand für die Formular-Seite */
  .main-wrap {
    padding: 20px 15px !important;
    box-sizing: border-box !important;
  }
  
  /* 2. Verhindert, dass der Titel aus dem Bildschirm raget */
  .hero-title-bar {
    width: 100% !important;
    padding: 0 5px !important;
    box-sizing: border-box !important;
    text-align: center !important; /* Zentriert wirkt auf dem Handy oft besser */
  }

  /* 3. Das Formular-Panel anpassen */
  .contact-panel {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* 4. Inputs auf Touch-Größe bringen (Apple/Google Guidelines) */
  .contact-panel input,
  .contact-panel textarea {
    font-size: 16px !important; /* Verhindert, dass iOS beim Tippen automatisch heranzoomt */
    padding: 10px !important;
  }

  .btn-save {
    width: 100% !important; /* Button nimmt die volle Breite ein -> leichter zu tippen */
    padding: 12px !important;
    margin-top: 10px !important;
  }
}

/* =========================================
   MOBILE PATCH V6 (BOTTOM APP BAR)
   ========================================= */
@media (max-width: 900px) {
  /* Platz für die untere Leiste machen */
  body {
    padding-bottom: 60px !important;
  }
  
  /* Top-Nav in eine Bottom-App-Bar verwandeln */
  nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: rgba(10, 10, 10, 0.95) !important;
    backdrop-filter: blur(5px) !important;
    border-top: 2px solid var(--red) !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important; /* Seitliches Wischen erlauben */
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.8) !important;
  }
  
  /* Scrollbar der App-Bar verstecken */
  nav::-webkit-scrollbar { display: none; }
  nav { -ms-overflow-style: none; scrollbar-width: none; }
  
  /* Buttons umgestalten */
  nav a {
    flex: 0 0 auto !important;
    padding: 18px 16px !important;
    font-size: 11px !important;
    border-bottom: none !important;
    border-top: 3px solid transparent !important;
  }
  nav a.active {
    border-bottom: none !important;
    border-top: 3px solid var(--red-bright) !important;
    background: rgba(204, 34, 51, 0.1) !important;
  }
}

/* =========================================
   KILL NATIVE PULL-TO-REFRESH
   ========================================= */
html, body {
  /* Verbietet dem Handy den Standard-Ladekreis beim Runterziehen */
}

/* =========================================
   MEDIA GRID ALIGNMENT FIX (GLEICHE HÖHE)
   ========================================= */
.media-grid {
  align-items: stretch !important; /* Zwingt alle Zellen in einer Reihe auf die exakt gleiche Höhe */
}

.media-card {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important; /* Füllt die Zelle bis zum Rand aus */
}

.media-card-body {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important; /* Nimmt sich den ganzen verfügbaren restlichen Platz */
}

/* Drückt das Datum/Meta-Info immer exakt auf den Boden der Karte */
.media-card-meta {
  margin-top: auto !important; 
}

/* Optional: Titelhöhe begrenzen, falls ein Titel mal extrem lang ist (schneidet sauber ab) */
.media-card-title {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important; /* Maximal 2 Zeilen Text */
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

/* =========================================
   DESKTOP GRID HORIZONTAL ALIGNMENT FIX
   ========================================= */
@media (min-width: 901px) {
  /* Nagelt die Überschriften linksbündig fest */
  .page-header {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 40px 0 10px 0 !important; /* Null Abstand nach links/rechts */
    text-align: left !important;
  }
  
  /* Nagelt die Karten exakt bündig unter die Überschriften */
  .media-grid {
    max-width: 1200px !important;
    margin: 0 auto 40px auto !important;
    padding: 0 !important; /* Null Abstand nach links/rechts */
    justify-content: center !important; /* Zwingt alle Karten kompromisslos nach links */
  }
}

/* =========================================
   DESKTOP ALIGNMENT NUKE (ABSOLUTE LINE-UP)
   ========================================= */
@media (min-width: 901px) {
  /* Überschriften und Grids auf exakt dasselbe Raster zwingen */
  .page-header,
  .media-grid {
    width: 100% !important;
    max-width: 1300px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important; /* Verhindert, dass Ränder das Layout sprengen */
  }

  /* Überschriften-Block: Harter linker Rand */
  .page-header {
    padding: 40px 28px 10px 28px !important;
    text-align: left !important;
    display: block !important;
    clear: both !important;
  }

  /* Media-Block: Exakt derselbe linke Rand wie die Überschrift */
  .media-grid {
    padding: 0 28px 40px 28px !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    justify-content: start !important; /* Alles kompromisslos nach links drücken */
    align-content: start !important;
  }
}

/* =========================================
   HEADER SOCIAL LINKS (RECHTS VOM TEXT)
   ========================================= */
.header-socials {
  display: flex !important;
  gap: 6px !important;
  margin-left: 20px !important; /* Abstand nach links zum Text */
  margin-right: 0 !important;
  border-left: 1px solid #333 !important; /* Trennstrich links statt rechts */
  border-right: none !important;
  padding-left: 15px !important;
  padding-right: 0 !important;
  align-items: center !important;
}

/* =========================================
   HEADER SOCIAL LINKS (BULLETPROOF)
   ========================================= */
.header-socials {
  display: flex !important;
  gap: 6px !important;
  margin-left: 15px !important; 
  border-left: 1px solid #333 !important; 
  padding-left: 15px !important;
  align-items: center !important;
}
.soc-link {
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 11px !important;
  font-weight: bold !important;
  text-decoration: none !important;
  color: #555 !important;
  border: 1px solid #2a2a2a !important;
  padding: 3px 6px !important;
  background: rgba(0,0,0,0.4) !important;
  transition: all 0.2s ease !important;
}

/* =========================================
   TEXT OVERFLOW FIX (DUNKELBUNTE & MODALS)
   ========================================= */
.status-text, 
.qr-text, 
#mod-content {
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  word-break: break-word !important; /* Bricht auch Endlos-Strings brutal um */
  hyphens: auto !important; /* Fügt bei echtem Text feine Trennstriche ein */
}

/* MOBILE MODAL FIX */
@media (max-width: 768px) {
  .modal-news-inner {
    max-height: 85vh !important; /* Etwas Platz oben/unten lassen */
    margin-top: 5vh !important;
    display: flex;
    flex-direction: column;
  }

  .news-art-body {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 120px !important; /* MASSIVES PADDING UNTEN */
    -webkit-overflow-scrolling: touch;
  }
  
  /* Verhindert, dass das Menü den Text abschneidet */
  .news-art-content {
    margin-bottom: 60px !important;
  }
}

/* =========================================
   HARDCORE MOBILE SCROLL FIX (NEWS MODAL)
   ========================================= */
@media (max-width: 768px) {
  /* Zwingt den unsichtbaren Modal-Hintergrund, vor dem Menü zu stoppen */
  .news-art-modal {
    padding-bottom: 80px !important; /* Exakter Platz für dein Menü */
    box-sizing: border-box !important;
  }
  
  /* Das eigentliche Fenster darf nicht größer werden als der restliche Platz */
  .modal-news-inner {
    max-height: 100% !important; 
    margin-top: 15px !important;
    margin-bottom: 0 !important;
  }
  
  /* Ein massives, unsichtbares Polster direkt unter dem letzten Buchstaben */
  .news-art-content {
    padding-bottom: 120px !important; 
  }
}

/* =========================================
   MOBILE FIX: TICKER OVERLAP
   ========================================= */
@media (max-width: 768px) {
  body {
    padding-bottom: 75px !important; /* Unsichtbares Polster am unteren Rand */
  }
  .bottom-ticker {
    z-index: 9999; /* Stellt sicher, dass er über dem Text, aber unter dem Polster bleibt */
  }
}

/* =========================================
   DROPDOWN MENU STYLES
   ========================================= */
nav .dropdown {
  display: inline-block;
  position: relative;
}
nav .dropdown-content {
  display: none;
  position: absolute;
  background-color: #080808;
  min-width: 180px;
  box-shadow: 0px 8px 25px 0px rgba(0,0,0,0.9);
  z-index: 10000;
  border: 1px solid #cc2233;
  border-top: none;
  left: 50%;
  transform: translateX(-50%);
  top: 100%;
}
nav .dropdown-content a {
  color: #aaa;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: center;
  font-size: 13px;
  border-bottom: 1px dashed #222;
  margin: 0;
}
nav .dropdown-content a:last-child {
  border-bottom: none;
}
nav .dropdown-content a:hover {
  background-color: rgba(204,34,51,0.1);
  color: #fff;
  text-shadow: 0 0 8px #cc2233;
}
nav .dropdown:hover .dropdown-content {
  display: block;
}
nav .dropdown:hover .dropbtn {
  color: #cc2233;
  text-shadow: 0 0 10px #cc2233;
}

@media (max-width: 768px) {
  nav .dropdown-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-top: 1px solid #cc2233;
  }
}

/* =========================================
   FORCED DROPDOWN STYLES (OVERRIDE)
   ========================================= */
nav .dropdown { display: inline-block; position: relative; }
nav .dropbtn { display: inline-block; padding: 0 10px; cursor: pointer; }
nav .dropdown-content { display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); background-color: #080808; border: 1px solid #cc2233; border-top: none; z-index: 10000; min-width: 180px; box-shadow: 0px 8px 25px rgba(0,0,0,0.9); }
nav .dropdown-content a { display: block; padding: 12px; margin: 0; border-bottom: 1px dashed #222; text-align: center; }
nav .dropdown-content a:last-child { border-bottom: none; }
nav .dropdown:hover .dropdown-content { display: block; }
nav .dropdown:hover .dropbtn { color: #cc2233; text-shadow: 0 0 10px #cc2233; }

/* =========================================
   HOTFIX: DROPDOWN VERTICAL ALIGNMENT
   ========================================= */
nav .dropdown {
  display: inline-flex !important;
  align-items: center;
  vertical-align: top;
  height: 100%;
}
nav .dropbtn {
  display: inline-flex !important;
  align-items: center;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* =========================================
   NUKLEAR-HOTFIX: FLEXBOX NAVIGATION
   ========================================= */
nav {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important; /* Hält das Menü linksbündig oder zentriert, je nach Container */
  gap: 20px; /* Perfekter, gleichmäßiger Abstand zwischen allen Links */
}

/* Zwingt die Links und das Dropdown auf exakt die gleiche Höhe */
nav > a, nav > .dropdown {
  display: flex !important;
  align-items: center !important;
  margin: 0 !important; /* Killt alle versteckten Abstände */
  height: 100% !important;
}

nav .dropbtn {
  display: flex !important;
  align-items: center !important;
  padding: 0 !important;
}
