/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-secondary);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; background: none; color: inherit; }

/* ===== UTILITY ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hidden { display: none !important; }

/* ===== ANIMATED BACKGROUND ===== */
.bg-glow {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
}
.orb-1 {
  width: 600px; height: 600px;
  background: #8B5CF6;
  top: -200px; left: -100px;
  animation: float1 20s ease-in-out infinite;
}
.orb-2 {
  width: 500px; height: 500px;
  background: #06B6D4;
  top: 40%; right: -150px;
  animation: float2 25s ease-in-out infinite;
}
.orb-3 {
  width: 400px; height: 400px;
  background: #EC4899;
  bottom: -100px; left: 30%;
  animation: float3 22s ease-in-out infinite;
}
@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, 60px) scale(1.1); }
  66% { transform: translate(-40px, 30px) scale(0.95); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-60px, -40px) scale(0.9); }
  66% { transform: translate(40px, 50px) scale(1.05); }
}
@keyframes float3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(50px, -30px) scale(1.08); }
  66% { transform: translate(-30px, -50px) scale(0.92); }
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 10, 24, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}
.logo-icon { font-size: 1.4rem; }
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Progress ring */
.progress-ring-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-ring { transform: rotate(-90deg); }
.progress-ring__bg {
  fill: none;
  stroke: var(--border-default);
  stroke-width: 3;
}
.progress-ring__fill {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 94.25;
  transition: stroke-dashoffset 0.6s ease;
}
.progress-pct {
  position: absolute;
  font-size: 0.55rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* Level badge */
.level-badge {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--primary-light);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.08);
  transition: all var(--transition-normal);
}
.level-badge:hover {
  border-color: var(--border-hover);
  background: rgba(139, 92, 246, 0.15);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 48px 24px 16px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 520px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}
.modal-overlay.active .modal-card {
  transform: translateY(0);
}
.modal-icon { font-size: 3rem; display: block; margin-bottom: 16px; }
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.modal-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}
.onboarding-prompt {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Level options */
.level-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.level-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  text-align: left;
  transition: all var(--transition-normal);
}
.level-option:hover {
  border-color: var(--primary);
  background: var(--gradient-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-sm);
}
.level-emoji { font-size: 1.8rem; flex-shrink: 0; }
.level-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  display: block;
}
.level-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* ===== TOPIC PANEL ===== */
.topic-panel {
  position: fixed;
  top: 0;
  right: -520px;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  z-index: 200;
  background: var(--bg-surface);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transition: right var(--transition-slow);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}
.topic-panel.open {
  right: 0;
}
.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}
.panel-overlay.active {
  opacity: 1;
  visibility: visible;
}
.panel-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.panel-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-icon {
  font-size: 2rem;
}
.panel-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.panel-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.panel-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.panel-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Panel tabs */
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-default);
  padding: 0 24px;
  flex-shrink: 0;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}
.tab svg { opacity: 0.7; }
.tab.active svg { opacity: 1; }

/* Panel body */
.panel-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
}
.tab-content {
  display: none;
  height: 100%;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* ===== TOAST NOTIFICATIONS ===== */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
  min-width: 200px;
}
.toast-icon { font-size: 1.3rem; }
@keyframes toastIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100px); opacity: 0; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.4); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { padding: 32px 16px 8px; }
  .hero h1 { font-size: 1.6rem; }
  .topic-panel { width: 100vw; right: -100vw; }
  .header-inner { height: 52px; }
  .site-logo { font-size: 1.1rem; }
  .modal-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .progress-ring-wrap { display: none; }
}
