:root {
  --bg-primary: #07090e;
  --bg-secondary: #0f141f;
  --bg-card: rgba(18, 24, 38, 0.7);
  --accent-cyan: #00f2fe;
  --accent-purple: #9d4edd;
  --accent-blue: #4cc9f0;
  --accent-pink: #f72585;
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(20px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', -apple-system, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(157, 78, 221, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0, 242, 254, 0.12) 0%, transparent 40%);
}

.app-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 70px 1fr;
  width: 100vw;
  height: 100vh;
}

/* Top Nav */
.top-nav {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  background: rgba(7, 9, 14, 0.6);
  z-index: 10;
}

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

.logo-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-cyan);
}

.logo-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 20px;
  letter-spacing: 1px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle-wrap {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--accent-cyan);
  color: #07090e;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

.connection-pill.connected {
  border-color: rgba(0, 242, 254, 0.4);
  background: rgba(0, 242, 254, 0.08);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffaa00;
}

.connection-pill.connected .pill-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* Main Stage */
.stage-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px;
}

/* Glowing Orb */
.orb-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.orb-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.4) 0%, rgba(157, 78, 221, 0.3) 50%, transparent 70%);
  filter: blur(25px);
  animation: pulseGlow 4s infinite ease-in-out;
}

.orb-core {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #9d4edd 100%);
  box-shadow: 
    0 0 40px rgba(0, 242, 254, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.6);
  position: relative;
  z-index: 2;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.orb-inner {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0.4));
  filter: blur(2px);
}

.orb-wrapper.listening .orb-core {
  transform: scale(1.15);
  box-shadow: 0 0 60px rgba(0, 242, 254, 0.9), inset 0 0 30px #ffffff;
  animation: ripple 1.2s infinite ease-out;
}

.orb-wrapper.speaking .orb-core {
  transform: scale(1.1);
  background: linear-gradient(135deg, #f72585 0%, #9d4edd 50%, #00f2fe 100%);
  box-shadow: 0 0 70px rgba(247, 37, 133, 0.8);
  animation: speakingPulse 0.8s infinite alternate;
}

.orb-rings .ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.ring-1 {
  width: 220px;
  height: 220px;
  animation: spin 18s infinite linear;
}

.ring-2 {
  width: 280px;
  height: 280px;
  border-style: dashed;
  animation: spinReverse 24s infinite linear;
}

/* Status & Subtitle */
.speech-status {
  text-align: center;
  max-width: 600px;
  margin-bottom: 24px;
}

.status-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--accent-cyan);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.live-subtitle {
  font-size: 1.15rem;
  color: var(--text-main);
  line-height: 1.5;
  font-weight: 400;
  min-height: 48px;
  transition: all 0.3s ease;
}

/* Visualizer */
.visualizer-container {
  width: 100%;
  max-width: 480px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

#audioVisualizer {
  width: 100%;
  height: 100%;
}

/* Control Bar */
.control-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 580px;
}

.mic-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(157, 78, 221, 0.2));
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: var(--glass-blur);
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.15);
}

.mic-button:hover {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.4), rgba(157, 78, 221, 0.4));
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 242, 254, 0.3);
}

.mic-button.active {
  background: linear-gradient(135deg, #f72585, #9d4edd);
  border-color: #f72585;
  box-shadow: 0 0 30px rgba(247, 37, 133, 0.6);
}

.mic-icon {
  width: 20px;
  height: 20px;
}

.text-input-wrap {
  display: flex;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 6px 8px 6px 18px;
  backdrop-filter: var(--glass-blur);
}

.text-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.send-btn {
  background: var(--accent-cyan);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.send-btn svg {
  width: 18px;
  height: 18px;
  stroke: #07090e;
}

.send-btn:hover {
  transform: scale(1.05);
}

/* Side HUD */
.side-hud {
  background: rgba(15, 20, 31, 0.8);
  border-left: 1px solid var(--border-color);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  backdrop-filter: var(--glass-blur);
  overflow-y: auto;
}

.hud-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.hud-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.pulse-live {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(247, 37, 133, 0.2);
  color: var(--accent-pink);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(247, 37, 133, 0.4);
  animation: pulseLive 1.5s infinite alternate;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.feed-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.feed-item.proactive {
  border-color: rgba(0, 242, 254, 0.5);
  background: rgba(0, 242, 254, 0.08);
}

.feed-item .feed-source {
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.feed-item.placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.8rem;
  text-align: center;
  padding: 20px 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  background: rgba(76, 201, 240, 0.12);
  color: var(--accent-blue);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(76, 201, 240, 0.25);
}

.rule-box {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rule-title {
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

/* Animations */
@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spinReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes pulseLive {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

@keyframes speakingPulse {
  0% { transform: scale(1.05); }
  100% { transform: scale(1.18); }
}

/* Mobile & Android Responsiveness */
@media (max-width: 860px) {
  body {
    overflow-y: auto;
    height: auto;
  }

  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: 100vh;
  }

  .top-nav {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .logo-title {
    font-size: 1rem;
  }

  .stage-container {
    padding: 30px 16px;
    min-height: 65vh;
  }

  .orb-wrapper {
    width: 200px;
    height: 200px;
    margin-bottom: 16px;
  }

  .orb-glow {
    width: 170px;
    height: 170px;
  }

  .orb-core {
    width: 120px;
    height: 120px;
  }

  .ring-1 {
    width: 170px;
    height: 170px;
  }

  .ring-2 {
    width: 210px;
    height: 210px;
  }

  .live-subtitle {
    font-size: 1rem;
    padding: 0 10px;
  }

  .control-bar {
    width: 100%;
  }

  .mic-button {
    width: 100%;
    justify-content: center;
    padding: 16px 20px;
    font-size: 1rem;
  }

  .side-hud {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 20px 16px 40px;
  }
}
