:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --surface: #16161d;
  --surface-2: #1e1e28;
  --text: #f2f2f5;
  --text-dim: #9a9aa5;
  --accent: #5b8cff;
  --accent-dim: #3a5cc4;
  --error: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 20px;
}

.hidden {
  display: none !important;
}

/* Login screen */

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.login-card h1 {
  margin: 0 0 4px 0;
  font-size: 1.5rem;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.field input {
  background: var(--surface-2);
  border: 1px solid #2c2c38;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  cursor: pointer;
  font-family: inherit;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
}

.primary-btn:active {
  background: var(--accent-dim);
}

.error-text {
  color: var(--error);
  font-size: 0.9rem;
  min-height: 1.2em;
  text-align: center;
}

/* Main screen */

#main-screen {
  justify-content: flex-start;
  padding-top: max(48px, env(safe-area-inset-top));
  gap: 32px;
}

.topbar {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.logout-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid #2c2c38;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
}

.notify-btn.enabled {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.jarvis-button-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 14px;
}

.hint-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.jarvis-button {
  width: 45vw;
  height: 45vw;
  min-width: 160px;
  min-height: 160px;
  max-width: 260px;
  max-height: 260px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, var(--accent), var(--accent-dim) 70%);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 8px rgba(91, 140, 255, 0.12), 0 12px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.jarvis-button.pressed {
  transform: scale(0.96);
  box-shadow: 0 0 0 14px rgba(91, 140, 255, 0.22), 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* Recording: red pulse while the mic is actively capturing. */
.jarvis-button.recording {
  background: radial-gradient(circle at 35% 30%, #ff6b6b, #c43a3a 70%);
  animation: pulse-recording 1.1s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%, 100% {
    box-shadow: 0 0 0 8px rgba(255, 107, 107, 0.18), 0 12px 32px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 0 18px rgba(255, 107, 107, 0.28), 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

/* Thinking: waiting on the transcribe/reply/synthesize round trip. */
.jarvis-button.thinking {
  animation: pulse-thinking 1s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes pulse-thinking {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

#mic-error {
  width: 100%;
  max-width: 480px;
}

.command-area {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.reply-audio {
  width: 100%;
}

.command-area input[type="text"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid #2c2c38;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
}

.response-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  min-height: 60px;
  font-size: 0.95rem;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.response-box.has-reply {
  color: var(--text);
}
