:root {
  --bg: #0a0e1a;
  --panel: rgba(17, 24, 39, 0.7);
  --muted: #8b92a8;
  --text: #f0f2f8;
  --primary: #00d9ff;
  --primary-600: #00b8d9;
  --primary-dark: #0099b8;
  --card: rgba(31, 41, 55, 0.6);
  --border: rgba(75, 85, 99, 0.3);
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(0, 217, 255, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
  /* Colorful gradient scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #00d9ff transparent;
}

/* Custom gradient scrollbar for body */
body::-webkit-scrollbar {
  width: 12px;
}

body::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    #00d9ff 0%,
    #00a8ff 20%,
    #3b82f6 40%,
    #7c3aed 60%,
    #a855f7 80%,
    #ec4899 100%
  );
  border-radius: 6px;
  border: 2px solid rgba(10, 14, 26, 0.5);
  background-clip: padding-box;
}

body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    #00b8d9 0%,
    #0090d9 20%,
    #2563eb 40%,
    #6d28d9 60%,
    #9333ea 80%,
    #db2777 100%
  );
  background-clip: padding-box;
}

body {
  margin: 0;
  background: radial-gradient(
      ellipse at top left,
      rgba(124, 58, 237, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at bottom right,
      rgba(0, 217, 255, 0.15) 0%,
      transparent 50%
    ),
    linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #0a0e1a 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent text size adjustment on iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Better touch scrolling */
  -webkit-overflow-scrolling: touch;
}

/* Disable page scrolling on mobile when chat is active */
@media (max-width: 768px) {
  body:has(.chat:not(.hidden)) {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
  }

  html:has(.chat:not(.hidden)) {
    overflow: hidden !important;
    height: 100% !important;
  }
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 24px;
  position: relative;
}

.header,
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  /* Prevent layout shift on mobile */
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Connection Status Indicator */
.username-wrapper .connection-status {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  border-radius: 8px;
  background: rgba(31, 41, 55, 0.7);
  cursor: help;
  z-index: 10;
  pointer-events: auto;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.connection-status.connected .connection-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulse 2s infinite;
}

.connection-status.connecting .connection-dot {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  animation: pulse 1s infinite;
}

.connection-status.disconnected .connection-dot {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  animation: toastSlideIn 0.3s ease-out;
  transition: all 0.3s ease;
}

.toast.hiding {
  animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.toast-message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error {
  border-left: 3px solid var(--error);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info {
  border-left: 3px solid var(--primary);
}

.toast.info .toast-icon {
  color: var(--primary);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .toast-container {
    top: 100px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

.header:hover {
  border-color: rgba(0, 217, 255, 0.3);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.brand {
  font-weight: 800;
  letter-spacing: -0.5px;
  font-size: 24px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--accent-light) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
}

.username-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 12px;
}

.username-display {
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 40px 10px 16px; /* Extra right padding for connection status */
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  min-width: 120px;
  text-align: left;
}

.username {
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 16px;
  padding-right: 40px; /* Make room for connection indicator */
  width: 180px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.username:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(31, 41, 55, 0.7);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.btn {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
}

/* Center SVG icons in header buttons - fix vertical alignment */
.header .me #profileBtn svg,
.header .me #statsBtn svg,
.header .me #settingsBtn svg,
.header .me #matchesBtn svg {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

/* Desktop: Hide mobile bottom nav */
.mobile-bottom-nav {
  display: none;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: rgba(31, 41, 55, 0.8);
  border-color: rgba(0, 217, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

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

.btn.primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-600) 100%
  );
  border: none;
  color: #0a0e1a;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 217, 255, 0.3);
}

.btn.primary:hover {
  background: linear-gradient(
    135deg,
    var(--primary-600) 0%,
    var(--primary-dark) 100%
  );
  box-shadow: 0 6px 20px rgba(0, 217, 255, 0.4);
  transform: translateY(-2px);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 217, 255, 0.3);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-loader {
  display: inline-block;
  animation: spin 1s linear infinite;
}

.btn-loader.hidden {
  display: none;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.main {
  display: grid;
  gap: 16px;
}

/* Hide ping section - now handled by quick ping modal */
#pingSection {
  display: none !important;
}

.panel {
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden; /* Keep hidden for mobile to maintain rounded corners */
  display: flex;
  flex-direction: column;
}

/* Override for bottom sheet panels - ensure visibility */
.profile-panel,
.stats-panel,
.settings-panel,
.matches-panel {
  background: rgba(17, 24, 39, 0.95) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-radius: 24px 24px 0 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-bottom: none !important;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3) !important;
  padding: 24px !important;
  color: var(--text) !important;
  min-height: 200px !important;
}

/* Ensure all content inside panels is visible */
.profile-panel *,
.stats-panel *,
.settings-panel * {
  color: inherit !important;
  opacity: 1 !important;
}

.profile-panel h2,
.stats-panel h2,
.settings-panel h2,
.matches-panel h2 {
  color: var(--text) !important;
  opacity: 1 !important;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.panel:hover::before {
  opacity: 1;
}

.panel:hover {
  border-color: rgba(0, 217, 255, 0.3);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 217, 255, 0.1);
  transform: translateY(-2px);
}

.panel h2 {
  margin: 0 0 0px 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.mood-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.mood-btn {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  min-width: 120px;
  backdrop-filter: blur(10px);
}

.mood-btn:hover {
  background: rgba(31, 41, 55, 0.8);
  border-color: rgba(0, 217, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

.mood-btn.active {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.2) 0%,
    rgba(124, 58, 237, 0.15) 100%
  );
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

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

.select,
.input {
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.select:focus,
.input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(31, 41, 55, 0.7);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.select option {
  background: #1f2937;
  color: var(--text);
}

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

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

/* Global hidden class */
.hidden {
  display: none !important;
}

.chat.hidden {
  display: none !important;
}
.chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  min-height: 0; /* Important for flex children to shrink */
  height: 100%; /* Take full height of parent */
  position: relative; /* For absolute positioning of composer if needed */
  flex: 1 1 auto; /* Allow chat to grow and shrink */
}
.chat-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
  padding: 12px 16px;
  padding-bottom: 16px;
  background: rgba(17, 24, 39, 0.3);
  border-radius: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0; /* Don't shrink on mobile */
  gap: 12px;
}

#chatMood {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

#chatTimer {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 8px;
  background: rgba(0, 217, 255, 0.1);
  border-radius: 8px;
}

/* User Slider Styles (Messenger-like) */
.user-slider {
  border-radius: 16px;
  margin-top: 70px;
}
@media screen and (max-width: 600px) {
  .user-slider {
    margin-top: 0px;
  }
}

.user-slider-container {
  position: relative;
  width: 100%;
}

.user-slider-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  padding-right: 4px;
}

.user-slider-scroll::-webkit-scrollbar {
  height: 6px;
}

.user-slider-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.user-slider-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(
    90deg,
    var(--primary) 0%,
    var(--primary-600) 100%
  );
  border-radius: 3px;
}

.user-slider-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 5px;
  background: rgba(31, 41, 55, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  user-select: none;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-chip:hover {
  background: rgba(31, 41, 55, 0.9);
  border-color: rgba(0, 217, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

.user-chip:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 217, 255, 0.15);
}

.user-chip.selected {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.2) 0%,
    rgba(0, 184, 217, 0.15) 100%
  );
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.25),
    0 4px 16px rgba(0, 217, 255, 0.2);
}

.user-chip.selected:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.25) 0%,
    rgba(0, 184, 217, 0.2) 100%
  );
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.3),
    0 6px 20px rgba(0, 217, 255, 0.3);
}

.user-chip-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.user-chip:hover .user-chip-avatar {
  border-color: rgba(0, 217, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 217, 255, 0.3);
}

.user-chip.selected .user-chip-avatar {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.3), 0 2px 8px rgba(0, 217, 255, 0.4);
}

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

.user-chip-avatar .default-avatar {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.4) 0%,
    rgba(124, 58, 237, 0.3) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
}

.user-chip-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s ease;
  display: none;
}

.user-chip.selected .user-chip-name {
  color: var(--primary);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(0, 217, 255, 0.3);
  display: none;
}

.user-chip-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
  margin-left: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: none;
}

.user-chip-remove:hover {
  background: rgba(239, 68, 68, 0.4);
  border-color: #ef4444;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.user-chip-remove:active {
  transform: scale(1.05);
}

.user-chip-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3), 0 0 8px rgba(16, 185, 129, 0.5);
  animation: statusPulse 2s ease-in-out infinite;
  margin-left: 4px;
}

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

.user-chip.active {
  border-color: rgba(16, 185, 129, 0.4);
}

.user-chip.active .user-chip-status {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4),
    0 0 12px rgba(16, 185, 129, 0.6);
  animation: statusPulse 1.5s ease-in-out infinite;
  display: none;
}

.messages {
  background: rgba(12, 18, 34, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(
    100vh - 280px
  ); /* Responsive: viewport height minus header (~80px), chat header (~60px), composer (~80px), and padding/margins (~60px) */
  min-height: 250px;
  flex: 1 1 auto; /* Take available space in flex container */
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  /* Better mobile scrolling */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto; /* Allow scroll chaining to page when at boundaries */
  overscroll-behavior-x: contain; /* Prevent horizontal scroll chaining */
  /* Ensure proper scrolling on mobile */
  position: relative;
  will-change: scroll-position;
  /* Better spacing for messages */
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Responsive max-height adjustments for different screen sizes */
@media (max-width: 768px) {
  .messages {
    max-height: calc(
      90vh - 200px
    ); /* Mobile: account for smaller headers and composer */
  }
}

@media (max-width: 640px) {
  .messages {
    max-height: calc(90vh - 180px); /* Smaller mobile screens */
  }
}

@media (max-width: 480px) {
  .messages {
    max-height: calc(75vh - 160px); /* Very small mobile screens */
  }
}

@media (min-width: 1200px) {
  .messages {
    max-height: calc(
      90vh - 320px
    ); /* Large desktop screens with more padding */
  }

  .composer:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }

  .messenger-input-wrapper {
    display: flex !important;
    visibility: visible !important;
  }
}

/* Desktop styles - ensure composer is visible */
@media (min-width: 769px) {
  .panel {
    overflow: visible !important; /* Ensure panel doesn't clip composer on desktop */
  }

  /* Ensure profile panel can scroll vertically on desktop */
  .profile-panel {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .composer:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    margin-top: 16px !important;
  }

  .messenger-input-wrapper {
    display: flex !important;
    visibility: visible !important;
  }
}

/* Mobile styles - keep overflow hidden for proper styling */
@media (max-width: 768px) {
  .panel {
    overflow: hidden; /* Maintain rounded corners on mobile */
  }
  
  /* Ensure panel doesn't clip composer on mobile - allow vertical scroll */
  .panel:has(.composer:not(.hidden)),
  section.panel:has(.composer:not(.hidden)) {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: calc(80px + 20px) !important; /* Space for composer + bottom nav */
    max-height: 100vh !important; /* Ensure panel doesn't exceed viewport */
  }

  /* Position composer fixed above mobile-bottom-nav on mobile */
  .composer:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important; /* Above mobile-bottom-nav (~72px height) */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 999 !important; /* Above content, below panels (1001) and bottom nav (1000) */
    margin: 0 !important;
    padding: 12px 16px !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
    background: rgba(17, 24, 39, 0.95) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3) !important;
    flex-shrink: 0 !important;
  }
  
  /* Ensure composer is visible when chat is visible on mobile */
  .chat:not(.hidden) + .composer:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Ensure messenger-input-wrapper is visible on mobile */
  .composer:not(.hidden) .messenger-input-wrapper {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    min-height: 48px !important;
    background: rgba(31, 41, 55, 0.6) !important;
  }
  
  /* Ensure all child elements are visible */
  .composer:not(.hidden) .messenger-action-btn,
  .composer:not(.hidden) .messenger-input,
  .composer:not(.hidden) .messenger-send-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Adjust messages container to account for fixed composer and bottom nav */
  .chat:not(.hidden) .messages {
    padding-bottom: calc(100px + 72px + env(safe-area-inset-bottom, 0px)) !important; /* Space for composer (~100px) + bottom nav (~72px + safe area) */
    margin-bottom: 0 !important;
  }
  
  /* Adjust panel padding when composer is visible */
  section.panel:has(.chat:not(.hidden)) {
    padding-bottom: calc(100px + 72px + env(safe-area-inset-bottom, 0px)) !important; /* Space for composer + bottom nav */
  }
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.msg {
  display: inline-block;
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: 12px;
  max-width: 75%;
  line-height: 1.5;
  word-wrap: break-word;
  animation: messageSlideIn 0.3s ease-out;
  box-shadow: var(--shadow-sm);
}

/* Message profile button wrapper */
.msg-profile-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  justify-content: flex-end;
}

.msg-container.msg-them .msg-profile-wrapper {
  justify-content: flex-start;
}

/* Message profile button */
.msg-profile-btn {
  background: none !important;
  border: none !important;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  color: var(--muted);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.msg-profile-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.1) !important;
}

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

.msg.me .msg-profile-btn,
.msg-container.msg-me .msg-profile-btn {
  color: rgba(255, 255, 255, 0.8);
}

.msg.them .msg-profile-btn,
.msg-container.msg-them .msg-profile-btn {
  color: var(--muted);
}

/* Message profile button status dots */
.msg-online-dot,
.msg-connection-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--bg);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  z-index: 1;
}

.msg-online-dot.online,
.msg-connection-dot.connected {
  background: #10b981;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2s infinite;
}

.msg-connection-dot.connecting {
  background: var(--warning);
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
  animation: pulse-dot 1s infinite;
}

.msg-connection-dot.disconnected {
  background: var(--error);
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

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

.msg.me {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.2) 0%,
    rgba(0, 184, 217, 0.15) 100%
  );
  border: 1px solid rgba(0, 217, 255, 0.3);
  margin-left: auto;
  display: flex;
  /* flex-direction: column; */
  align-items: flex-end;
  text-align: right;
}

.msg.them {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-right: auto;
  display: block;
}

/* Message footer with timestamp and read receipt */
.msg-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  justify-content: flex-end;
}

.msg.me .msg-footer {
  justify-content: flex-end;
}

.msg.them .msg-footer {
  justify-content: flex-start;
}

.msg-timestamp {
  opacity: 0.7;
  font-size: 10px;
}

.read-receipt {
  color: var(--muted);
  font-size: 12px;
  opacity: 0.6;
}

.read-receipt.read {
  color: var(--primary);
  opacity: 1;
}

/* Online status indicator */
.online-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.online-status.hidden {
  display: none;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.online-status.online .online-dot {
  background: #10b981;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Unread badge */
.unread-badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.unread-badge.hidden {
  display: none;
}

/* Timer warning animation */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.composer {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  flex-shrink: 0; /* Don't shrink on mobile */
  margin-top: 16px; /* Fixed margin instead of auto */
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%; /* Full width */
  visibility: visible;
  opacity: 1;
  z-index: 10; /* Ensure it's above other elements */
}

.composer:not(.hidden) {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Messenger-style input wrapper */
.messenger-input-wrapper {
  display: flex !important;
  align-items: center;
  gap: 8px;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 6px 8px;
  transition: all 0.2s ease;
  width: 100%;
}

.messenger-input-wrapper:focus-within {
  border-color: var(--primary);
  background: rgba(31, 41, 55, 0.8);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.messenger-action-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.messenger-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  transform: scale(1.1);
}

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

.messenger-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  min-width: 0;
}

.messenger-input::placeholder {
  color: var(--muted);
}

.messenger-send-btn {
  background: var(--primary);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 217, 255, 0.3);
}

.messenger-send-btn:hover {
  background: var(--primary-600);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.4);
}

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

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

.send-icon {
  display: inline-block;
  transform: rotate(-90deg);
  font-weight: bold;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

/* Settings Panel - bottom sheet animation handled below */
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.settings-header h2 {
  margin: 0;
}
.settings-content {
  display: grid;
  gap: 20px;
}
.setting-group {
  display: grid;
  gap: 8px;
}
.setting-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}
.setting-value {
  color: var(--accent);
  font-weight: 600;
}
.slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--card);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--bg);
}
.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--bg);
}
.setting-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.toggle {
  width: 44px;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle:checked {
  background: var(--primary);
  border-color: var(--primary-600);
}
.toggle::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}
.toggle:checked::before {
  transform: translateX(20px);
}
.toggle-text {
  font-weight: 500;
}
.mood-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.mood-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.mood-checkbox:hover {
  background: #252b37;
  border-color: #4b5563;
}
.mood-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}
.mood-checkbox input[type="checkbox"]:checked + span {
  color: var(--primary);
  font-weight: 500;
}
.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.settings-status {
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
}
.settings-status.show {
  opacity: 1;
}

/* Bottom Sheet Panels - Only for profile, stats, settings, discover, and matches */
.profile-panel,
.stats-panel,
.settings-panel,
.discover-panel,
.matches-panel {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-height: 90vh !important;
  transform: translateY(100%) !important;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 1001 !important; /* Higher than bottom nav (1000) */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  margin: 0 !important;
}

.profile-panel:not(.hidden),
.stats-panel:not(.hidden),
.settings-panel:not(.hidden),
.discover-panel:not(.hidden),
.matches-panel:not(.hidden) {
  transform: translateY(0) !important;
  visibility: visible !important;
  opacity: 1 !important;
  display: block !important;
}

/* Prevent panel clicks from closing when clicking inside panel */
.profile-panel,
.stats-panel,
.settings-panel,
.discover-panel,
.matches-panel {
  pointer-events: auto;
}

.profile-panel *,
.stats-panel *,
.settings-panel *,
.discover-panel *,
.matches-panel * {
  pointer-events: auto;
}

.profile-panel.hidden,
.stats-panel.hidden,
.settings-panel.hidden,
.discover-panel.hidden,
.matches-panel.hidden {
  transform: translateY(100%) !important;
  pointer-events: none;
  visibility: hidden;
}

/* Backdrop overlay */
.panel-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999;
  pointer-events: none;
}

.panel-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Hide main content when panel is open */
body.panel-open .main-content {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.panel-open .header {
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
/* Drag handle indicator for bottom sheet - only for profile, stats, settings, discover, matches */
.profile-panel::after,
.stats-panel::after,
.settings-panel::after,
.discover-panel::after,
.matches-panel::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px 20px 0 20px;
  position: sticky;
  top: 0;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  z-index: 10;
}
.panel-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}
.panel-header .btn {
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 8px 12px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-header .btn:hover {
  background: rgba(31, 41, 55, 0.7);
  border-color: var(--primary);
}
.profile-content {
  display: grid;
  gap: 20px;
}
.profile-avatar-section {
  display: flex;
  justify-content: center;
}
.profile-avatar-large {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  background: rgba(31, 41, 55, 0.5);
  box-shadow: 0 0 30px rgba(0, 217, 255, 0.4);
  transition: all 0.3s ease;
}

.profile-avatar-large:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(0, 217, 255, 0.6);
}
.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  padding: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 10px;
  border: 2px solid var(--primary);
  box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
  transition: all 0.3s ease;
}

.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 217, 255, 0.5);
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Photo Gallery */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.photo-gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.photo-gallery-item:hover {
  transform: scale(1.05);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

.photo-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.photo-delete-btn:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

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

/* Matches Panel Styles */
.matches-content {
  padding: 0;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

.matches-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 16px 16px 16px;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 8px;
}

.match-item:hover {
  background: rgba(31, 41, 55, 0.7);
  border-color: rgba(0, 217, 255, 0.3);
  transform: translateX(4px);
}

.match-item.active {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.15) 0%,
    rgba(0, 184, 217, 0.1) 100%
  );
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.2);
  border-width: 2px;
}

.match-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.match-item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.match-item-avatar .default-avatar {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-dark);
  color: white;
  font-weight: 600;
  font-size: 20px;
}

.match-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.match-item-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.match-item-status {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--success);
  color: white;
  border-radius: 10px;
  font-weight: 500;
}

.match-item-expired {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-radius: 10px;
  font-weight: 500;
}

.match-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.match-item-mood {
  text-transform: capitalize;
}

.match-item-time {
  color: var(--primary);
  font-weight: 500;
}

.match-item-action {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.match-item-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary);
}

#openMatchesPanel {
  display: none;
  padding: 8px;
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#openMatchesPanel:hover {
  background: rgba(31, 41, 55, 0.7);
  border-color: var(--primary);
  color: var(--primary);
}

#openMatchesPanel svg {
  display: block;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state p {
  margin: 8px 0;
}

/* Photo Viewer Modal */
.photo-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer-modal.hidden {
  display: none;
}

.photo-viewer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.photo-viewer-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.photo-viewer-image-container {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.photo-viewer-image {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.photo-viewer-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
}

.photo-viewer-close:hover {
  background: rgba(239, 68, 68, 0.9);
  border-color: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

.photo-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  user-select: none;
}

.photo-viewer-nav:hover {
  background: rgba(0, 217, 255, 0.9);
  border-color: var(--primary);
  transform: translateY(-50%) scale(1.1);
}

.photo-viewer-prev {
  left: 20px;
}

.photo-viewer-next {
  right: 20px;
}

.photo-viewer-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10;
}

.form-group {
  display: grid;
  gap: 8px;
}
.form-group label {
  font-weight: 500;
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}
.status-message {
  color: var(--primary);
  font-size: 14px;
  margin-left: 12px;
  opacity: 0;
  transition: opacity 0.3s;
}
.status-message.show {
  opacity: 1;
}

/* Statistics Panel */
.stats-content {
  display: grid;
  gap: 20px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.stat-card {
  background: rgba(31, 41, 55, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent-light));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover {
  border-color: rgba(0, 217, 255, 0.4);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(0, 217, 255, 0.2);
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--accent-light) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
}
.stats-details {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stat-item-label {
  color: var(--muted);
}
.stat-item-value {
  font-weight: 600;
  color: var(--text);
}
.achievements-section {
  margin-top: 8px;
}
.achievements-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
}
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
}
.achievement-badge {
  background: rgba(31, 41, 55, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.achievement-badge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(0, 217, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.achievement-badge:hover::after {
  width: 100px;
  height: 100px;
}

.achievement-badge:hover {
  background: rgba(31, 41, 55, 0.8);
  border-color: var(--primary);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 217, 255, 0.3);
}

.achievement-badge.unlocked {
  border-color: var(--primary);
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.2) 0%,
    rgba(124, 58, 237, 0.2) 100%
  );
  box-shadow: 0 4px 16px rgba(0, 217, 255, 0.2);
}
.achievement-icon {
  font-size: 32px;
  margin-bottom: 4px;
}
.achievement-name {
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
}
.achievement-badge.locked {
  opacity: 0.5;
}
.achievement-badge.locked .achievement-icon {
  filter: grayscale(100%);
}

/* Enhanced Chat */
.chat-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 0;
}

.chat-action-btn {
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-action-btn:hover {
  background: rgba(0, 217, 255, 0.15);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 217, 255, 0.2);
}

.chat-action-btn:active {
  transform: translateY(0);
  opacity: 0.8;
}

.chat-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.message-reactions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.reaction {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.reaction:hover {
  background: #252b37;
  border-color: var(--primary);
}

.message-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}

.delete-message-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  color: var(--muted);
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
  border-radius: 4px;
}

.delete-message-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  background: rgba(239, 68, 68, 0.1);
}

.delete-message-btn:active {
  transform: scale(0.95);
}
/* Typing indicator bubble (Facebook Messenger style) */
.typing-indicator-bubble {
  display: flex !important;
  align-items: center;
  padding: 8px 12px;
  margin: 0;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  max-width: 75%;
  width: auto;
  animation: messageSlideIn 0.3s ease-out;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
  animation: typingDot 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typingDot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}
/* Photo Messages */
.message-photo-container {
  margin-top: 4px;
  margin-bottom: 4px;
}

.message-photo {
  max-width: 250px;
  max-height: 300px;
  width: auto;
  height: auto;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: block;
}

.message-photo:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 217, 255, 0.3);
}

.message-photo-caption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text);
  opacity: 0.9;
}

/* Photo Fullscreen View */
.photo-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease-out;
}

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

.photo-fullscreen-img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

/* Location Messages */
.message-location-container {
  margin-top: 4px;
  margin-bottom: 4px;
}

.message-location {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 217, 255, 0.1);
  border: 1px solid rgba(0, 217, 255, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 8px;
}

.message-location:hover {
  background: rgba(0, 217, 255, 0.15);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

.location-icon {
  font-size: 20px;
}

.location-text {
  flex: 1;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.location-link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
}

.message-location:hover .location-link {
  opacity: 1;
}

.location-map-preview {
  margin-top: 8px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.location-map-link {
  display: block;
  width: 100%;
  text-decoration: none;
}

.location-map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: rgba(0, 217, 255, 0.05);
  border: 2px dashed rgba(0, 217, 255, 0.3);
  border-radius: 8px;
  transition: all 0.3s ease;
  min-height: 120px;
}

.location-map-link:hover .location-map-placeholder {
  background: rgba(0, 217, 255, 0.1);
  border-color: var(--primary);
  transform: scale(1.02);
}

.map-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.map-text {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.message-location-caption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text);
  opacity: 0.9;
}

/* Match Feedback */
.match-feedback {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
}
.match-feedback.hidden {
  display: none;
}
.match-feedback h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
}
.rating-stars {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.star {
  font-size: 36px;
  cursor: pointer;
  opacity: 0.3;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: grayscale(100%);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0);
}

.star:hover {
  opacity: 0.8;
  filter: grayscale(30%);
  transform: scale(1.2) rotate(5deg);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.star.active {
  opacity: 1;
  filter: grayscale(0%);
  transform: scale(1.1);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

/* Emoji Picker */
.emoji-btn-wrapper {
  position: relative;
  display: inline-block;
}

.emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 217, 255, 0.2);
  z-index: 100;
  animation: slideDown 0.3s ease-out;
  width: 180px;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
.emoji-picker.hidden {
  display: none;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.emoji-option {
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  text-align: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-option:hover {
  background: rgba(0, 217, 255, 0.15);
  transform: scale(1.15);
}

.emoji-option:active {
  transform: scale(0.95);
  background: rgba(0, 217, 255, 0.25);
}

/* Smooth transitions for all interactive elements */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease,
    color 0.3s ease;
}

/* Loading animation */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Glow effect for active elements */
.glow {
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
}

/* Colorful gradient scrollbar for webkit browsers - matches the design */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    #00d9ff 0%,
    #00a8ff 20%,
    #3b82f6 40%,
    #7c3aed 60%,
    #a855f7 80%,
    #ec4899 100%
  );
  border-radius: 6px;
  border: 2px solid rgba(10, 14, 26, 0.5);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    #00b8d9 0%,
    #0090d9 20%,
    #2563eb 40%,
    #6d28d9 60%,
    #9333ea 80%,
    #db2777 100%
  );
  background-clip: padding-box;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Show mobile bottom nav on mobile - fixed at bottom of screen */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: rgba(17, 24, 39, 0.95) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 8px !important;
    gap: 8px !important;
    z-index: 1000 !important; /* Lower than panels (1001) */
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3) !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
  }

  /* Mobile: Panels should appear above bottom nav and account for its height */
  .profile-panel:not(.hidden),
  .stats-panel:not(.hidden),
  .settings-panel:not(.hidden),
  .discover-panel:not(.hidden),
  .matches-panel:not(.hidden) {
    z-index: 1001 !important; /* Above bottom nav */
    max-height: calc(
      100vh - 80px
    ) !important; /* Account for bottom nav height */
    padding-bottom: max(
      80px,
      calc(24px + env(safe-area-inset-bottom))
    ) !important; /* Space for bottom nav */
  }

  .mobile-bottom-nav .btn {
    flex: 1;
    min-width: 0;
    padding: 12px 8px;
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-radius: 12px;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
  }

  .mobile-bottom-nav .btn:active {
    background: rgba(31, 41, 55, 0.8);
    transform: scale(0.95);
  }

  .app {
    padding: 12px;
    gap: 12px;
    max-width: 100%;
    padding-bottom: 80px; /* Space for fixed bottom nav */
    margin-bottom: 0;
  }

  .header {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    border-radius: 16px;
  }

  .header .me {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    width: 100%;
  }

  .brand {
    font-size: 20px;
    text-align: center;
    width: 100%;
    /* margin-bottom: 2px; */
    /* padding-bottom: 6px; */
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
  }

  /* Hide avatar on mobile to save space */
  .header .me .user-avatar {
    display: none !important;
  }

  /* Group username and save button together on mobile - keep at top */
  .header .me .username-wrapper {
    flex: 1 1 100%;
    min-width: 0;
    margin-right: 0;
    margin-bottom: 6px;
  }

  .header .me #saveName {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    margin-right: 6px;
    padding: 10px 14px;
    font-size: 14px;
  }

  /* Move profile/stats/settings buttons to bottom on mobile - hide header buttons */
  .header .me #profileBtn,
  .header .me #statsBtn,
  .header .me #settingsBtn {
    display: none !important;
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .panel h2 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .mood-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mood-buttons {
    grid-column: 1;
    gap: 6px;
  }

  .mood-btn {
    min-width: 0;
    flex: 1 1 calc(50% - 3px);
    padding: 10px 12px;
    font-size: 13px;
  }

  .mood-row .btn.primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
  }

  .username-wrapper {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
  }

  .username {
    width: 100%;
    padding-right: 40px; /* Keep room for connection indicator */
  }

  .header .me .btn {
    flex: 1;
    min-width: 44px; /* Minimum touch target size */
    padding: 10px 12px;
    font-size: 16px;
  }

  .header .me #saveName {
    flex: 0 0 auto;
    min-width: 80px;
  }

  .mood-checkboxes {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 28px;
  }

  .achievements-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .chat {
    min-height: 0;
    max-height: none;
    height: auto;
  }

  .messages {
    min-height: 250px;
    height: auto;
    flex: 1 1 auto;
    padding: 12px;
    /* Use viewport height minus header, panel padding, chat header, composer, and margins */
    /* max-height: calc(100vh - 280px); */
  }

  .msg {
    max-width: 85%;
    padding: 8px 12px;
    font-size: 14px;
  }

  .chat-header {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    padding: 10px 12px;
    padding-bottom: 8px;
    flex-shrink: 0;
  }

  .typing-indicator {
    font-size: 12px;
    padding: 6px 10px;
    margin: 6px 0;
  }

  .composer {
    gap: 0;
    padding-top: 12px;
    margin-top: 12px;
  }

  .messenger-input-wrapper {
    gap: 6px;
    padding: 5px 6px;
    border-radius: 22px;
    display: flex !important;
  }

  .messenger-action-btn {
    font-size: 22px;
    min-width: 40px;
    min-height: 40px;
    padding: 6px;
  }

  .messenger-send-btn {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .messenger-input {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 8px 10px;
  }

  .composer-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .chat-actions {
    order: -1;
    justify-content: center;
    margin-bottom: 0;
    gap: 8px;
  }

  .chat-action-btn {
    padding: 12px 14px;
    font-size: 20px;
    min-width: 48px;
    min-height: 48px;
  }

  .composer-row .input {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
  }

  .composer-row .btn {
    padding: 14px 20px;
    font-size: 15px;
    min-height: 48px;
    min-width: 70px;
  }

  #chatTimer {
    font-size: 12px;
    padding: 3px 6px;
  }

  .composer-row .input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 14px;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
  }

  .composer-row .input:focus {
    border-color: var(--primary);
    background: rgba(31, 41, 55, 0.8);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
    outline: none;
  }

  .composer-row .btn {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    min-height: 48px;
    min-width: 80px;
    border-radius: 14px;
    white-space: nowrap;
  }

  .settings-content,
  .profile-content,
  .stats-content {
    gap: 16px;
  }

  .form-group textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
  }

  .form-group input[type="number"],
  .form-group input[type="text"] {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
  }

  .profile-avatar-large {
    width: 100px;
    height: 100px;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
  }

  .photo-gallery-item {
    border-radius: 8px;
  }

  /* Photo Viewer Mobile Styles */
  .photo-viewer-image-container {
    max-width: 95vw;
    max-height: 85vh;
  }

  .photo-viewer-image {
    max-height: 85vh;
  }

  .photo-viewer-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .photo-viewer-nav {
    width: 44px;
    height: 44px;
    font-size: 28px;
  }

  .photo-viewer-prev {
    left: 10px;
  }

  .photo-viewer-next {
    right: 10px;
  }

  .photo-viewer-counter {
    bottom: 10px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .panel-header,
  .settings-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-header .btn,
  .settings-header .btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  .footer {
    padding: 12px 16px;
    font-size: 12px;
    text-align: center;
  }

  .emoji-picker {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    padding: 10px;
  }

  .emoji-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .emoji-option {
    font-size: 22px;
    padding: 10px;
    min-height: 48px;
    min-width: 48px;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 8px;
    gap: 8px;
  }

  .header {
    padding: 8px 10px;
    gap: 8px;
  }

  .header .me {
    gap: 5px;
  }

  .brand {
    font-size: 18px;
    /* padding-bottom: 4px; */
  }

  /* Better mobile layout for username and buttons */
  .header .me .username-wrapper {
    flex: 1 1 100%;
    margin-right: 0;
    margin-bottom: 4px;
  }

  .header .me #saveName {
    flex: 1 1 calc(50% - 2.5px);
    min-width: 0;
    margin-right: 5px;
    padding: 10px 12px;
    font-size: 14px;
  }

  /* Action buttons hidden on mobile - moved to bottom nav */
  .header .me #profileBtn,
  .header .me #statsBtn,
  .header .me #settingsBtn {
    display: none !important;
  }

  .panel {
    padding: 12px;
    border-radius: 12px;
  }

  .panel h2 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 44px;
  }

  .chat {
    min-height: 0;
  }

  .messages {
    /* max-height: calc(100vh - 260px); */
    min-height: 180px;
    padding: 10px;
    flex: 1 1 auto;
  }

  .msg {
    max-width: 90%;
    padding: 6px 10px;
    font-size: 13px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-card {
    padding: 12px;
  }

  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chat-header {
    font-size: 12px;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .composer .input,
  .composer .btn {
    padding: 12px;
  }

  .mood-row .input {
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .mood-btn {
    flex: 1 1 100%;
    padding: 12px;
    font-size: 14px;
  }

  .message-photo {
    max-width: 200px;
    max-height: 250px;
  }

  .location-map-placeholder {
    padding: 30px 16px;
    min-height: 100px;
  }

  .map-icon {
    font-size: 28px;
  }

  .map-text {
    font-size: 12px;
  }

  .message-location {
    padding: 10px 12px;
    font-size: 13px;
  }

  .location-text {
    font-size: 13px;
  }

  .location-link {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 6px;
    gap: 6px;
  }

  .header {
    padding: 8px 10px;
    gap: 6px;
  }

  .header .me {
    gap: 4px;
  }

  .brand {
    font-size: 18px;
    /* padding-bottom: 4px; */
  }

  .header .me .username-wrapper {
    flex: 1 1 100%;
    margin-right: 0;
    margin-bottom: 4px;
  }

  .header .me #saveName {
    flex: 1 1 calc(50% - 2px);
    min-width: 0;
    margin-right: 4px;
    padding: 10px 12px;
    font-size: 14px;
  }

  /* Action buttons hidden on mobile - moved to bottom nav */
  .header .me #profileBtn,
  .header .me #statsBtn,
  .header .me #settingsBtn {
    display: none !important;
  }

  .panel {
    padding: 10px;
  }

  .messages {
    /* max-height: calc(100vh - 240px); */
    min-height: 150px;
    padding: 8px;
    flex: 1 1 auto;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .emoji-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Touch-friendly improvements for all mobile */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .chat-action-btn,
  .emoji-option,
  .star,
  .achievement-badge {
    min-height: 44px;
    min-width: 44px;
  }

  .btn:hover,
  .chat-action-btn:hover {
    transform: none; /* Disable hover transforms on touch devices */
  }

  .panel:hover {
    transform: none;
  }

  /* Better tap feedback */
  .btn:active,
  .chat-action-btn:active {
    opacity: 0.7;
    transform: scale(0.98);
  }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .messages {
    /* max-height: calc(100vh - 200px); */
    min-height: 120px;
  }

  .header {
    flex-direction: row;
    align-items: center;
  }

  .header .me {
    flex-wrap: nowrap;
    width: auto;
  }

  .brand {
    width: auto;
    margin-bottom: 0;
    text-align: left;
  }

  .chat {
    min-height: 0;
  }

  .composer {
    flex-shrink: 0;
  }

  .composer:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Better message container on very small screens */
@media (max-width: 360px) {
  .messages {
    /* max-height: calc(100vh - 220px); */
    min-height: 120px;
    padding: 8px;
  }

  .msg {
    max-width: 92%;
    padding: 6px 8px;
    font-size: 12px;
    margin: 4px 0;
  }
}

/* ============================================
   UNIQUE VISUAL EFFECTS & ANIMATIONS
   ============================================ */

/* Particle Effect Container */
.particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFloat 3s ease-out forwards;
}

@keyframes particleFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-100vh) scale(0);
  }
}

/* Match Celebration Animation */
.match-celebration {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10001;
  pointer-events: none;
  text-align: center;
}

.match-celebration-text {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, #00d9ff 0%, #7c3aed 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: celebrationPulse 0.6s ease-out;
  text-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
}

@keyframes celebrationPulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mood Button Hover Effects */
.mood-btn:hover,
.quick-mood-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 217, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mood-btn:active,
.quick-mood-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Selected Mood Glow */
.mood-btn.selected,
.quick-mood-btn.selected {
  background: linear-gradient(
    135deg,
    rgba(0, 217, 255, 0.2) 0%,
    rgba(124, 58, 237, 0.2) 100%
  );
  border: 2px solid var(--primary);
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.5),
    inset 0 0 20px rgba(0, 217, 255, 0.1);
  animation: moodGlow 2s ease-in-out infinite;
}

@keyframes moodGlow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.5),
      inset 0 0 20px rgba(0, 217, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 217, 255, 0.7),
      inset 0 0 30px rgba(0, 217, 255, 0.2);
  }
}

/* Ping Button Special Effect */
#sendPing:not(:disabled) {
  position: relative;
  overflow: hidden;
}

#sendPing:not(:disabled)::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

#sendPing:not(:disabled):active::before {
  width: 300px;
  height: 300px;
}

/* Brand Logo Animation */
.brand {
  position: relative;
  background: linear-gradient(135deg, #00d9ff 0%, #7c3aed 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: brandShimmer 3s ease-in-out infinite;
  font-weight: 800;
  letter-spacing: -0.5px;
}

@keyframes brandShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Message Bubble Entrance Animation */
.msg {
  animation: messageBubbleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Ripple Effect Animation */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Mood Pulse Animation */
@keyframes moodPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

@keyframes messageBubbleIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Match Found Animation */
.match-found-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle,
    rgba(0, 217, 255, 0.2) 0%,
    transparent 70%
  );
  z-index: 10000;
  pointer-events: none;
  animation: matchFoundPulse 1s ease-out;
}

@keyframes matchFoundPulse {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

/* Floating Action Button Effect */
.btn.primary:not(:disabled) {
  position: relative;
  overflow: hidden;
}

.btn.primary:not(:disabled)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
}

.btn.primary:not(:disabled):hover::after {
  width: 200px;
  height: 200px;
}

/* Loading Spinner Unique Design */
.btn-loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Panel Entrance Animation */
.panel {
  animation: panelSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Modal Unique Entrance */
.quick-ping-modal:not(.hidden),
.welcome-settings-modal:not(.hidden) {
  animation: modalPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPopIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

/* Status Indicator Pulse */
.status {
  position: relative;
}

.status::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: var(--primary);
  opacity: 0.1;
  transform: translate(-50%, -50%);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.2;
  }
}

/* Gradient Text Effect */
.gradient-text {
  background: linear-gradient(135deg, #00d9ff 0%, #7c3aed 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Hover Glow Effect */
.hover-glow {
  transition: all 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
  transform: translateY(-2px);
}

/* Success Flash Animation */
.success-flash {
  animation: successFlash 0.5s ease-out;
}

@keyframes successFlash {
  0% {
    background-color: transparent;
  }
  50% {
    background-color: rgba(16, 185, 129, 0.3);
  }
  100% {
    background-color: transparent;
  }
}

/* Quick Ping Modal */
.quick-ping-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.quick-ping-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Welcome Settings Modal */
.welcome-settings-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  z-index: 10000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.welcome-settings-modal.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.9);
  pointer-events: none;
}

.welcome-settings-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.welcome-settings-content {
  text-align: center;
}

#welcomeSettingsTitle {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.welcome-settings-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 32px 0;
}

.welcome-setting-group {
  margin-bottom: 32px;
  text-align: left;
}

.welcome-setting-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 16px;
}

.welcome-setting-group .setting-value {
  font-weight: 600;
  color: var(--primary);
  font-size: 18px;
}

.welcome-setting-group .slider {
  width: 100%;
  margin: 16px 0;
}

.welcome-setting-group .setting-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 8px 0 0 0;
}

.welcome-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

.welcome-actions .btn {
  min-width: 160px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
}

.quick-ping-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 2001;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.quick-ping-modal.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.9);
}

.quick-ping-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.quick-ping-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.quick-ping-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.quick-ping-content {
  text-align: center;
}

#quickPingTitle {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.quick-ping-subtitle {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 32px;
}

.quick-ping-moods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.quick-mood-btn {
  background: rgba(31, 41, 55, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.quick-mood-btn:hover {
  background: rgba(0, 217, 255, 0.1);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

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

.quick-mood-btn .mood-emoji {
  font-size: 32px;
  line-height: 1;
}

.quick-mood-btn .mood-text {
  font-size: 14px;
  font-weight: 500;
}

.quick-ping-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.quick-ping-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.quick-ping-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

body.modal-open {
  overflow: hidden;
}

/* Mobile adjustments for quick ping modal */
@media (max-width: 768px) {
  .quick-ping-modal {
    padding: 24px;
    width: 95%;
    max-height: 85vh;
  }

  #quickPingTitle {
    font-size: 24px;
  }

  .quick-ping-subtitle {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .quick-ping-moods {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 24px;
  }

  .quick-mood-btn {
    padding: 16px 12px;
  }

  .quick-mood-btn .mood-emoji {
    font-size: 28px;
  }

  .quick-mood-btn .mood-text {
    font-size: 12px;
  }
  #match-heading {
    display: none;
  }
}

/* Registration Modal */
.registration-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.registration-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.registration-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.registration-content {
  position: relative;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.registration-modal:not(.hidden) .registration-content {
  transform: scale(1);
}

.registration-progress {
  margin-bottom: 32px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 16.66%;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.step-indicator {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.step-indicator.active {
  background: var(--primary);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.4);
}

.step-indicator.completed {
  background: var(--success);
  color: white;
}

.registration-step {
  display: none;
}

.registration-step:not(.hidden) {
  display: block;
}

#registrationTitle {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text);
}

.registration-subtitle {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 24px 0;
}

.gender-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.gender-option {
  display: flex;
  align-items: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gender-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.gender-option input[type="radio"] {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.gender-option input[type="radio"]:checked + span {
  color: var(--primary);
  font-weight: 600;
}

.profile-images-upload {
  margin-top: 16px;
}

.image-upload-area {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.image-upload-area:hover {
  border-color: var(--primary);
  background: rgba(0, 217, 255, 0.05);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.upload-icon {
  font-size: 48px;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-item .remove-image {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(239, 68, 68, 0.9);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.image-preview-item .remove-image:hover {
  background: var(--error);
  transform: scale(1.1);
}

.interests-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.interest-tag {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  user-select: none;
}

.interest-tag:hover {
  background: rgba(255, 255, 255, 0.1);
}

.interest-tag.selected {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
  font-weight: 600;
}

.moods-selection {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.mood-select-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
  font-size: 14px;
}

.mood-select-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.mood-select-btn.selected {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.4);
}

.mood-select-btn .mood-emoji {
  font-size: 32px;
}

.status-message {
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}

.status-message.success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
}

.status-message.error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
  border: 1px solid var(--error);
}

@media (max-width: 640px) {
  .registration-content {
    padding: 24px;
    width: 95%;
    max-height: 85vh;
  }

  #registrationTitle {
    font-size: 24px;
  }

  .registration-subtitle {
    font-size: 14px;
  }

  .moods-selection {
    grid-template-columns: 1fr;
  }

  .image-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* Discover Panel Styles */
.discover-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.discover-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}

.discover-tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.discover-tab:hover {
  color: var(--text);
}

.discover-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.pings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ping-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.ping-card:hover {
  background: rgba(31, 41, 55, 0.7);
  border-color: rgba(0, 217, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

.ping-card.ping-mine {
  border-color: rgba(0, 217, 255, 0.5);
  background: rgba(0, 217, 255, 0.05);
}

.ping-user-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--primary);
}

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

.ping-info {
  flex-grow: 1;
  min-width: 0;
}

.ping-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}

.ping-username {
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
  margin: 0;
}

.ping-mood {
  background: var(--primary-dark);
  color: var(--text-light);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.ping-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.ping-distance,
.ping-time-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ping-time-left {
  color: var(--primary);
  font-weight: 500;
}

.ping-action-btn {
  padding: 8px 16px;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  color: var(--background);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 14px;
}

.ping-action-btn:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

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

@media (max-width: 768px) {
  .ping-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .ping-user-avatar {
    align-self: center;
  }

  .ping-action-btn {
    width: 100%;
    text-align: center;
  }
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.discover-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.discover-user-card:hover {
  background: rgba(31, 41, 55, 0.7);
  border-color: rgba(0, 217, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.2);
}

.discover-user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

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

.discover-user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

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

.discover-username {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.discover-user-age {
  color: var(--text-secondary);
  font-size: 14px;
}

.discover-section {
  padding: 20px;
  margin-bottom: 20px;
}

.discover-header {
  margin-bottom: 20px;
}

.discover-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.discover-user-bio {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.4;
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discover-user-interests {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.interest-tag {
  padding: 4px 10px;
  background: rgba(0, 217, 255, 0.1);
  border: 1px solid rgba(0, 217, 255, 0.3);
  border-radius: 12px;
  font-size: 12px;
  color: var(--primary);
}

.discover-user-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.discover-distance,
.discover-photos {
  display: flex;
  align-items: center;
  gap: 4px;
}

.discover-view-profile-btn {
  padding: 10px 20px;
  background: rgba(0, 217, 255, 0.1);
  border: 1px solid var(--primary);
  border-radius: 12px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.discover-view-profile-btn:hover {
  background: var(--primary);
  color: #0a0e1a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.discover-view-profile-btn:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .discover-user-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .discover-user-avatar {
    align-self: center;
  }

  .discover-view-profile-btn {
    width: 100%;
    text-align: center;
  }
}
