@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand Identity - Modern SaaS Palette */
  --color-primary: #14B8A6; /* Sampled from brand logo */
  --color-primary-light: #2DD4BF; /* 15% lighter for hover */
  
  /* Default Dark Theme (Base) */
  --color-bg-base: #000000;
  --color-surface: #0A141E;
  --color-surface-rgb: 10, 20, 30;
  --color-text-main: #FFFFFF;
  --color-text-muted: #CBD5E1;
  --color-border: rgba(255, 255, 255, 0.1);
  --color-shadow: rgba(0, 0, 0, 0.5);

  --bg-color: #000000;
  --bg-rgb: 0, 0, 0;
  --bg-gradient: radial-gradient(circle at 50% 0%, #001a33 0%, #000000 100%);
  --text-primary: #ffffff;
  --text-primary-rgb: 255, 255, 255;
  --text-secondary: #cbd5e1;
  --accent-color: #14B8A6; /* Match brand color */
  --accent-rgb: 20, 184, 166;
  --accent-secondary: #0D9488;
  --accent-glow: rgba(20, 184, 166, 0.4);
  --surface-color: rgba(10, 20, 30, 0.8);
  --border-color: rgba(255, 255, 255, 0.15);
  --glass-bg: rgba(0, 0, 0, 0.6);
  --glass-border: rgba(255, 255, 255, 0.2);
  --success-color: #10b981;
  --danger-color: #f43f5e;

  /* Sizing & Layout */
  --container-max: 1180px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 64px;
  --header-offset: calc(var(--header-height) + 24px);
}

[data-theme="light"] {
  --color-bg-base: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-surface-rgb: 255, 255, 255;
  --color-text-main: #0F172A;
  --color-text-muted: #64748B;
  --color-border: rgba(0, 0, 0, 0.03);
  --color-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);

  --bg-color: #f0f7ff;
  --bg-rgb: 240, 247, 255;
  --bg-gradient: radial-gradient(circle at 50% 0%, #d9ebff 0%, #f0f7ff 100%);
  --text-primary: #0f172a;
  --text-primary-rgb: 15, 23, 42;
  --text-secondary: #475569;
  --accent-color: #14B8A6;
  --accent-rgb: 20, 184, 166;
  --accent-secondary: #0D9488;
  --accent-glow: rgba(20, 184, 166, 0.2);
  --surface-color: rgba(255, 255, 255, 0.9);
  --border-color: rgba(20, 184, 166, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(20, 184, 166, 0.2);
}

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

html {
  font-size: 15px;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

html, body {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevent horizontal scroll only */
  overflow-y: auto;   /* Allow vertical scroll explicitly */
  position: relative;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--color-bg-base);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  background-size: cover;
  color: var(--color-text-main);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
  padding-top: var(--header-offset);
}

body[data-page="login"],
body[data-page="signup"] {
  padding-top: calc(var(--header-height) + 12px);
}

main {
  position: relative;
  z-index: 1;
}

section[id] {
  scroll-margin-top: calc(var(--header-height) + 28px);
}

/* Streamlit header overrides for injected builds */
[data-testid="stHeader"] {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
}

[data-testid="stAppViewContainer"] {
  padding-top: 0 !important;
}

.stApp .block-container,
[data-testid="stAppViewContainer"] .block-container {
  padding-top: var(--header-offset) !important;
  margin-top: 0 !important;
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  margin-left: 8px;
}

.theme-toggle:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-2px);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

[data-theme="light"] .theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }
[data-theme="light"] .theme-toggle .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }

/* Scroll Animation Helper */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

#canvas-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0.2;
}

[data-theme="light"] #canvas-bg {
  opacity: 0.05;
}

.wrap {
  max-width: 1100px; /* Reduced from 1400px */
  margin: 0 auto;
  padding: 0 32px; /* Reduced from 40px */
  width: 100%;
}

.wrap-full {
  max-width: 1200px; /* Reduced from 1800px for a more centered, compact dashboard */
  margin: 0 auto;
  padding: 0 32px; /* Reduced from 40px */
  width: 100%;
}

@media (max-width: 768px) {
  .wrap-full {
    padding: 0 24px;
  }
}

/* Typography Refinements - Compact Scaling */
h1 {
  font-size: 1.5rem; /* Reduced to 24px */
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-text-main);
}

h2 {
  font-size: 1.125rem; /* Reduced to 18px */
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-text-main);
}

h3, h4, h5, h6 {
  font-size: 1rem; /* Reduced to 16px */
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-text-main);
}

.headline {
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.05em;
  margin-bottom: 16px;
  color: var(--color-text-main);
  display: block;
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding-bottom: 0.1em;
}

.accent {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  position: relative;
  display: inline-block;
  padding-bottom: 0.15em;
}

.accent::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0.15em;
  background: var(--color-primary);
  opacity: 0.3;
  border-radius: 100px;
}

/* System Status Pill */
.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  padding: 6px 12px;
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-color);
  margin-bottom: 24px;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-color);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-color);
}

.status-dot.pulse {
  animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(0, 128, 255, 0.7); }
  70% { transform: scale(1.1); opacity: 0.8; box-shadow: 0 0 0 10px rgba(0, 128, 255, 0); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(0, 128, 255, 0); }
}

@keyframes vibrate { 
  0%, 100% { transform: translateX(0); } 
  20% { transform: translateX(-4px); } 
  40% { transform: translateX(4px); } 
  60% { transform: translateX(-4px); } 
  80% { transform: translateX(4px); } 
} 

.vibrate-error { 
  animation: vibrate 0.3s ease-in-out; 
} 

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-8px); }
}

.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Navigation - Clean and Stable */
.nav {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background: var(--color-surface); /* Solid background to prevent overlap transparency */
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  min-height: var(--header-height);
}

.nav-scrolled {
  background: var(--color-surface);
  box-shadow: 0 4px 20px var(--color-shadow);
}

.nav-inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: height 0.3s ease;
}

.nav-scrolled .nav-inner {
  height: var(--header-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  z-index: 1001;
  transition: transform 0.3s ease;
}

.brand-logo {
  max-height: 40px;
  width: auto;
  object-fit: contain;
}

@media (max-width: 768px) {
  .brand-logo {
    max-height: 32px;
  }
}

.brand-name {
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-left: 32px;
}

.nav-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
  letter-spacing: -0.01em;
}

.nav-link svg {
  width: 18px;
  height: 18px;
}

/* Custom Signup Button Style */
.btn-signup-brand {
  background-color: var(--color-primary) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-signup-brand:hover {
  background-color: var(--color-primary-light) !important;
  transform: translateY(-1px);
}

/* Header Login Visibility for Dark Theme */
[data-theme='dark'] .nav-actions #navLoginBtn {
  color: #FFFFFF !important;
  border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
  opacity: 1 !important;
  padding: 8px 20px;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: var(--transition);
  transform: translateX(-50%);
  border-radius: 2px;
}

.nav-link:hover::after {
  width: 100%;
}

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

.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
  justify-content: flex-end;
  min-height: 46px;
}

.nav-mobile-auth {
  display: none;
}

/* Hamburger Menu */
.menu-toggle {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
  z-index: 1001;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: var(--transition);
}

.menu-toggle:hover {
  background: var(--color-bg-base);
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-main);
  transition: var(--transition);
  transform-origin: center;
  border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Attractive Buttons */
.btn-icon {
  margin-right: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 99px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  gap: 8px;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.forensic-status-glow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #00F2FF;
  text-shadow: 0 0 8px rgba(0, 242, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-weight: 600;
}

.pulsing-dot {
  width: 6px;
  height: 6px;
  background-color: #00F2FF;
  border-radius: 50%;
  box-shadow: 0 0 10px #00F2FF;
  animation: forensic-pulse 1.5s infinite;
}

@keyframes forensic-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--accent-secondary) 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(20, 184, 166, 0.39);
  border: none;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  box-shadow: 0 6px 20px 0 rgba(20, 184, 166, 0.5);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-nav-primary {
  background: white;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-nav-primary:hover {
  background: rgba(20, 184, 166, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-nav-primary:active {
  transform: scale(0.98);
}

.btn-google-signup {
  background: #FFFFFF;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  gap: 8px;
  transition: all 0.2s ease;
  width: 100%;
  cursor: pointer;
}

.btn-google-signup:hover {
  background-color: rgba(20, 184, 166, 0.04);
}

.btn-google-signup svg {
  fill: var(--color-primary);
  width: 18px;
  height: 18px;
}

/* Correct Header Login Button Visibility */
[data-theme='dark'] .auth-btn#navLoginBtn {
  color: #FFFFFF !important;
  opacity: 1;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 16px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

[data-theme='dark'] .auth-btn#navLoginBtn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #FFFFFF;
}

.btn-auth-brand {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--accent-secondary) 100%);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 14px 0 rgba(20, 184, 166, 0.39);
  gap: 12px;
  transition: all 0.2s ease;
  width: 100%;
  cursor: pointer;
  margin-top: 12px;
}

.btn-auth-brand:hover {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(20, 184, 166, 0.5);
}

.btn-auth-brand:active {
  transform: scale(0.98);
}

.btn-auth-brand svg {
  stroke: #FFFFFF;
  width: 18px;
  height: 18px;
}

.btn-outline {
  background: transparent;
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.btn-outline:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 52px;
  background: white;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-top: 12px;
}

.btn-google:hover {
  background: #f8f9fa;
  border-color: #d2d4d7;
  box-shadow: 0 1px 3px rgba(60,64,67, 0.3), 0 4px 8px 3px rgba(60,64,67, 0.15);
  transform: translateY(-1px);
}

.btn-google svg {
  width: 20px;
  height: 20px;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.auth-divider:not(:empty)::before {
  margin-right: 1.5em;
}

.auth-divider:not(:empty)::after {
  margin-left: 1.5em;
}

/* Sections - More compact spacing */
.section {
  padding: 80px 0;
}

.section-title {
  font-size: clamp(2.2rem, 4vw, 3rem);
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: -0.04em;
  line-height: 1.2;
  overflow: visible;
}

.section-sub {
  color: var(--color-text-muted);
  text-align: center;
  max-width: 600px;
  margin: 0 auto 60px;
  font-size: 1.1rem;
  line-height: 1.5;
}

/* Hero - Balanced Grid */
.hero {
  padding: 28px 0 88px;
  min-height: calc(100vh - var(--header-offset));
  display: flex;
  align-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero-content {
  text-align: left;
}

.lead {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 520px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 20px;
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
  padding: 20px 0;
}

/* Interactive Slider */
.slider-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  border: 1px solid var(--border-color);
  touch-action: pan-y;
  cursor: col-resize;
  background: #000;
}

.slider-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.slider-bg {
  z-index: 1;
}

.slider-clip {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
}

.slider-clip .slider-img {
  width: 100%; /* Ensure it matches the container's width */
}

/* Better approach using clip-path on the image itself */
.slider-clip {
  width: 100%;
  clip-path: inset(0 50% 0 0); /* top right bottom left */
}

.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #fff;
  z-index: 3;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  pointer-events: none; /* Let the container handle mouse events */
}

.slider-handle-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  color: #111;
  pointer-events: none;
}

.slider-handle-btn svg {
  transform: translateX(-3px); /* Optical alignment */
}

/* Feature Cards - Interactive Glow */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.feature-card {
  background: rgba(var(--text-primary-rgb), 0.02);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.feature-card:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--text-primary-rgb), 0.04);
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.1), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

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

.feature-icon {
  width: 56px;
  height: 56px;
  color: var(--accent-color);
  background: rgba(0, 128, 255, 0.1);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  transition: var(--transition);
}

.feature-card h3 {
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 1rem;
}

body[data-page="landing"] .wrap {
  max-width: 1180px;
}

body[data-page="landing"] .headline {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
}

body[data-page="landing"] .lead {
  font-size: 1.22rem;
  max-width: 580px;
  line-height: 1.6;
}

body[data-page="landing"] .section-title {
  font-size: clamp(2.35rem, 4vw, 3.25rem);
}

body[data-page="landing"] .section-sub {
  font-size: 1.15rem;
}

body[data-page="landing"] .feature-card {
  padding: 44px;
}

body[data-page="landing"] .feature-card h3 {
  font-size: 1.5rem;
}

body[data-page="landing"] .feature-card p {
  font-size: 1.05rem;
}

body[data-page="landing"] .dropzone {
  padding: 68px 44px;
}

/* Glass Card & Dropzone */
.dropzone {
  width: 100%;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.dropzone input[type="file"], 
#file {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.dropzone:hover, .dropzone.drag-active {
  border-color: var(--accent-color);
  background: rgba(0, 128, 255, 0.05);
  border-style: solid;
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  color: var(--accent-color);
}

.dropzone-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.dropzone-hint {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* FAQ Refinements */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}

.faq-toggle {
  width: 100%;
  padding: 20px 32px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  text-align: left;
}

.faq-toggle svg {
  transition: transform 0.3s ease;
  color: var(--accent-color);
}

.faq-item.active .faq-toggle svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.faq-answer-inner {
  padding: 0 32px 24px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.tech-detail {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  opacity: 0.9;
}

.tech-badge {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-color);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', monospace;
}

/* Dashboard Sandbox Refinements */
.dashboard-container {
  padding: 0;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  background: transparent;
  position: relative;
  overflow: visible; /* Ensure vertical scrolling is not restricted */
}

/* Dashboard Layout Refinements */
.dashboard-shell {
  --dashboard-sidebar-width: 240px;
  display: grid;
  grid-template-columns: minmax(0, var(--dashboard-sidebar-width)) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: calc(100vh - var(--header-height));
  width: 100%;
  max-width: 100%;
  background: transparent;
  transition: grid-template-columns 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-history-toolbar {
  position: fixed;
  top: 50%;
  left: 18px;
  right: auto;
  transform: translateY(-50%);
  z-index: 10020;
  pointer-events: none;
}

.dashboard-history-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--color-surface-rgb, 10, 20, 30), 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  transition: transform 0.25s ease, background-color 0.25s ease, opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: auto;
  position: relative;
  z-index: 10020;
}

.dashboard-history-toggle:hover {
  background: rgba(var(--accent-rgb), 0.16);
  border-color: rgba(var(--accent-rgb), 0.42);
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.dashboard-history-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.dashboard-history-toggle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-primary);
  animation: history-arrow-pulse-right 1.8s ease-in-out infinite;
}

/* Hide toggle button when history is OPEN */
.dashboard-shell:not(.history-collapsed) .dashboard-history-toolbar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes history-arrow-pulse-right {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

.dashboard-sidebar {
  background: rgba(var(--color-surface-rgb, 255, 255, 255), 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--color-border);
  padding: 16px 12px; /* Reduced from 24px 20px */
  height: calc(100vh - var(--header-height));
  width: var(--dashboard-sidebar-width);
  max-width: var(--dashboard-sidebar-width);
  display: flex; flex-direction: column;
  position: sticky;
  top: var(--header-height);
  z-index: 10;
  transform-origin: left center;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1), padding 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease, box-shadow 0.3s ease;
  min-width: 0;
  box-shadow: 4px 0 20px var(--color-shadow);
  overflow: hidden;
}

.dashboard-shell.history-collapsed {
  --dashboard-sidebar-width: 0px;
}

.dashboard-shell.history-collapsed .dashboard-sidebar {
  width: 0;
  max-width: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  transform: translateX(-24px) scaleX(0.96);
  pointer-events: none;
  box-shadow: none;
}

.dashboard-shell.history-collapsed .dashboard-main {
  width: 100%;
  max-width: 100%;
  transform: translateX(0);
}

.dashboard-main {
  padding: 24px 32px; /* Reduced from 32px 48px */
  overflow-y: auto;
  height: calc(100vh - var(--header-height));
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  min-width: 0;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1), padding 0.45s cubic-bezier(0.4, 0, 0.2, 1), transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.analysis-grid,
.analysis-data-row,
.comparison-grid,
.explanation-card,
.result-summary,
.metadata-card,
.glass-card {
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, width 0.45s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1), gap 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-shell.history-collapsed .analysis-grid,
.dashboard-shell.history-collapsed .analysis-data-row,
.dashboard-shell.history-collapsed .comparison-grid,
.dashboard-shell.history-collapsed .explanation-card,
.dashboard-shell.history-collapsed .result-summary,
.dashboard-shell.history-collapsed .metadata-card {
  transform: translateX(0) scale(1);
}

.dashboard-shell:not(.history-collapsed) .dashboard-main {
  transform: translateX(0);
}

.dashboard-shell:not(.history-collapsed) .analysis-grid,
.dashboard-shell:not(.history-collapsed) .analysis-data-row,
.dashboard-shell:not(.history-collapsed) .comparison-grid,
.dashboard-shell:not(.history-collapsed) .explanation-card,
.dashboard-shell:not(.history-collapsed) .result-summary,
.dashboard-shell:not(.history-collapsed) .metadata-card {
  transform: translateX(0);
}

.dashboard-main::-webkit-scrollbar {
  width: 6px;
}

.dashboard-main::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 10px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px; /* Reduced from 24px */
  padding: 0 4px;
}

.sidebar-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  opacity: 0.8;
}

.history-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--color-primary);
  background: rgba(var(--accent-rgb), 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

.history-list-container {
  flex: 1 1 auto;
  min-height: 0; /* Crucial for scrolling to work in flex containers */
  overflow-y: auto;
  margin-top: 4px;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Add explicit scrollbar styling to ensure it shows up */
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

.history-list-container::-webkit-scrollbar {
  width: 6px;
}

.history-list-container::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 10px;
}

.dashboard-history-item {
  padding: 8px 12px; /* Reduced from 16px 20px */
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); /* Reduced from radius-md */
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.dashboard-history-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--color-primary);
  transform: scaleY(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-history-item:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
  transform: translateX(6px);
}

.dashboard-history-item.active {
  background: var(--color-surface);
  border-color: var(--color-primary);
}

.dashboard-history-item.active::before {
  transform: scaleY(1);
}

.dashboard-history-file {
  font-weight: 700;
  font-size: 0.9rem; /* Reduced from 1rem */
  margin-bottom: 4px; /* Reduced from 10px */
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dashboard-history-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-wrap: wrap;
  opacity: 0.8;
}

/* Analysis Layout Alignment */
.analysis-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
  margin-bottom: 12px;
  overflow: hidden;
  min-width: 0;
}

.image-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.image-box:hover {
  border-color: var(--color-primary);
  transform: translateY(-4px);
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  border-radius: var(--radius-lg);
}

.image-label {
  position: absolute;
  top: 30px;
  left: 30px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, 0.2);
  line-height: 1;
  white-space: normal;
  max-width: calc(100% - 60px);
  pointer-events: none;
}

/* Analysis Data Row */
.analysis-data-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 40px;
  align-items: stretch;
  min-width: 0;
}

.glass-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px; /* Reduced from 16px */
  padding: 16px; /* Reduced from 24px */
  box-shadow: var(--color-shadow);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.card-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  display: block;
  opacity: 0.7;
}

/* Scan Overlay & Animation Refined */
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(5px);
  overflow: hidden;
}

.scan-overlay.active {
  opacity: 1;
}

.scan-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: #fff;
  box-shadow: 0 0 15px var(--accent-color), 0 0 30px var(--accent-color), 0 0 45px var(--accent-color);
  animation: scan-move 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  z-index: 15;
}

.scan-line::before {
  content: '';
  position: absolute;
  top: -40px;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(to bottom, transparent 0%, rgba(var(--accent-rgb), 0.3) 100%);
  pointer-events: none;
}

.scan-line::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 0;
  width: 100%;
  height: 80px;
  background: linear-gradient(to top, rgba(var(--accent-rgb), 0.5) 0%, transparent 100%);
  pointer-events: none;
}

@keyframes scan-move {
  0% { top: -20%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 120%; opacity: 0; }
}

/* Add a subtle scanning grid background during animation */
.scan-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(var(--accent-rgb), 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.15) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 1;
}

.scan-overlay.active::before {
  opacity: 1;
  animation: grid-pulse 3s ease-in-out infinite alternate;
}

@keyframes grid-pulse {
  0% { opacity: 0.3; transform: scale(1); }
  100% { opacity: 0.7; transform: scale(1.05); }
}

/* Inference Result Card */
.result-summary {
  padding: 48px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.status-badge {
  display: inline-flex;
  padding: 8px 18px;
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(var(--text-primary-rgb), 0.05);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  width: fit-content;
}

.result-headline {
  font-size: 3rem !important;
  margin: 0 0 32px !important;
  line-height: 1;
  font-weight: 900;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.progress-track {
  height: 12px !important;
  background: rgba(var(--text-primary-rgb), 0.05) !important;
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Metadata Cards */
.metadata-card {
  display: flex;
  flex-direction: column;
}

.meta-grid {
  display: grid;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(var(--text-primary-rgb), 0.03);
  border-radius: 14px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  min-width: 0;
}

.meta-item:hover {
  background: rgba(var(--text-primary-rgb), 0.05);
  border-color: rgba(var(--accent-rgb), 0.2);
}

.meta-key {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 0;
}

.meta-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.core-tech-module {
  font-family: 'JetBrains Mono', monospace;
  color: #22D3EE;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(10, 20, 30, 0.8);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 8px;
  animation: monitor-flicker 4s infinite ease-in-out;
}

.core-tech-module h3 {
  color: #22D3EE !important;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.core-tech-module p {
  color: #22D3EE !important;
  opacity: 0.8;
  font-size: 0.8rem;
  margin: 0;
}

@keyframes monitor-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Auth Pages Styles */
.auth-container {
  min-height: calc(100vh - var(--header-offset));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 32px;
}

.auth-card {
  width: 90%;
  max-width: 360px;
  padding: 24px !important;
}

.auth-title {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.auth-sub {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.auth-message {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: center;
  display: block;
  width: 100%;
}

.form-group {
  margin-bottom: 12px;
}

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  height: 38px;
  background: rgba(var(--text-primary-rgb), 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: var(--text-primary);
  font-family: inherit;
  transition: var(--transition);
  font-size: 1rem; /* 1rem = 14px now */
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(var(--text-primary-rgb), 0.06);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form .btn {
  height: 52px;
  width: 100%;
  font-size: 0.95rem;
  margin-top: 8px;
}

.auth-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-link {
  color: var(--accent-color);
  font-weight: 700;
  text-decoration: none;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 220px; /* Reduced from likely 300px+ */
  padding: 32px;
  border: 2px dashed var(--color-border);
  background: rgba(var(--color-surface-rgb), 0.02);
}

.empty-state-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-top: 24px;
}

.empty-state-text {
  font-size: 0.85rem;
  opacity: 0.8;
}

.empty-state div:has(label.btn-primary) {
  display: flex;
  align-items: center;
  gap: 32px;
}

.empty-state .btn-primary {
  margin-left: 0;
}

.empty-icon {
  margin-bottom: 16px;
  color: var(--color-primary);
  opacity: 0.8;
}

.empty-icon svg {
  width: 48px; /* Reduced from 64px */
  height: 48px;
}

/* Profile Circle / Avatar Placeholder */
.user-profile {
  width: 28px; /* Reduced to 28x28px */
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  border: 2px solid var(--color-border);
  transition: var(--transition);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.user-profile:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px var(--color-primary);
}

.account-menu {
  position: relative;
  display: none;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.account-menu.visible {
  display: flex;
}

.account-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  min-width: 228px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background: linear-gradient(180deg, rgba(var(--color-surface-rgb), 0.96) 0%, rgba(var(--color-surface-rgb), 0.84) 100%);
  color: var(--color-text-main);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.account-menu-trigger:hover,
.account-menu-trigger.open {
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.account-menu-trigger .user-profile {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
  flex-shrink: 0;
}

.account-menu-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 0;
  flex: 1;
}

.account-menu-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-email {
  font-size: 0.72rem;
  color: var(--text-secondary);
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-caret {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.account-menu-trigger.open .account-menu-caret {
  transform: rotate(180deg);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 220px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.20);
  background: linear-gradient(180deg, rgba(var(--color-surface-rgb), 0.98) 0%, rgba(var(--color-surface-rgb), 0.93) 100%);
  backdrop-filter: blur(16px);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.30);
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 1200;
}

.account-dropdown.open {
  display: flex;
}

.account-dropdown button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.account-dropdown button:hover {
  background: rgba(var(--accent-rgb), 0.10);
  border-color: rgba(var(--accent-rgb), 0.18);
  transform: translateX(2px);
}

.account-dropdown button.logout-item {
  color: var(--danger-color);
}

.account-dropdown button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Page Loader - Enhanced Animation */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
}

.loader-spinner {
  width: 64px;
  height: 64px;
  position: relative;
  margin-bottom: 32px;
}

.loader-spinner::before,
.loader-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent-color);
  animation: loader-spin 1.2s cubic-bezier(0.6, 0.2, 0, 0.8) infinite;
}

.loader-spinner::after {
  inset: 8px;
  border-top-color: var(--accent-secondary);
  animation-duration: 0.8s;
  animation-direction: reverse;
}

.loader-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: var(--text-primary);
  text-transform: uppercase;
  animation: loader-pulse 2s ease-in-out infinite;
  text-align: center;
  padding: 0 20px;
}

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

@keyframes loader-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1); }
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Premium Scanning Ring Animation - Image Loader */
.image-loader-container {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 20;
  border-radius: var(--radius-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-loader-container.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.image-spinner {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  animation: radar-spin 2.5s linear infinite;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-spinner::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(var(--accent-rgb), 0.5);
  animation: radar-spin 5s linear infinite reverse;
}

.image-spinner::after {
  content: '';
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  animation: core-pulse 2s ease-in-out infinite alternate;
}

.scan-percentage {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 15px var(--accent-color), 0 0 25px var(--accent-color);
  z-index: 30;
  letter-spacing: -0.05em;
  animation: radar-spin-reverse 2.5s linear infinite;
}

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

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

@keyframes core-pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* Footer Alignment */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
  width: 100%;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Consolidated Responsive Design */
@media (max-width: 1200px) {
  .wrap { padding: 0 32px; }
  .wrap-full { padding: 0 32px; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  :root {
    --header-height: 72px;
    --header-offset: calc(var(--header-height) + 16px);
  }

  .menu-toggle { display: flex; order: 3; }

  .nav-inner {
    height: 72px;
    padding: 0 20px;
  }

  .nav-scrolled .nav-inner {
    height: var(--header-height);
  }

  .nav-actions {
    order: 2;
    margin-left: auto;
    margin-right: 12px;
  }

  .nav-actions {
    gap: 8px;
  }
  .nav-actions .btn {
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-actions .btn-text {
    display: none;
  }
  .nav-actions .btn-icon {
    margin-right: 0 !important;
  }
  body[data-page="landing"] .headline {
    font-size: clamp(2.2rem, 7vw, 3.2rem);
  }
  body[data-page="landing"] .feature-card {
    padding: 36px;
  }
  /* Async Processing & UI Blocking */
.disabled-state {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.5);
  transition: var(--transition);
}

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

/* Cyberpunk Forensic Aesthetic Updates */
.explanation-method-card {
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  padding: 24px !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.explanation-method-card:hover {
  transform: translateY(-4px);
  background: rgba(15, 23, 42, 0.8) !important;
}

/* Glowing States for Cards */
.explanation-method-card.real-glow {
  border-color: rgba(16, 185, 129, 0.3) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.1), inset 0 0 12px rgba(16, 185, 129, 0.05);
}

.explanation-method-card.fake-glow {
  border-color: rgba(244, 63, 94, 0.3) !important;
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.1), inset 0 0 12px rgba(244, 63, 94, 0.05);
}

/* Cyberpunk Bar Styling */
.forensic-bar-wrapper {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
  height: 12px !important;
  border-radius: 100px !important;
}

.forensic-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.forensic-bar-fill.real-fill {
  background: linear-gradient(90deg, #064e3b 0%, #10b981 100%);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.forensic-bar-fill.fake-fill {
  background: linear-gradient(90deg, #4c0519 0%, #f43f5e 100%);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.5);
}

.forensic-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 12px;
}

.d3-signal-container {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.loading-shimmer {
  position: relative;
  overflow: hidden;
}

.loading-shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.03),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.d3-signal-container svg {
  width: 100%;
  height: 100%;
}

.d3-path-authentic {
  stroke: #1a73e8;
  fill: none;
}

.d3-path-synthetic {
  stroke: #d93025;
  fill: none;
}

.auth-btn {
    display: none !important;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-color);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    margin-left: 0;
    gap: 0;
  }

  .nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links .nav-link {
    font-size: 1.6rem;
    padding: 20px;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(var(--text-primary-rgb), 0.05);
  }

  .nav-links .nav-link:first-child {
    border-top: 1px solid rgba(var(--text-primary-rgb), 0.05);
  }

  .nav-mobile-auth {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 32px 24px;
    gap: 16px;
  }

  .nav-mobile-auth a {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-weight: 700;
    text-decoration: none;
    font-size: 1.1rem;
  }

  .mobile-login {
    background: var(--color-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
  }

  .mobile-signup {
    background: var(--color-primary);
    color: white;
  }

  .hero-grid { grid-template-columns: 1fr; gap: 48px; text-align: center; }
  .hero-content { display: flex; flex-direction: column; align-items: center; }
  .lead { margin-left: auto; margin-right: auto; }

  .dashboard-shell { 
    grid-template-columns: 1fr; 
    min-height: auto;
    width: 100%;
    max-width: 100%;
  }

  .dashboard-history-toolbar {
    left: 14px;
    top: calc(var(--header-height) + 18px);
    transform: none;
  }

  .dashboard-sidebar { 
    position: static; 
    height: auto; 
    /* Fixed max-height to show ~2 items + header and enable scroll */
    max-height: 380px; 
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 32px 24px;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
  }

  .history-list-container {
    /* Ensure it scrolls within the bounded sidebar height on mobile */
    margin-right: -8px; /* Offset padding for scrollbar on mobile */
  }

  .dashboard-main {
    padding: 40px 20px;
    height: auto;
    min-width: 0;
    overflow-x: hidden;
  }

  .image-box {
    aspect-ratio: 1/1;
    min-width: 0;
  }

  .comparison-grid {
    gap: 24px;
  }

  .analysis-data-row { 
    grid-template-columns: 1fr; 
    gap: 24px;
  }

  .glass-card {
    padding: 32px 24px;
    min-width: 0;
  }

  .result-headline {
    font-size: 2.2rem !important;
  }
}

@media (max-width: 768px) {
  .section { padding: 80px 0; }
  .features-grid { grid-template-columns: 1fr; }
  .comparison-grid { grid-template-columns: 1fr; }
  .footer-content { flex-direction: column; gap: 16px; text-align: center; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .wrap-full { padding: 0 16px; }
  .brand-name { font-size: 1.1rem; }
  .brand-mark { width: 34px; height: 34px; font-size: 1rem; }
  .headline { 
    font-size: 2.2rem; 
    margin-bottom: 20px; 
    line-height: 1.25;
    letter-spacing: -0.04em;
  }
  .lead { font-size: 1rem; margin-bottom: 32px; }
  .hero-actions { flex-direction: column; width: 100%; gap: 12px; }
  .btn { width: 100%; height: 50px; }
  .system-status { 
    font-size: 0.65rem; 
    padding: 8px 16px; 
    margin-bottom: 20px;
    white-space: normal;
    display: inline-flex;
    justify-content: center;
    line-height: 1.5;
    width: auto;
    max-width: 100%;
    text-align: center;
  }
  
  /* Login/Signup Mobile Optimization */
  .auth-card { 
    padding: 16px !important; 
    width: 90% !important;
  }
  .auth-title { font-size: 1.4rem; }
  .auth-sub { font-size: 0.8rem; margin-bottom: 16px; }
  
  .form-group { margin-bottom: 12px; }
  .form-label { font-size: 0.7rem; margin-bottom: 4px; }
  .form-input { 
    height: 42px; 
    font-size: 14px; 
    padding: 10px; 
  }
  .auth-form .btn, 
  #loginSubmit, 
  #signupSubmit { 
    height: 44px; 
    font-size: 14px; 
    margin-top: 8px; 
  }
  .btn-google { 
    height: 44px; 
    font-size: 14px; 
  }
  .auth-divider { margin: 16px 0; }
  .auth-footer { margin-top: 24px; font-size: 0.85rem; }

  .dashboard-container {
    overflow-x: hidden;
  }

  /* Ensure the parent is a flex container for ordering to work */ 
  .dashboard-shell { 
      display: flex !important; 
      flex-direction: column !important; 
  } 

  .dashboard-history-toolbar {
      left: 12px;
      top: calc(var(--header-height) + 12px);
      transform: none;
  }

  /* Main analysis section comes first */ 
  .dashboard-main { 
      order: 1; 
      padding: 24px 0 32px;
      width: 100%;
      max-width: 100%;
      min-width: 0;
  } 

  /* History sidebar moves to the bottom */ 
  .dashboard-sidebar { 
      order: 2; 
      margin-top: 40px; /* Adds space between analysis and history */ 
      padding: 24px 16px;
      max-height: 340px; /* Even tighter for very small screens to fit 2 items nicely */
      width: 100%;
      max-width: 100%;
      min-width: 0;
  } 

  .dashboard-shell.history-collapsed .dashboard-sidebar {
      margin-top: 0;
      max-height: 0;
  }

  .dashboard-history-toggle {
      min-height: 40px;
      padding: 9px 14px;
      gap: 8px;
  }

  .analysis-grid,
  .analysis-data-row,
  .comparison-grid,
  .glass-card,
  .result-summary,
  .metadata-card,
  .explanation-card,
  .meta-grid,
  .meta-item,
  .progress-container,
  .progress-labels,
  .image-box {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .analysis-grid {
    gap: 24px;
  }
  .glass-card,
  .result-summary {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .card-label {
    margin-bottom: 16px;
    line-height: 1.4;
  }
  .result-headline {
    font-size: 1.75rem !important;
    line-height: 1.15;
    margin: 0 0 20px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .status-badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .progress-labels {
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
  }
  .progress-labels span,
  #analysisText,
  .card-label,
  .image-label {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .image-label {
    top: 12px;
    left: 12px;
    right: 12px;
    padding: 8px 12px;
    font-size: 0.65rem;
    white-space: normal;
  }
  .image-box img {
    max-width: 100%;
    height: auto;
    padding: 12px;
  }
  .meta-item {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    padding: 14px 16px;
  }
  .meta-key {
    flex: 0 0 auto;
  }
  .meta-val {
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .empty-state div:has(label.btn-primary) {
    flex-direction: column;
    gap: 16px;
  }

  .empty-state .btn-primary {
    width: 100%;
    margin-left: 0;
  }

  .scan-percentage {
    font-size: 2.2rem;
  }
}

/* --- DELETE HISTORY MODAL --- */
.delete-history-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px) saturate(160%);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  animation: modal-fade-in 0.4s cubic-bezier(0.4,0,0.2,1);
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.delete-modal-content {
  background: #fff !important;
  color: var(--text-primary);
  border: 1.5px solid var(--accent-color);
  border-radius: 22px;
  padding: 36px 28px 28px 28px;
  max-width: 440px;
  width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.45), 0 0 0 2px rgba(var(--accent-rgb),0.08);
  position: relative;
  animation: modal-pop 0.5s cubic-bezier(0.4,0,0.2,1);
}
@keyframes modal-pop {
  0% { transform: scale(0.92) translateY(40px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.delete-modal-content h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-color);
  margin: 0 0 10px 0;
  letter-spacing: -0.01em;
}
.delete-modal-content p {
  color: var(--text-secondary);
  font-size: 0.98rem;
  margin-bottom: 18px;
}
#deleteHistoryList > div {
  background: rgba(var(--accent-rgb),0.07);
  border: 1px solid rgba(var(--accent-rgb),0.13);
  border-radius: 10px;
  padding: 14px 12px 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s, border 0.2s;
  box-shadow: 0 2px 12px rgba(var(--accent-rgb),0.04);
}
#deleteHistoryList > div:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 24px rgba(var(--accent-rgb),0.13);
}
#deleteHistoryList input[type="checkbox"] {
  accent-color: var(--accent-color);
  width: 20px; height: 20px;
  border-radius: 6px;
  margin-right: 6px;
  cursor: pointer;
}
#deleteHistoryList .delete-item-label {
  flex: 1;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.01rem;
  letter-spacing: 0.01em;
}
#deleteHistoryList .delete-item-id {
  color: var(--accent-color);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
#selectAllCheckbox {
  accent-color: var(--accent-color);
  width: 18px; height: 18px;
  margin-right: 8px;
  cursor: pointer;
}
.delete-modal-content button {
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 1rem;
  border: none;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
#confirmDeleteBtn {
  background: linear-gradient(90deg, var(--danger-color) 60%, #fb7185 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(244,63,94,0.13);
  border: 1px solid var(--danger-color);
}
#confirmDeleteBtn:hover {
  background: linear-gradient(90deg, #fb7185 0%, var(--danger-color) 100%);
  color: #fff;
  box-shadow: 0 4px 24px rgba(244,63,94,0.18);
}
#cancelDeleteBtn {
  background: rgba(var(--accent-rgb),0.07);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
}
#cancelDeleteBtn:hover {
  background: var(--accent-color);
  color: #fff;
}
#closeDeleteModal {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 2.1rem;
  cursor: pointer;
  padding: 0 8px;
  transition: color 0.2s;
  line-height: 1;
}
#closeDeleteModal:hover {
  color: var(--danger-color);
}
@media (max-width: 600px) {
  .delete-modal-content {
    padding: 18px 6vw 18px 6vw;
    max-width: 98vw;
  }
  .delete-modal-content h2 {
    font-size: 1.1rem;
  }
}

/* Account Settings Modal */
.settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  z-index: 100000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.settings-modal.open {
  display: flex;
}

.settings-modal-content {
  width: min(100%, 520px);
  max-width: 520px;
  max-height: min(88vh, 760px);
  border-radius: 24px;
  background: var(--color-surface);
  color: var(--text-primary);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.12);
  flex-shrink: 0;
}

.settings-modal-header p {
  color: var(--text-secondary);
  margin-top: 8px;
}

.settings-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

#settingsForm {
  padding: 0 24px 24px 24px;
  overflow-y: auto;
}

.settings-avatar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
}

.settings-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(var(--accent-rgb), 0.18);
}

.settings-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

.settings-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.20);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.settings-help {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.settings-field:first-child {
  grid-column: 1 / -1;
}

.settings-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.settings-field input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: rgba(var(--color-surface-rgb), 0.72);
  color: var(--text-primary);
  padding: 12px 14px;
  outline: none;
}

.settings-field input:focus {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
}

.settings-message {
  min-height: 20px;
  font-size: 0.84rem;
  margin-top: 10px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.settings-message.error {
  color: var(--danger-color);
}

.settings-message.success {
  color: var(--success-color);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(var(--accent-rgb), 0.12);
}

.settings-actions button {
  min-width: 120px;
}

#settingsDeleteBtn {
  transition: background-color 0.2s ease, transform 0.2s ease;
}

#settingsDeleteBtn:hover {
  background: #e11d48 !important; /* Rose 600 */
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .account-menu-label {
    display: none;
  }

  .account-menu-trigger {
    min-width: auto;
    padding-right: 8px;
  }

  .account-dropdown {
    min-width: 200px;
  }

  .settings-modal {
    padding: 16px;
  }

  .settings-modal-content {
    border-radius: 18px;
    max-height: calc(100vh - 32px);
  }

  .settings-avatar-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-actions {
    flex-direction: column-reverse;
  }

  .settings-actions button {
    width: 100%;
  }

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

  .settings-field:first-child {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .settings-modal {
    padding: 12px;
  }

  .settings-modal-content {
    padding: 16px;
    border-radius: 16px;
    max-height: calc(100vh - 24px);
  }

  .settings-modal-header {
    gap: 12px;
    margin-bottom: 16px;
  }

  .settings-modal-header h2 {
    font-size: 1.1rem;
  }

  .settings-modal-header p {
    font-size: 0.85rem;
  }

  .settings-avatar-row {
    padding: 14px;
  }

  .settings-avatar-actions {
    min-width: 100%;
  }
}

#explanationGraph {
  width: 100%;
  max-width: 420px;
  height: 38px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  background: linear-gradient(90deg, #eee 0%, #bbb 100%);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.explanation-bar {
  height: 100%;
  min-height: 24px;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(90deg, #222 0%, #888 100%);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 8px #8888;
  filter: grayscale(1);
}
.explanation-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  color: #444;
  margin-left: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Neural Explanation Method Cards Grid */
.explanation-methods-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.explanation-method-card {
  background: linear-gradient(135deg, rgba(var(--text-primary-rgb), 0.02) 0%, rgba(var(--text-primary-rgb), 0.05) 100%);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.explanation-method-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-color), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.explanation-method-card:hover {
  background: linear-gradient(135deg, rgba(var(--text-primary-rgb), 0.05) 0%, rgba(var(--text-primary-rgb), 0.08) 100%);
  border-color: var(--accent-color);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.15);
}

.explanation-method-card:hover::before {
  opacity: 1;
}

.explanation-method-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.explanation-method-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--accent-color);
  border-radius: 50%;
}

.explanation-method-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.1) 100%);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(100, 100, 100, 0.2);
  padding: 12px;
}

.explanation-method-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: rgba(var(--text-primary-rgb), 0.02);
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--accent-color);
}

/* Responsive: Stack to 1 column on tablet and below */
@media (max-width: 768px) {
  .explanation-methods-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

@media (max-width: 480px) {
  .explanation-method-card {
    padding: 20px;
    gap: 14px;
  }
  
  .explanation-method-title {
    font-size: 0.95rem;
  }
  
  .explanation-method-text {
    font-size: 0.8rem;
  }
}
