body,
html {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
*,
*::before,
*::after {
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    fill 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    stroke 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: background-color, color, border-color, box-shadow, fill, stroke,
    opacity;
}
:root {
  --bg-color: #000000;
  --text-color: #ffffff;
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}
/* Starfield for space background */
.chat-mode-hidden {
  display: none !important;
}



#stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at bottom, #1b1b33 0%, #000000 70%);
  z-index: 0;
  overflow: hidden;
}
.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  animation: twinkle linear infinite;
}
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.chat-mode-hidden {
  display: none !important;
}

footer {
  position: fixed;
  bottom: 16px;
  right: 24px;
  z-index: 50;
  text-align: right;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  line-height: 1.5;
  pointer-events: none;
  
}
#voice-ui {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
}
#voice-btn {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2),
    rgba(147, 51, 234, 0.2)
  );
  border: 2px solid rgba(59, 130, 246, 0.4);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3),
    0 0 0 0 rgba(59, 130, 246, 0.4);
  position: relative;
  overflow: hidden;
}
#voice-btn::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #3b82f6, #9333ea);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#voice-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 48px rgba(59, 130, 246, 0.4),
    0 0 0 8px rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.6);
}
#voice-btn:hover::before {
  opacity: 1;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(6px);
  }
  to {
    transform: translateY(0);
  }
}

#voice-btn:active {
  transform: scale(0.95);
}
#talk-text {
  position: fixed;
  bottom: 55px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  pointer-events: none;
  letter-spacing: 0.3px;
}
.loading-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: #fff;
  font-family: sans-serif;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top: 3px solid #0ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 1024px) {
  footer {
    font-size: 10px;
    bottom: 12px;
    right: 16px;
  }
}
@media (max-width: 768px) {
  .header {
    padding: 10px 16px;
  }
  #theme-toggle .theme-text {
    display: inline;
  }
  footer {
    right: 0;
    left: 0;
    text-align: right;
    font-size: 9px;
    bottom: 10px;
    padding: 0 12px;
  }
  #voice-btn {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }
  #voice-ui {
    bottom: 80px;
  }
  #talk-text {
    font-size: 13px;
    bottom: 50px;
  }
  #transcript {
    bottom: 32px !important;
    left: 12px !important;
    right: 12px !important;
    font-size: 12px;
  }
}
@media (max-width: 480px) {
  .header {
    padding: 8px 12px;
  }
  .logo-text {
    font-size: 13px;
  }
  .logo-img {
    width: 26px !important;
    height: 26px !important;
  }
  #theme-toggle {
    font-size: 10px;
    padding: 6px 10px;
    gap: 4px;
  }
  #voice-btn {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
  #voice-ui {
    bottom: 100px;
  }
  #talk-text {
    font-size: 12px;
    bottom: 75px;
  }
  footer {
    font-size: 8px;
    line-height: 1.4;
  }
}
@media (max-width: 360px) {
  .header {
    padding: 7px 10px;
  }
  .logo-text {
    font-size: 12px;
  }
  .logo-img {
    width: 24px !important;
    height: 24px !important;
  }
  #theme-toggle {
    font-size: 9px;
    padding: 5px 8px;
    gap: 3px;
  }
  #voice-btn {
    width: 52px;
    height: 52px;
    font-size: 20px;
  }
  footer {
    font-size: 7px;
  }
}
@media (max-height: 600px) and (orientation: landscape) {
  #voice-ui {
    bottom: 60px;
  }
  #talk-text {
    bottom: 35px;
    font-size: 11px;
  }
  #voice-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  footer {
    font-size: 8px;
    bottom: 8px;
  }
}
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  #voice-btn {
    width: 68px;
    height: 68px;
    font-size: 26px;
  }
  #talk-text {
    font-size: 14px;
  }
}

/* Customize Button */
#customize-btn {
  position: fixed;
  bottom: 200px;
  right: 24px;
  z-index: 50;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 24px;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 8px;
}

#customize-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}
#customize-btn.hidden {
  display: none !important;
}

/* Popup Overlay */
#customize-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  pointer-events: none;
}

#customize-overlay.show {
  display: block;
  pointer-events: auto;
}

/* Popup Container - Side Panel */
#customize-popup {
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  height: 100vh;
  background: #1f1f1f;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 101;
}

#customize-overlay.show #customize-popup {
  right: 0;
}

/* Popup Header */
.popup-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popup-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Popup Content */
.popup-content {
  padding: 20px;
  height: calc(100vh - 65px);
  overflow-y: auto;
}

/* Custom Scrollbar */
.popup-content::-webkit-scrollbar {
  width: 8px;
}

.popup-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Theme Options */
.theme-section {
  margin-bottom: 24px;
  margin-top: 24px;

}

/* .section-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
} */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.theme-option {
  aspect-ratio: 1;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.theme-option:hover {
  transform: scale(1.05);
  border-color: rgba(59, 130, 246, 0.5);
}

.theme-option.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.theme-option.active::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  background: #3b82f6;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* Dice mood specific styles (kept separate to avoid collisions with background themes) */
.dice-option {
  aspect-ratio: 1;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.dice-option:hover {
  transform: scale(1.03);
  border-color: rgba(59, 130, 246, 0.4);
}

.dice-option.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.dice-option.active::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  background: #3b82f6;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

.theme-label {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  text-align: center;
  color: white;
  font-size: 10px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Color Picker */
.color-picker-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideInRight {
  from {
    right: -380px;
  }
  to {
    right: 0;
  }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  #customize-btn {
    bottom: 180px;
    right: 16px;
    font-size: 12px;
    padding: 8px 16px;
  }

  #customize-popup {
    width: 100vw;
    right: -100vw;
    border-radius: 0;
  }

  #customize-overlay.show #customize-popup {
    right: 0;
  }

  .popup-header {
    padding: 14px 18px;
  }

  .popup-title {
    font-size: 16px;
  }

  .popup-content {
    padding: 18px;
    height: calc(100vh - 60px);
  }

  .theme-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}
@keyframes typing {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

.typing-indicator span {
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

#stars-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.message-enter {
  animation: slideIn 0.3s ease-out;
}

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

.voice-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.voice-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

.voice-card.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.voice-card.active::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  background: #3b82f6;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.voice-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.3),
    rgba(147, 51, 234, 0.3)
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
}

.voice-name {
  color: white;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.voice-description {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  line-height: 1.4;
}

.preview-btn {
  margin-top: 10px;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 6px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.6);
}

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

.section-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  margin-top: 10px;
}

/* chat */

#chat-messages {
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
  display: none;
}

.resize-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  background: transparent;
  z-index: 9999;
}

.resize-corner.top-left {
  left: 0;
  top: 0;
  cursor: nw-resize;
}
.resize-corner.top-right {
  right: 0;
  top: 0;
  cursor: ne-resize;
}
.resize-corner.bottom-left {
  left: 0;
  bottom: 0;
  cursor: sw-resize;
}
.resize-corner.bottom-right {
  right: 0;
  bottom: 0;
  cursor: se-resize;
}

/* Animated gradient background */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animated-bg {
  background: #141414;
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
}

/* Glassmorphism effect */
.glass {
  background: #212121;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

/* Custom scrollbar for messages */
#chat-messages:hover::-webkit-scrollbar {
  display: block;
  width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.3);
  border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.7);
}

/* Shimmer effect for send button */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.shimmer {
  background: linear-gradient(90deg, #1b1b1b 0%, #141415 50%, #181a1c 100%);
  background-size: 200% auto;
  animation: shimmer 3s linear infinite;
}

/* Floating particles effect */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.particle {
  animation: float 6s ease-in-out infinite;
}

button.copied {
  position: relative;
}

button.copied svg {
  opacity: 0;
  transition: opacity 0.15s ease-out;
  /* Fade out the copy icon quickly */
}

button.copied::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  background-image: url('data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 12.6111L8.92308 17.5L20 6.5" stroke="%234ade80" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transition: opacity 0.2s ease-in 0.15s;
  /* Delay the checkmark appearance by 0.15s, then fade in over 0.2s */
}

button.copied::after {
  opacity: 1;
}
/* Glow effect for close button */
.glow-red:hover {
  box-shadow: 0 0 20px rgba(255, 248, 248, 0.5);
}

.liked svg {
  fill: white;
}