:root {
  --bg: #07090f;
  --surface: #0c0f1a;
  --card: #111622;
  --card2: #161d2e;
  --border: #1e2a40;
  --border2: #253349;
  --cyan: #00d4ff;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #fbbf24;
  --pink: #ec4899;
  --text: #e2eaf4;
  --muted: #5a7090;
  --dim: #2a3a50;
  --code: #0a0d14;
  --ts-moss: #00ff87;
  --ts-teal: #00d4cc;
  --ts-wire: #143020;
  --ts-card: #0a1510;
}
[data-theme="light"] {
  --bg: #fff;
  --surface: #ffffff;
  --card: #ffffff;
  --card2: #f8fafd;
  --border: #dde4f0;
  --border2: #c8d4e8;
  --cyan: #0284c7;
  --blue: #2563eb;
  --purple: #7c3aed;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --yellow: #ca8a04;
  --pink: #db2777;
  --text: #0f172a;
  --muted: #64748b;
  --dim: #cbd5e1;
  --code: #f1f5f9;
}
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Syne", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  transition:
    background 0.35s,
    color 0.35s;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.018) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.018) 2px, transparent 2px);
  background-size: 52px 52px;
  pointer-events: none;
  z-index: 0;
}
[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(8, 171, 22, 0.04) 2px, transparent 2px),
    linear-gradient(90deg, rgba(152, 219, 6, 0.04) 2px, transparent 2px);
}

.theme-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: all 0.25s;
}
.theme-btn:hover {
  transform: scale(1.1) rotate(12deg);
  border-color: var(--cyan);
}

.shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 12px 40px;
  position: relative;
  z-index: 1;
}

.hdr {
  background: rgba(17, 22, 34, 0.96);
  border: 1px solid rgba(42, 74, 116, 0.8);
  border-radius: 12px;
  padding: 11px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.hdr-brand {
  font-family: "Syne", sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #79eaff;
  letter-spacing: 0.03em;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.hdr-brand span {
  color: var(--text);
  font-weight: 900;
}
.hdr-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.intro-panel {
  border-radius: 10px 0 40px 0;
  padding: 24px 20px;
  margin: 16px 0 18px;
  box-shadow: 0 5px 10px rgba(1, 192, 250, 0.2);
}
[data-theme="dark"] .intro-panel {
  position: relative;
  overflow: hidden;
  border-top: 3px solid #09afeb;
  border-right: 3px solid #09afeb;
  background: linear-gradient(
    135deg,
    rgba(5, 5, 5, 0.94),
    rgba(2, 12, 30, 0.95)
  );
}
[data-theme="dark"] .intro-panel::before {
  content: "";
  position: absolute;
  inset: -20px;
  background:
    radial-gradient(circle at 20% 25%, rgba(0, 7, 31, 0.18), transparent 36%),
    radial-gradient(circle at 80% 70%, rgba(53, 155, 3, 0.15), transparent 35%);
  filter: blur(8px);
  pointer-events: none;
}
.intro-panel .intro-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.intro-panel h1 {
  margin: 0 0 10px;
  font-family: "Syne", sans-serif;
  font-size: 1.35rem;
  font-weight: 900;
  background: linear-gradient(90deg, #016df1 0%, #dbcabd 50%, #edf3f2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
  text-shadow: 0 0 10px rgba(30, 239, 255, 0.1);
}
.intro-panel p {
  margin: 0 0 12px;
  font-family: "Syne", sans-serif;
  font-size: 0.9rem;
  color: rgba(227, 237, 248, 0.94);
  line-height: 1.6;
  max-width: 660px;
}

.btn-start {
  border-top: 1px solid rgba(0, 219, 255, 0.72);
  border-right: 1px solid rgba(0, 219, 255, 0.72);
  background: radial-gradient(circle at top left, #a3dbe1, #0f4f8b);
  color: #030b14;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 2px 0 8px 0;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(38, 39, 39, 0.34);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}
.btn-start:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 220, 255, 0.38);
  filter: brightness(1.1);
}
.intro-steps {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Force 3 columns on desktop */
  gap: 8px;
  list-style: none;
  padding: 0;
}

.intro-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: #def3ff;
  font-size: 0.75rem;
  transition: all 0.3s ease;

}

.intro-steps li:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 212, 255, 0.2);
  border-color: rgba(0, 212, 255, 0.4);
  border-radius: 0 0 4px 0;
}

.intro-steps li strong {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #3b82f6);
  color: #030d17;
  font-weight: 900;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.intro-continue {
  margin: 18px auto 14px;
  font-family: "JetBrains Mono", monospace;
  color: #bcdcff;
  font-size: 0.79rem;
  text-align: center;
  background: rgba(24, 40, 73, 0.62);
  border-top: 1px solid rgba(0, 212, 255, 0.32);
  border-bottom: 3px solid rgba(0, 212, 255, 0.32);
  border-radius: 2px 0 8px 0 8px;
  padding: 8px;
  max-width: 370px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
}
.intro-continue span {
  color: #00d4ff;
  font-weight: 700;
}

[data-theme="light"] .intro-panel {
  border-top: 3px solid #6e6f6f;
  border-right: 3px solid #6e6f6f;
  background: radial-gradient(90deg, #eff3f8 0%, #f9f9f6 50%, #048ec9 100%);
  box-shadow: 0 10px 26px rgba(0, 30, 25, 0.5);
}

[data-theme="light"] .intro-panel h1 {
  background: linear-gradient(90deg, #131819 0%, #717272, #313735, #000);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 10px rgba(44, 129, 184, 0.1);
}
[data-theme="light"] .intro-panel p,
[data-theme="light"] .intro-steps li {
  color: #1a436c;
}
[data-theme="light"] .hdr-brand {
  background: linear-gradient(90deg, #016df1 0%, #dbcabd 50%, #edf3f2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .intro-steps li {
  /* background: radial-gradient(circle at top left, #555757, #e2fcf5, #5c7d9a);*/
  color: #0f172a;
}
[data-theme="light"] .intro-steps li:hover {
  border-color: #0284c7;
  box-shadow: 4px 4px 20px rgba(3, 3, 3, 0.5);
}
[data-theme="light"] .btn-start {
  background: radial-gradient(circle at top left, #1c2f68, #5b6065);
  color: #b9bfc5;
  box-shadow: 0 6px 16px rgba(0, 13, 18, 0.34);
}

[data-theme="light"] .intro-continue {
  background: linear-gradient(145deg, #e6f0fa, #c8dff5);
  color: #030b14;
  padding: 12px 28px;
  border-right: 3px solid rgba(7, 197, 244, 0.4);
  border-top: 2px solid rgba(13, 163, 218, 0.4);
  box-shadow:
    0px 4px 12px rgba(225, 247, 252, 0.3),
    0px 8px 24px rgba(228, 239, 241, 0.3);
}

[data-theme="light"] .hdr {
  background: radial-gradient(circle at top left, #041111, #28292a);
  color: #030b14;
  box-shadow: 0 6px 16px rgba(0, 13, 18, 0.34);
}

/* ═══════════════════════════════════════════
   HEADER - Desktop Layout
   ═══════════════════════════════════════════ */

.hdr {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

/* ────────────────────────────────────────────
   Brand
   ──────────────────────────────────────────── */
.hdr-brand {
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ────────────────────────────────────────────
   Progress Bar Section
   ──────────────────────────────────────────── */
.hdr-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.hdr-progress .prog-track {
  flex: 1;
}

.hdr-progress #prog-pct {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ────────────────────────────────────────────
   Stats Pills - Desktop: VERTICAL COLUMN
   ──────────────────────────────────────────── */
.hdr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2 columns */
  gap: 8px;
  flex-shrink: 0;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  white-space: nowrap;
}

[data-theme="light"] .stat-pill {
  background-color: white;
}

.stat-label {
  color: var(--muted);
  font-size: 0.65rem;
}

.val {
  font-weight: 700;
}
.stat-pill .val {
  font-weight: 700;
  font-size: 0.88rem;
}
.stat-pill .val.orange {
  color: var(--orange);
}
.stat-pill .val.yellow {
  color: var(--yellow);
}
.stat-pill .val.cyan {
  color: var(--cyan);
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: rgba(6, 21, 44, 0.95);
  color: #dbedff;
  border: 1px solid rgba(0, 217, 255, 0.55);
  border-radius: 10px;
  padding: 11px 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(12px);
  animation: toast-in 0.28s ease forwards;
}
.toast-success {
  border-color: rgba(17, 241, 181, 0.7);
  background: linear-gradient(
    140deg,
    rgba(5, 33, 66, 0.88),
    rgba(5, 49, 98, 0.93)
  );
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(14px);
  }
}

.prog-wrap {
  margin-top: 10px;
}
.prog-row {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  color: var(--muted);
  margin-bottom: 5px;
}
.prog-track {
  height: 6px;
  background: var(--dim);
  border-radius: 99px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--purple));
  background-size: 200% 100%;
  animation: pgShimmer 3s ease infinite;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes pgShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.l-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.l-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s;
}
.l-card:hover {
  background: var(--card2);
  border-color: var(--border2);
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}
.l-card:hover::after {
  transform: scaleX(1);
}
.l-card.done {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.04);
}
.l-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.l-card.locked:hover {
  transform: none;
  box-shadow: none;
}
.l-card.active-now {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.15);
}
.l-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.l-icon {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cyan);
}
.l-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}
.l-badge.done {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.l-badge.locked-b {
  background: rgba(90, 112, 144, 0.1);
  color: var(--muted);
  border: 1px solid var(--border);
}
.l-badge.open {
  background: rgba(0, 212, 255, 0.08);
  color: var(--cyan);
  border: 1px solid rgba(0, 212, 255, 0.2);
}
.l-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.l-desc {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.4;
}
.l-steps {
  display: flex;
  gap: 3px;
  margin-top: 10px;
}
.step-dot {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--dim);
  transition: background 0.3s;
}
.step-dot.done {
  background: var(--green);
}
.step-dot.active {
  background: var(--cyan);
}
.step-dot.quiz-done {
  background: var(--purple);
}
.step-dot.code-done {
  background: var(--orange);
}
.step-dot.project-done {
  background: var(--blue);
}

.view {
  display: block;
}
.view.hidden,
.hidden {
  display: none !important;
}

/* Phase tabs — now 4 */
.phase-bar {
  display: flex;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.phase-tab {
  flex: 1;
  padding: 14px 10px;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: all 0.2s;
}
.phase-tab:last-child {
  border-right: none;
}
.phase-tab.active {
  background: rgba(0, 212, 255, 0.08);
  color: var(--cyan);
}
.phase-tab.done-tab {
  color: var(--green);
}
.phase-tab.locked-tab {
  cursor: not-allowed;
  opacity: 0.4;
}
.phase-tab.project-active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--blue);
}
.phase-tab.project-done-tab {
  color: var(--blue);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.2s;
}
.back-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

.phase-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.learn-lesson-hdr {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.learn-icon {
  font-family: "JetBrains Mono", monospace;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--cyan);
}
.learn-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
}
.learn-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.content-block {
  margin-bottom: 24px;
}
.block-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.block-text {
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 10px;
}
.block-text strong {
  color: var(--text);
}
.point-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.point {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.5;
}
.code-wrap {
  background: var(--code);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 12px 0;
}
.code-top {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.code-dots {
  display: flex;
  gap: 5px;
}
.code-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.code-dots .r {
  background: #ff5f57;
}
.code-dots .y {
  background: #febc2e;
}
.code-dots .g {
  background: #28c840;
}
.code-fname {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.2);
}
.code-pre {
  padding: 18px 20px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.75;
  color: #4ade80;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
}
[data-theme="light"] .code-pre {
  color: #166534;
}
[data-theme="light"] .code-wrap {
  background: #f8fafc;
}

.quiz-hdr {
  margin-bottom: 24px;
}
.quiz-q-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.quiz-q-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card2);
  border: 1.5px solid var(--border);
  padding: 14px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.choice:hover {
  background: var(--card);
  border-color: var(--border2);
  transform: translateX(4px);
}
.choice.correct {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.4);
  pointer-events: none;
}
.choice.wrong {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  pointer-events: none;
}
.choice.dim {
  opacity: 0.45;
  pointer-events: none;
}
.choice-letter {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 0.85rem;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: white;
  transition: all 0.2s;
}
.choice.correct .choice-letter {
  background: linear-gradient(135deg, var(--green), #16a34a);
}
.choice.wrong .choice-letter {
  background: linear-gradient(135deg, var(--red), #dc2626);
}
.choice-text {
  font-size: 0.9rem;
  color: var(--text);
}
.feedback-box {
  display: none;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-top: 16px;
}
.feedback-box.show {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.fb-icon {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.6rem;
  font-weight: 700;
  min-width: 40px;
}
.fb-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}
.fb-title.ok {
  color: var(--green);
}
.fb-title.bad {
  color: var(--red);
}
.fb-msg {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

.challenge-hdr {
  margin-bottom: 20px;
}
.challenge-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.challenge-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}
.challenge-task {
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
}
.challenge-task-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.challenge-task-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

/* PROJECT PHASE SPECIFIC */
.project-header {
  margin-bottom: 24px;
}
.project-title-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.project-icon {
  font-size: 2.2rem;
  line-height: 1;
}
.project-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}
.project-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
}
.project-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.project-option {
  background: var(--card2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s;
}
.project-option:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}
.project-option.selected {
  border-color: var(--blue);
  background: rgba(59, 130, 246, 0.08);
}
.project-option-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.project-option-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.project-option-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.project-option-level {
  margin-top: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text);
}
.project-difficulty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 600;
}
.diff-easy {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.diff-medium {
  background: rgba(251, 191, 36, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.diff-hard {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.project-requirements {
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
}
.project-req-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 10px;
}
.project-req-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-req-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}
.req-check {
  color: var(--blue);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.project-bonus {
  background: rgba(251, 191, 36, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.project-bonus-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  color: var(--yellow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.project-bonus-text {
  font-size: 0.83rem;
  color: var(--muted);
}

.project-editor-wrap {
  position: relative;
  margin: 16px 0;
}
.project-editor-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.project-result {
  display: none;
  border-radius: 10px;
  padding: 20px;
  margin-top: 12px;
  border: 1px solid var(--border);
}
.project-result.show {
  display: block;
}
.project-result.pass {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
}
.project-result.fail {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.3);
}
.project-result-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.project-result-icon {
  font-size: 1.3rem;
}
.project-result-title {
  font-weight: 700;
  font-size: 1rem;
}
.project-result.pass .project-result-title {
  color: var(--blue);
}
.project-result.fail .project-result-title {
  color: var(--red);
}
.project-result-body {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* XP badge for project */
.xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2),
    rgba(99, 179, 237, 0.2)
  );
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 5px 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--blue);
  font-weight: 700;
}

.editor-wrap {
  position: relative;
  margin: 16px 0;
}
.editor-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
textarea.code-editor {
  width: 100%;
  min-height: 180px;
  background: var(--code);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.75;
  color: #4ade80;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
[data-theme="light"] textarea.code-editor {
  color: #166534;
  background: #f3f5f7;
}
textarea.code-editor:focus {
  border-color: var(--cyan);
}
textarea.code-editor.checking {
  opacity: 0.7;
  pointer-events: none;
}
textarea.project-editor {
  border-color: rgba(6, 110, 98, 0.3);
}
textarea.project-editor:focus {
  border-color: var(--blue);
}

.ai-result {
  display: none;
  border-radius: 10px;
  padding: 20px;
  margin-top: 12px;
  border: 1px solid var(--border);
}
.ai-result.show {
  display: block;
}
.ai-result.pass {
  background: rgba(34, 197, 94, 0.07);
  border-color: rgba(34, 197, 94, 0.3);
}
.ai-result.fail {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.3);
}
.ai-result-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.ai-result-icon {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.3rem;
  font-weight: 700;
}
.ai-result-title {
  font-weight: 700;
  font-size: 1rem;
}
.ai-result.pass .ai-result-title {
  color: var(--green);
}
.ai-result.fail .ai-result-title {
  color: var(--red);
}
.ai-result-body {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

.thinking {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(0, 212, 255, 0.04);
  border: 1px solid rgba(0, 212, 255, 0.15);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--cyan);
  margin-top: 12px;
}
.thinking.show {
  display: flex;
}
.thinking.project-thinking {
  background: rgba(59, 130, 246, 0.04);
  border-color: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}
.think-dots span {
  animation: blink 1.2s ease infinite;
}
.think-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.think-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: white;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-pink {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: white;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}
.btn-pink:hover {
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
}
.btn-pink:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-cyan {
  background: rgba(0, 212, 255, 0.1);
  color: var(--cyan);
  border: 1.5px solid rgba(0, 212, 255, 0.25);
}
.btn-cyan:hover {
  background: rgba(0, 212, 255, 0.18);
  border-color: rgba(0, 212, 255, 0.5);
}
.btn-ghost {
  background: var(--card2);
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border2);
}
.btn-full {
  width: 100%;
  justify-content: center;
}
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.complete-screen {
  text-align: center;
  padding: 40px 20px;
}
.complete-ascii {
  font-family: "JetBrains Mono", monospace;
  font-size: 3rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 16px;
  line-height: 1;
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.complete-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.complete-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 32px;
}
.complete-rewards {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.reward-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 24px;
  text-align: center;
  min-width: 100px;
}
.reward-val {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.5rem;
  font-weight: 700;
}
.reward-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fade-in {
  animation: fadeUp 0.5s ease both;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════
   📱 RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════ */

/* ────────────────────────────────────────────
   Tablet (≤ 768px) - Compact Layout
   ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .hdr {
    gap: 10px;
    padding: 12px 16px;
    justify-content: flex-start;
  }

  /* Progress bar - Compact size */
  .hdr-progress {
    flex: 0 0 auto;
    width: auto;
    min-width: 140px;
    max-width: 180px;
  }

  .hdr-progress #prog-pct {
    font-size: 0.6rem;
  }

  /* Stats - Compact flex layout */
  .hdr-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }

  .stat-pill {
    padding: 6px 12px;
    gap: 5px;
    font-size: 0.7rem;
    width: fit-content;
    max-width: 150px;
  }

  .stat-label {
    font-size: 0.6rem;
  }
}

/* ────────────────────────────────────────────
   600px Breakpoint - General Mobile Styles
   ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .shell {
    padding: 20px 14px 80px;
  }

  .phase-card {
    padding: 20px;
  }

  .learn-title {
    font-size: 1.3rem;
  }

  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .project-selector {
    grid-template-columns: 1fr;
  }

  .phase-tab {
    font-size: 0.6rem;
    padding: 12px 6px;
  }

  .ai-result-icon,
  .fb-icon {
    font-size: 0.84rem;
  }

  .btn-primary {
    padding: 10px;
    border-radius: 3px;
    font-size: 0.7rem;
  }

  .ascii {
    font-size: 0.8rem;
  }
}

/* ────────────────────────────────────────────
   Mobile (≤ 480px) - Stacked Layout
   ──────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Header Layout */
  .hdr {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .hdr-brand {
    order: 1;
    align-self: flex-start;
    font-size: 1.1rem;
  }

  /* Progress Bar - COMPACT on mobile */
  .hdr-progress {
    order: 2;
    width: 100%;
    max-width: 100%;
    min-width: auto;
    margin-top: -2px;
  }

  .hdr-progress #prog-pct {
    font-size: 0.6rem;
  }

  /* Stats - 2x2 Grid */
  .hdr-stats {
    order: 3;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
  }

  .stat-pill {
    padding: 5px 8px;
    gap: 3px;
    border-radius: 6px;
    font-size: 0.68rem;
    width: 100%;
    max-width: 100%;
  }

  .stat-pill .val {
    font-size: 0.85rem !important;
    font-weight: 600;
  }

  .stat-label {
    font-size: 0.55rem;
    line-height: 1.2;
  }

  /* Lesson View - Text Overflow Fixes */
  .learn-lesson-hdr {
    padding: 12px;
    gap: 10px;
  }

  .learn-title {
    font-size: 1.1rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .learn-sub {
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .learn-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
  }

  .content-block {
    padding: 12px;
  }

  .block-heading {
    font-size: 1rem;
    line-height: 1.3;
    word-wrap: break-word;
  }

  .block-text {
    font-size: 0.85rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .phase-bar {
    padding: 8px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .back-btn {
    font-size: 0.85rem;
    padding: 8px 14px;
  }

  .point-list .point {
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
  }

  /* Container Overflow Fixes */
  body {
    overflow-x: hidden;
  }

  .shell {
    padding: 0 8px;
    overflow-x: hidden;
  }

  #view-lesson {
    padding: 0 8px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .view {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  li,
  span,
  div {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* ────────────────────────────────────────────
   Very Small Phones (≤ 360px)
   ──────────────────────────────────────────── */
@media (max-width: 360px) {
  .hdr {
    padding: 8px 10px;
    gap: 6px;
  }

  .hdr-brand {
    font-size: 1rem;
  }

  .hdr-stats {
    gap: 5px;
  }

  .stat-pill {
    padding: 4px 6px;
    gap: 2px;
    border-radius: 5px;
    font-size: 0.65rem;
  }

  .stat-pill .val {
    font-size: 0.8rem !important;
  }

  .stat-label {
    font-size: 0.5rem;
  }

  .hdr-progress #prog-pct {
    font-size: 0.55rem;
  }

  /* Lesson View */
  .learn-title {
    font-size: 1rem;
  }

  .learn-sub {
    font-size: 0.8rem;
  }

  .block-heading {
    font-size: 0.95rem;
  }

  .block-text {
    font-size: 0.8rem;
  }

  .phase-tab {
    font-size: 0.7rem;
    padding: 6px 10px;
  }
}
/* ═══════════════════════════════════════════
   INTRO STATS SECTION
   ═══════════════════════════════════════════ */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
  justify-content: flex-start;
  max-width: 690px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--border);
  border-bottom: 3px solid rgba(7, 206, 246, 0.2);
  border-right: 2px solid rgba(214, 241, 246, 0.2);
  padding: 6px 12px;
  border-radius: 2px 0 4px 0;
  font-family: "JetBrains Mono", monospace;
  transition: all 0.25s ease;
  cursor: default;
  width: fit-content; /* DON'T STRETCH */
  flex: 0 0 auto; /* DON'T GROW */
}

.stat:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
  box-shadow: 0 4px 12px rgba(209, 224, 227, 0.15);
}

.stat-val {
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
}

.stat-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}

/* Special styling for "by Ruth" */
.stat:last-child {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.1),
    rgba(236, 72, 153, 0.08)
  );
  border-color: rgba(139, 92, 246, 0.3);
}

.stat:last-child .stat-val {
  color: var(--purple);
  font-size: 0.75rem;
}

.stat:last-child .stat-label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.72rem;
}

.stat:last-child:hover {
  border-color: var(--purple);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* Light mode */
[data-theme="light"] .stat {
  background: #1f3240;
}

[data-theme="light"] .stat:last-child {
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.2),
    rgba(28, 44, 125, 0.6)
  );
  border-color: rgba(124, 58, 237, 0.25);
}

/* Mobile */
@media (max-width: 600px) {
  .stats {
    gap: 6px;
    margin: 10px 0 14px;
    max-width: 100%;
  }

  .stat {
    padding: 5px 10px;
    gap: 5px;
  }

  .stat-val {
    font-size: 0.82rem;
  }

  .stat-label {
    font-size: 0.62rem;
  }

  .stat:last-child .stat-val {
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  .stats {
    gap: 5px;
  }

  .stat {
    padding: 4px 8px;
    gap: 4px;
  }

  .stat-val {
    font-size: 0.78rem;
  }

  .stat-label {
    font-size: 0.58rem;
  }
}

@media (max-width: 480px) {
  .intro-steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .intro-steps li {
    padding: 10px 12px;
    font-size: 0.78rem;
  }

  .intro-steps li strong {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.7rem;
  }
}
@media (max-width: 768px) {
  .intro-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile - 1 column */
@media (max-width: 480px) {
  .intro-steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .intro-steps li {
    padding: 10px 12px;
    font-size: 0.78rem;
  }

  .intro-steps li strong {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.7rem;
  }
}
/* ═══════════════════════════════════════════════
       SECTION WRAPPER  (matches your .shell width)
    ═══════════════════════════════════════════════ */
.extra-projects-section {
  max-width: 1160px;
  margin: 0 auto;
  padding: 4rem 1.25rem 6rem;
}

/* ─── Header ─────────────────────────────────── */
.ep-header {
  text-align: center;
  margin-bottom: 2.75rem;
}

.ep-header-label {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.22rem 0.75rem;
  margin-bottom: 0.8rem;
  transition: background 0.25s;
}

[data-theme="light"] .ep-header-label {
  background: var(--accent-dim);
}

.ep-title {
  font-family: "Syne", sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 0.5rem;
  transition: color 0.25s;
}

.ep-subtitle {
  color: var(--fg-muted);
  font-size: 0.82rem;
  margin-bottom: 1.1rem;
  transition: color 0.25s;
}

.ep-meta {
  display: flex;
  gap: 0.55rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.ep-meta-pill {
  font-size: 0.68rem;
  background: var(--card-bg);
  color: var(--cyan);
  border: 1px solid var(--border);
  padding: 0.22rem 0.65rem;
  border-radius: 2px;
  transition:
    background 0.25s,
    color 0.25s,
    border-color 0.25s;
}

/* ─── Filters ────────────────────────────────── */
.ep-filters {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  flex-wrap: wrap;
}

.ep-filter {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid transparent ;
  border-bottom: 4px solid rgba(36, 107, 222, 0.5);
  border-right: 2px solid rgba(36, 107, 222, 0.5);
  background: rgba(6, 96, 78, 0.15);
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 2px;
}

.ep-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ep-filter.active {
  background: var(--accent);
  color:white;
  border-color: rgb(119, 68, 155);
  font-weight: 600;
}

[data-theme="light"] .ep-filter.active {
  color: black;
  background: rgb(211, 193, 234);
  
}

/* ─── Grid ───────────────────────────────────── */
.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1rem;
}

/* ─── Card ───────────────────────────────────── */
.ep-card {
  background: var(--card-bg);
  box-shadow: 4px 4px 10px rgba(9, 227, 239, 0.1);
  border-right: 1px solid rgb(64, 28, 80);
  border-radius: 4px;
  padding: 1.2rem 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.2s,
    transform 0.2s,
    background 0.25s,
    box-shadow 0.2s;
}
[daata-theme="light"] .ep-card {
  box-shadow: 4px 4px 10px rgba(20, 19, 19, 0.1);
  border-right: 1px solid rgb(78, 222, 12);
}
.ep-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.ep-card:hover {
  border-color: var(--card-hover);
  background: var(--card-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(50, 46, 46, 0.15);
}

[data-theme="light"] .ep-card:hover {
  box-shadow: 0 12px 24px rgba(4, 129, 245, 0.08);
}

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

.ep-card.ep-hidden {
  display: none;
}

/* card internals */
.ep-card-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.ep-card-num {
  font-size: 0.62rem;
  color: var(--fg-dim);
  border: 1px solid var(--border);
  padding: 0.1rem 0.38rem;
  border-radius: 2px;
  transition:
    color 0.25s,
    border-color 0.25s;
}

.ep-card-difficulty {
  font-size: 0.6rem;
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
  margin-left: auto;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ep-diff-medium {
  background: var(--accent-dim);
  color: var(--accent);
}

.ep-diff-hard {
  background: var(--red-dim);
  color: var(--red);
}

.ep-card-title {
  font-family: "Syne", sans-serif;
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
  transition: color 0.25s;
}

.ep-card-goal {
  font-size: 0.73rem;
  color: var(--cyan);
  transition: color 0.25s;
}

.ep-card-desc {
  font-size: 0.73rem;
  color: var(--fg-muted);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.25s;
}

.ep-card-reqs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.ep-req-tag {
  font-size: 0.6rem;
  background: var(--purple-dim);
  color: var(--purple);
  border: 1px solid rgba(167, 139, 250, 0.2);
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
  transition:
    background 0.25s,
    color 0.25s;
}

.ep-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.2rem;
  gap: 0.5rem;
}

.ep-example-label {
  font-size: 0.6rem;
  color: var(--fg-dim);
  margin-bottom: 0.18rem;
  transition: color 0.25s;
}

.ep-example-val {
  font-size: 0.68rem;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.18);
  padding: 0.13rem 0.45rem;
  border-radius: 2px;
  transition:
    color 0.25s,
    background 0.25s;
}

[data-theme="light"] .ep-example-val {
  border-color: rgba(21, 128, 61, 0.2);
}

.ep-open-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.38rem 0.9rem;
  cursor: pointer;
  border-radius: 2px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    opacity 0.15s,
    background 0.25s;
  flex-shrink: 0;
}

.ep-open-btn:hover {
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════
       MODAL
    ═══════════════════════════════════════════════ */
.ep-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

[data-theme="light"] .ep-modal-overlay {
  background: rgba(15, 23, 42, 0.35);
}

.ep-modal-overlay.open {
  display: flex;
}

.ep-modal {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px var(--border),
    0 12px 32px rgba(0, 0, 0, 0.25);
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.75rem;
  position: relative;
  animation: ep-slide-in 0.18s ease;
  transition:
    background 0.25s,
    border-color 0.25s;
}

@keyframes ep-slide-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ep-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 0.22rem 0.55rem;
  cursor: pointer;
  border-radius: 2px;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.ep-modal-close:hover {
  border-color: var(--red);
  color: var(--red);
}

.ep-modal h3 {
  font-family: "Syne", sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--fg);
  margin: 0 0 0.3rem;
  padding-right: 5.5rem;
  line-height: 1.3;
  transition: color 0.25s;
}

.ep-modal-goal {
  font-size: 0.78rem;
  color: var(--cyan);
  margin-bottom: 1rem;
  transition: color 0.25s;
}

.ep-modal-section-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 1.1rem 0 0.45rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.28rem;
  transition:
    color 0.25s,
    border-color 0.25s;
}

.ep-modal-desc {
  font-size: 0.77rem;
  color: var(--fg-muted);
  line-height: 1.7;
  transition: color 0.25s;
}

.ep-modal-reqs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ep-modal-reqs-list li {
  font-size: 0.76rem;
  color: var(--fg);
  padding-left: 1.1rem;
  position: relative;
  line-height: 1.5;
  transition: color 0.25s;
}

.ep-modal-reqs-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.ep-modal-example {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  padding: 0.7rem 1rem;
  font-size: 0.77rem;
  color: var(--green);
  white-space: pre;
  border-radius: 2px;
  overflow-x: auto;
  transition:
    background 0.25s,
    color 0.25s,
    border-color 0.25s;
}

.ep-modal-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.ep-modal-tag {
  font-size: 0.62rem;
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.18);
  padding: 0.13rem 0.5rem;
  border-radius: 2px;
  transition:
    background 0.25s,
    color 0.25s;
}

[data-theme="light"] .ep-modal-tag {
  border-color: rgba(14, 116, 144, 0.2);
}

.ep-modal-diff-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 2px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.ep-modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.ep-modal-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.73rem;
  padding: 0.5rem 1.1rem;
  border-radius: 2px;
  cursor: pointer;
  font-weight: 700;
  transition: opacity 0.15s;
  border: none;
}

.ep-modal-btn-primary {
  background: var(--accent);
  color: #000;
}

.ep-modal-btn-secondary {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border) !important;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.ep-modal-btn-secondary:hover {
  border-color: var(--fg-muted) !important;
  color: var(--fg);
}

.ep-modal-btn:hover {
  opacity: 0.82;
}

/* ── progress bar in modal ── */
.ep-modal-progress {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin: 0.6rem 0;
  overflow: hidden;
}

.ep-modal-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* count badge */
.ep-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--fg-muted);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  margin-bottom: 1.2rem;
  transition:
    background 0.25s,
    border-color 0.25s;
}

.ep-count-badge strong {
  color: var(--accent);
}

/* ── Theme transition helper ── */
body.theme-transitioning * {
  transition:
    background 0.25s,
    color 0.25s,
    border-color 0.25s !important;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
