:root {
  --black: #0A0A0A;
  --panel: #161618;
  --panel-soft: #1c1c1f;
  --border: #2A2A2E;
  --red: #FF1E27;
  --red-dim: #8f1217;
  --text: #F2F2F2;
  --text-dim: #9A9AA0;
  --green: #35e07a;
  --font-sans: "Rajdhani", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Share Tech Mono", "Consolas", "SF Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
}

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #140405 0%, #0A0A0A 70%);
}
.login-card {
  text-align: center;
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 0 50px rgba(255, 30, 39, 0.18);
  min-width: 280px;
}
.login-ring {
  width: 70px; height: 70px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 2px solid var(--red);
  box-shadow: 0 0 25px var(--red), inset 0 0 15px var(--red);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.12); opacity: 1; }
}
.login-card h1 { letter-spacing: 4px; font-weight: 500; margin-bottom: 20px; color: var(--text); }
.login-card h1 span { color: var(--red); font-weight: 700; display: block; font-size: 0.5em; letter-spacing: 6px; }
.login-card input {
  background: #0d0d0e;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 1em;
  font-family: var(--font-mono);
  width: 100%;
  margin-bottom: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--red); }
.login-card button {
  background: var(--red);
  color: #0A0A0A;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  width: 100%;
  text-transform: uppercase;
}
.login-error { color: var(--red); min-height: 1.2em; margin-top: 10px; font-size: 0.9em; }

/* ---------- Grundgeruest ---------- */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------- Kopf ---------- */
#headerBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex: 0 0 auto;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 700; letter-spacing: 3px; font-size: 1.05em; }
.header-sep { color: var(--border); }
.reactor-status { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.82em; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 16px; }
#clock { font-family: var(--font-mono); color: var(--text); letter-spacing: 1px; }
.status-pill { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.8em; color: var(--green); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); display: inline-block; animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.logout { color: var(--text-dim); text-decoration: none; font-size: 0.8em; }
.logout:hover { color: var(--red); }

/* ---------- 3-Spalten-Layout ---------- */
#layout {
  flex: 1;
  display: grid;
  grid-template-columns: 30% 38% 32%;
  min-height: 0;
}
.panel {
  padding: 16px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  min-height: 0;
}
#colRight { border-right: none; border-left: 1px solid var(--border); display: flex; flex-direction: column; }

/* ---------- Links: Chat ---------- */
.col-title {
  font-size: 0.95em;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.chat-log { display: flex; flex-direction: column; gap: 10px; }
.chat-card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.88em;
  animation: fadeIn 0.25s ease-out;
}
.chat-card.user { border-left-color: var(--text-dim); }
.chat-card .who { font-family: var(--font-mono); font-size: 0.72em; letter-spacing: 1px; color: var(--red); text-transform: uppercase; }
.chat-card.user .who { color: var(--text-dim); }
.chat-card .txt { margin-top: 4px; line-height: 1.4; }
.chat-card .ts { float: right; color: var(--text-dim); font-family: var(--font-mono); font-size: 0.7em; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Mitte: Reaktor ---------- */
#colCenter { display: flex; flex-direction: column; border-right: 1px solid var(--border); padding-bottom: 10px; }
#reactorWrap { position: relative; flex: 1 1 auto; min-height: 220px; display: flex; align-items: center; justify-content: center; }
#coreCanvas { width: 100%; height: 100%; }

#globeOverlay {
  position: absolute; inset: 0;
  background: rgba(10,10,10,0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 5;
}
#globeOverlay.hidden { display: none; }
#globeViz { position: absolute; inset: 0; }
#closeGlobe {
  position: absolute; top: 8px; right: 8px; z-index: 6;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 0.9em;
}
#closeGlobe:hover { border-color: var(--red); color: var(--red); }

#statusRow { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 4px 0; }
.status-badge {
  font-family: var(--font-mono);
  font-size: 0.78em;
  letter-spacing: 2px;
  color: var(--red);
  border: 1px solid var(--red-dim);
  border-radius: 20px;
  padding: 4px 14px;
  text-shadow: 0 0 8px rgba(255,30,39,0.6);
}
.audio-wave { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.audio-wave span {
  width: 3px; background: var(--red); border-radius: 2px;
  height: 20%; box-shadow: 0 0 4px rgba(255,30,39,0.8);
  transition: height 0.08s ease-out;
}

#subtitles {
  min-height: 2.6em;
  text-align: center;
  padding: 6px 24px;
  font-size: 1.02em;
  overflow-y: auto;
}

#controls { display: flex; gap: 10px; padding: 8px 20px; align-items: center; }
#textInput {
  flex: 1;
  background: #0d0d0e;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 20px;
  outline: none;
  font-family: var(--font-sans);
}
#textInput:focus { border-color: var(--red); }
.round-btn {
  border: 1px solid var(--red-dim);
  background: transparent;
  color: var(--red);
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 1.1em;
  cursor: pointer;
  flex: 0 0 auto;
}
.round-btn:hover { border-color: var(--red); }
#micBtn.listening {
  background: var(--red); color: #0A0A0A;
  box-shadow: 0 0 22px var(--red), 0 0 46px rgba(255,30,39,0.5);
  animation: micPulse 1s ease-in-out infinite;
}
@keyframes micPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

#wakeRow { display: flex; justify-content: center; padding: 4px 0 2px; }
.wake-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 16px;
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 0.75em;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex; align-items: center; gap: 7px;
}
.wake-toggle.active { color: var(--red); border-color: var(--red-dim); }
.wake-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); display: inline-block; }
.wake-toggle.active .wake-dot { background: var(--red); box-shadow: 0 0 8px var(--red); animation: blink 1.3s ease-in-out infinite; }

#quickPills { padding: 8px 16px 2px; }
.pill-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; flex-wrap: wrap; }
.pill {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.8em;
  cursor: pointer;
  font-family: var(--font-sans);
  letter-spacing: 0.4px;
}
.pill:hover { border-color: var(--red); color: var(--red); }
.pill:active { background: var(--red-dim); }

/* ---------- Rechts: Tabs ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex: 0 0 auto; }
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.8em;
  padding: 10px 4px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.5px;
}
.tab.active { color: var(--red); border-bottom-color: var(--red); }
.tab-panel { display: none; flex: 1; overflow-y: auto; min-height: 0; }
.tab-panel.active { display: block; }

.sub-title { font-size: 0.75em; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); margin: 16px 0 8px; }

.data-list { list-style: none; padding: 0; margin: 0 0 6px; font-size: 0.85em; }
.data-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.muted { color: var(--text-dim); opacity: 0.85; }
.pct-up { color: var(--green); }
.pct-down { color: var(--red); }

.badge { display: inline-block; font-family: var(--font-mono); font-size: 0.68em; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; text-transform: uppercase; }
.badge-aktiv { background: rgba(53,224,122,0.15); color: var(--green); border: 1px solid var(--green); }
.badge-warteschlange { background: rgba(255,30,39,0.12); color: var(--red); border: 1px solid var(--red-dim); }
.badge-pausiert { background: rgba(154,154,160,0.12); color: var(--text-dim); border: 1px solid var(--border); }
.badge-erledigt { background: rgba(80,120,255,0.12); color: #7aa2ff; border: 1px solid #334a9c; }

.next-event { border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: 4px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.9em; }
.next-event b { display: block; font-size: 1.05em; margin-bottom: 2px; }

.sys-meter { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 0.8em; }
.sys-meter span { width: 60px; color: var(--text-dim); }
.sys-meter .bar { flex: 1; height: 8px; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.sys-meter .bar i { display: block; height: 100%; background: var(--red); box-shadow: 0 0 6px rgba(255,30,39,0.6); width: 0%; }
.sys-meter b { width: 44px; text-align: right; font-family: var(--font-mono); font-size: 0.85em; }

/* ---------- Fuss: Laufleiste ---------- */
#ticker {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  background: var(--panel);
  overflow: hidden;
  height: 32px;
  display: flex;
  align-items: center;
}
.ticker-track {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--text-dim);
  padding-left: 100%;
  animation: tickerScroll 38s linear infinite;
}
.ticker-track b { color: var(--red); margin: 0 4px 0 18px; }
@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  #layout { display: flex; flex-direction: column; overflow-y: auto; }
  .panel { border: none !important; border-bottom: 1px solid var(--border) !important; max-height: none; }
  #colCenter { order: 1; }
  #colLeft { order: 2; max-height: 260px; }
  #colRight { order: 3; max-height: 320px; }
  #reactorWrap { min-height: 220px; }
}
