:root {
  --bg-dark: #07090e;
  --bg-card: rgba(13, 17, 23, 0.75);
  --bg-card-hover: rgba(20, 26, 36, 0.85);
  --border-glow: rgba(255, 210, 63, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.08);

  /* Tensura Ciel Palette */
  --gold-primary: #ffd23f;
  --gold-glow: rgba(255, 210, 63, 0.6);
  --gold-dark: #ca6702;
  --amber: #ee9b00;
  --cyan-subtle: #00f2fe;

  /* Alert Mode (Crimson / Raphael Battle Mode) */
  --crimson-primary: #ff2a4b;
  --crimson-glow: rgba(255, 42, 75, 0.7);

  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --font-hud: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-hud);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Master Security Gate (Auth Overlay) */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0f141c 0%, #05070a 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.auth-gate-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: rgba(13, 17, 23, 0.9);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 60px rgba(255, 210, 63, 0.25);
  border-radius: 24px;
  padding: 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(20px);
}

.auth-iris-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 24px auto;
  border-radius: 50%;
  box-shadow: 0 0 35px var(--gold-glow);
}

.auth-iris-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.auth-magic-ring {
  position: absolute;
  inset: -12px;
  border: 2px dashed var(--gold-primary);
  border-radius: 50%;
  animation: rotateOuter 20s linear infinite;
}

.auth-card h2 {
  font-size: 19px;
  letter-spacing: 2px;
  color: var(--gold-primary);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 24px;
}

.auth-form .form-group input {
  text-align: center;
  font-size: 16px;
  letter-spacing: 2px;
  padding: 12px;
  border-radius: 12px;
}

.auth-error-msg {
  color: var(--crimson-primary);
  font-size: 12px;
  margin-top: 10px;
  min-height: 16px;
}

.auth-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
}

/* Background */
.hud-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  top: 15%;
  left: 20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(238, 155, 0, 0.12) 0%, rgba(7, 9, 14, 0) 70%);
  filter: blur(80px);
  transition: background 0.8s ease;
}

body.alarm-mode .ambient-glow {
  background: radial-gradient(circle, rgba(255, 42, 75, 0.22) 0%, rgba(7, 9, 14, 0) 70%);
}

.particle-field {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #ffd23f, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 80px 140px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 150px 220px, #ee9b00, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 300px 90px, #ffd23f, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 450px 320px, rgba(255,255,255,0.8), rgba(0,0,0,0));
  background-size: 550px 550px;
  animation: particleFloat 60s linear infinite;
}

@keyframes particleFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-550px); }
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-glyph {
  font-size: 26px;
  color: var(--gold-primary);
  text-shadow: 0 0 15px var(--gold-glow);
  animation: pulseGlyph 3s ease-in-out infinite;
}

@keyframes pulseGlyph {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); filter: drop-shadow(0 0 10px #ffd23f); }
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 40%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .sub-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.hud-center-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.stat-label {
  color: var(--text-muted);
  font-size: 11px;
}

.stat-value {
  color: var(--gold-primary);
  font-weight: 600;
}

.threat-pill .stat-value {
  color: #10b981;
}

body.alarm-mode .threat-pill .stat-value {
  color: var(--crimson-primary);
  animation: blinkThreat 1s infinite alternate;
}

@keyframes blinkThreat {
  0% { opacity: 0.5; }
  100% { opacity: 1; text-shadow: 0 0 12px var(--crimson-primary); }
}

.hud-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.icon-btn:hover {
  background: rgba(255, 210, 63, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  transform: translateY(-2px);
}

.icon-btn.active {
  color: var(--gold-primary);
  border-color: rgba(255, 210, 63, 0.4);
  box-shadow: 0 0 12px rgba(255, 210, 63, 0.2);
}

.icon-btn.highlight {
  color: #00f2fe;
  border-color: rgba(0, 242, 254, 0.4);
}

.icon-btn.highlight:hover {
  background: rgba(0, 242, 254, 0.15);
  color: #00f2fe;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

/* Grid Layout */
.hud-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  flex: 1;
}

.core-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.core-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(255, 210, 63, 0.05);
  transition: border-color 0.5s ease;
}

body.alarm-mode .core-container {
  border-color: var(--crimson-primary);
  box-shadow: 0 12px 40px rgba(255, 42, 75, 0.25), inset 0 0 30px rgba(255, 42, 75, 0.1);
}

/* Magic Circles */
.magic-circle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  border: 1px dashed rgba(255, 210, 63, 0.25);
  transition: all 0.5s ease;
}

body.alarm-mode .magic-circle {
  border-color: rgba(255, 42, 75, 0.4);
}

.ring-outer {
  width: 380px;
  height: 380px;
  border-width: 1.5px;
  border-style: solid;
  border-color: rgba(255, 210, 63, 0.15);
  border-top-color: var(--gold-primary);
  border-bottom-color: var(--amber);
  animation: rotateOuter 30s linear infinite;
}

.ring-middle {
  width: 320px;
  height: 320px;
  border-width: 2px;
  border-style: dashed;
  border-color: rgba(255, 210, 63, 0.25);
  animation: rotateMiddle 20s linear infinite reverse;
}

.ring-inner {
  width: 270px;
  height: 270px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--gold-primary);
  border-right-color: var(--amber);
  animation: rotateOuter 15s linear infinite;
}

@keyframes rotateOuter {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes rotateMiddle {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

/* Iris Orb & Audio-Reactive Live Wallpaper */
.core-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  height: 440px;
  pointer-events: none;
  z-index: 1;
}

.audio-reactive-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.audio-reactive-svg .base-ring {
  fill: none;
  stroke: rgba(255, 210, 63, 0.15);
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
}

.audio-reactive-svg .wave-path {
  fill: rgba(255, 210, 63, 0.05);
  stroke: url(#manaGradient);
  stroke-width: 2.5;
  stroke-linejoin: round;
  transition: all 0.04s ease-out;
}

.iris-orb {
  width: 230px;
  height: 230px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  cursor: pointer;
  box-shadow: 0 0 var(--voice-glow, 35px) var(--gold-glow);
  transform: scale(var(--voice-scale, 1.0));
  transition: transform 0.08s ease-out, box-shadow 0.15s ease-out;
  overflow: hidden;
}

.iris-orb.speaking {
  box-shadow: 0 0 65px var(--gold-primary), 0 0 95px rgba(255, 210, 63, 0.5);
}

body.alarm-mode .iris-orb {
  box-shadow: 0 0 55px var(--crimson-glow);
}

body.alarm-mode .iris-orb.speaking {
  box-shadow: 0 0 75px var(--crimson-primary);
}

.core-custom-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  transition: filter 0.3s ease;
}

.core-upload-badge {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.iris-orb:hover .core-upload-badge {
  opacity: 1;
}

.core-label {
  margin-top: 20px;
  text-align: center;
  z-index: 2;
}

.core-sub {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.core-state {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--gold-primary);
  margin-top: 4px;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.4);
  transition: color 0.3s ease;
}

.core-state.listening {
  color: #10b981;
  text-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.core-state.analyzing {
  color: #f59e0b;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.core-state.speaking {
  color: var(--gold-primary);
  text-shadow: 0 0 15px rgba(255, 210, 63, 0.8);
}

body.alarm-mode .core-state {
  color: var(--crimson-primary);
  text-shadow: 0 0 12px var(--crimson-glow);
}

/* Live Voice Mode Button */
.live-mode-wrapper {
  margin-top: 16px;
  z-index: 3;
  width: 100%;
  max-width: 320px;
}

.live-voice-btn {
  width: 100%;
  padding: 12px 18px;
  border-radius: 30px;
  background: rgba(255, 210, 63, 0.08);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  font-family: var(--font-hud);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(255, 210, 63, 0.15);
}

.live-voice-btn:hover {
  background: rgba(255, 210, 63, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(255, 210, 63, 0.3);
}

.live-voice-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
  animation: pulseLiveBtn 1.5s infinite alternate;
}

@keyframes pulseLiveBtn {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(16, 185, 129, 0.3); }
  100% { transform: scale(1.03); box-shadow: 0 0 35px rgba(16, 185, 129, 0.6); }
}

.live-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-primary);
}

.live-voice-btn.active .live-indicator {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

/* Live Shimmer Sweep across the Magic Circle */
.iris-shimmer-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(255, 210, 63, 0) 260deg, rgba(255, 240, 180, 0.45) 320deg, transparent 360deg);
  mix-blend-mode: color-dodge;
  pointer-events: none;
  animation: rotateShimmerSweep 7s linear infinite;
  z-index: 2;
}

@keyframes rotateShimmerSweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.iris-mana-pulsar {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 245, 160, 0.6) 0%, rgba(255, 210, 63, 0.25) 50%, transparent 80%);
  mix-blend-mode: screen;
  pointer-events: none;
  animation: manaPulsar 2.8s ease-in-out infinite alternate;
  z-index: 2;
}

@keyframes manaPulsar {
  0% { transform: scale(0.85); opacity: 0.35; filter: drop-shadow(0 0 5px rgba(255, 210, 63, 0.5)); }
  100% { transform: scale(1.35); opacity: 0.85; filter: drop-shadow(0 0 18px rgba(255, 210, 63, 0.9)); }
}

/* Holographische Ciel & Kilian Sprechblase (Anime AI Voice HUD) */
.ciel-speech-bubble-container {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 14px auto 4px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.speech-bubble {
  position: relative;
  background: rgba(12, 16, 26, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 210, 63, 0.4);
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(255, 210, 63, 0.08);
  animation: bubblePop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: all 0.3s ease;
}

.ciel-bubble {
  border-left: 3px solid var(--gold-primary);
}

.ciel-bubble .bubble-tail {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid rgba(255, 210, 63, 0.5);
}

.kilian-bubble {
  border-left: 3px solid #00f0ff;
  background: rgba(8, 20, 32, 0.92);
}

.kilian-bubble.hidden {
  display: none;
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.bubble-avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-primary);
  display: inline-block;
  margin-right: 6px;
}

.bubble-speaker {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  color: var(--gold-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
}

.kilian-bubble .bubble-speaker {
  color: #00f0ff;
}

.bubble-tag {
  font-size: 9px;
  letter-spacing: 1px;
  color: #00f0ff;
  font-family: var(--font-mono);
  background: rgba(0, 240, 255, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
}

.bubble-wave-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 12px;
}

.bubble-wave-bars span {
  display: block;
  width: 2.5px;
  height: 100%;
  background: var(--gold-primary);
  border-radius: 2px;
  animation: waveBar 0.8s ease-in-out infinite alternate;
}

.bubble-wave-bars span:nth-child(2) { animation-delay: 0.15s; }
.bubble-wave-bars span:nth-child(3) { animation-delay: 0.3s; }
.bubble-wave-bars span:nth-child(4) { animation-delay: 0.45s; }

@keyframes waveBar {
  0% { transform: scaleY(0.2); }
  100% { transform: scaleY(1.0); }
}

.bubble-text {
  font-size: 13px;
  line-height: 1.45;
  color: #f1f5f9;
}

@keyframes bubblePop {
  0% { opacity: 0; transform: translateY(-8px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1.0); }
}

.rescue-btn {
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.6) !important;
  color: #fca5a5 !important;
  font-size: 12px !important;
}

.rescue-btn:hover {
  background: rgba(239, 68, 68, 0.28) !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4) !important;
}


/* Chat Terminal */
.terminal-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  gap: 8px;
  flex-wrap: wrap;
}

.terminal-title {
  font-size: 12px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.voice-selector-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.voice-select-dropdown {
  background: transparent;
  border: none;
  color: var(--gold-primary);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-hud);
  outline: none;
  cursor: pointer;
}

.voice-select-dropdown option {
  background: #12151f;
  color: #fff;
}

.voice-probe-btn {
  background: rgba(255, 210, 63, 0.15);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-probe-btn:hover {
  background: var(--gold-primary);
  color: #0b0c10;
}


.voice-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(0, 242, 254, 0.1);
  color: #00f2fe;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 242, 254, 0.3);
}

.provider-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(255, 210, 63, 0.1);
  color: var(--gold-primary);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 210, 63, 0.3);
}

.chat-messages {
  flex: 1;
  min-height: 220px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 8px;
  margin-bottom: 14px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.message {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeInMsg 0.3s ease;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ciel-msg {
  background: rgba(255, 210, 63, 0.05);
  border: 1px solid rgba(255, 210, 63, 0.2);
  align-self: flex-start;
  max-width: 90%;
}

.ciel-msg .msg-sender {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-primary);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.user-msg {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  align-self: flex-end;
  max-width: 85%;
}

.user-msg .msg-sender {
  font-size: 11px;
  font-weight: 700;
  color: #79c0ff;
  font-family: var(--font-mono);
  margin-bottom: 4px;
  text-align: right;
}

.suggestion-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: rgba(255, 210, 63, 0.12);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

.terminal-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 8px 6px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s ease;
}

.terminal-input-bar:focus-within {
  border-color: var(--gold-primary);
}

.terminal-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  font-family: var(--font-hud);
  outline: none;
}

.terminal-input-bar input::placeholder {
  color: var(--text-muted);
}

.mic-btn, .send-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mic-btn:hover {
  color: var(--gold-primary);
  background: rgba(255, 210, 63, 0.1);
}

.mic-btn.recording {
  color: #ff3355;
  background: rgba(255, 51, 85, 0.2);
  animation: pulseMic 1s infinite alternate;
}

@keyframes pulseMic {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

.send-btn {
  background: var(--gold-primary);
  color: #07090e;
}

.send-btn:hover {
  background: #ffe066;
  transform: translateY(-1px);
}

/* Command Cards */
.command-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hud-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: all 0.3s ease;
}

.hud-card:hover {
  border-color: rgba(255, 210, 63, 0.35);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.card-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
}

.flame-icon { color: #ff9f1c; border-color: rgba(255, 159, 28, 0.3); }
.shield-icon { color: #2ec4b6; border-color: rgba(46, 196, 182, 0.3); }
.mail-icon { color: #70e000; border-color: rgba(112, 224, 0, 0.3); }

.card-title-group {
  flex: 1;
}

.card-title-group h3 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.active { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.normal { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.alarm { background: rgba(255, 42, 75, 0.2); color: var(--crimson-primary); border: 1px solid var(--crimson-primary); }

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.schedule-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.time-block {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.time-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.time-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-primary);
  font-family: var(--font-mono);
}

.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 10px;
}

.info-row span { color: var(--text-muted); }
.info-row strong { color: #fff; font-family: var(--font-mono); font-size: 12px; }

/* Multi-Email Summary Grid */
.accounts-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.account-badge-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.acc-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-unread {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: #10b981;
}

.incident-box {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  max-height: 90px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
}

.incident-item {
  font-size: 12px;
  line-height: 1.4;
}

.incident-item.clean { color: #10b981; }
.incident-item.threat { color: var(--crimson-primary); font-weight: 600; }

.recent-mails-list {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  max-height: 90px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
}

.mail-item {
  font-size: 12px;
  color: var(--text-main);
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.mail-item.empty { color: var(--text-muted); }

.card-actions {
  display: flex;
  gap: 10px;
}

.card-actions.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.action-btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: all 0.2s ease;
  font-family: var(--font-hud);
  text-decoration: none;
}

.action-btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--gold-primary), var(--amber));
  color: #07090e;
}

.action-btn.primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 210, 63, 0.3);
}

.action-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.action-btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Download Cards */
.download-item-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dl-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dl-info {
  flex: 1;
}

.dl-info h4 {
  font-size: 14px;
  color: #fff;
  margin-bottom: 2px;
}

.dl-info p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeInModal 0.25s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-dialog {
  background: #0d1117;
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog.large {
  max-width: 820px;
}

.modal-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold-primary);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 24px;
  max-height: 65vh;
  overflow-y: auto;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(255, 210, 63, 0.12);
  color: var(--gold-primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.form-group {
  margin-bottom: 16px;
}

.form-group.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  outline: none;
  font-family: var(--font-hud);
}

.form-group input:focus,
.form-group select:focus,
textarea:focus {
  border-color: var(--gold-primary);
}

.info-box-subtle {
  background: rgba(255, 210, 63, 0.08);
  border: 1px solid rgba(255, 210, 63, 0.2);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #fce79a;
  margin-top: 10px;
}

/* Contacts Table */
.contacts-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.contacts-stat {
  font-size: 13px;
  color: var(--text-muted);
}

.contacts-stat strong {
  color: var(--gold-primary);
}

.contacts-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.contacts-table th {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.contacts-table td {
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.contacts-table input[type="text"],
.contacts-table input[type="number"] {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-size: 13px;
}

/* Translator */
.translator-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.select-group {
  flex: 1;
  margin-bottom: 0;
}

.trans-swap-icon {
  font-size: 20px;
  color: var(--gold-primary);
  margin-top: 20px;
}

.translator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.trans-box {
  display: flex;
  flex-direction: column;
}

.trans-box label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.trans-box textarea {
  width: 100%;
  height: 180px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  color: #fff;
  font-family: var(--font-hud);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.trans-output-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

/* Vault */
.vault-backup-alert {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  color: #6ee7b7;
  margin-bottom: 16px;
  font-family: var(--font-mono);
}

.vault-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.vault-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.vault-info h4 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 4px;
}

.vault-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.vault-pwd-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vault-pwd-field {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold-primary);
  min-width: 170px;
  user-select: all;
}

.vault-whatsapp-box {
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: 12px;
  padding: 16px;
}

.vault-whatsapp-box h4 {
  color: #25d366;
  font-size: 14px;
  margin-bottom: 4px;
}

.acc-config-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.acc-config-card h4 {
  font-size: 14px;
  color: var(--gold-primary);
  margin-bottom: 10px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@media (max-width: 1024px) {
  .hud-main { grid-template-columns: 1fr; }
  .translator-grid { grid-template-columns: 1fr; }
  .accounts-summary-grid { grid-template-columns: 1fr; }
}

/* Karte "Zugriff vom Handy" */
.info-row.remote-row { flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.info-row.remote-row strong { flex: 1 1 100%; order: 3; overflow-wrap: anywhere; }
.info-row.remote-row .copy-btn { width: auto; flex: 0 0 auto; margin-left: auto; }

/* ===== Wallpaper: Ciel-Kernbild als Vollbild-Hintergrund ===== */
:root { --bg-card: rgba(13, 17, 23, 0.62); }

.wallpaper-img {
  position: absolute;
  inset: -4%;
  background: var(--wallpaper-url, url('/static/assets/ciel_core.jpg')) center / cover no-repeat;
  filter: saturate(1.15) brightness(0.6);
  transform-origin: center;
  animation: wallpaperDrift 48s ease-in-out infinite alternate;
  transition: filter 0.5s ease;
}
body.raphael-speaking .wallpaper-img { filter: saturate(1.4) brightness(0.82); }
body.alarm-mode .wallpaper-img { filter: saturate(1.1) brightness(0.5) hue-rotate(-25deg); }

@keyframes wallpaperDrift {
  0%   { transform: scale(1.0) translate(0, 0); }
  100% { transform: scale(1.08) translate(-1.2%, -0.8%); }
}

.wallpaper-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(7, 9, 14, 0) 0%, rgba(7, 9, 14, 0.5) 65%, rgba(7, 9, 14, 0.85) 100%),
    linear-gradient(rgba(7, 9, 14, 0.3), rgba(7, 9, 14, 0.5));
}

.voice-bubbles { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Der Kern im Orb ist jetzt ein leuchtender Mana-Ring über dem Wallpaper (das Bild selbst ist der Hintergrund) */
#customCoreImg { visibility: hidden; }
.iris-orb {
  background: radial-gradient(circle, rgba(255, 210, 63, 0.22) 0%, rgba(238, 155, 0, 0.08) 55%, rgba(7, 9, 14, 0) 72%);
  border: 1px solid rgba(255, 210, 63, 0.45);
}
.core-container { background: rgba(13, 17, 23, 0.35); }

/* ===== Empfänger-Fenster ===== */
.recipients-schedule { display:flex; gap:8px; align-items:center; font-size:13px; padding:8px 10px; margin-bottom:8px;
  background: rgba(255,210,63,0.08); border:1px solid rgba(255,210,63,0.25); border-radius:10px; cursor:pointer; }
.recipients-toolbar { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:6px; }
.recipients-toolbar input { flex:1 1 150px; min-width:120px; padding:8px 10px; border-radius:8px; border:1px solid var(--border-subtle);
  background:rgba(0,0,0,0.35); color:var(--text-main); }
.recipients-toolbar .action-btn { width:auto; flex:0 0 auto; }
.recipients-count { font-size:11px; color:var(--text-muted); margin:4px 2px 6px; font-family:var(--font-mono); }
.recipients-list { max-height: 48vh; overflow-y:auto; border:1px solid var(--border-subtle); border-radius:10px; background:rgba(0,0,0,0.25); }
.recip-row { display:flex; align-items:center; gap:10px; padding:8px 12px; border-bottom:1px solid rgba(255,255,255,0.05); cursor:pointer; }
.recip-row:last-child { border-bottom:none; }
.recip-row:hover { background:rgba(255,210,63,0.06); }
.recip-row input { width:18px; height:18px; accent-color: var(--gold-primary); flex:0 0 auto; }
.recip-name { flex:1; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.recip-flames { font-family:var(--font-mono); color:var(--gold-primary); font-size:12px; flex:0 0 auto; }
.recip-last { font-size:10px; color:var(--text-muted); flex:0 0 auto; max-width:38%; text-align:right; }

/* ===== Ein-/Ausklappen ===== */
.hud-card .card-header { position: relative; }
.collapse-btn { margin-left:auto; flex:0 0 auto; width:30px; height:30px; border-radius:8px; border:1px solid var(--border-subtle);
  background:rgba(255,255,255,0.06); color:var(--text-main); cursor:pointer; font-size:14px; line-height:1; transition: transform .2s ease, background .2s ease; }
.collapse-btn:hover { background:rgba(255,210,63,0.18); }
.hud-card.collapsed .card-body { display:none; }
.hud-card.collapsed .collapse-btn { transform: rotate(-90deg); }
.hud-card.collapsed { padding-bottom: 14px; }
.snap-more-btn { display:block; width:100%; margin-top:6px; padding:6px; border-radius:8px; border:1px dashed rgba(255,210,63,0.4);
  background:transparent; color:var(--gold-primary); cursor:pointer; font-size:11px; font-weight:600; }
.snap-more-btn:hover { background:rgba(255,210,63,0.08); }

/* Mail-Übersicht */
.mail-group-title { font-size:11px; font-weight:700; letter-spacing:.3px; margin:8px 0 4px; }

/* Hinweise (statt blockierbarer alert-Fenster) */
#cielToasts { position:fixed; right:14px; bottom:14px; z-index:100001; display:flex; flex-direction:column; gap:8px; max-width:min(420px, 92vw); }
.ciel-toast { background:rgba(13,17,23,0.96); color:var(--text-main); border:1px solid var(--border-glow); border-left:4px solid var(--gold-primary);
  border-radius:10px; padding:10px 14px; font-size:13px; line-height:1.4; box-shadow:0 8px 28px rgba(0,0,0,.55); cursor:pointer; white-space:pre-wrap; }
