/* ============================================
   GAPE.top - Modern Anonymous Chat Platform
   Enhanced UX Version
   ============================================ */

/* CSS Variables */
:root {
  /* Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-tertiary: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --accent-gradient-vibrant: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f472b6 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --glow-color: rgba(99, 102, 241, 0.4);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: rgba(30, 41, 59, 0.8);
  --bg-tertiary: rgba(51, 65, 85, 0.6);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(99, 102, 241, 0.2);
  --glass-bg: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(99, 102, 241, 0.15);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 25px 50px -12px rgba(99, 102, 241, 0.25);
  --glow-color: rgba(139, 92, 246, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Dark mode animated gradient background */
[data-theme="dark"] body {
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(236, 72, 153, 0.05) 0%, transparent 70%),
    var(--bg-primary);
}

/* Floating Particles */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
  opacity: 0.3;
  animation: float 15s infinite ease-in-out;
}

@keyframes float {
  0%, 100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 25px 30px;
  margin-bottom: 25px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  width: 60px;
  height: 60px;
  background: var(--accent-gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 4px 15px var(--glow-color);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 15px var(--glow-color);
  }
  50% {
    box-shadow: 0 4px 25px var(--glow-color), 0 0 40px var(--glow-color);
  }
}

.logo-emoji {
  animation: spin 10s linear infinite;
}

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

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5em;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.logo-dot {
  opacity: 0.7;
}

.tagline {
  font-size: 0.95em;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Theme Toggle */
.theme-toggle {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.theme-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  transition: all 0.3s ease;
}

.theme-icon.sun {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0);
}

.theme-icon.moon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-icon.sun {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-icon.moon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0);
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.stat:hover {
  transform: translateY(-2px);
  background: var(--accent-gradient);
}

.stat:hover .stat-value,
.stat:hover .stat-label {
  color: white;
}

.stat-icon {
  font-size: 1.3em;
}

.stat-value {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
}

.stat-label {
  font-size: 0.75em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cards */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 25px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.4s var(--transition-smooth);
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-primary);
}

/* Section Header */
.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.3em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-top: 5px;
}

.section-icon {
  font-size: 1.2em;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
  border: none;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1em;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px var(--glow-color);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px var(--glow-color);
}

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

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

.btn-glow {
  animation: btn-glow 2s infinite;
}

.btn-glow:disabled {
  animation: none;
}

@keyframes btn-glow {
  0%, 100% {
    box-shadow: 0 4px 15px var(--glow-color);
  }
  50% {
    box-shadow: 0 4px 30px var(--glow-color);
  }
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 16px;
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-icon {
  font-size: 1.1em;
}

/* Inputs */
.input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1em;
  font-family: inherit;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transition: all 0.3s var(--transition-smooth);
}

.input:hover {
  border-color: var(--border-color);
}

.input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--glow-color);
  background: var(--bg-secondary);
  transform: translateY(-1px);
}

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

/* Post Form */
.post-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.input-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar-picker {
  position: relative;
}

.avatar-button {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.avatar-button:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.avatar-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--card-shadow-hover);
  z-index: 100;
  display: none;
}

.avatar-dropdown.show {
  display: block;
  animation: slideDown 0.2s ease;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.avatar-option {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-option:hover {
  background: var(--accent-primary);
  transform: scale(1.1);
}

.username-input {
  flex: 1;
}

/* Textarea */
.textarea-wrapper {
  position: relative;
}

.message-input {
  resize: none;
  min-height: 120px;
  padding-right: 50px;
}

.textarea-tools {
  position: absolute;
  right: 12px;
  bottom: 12px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background: var(--accent-primary);
  transform: scale(1.1);
}

.emoji-picker {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--card-shadow-hover);
  z-index: 100;
  display: none;
}

.emoji-picker.show {
  display: block;
  animation: slideUp 0.2s ease;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-option {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.emoji-option img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.emoji-option:hover {
  background: var(--bg-tertiary);
  transform: scale(1.2);
}

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

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

/* Form Footer */
.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.char-count {
  font-size: 0.9em;
  color: var(--text-muted);
  font-weight: 500;
}

.char-count.warning {
  color: var(--warning);
}

.char-count.danger {
  color: var(--danger);
}

.hint {
  font-size: 0.8em;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 15px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
}

.filter-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9em;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.filter-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--accent-gradient);
  color: white;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-input {
  padding-left: 45px;
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1em;
}

/* Chat Feed */
.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 200px;
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 15px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 4em;
  margin-bottom: 15px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.3em;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

/* Loading Skeleton */
.loading-skeleton {
  background: var(--bg-tertiary);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95em;
  animation: pulse 2s ease-in-out infinite;
}

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

/* Message Card */
.message {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.3s var(--transition-smooth);
  animation: fadeInUp 0.4s ease;
  position: relative;
  overflow: hidden;
}

.message::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 ease;
}

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

.message:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px) translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

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

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.message-author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-avatar {
  width: 45px;
  height: 45px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.message-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-author {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1em;
}

.message-time {
  font-size: 0.8em;
  color: var(--text-muted);
}

.message-actions {
  display: flex;
  gap: 5px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.action-btn:hover {
  background: var(--bg-tertiary);
}

.action-btn.report:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.message-content {
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 1em;
  word-wrap: break-word;
  white-space: pre-wrap;
  margin-bottom: 12px;
}

.inline-emoji {
  display: inline-block;
  height: 1.2em;
  width: auto;
  margin: 0 2px;
  vertical-align: middle;
}

.message-image {
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
  background: var(--bg-tertiary);
}

.message-image img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  max-height: 300px;
  object-fit: cover;
}

.message-footer {
  display: flex;
  gap: 12px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.reaction-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  border-radius: 20px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}

.reaction-btn:hover {
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
  transform: scale(1.05);
}

.reaction-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  transform: scale(1.1);
}

.reaction-btn.active span:first-child {
  animation: heart-pop 0.6s var(--transition-bounce);
}

@keyframes heart-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.reaction-count {
  font-weight: 600;
}

/* Load More */
.load-more {
  text-align: center;
  padding: 20px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal.show {
  display: flex;
}

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

.modal-content {
  background: var(--bg-secondary);
  border-radius: 20px;
  width: 100%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--card-shadow-hover);
  animation: modalSlide 0.4s var(--transition-bounce);
}

.modal-intro {
  max-width: 500px;
  border: 2px solid var(--accent-primary);
}

.intro-content {
  padding: 40px 30px;
  text-align: center;
}

.intro-icon {
  font-size: 4em;
  margin-bottom: 20px;
  display: block;
  animation: bounce-in 0.6s var(--transition-bounce);
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.intro-content h2 {
  font-size: 2em;
  margin-bottom: 10px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.intro-content p {
  color: var(--text-secondary);
  margin-bottom: 25px;
  font-size: 1.05em;
}

.intro-features {
  list-style: none;
  margin-bottom: 30px;
  text-align: left;
}

.intro-features li {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInLeft 0.4s ease backwards;
}

.intro-features li:nth-child(1) { animation-delay: 0.1s; }
.intro-features li:nth-child(2) { animation-delay: 0.2s; }
.intro-features li:nth-child(3) { animation-delay: 0.3s; }
.intro-features li:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.modal-large {
  max-width: 600px;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.2em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--danger);
  color: white;
}

.modal-body {
  padding: 25px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 25px;
  border-top: 1px solid var(--border-color);
}

/* Report Options */
.report-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 15px 0;
}

.report-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.report-option:hover {
  background: var(--border-color);
}

.report-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

#reportDetails {
  margin-top: 15px;
}

/* Terms Modal */
.terms-body {
  max-height: 60vh;
  overflow-y: auto;
}

.terms-body h4 {
  font-size: 1.2em;
  margin-bottom: 10px;
  color: var(--accent-primary);
}

.terms-body h5 {
  font-size: 1em;
  margin: 20px 0 10px;
  color: var(--text-primary);
}

.terms-body p {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.terms-body ul {
  margin-left: 20px;
  color: var(--text-secondary);
}

.terms-body li {
  margin-bottom: 5px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: var(--card-shadow-hover);
  border-left: 4px solid var(--accent-primary);
  animation: slideInRight 0.3s ease;
  max-width: 350px;
}

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

.toast.error {
  border-left-color: var(--danger);
}

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

.toast.info {
  border-left-color: var(--info);
}

.toast-icon {
  font-size: 1.3em;
}

.toast-message {
  flex: 1;
  font-size: 0.95em;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
}

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

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

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

/* Confetti Canvas */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3000;
}

/* Footer */
.footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 30px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9em;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent-primary);
}

.footer-links .divider {
  color: var(--text-muted);
}

.footer-disclaimer {
  font-size: 0.8em;
  color: var(--text-muted);
  font-style: italic;
}

.copyright {
  font-size: 0.85em;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .header {
    padding: 20px;
    border-radius: 16px;
  }

  .header-top {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .logo-section {
    flex-direction: column;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

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

  .logo {
    font-size: 2em;
  }

  .filter-bar {
    flex-direction: column;
    gap: 12px;
  }

  .search-box {
    max-width: 100%;
  }

  .form-footer {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .form-info {
    justify-content: space-between;
  }

  .btn-primary {
    width: 100%;
  }

  .btn-lg {
    width: 100%;
  }

  .message-header {
    flex-direction: column;
    gap: 10px;
  }

  .message-actions {
    align-self: flex-end;
  }

  .emoji-grid {
    grid-template-columns: repeat(5, 1fr);
    max-height: 180px;
  }

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

  .hint {
    display: none;
  }

  .toast-container {
    left: 15px;
    right: 15px;
    top: 15px;
  }

  .toast {
    max-width: 100%;
  }

  .modal-content {
    width: 90%;
    max-width: none;
    border-radius: 16px;
  }

  .message-input {
    min-height: 100px;
  }

  /* Better touch targets on mobile */
  .btn {
    min-height: 44px;
  }

  .input {
    min-height: 44px;
  }

  .reaction-btn {
    min-height: 40px;
    padding: 8px 12px;
  }

  .action-btn {
    min-height: 36px;
    min-width: 36px;
  }

  .avatar-button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Improve scrolling performance */
  body {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

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

  .stat {
    padding: 6px;
  }

  .stat-value {
    font-size: 1em;
  }

  .stat-label {
    font-size: 0.65em;
  }

  .input-group {
    flex-direction: column;
  }

  .avatar-button {
    align-self: flex-start;
  }

  .filter-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .filter-tab {
    padding: 8px 12px;
    font-size: 0.85em;
  }

  .filter-tab span:last-child {
    display: none;
  }

  .logo {
    font-size: 1.5em;
  }

  .message {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }

  /* Larger touch targets */
  .btn {
    min-height: 48px;
    padding: 12px 16px;
  }

  .input {
    min-height: 48px;
    padding: 12px 14px;
  }

  .modal-content {
    max-height: 95vh;
  }
}

@media (hover: hover) {
  /* Only apply hover effects on devices that support it */
  .btn:hover {
    transform: translateY(-2px);
  }

  .stat:hover {
    transform: translateY(-2px);
  }

  .message:hover {
    transform: translateX(4px) translateY(-2px);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Selection */
::selection {
  background: var(--accent-primary);
  color: white;
}

/* ============================================
   Magic 8 Ball
   ============================================ */

.magic-8-ball-section {
  padding: 40px 20px;
  margin-bottom: 30px;
  text-align: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.magic-8-ball-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5em;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.magic-8-ball-subtitle {
  color: var(--text-secondary);
  font-size: 0.95em;
  margin-bottom: 30px;
}

.magic-8-ball-container {
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

.magic-8-ball {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle at 30% 30%, #4a4a4a 0%, #1a1a1a 50%, #000000 100%);
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 -10px 30px rgba(0, 0, 0, 0.8),
    inset 0 10px 30px rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
}

.magic-8-ball:hover {
  transform: scale(1.05) rotateX(-5deg);
  box-shadow: 
    0 30px 80px rgba(99, 102, 241, 0.3),
    inset 0 -10px 30px rgba(0, 0, 0, 0.8),
    inset 0 10px 30px rgba(255, 255, 255, 0.1);
}

.magic-8-ball:active {
  transform: scale(0.95);
}

.ball-shine {
  position: absolute;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  top: 15px;
  left: 25px;
  pointer-events: none;
}

.ball-window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at center, #1a237e 0%, #0d1339 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(99, 102, 241, 0.3);
  overflow: hidden;
}

.ball-answer {
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2em;
  font-weight: 700;
  text-align: center;
  padding: 8px;
  line-height: 1.1;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.ball-answer.small-text {
  font-size: 0.7em;
  line-height: 1.2;
}

/* Shake Animation */
@keyframes shake8Ball {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  10% { transform: rotate(-15deg) translateX(-10px); }
  20% { transform: rotate(15deg) translateX(10px); }
  30% { transform: rotate(-15deg) translateX(-10px); }
  40% { transform: rotate(15deg) translateX(10px); }
  50% { transform: rotate(-10deg) translateX(-5px); }
  60% { transform: rotate(10deg) translateX(5px); }
  70% { transform: rotate(-5deg) translateX(-3px); }
  80% { transform: rotate(5deg) translateX(3px); }
  90% { transform: rotate(-2deg) translateX(-1px); }
}

.magic-8-ball.shaking {
  animation: shake8Ball 1s ease-in-out;
  pointer-events: none;
}

/* Answer fade in */
@keyframes fadeInAnswer {
  0% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}

.ball-answer.revealing {
  animation: fadeInAnswer 1.2s ease-out forwards;
}

/* Glow effect on reveal */
@keyframes glowPulse {
  0%, 100% { box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 10px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 30px rgba(139, 92, 246, 0.8); }
}

.ball-window.glowing {
  animation: glowPulse 0.5s ease-in-out 3;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .magic-8-ball {
    width: 140px;
    height: 140px;
  }
  
  .ball-window {
    width: 60px;
    height: 60px;
  }
  
  .ball-answer {
    font-size: 1.5em;
  }
  
  .ball-answer.small-text {
    font-size: 0.6em;
  }
  
  .ball-shine {
    width: 45px;
    height: 45px;
    top: 10px;
    left: 20px;
  }
}

/* Enhanced Responsive & Performance Improvements */

/* Fix filter/search layout overlapping */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-section {
  z-index: 10;
}

.filter-bar {
  margin-top: 10px;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
}

/* Smooth message rendering - reduce flicker */
.messages-feed {
  will-change: contents;
  contain: layout;
}

.message {
  contain: layout style paint;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  .container {
    padding: 12px;
    max-width: 100%;
  }

  .header {
    padding: 16px;
    gap: 12px;
  }

  .logo {
    font-size: 1.8em;
  }

  .tagline {
    font-size: 0.85em;
  }

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

  .stat {
    padding: 12px;
    text-align: center;
  }

  .stat-value {
    font-size: 1.2em;
  }

  .stat-label {
    font-size: 0.75em;
  }

  .filter-bar {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
  }

  .filter-tabs {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-tab {
    padding: 8px 12px;
    font-size: 0.85em;
    white-space: nowrap;
  }

  .search-box {
    max-width: 100%;
    width: 100%;
  }

  .search-input {
    padding: 10px 12px;
    font-size: 1em;
  }

  .section-header {
    margin-bottom: 15px;
  }

  .section-header h2 {
    font-size: 1.3em;
  }

  .section-subtitle {
    font-size: 0.85em;
  }

  .post-form {
    gap: 12px;
  }

  .input-group {
    gap: 10px;
  }

  .username-input {
    font-size: 1em;
    padding: 12px;
  }

  .message-input {
    font-size: 1em;
    padding: 12px;
    min-height: 120px;
    border-radius: 12px;
  }

  .form-footer {
    flex-direction: column;
    gap: 10px;
  }

  .form-footer > * {
    width: 100%;
  }

  .char-count {
    font-size: 0.85em;
    align-self: flex-start;
  }

  .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 1em;
  }

  .message {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
  }

  .message-header {
    gap: 8px;
  }

  .message-avatar {
    font-size: 2em;
  }

  .message-author {
    font-size: 0.9em;
  }

  .message-time {
    font-size: 0.8em;
  }

  .message-content {
    font-size: 0.95em;
    line-height: 1.5;
  }

  .reaction-btn {
    padding: 6px 10px;
    gap: 4px;
  }

  .reaction-count {
    font-size: 0.9em;
  }

  /* Magic 8 Ball mobile */
  #magic8Ball {
    width: 120px;
    height: 120px;
  }

  .ball-window {
    width: 50px;
    height: 50px;
  }

  .ball-answer {
    font-size: 1.2em;
  }

  .ball-answer.small-text {
    font-size: 0.55em;
  }

  .ball-shine {
    width: 35px;
    height: 35px;
    top: 8px;
    left: 15px;
  }

  /* Modal adjustments */
  .modal-content {
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 12px;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h3 {
    font-size: 1.2em;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
    gap: 8px;
  }

  .btn {
    font-size: 0.95em;
    padding: 12px;
  }

  /* Toast adjustments */
  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: auto;
  }

  .toast {
    font-size: 0.9em;
  }

  /* Emoji/Avatar picker */
  .emoji-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: 150px;
  }

  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .emoji-option,
  .avatar-option {
    font-size: 1.3em;
  }

  /* Input touch targets */
  .input {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .btn {
    min-height: 44px;
  }

  .reaction-btn {
    min-height: 40px;
  }

  .avatar-button {
    min-height: 44px;
    min-width: 44px;
    font-size: 1.2em;
  }

  /* Scrolling performance */
  body {
    -webkit-overflow-scrolling: touch;
  }

  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Notification Badge Animation */
@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

@keyframes pulse-badge {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.6);
  }
}

.new-message-badge {
  animation: slideDown 0.3s ease, pulse-badge 2s ease infinite !important;
}

/* Unread message indicator */
.message.unread {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
  border-left: 3px solid var(--accent-primary);
  animation: highlightMessage 0.5s ease;
}

@keyframes highlightMessage {
  from {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-left-width: 6px;
  }
  to {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-left-width: 3px;
  }
}

/* Notification dot for active status */
.notification-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  margin-right: 6px;
}

/* Tablet/Medium screens */
@media (min-width: 641px) and (max-width: 1024px) {
  .container {
    max-width: 95%;
  }

  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }

  .filter-bar {
    flex-wrap: nowrap;
    gap: 15px;
  }

  .filter-tabs {
    flex: 1;
    min-width: 200px;
  }

  .search-box {
    flex: 1;
    max-width: 300px;
  }

  .message {
    padding: 18px;
  }
}

/* Large screens (Desktop) */
@media (min-width: 1025px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
  }

  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .filter-bar {
    justify-content: space-between;
    align-items: center;
    gap: 20px;
  }

  .search-box {
    max-width: 400px;
  }

  .message {
    padding: 20px;
    transition: all 0.2s ease;
  }

  .message:hover {
    transform: translateY(-2px);
  }
}

/* Touch device enhancements */
@media (hover: none) and (pointer: coarse) {
  /* Reduce hover animations on touch devices */
  .message:hover {
    transform: none;
  }

  .filter-tab:hover {
    background: var(--bg-tertiary);
  }

  /* Larger buttons on touch */
  .btn {
    min-height: 48px;
  }

  .reaction-btn {
    min-height: 44px;
  }
}

/* High DPI devices */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}
