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

:root {
  --bg: #05050f;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.06);
  --text: #e4e4e7;
  --text-dim: #71717a;
  --text-mute: #52525b;
  --accent-violet: #8b5cf6;
  --accent-fuchsia: #d946ef;
  --nav-bg: rgba(5,5,15,0.75);
  --input-bg: rgba(0,0,0,0.3);
  --input-border: rgba(255,255,255,0.08);
  --input-placeholder: #3f3f46;
  --card-bg-alt: rgba(0,0,0,0.2);
  --hero-desc: #52525b;
  --footer-text: #52525b;
  --stars-bg: radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1.5px 1.5px at 50% 10%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 70% 40%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 90% 80%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 20% 90%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 80% 15%, rgba(255,255,255,0.25), transparent),
    radial-gradient(1.5px 1.5px at 40% 45%, rgba(255,255,255,0.3), transparent);
  --spinner-border: rgba(255,255,255,0.2);
  --spinner-top: #fff;
}

[data-theme="light"] {
  --bg: #f5f5f0;
  --surface: rgba(255,255,255,0.7);
  --surface-hover: rgba(255,255,255,0.9);
  --border: rgba(0,0,0,0.08);
  --text: #1c1917;
  --text-dim: #6b7280;
  --text-mute: #9ca3af;
  --nav-bg: rgba(255,255,255,0.85);
  --input-bg: rgba(255,255,255,0.8);
  --input-border: rgba(0,0,0,0.1);
  --input-placeholder: #9ca3af;
  --card-bg-alt: rgba(255,255,255,0.5);
  --hero-desc: #9ca3af;
  --footer-text: #9ca3af;
  --stars-bg: none;
  --spinner-border: rgba(0,0,0,0.15);
  --spinner-top: #8b5cf6;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--stars-bg);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.nav-links { display: flex; gap: 8px; }

.nav-links a {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-dim);
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  background: rgba(139,92,246,0.15);
  color: #c4b5fd;
}

[data-theme="light"] .nav-links a:hover,
[data-theme="light"] .nav-links a.active {
  background: rgba(139,92,246,0.12);
  color: #7c3aed;
}

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: all 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}

.theme-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Hero section */
.hero {
  position: relative;
  z-index: 1;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 60px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.2);
  font-size: 12px;
  color: #c4b5fd;
  margin-bottom: 24px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a78bfa;
  animation: pulse 2s infinite;
}

.hero-title {
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, #8b5cf6, #d946ef, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(14px, 2.5vw, 18px);
  color: var(--text-dim);
  margin-bottom: 12px;
}

.hero-desc {
  max-width: 560px;
  font-size: 14px;
  color: var(--hero-desc);
  line-height: 1.7;
}

/* Section title */
.section-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 40px;
}

/* Agent cards */
.agents {
  position: relative;
  z-index: 1;
  padding: 0 20px 80px;
}

.agents-grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.agent-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8b5cf6, #d946ef, #06b6d4);
  opacity: 0;
  transition: opacity 0.3s;
}

.agent-card:hover {
  background: var(--surface-hover);
  border-color: rgba(139,92,246,0.2);
  transform: translateY(-4px);
}

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

.agent-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.agent-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.agent-card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 14px;
}

.agent-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.agent-tags span {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(139,92,246,0.1);
  color: #c4b5fd;
  border: 1px solid rgba(139,92,246,0.15);
}

.agent-enter {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-violet);
  transition: transform 0.2s;
}

.agent-card:hover .agent-enter { transform: translateX(4px); }

/* Features */
.features {
  position: relative;
  z-index: 1;
  padding: 60px 20px 80px;
}

.features-grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s;
}

.feature-card:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.feature-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Page header (agent pages) */
.page-header {
  position: relative;
  z-index: 1;
  padding: 100px 20px 40px;
  text-align: center;
}

.header-badge {
  display: inline-flex;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.page-header h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
}

.page-header p {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 500px;
  margin: 0 auto;
}

/* Main content (agent pages) */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 24px;
}

.input-section textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 16px;
  padding: 16px;
  font-size: 14px;
  color: var(--text);
  resize: vertical;
  outline: none;
  font-family: inherit;
  line-height: 1.7;
  transition: border-color 0.2s;
}

.input-section textarea:focus {
  border-color: rgba(139,92,246,0.4);
}

.input-section textarea::placeholder {
  color: var(--input-placeholder);
}

#analyzeBtn {
  margin-top: 16px;
  padding: 12px 28px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#analyzeBtn:hover {
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
  transform: translateY(-1px);
}

#analyzeBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon { font-size: 18px; }

/* Result area */
.result-area {
  animation: fadeInUp 0.4s ease;
}

.hidden { display: none; }

.result-nav {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn.active {
  background: rgba(139,92,246,0.15);
  color: #c4b5fd;
}

.tab-btn:hover:not(.active) {
  color: var(--text);
}

.tab-content { display: none; }

.tab-content.active { display: block; }

/* Steps */
.step-list { display: flex; flex-direction: column; gap: 12px; }

.step-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  border-left: 3px solid var(--accent-violet);
}

.step-item .step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-violet);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.step-item .step-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.step-item .step-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
}

.step-item.highlight {
  border-left-color: #f59e0b;
}

.step-item.highlight .step-num { color: #f59e0b; }

.step-item.answer {
  border-left-color: #22c55e;
}

.step-item.answer .step-num { color: #22c55e; }

/* Tips card */
.tips-card, .analysis-card, .map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
}

.tips-card h4, .analysis-card h4, .map-card h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tips-card .tip-group {
  margin-bottom: 16px;
}

.tips-card .tip-group:last-child { margin-bottom: 0; }

.tips-card .tip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-violet);
  margin-bottom: 6px;
}

.tips-card .tip-text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  padding: 10px 14px;
  background: var(--card-bg-alt);
  border-radius: 10px;
}

.analysis-card .analysis-line {
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--card-bg-alt);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  border-left: 2px solid var(--accent-violet);
}

.map-card .map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.map-card .map-item {
  padding: 12px;
  background: var(--card-bg-alt);
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.map-card .map-item:hover {
  background: rgba(139,92,246,0.1);
  border-color: rgba(139,92,246,0.2);
}

.map-item .map-label {
  font-size: 12px;
  color: var(--accent-violet);
  font-weight: 600;
  margin-bottom: 4px;
}

.map-item .map-desc {
  font-size: 11px;
  color: var(--text-dim);
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px 20px;
  font-size: 13px;
  color: var(--footer-text);
  border-top: 1px solid var(--border);
}

/* ===== Question Bank ===== */
.qb-section {
  margin-top: 40px;
}

.qb-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.qb-toggle:hover {
  background: var(--surface-hover);
}

.qb-toggle .qb-arrow {
  margin-left: auto;
  transition: transform 0.2s;
  font-size: 12px;
}

.qb-toggle.open .qb-arrow {
  transform: rotate(180deg);
}

.qb-content {
  display: none;
  margin-top: 12px;
}

.qb-content.open {
  display: block;
}

.qb-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.qb-filter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.qb-filter:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.qb-filter.active {
  background: rgba(139,92,246,0.15);
  border-color: rgba(139,92,246,0.3);
  color: #c4b5fd;
}

[data-theme="light"] .qb-filter.active {
  color: #7c3aed;
}

.qb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qb-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.qb-item:hover {
  background: var(--surface-hover);
  border-color: rgba(139,92,246,0.2);
}

.qb-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.qb-badge-grade {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  background: rgba(139,92,246,0.15);
  color: #c4b5fd;
}

[data-theme="light"] .qb-badge-grade {
  color: #7c3aed;
}

.qb-badge-topic {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(6,182,212,0.12);
  color: #5eead4;
}

[data-theme="light"] .qb-badge-topic {
  color: #0d9488;
}

.qb-badge-diff {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
}

[data-theme="light"] .qb-badge-diff {
  color: #b45309;
}

.qb-item-preview {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qb-item-action {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.qb-use-btn {
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 6px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.qb-use-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.qb-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 13px;
}

.footer a {
  color: var(--accent-violet);
  text-decoration: none;
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

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

@keyframes typing {
  from { width: 0; }
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--spinner-border);
  border-top-color: var(--spinner-top);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* Mobile responsive */
@media (max-width: 640px) {
  .nav-links { gap: 4px; }
  .nav-links a { padding: 6px 10px; font-size: 12px; }
  .agents-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .result-nav { flex-wrap: nowrap; }
  .tab-btn { font-size: 12px; padding: 8px 10px; }
  .map-card .map-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header h1 { font-size: 28px; }
}
