:root {
  --bg: #07090e;
  --panel: rgba(16, 21, 31, 0.75);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #00f2fe;
  --accent-glow: rgba(0, 242, 254, 0.35);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 440px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  position: relative;
  background: radial-gradient(circle at 50% 20%, rgba(0, 242, 254, 0.08) 0%, transparent 60%);
  /* Filet de secours : si le contenu depasse quand meme la hauteur visible
     (barre de navigation du telephone, clavier, etc.), on peut au moins
     defiler pour voir le bas -- avant ce correctif (19/09/2026), le "overflow:
     hidden" du body rendait ça impossible et le dernier bouton (changement de
     mode) restait invisible et inaccessible sur certains telephones. */
  overflow-y: auto;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.brand h1 span {
  color: var(--accent);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  backdrop-filter: blur(12px);
}

.status-indicator {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.status-pill.connected .status-indicator {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.status-pill.active .status-indicator {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.2s infinite;
}

/* Stage / Orb */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  position: relative;
}

.orb-container {
  width: 180px;
  height: 180px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.orb-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  filter: blur(18px);
  opacity: 0.5;
  transition: all 0.5s ease;
}

.orb {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 20px rgba(0, 242, 254, 0.2), 0 10px 30px rgba(0, 0, 0, 0.6);
  position: relative;
  transition: transform 0.3s ease;
}

.orb-inner {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.4) 0%, transparent 80%);
}

.orb-core {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 16px var(--accent);
  transition: all 0.3s ease;
}

/* Orb States */
.orb.listening {
  transform: scale(1.08);
  border-color: var(--accent);
  box-shadow: 0 0 35px var(--accent-glow);
}

.orb.speaking {
  transform: scale(1.15);
  border-color: var(--emerald);
  box-shadow: 0 0 45px var(--emerald-glow);
}

.orb.speaking .orb-glow {
  background: radial-gradient(circle, var(--emerald-glow) 0%, transparent 70%);
  opacity: 0.8;
}

.orb.thinking {
  border-color: #f59e0b;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.45);
  animation: thinkingPulse 1s ease-in-out infinite;
}

.orb.thinking .orb-glow {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.45) 0%, transparent 70%);
  opacity: 0.7;
}

@keyframes thinkingPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

#visualizer {
  position: absolute;
  bottom: -35px;
  pointer-events: none;
}

.live-subtitle {
  margin-top: 35px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 80%;
  line-height: 1.4;
  height: 38px;
}

/* Transcript Section */
.transcript-section {
  height: 190px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  margin-bottom: 12px;
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  opacity: 0.6;
}

.transcript-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.transcript-list::-webkit-scrollbar {
  width: 4px;
}

.transcript-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.message {
  font-size: 13px;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 90%;
  word-break: break-word;
}

.user-msg {
  align-self: flex-end;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: #e2f8ff;
  border-bottom-right-radius: 3px;
}

.jarvis-msg {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-bottom-left-radius: 3px;
}

.system-msg {
  align-self: center;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  background: transparent;
  padding: 4px;
}

.mission-msg {
  color: #00f2fe;
  font-size: 12px;
  font-weight: 600;
  white-space: pre-wrap;
  max-width: 90%;
}

/* Footer & Buttons */
.footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Respecte la zone reservee par la barre de navigation/geste du telephone
     (Android/iOS) -- sans ça, le dernier bouton (changement de mode) se
     retrouvait cache derriere elle. Necessite viewport-fit=cover dans
     index.html pour que env() renvoie une vraie valeur non nulle. */
  padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
}

.main-action-btn {
  width: 100%;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  border: none;
  color: #05101a;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4);
  transition: all 0.2s ease;
}

.main-action-btn:active {
  transform: scale(0.98);
}

.main-action-btn.active {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.controls-row {
  display: flex;
  gap: 8px;
}

.control-btn {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.control-btn.active {
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
