/* =========================================
   AUROARA DESIGN SYSTEM
   ========================================= */

:root {
  /* Typography */
  --font-primary: 'Helvetica Neue', 'Inter', sans-serif;

  /* Light Mode Palette (Default) */
  --bg-color: #FFFFFF;
  --text-color: #0F172A;
  --text-secondary: #475569;
  --container-bg-color: #FFFFFF;
  --input-bg-color: #F8FAFC;
  --border-color: #E2E8F0;
  --accent-color: #C5A059;
  /* Muted Gold */
  --accent-hover: #B08D45;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --nav-bg: rgba(255, 255, 255, 0.9);

  /* Status Colors */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
}

/* Dark Mode - Midnight Charcoal */
body.dark-mode {
  --bg-color: #020617;
  /* Darker Midnight */
  --text-color: #F8FAFC;
  --text-secondary: #94A3B8;
  --container-bg-color: #0F172A;
  /* Deep Slate */
  --input-bg-color: #1E293B;
  --border-color: #334155;
  --accent-color: #FCD34D;
  /* Bright Gold */
  --accent-hover: #FBBF24;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(2, 6, 23, 0.9);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s ease;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

html {
  height: 100%;
}

/* =========================================
   LAYOUT & NAVIGATION
   ========================================= */

#app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 80px;
  /* Space for fixed nav */
}

/* Navigation Bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background-color: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  transition: all 0.3s ease;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: none;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-color);
}

/* Theme Toggle in Nav */
#theme-toggle {
  cursor: pointer;
  font-size: 1.2rem;
  padding: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle:hover {
  background-color: var(--container-bg-color);
  transform: rotate(15deg);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 40px 20px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0 10px;
  transition: color 0.2s;
}

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

/* =========================================
   HERO & LANDING
   ========================================= */

#landing-container {
  text-align: center;
  padding: 60px 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

#main-title {
  font-size: clamp(3rem, 8vw, 5rem);
  margin-bottom: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-color);
  opacity: 0;
  animation: slide-up-fade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s forwards;
}

#sub-header {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  max-width: 700px;
  margin: 0 auto 4rem auto;
  font-weight: 400;
  color: var(--text-secondary);
  opacity: 0;
  animation: slide-up-fade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s forwards;
}

/* Pathways Grid Removed */

/* =========================================
   COMPONENTS
   ========================================= */

/* Buttons */
.btn-primary {
  background-color: var(--accent-color);
  color: #000;
  /* Contrast for gold */
  border: none;
  padding: 14px 28px;
  border-radius: 50px;
  /* Pill shape */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(197, 160, 89, 0.4);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 12px 26px;
  border-radius: 50px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  font-size: 1rem;
}

.btn-secondary:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background-color: rgba(197, 160, 89, 0.05);
}

/* Floating Action Button (Feedback) */
#feedback-floating-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--text-color);
  color: var(--bg-color);
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#feedback-floating-btn:hover {
  transform: scale(1.1) rotate(10deg);
}

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

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

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

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

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-color);
}

/* Auth Containers */
#login-container,
#signup-container,
#forgot-password-container,
#reset-password-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--container-bg-color);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

/* Rainbow Orb Animation */
.rainbow-orb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
  background-size: 400%;
  animation: rainbow-pulse 2s linear infinite;
  filter: blur(2px);
}

@keyframes rainbow-pulse {
  0% {
    background-position: 0% 50%;
    transform: scale(0.8);
    opacity: 0.8;
  }

  50% {
    background-position: 100% 50%;
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    background-position: 0% 50%;
    transform: scale(0.8);
    opacity: 0.8;
  }
}

#login-container input,
#signup-container input,
#forgot-password-container input,
#reset-password-container input {
  width: 100%;
  padding: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg-color);
  color: var(--text-color);
  font-size: 1rem;
}

#login-container input:focus,
#signup-container input:focus,
#forgot-password-container input:focus,
#reset-password-container input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.2);
}

.auth-btn-group {
  margin-top: 1rem;
}

.auth-btn-group button {
  width: 100%;
}

/* Forms */
input,
textarea {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background-color: var(--input-bg-color);
  color: var(--text-color);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.1);
}

/* Page Containers */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  animation: fade-in 0.6s ease-out;
}

.content-section {
  margin-bottom: 4rem;
}

.body-text {
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

.section-heading {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.page-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

/* Cards (Generic) */
.card {
  background-color: var(--container-bg-color);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.card-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.card-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-link:hover {
  gap: 10px;
  /* Slide arrow effect */
}

/* =========================================
   ADMIN PANEL & COMMUNITY STYLES
   ========================================= */

.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 8px;
}

.admin-badge.bug {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.admin-badge.feature {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.admin-badge.general {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.radical-analysis-box {
  margin-top: 1rem;
  padding: 1.5rem;
  background: var(--container-bg-color);
  border: 1px solid var(--accent-color);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  animation: fade-in 0.5s ease-out;
}

.radical-analysis-box::before {
  content: "✨";
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 5rem;
  opacity: 0.05;
  transform: rotate(20deg);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 9999;
  /* High z-index to sit on top of everything */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  animation: fade-in 0.3s forwards;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  animation: fade-in 0.3s forwards;
}

.modal-content {
  background-color: var(--container-bg-color);
  padding: 40px;
  border-radius: 24px;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transform: scale(0.95);
  opacity: 0;
  animation: scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.close-modal {
  position: absolute;
  top: 24px;
  right: 28px;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
  background: transparent;
  border: none;
}

.close-modal:hover {
  color: var(--accent-color);
}

/* Animations */
@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Utilities */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

#login-container,
#home-container {
  max-width: 480px;
  margin: 40px auto;
  padding: 40px;
  background-color: var(--container-bg-color);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

/* =========================================
   CHAT INTERFACE
   ========================================= */

.chat-interface {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-color);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 650px;
  border: 1px solid var(--border-color);
}

.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--container-bg-color);
  z-index: 10;
}

.chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--input-bg-color);
  scroll-behavior: smooth;
}

/* Message Rows */
.chat-message-row {
  display: flex;
  width: 100%;
  animation: fade-in-up 0.3s ease-out forwards;
  opacity: 0;
  transform: translateY(10px);
}

.chat-message-row.user {
  justify-content: flex-end;
}

.chat-message-row.ai {
  justify-content: flex-start;
}

/* Chat Bubbles */
.chat-bubble {
  max-width: 85%;
  padding: 14px 20px;
  border-radius: 18px;
  position: relative;
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
}

/* User Bubble */
.chat-bubble.user {
  background: linear-gradient(135deg, var(--text-color), #334155);
  color: white;
  border-bottom-right-radius: 4px;
}

/* AI Bubble */
.chat-bubble.ai {
  background: var(--container-bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

/* Content Spacing Fixes */
.chat-bubble p {
  margin: 0 0 0.5rem 0;
}

.chat-bubble p:last-child {
  margin: 0;
}

.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3 {
  margin: 0.75rem 0 0.5rem 0;
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1.3;
}

.chat-bubble h1:first-child,
.chat-bubble h2:first-child,
.chat-bubble h3:first-child {
  margin-top: 0;
}

.chat-bubble ul,
.chat-bubble ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.chat-bubble li {
  margin-bottom: 0.25rem;
}

.chat-bubble strong {
  font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--container-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  opacity: 0.6;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing-bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

@keyframes fade-in-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Input Area */
.chat-input-area {
  padding: 1rem;
  background: var(--container-bg-color);
  border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-input-field {
  width: 100%;
  padding: 14px;
  padding-right: 50px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  background: var(--input-bg-color);
  color: var(--text-color);
  resize: none;
  min-height: 52px;
  max-height: 150px;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.chat-input-field:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.1);
  background: var(--container-bg-color);
}

.chat-send-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: var(--text-color);
  color: var(--bg-color);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  background: var(--accent-color);
}

/* =========================================
   FOUNDER'S NOTE MODAL
   ========================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  /* Indicate it's clickable */
}

.founder-modal {
  background: rgba(var(--container-bg-rgb), 0.95);
  background-color: var(--container-bg-color);
  border: 1px solid var(--accent-color);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  border-radius: 16px;
  position: relative;
  z-index: 1001;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal-overlay.active .founder-modal {
  transform: scale(1);
  opacity: 1;
}

.close-modal-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
  /* Ensure it's above backdrop content */
  z-index: 1002;
}

.close-modal-btn:hover {
  color: var(--accent-color);
}

/* Ensure text readability in modal */
.founder-content {
  line-height: 1.6;
  font-size: 1rem;
}

.founder-content h2 {
  font-size: 1.5rem;
  margin-top: 0;
}

.founder-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Dark mode adjustment */
body.dark-mode .founder-modal {
  background-color: rgba(15, 23, 42, 0.95);
}

/* --- Full Page Chat --- */
.chat-layout {
  display: flex;
  height: calc(100vh - 140px);
  /* Adjust based on header/footer */
  gap: 20px;
}

.chat-sidebar {
  width: 250px;
  background: var(--input-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.chat-history-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 1rem;
}

.chat-history-item {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 5px;
}

.chat-history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.chat-history-item.active {
  background: rgba(197, 160, 89, 0.1);
  border: 1px solid rgba(197, 160, 89, 0.3);
}

.chat-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chat-main {
  flex: 1;
  background: var(--input-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

/* Override input area for full chat */
.chat-main .chat-input-area {
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

/* =========================================
   MOBILE NAVIGATION
   ========================================= */

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.mobile-menu-btn span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--text-color);
  margin: 5px 0;
  transition: all 0.3s ease;
  border-radius: 3px;
}

/* Hamburger Animation */
.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 70px;
    /* Below navbar */
    left: 0;
    width: 100%;
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transform: translateY(-150%);
    transition: transform 0.3s ease-in-out;
    z-index: 999;
    box-shadow: var(--shadow-md);
  }

  .nav-links.active {
    transform: translateY(0);
  }

  /* Adjust chat layout for mobile */
  .chat-layout {
    flex-direction: column;
    height: auto;
  }

  .chat-sidebar {
    width: 100%;
    height: 200px;
    /* Collapsed height */
  }

  .chat-main {
    height: 500px;
  }
}

/* =========================================
   GROUND ME PROTOCOL
   ========================================= */

#ground-me-trigger {
  position: fixed;
  bottom: 20px;
  left: 20px;
  /* Moved to bottom-left */
  /* Left of theme toggle/mobile menu */
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  z-index: 1000;
  opacity: 0.7;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#ground-me-trigger:hover .sos-orb {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
}

.sos-orb {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(139, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sos-text {
  color: #8B0000;
  /* Dark Red */
  font-weight: 900;
  font-size: 1rem;
  z-index: 2;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
  font-family: var(--font-primary);
}

.sos-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}

.sos-ring.ring-1 {
  width: 100%;
  height: 100%;
  border-top-color: rgba(173, 216, 230, 0.8);
  /* Soft Blue */
  border-bottom-color: rgba(255, 255, 255, 0.6);
  animation: spin 3s linear infinite;
}

.sos-ring.ring-2 {
  width: 70%;
  height: 70%;
  border-left-color: rgba(255, 255, 255, 0.8);
  border-right-color: rgba(173, 216, 230, 0.6);
  animation: spin 5s linear infinite reverse;
}

@keyframes spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

#ground-me-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  will-change: opacity, visibility;
  /* Fix for potential rendering glitches */
  transform: translateZ(0);
}

#ground-me-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Breathing Orb Animation */
.breathing-orb {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
  margin-bottom: 2rem;
  transition: transform 4s ease-in-out, opacity 4s ease-in-out;
}

.breathing-orb.inhale {
  transform: scale(2.5);
  opacity: 0.8;
}

.breathing-orb.hold-inhale {
  transform: scale(2.5);
  opacity: 0.8;
}

.breathing-orb.exhale {
  transform: scale(1);
  opacity: 0.3;
}

.breathing-orb.hold-exhale {
  transform: scale(1);
  opacity: 0.3;
}

/* Particle System */
.lights-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  perspective: 500px;
  transform-style: preserve-3d;
}

.particle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  /* Smaller as requested */
  height: 1px;
  border-radius: 50%;
  background: #fff;
  /* Removed border for 1px size, just opacity */
  opacity: var(--opacity);
  box-shadow: 0 0 1px rgba(255, 255, 255, 0.8);

  /* Default Orbit Animation */
  animation: particle-orbit var(--duration) linear infinite;
  animation-delay: var(--delay);
  transform-style: preserve-3d;
  will-change: transform;
  transition: background-color 1s ease, box-shadow 1s ease, border-color 1s ease;
}

/* Inhale: Blue Tint (Default) */
.breathing-orb.inhale .particle {
  background-color: #00f3ff;
  border-color: rgba(0, 243, 255, 0.6);
  box-shadow: 0 0 3px #00f3ff;
}

/* Helios Mode Inhale: Gold/Purple */
#ground-me-overlay.helios-mode .breathing-orb.inhale .particle {
  background-color: #FFD700;
  /* Gold */
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 3px #FFD700;
}

/* Exhale: Orange Tint (Default) */
.breathing-orb.exhale .particle {
  background-color: #ffaa00;
  border-color: rgba(255, 170, 0, 0.6);
  box-shadow: 0 0 3px #ffaa00;
}

/* Helios Mode Exhale: Purple */
#ground-me-overlay.helios-mode .breathing-orb.exhale .particle {
  background-color: #9D00FF;
  /* Purple */
  border-color: rgba(157, 0, 255, 0.6);
  box-shadow: 0 0 3px #9D00FF;
}

/* Hold State: Grey, Continue Orbit */
.breathing-orb.hold-inhale .particle,
.breathing-orb.hold-exhale .particle {
  background-color: #a0a0a0;
  border-color: rgba(160, 160, 160, 0.6);
  box-shadow: 0 0 2px #a0a0a0;
  /* Animation continues (particle-orbit) */
}

/* Helios Mode Hold: White/Silver */
#ground-me-overlay.helios-mode .breathing-orb.hold-inhale .particle,
#ground-me-overlay.helios-mode .breathing-orb.hold-exhale .particle {
  background-color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 2px #ffffff;
}

@keyframes particle-orbit {
  from {
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) rotateZ(0deg) translateX(var(--radius));
  }

  to {
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) rotateZ(360deg) translateX(var(--radius));
  }
}

@keyframes particle-hold-orbit {
  from {
    transform: translate(calc(-50% + var(--hold-x)), calc(-50% + var(--hold-y))) rotate(0deg) translateX(var(--hold-r)) rotate(0deg);
  }

  to {
    transform: translate(calc(-50% + var(--hold-x)), calc(-50% + var(--hold-y))) rotate(360deg) translateX(var(--hold-r)) rotate(-360deg);
  }
}

/* Audio Toggle Switch */
.audio-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.audio-switch input {
  display: none;
}

.audio-slider {
  width: 40px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  position: relative;
  transition: background-color 0.3s;
}

.audio-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

.audio-switch input:checked+.audio-slider {
  background-color: var(--accent-color);
}

.audio-switch input:checked+.audio-slider::before {
  transform: translateX(20px);
}

/* Helios Orb Positioning */
.helios-orb-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  /* Default size for container to hold background */
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

/* Light Mode Visibility Enhancements */
body:not(.dark-mode) .sos-orb,
body:not(.dark-mode) .helios-orb-container {
  background-color: rgba(15, 23, 42, 0.6) !important;
  /* Dark Slate */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Adjust SOS text color in light mode if needed (but background fixes it) */
body:not(.dark-mode) .sos-text {
  color: #ff4d4d;
  /* Lighter red for contrast against dark bg */
}

@media (max-width: 768px) {
  .helios-orb-container {
    bottom: 20px;
    right: 20px;
    /* Ensure it doesn't block content */
  }
}

.breathing-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
  box-shadow: 0 0 30px var(--accent-color);
  margin-bottom: 2rem;
  transform: scale(1);
}

#ground-me-overlay.active .breathing-circle {
  animation: breathe 8s infinite ease-in-out;
}

.breathing-text {
  font-size: 1.5rem;
  color: var(--text-color);
  margin-bottom: 3rem;
  font-weight: 300;
  letter-spacing: 2px;
  opacity: 0.9;
  min-height: 3rem;
  /* Reserve space to prevent layout shift */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#ground-me-exit {
  background: transparent;
  border: 1px solid var(--text-color);
  color: var(--text-color);
  padding: 10px 30px;
  border-radius: 30px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

#ground-me-overlay.active #ground-me-exit {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 2s;
  /* Fade in after user settles */
}

#ground-me-exit:hover {
  background: var(--text-color);
  color: var(--bg-color);
}

@keyframes breathe {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(3);
    opacity: 0.8;
  }
}

/* =========================================
   CONSTELLATION MAP
   ========================================= */

.star-node {
  transition: all 0.3s ease;
}

.star-node:hover circle {
  stroke: #fff;
  stroke-width: 2px;
}

.star-node.locked circle {
  fill: #333;
}

.star-node.completed circle {
  fill: #FFD700;
  filter: drop-shadow(0 0 5px #FFD700);
}

.star-node.active circle {
  fill: var(--accent-color);
  animation: pulse-star 2s infinite;
}

@keyframes pulse-star {
  0% {
    r: 8;
    filter: drop-shadow(0 0 0px var(--accent-color));
  }

  50% {
    r: 10;
    filter: drop-shadow(0 0 10px var(--accent-color));
  }

  100% {
    r: 8;
    filter: drop-shadow(0 0 0px var(--accent-color));
  }
}