:root {
  --bg-primary: #111927;
  --bg-secondary: #1a2332;
  --bg-card: #1e2d3d;
  --bg-input: #243447;
  --accent: #9fef00;
  --accent-hover: #7bc200;
  --accent-dim: rgba(159, 239, 0, 0.1);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #2d3f50;
  --danger: #ff4444;
  --success: #9fef00;
  --warning: #ffb800;
  --info: #00b4d8;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

#main-wrapper {
  flex: 1;
  padding-top: 50px;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* Navbar */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 2.5rem;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.navbar-brand span[style*="background-clip"] {
  font-size: 1.25rem;
  font-weight: 800;
}

.navbar-brand:hover { opacity: 0.85; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a:not(.btn) {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--accent);
  color: #000000;
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #111927;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-dim);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-input);
}

.card-body { padding: 1.2rem; }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.card-text { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }

/* Grid */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-3 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Badge */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-beginner { background: rgba(0, 180, 216, 0.15); color: var(--info); }
.badge-intermediate { background: rgba(255, 184, 0, 0.15); color: var(--warning); }
.badge-advanced { background: rgba(255, 68, 68, 0.15); color: var(--danger); }
.badge-success { background: rgba(159, 239, 0, 0.15); color: var(--success); }
.badge-active { background: rgba(159, 239, 0, 0.15); color: var(--success); }
.badge-upcoming { background: rgba(0, 180, 216, 0.15); color: var(--info); }
.badge-ended { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

/* Progress bar */
.progress-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent), #00b4d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Section */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover, .filter-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* Module list */
.module-list { list-style: none; }
.module-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.module-item:last-child { border-bottom: none; }
.module-item:hover { background: var(--bg-input); }

.module-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.module-number.done {
  background: var(--accent-dim);
  color: var(--accent);
}

.module-info { flex: 1; }
.module-title { font-weight: 600; font-size: 0.95rem; }
.module-desc { color: var(--text-muted); font-size: 0.85rem; }

/* Course detail layout */
.course-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

/* Stats row */
.stats-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Leaderboard */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.leaderboard-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table tr:hover td {
  background: var(--bg-input);
}

.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

/* Content area (markdown) */
.content-area {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.content-area h1, .content-area h2, .content-area h3 { margin: 1.5rem 0 0.8rem; }
.content-area h1 { font-size: 1.8rem; }
.content-area h2 { font-size: 1.4rem; }
.content-area h3 { font-size: 1.2rem; }
.content-area p { margin-bottom: 1rem; color: var(--text-secondary); }
.content-area pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.content-area code {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
}

.content-area :not(pre) > code {
  background: var(--bg-input);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.content-area ul, .content-area ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.content-area table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.content-area th, .content-area td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.content-area th { background: var(--bg-input); }

/* Lab section */
.lab-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.lab-section h3 {
  color: var(--accent);
  margin-bottom: 1rem;
}

.flag-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.flag-form input {
  flex: 1;
  font-family: 'Fira Code', monospace;
}

/* Alert */
.alert {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success { background: rgba(159, 239, 0, 0.1); color: var(--success); border: 1px solid rgba(159, 239, 0, 0.3); }
.alert-error { background: rgba(255, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(255, 68, 68, 0.3); }
.alert-info { background: rgba(0, 180, 216, 0.1); color: var(--info); border: 1px solid rgba(0, 180, 216, 0.3); }

/* Auth forms */
.auth-container {
  max-width: 440px;
  margin: 4rem auto;
  padding: 0 1rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

/* Why section */
.why-section {
  padding: 5rem 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.why-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, var(--accent), #00b4d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.why-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  text-align: center;
}

.why-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(159,239,0,0.1);
}

.why-illustration {
  width: 100%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 2rem 1rem;
}

.why-illustration svg {
  width: 160px;
  height: 130px;
}

.why-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 1.2rem 1.5rem 0.6rem;
}

.why-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  padding: 0 1.5rem 1.8rem;
}

@media (max-width: 768px) {
  .why-grid { grid-template-columns: 1fr; }
  .why-title { font-size: 1.5rem; }
}

/* Testimonials */
.testimonials-section {
  padding: 4rem 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.testimonials-slider {
  position: relative;
}

.testimonials-viewport {
  overflow: hidden;
}

.testimonials-track {
  display: flex;
  gap: 1.5rem;
  transition: transform 0.5s ease;
}

.testimonial-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  flex: 0 0 calc((100% - 3rem) / 3);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.testimonial-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(159,239,0,0.08);
}

.testimonial-quote {
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
  font-family: Georgia, serif;
  opacity: 0.6;
}

.testimonial-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  flex: 1;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: auto;
}

.testimonial-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #00c896);
  color: #0f1923;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.testimonial-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.testimonial-role {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.testimonials-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.testimonials-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.testimonials-dots .dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

@media (max-width: 768px) {
  .testimonial-card { flex: 0 0 100%; }
}

/* Footer */
.footer {
  margin-top: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-bottom: 1rem;
}

.footer-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.7;
  margin-bottom: 1.2rem;
}

.footer-socials {
  display: flex;
  gap: 0.6rem;
}

.social-link {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.social-link:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-col ul li a {
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: color 0.2s;
}

.footer-col ul li a:hover {
  color: var(--accent);
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 0.8rem !important;
}

.footer-contact li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-contact li svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}

.footer-contact li a {
  color: var(--text-muted);
}

.footer-contact li a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1.2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-bottom-links {
  display: flex;
  gap: 1.5rem;
}

.footer-bottom-links a {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-bottom-links a:hover {
  color: var(--accent);
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
}

/* Challenge cards */
.challenge-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.challenge-card.solved {
  border-color: var(--accent);
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.challenge-points {
  font-weight: 700;
  color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 1.8rem; }
  .container { padding: 1rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .course-detail-grid { grid-template-columns: 1fr; }
  .course-detail-grid .card { position: static !important; }
  .flag-form { flex-direction: column; }
  .leaderboard-table th, .leaderboard-table td { padding: 0.6rem 0.5rem; font-size: 0.85rem; }
  .content-area { padding: 1.2rem; }
}

@media (max-width: 480px) {
  .hero { padding: 2rem 1rem; }
  .hero h1 { font-size: 1.4rem; }
  .stats-row { flex-direction: column; }
}
