/* ============================================================
   NgertiinKamu — style.css
   Aesthetic: Soft purple-pink glassmorphism, Gen-Z vibe
   ============================================================ */

/* ---------- CSS Variables / Design Tokens ---------- */
:root {
  --clr-bg:         #0f0a1e;
  --clr-surface:    rgba(255,255,255,0.06);
  --clr-surface-2:  rgba(255,255,255,0.10);
  --clr-border:     rgba(255,255,255,0.12);
  --clr-border-2:   rgba(255,255,255,0.20);

  --clr-primary:    #c084fc;   /* soft violet */
  --clr-primary-2:  #a855f7;
  --clr-accent:     #f0abfc;   /* lavender pink */
  --clr-accent-2:   #e879f9;
  --clr-rose:       #fb7185;
  --clr-teal:       #34d399;

  --clr-user-bg:    linear-gradient(135deg, #c084fc, #a855f7);
  --clr-ai-bg:      rgba(255,255,255,0.09);

  --clr-text:       #f1e8ff;
  --clr-text-muted: rgba(241,232,255,0.55);
  --clr-text-faint: rgba(241,232,255,0.35);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --radius-xl:  32px;
  --radius-pill:999px;

  --shadow-glow: 0 0 40px rgba(192,132,252,0.25);
  --shadow-card: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08);

  --font-main: 'Nunito', sans-serif;
  --font-alt:  'Plus Jakarta Sans', sans-serif;

  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
}

img { display: block; max-width: 100%; }
a   { color: var(--clr-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--clr-accent); }
button { font-family: var(--font-main); cursor: pointer; border: none; outline: none; }

.hidden { display: none !important; }

/* ============================================================
   ANIMATED BLOBS
   ============================================================ */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: blobFloat 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #7c3aed, #a855f7);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.blob-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #db2777, #f472b6);
  bottom: -80px; right: -80px;
  animation-delay: -3s;
}
.blob-3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, #0ea5e9, #8b5cf6);
  top: 40%; left: 50%;
  transform: translateX(-50%);
  animation-delay: -6s;
}
@keyframes blobFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(20px,-30px) scale(1.05); }
  66%      { transform: translate(-15px,20px) scale(0.97); }
}

/* ============================================================
   SPLASH / API KEY SCREEN
   ============================================================ */
.splash-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.splash-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.splash-card {
  position: relative;
  z-index: 2;
  background: rgba(20,10,45,0.75);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--clr-border-2);
  border-radius: var(--radius-xl);
  padding: 40px 36px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  animation: cardEntrance 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
  text-align: center;
}

@keyframes cardEntrance {
  from { opacity:0; transform: translateY(30px) scale(0.95); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

/* Avatar */
.splash-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}
.avatar-ring {
  width: 110px; height: 110px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #c084fc, #f0abfc, #a855f7);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  margin: 0 auto;
}
.splash-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--clr-bg);
}
.avatar-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(192,132,252,0.4);
  animation: pulse 2.5s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}
.online-badge {
  position: absolute;
  bottom: -4px; right: -4px;
  background: rgba(20,10,45,0.9);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-teal);
  white-space: nowrap;
}

/* Logo */
.app-logo {
  font-family: var(--font-alt);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.logo-ngertiin { color: var(--clr-text); }
.logo-kamu { 
  background: linear-gradient(135deg, #c084fc, #f0abfc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-heart { font-size: 1.6rem; margin-left: 4px; -webkit-text-fill-color: initial; }

.splash-tagline {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--clr-text-muted);
  margin-bottom: 20px;
}
.splash-tagline strong { color: var(--clr-accent); }

/* Feature pills */
.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}
.pill {
  background: rgba(192,132,252,0.12);
  border: 1px solid rgba(192,132,252,0.25);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-primary);
  white-space: nowrap;
}

/* ============================================================
   SETUP SECTION — Name Input (Aesthetic Upgrade)
   ============================================================ */
.setup-section { text-align: left; }

.input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--clr-text-muted);
  margin-bottom: 12px;
  cursor: pointer;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-family: var(--font-alt);
}

/* Name Input Wrapper — Premium Glassmorphism Style */
.name-input-wrap {
  position: relative;
  margin-bottom: 18px;
}

/* Glow track behind the input */
.name-input-wrap::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 18px;
  background: linear-gradient(135deg, #c084fc, #f0abfc, #a855f7, #e879f9);
  background-size: 300% 300%;
  animation: nameInputGlow 4s ease infinite;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}
.name-input-wrap:focus-within::before {
  opacity: 1;
}
@keyframes nameInputGlow {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* Inner layer — frosted glass */
.name-input-wrap::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 17px;
  background: rgba(20, 10, 45, 0.82);
  backdrop-filter: blur(20px);
  z-index: 1;
  pointer-events: none;
  transition: background 0.3s ease;
}
.name-input-wrap:focus-within::after {
  background: rgba(20, 10, 45, 0.75);
}

.name-input {
  position: relative;
  z-index: 2;
  width: 100%;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 16px 52px 16px 20px;
  font-size: 1rem;
  font-family: var(--font-main);
  font-weight: 600;
  color: var(--clr-text);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  letter-spacing: 0.2px;
}
.name-input::placeholder {
  color: rgba(241,232,255,0.30);
  font-weight: 400;
  font-style: italic;
}
.name-input:focus {
  border-color: transparent;
  box-shadow: none;
}

/* Emoji Decorator */
.name-input-emoji {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  font-size: 1.3rem;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), filter 0.3s ease;
  filter: grayscale(0.2);
}
.name-input-wrap:focus-within .name-input-emoji {
  transform: translateY(-50%) rotate(12deg) scale(1.2);
  filter: none;
  animation: emojiWiggle 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes emojiWiggle {
  0%   { transform: translateY(-50%) rotate(0deg) scale(1); }
  30%  { transform: translateY(-50%) rotate(18deg) scale(1.3); }
  60%  { transform: translateY(-50%) rotate(8deg) scale(1.15); }
  100% { transform: translateY(-50%) rotate(12deg) scale(1.2); }
}

/* Shimmer line at bottom of input when focused */
.name-input-shimmer {
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #c084fc, #f0abfc, #c084fc, transparent);
  background-size: 200% 100%;
  opacity: 0;
  z-index: 3;
  transition: opacity 0.3s ease;
  animation: shimmerSlide 2s linear infinite;
}
.name-input-wrap:focus-within .name-input-shimmer {
  opacity: 1;
}
@keyframes shimmerSlide {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Input label icon animation */
.input-label-icon {
  display: inline-block;
  animation: labelIconSpin 3s ease-in-out infinite;
  font-style: normal;
}
@keyframes labelIconSpin {
  0%,100% { transform: rotate(0deg) scale(1); }
  25%      { transform: rotate(-15deg) scale(1.1); }
  75%      { transform: rotate(15deg) scale(1.1); }
}

/* Config / Provider Status Row */
.config-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  transition: border-color var(--transition), background var(--transition);
}
.config-status-row:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(192,132,252,0.2);
}

.provider-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--clr-text-muted);
  font-family: var(--font-alt);
  letter-spacing: 0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--clr-teal);
  box-shadow: 0 0 6px var(--clr-teal);
  animation: dotPulse 2s ease-in-out infinite;
}
.provider-dot.error { background: var(--clr-rose); box-shadow: 0 0 6px var(--clr-rose); animation: none; }
@keyframes dotPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.8); }
}

.config-file-btn {
  flex-shrink: 0;
  background: rgba(192,132,252,0.10);
  border: 1px solid rgba(192,132,252,0.22);
  border-radius: var(--radius-pill);
  padding: 5px 13px;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--clr-primary);
  font-family: var(--font-alt);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.2px;
}
.config-file-btn:hover {
  background: rgba(192,132,252,0.20);
  border-color: var(--clr-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(192,132,252,0.2);
}
.config-file-btn:active { transform: translateY(0); }

.api-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  margin-bottom: 8px;
}
.api-input-wrap:focus-within {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(192,132,252,0.15);
}
.api-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-family: 'Courier New', monospace;
  color: var(--clr-text);
  outline: none;
}
.api-input::placeholder { color: var(--clr-text-faint); font-family: var(--font-main); }
.toggle-visibility {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: opacity var(--transition);
  line-height: 1;
}
.toggle-visibility:hover { opacity: 0.7; }

.api-hint {
  font-size: 0.78rem;
  color: var(--clr-text-faint);
  margin-bottom: 16px;
  line-height: 1.5;
}

.error-msg {
  background: rgba(251,113,133,0.15);
  border: 1px solid rgba(251,113,133,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--clr-rose);
  margin-bottom: 14px;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* Start button */
.start-btn {
  position: relative;
  width: 100%;
  padding: 15px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #a855f7, #c084fc, #f0abfc);
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-alt);
  letter-spacing: 0.3px;
  box-shadow: 0 8px 30px rgba(168,85,247,0.4);
  transition: transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
}
@keyframes gradientShift {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.start-btn:hover  { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(168,85,247,0.5); }
.start-btn:active { transform: translateY(0); }

.privacy-note {
  margin-top: 18px;
  font-size: 0.76rem;
  color: var(--clr-text-faint);
  text-align: center;
}

/* ============================================================
   CHAT APP LAYOUT
   ============================================================ */
.chat-app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.app-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
/* ---------- Header ---------- */
.chat-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(15,10,30,0.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--clr-border);
  box-shadow: 0 1px 20px rgba(0,0,0,0.3);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-avatar-wrap { position: relative; flex-shrink: 0; }
.header-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--clr-primary);
  box-shadow: 0 0 12px rgba(192,132,252,0.4);
}
.header-status-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  background: var(--clr-teal);
  border-radius: 50%;
  border: 2px solid var(--clr-bg);
  box-shadow: 0 0 6px var(--clr-teal);
}
.header-name {
  font-family: var(--font-alt);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.1;
}
.app-brand {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--clr-primary);
  letter-spacing: 0.5px;
  margin-left: 4px;
}
.header-status {
  font-size: 0.78rem;
  color: var(--clr-teal);
  font-weight: 600;
}
.header-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), transform var(--transition);
  line-height: 1;
}
.icon-btn:hover { background: rgba(255,255,255,0.15); transform: scale(1.08); }
.mood-indicator {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--clr-surface-2);
  border: 1px solid rgba(192,132,252,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.mood-indicator:hover { transform: scale(1.12); box-shadow: 0 0 12px rgba(192,132,252,0.3); }

/* ---------- Chat Main / Messages ---------- */
.chat-main {
  position: relative;
  z-index: 5;
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 10px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.chat-main::-webkit-scrollbar { width: 4px; }
.chat-main::-webkit-scrollbar-track { background: transparent; }
.chat-main::-webkit-scrollbar-thumb { background: rgba(192,132,252,0.3); border-radius: 4px; }

/* Messages wrapper */
.chat-messages { display: flex; flex-direction: column; gap: 16px; min-height: 100%; }

/* --- Single message row --- */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: msgIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
  max-width: 100%;
}
@keyframes msgIn {
  from { opacity:0; transform: translateY(12px) scale(0.97); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
.msg-row.user-row { flex-direction: row-reverse; }

/* Bubble avatar */
.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(192,132,252,0.4);
  flex-shrink: 0;
}
.user-row .msg-avatar { display: none; }

/* Bubble */
.msg-bubble-wrap { max-width: min(75%, 520px); display: flex; flex-direction: column; gap: 4px; }
.user-row .msg-bubble-wrap { align-items: flex-end; }
.ai-row  .msg-bubble-wrap { align-items: flex-start; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 20px;
  line-height: 1.65;
  font-size: 0.94rem;
  word-break: break-word;
  position: relative;
}
.user-row .msg-bubble {
  background: var(--clr-user-bg);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 20px rgba(168,85,247,0.35);
}
.ai-row .msg-bubble {
  background: rgba(255,255,255,0.09);
  backdrop-filter: blur(12px);
  border: 1px solid var(--clr-border);
  color: var(--clr-text);
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.msg-time {
  font-size: 0.7rem;
  color: var(--clr-text-faint);
  padding: 0 4px;
}

/* Welcome message special */
.welcome-card {
  background: rgba(192,132,252,0.08);
  border: 1px solid rgba(192,132,252,0.2);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 8px;
  text-align: center;
  animation: cardEntrance 0.6s ease both;
}
.welcome-card .welcome-emoji { font-size: 2.5rem; margin-bottom: 10px; }
.welcome-card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.welcome-card p  { font-size: 0.88rem; color: var(--clr-text-muted); line-height: 1.6; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  animation: msgIn 0.3s ease both;
}
.typing-avatar { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 1.5px solid rgba(192,132,252,0.4); flex-shrink: 0; }
.typing-avatar img { width: 100%; height: 100%; object-fit: cover; }
.typing-bubble {
  background: rgba(255,255,255,0.09);
  border: 1px solid var(--clr-border);
  border-radius: 20px 20px 20px 4px;
  padding: 12px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--clr-primary);
  animation: dotBounce 1.2s ease infinite;
}
.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%,80%,100% { transform: scale(1); opacity: 0.5; }
  40%          { transform: scale(1.3) translateY(-4px); opacity: 1; }
}
.typing-label { font-size: 0.75rem; color: var(--clr-text-faint); font-style: italic; }

/* ---------- Suggestions ---------- */
.suggestions-wrap {
  position: relative;
  z-index: 6;
  padding: 10px 16px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.suggestions-wrap::-webkit-scrollbar { display: none; }
.suggestions {
  display: flex;
  gap: 8px;
  width: max-content;
}
.suggestion-chip {
  background: rgba(192,132,252,0.1);
  border: 1.5px solid rgba(192,132,252,0.25);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--clr-primary);
  white-space: nowrap;
  transition: all var(--transition);
  font-family: var(--font-main);
}
.suggestion-chip:hover {
  background: rgba(192,132,252,0.2);
  border-color: var(--clr-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(192,132,252,0.2);
}

/* ---------- Footer / Input ---------- */
.chat-footer {
  position: relative;
  z-index: 10;
  padding: 12px 16px 16px;
  background: rgba(15,10,30,0.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--clr-border);
}
.input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-container:focus-within {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(192,132,252,0.12);
}

/* Emoji toggle */
.emoji-wrap { position: relative; }
.emoji-btn { background: transparent !important; border: none !important; font-size: 1.3rem; padding: 4px; width: 36px; height: 36px; }
.emoji-picker {
  position: absolute;
  bottom: 50px;
  left: 0;
  background: rgba(20,10,45,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-card);
  z-index: 50;
  display: none;
}
.emoji-picker.open { display: block; animation: fadeUp 0.2s ease; }
@keyframes fadeUp {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 32px);
  gap: 4px;
}
.emoji-grid button {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: transparent;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  line-height: 1;
}
.emoji-grid button:hover { background: rgba(255,255,255,0.1); }

/* Textarea */
.textarea-wrap { flex: 1; position: relative; }
.message-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-main);
  font-size: 0.93rem;
  color: var(--clr-text);
  line-height: 1.5;
  max-height: 120px;
  padding: 6px 0 24px;
  scrollbar-width: none;
}
.message-input::-webkit-scrollbar { display: none; }
.message-input::placeholder { color: var(--clr-text-faint); }
.char-count {
  position: absolute;
  bottom: 4px;
  right: 0;
  font-size: 0.68rem;
  color: var(--clr-text-faint);
}
.char-count.warn { color: var(--clr-rose); }

/* Send button */
.send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #c084fc);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(168,85,247,0.35);
  opacity: 0.4;
}
.send-btn:not(:disabled) { opacity: 1; }
.send-btn:not(:disabled):hover { transform: scale(1.08) rotate(5deg); box-shadow: 0 6px 20px rgba(168,85,247,0.5); }
.send-btn:not(:disabled):active { transform: scale(0.95); }
.send-icon { width: 18px; height: 18px; color: #fff; }

.footer-note {
  text-align: center;
  font-size: 0.68rem;
  color: var(--clr-text-faint);
  margin-top: 8px;
  letter-spacing: 0.3px;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Mood Modal */
.mood-modal-card, .confirm-modal-card {
  background: rgba(20,10,45,0.95);
  backdrop-filter: blur(30px);
  border: 1px solid var(--clr-border-2);
  border-radius: var(--radius-xl);
  padding: 30px 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-card);
  animation: cardEntrance 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  text-align: center;
}
.mood-modal-card h3, .confirm-modal-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.mood-modal-card p, .confirm-modal-card p {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  margin-bottom: 22px;
  line-height: 1.5;
}
.mood-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.mood-option {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-border);
  transition: all var(--transition);
  font-family: var(--font-main);
  cursor: pointer;
}
.mood-option:hover {
  background: rgba(192,132,252,0.12);
  border-color: var(--clr-primary);
  transform: translateY(-3px);
}
.mood-option span { font-size: 1.5rem; line-height: 1; }
.mood-option span:last-child { font-size: 0.68rem; color: var(--clr-text-muted); font-weight: 600; }
.modal-close {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-pill);
  padding: 8px 20px;
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--clr-surface-2); color: var(--clr-text); }

/* Confirm Modal */
.confirm-icon { font-size: 2.5rem; margin-bottom: 12px; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }
.btn-secondary {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--clr-text-muted);
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { background: var(--clr-surface-2); color: var(--clr-text); }
.btn-danger {
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(244,63,94,0.3);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(244,63,94,0.4); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .splash-card { padding: 32px 22px 26px; }
  .app-logo { font-size: 1.7rem; }
  .mood-grid { grid-template-columns: repeat(4, 1fr); }
  .msg-bubble-wrap { max-width: 85%; }
}

@media (min-width: 640px) {
  .chat-app {
    max-width: 680px;
    margin: 0 auto;
    height: 100dvh;
  }
}

/* Particles */
.particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--clr-primary);
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0%   { opacity:0; transform: translateY(100vh) scale(0); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { opacity:0; transform: translateY(-20vh) scale(1.5); }
}

/* Message formatting */
.msg-bubble strong { font-weight: 800; }
.msg-bubble em { font-style: italic; }
.msg-bubble br { line-height: 2.2; }

/* ============================================================
   VOICE FEATURES
   ============================================================ */

/* --- TTS Toggle Button (Speaker icon in header) --- */
#tts-toggle-btn {
  position: relative;
  transition: all var(--transition);
}
#tts-toggle-btn.tts-active {
  background: rgba(192,132,252,0.18);
  border-color: var(--clr-primary);
  box-shadow: 0 0 12px rgba(192,132,252,0.35);
  color: var(--clr-primary);
}
#tts-toggle-btn.tts-speaking {
  animation: speakerPulse 0.8s ease-in-out infinite;
}
@keyframes speakerPulse {
  0%,100% { box-shadow: 0 0 8px rgba(192,132,252,0.3); }
  50%      { box-shadow: 0 0 22px rgba(192,132,252,0.7); transform: scale(1.08); }
}

/* --- Microphone Button --- */
.mic-btn {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid var(--clr-border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--clr-text-muted);
  transition: all var(--transition);
  overflow: visible;
}
.mic-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  transform: scale(1.06);
}
.mic-icon {
  width: 18px; height: 18px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}
/* Mic waves (hidden by default, shown when listening) */
.mic-waves {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  display: none;
  pointer-events: none;
}
.mic-waves span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--clr-rose);
  animation: micRing 1.4s ease-out infinite;
}
.mic-waves span:nth-child(2) { animation-delay: 0.35s; }
.mic-waves span:nth-child(3) { animation-delay: 0.7s; }
@keyframes micRing {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Active (listening) state */
.mic-btn.listening {
  background: rgba(251,113,133,0.18);
  border-color: var(--clr-rose);
  color: var(--clr-rose);
  animation: micListenPulse 1.2s ease-in-out infinite;
}
.mic-btn.listening .mic-waves { display: block; }
@keyframes micListenPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(251,113,133,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(251,113,133,0); }
}

/* --- Voice Mode Banner --- */
.voice-mode-banner {
  position: relative;
  z-index: 8;
  background: linear-gradient(90deg, rgba(192,132,252,0.12), rgba(240,171,252,0.08));
  border-bottom: 1px solid rgba(192,132,252,0.2);
  padding: 8px 16px;
  animation: bannerSlideIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes bannerSlideIn {
  from { opacity:0; transform: translateY(-100%); }
  to   { opacity:1; transform: translateY(0); }
}
.voice-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Orb */
.voice-orb {
  position: relative;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.voice-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(192,132,252,0.5);
  animation: orbRing 2s ease-out infinite;
}
.voice-orb-ring.ring-2 { animation-delay: 0.8s; }
@keyframes orbRing {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Orb when speaking (Kimi talks) */
.voice-orb.speaking .voice-orb-ring {
  border-color: rgba(240,171,252,0.6);
  animation: orbRingSpeaking 0.6s ease-in-out infinite alternate;
}
@keyframes orbRingSpeaking {
  from { transform: scale(1); opacity: 0.6; }
  to   { transform: scale(1.5); opacity: 0.1; }
}

/* Orb when listening (user talks) */
.voice-orb.listening {
  background: rgba(251,113,133,0.1);
  border-radius: 50%;
}
.voice-orb.listening .voice-orb-ring {
  border-color: rgba(251,113,133,0.5);
}

.voice-mode-label {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--clr-primary);
  font-family: var(--font-alt);
}
.voice-mode-stop {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(251,113,133,0.15);
  border: 1px solid rgba(251,113,133,0.3);
  color: var(--clr-rose);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  font-family: var(--font-main);
}
.voice-mode-stop:hover { background: rgba(251,113,133,0.3); transform: scale(1.1); }

/* --- Speaking audio wave bars on AI bubble --- */
.speaking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 8px;
  vertical-align: middle;
}
.speaking-indicator span {
  display: inline-block;
  width: 3px;
  border-radius: 3px;
  background: var(--clr-primary);
  animation: wavebar 0.8s ease-in-out infinite;
}
.speaking-indicator span:nth-child(1) { height: 8px;  animation-delay: 0s; }
.speaking-indicator span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.speaking-indicator span:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.speaking-indicator span:nth-child(4) { height: 16px; animation-delay: 0.15s; }
.speaking-indicator span:nth-child(5) { height: 8px;  animation-delay: 0.05s; }
@keyframes wavebar {
  0%,100% { transform: scaleY(0.5); opacity: 0.5; }
  50%      { transform: scaleY(1.2); opacity: 1; }
}

/* --- Transcript overlay during STT --- */
.stt-interim {
  color: var(--clr-text-faint);
  font-style: italic;
  font-size: 0.88rem;
  padding: 4px 8px;
}

/* --- Voice Player Custom (Voice Notes) --- */
.voice-player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-top: 4px;
  margin-bottom: 4px;
  width: 260px;
  max-width: 100%;
}
.voice-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--clr-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.voice-play-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.9);
}
.voice-play-btn svg {
  width: 18px;
  height: 18px;
}
.voice-play-btn .hidden {
  display: none !important;
}
.voice-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.voice-seekbar-container {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  cursor: pointer;
}
.voice-seekbar-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--clr-primary);
  border-radius: 2px;
  pointer-events: none;
}
.voice-seekbar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.voice-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--clr-text-muted);
  line-height: 1;
}
.voice-transcript {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.95);
  margin-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  padding-top: 6px;
}

