:root {
  --primary-pink: #f28b9f;
  --primary-soft: #fdf2f4;
  --lavender: #e9e5fb;
  --lavender-dark: #7b68ee;
  --text-dark: #2d2a32;
  --text-muted: #736b79;
  --card-bg: rgba(255, 255, 255, 0.78);
  --card-border: rgba(255, 255, 255, 0.65);
  --bot-bubble: #ffffff;
  --user-bubble: #f28b9f;
  --user-bubble-text: #ffffff;
  --shadow-soft: 0 12px 35px rgba(234, 172, 190, 0.25);
  --radius-xl: 28px;
  --radius-md: 18px;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #faf7f5;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Animated Blobs */
.background-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float 14s ease-in-out infinite alternate;
}

.blob-1 {
  width: 380px;
  height: 380px;
  background: #fcd5ce;
  top: -60px;
  left: -80px;
}

.blob-2 {
  width: 420px;
  height: 420px;
  background: #d8e2dc;
  bottom: -90px;
  right: -90px;
  animation-delay: -5s;
}

.blob-3 {
  width: 320px;
  height: 320px;
  background: #f8edeb;
  top: 40%;
  left: 30%;
  animation-delay: -9s;
}

@keyframes float {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(35px) scale(1.08); }
}

/* Overlay for Audio Initiation */
.start-overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 247, 245, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.overlay-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.pulse-flower {
  font-size: 52px;
  margin-bottom: 16px;
  animation: pulseScale 2.4s ease-in-out infinite;
  display: inline-block;
}

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

.overlay-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 600;
  color: #3b3038;
  margin-bottom: 8px;
}

.overlay-subtext {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 28px;
}

.start-btn {
  background: linear-gradient(135deg, #f28b9f 0%, #ea7088 100%);
  color: #ffffff;
  border: none;
  padding: 16px 32px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(242, 139, 159, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(242, 139, 159, 0.55);
}

.start-btn:active {
  transform: translateY(1px);
}

.tap-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
}

/* App Layout */
.app-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 520px;
  height: 94vh;
  max-height: 900px;
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 16px;
}

/* Header */
.app-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.65);
  border-bottom: 1px solid rgba(220, 215, 225, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.avatar-container {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffe3ea;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  position: relative;
}

.avatar-container.speaking {
  animation: glowSpeaking 1.8s infinite;
}

@keyframes glowSpeaking {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 139, 159, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(242, 139, 159, 0); }
}

.title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.title-row h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

.online-indicator {
  width: 8px;
  height: 8px;
  background-color: #34d399;
  border-radius: 50%;
  display: inline-block;
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

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

.icon-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(220, 215, 225, 0.6);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: #ffffff;
  transform: scale(1.05);
}

.repo-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f1f0f7;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: #554e60;
}

.repo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* Voice Visualizer Banner */
.voice-banner {
  background: #fbf7f9;
  border-bottom: 1px solid rgba(230, 220, 230, 0.4);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.wave-container {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.bar {
  width: 3px;
  height: 4px;
  background: var(--primary-pink);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.speaking .bar {
  animation: wave 1s ease-in-out infinite alternate;
}

.speaking .bar:nth-child(2) { animation-delay: 0.15s; }
.speaking .bar:nth-child(3) { animation-delay: 0.3s; }
.speaking .bar:nth-child(4) { animation-delay: 0.45s; }
.speaking .bar:nth-child(5) { animation-delay: 0.6s; }

@keyframes wave {
  0% { height: 4px; }
  100% { height: 16px; }
}

.voice-status-label {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Chat Messages */
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.message-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-wrapper.bot {
  align-self: flex-start;
}

.message-wrapper.user {
  align-self: flex-end;
}

.bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 1.55;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.message-wrapper.bot .bubble {
  background: var(--bot-bubble);
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(220, 215, 225, 0.6);
}

.message-wrapper.user .bubble {
  background: linear-gradient(135deg, #f28b9f 0%, #ea7088 100%);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.message-wrapper.user .message-time {
  align-self: flex-end;
}

/* Pre-built Single Telegram Prompt */
.telegram-prompt-container {
  padding: 10px 16px 14px 16px;
  display: flex;
  flex-direction: column;
}

.telegram-prompt-card {
  background: linear-gradient(135deg, #eef7ff 0%, #e2f0fd 100%);
  border: 1.5px solid #a8d5fc;
  border-radius: 20px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 6px 20px rgba(42, 171, 238, 0.16);
  animation: fadeIn 0.4s ease;
}

.tg-prompt-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tg-prompt-title {
  font-size: 15px;
  font-weight: 700;
  color: #0c4d7e;
}

.tg-prompt-desc {
  font-size: 12px;
  color: #3b5f7e;
}

.tg-main-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2aabee 0%, #1a94d2 100%);
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.4);
  transition: all 0.2s ease;
}

.tg-main-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(42, 171, 238, 0.5);
}

/* Telegram Interactive Card inside chat */
.tg-guide-card {
  margin-top: 12px;
  background: linear-gradient(135deg, #f0f7fe 0%, #e8f3fd 100%);
  border: 1px solid #c9e2fa;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(42, 171, 238, 0.08);
}

.tg-guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #1a6296;
}

.tg-steps {
  font-size: 13px;
  color: #3b5266;
  line-height: 1.5;
  padding-left: 18px;
}

.tg-steps li {
  margin-bottom: 4px;
}

.tg-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.tg-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #2aabee;
  color: #ffffff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.35);
  transition: all 0.2s ease;
}

.tg-link-btn:hover {
  background: #2299d6;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(42, 171, 238, 0.45);
}

.tg-confirm-btn {
  background: #ffffff;
  border: 1px solid #bedbf7;
  color: #1a6296;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tg-confirm-btn:hover {
  background: #f0f7fe;
  border-color: #2aabee;
  color: #2aabee;
}

/* YouTube Music Dedication Card */
.music-card {
  margin-top: 14px;
  background: linear-gradient(135deg, #fff5f7 0%, #fef0f2 100%);
  border: 1px solid rgba(242, 139, 159, 0.4);
  border-radius: 20px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(242, 139, 159, 0.18);
  animation: glowCard 2.5s ease-in-out infinite alternate;
}

@keyframes glowCard {
  0% { box-shadow: 0 8px 20px rgba(242, 139, 159, 0.15); }
  100% { box-shadow: 0 12px 28px rgba(242, 139, 159, 0.3); }
}

.music-icon-wrap {
  width: 50px;
  height: 50px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(234, 112, 136, 0.2);
  animation: rotateMusic 8s linear infinite;
}

@keyframes rotateMusic {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.music-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.music-sub {
  font-size: 12px;
  color: #925867;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.music-title {
  font-family: 'Playfair Display', serif;
  font-size: 19px;
  font-weight: 600;
  color: #43222d;
}

.music-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 4px;
}

.music-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #ea7088;
  border: 1.5px solid #ea7088;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.music-toggle-btn:hover {
  background: #fdf2f4;
  transform: translateY(-1px);
}

.music-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff0033 0%, #cc0029 100%);
  color: #ffffff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(204, 0, 41, 0.25);
  transition: all 0.2s ease;
}

.music-play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(204, 0, 41, 0.4);
}

/* Telegram Connect Action Card */
.tg-action-card {
  margin-top: 14px;
  background: linear-gradient(135deg, #f4faff 0%, #ebf5fe 100%);
  border: 1.5px solid rgba(42, 171, 238, 0.35);
  border-radius: 20px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(42, 171, 238, 0.15);
  animation: glowTgCard 3s ease-in-out infinite alternate;
}

@keyframes glowTgCard {
  0% { box-shadow: 0 8px 20px rgba(42, 171, 238, 0.12); }
  100% { box-shadow: 0 12px 28px rgba(42, 171, 238, 0.28); }
}

.tg-action-sub {
  font-size: 12px;
  color: #1c7bb5;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tg-hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #2aabee 0%, #1c94d2 100%);
  color: #ffffff !important;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 999px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 6px 20px rgba(42, 171, 238, 0.35);
  transition: all 0.25s ease;
}

.tg-hero-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 28px rgba(42, 171, 238, 0.5);
}

.tg-hero-btn:active {
  transform: scale(0.98);
}

.tg-hero-note {
  font-size: 11.5px;
  color: #728496;
}

/* Footer / Input Area */
.app-footer {
  padding: 12px 16px 16px 16px;
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid rgba(220, 215, 225, 0.45);
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(210, 205, 220, 0.7);
  border-radius: 26px;
  padding: 4px 6px 4px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
  gap: 8px;
}

.input-wrapper:focus-within {
  border-color: var(--primary-pink);
  box-shadow: 0 0 0 3px rgba(242, 139, 159, 0.2);
}

.mic-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.mic-btn.recording {
  animation: pulseMic 1.2s infinite;
  background: #ffe3ea;
}

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

textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--text-dark);
  max-height: 80px;
  padding: 6px 0;
  background: transparent;
}

textarea::placeholder {
  color: #9f96a6;
}

.send-btn {
  background: linear-gradient(135deg, #f28b9f 0%, #ea7088 100%);
  color: #ffffff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* Responsiveness */
@media (max-width: 600px) {
  .app-container {
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
  }
}

/* Mid-Conversation Telegram Modal Popup */
.tg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 50, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.tg-modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tg-modal-card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  padding: 32px 26px 26px 26px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalScale 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.tg-modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 24px;
  color: #9f96a6;
  cursor: pointer;
  line-height: 1;
}

.tg-modal-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.tg-modal-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: #2d2a32;
  margin-bottom: 10px;
}

.tg-modal-text {
  font-size: 13.5px;
  color: #635b6a;
  line-height: 1.5;
  margin-bottom: 22px;
}

.tg-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #2aabee 0%, #1c94d2 100%);
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 28px;
  border-radius: 999px;
  width: 100%;
  box-shadow: 0 6px 18px rgba(42, 171, 238, 0.4);
  transition: all 0.2s ease;
}

.tg-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(42, 171, 238, 0.5);
}

.tg-modal-dismiss {
  background: none;
  border: none;
  font-size: 12.5px;
  color: #9f96a6;
  cursor: pointer;
  margin-top: 14px;
  text-decoration: underline;
}
