:root {
  --bg: #0f0c14;
  --panel: rgba(24, 20, 30, 0.85);
  --bot-glass: rgba(255, 192, 203, 0.15);
  --user-glass: rgba(173, 216, 230, 0.15);
  --text: #f7f1ff;
  --muted: #b4a7d6;
  --accent: rgb(139, 92, 246);
}

* { box-sizing: border-box; }

/* Preloader */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #FFB6D9;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader-icon {
  width: 80px;
  height: 80px;
  animation: kiss-pulse 1.5s ease-in-out infinite;
}

.preloader-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.3));
}

@keyframes kiss-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}
html, body { 
  height: 100%; 
  margin: 0;
  overflow: hidden;
}
body {
  background: #0f0c14;
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Sky Layer - Slowest parallax (back) */
body::before {
  content: '';
  position: fixed;
  top: -5%;
  left: -5%;
  width: 110%;
  height: 110%;
  background: url('./assets/bg-sky.webp') center center / cover no-repeat;
  background-image: image-set(
    url('./assets/bg-sky.webp') type('image/webp'),
    url('./assets/bg-sky.png') type('image/png')
  );
  transform: translate3d(calc(var(--mouse-x, 0) * 0.3), calc(var(--mouse-y, 0) * 0.3), 0);
  transition: transform 0.3s ease-out;
  will-change: transform;
  z-index: -3;
}

/* City Layer - Medium parallax (middle) */
body::after {
  content: '';
  position: fixed;
  top: -5%;
  left: -5%;
  width: 110%;
  height: 110%;
  background: url('./assets/bg-city.webp') center center / cover no-repeat;
  background-image: image-set(
    url('./assets/bg-city.webp') type('image/webp'),
    url('./assets/bg-city.png') type('image/png')
  );
  transform: translate3d(calc(var(--mouse-x, 0) * 0.6), calc(var(--mouse-y, 0) * 0.6), 0);
  transition: transform 0.3s ease-out;
  will-change: transform;
  z-index: -2;
}

/* Room Layer - Fastest parallax (front) */
.bg-room-layer {
  content: '';
  position: fixed;
  top: -5%;
  left: -5%;
  width: 110%;
  height: 110%;
  background: url('./assets/bg-room.webp') center center / cover no-repeat;
  background-image: image-set(
    url('./assets/bg-room.webp') type('image/webp'),
    url('./assets/bg-room.png') type('image/png')
  );
  transform: translate3d(var(--mouse-x, 0), var(--mouse-y, 0), 0);
  transition: transform 0.3s ease-out;
  filter: blur(2px);
  will-change: transform;
  z-index: -1;
  pointer-events: none;
}

#mika-animation {
  position: fixed;
  bottom: -90px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: calc(100vh + 4px);
  pointer-events: none;
  z-index: 1;
  line-height: 0;
}

#mika-animation > * {
  vertical-align: bottom;
  display: block;
}

.wrap { 
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 760px; 
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 2;
  height: 100vh;
  overflow: hidden;
}

.toggles { 
  display: flex; 
  gap: 20px; 
  color: rgba(255, 255, 255, 0.85); 
  font-size: 13px;
  justify-content: flex-start;
  margin-top: 14px;
  font-weight: 400;
}
.toggles label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: color 0.2s;
}
.toggles label:hover {
  color: rgba(255, 255, 255, 1);
}
.toggles input { 
  accent-color: rgb(139, 92, 246);
  cursor: pointer;
}

.log {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  padding-bottom: 160px;
  display: flex;
  flex-direction: column;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.log::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

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

.bubble {
  max-width: 70%;
  padding: 12px 18px;
  border-radius: 18px;
  margin: 6px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  backdrop-filter: blur(8px);
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.3s ease-out;
  line-height: 1.5;
}

.user { 
  background: rgba(139, 92, 246, 0.3);
  color: #ffffff;
  margin-left: auto;
  text-shadow: none;
}

.bot { 
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  text-shadow: none;
}

.bot-message-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 8px 0;
}

.bot-pfp {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255, 182, 193, 0.4);
}

.bot-message-wrapper .bot {
  margin: 0;
}

footer {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 700px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.input-area {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

textarea {
  height: 52px;
  resize: none;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: all 0.2s;
}

textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

button {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: none;
  background: rgba(139, 92, 246, 0.25);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

button:hover { 
  background: rgba(139, 92, 246, 0.35);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button svg {
  transform: rotate(45deg);
}
.typing { 
  opacity: 0.7; 
  font-style: italic;
}

/* Menu Toggle Button */
.menu-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.menu-toggle:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.menu-toggle svg {
  transform: none;
  width: 20px;
  height: 20px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  transition: left 0.3s ease;
  z-index: 99;
  overflow-y: auto;
}

.sidebar.open {
  left: 0;
}

.sidebar-content {
  padding: 80px 20px 20px;
}

.sidebar h2 {
  color: #ffffff;
  margin: 0 0 24px 0;
  font-size: 24px;
}

/* Girl Items */
.girl-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s;
  cursor: pointer;
}

.girl-item.active {
  background: rgba(199, 156, 255, 0.15);
  border-color: var(--accent);
}

.girl-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.girl-item:not(.locked):hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.girl-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff6ec4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  color: white;
  object-fit: cover;
  flex-shrink: 0;
}

.girl-avatar.locked-avatar {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
}

.girl-info {
  flex: 1;
}

.girl-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.girl-status {
  font-size: 13px;
  color: var(--muted);
}

.girl-status.available {
  color: #4ade80;
}

/* Buy More Button */
.buy-more-btn {
  width: 100%;
  margin-top: 24px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(199, 156, 255, 0.2);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.buy-more-btn:hover {
  background: rgba(199, 156, 255, 0.3);
  border-color: var(--accent);
}

.coming-soon {
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
}

/* Settings Toggle Button */
.settings-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.settings-toggle:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.settings-toggle svg {
  transform: none;
  width: 20px;
  height: 20px;
}

/* Settings Sidebar (Right) */
.settings-sidebar {
  left: auto;
  right: -320px;
  border-right: none;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  transition: right 0.3s ease;
}

.settings-sidebar.open {
  right: 0;
  left: auto;
}

/* Menu Items Container */
.menu-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 24px;
}

/* Menu Buttons */
.menu-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  text-align: left;
}

.menu-btn:hover {
  background: rgba(199, 156, 255, 0.1);
}

.menu-btn:active {
  background: rgba(199, 156, 255, 0.15);
}

.menu-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transform: none;
  opacity: 0.8;
}

.menu-btn span {
  flex: 1;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  /* Disable expensive blur effects on mobile for better performance */
  .bubble,
  footer,
  .menu-toggle,
  .settings-toggle,
  .sidebar {
    backdrop-filter: none;
  }
  
  /* Remove blur from room layer on mobile */
  .bg-room-layer {
    filter: none;
  }
  
  /* Increase background opacity to compensate for removed blur */
  .bubble {
    background: rgba(139, 92, 246, 0.4);
  }
  
  .bot {
    background: rgba(255, 255, 255, 0.18);
  }
  
  footer {
    background: rgba(0, 0, 0, 0.6);
  }
  
  .menu-toggle,
  .settings-toggle {
    background: rgba(0, 0, 0, 0.6);
  }
  
  .sidebar {
    background: rgba(0, 0, 0, 0.7);
  }
  
  #mika-animation {
    height: auto;
    width: 308vw;
    max-width: none;
    bottom: 0;
    transform: translateX(-50%);
  }
  
  #mika-animation > * {
    height: auto;
    width: 100%;
    max-height: 110vh;
    object-fit: contain;
    object-position: bottom;
  }
  
  .bubble {
    max-width: 80%;
  }
  
  .log {
    padding-top: 80px;
    padding-bottom: 200px;
  }
  
  footer {
    bottom: 12px;
    width: calc(100% - 24px);
    padding: 12px;
    border-radius: 20px;
  }
  
  textarea {
    height: 46px;
    padding: 12px 14px;
    font-size: 14px;
  }
  
  button {
    width: 46px;
    height: 46px;
  }
  
  button svg {
    width: 20px;
    height: 20px;
  }
  
  .toggles {
    font-size: 12px;
    gap: 14px;
    margin-top: 10px;
  }
  
  .menu-toggle,
  .settings-toggle {
    width: 40px;
    height: 40px;
  }
}
