:root, [data-theme="dark"] {
  --bg: #050505;
  --surface: #0c0c0c;
  --elevated: #141414;
  --line: #222;
  --mute: #555;
  --text: #f0f0f0;
  --text-dim: #aaa;
  --lime: #c8f560;
  --lime-dim: #a3d13a;
  --lime-bg: rgba(200, 245, 96, 0.08);
  --lime-border: rgba(200, 245, 96, 0.3);
  --input-bg: #0c0c0c;
  --nav-bg: rgba(5, 5, 5, 0.8);
  --card-hover: #111;
  --noise-opacity: 0.03;
}

[data-theme="light"] {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --elevated: #f0f0eb;
  --line: #e0e0d8;
  --mute: #888;
  --text: #1a1a1a;
  --text-dim: #555;
  --lime: #5a8a00;
  --lime-dim: #4a7500;
  --lime-bg: rgba(90, 138, 0, 0.08);
  --lime-border: rgba(90, 138, 0, 0.3);
  --input-bg: #ffffff;
  --nav-bg: rgba(245, 245, 240, 0.9);
  --card-hover: #f8f8f3;
  --noise-opacity: 0.02;
}

* { box-sizing: border-box; }

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.25s, color 0.25s;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--noise-opacity); pointer-events: none; z-index: 9999;
}

.font-mono { font-family: 'JetBrains Mono', monospace; }
::selection { background: var(--lime); color: var(--bg); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.btn-lime {
  background: var(--lime); color: var(--bg); font-weight: 700;
  transition: all 0.2s ease;
}
.btn-lime:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 30px rgba(200, 245, 96, 0.25);
  transform: translateY(-1px);
}
[data-theme="light"] .btn-lime:hover { box-shadow: 0 0 20px rgba(90, 138, 0, 0.2); }

.btn-ghost {
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--mute); color: var(--text); background: var(--card-hover); }

.chip {
  border: 1px solid var(--line); background: var(--surface);
  transition: all 0.15s ease; cursor: pointer; user-select: none;
  color: var(--text-dim);
}
.chip:hover { border-color: var(--mute); background: var(--card-hover); }
.chip.active {
  border-color: var(--lime); background: var(--lime-bg); color: var(--lime);
}

.input-field {
  background: var(--input-bg); border: 1px solid var(--line); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-field::placeholder { color: var(--mute); }
.input-field:focus {
  outline: none; border-color: var(--lime);
  box-shadow: 0 0 0 3px var(--lime-bg);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  transition: background 0.25s, border-color 0.25s;
}

.nav-bar {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.text-mute { color: var(--mute); }
.text-dim { color: var(--text-dim); }
.border-line { border-color: var(--line); }
.bg-surface { background: var(--surface); }
.bg-elevated { background: var(--elevated); }
.text-lime { color: var(--lime); }
.bg-lime { background: var(--lime); }
.border-lime { border-color: var(--lime-border); }

@keyframes orbit { to { transform: rotate(360deg); } }
.orbit { animation: orbit 1s linear infinite; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.stagger > * { opacity: 0; animation: fadeUp 0.4s ease forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
.stagger > *:nth-child(9) { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.5s; }

.mode-tab { position: relative; color: var(--mute); }
.mode-tab.active { color: var(--lime); }
.mode-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 2px; background: var(--lime);
}

@keyframes detectPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--lime-bg); }
  50% { box-shadow: 0 0 0 6px transparent; }
}
.detect-pulse { animation: detectPulse 2s ease infinite; }
textarea { resize: none; }

.feature-card {
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover { border-color: var(--mute); transform: translateY(-2px); }

.hero-glow {
  background: radial-gradient(ellipse 60% 40% at 50% 0%, var(--lime-bg) 0%, transparent 70%);
}

.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.admin-nav-item {
  color: var(--mute); transition: all 0.15s;
  border-radius: 8px; cursor: pointer;
  text-decoration: none;
  display: block;
}
.admin-nav-item:hover { background: var(--elevated); color: var(--text); }
.admin-nav-item.active { background: var(--lime-bg); color: var(--lime); }

.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px;
}

.theme-toggle {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--elevated); border: 1px solid var(--line);
  position: relative; cursor: pointer; transition: background 0.2s;
  appearance: none;
}
.theme-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--lime); transition: transform 0.2s;
}
[data-theme="light"] .theme-toggle::after {
  transform: translateX(16px);
}

.admin-toggle {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--line); border: 1px solid var(--line);
  position: relative; cursor: pointer; transition: all 0.2s;
  appearance: none;
}
.admin-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); transition: transform 0.2s;
}
.admin-toggle:checked {
  background: var(--lime); border-color: var(--lime);
}
.admin-toggle:checked::after {
  transform: translateX(16px);
  background: var(--bg);
}

.loading-screen {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); opacity: 0.95;
  align-items: center; justify-content: center;
}
.loading-screen.active { display: flex; }
