@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #08081a;
  --surface: #0f0f2a;
  --panel: #141432;
  --border: rgba(124,58,237,0.18);
  --border-bright: rgba(124,58,237,0.45);
  --purple: #7C3AED;
  --purple-dim: rgba(124,58,237,0.15);
  --violet: #A855F7;
  --gold: #F59E0B;
  --gold-dim: rgba(245,158,11,0.15);
  --cyan: #06B6D4;
  --cyan-dim: rgba(6,182,212,0.15);
  --green: #10B981;
  --red: #EF4444;
  --text: #E2E8F0;
  --text-muted: #94A3B8;
  --text-secondary: #CBD5E1;
  --r: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 4px; }

/* App shell */
.app-shell { display: flex; flex-direction: column; min-height: 100dvh; }

/* Top nav */
.topnav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: rgba(8,8,26,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topnav-brand { font-family: 'Orbitron',monospace; font-size: 1.1rem; font-weight: 900; color: var(--purple); letter-spacing: 0.1em; text-decoration: none; }
.topnav-brand span { color: var(--gold); }
.topnav-xp { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.xp-badge { font-family: 'Orbitron',monospace; font-size: 0.65rem; font-weight: 700; color: var(--gold); background: var(--gold-dim); border: 1px solid rgba(245,158,11,0.3); padding: 0.2rem 0.55rem; border-radius: 20px; }
.streak-badge { font-family: 'Orbitron',monospace; font-size: 0.65rem; font-weight: 700; color: var(--red); background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); padding: 0.2rem 0.55rem; border-radius: 20px; }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex;
  background: rgba(8,8,26,0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0.55rem 0.25rem;
  color: var(--text-muted); text-decoration: none; font-size: 0.58rem;
  font-family: 'Orbitron',monospace; font-weight: 600; letter-spacing: 0.04em;
  transition: color 0.15s;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--purple); }
.bottom-nav a.active .nav-icon { filter: drop-shadow(0 0 6px var(--purple)); }
.nav-icon { font-size: 1.3rem; }

/* Page container */
.container { max-width: 680px; margin: 0 auto; padding: 1.25rem 1rem 6rem; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  margin-bottom: 0.875rem;
}
.card-purple { border-color: rgba(124,58,237,0.4); box-shadow: 0 0 20px rgba(124,58,237,0.08); }
.card-gold { border-color: rgba(245,158,11,0.4); box-shadow: 0 0 20px rgba(245,158,11,0.08); }
.card-cyan { border-color: rgba(6,182,212,0.4); }

/* Section headers */
.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.875rem; }
.section-title { font-family: 'Orbitron',monospace; font-size: 0.75rem; font-weight: 700; color: var(--purple); letter-spacing: 0.1em; text-transform: uppercase; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border-radius: 8px; font-weight: 600; font-size: 0.875rem; cursor: pointer; transition: all 0.15s; border: none; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--purple); color: white; }
.btn-primary:hover { background: var(--violet); box-shadow: 0 0 18px rgba(124,58,237,0.4); }
.btn-gold { background: var(--gold); color: #000; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; border-radius: 6px; }
.btn-danger { background: var(--red); color: white; }
.w-full { width: 100%; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.4rem; }
.form-input {
  width: 100%; padding: 0.65rem 0.875rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem;
  font-family: inherit; transition: border-color 0.15s; outline: none;
}
.form-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
textarea.form-input { resize: vertical; min-height: 100px; }

/* Badges/tags */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.55rem; border-radius: 20px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; }
.badge-purple { background: var(--purple-dim); color: var(--violet); border: 1px solid rgba(124,58,237,0.3); }
.badge-gold   { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(245,158,11,0.3); }
.badge-cyan   { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(6,182,212,0.3); }
.badge-green  { background: rgba(16,185,129,0.12); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.badge-red    { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.6rem; margin-bottom: 1.25rem; }
.stat-box { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.5rem; text-align: center; }
.stat-value { font-family: 'Orbitron',monospace; font-size: 1.4rem; font-weight: 900; color: var(--purple); }
.stat-label { font-size: 0.62rem; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 0.2rem; }

/* XP bar */
.xp-bar-wrap { background: rgba(124,58,237,0.12); border-radius: 99px; height: 6px; overflow: hidden; margin-top: 0.4rem; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg,var(--purple),var(--violet)); border-radius: 99px; transition: width 0.6s; }

/* Subject chips */
.subject-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.65rem; border-radius: 20px; font-size: 0.72rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; }

/* Tabs */
.tabs { display: flex; gap: 0.3rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; overflow-x: auto; }
.tab-btn { padding: 0.4rem 0.875rem; border-radius: 8px; border: none; background: transparent; color: var(--text-muted); font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.15s; font-family: inherit; }
.tab-btn.active { background: var(--purple-dim); color: var(--violet); border: 1px solid rgba(124,58,237,0.3); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.85rem; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.alert-info { background: var(--purple-dim); border: 1px solid rgba(124,58,237,0.3); color: var(--violet); }

/* Empty states */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--text-secondary); }

/* Progress ring placeholder */
@keyframes destinyPulse { 0%,100%{box-shadow:0 0 0 0 rgba(124,58,237,0.4)} 50%{box-shadow:0 0 0 8px rgba(124,58,237,0)} }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn 0.3s ease; }

/* Flashcard flip */
.flashcard { perspective: 1000px; cursor: pointer; user-select: none; }
.flashcard-inner { position: relative; transition: transform 0.5s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face { position: absolute; width: 100%; backface-visibility: hidden; }
.flashcard-back { transform: rotateY(180deg); }

/* Priority colors */
.priority-high { border-left: 3px solid var(--red); }
.priority-medium { border-left: 3px solid var(--gold); }
.priority-low { border-left: 3px solid var(--green); }

/* Hero gradient */
.hero-gradient { background: radial-gradient(ellipse at top,rgba(124,58,237,0.12) 0%,transparent 70%); }

/* Starfield bg for hero */
.starfield { position: relative; overflow: hidden; }
.starfield::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 20% 30%,rgba(255,255,255,0.4) 0%,transparent 100%), radial-gradient(1px 1px at 80% 10%,rgba(255,255,255,0.3) 0%,transparent 100%), radial-gradient(1px 1px at 50% 70%,rgba(255,255,255,0.35) 0%,transparent 100%), radial-gradient(1px 1px at 10% 80%,rgba(255,255,255,0.25) 0%,transparent 100%), radial-gradient(1px 1px at 90% 60%,rgba(255,255,255,0.3) 0%,transparent 100%); pointer-events: none; }
