/* ============================================================
   SAMNEX — style.css
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --bg: #040a0f;
  --bg-soft: #060d14;
  --surface: #0a1219;
  --surface-2: #0e1820;
  --border: rgba(0, 240, 255, 0.15);
  --text: #e5e7eb;
  --text-muted: #6b7280;
  --cyan: #00f0ff;
  --pink: #fe01ff;
  --green: #0cff0c;
  --purple: #b026ff;
  --yellow: #ffde00;
  --orange: #ff9900;
  --red: #ff3c3c;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Chakra Petch', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Grid bg */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0,240,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,240,255,0.04) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none; z-index: 0;
}

h1,h2,h3,h4,h5,h6 { font-family: 'Orbitron', sans-serif; letter-spacing: 0.02em; }
code, pre, .font-mono, input, textarea, button { font-family: 'Chakra Petch', sans-serif; }
input, textarea { font-family: 'Source Code Pro', monospace; }

/* ── Color helpers ── */
.t-cyan   { color: var(--cyan);   text-shadow: 0 0 8px rgba(0,240,255,.6); }
.t-pink   { color: var(--pink);   text-shadow: 0 0 8px rgba(254,1,255,.6); }
.t-green  { color: var(--green);  text-shadow: 0 0 8px rgba(12,255,12,.6); }
.t-purple { color: var(--purple); text-shadow: 0 0 8px rgba(176,38,255,.6); }
.t-yellow { color: var(--yellow); text-shadow: 0 0 8px rgba(255,222,0,.6); }
.t-orange { color: var(--orange); text-shadow: 0 0 8px rgba(255,153,0,.6); }
.t-red    { color: var(--red);    text-shadow: 0 0 8px rgba(255,60,60,.6); }
.text-muted { color: var(--text-muted); }
.small { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* ── Buttons ── */
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; }

.btn-cyan, .btn-ghost, .btn-danger, .btn-pink {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; border-radius: 0.5rem;
  font-weight: 600; font-size: 0.875rem; transition: all 0.2s;
  cursor: pointer; font-family: 'Chakra Petch', sans-serif;
}

.btn-cyan {
  color: var(--cyan);
  background: rgba(0,240,255,.06);
  border: 1px solid rgba(0,240,255,.5);
}
.btn-cyan:hover {
  background: rgba(0,240,255,.12);
  box-shadow: 0 0 16px rgba(0,240,255,.3);
}

.btn-ghost {
  color: var(--text-muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,.1);
}
.btn-ghost:hover { color: var(--cyan); border-color: rgba(0,240,255,.4); }

.btn-danger {
  color: var(--red);
  background: rgba(255,60,60,.05);
  border: 1px solid rgba(255,60,60,.3);
}
.btn-danger:hover { background: rgba(255,60,60,.1); }

.btn-pink {
  color: var(--pink);
  background: rgba(254,1,255,.06);
  border: 1px solid rgba(254,1,255,.5);
}
.btn-pink:hover { background: rgba(254,1,255,.12); box-shadow: 0 0 16px rgba(254,1,255,.3); }

.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.75rem; }

/* ── Glass ── */
.glass {
  background: rgba(4,10,15,.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Cards ── */
.card {
  border-radius: 0.75rem;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.08);
  transition: all 0.3s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,.4); }

/* ── Matrix Rain ── */
#matrix-rain, #matrix-rain-dash {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; display: flex; justify-content: space-between;
  pointer-events: none; opacity: 0.07;
}
.rain-col {
  width: 18px; color: var(--green);
  font-family: 'VT323', monospace; font-size: 16px;
  white-space: pre;
  animation: fall linear infinite;
}
@keyframes fall {
  from { transform: translateY(-100%); }
  to   { transform: translateY(100vh); }
}

/* ── Animations ── */
.animate-fade-up  { animation: fadeUp 0.5s ease-out both; }
.animate-scale-in { animation: scaleIn 0.3s cubic-bezier(.34,1.56,.64,1) both; }
.animate-fade-in  { animation: fadeIn 0.4s ease-out both; }

@keyframes fadeUp  { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
@keyframes scaleIn { from { opacity:0; transform:scale(.92); } to { opacity:1; transform:scale(1); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }

.pulse-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.3;} }

/* ── Loading Screen ── */
#loading-screen {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg); gap: 1.5rem;
}
.loading-logo {
  width: 56px; height: 56px; border-radius: 14px;
  border: 1px solid rgba(0,240,255,.4); background: rgba(0,240,255,.05);
  display: flex; align-items: center; justify-content: center;
}
.loading-spinner {
  width: 24px; height: 24px; border: 2px solid rgba(0,240,255,.2);
  border-top-color: var(--cyan); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.25rem 0.75rem; border-radius: 999px;
  border: 1px solid rgba(0,240,255,.3); background: rgba(0,240,255,.05);
  font-size: 0.75rem; font-family: 'Source Code Pro', monospace; color: var(--cyan);
}
.badge-green {
  display: inline-block; padding: 0.25rem 0.75rem; border-radius: 999px;
  border: 1px solid rgba(12,255,12,.3); background: rgba(12,255,12,.05);
  font-size: 0.75rem; font-family: 'Source Code Pro', monospace; color: var(--green);
  margin-bottom: 0.75rem;
}

/* ============================================================
   AUTH PAGE
   ============================================================ */
#auth-page { position: relative; min-height: 100vh; }

.auth-nav {
  position: relative; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; max-width: 80rem; margin: 0 auto;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.625rem;
  font-family: 'Orbitron', sans-serif; font-weight: 700;
  font-size: 1.25rem; color: var(--cyan);
  text-shadow: 0 0 8px rgba(0,240,255,.6);
  text-decoration: none;
}
.nav-actions { display: flex; align-items: center; gap: 0.75rem; }

.landing-hero {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 5rem 1rem;
}
.hero-glow {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 600px; height: 450px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,240,255,.07) 0%, transparent 70%);
  pointer-events: none;
}
.landing-hero h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1; margin: 1.5rem 0 0.5rem;
}
.hero-sub {
  display: block; font-size: clamp(1rem, 2.5vw, 1.5rem);
  color: var(--pink); text-shadow: 0 0 8px rgba(254,1,255,.6);
  font-family: 'Source Code Pro', monospace; font-weight: 400;
  letter-spacing: 0.25em; margin-top: 0.5rem;
}
.hero-desc {
  max-width: 42rem; font-size: 1.125rem;
  color: var(--text-muted); font-family: 'Source Code Pro', monospace;
  margin: 0 0 2.5rem;
}
.hero-btns {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center;
  margin-bottom: 5rem;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 1.5rem;
  max-width: 48rem;
}
.stat { text-align: center; }
.stat span { display: block; font-family: 'Orbitron', sans-serif; font-size: 1.875rem; font-weight: 700; }
.stat small { display: block; color: var(--text-muted); font-size: 0.75rem; font-family: 'Source Code Pro', monospace; margin-top: 0.25rem; }

.features-grid {
  position: relative; z-index: 10;
  max-width: 80rem; margin: 0 auto; padding: 0 1rem 5rem;
}
.section-eyebrow {
  text-align: center; font-size: 0.75rem; color: var(--text-muted);
  font-family: 'Source Code Pro', monospace; letter-spacing: 0.15em;
  margin-bottom: 1.5rem;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.feature-card {
  padding: 1.25rem; border-radius: 0.75rem;
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08);
  transition: transform 0.3s, box-shadow 0.3s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.feature-icon { font-size: 1.5rem; margin-bottom: 0.75rem; color: var(--cyan); text-shadow: 0 0 8px rgba(0,240,255,.6); }
.feature-card h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.25rem; }
.feature-card p  { font-size: 0.875rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; }

#view-login, #view-register, #view-reset { width: 100%; }
.auth-card-wrap {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; padding: 1rem;
  width: 100%;
}
.auth-card {
  width: 100%; max-width: 28rem;
  background: rgba(4,10,15,.93); border: 1px solid rgba(0,240,255,.3);
  border-radius: 1rem; padding: 2rem; box-shadow: 0 25px 50px rgba(0,0,0,.5);
}
.auth-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 0.625rem; margin-bottom: 2rem;
  font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 1.25rem;
}
.auth-card h2 { font-size: 1.5rem; text-align: center; margin-bottom: 0.25rem; }
.auth-sub { text-align: center; font-size: 0.875rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-bottom: 2rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.75rem; font-family: 'Source Code Pro', monospace; color: var(--text-muted); margin-bottom: 0.375rem; }
.field input, .input-wrap input {
  width: 100%; background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.1); border-radius: 0.5rem;
  padding: 0.75rem 1rem; font-size: 0.875rem;
  color: var(--text); outline: none; transition: border-color 0.2s;
}
.field input:focus, .input-wrap input:focus { border-color: rgba(0,240,255,.5); }
.field input::placeholder { color: rgba(107,114,128,.5); }

.input-wrap {
  display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid rgba(255,255,255,.1);
  border-radius: 0.5rem; overflow: hidden;
  transition: border-color 0.2s;
}
.input-wrap:focus-within { border-color: rgba(0,240,255,.5); }
.input-wrap input { border: none; flex: 1; }
.toggle-pass {
  padding: 0 0.75rem; color: var(--text-muted); font-size: 1rem;
  background: none; border: none; cursor: pointer;
}
.toggle-pass:hover { color: var(--cyan); }

.error-msg {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: rgba(255,60,60,.05); border: 1px solid rgba(255,60,60,.3);
  border-radius: 0.5rem; padding: 0.75rem; font-size: 0.875rem;
  color: var(--red); font-family: 'Source Code Pro', monospace;
  margin-bottom: 0.75rem;
}
.success-msg {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: rgba(12,255,12,.05); border: 1px solid rgba(12,255,12,.3);
  border-radius: 0.5rem; padding: 0.75rem; font-size: 0.875rem;
  color: var(--green); font-family: 'Source Code Pro', monospace;
  margin-bottom: 0.75rem;
}

.auth-links { margin-top: 1rem; text-align: center; }
.auth-links p { font-size: 0.875rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-top: 0.5rem; }
.auth-footer { margin-top: 1rem; text-align: center; font-size: 0.875rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; }
.link-btn { background: none; border: none; font-size: inherit; color: var(--text-muted); cursor: pointer; font-family: inherit; transition: color 0.2s; }
.link-btn:hover { color: var(--cyan); text-decoration: underline; }
.back-home { margin-top: 1rem; color: var(--text-muted); font-size: 0.75rem; font-family: 'Source Code Pro', monospace; background: none; border: none; cursor: pointer; transition: color 0.2s; }
.back-home:hover { color: var(--cyan); }

/* ============================================================
   DASHBOARD
   ============================================================ */
#dashboard { position: relative; min-height: 100vh; }

.dash-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  border-bottom: 1px solid rgba(0,240,255,.15);
}
.dash-nav-inner {
  max-width: 80rem; margin: 0 auto; height: 4rem;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
}
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  padding: 0.5rem 0.75rem; font-size: 0.875rem; color: var(--text-muted);
  text-decoration: none; border-radius: 0.5rem;
  font-family: 'Source Code Pro', monospace; transition: all 0.2s;
  cursor: pointer;
}
.nav-links a:hover { color: var(--cyan); background: rgba(0,240,255,.05); }
.nav-user { display: flex; align-items: center; gap: 0.75rem; }
.stat-pill { font-family: 'Source Code Pro', monospace; font-size: 0.875rem; font-weight: 600; }
.profile-btn {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.375rem 0.75rem; border-radius: 0.5rem;
  border: 1px solid rgba(0,240,255,.2); background: rgba(0,240,255,.05);
  color: var(--cyan); font-size: 0.875rem; font-weight: 600;
  font-family: 'Source Code Pro', monospace; cursor: pointer; transition: all 0.2s;
}
.profile-btn:hover { border-color: rgba(0,240,255,.4); background: rgba(0,240,255,.1); }

.profile-dropdown {
  position: fixed; top: 4.5rem; right: 1rem; z-index: 50;
  width: 20rem; border: 1px solid rgba(0,240,255,.3);
  border-radius: 1rem; padding: 1.25rem;
  box-shadow: 0 20px 40px rgba(0,0,0,.5);
  animation: fadeIn 0.2s ease both;
}
.profile-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.avatar-big { width: 56px; height: 56px; border-radius: 1rem; border: 2px solid rgba(0,240,255,.4); background: rgba(0,240,255,.1); display: flex; align-items: center; justify-content: center; font-size: 1.75rem; }
.profile-header p { margin: 0; }
.rank-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.profile-stats {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 0.5rem;
  margin-bottom: 1rem;
}
.profile-stats > div { text-align: center; padding: 0.5rem; background: var(--surface-2); border-radius: 0.5rem; }
.profile-stats strong { display: block; font-size: 1rem; font-family: 'Orbitron', sans-serif; }
.profile-stats small { display: block; font-size: 0.625rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-top: 0.125rem; }

.dash-hero {
  position: relative; z-index: 10;
  padding: 7rem 1rem 4rem; max-width: 80rem; margin: 0 auto;
}
.dash-welcome { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; margin-bottom: 3rem; flex-wrap: wrap; }
.eyebrow { font-size: 0.75rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; letter-spacing: 0.1em; margin-bottom: 0.25rem; }
.dash-welcome h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); }
.dash-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.stat-card { padding: 0.75rem; border-radius: 0.75rem; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08); text-align: center; }
.stat-card span { display: block; font-size: 1.125rem; margin-bottom: 0.25rem; }
.stat-card strong { display: block; font-size: 1.125rem; font-family: 'Orbitron', sans-serif; font-weight: 700; }
.stat-card small { display: block; font-size: 0.625rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-top: 0.125rem; }
.progress-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
.prog-card { padding: 0.75rem; border-radius: 0.75rem; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08); text-align: center; }
.prog-card strong { display: block; font-size: 1.5rem; font-family: 'Orbitron', sans-serif; }
.prog-card small  { display: block; font-size: 0.625rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-top: 0.25rem; }

.hero-cta-row { display: flex; gap: 1rem; flex-wrap: wrap; }

.section { position: relative; z-index: 10; padding: 5rem 1rem; max-width: 80rem; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: 0.75rem; }
.section-header p  { color: var(--text-muted); font-family: 'Source Code Pro', monospace; font-size: 0.875rem; max-width: 42rem; margin: 0 auto; }

/* Courses */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.course-card {
  padding: 1.5rem; border-radius: 0.75rem;
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08);
  cursor: pointer; transition: transform 0.3s, box-shadow 0.3s;
  text-align: left;
}
.course-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.course-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.course-icon { font-size: 3rem; }
.course-badge { font-size: 0.625rem; padding: 0.25rem 0.5rem; border-radius: 999px; border: 1px solid rgba(0,240,255,.2); background: rgba(0,240,255,.05); color: var(--cyan); font-family: 'Source Code Pro', monospace; }
.course-card h3 { font-size: 1.25rem; color: var(--cyan); margin-bottom: 0.25rem; }
.course-card .tagline { font-size: 0.875rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-bottom: 0.5rem; }
.course-card p { font-size: 0.875rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-bottom: 1rem; }
.course-meta { display: flex; gap: 0.5rem; font-size: 0.75rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-bottom: 1rem; flex-wrap: wrap; }
.course-footer { display: flex; align-items: center; justify-content: flex-end; }
.course-cta { font-size: 0.875rem; color: var(--cyan); font-family: 'Source Code Pro', monospace; display: flex; align-items: center; gap: 0.25rem; transition: gap 0.2s; }
.course-card:hover .course-cta { gap: 0.5rem; }

/* Footer */
.site-footer {
  position: relative; z-index: 10;
  border-top: 1px solid rgba(0,240,255,.1);
  background: rgba(0,0,0,.3); padding: 4rem 1rem 2rem;
}
.footer-inner { max-width: 80rem; margin: 0 auto; }
.footer-brand { margin-bottom: 2rem; }
.footer-brand p { margin-top: 0.5rem; }
.footer-copy { max-width: 80rem; margin: 2rem auto 0; text-align: center; }

/* ============================================================
   DAILY CHALLENGE
   ============================================================ */
.daily-card {
  background: rgba(0,0,0,.4); border: 1px solid rgba(0,240,255,.2);
  border-radius: 1rem; padding: 2rem; transition: box-shadow 0.3s;
}
.daily-card:hover { box-shadow: 0 0 40px rgba(0,240,255,.08); }
.daily-card.done { border-color: rgba(12,255,12,.2); }
.daily-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.diff-badge { padding: 0.2rem 0.625rem; border-radius: 999px; font-size: 0.75rem; font-family: 'Source Code Pro', monospace; border: 1px solid currentColor; background: rgba(255,255,255,.04); }
.done-badge { padding: 0.2rem 0.625rem; border-radius: 999px; font-size: 0.7rem; font-family: 'Source Code Pro', monospace; border: 1px solid rgba(12,255,12,.4); background: rgba(12,255,12,.07); color: var(--green); margin-left: 0.5rem; white-space: nowrap; }
.daily-title { font-size: 1.75rem; font-family: 'Orbitron', sans-serif; color: var(--cyan); margin-bottom: 0.75rem; }
.daily-desc  { font-size: 0.9rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-bottom: 1rem; line-height: 1.6; }
.daily-tags  { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.tag { padding: 0.2rem 0.625rem; border-radius: 999px; font-size: 0.7rem; font-family: 'Source Code Pro', monospace; border: 1px solid rgba(255,255,255,.12); color: var(--text-muted); }
.daily-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.daily-rewards { display: flex; gap: 1.5rem; font-family: 'Source Code Pro', monospace; font-size: 0.875rem; font-weight: 600; }

/* ============================================================
   BOSS BATTLES
   ============================================================ */
.battles-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem;
}
.battle-card {
  padding: 1.5rem; border-radius: 0.75rem;
  background: rgba(0,0,0,.4); border: 1px solid rgba(254,1,255,.15);
  transition: transform 0.3s, box-shadow 0.3s;
}
.battle-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(254,1,255,.1); }
.battle-card.done { border-color: rgba(12,255,12,.15); }
.battle-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.boss-icon { font-size: 2.5rem; }
.battle-course { font-size: 0.7rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-bottom: 0.25rem; letter-spacing: 0.05em; }
.battle-name { font-size: 1.125rem; margin-bottom: 0.5rem; }
.battle-desc { font-size: 0.8rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; margin-bottom: 0.75rem; line-height: 1.5; }
.battle-meta { display: flex; gap: 1rem; font-size: 0.75rem; font-family: 'Source Code Pro', monospace; }

/* ============================================================
   MODALS (course curriculum / olympiad / rewards)
   ============================================================ */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  align-items: center; justify-content: center;
  background: rgba(2,5,8,.75);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 1.5rem;
  opacity: 0; transition: opacity 0.15s ease;
}
.modal-backdrop.open { opacity: 1; }
.modal-panel {
  width: 100%; max-width: 40rem; max-height: 85vh;
  background: rgba(6,13,20,.98); border: 1px solid rgba(0,240,255,.25);
  border-radius: 1rem; box-shadow: 0 30px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
  transform: scale(.96) translateY(10px); transition: transform 0.18s cubic-bezier(.34,1.4,.64,1);
}
.modal-backdrop.open .modal-panel { transform: scale(1) translateY(0); }
.modal-panel-lg { max-width: 56rem; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.modal-header-title { display: flex; align-items: center; gap: 0.875rem; }
.modal-header-icon { font-size: 2rem; }
.modal-header h2 { font-size: 1.25rem; margin-bottom: 0.125rem; }
.modal-close {
  width: 2rem; height: 2rem; border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1); font-size: 1rem; transition: all 0.2s;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--red); border-color: rgba(255,60,60,.3); background: rgba(255,60,60,.08); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }

/* Course phase tabs */
.course-phase-tabs {
  display: flex; gap: 0.5rem; padding: 1rem 1.5rem 0; overflow-x: auto;
  flex-shrink: 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.phase-tab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.125rem;
  padding: 0.625rem 1rem; border-radius: 0.5rem 0.5rem 0 0;
  border: 1px solid rgba(255,255,255,.08); border-bottom: none;
  background: rgba(255,255,255,.02); white-space: nowrap; transition: all 0.2s;
}
.phase-tab-num { font-size: 0.625rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; }
.phase-tab-name { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); font-family: 'Source Code Pro', monospace; }
.phase-tab.active { background: rgba(0,240,255,.07); border-color: rgba(0,240,255,.3); }
.phase-tab.active .phase-tab-num, .phase-tab.active .phase-tab-name { color: var(--cyan); }
.phase-tab:hover:not(.active) { background: rgba(255,255,255,.05); }

/* Module accordion */
.module-card {
  border: 1px solid rgba(255,255,255,.08); border-radius: 0.625rem;
  margin-bottom: 0.75rem; overflow: hidden; background: rgba(0,0,0,.3);
}
.module-head {
  width: 100%; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1rem; text-align: left; transition: background 0.2s;
}
.module-head:hover { background: rgba(0,240,255,.04); }
.module-num {
  font-family: 'Source Code Pro', monospace; font-size: 0.75rem; color: var(--cyan);
  background: rgba(0,240,255,.08); border-radius: 0.375rem; padding: 0.125rem 0.5rem;
  flex-shrink: 0;
}
.module-title { flex: 1; font-size: 0.9rem; font-weight: 600; }
.module-chevron { color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.module-card.expanded .module-chevron { transform: rotate(180deg); }
.module-body {
  display: none; padding: 0 1rem 1.25rem;
  font-size: 0.85rem; line-height: 1.6; font-family: 'Source Code Pro', monospace;
}
.module-card.expanded .module-body { display: block; animation: fadeIn 0.2s ease both; }
.module-theory { color: var(--text); margin-bottom: 0.875rem; }
.module-task { color: var(--text); margin-top: 0.875rem; }
.module-code {
  background: var(--surface-2); border: 1px solid rgba(255,255,255,.08);
  border-radius: 0.5rem; padding: 0.875rem 1rem; overflow-x: auto;
  font-size: 0.8rem; line-height: 1.55; color: #c9f5ff;
}
.module-code code { font-family: 'Source Code Pro', monospace; white-space: pre; }

/* ============================================================
   OLYMPIAD (inside modal now)
   ============================================================ */
.olympiad-filters { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.375rem 1rem; border-radius: 999px; font-size: 0.8rem;
  font-family: 'Source Code Pro', monospace; border: 1px solid rgba(255,255,255,.12);
  color: var(--text-muted); background: transparent; cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { color: var(--cyan); border-color: rgba(0,240,255,.4); }
.filter-btn.active { color: var(--cyan); border-color: rgba(0,240,255,.5); background: rgba(0,240,255,.07); }

.olympiad-list { display: flex; flex-direction: column; gap: 0.5rem; }
.olympiad-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-radius: 0.625rem;
  background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.07);
  cursor: pointer; transition: all 0.2s; gap: 1rem; flex-wrap: wrap;
}
.olympiad-row:hover { border-color: rgba(0,240,255,.3); background: rgba(0,240,255,.03); }
.olympiad-row.done { border-color: rgba(12,255,12,.2); }
.olympiad-left { display: flex; align-items: center; gap: 1rem; }
.olympiad-status { font-size: 1rem; width: 1.25rem; text-align: center; color: var(--text-muted); flex-shrink: 0; }
.olympiad-row.done .olympiad-status { color: var(--green); }
.olympiad-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
.olympiad-tags  { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.olympiad-right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; font-family: 'Source Code Pro', monospace; }
.source-badge { padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.65rem; border: 1px solid rgba(255,222,0,.3); color: var(--yellow); background: rgba(255,222,0,.05); white-space: nowrap; }

/* ============================================================
   REWARDS (inside modal now)
   ============================================================ */
.rewards-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.rewards-sub { font-family: 'Orbitron', sans-serif; font-size: 1rem; margin-bottom: 1.25rem; letter-spacing: 0.05em; }
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; }
.badge-card {
  padding: 1rem; border-radius: 0.75rem; text-align: center;
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08);
  transition: transform 0.2s;
}
.badge-card.earned { border-color: rgba(0,240,255,.25); }
.badge-card.earned:hover { transform: translateY(-3px); }
.badge-card.locked { opacity: 0.4; }
.badge-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.badge-name { font-size: 0.75rem; font-weight: 700; font-family: 'Source Code Pro', monospace; margin-bottom: 0.25rem; }
.badge-desc  { font-size: 0.65rem; color: var(--text-muted); font-family: 'Source Code Pro', monospace; line-height: 1.4; }

.lb-list { display: flex; flex-direction: column; gap: 0.5rem; }
.lb-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1rem; border-radius: 0.625rem;
  background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.07);
  font-family: 'Source Code Pro', monospace; font-size: 0.875rem;
}
.lb-row.lb-you { border-color: rgba(0,240,255,.3); background: rgba(0,240,255,.04); }
.lb-rank   { width: 2.5rem; text-align: center; font-weight: 700; }
.lb-country{ width: 1.5rem; text-align: center; }
.lb-name   { flex: 1; font-weight: 600; }
.lb-xp     { font-weight: 700; white-space: nowrap; }

/* ============================================================
   BYTE — AI ASSISTANT WIDGET (bottom-right)
   ============================================================ */
.ai-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 150;
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: linear-gradient(135deg, rgba(176,38,255,.25), rgba(0,240,255,.25));
  border: 1px solid rgba(0,240,255,.4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 24px rgba(0,240,255,.15);
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 12px 36px rgba(0,0,0,.6), 0 0 32px rgba(0,240,255,.25); }
.ai-fab.active { border-color: rgba(254,1,255,.5); }
.ai-fab-icon { font-size: 1.5rem; }

.ai-panel {
  display: none;
  position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 150;
  width: min(22rem, calc(100vw - 2rem)); height: min(30rem, calc(100vh - 8rem));
  background: rgba(6,13,20,.98); border: 1px solid rgba(0,240,255,.3);
  border-radius: 1rem; box-shadow: 0 20px 60px rgba(0,0,0,.6);
  flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(12px) scale(.97);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.ai-panel.open { opacity: 1; transform: translateY(0) scale(1); }
.ai-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.ai-panel-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: 'Orbitron', sans-serif; font-size: 0.9rem; color: var(--cyan);
}
.ai-status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 6px var(--green); animation: pulse 2s ease-in-out infinite;
}
.ai-log {
  flex: 1; overflow-y: auto; padding: 1rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.ai-msg { display: flex; }
.ai-msg-user { justify-content: flex-end; }
.ai-msg-bot { justify-content: flex-start; }
.ai-bubble {
  max-width: 85%; padding: 0.625rem 0.875rem; border-radius: 0.75rem;
  font-size: 0.8rem; line-height: 1.5; font-family: 'Source Code Pro', monospace;
}
.ai-msg-user .ai-bubble { background: rgba(0,240,255,.12); border: 1px solid rgba(0,240,255,.3); border-bottom-right-radius: 0.125rem; }
.ai-msg-bot .ai-bubble  { background: rgba(176,38,255,.08); border: 1px solid rgba(176,38,255,.25); border-bottom-left-radius: 0.125rem; color: var(--text); }
.ai-input-row {
  display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.ai-input-row input {
  flex: 1; background: var(--surface-2); border: 1px solid rgba(255,255,255,.1);
  border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.8rem; color: var(--text); outline: none;
}
.ai-input-row input:focus { border-color: rgba(0,240,255,.5); }
.ai-input-row input:disabled { opacity: 0.5; }

/* Byte code blocks inside chat bubbles */
.ai-code {
  background: var(--surface-2); border: 1px solid rgba(255,255,255,.08);
  border-radius: 0.5rem; padding: 0.625rem 0.75rem; margin: 0.5rem 0;
  overflow-x: auto; font-size: 0.75rem; line-height: 1.5; color: #c9f5ff;
  white-space: pre;
}

/* Byte "typing…" indicator */
.ai-typing-dots { display: flex; gap: 4px; align-items: center; padding: 0.75rem 0.875rem !important; }
.ai-typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--purple);
  opacity: 0.4; animation: typingBounce 1.2s ease-in-out infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce { 0%,60%,100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .progress-cards { grid-template-columns: repeat(2,1fr); }
  .dash-stats { grid-template-columns: repeat(3,1fr); }
  .nav-links { display: none; }
  .profile-btn span:last-child { display: none; }
  .rewards-layout { grid-template-columns: 1fr; }
  .olympiad-right { gap: 0.5rem; }
  .ai-panel { width: calc(100vw - 1.5rem); right: 0.75rem; height: min(26rem, calc(100vh - 7rem)); }
  .ai-fab { right: 1rem; bottom: 1rem; }
}
@media (max-width: 480px) {
  .hero-btns { flex-direction: column; align-items: stretch; }
  .hero-btns .btn-cyan, .hero-btns .btn-ghost { text-align: center; justify-content: center; }
  .progress-cards { grid-template-columns: repeat(2,1fr); }
  .dash-welcome { flex-direction: column; }
  .modal-panel { max-height: 92vh; }
  .hero-cta-row { flex-direction: column; }
}

/* ============================================================
   PRACTICE / LOCKING
   ============================================================ */
.section-label {
  font-family: 'Source Code Pro', monospace; font-size: 0.7rem;
  letter-spacing: 0.08em; text-transform: uppercase; margin: 0.75rem 0 0.375rem;
}
.practice-editor-inline, .practice-editor-inline#practice-editor {
  width: 100%; min-height: 140px; resize: vertical;
  background: #05090d; border: 1px solid rgba(255,255,255,.12);
  border-radius: 0.5rem; padding: 0.75rem; color: #c9f5ff;
  font-family: 'Source Code Pro', monospace; font-size: 0.82rem; line-height: 1.55;
  outline: none; tab-size: 2; margin-top: 0.25rem;
}
.practice-editor-inline:focus { border-color: rgba(0,240,255,.5); }
.module-check-row { display: flex; justify-content: flex-end; margin-top: 0.625rem; }
.practice-result {
  margin-top: 0.875rem; padding: 0.75rem 1rem; border-radius: 0.5rem;
  font-size: 0.82rem; font-family: 'Source Code Pro', monospace; line-height: 1.5;
}
.practice-result.pass { background: rgba(12,255,12,.06); border: 1px solid rgba(12,255,12,.3); color: var(--green); }
.practice-result.fail { background: rgba(255,60,60,.06); border: 1px solid rgba(255,60,60,.3); color: var(--red); }
.practice-result p { color: var(--text); margin-top: 0.25rem; }
.practice-note { opacity: 0.7; font-style: italic; font-size: 0.75rem; }

.lock-notice {
  margin: 0.75rem 1.5rem 0; padding: 0.625rem 1rem; border-radius: 0.5rem;
  background: rgba(255,222,0,.06); border: 1px solid rgba(255,222,0,.3);
  color: var(--yellow); font-size: 0.8rem; font-family: 'Source Code Pro', monospace;
}

.phase-tab.locked { opacity: 0.5; }
.phase-tab.locked .phase-tab-num, .phase-tab.locked .phase-tab-name { color: var(--text-muted); }

.module-card.locked { opacity: 0.55; }
.module-head-locked { cursor: default; }
.lock-icon { margin-left: auto; flex-shrink: 0; }

.battle-card.locked { opacity: 0.55; }
.battle-card.locked .battle-head { justify-content: space-between; }

/* Full problem statement in the practice modal (Daily/Boss/Olympiad):
   preserve the line breaks in "Problem / Input / Output / Example /
   Constraints" instead of collapsing them into one paragraph. */
#practice-modal-desc {
  white-space: pre-wrap;
  line-height: 1.65;
}
