/* ============================================================
   TALK TO KRISHNA — STYLES
   Colors, fonts, and easing match tenminutegita.com/index.html
   ============================================================ */

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  height: 100%;
}

@media (pointer: fine) {
  *, *::before, *::after {
    cursor: none !important;
  }
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a1410;
  color: #f5f0e8;
  line-height: 1.7;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}

body.loaded {
  opacity: 1;
}

h1, h2, h3 {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
   BACKGROUND AURA (identical to index.html)
   ============================================================ */
.bg-aura {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 600px 600px at 30% 20%, rgba(232, 165, 75, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 70% 60%, rgba(240, 192, 120, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 400px 400px at 50% 80%, rgba(232, 165, 75, 0.04) 0%, transparent 70%);
  animation: aura-drift 20s ease-in-out infinite;
  will-change: transform;
}

@keyframes aura-drift {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(30px, -20px); }
  66% { transform: translate(-20px, 15px); }
}

/* ============================================================
   FLOATING PARTICLES (identical to index.html)
   ============================================================ */
.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  will-change: transform, opacity;
}

.particle:nth-child(2) {
  width: 3px; height: 3px;
  background: rgba(232, 165, 75, 0.3);
  left: 15%; top: 20%;
  animation: float-particle 14s ease-in-out infinite;
}

.particle:nth-child(3) {
  width: 2px; height: 2px;
  background: rgba(240, 192, 120, 0.25);
  left: 70%; top: 35%;
  animation: float-particle 18s ease-in-out infinite 3s;
}

.particle:nth-child(4) {
  width: 4px; height: 4px;
  background: rgba(245, 213, 144, 0.2);
  left: 40%; top: 65%;
  animation: float-particle 16s ease-in-out infinite 6s;
}

.particle:nth-child(5) {
  width: 2px; height: 2px;
  background: rgba(232, 165, 75, 0.2);
  left: 85%; top: 50%;
  animation: float-particle 20s ease-in-out infinite 9s;
}

.particle:nth-child(6) {
  width: 3px; height: 3px;
  background: rgba(240, 192, 120, 0.15);
  left: 55%; top: 85%;
  animation: float-particle 17s ease-in-out infinite 12s;
}

@keyframes float-particle {
  0%, 100% {
    transform: translate(0, 0);
    opacity: 0;
  }
  20% { opacity: 1; }
  80% { opacity: 1; }
  50% {
    transform: translate(30px, -40px);
  }
}

/* ============================================================
   AUTH OVERLAY
   ============================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.auth-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(42, 35, 26, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(232, 165, 75, 0.15);
  border-radius: 20px;
  padding: 48px 36px;
  text-align: center;
  transform: translateY(20px);
  opacity: 0;
  animation: authCardIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
}

@keyframes authCardIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.auth-om {
  font-size: 3.5rem;
  color: #e8a54b;
  margin-bottom: 8px;
  text-shadow: 0 0 40px rgba(232, 165, 75, 0.3);
}

.auth-card h2 {
  font-size: 1.5rem;
  color: #f5f0e8;
  margin-bottom: 12px;
  font-weight: 600;
}

.auth-subtitle {
  color: rgba(245, 240, 232, 0.55);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 32px;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 12px;
}

.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.google-btn {
  background: #ffffff;
  color: #1a1a1a;
}

.apple-btn {
  background: #000000;
  color: #ffffff;
}

.auth-error {
  color: #e87c5a;
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 20px;
}

.auth-back-link {
  display: inline-block;
  margin-top: 20px;
  color: rgba(245, 240, 232, 0.4);
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

.auth-back-link:hover {
  color: #e8a54b;
}

/* ============================================================
   CHAT APP LAYOUT
   ============================================================ */
.chat-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chat-app.visible {
  opacity: 1;
}

/* ============================================================
   HEADER
   ============================================================ */
.chat-header {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 60px;
  background: rgba(26, 20, 16, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(232, 165, 75, 0.1);
  flex-shrink: 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top);
  overflow: visible;
}

.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: rgba(245, 240, 232, 0.6);
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.back-link:hover {
  color: #e8a54b;
  background: rgba(232, 165, 75, 0.08);
}

.back-link svg {
  width: 20px;
  height: 20px;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
}

.krishna-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(232, 165, 75, 0.2), rgba(232, 165, 75, 0.08));
  border: 1px solid rgba(232, 165, 75, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #e8a54b;
  flex-shrink: 0;
}

.header-title-text h1 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f5f0e8;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.7rem;
  color: rgba(245, 240, 232, 0.4);
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(245, 240, 232, 0.5);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.header-btn:hover {
  color: #e8a54b;
  background: rgba(232, 165, 75, 0.08);
}

.header-btn svg {
  width: 18px;
  height: 18px;
}

/* User avatar in header */
.user-avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(232, 165, 75, 0.3);
  background: rgba(232, 165, 75, 0.12);
  color: #e8a54b;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease;
  margin-left: 4px;
}

.user-avatar-btn:hover {
  border-color: #e8a54b;
}

.user-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* User menu dropdown */
.user-menu {
  position: fixed;
  top: 56px;
  right: 16px;
  background: rgba(42, 35, 26, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(232, 165, 75, 0.15);
  border-radius: 12px;
  padding: 12px 0;
  min-width: 200px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
}

.user-menu.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.user-menu-info {
  padding: 8px 16px 12px;
  border-bottom: 1px solid rgba(232, 165, 75, 0.1);
}

.user-menu-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #f5f0e8;
}

.user-menu-email {
  display: block;
  font-size: 0.75rem;
  color: rgba(245, 240, 232, 0.4);
  margin-top: 2px;
}

.user-menu-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: rgba(245, 240, 232, 0.7);
  font-size: 0.85rem;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.user-menu-btn:hover {
  background: rgba(232, 165, 75, 0.08);
  color: #e8a54b;
}

/* ============================================================
   MESSAGES CONTAINER
   ============================================================ */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 16px 100px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .messages-container {
    padding: 32px 48px 100px;
  }
}

.messages-inner {
  max-width: 800px;
  margin: 0 auto;
}

/* ============================================================
   WELCOME STATE
   ============================================================ */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  padding: 40px 20px;
  opacity: 0;
  animation: welcomeFadeIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s forwards;
}

@keyframes welcomeFadeIn {
  to { opacity: 1; }
}

.welcome-om {
  font-size: 4rem;
  color: #e8a54b;
  margin-bottom: 24px;
  text-shadow: 0 0 60px rgba(232, 165, 75, 0.25), 0 0 120px rgba(232, 165, 75, 0.1);
  animation: omBreath 4s ease-in-out infinite;
}

@keyframes omBreath {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
    text-shadow: 0 0 60px rgba(232, 165, 75, 0.25), 0 0 120px rgba(232, 165, 75, 0.1);
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
    text-shadow: 0 0 80px rgba(232, 165, 75, 0.35), 0 0 160px rgba(232, 165, 75, 0.15);
  }
}

.welcome-heading {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: #f5f0e8;
  margin-bottom: 12px;
}

.welcome-sub {
  color: rgba(245, 240, 232, 0.5);
  font-size: 1rem;
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 36px;
}

.starter-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 500px;
}

.starter-btn {
  padding: 10px 20px;
  background: rgba(42, 35, 26, 0.6);
  border: 1px solid rgba(232, 165, 75, 0.2);
  border-radius: 20px;
  color: rgba(245, 240, 232, 0.75);
  font-size: 0.85rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
  animation: starterFadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.starter-btn:nth-child(1) { animation-delay: 0.7s; }
.starter-btn:nth-child(2) { animation-delay: 0.85s; }
.starter-btn:nth-child(3) { animation-delay: 1.0s; }
.starter-btn:nth-child(4) { animation-delay: 1.15s; }

@keyframes starterFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.starter-btn:hover {
  border-color: rgba(232, 165, 75, 0.5);
  color: #f5f0e8;
  background: rgba(232, 165, 75, 0.08);
  box-shadow: 0 0 20px rgba(232, 165, 75, 0.1);
}

/* ============================================================
   MESSAGE BUBBLES
   ============================================================ */
.message {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  max-width: 85%;
  opacity: 0;
  transform: translateY(12px);
  animation: messageIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes messageIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Krishna (left-aligned) */
.message.krishna {
  align-self: flex-start;
}

.message.krishna .message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(232, 165, 75, 0.2), rgba(232, 165, 75, 0.08));
  border: 1px solid rgba(232, 165, 75, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #e8a54b;
  flex-shrink: 0;
  margin-top: 4px;
}

.message-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.message.krishna .message-bubble {
  background: rgba(42, 35, 26, 0.6);
  border: 1px solid rgba(232, 165, 75, 0.08);
  border-radius: 4px 16px 16px 16px;
  padding: 14px 18px;
}

/* User (right-aligned) */
.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, rgba(232, 165, 75, 0.12), rgba(232, 165, 75, 0.06));
  border: 1px solid rgba(232, 165, 75, 0.12);
  border-radius: 16px 4px 16px 16px;
  padding: 14px 18px;
}

.message-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #f5f0e8;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-content strong {
  font-weight: 600;
  color: #f0c078;
}

.message-content em {
  font-style: italic;
  color: rgba(245, 240, 232, 0.85);
}

/* Sanskrit shloka styling */
.message-content .shloka {
  display: block;
  font-family: 'Noto Sans Devanagari', 'Tiro Devanagari Hindi', serif;
  border-left: 2px solid rgba(232, 165, 75, 0.4);
  padding: 8px 0 8px 16px;
  margin: 12px 0;
  color: rgba(245, 240, 232, 0.8);
  font-style: italic;
}

/* Message action row (speaker + copy) */
.message-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

/* Keep actions visible when speaker is loading or playing */
.message-actions:has(.loading),
.message-actions:has(.playing) {
  opacity: 1;
}

.message-bubble {
  position: relative;
}

/* Copy button on messages */
.message-copy {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(245, 240, 232, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
  position: relative;
}

.message-copy:hover {
  color: #e8a54b;
  background: rgba(232, 165, 75, 0.08);
}

.message-copy svg {
  width: 14px;
  height: 14px;
}

/* Copy tooltip */
.copy-tooltip {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(42, 35, 26, 0.95);
  color: #e8a54b;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.copy-tooltip.visible {
  opacity: 1;
}

/* ============================================================
   LOADING INDICATOR (Om pulsing)
   ============================================================ */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 85%;
  margin-bottom: 20px;
  opacity: 0;
  animation: messageIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.loading-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(232, 165, 75, 0.2), rgba(232, 165, 75, 0.08));
  border: 1px solid rgba(232, 165, 75, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #e8a54b;
  flex-shrink: 0;
}

.loading-bubble {
  background: rgba(42, 35, 26, 0.6);
  border: 1px solid rgba(232, 165, 75, 0.08);
  border-radius: 4px 16px 16px 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.loading-om {
  font-size: 1.4rem;
  color: #e8a54b;
  animation: omPulse 2s ease-in-out infinite;
}

@keyframes omPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
    text-shadow: 0 0 12px rgba(232, 165, 75, 0.2);
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
    text-shadow: 0 0 24px rgba(232, 165, 75, 0.4);
  }
}

.loading-text {
  font-size: 0.85rem;
  color: rgba(245, 240, 232, 0.45);
  font-style: italic;
}

/* ============================================================
   INPUT AREA
   ============================================================ */
.input-area {
  flex-shrink: 0;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(26, 20, 16, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(232, 165, 75, 0.08);
}

@media (min-width: 768px) {
  .input-area {
    padding: 16px 48px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

.input-inner {
  max-width: 800px;
  margin: 0 auto;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(42, 35, 26, 0.5);
  border: 1px solid rgba(232, 165, 75, 0.12);
  border-radius: 16px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-wrapper:focus-within {
  border-color: rgba(232, 165, 75, 0.35);
  box-shadow: 0 0 20px rgba(232, 165, 75, 0.06);
}

#messageInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f5f0e8;
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  padding: 4px 0;
}

#messageInput::placeholder {
  color: rgba(245, 240, 232, 0.3);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #e8a54b;
  color: #1a1410;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
  opacity: 0.3;
  pointer-events: none;
}

.send-btn.active {
  opacity: 1;
  pointer-events: auto;
}

.send-btn.active:hover {
  transform: scale(1.06);
  background: #f0c078;
}

.send-btn.active:active {
  transform: scale(0.95);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.char-count {
  font-size: 0.7rem;
  color: rgba(245, 240, 232, 0.3);
  text-align: right;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.char-count.visible {
  opacity: 1;
}

.char-count.warning {
  color: #e87c5a;
}

/* ============================================================
   SCROLL TO BOTTOM PILL
   ============================================================ */
.scroll-pill {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(42, 35, 26, 0.9);
  border: 1px solid rgba(232, 165, 75, 0.2);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.75rem;
  color: rgba(245, 240, 232, 0.6);
  cursor: pointer;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.scroll-pill.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.scroll-pill:hover {
  color: #e8a54b;
  border-color: rgba(232, 165, 75, 0.4);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(42, 35, 26, 0.95);
  border: 1px solid rgba(232, 165, 75, 0.2);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 0.85rem;
  color: rgba(245, 240, 232, 0.8);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 90%;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   SYSTEM MESSAGE (errors shown inline)
   ============================================================ */
.system-message {
  text-align: center;
  padding: 12px 20px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: rgba(245, 240, 232, 0.45);
  font-style: italic;
}

/* ============================================================
   CONVERSATION HISTORY PANEL
   ============================================================ */
.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.history-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 100%;
  background: rgba(26, 20, 16, 0.98);
  border-left: 1px solid rgba(232, 165, 75, 0.1);
  z-index: 301;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.history-panel.visible {
  transform: translateX(0);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(232, 165, 75, 0.1);
}

.history-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #f5f0e8;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(245, 240, 232, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.close-btn:hover {
  color: #e8a54b;
  background: rgba(232, 165, 75, 0.08);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.history-item {
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-bottom: 4px;
}

.history-item:hover {
  background: rgba(232, 165, 75, 0.06);
}

.history-item.active {
  background: rgba(232, 165, 75, 0.1);
  border: 1px solid rgba(232, 165, 75, 0.15);
}

.history-item-title {
  font-size: 0.85rem;
  color: #f5f0e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-date {
  font-size: 0.7rem;
  color: rgba(245, 240, 232, 0.35);
  margin-top: 4px;
}

.history-item-delete {
  float: right;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(245, 240, 232, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  color: #e87c5a;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(245, 240, 232, 0.35);
  font-size: 0.85rem;
}

/* ============================================================
   NEW CHAT CONFIRM DIALOG
   ============================================================ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 24px;
}

.confirm-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.confirm-card {
  background: rgba(42, 35, 26, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(232, 165, 75, 0.15);
  border-radius: 16px;
  padding: 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.confirm-card p {
  font-size: 0.95rem;
  color: rgba(245, 240, 232, 0.8);
  line-height: 1.6;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  font-size: 0.85rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.confirm-btn:active {
  transform: scale(0.97);
}

.confirm-btn.primary {
  background: #e8a54b;
  color: #1a1410;
}

.confirm-btn.primary:hover {
  background: #f0c078;
}

.confirm-btn.secondary {
  background: rgba(245, 240, 232, 0.08);
  color: rgba(245, 240, 232, 0.7);
}

.confirm-btn.secondary:hover {
  background: rgba(245, 240, 232, 0.12);
}

/* ============================================================
   LOADING SCREEN (initial conversation load)
   ============================================================ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  gap: 16px;
}

.loading-screen-om {
  font-size: 2.5rem;
  color: #e8a54b;
  animation: omPulse 2s ease-in-out infinite;
}

.loading-screen-text {
  font-size: 0.9rem;
  color: rgba(245, 240, 232, 0.4);
}

/* ============================================================
   VOICE MODE: MIC BUTTON
   ============================================================ */
.mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(232, 165, 75, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease;
}

.mic-btn:hover {
  color: #e8a54b;
  background: rgba(232, 165, 75, 0.08);
}

.mic-btn svg {
  width: 18px;
  height: 18px;
}

.mic-btn.recording {
  color: #e87c5a;
  background: rgba(232, 124, 90, 0.12);
  animation: micPulse 1.5s ease-in-out infinite;
}

.mic-btn.recording .mic-icon-default {
  display: none;
}

.mic-btn.recording .mic-icon-recording {
  display: block !important;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 124, 90, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(232, 124, 90, 0); }
}

/* ============================================================
   VOICE MODE: SPEAKER BUTTON ON MESSAGES
   ============================================================ */
.message-speaker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(245, 240, 232, 0.3);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.message-speaker-btn:hover {
  color: #e8a54b;
  background: rgba(232, 165, 75, 0.08);
}

.message-speaker-btn svg {
  width: 16px;
  height: 16px;
}

.message-speaker-btn.loading {
  color: rgba(232, 165, 75, 0.5);
  animation: speakerPulse 1.2s ease-in-out infinite;
}

@keyframes speakerPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.message-speaker-btn.playing {
  color: #e8a54b;
}

.message-speaker-btn.playing svg {
  animation: speakerBounce 0.8s ease-in-out infinite;
}

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

/* ============================================================
   VOICE MODE: GLOBAL TOGGLE IN HEADER
   ============================================================ */
.voice-toggle {
  position: relative;
}

.voice-toggle .voice-wave-outer,
.voice-toggle .voice-wave-inner {
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

.voice-toggle.active {
  color: #e8a54b;
}

.voice-toggle.active .voice-wave-outer,
.voice-toggle.active .voice-wave-inner {
  opacity: 1;
}

/* Speed control */
.speed-control-wrapper {
  position: relative;
}

.speed-btn {
  min-width: 32px;
}

.speed-btn .speed-label {
  font-size: 12px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: -0.02em;
  color: rgba(245, 235, 220, 0.6);
  transition: color 0.2s ease;
}

.speed-btn:hover .speed-label,
.speed-btn.active .speed-label {
  color: #e8a54b;
}

/* Speed preset popover */
.speed-popover {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: -8px;
  background: rgba(28, 20, 12, 0.97);
  border: 1px solid rgba(232, 165, 75, 0.12);
  border-radius: 14px;
  padding: 6px;
  z-index: 10000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.speed-popover.visible {
  display: block;
  animation: speedPopIn 0.15s cubic-bezier(0.2, 0, 0.13, 1.5);
}

@keyframes speedPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.speed-presets {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.speed-preset {
  display: block;
  width: 100%;
  padding: 8px 24px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(245, 240, 232, 0.55);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.speed-preset:hover {
  background: rgba(232, 165, 75, 0.08);
  color: rgba(245, 240, 232, 0.85);
}

.speed-preset.active {
  background: rgba(232, 165, 75, 0.15);
  color: #e8a54b;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 768px) {
  .message {
    max-width: 70%;
  }

  .chat-header {
    padding: 0 32px;
  }
}

@media (min-width: 1024px) {
  .messages-inner {
    max-width: 900px;
  }
}

@media (max-width: 480px) {
  .history-panel {
    width: 100%;
  }

  .auth-card {
    padding: 36px 24px;
  }

  .chat-header {
    padding: 0 12px;
  }

  .header-subtitle {
    display: none;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .welcome-om {
    animation: none;
    opacity: 1;
  }

  .loading-om {
    animation: none;
    opacity: 1;
  }

  .bg-aura {
    animation: none;
  }

  .particle {
    display: none;
  }

  .message {
    opacity: 1;
    transform: none;
  }

  .welcome-state {
    opacity: 1;
  }

  .starter-btn {
    opacity: 1;
    transform: none;
  }

  .auth-card {
    opacity: 1;
    transform: none;
  }

  .mic-btn.recording {
    animation: none;
  }

  .message-speaker-btn.loading {
    animation: none;
    opacity: 1;
  }

  .message-speaker-btn.playing svg {
    animation: none;
  }
}
