:root {
  color-scheme: light;
  --paper: #fcfbfa;
  --paper-2: #f3efe6;
  --ink: #172422;
  --muted: #53625f;
  --line: #e2dcce;
  --card: rgba(255, 255, 255, 0.95);
  
  --green: #0d836e;
  --green-2: #075244;
  --green-soft: #e2f4ef;
  
  --orange: #ff6f2c;
  --orange-soft: #fff0e7;
  
  --yellow: #ffd053;
  --yellow-soft: #fdf5d3;
  
  --blue: #4a8df8;
  --blue-soft: #edf4fe;
  
  --red: #d9544f;
  --red-soft: #fcebeb;
  
  --shadow: 0 12px 30px rgba(23, 36, 34, 0.05), 0 2px 8px rgba(23, 36, 34, 0.03);
  --shadow-lg: 0 20px 40px rgba(23, 36, 34, 0.1);
  --radius: 20px;
  
  --mono: 'JetBrains Mono', "SFMono-Regular", Consolas, monospace;
  
  --header-bg: rgba(252, 251, 250, 0.88);
  --grid-color: rgba(23, 36, 34, 0.025);
  --hover-bg: rgba(23, 36, 34, 0.04);
  --input-bg: rgba(255, 255, 255, 0.8);
  --filter-bg: rgba(255, 255, 255, 0.6);
  --card-shadow: 0 7px 30px rgba(23, 36, 34, 0.04);
  --card-index-color: rgba(23, 36, 34, 0.045);
  
  --note-bg: #fff1b9;
  --note-border: #e2c779;
  --note-text: #7a5b16;
  
  --step-bg: #fbf9f4;
  --viz-bg: #faf8f3;
  --viz-grid: rgba(23, 36, 34, 0.03);
  --btn-bg: #ffffff;
  --cell-shadow: 0 4px 0 rgba(23, 36, 34, 0.05);
  
  --node-bg: #ffffff;
  --node-frontier-bg: #fff1bb;
  --node-frontier-stroke: #bc8a15;
  --node-active-stroke: #a74319;
}


* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, rgba(229, 107, 50, 0.03), transparent 26rem),
    radial-gradient(circle at 94% 18%, rgba(20, 107, 92, 0.03), transparent 28rem),
    var(--paper);
  font-family: 'Plus Jakarta Sans', Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.55;
  transition: background-color 300ms ease, color 300ms ease;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(var(--grid-color) 1px, transparent 1px);
  background-size: 100% 28px;
  content: "";
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  transition: background-color 300ms ease, border-color 300ms ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 36px));
  height: 68px;
  margin: auto;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: white;
  background: var(--green);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  font-family: var(--mono);
  font-size: 13px;
  place-items: center;
}

.brand-mark .lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.icon-link,
.control-btn {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.icon-link .lucide,
.control-btn .lucide,
.open-arrow .lucide {
  width: 15px;
  height: 15px;
  stroke-width: 2.4;
}

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

.header-link {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.header-link:hover {
  color: var(--ink);
  background: var(--hover-bg);
}

.container {
  width: min(1180px, calc(100% - 36px));
  margin: auto;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.65fr);
  gap: 50px;
  align-items: end;
  padding: 92px 0 62px;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 28px;
  height: 3px;
  border-radius: 10px;
  background: var(--orange);
  content: "";
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.home-hero h1 {
  max-width: 820px;
  margin-bottom: 24px;
  font-size: clamp(44px, 7.5vw, 86px);
  font-weight: 850;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.accent-word {
  position: relative;
  color: var(--green);
  white-space: nowrap;
}

.accent-word::after {
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 2px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  content: "";
  opacity: 0.75;
  transform: rotate(-1.5deg);
}

.hero-copy {
  max-width: 680px;
  color: var(--muted);
  font-size: 19px;
}

.hero-note {
  position: relative;
  padding: 28px;
  border: 1px solid var(--note-border);
  border-radius: 6px 6px 18px 6px;
  background: var(--note-bg);
  color: var(--note-text);
  box-shadow: 8px 10px 0 rgba(70, 58, 30, 0.08);
  transform: rotate(1.2deg);
}

.hero-note::before {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 72px;
  height: 24px;
  background: rgba(255, 255, 255, 0.58);
  content: "";
  transform: translateX(-50%) rotate(-2deg);
}

.note-label {
  margin-bottom: 12px;
  color: #7a5b16;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-note p:last-child {
  margin-bottom: 0;
  font-size: 17px;
  font-weight: 700;
}

.study-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  margin-bottom: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.study-stat {
  padding: 24px 28px;
}

.study-stat + .study-stat {
  border-left: 1px solid var(--line);
}

.study-stat strong {
  display: block;
  margin-bottom: 3px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.study-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.catalog {
  padding-bottom: 100px;
}

.catalog-head {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 26px;
}

.catalog h2 {
  margin-bottom: 6px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.catalog-sub {
  margin-bottom: 0;
  color: var(--muted);
}

.search-wrap {
  position: relative;
  width: min(370px, 100%);
}

.search-wrap svg {
  position: absolute;
  top: 50%;
  left: 16px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: var(--input-bg);
  transition: all 200ms ease;
}

.search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 18px;
  scrollbar-width: none;
}

.filter {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--filter-bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition: all 200ms ease;
}

.filter:hover,
.filter.active {
  border-color: var(--green);
  color: #ffffff;
  background: var(--green);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.topic-card {
  position: relative;
  display: flex;
  min-height: 260px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--card-shadow);
  flex-direction: column;
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1), border-color 250ms ease;
}

.topic-card:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card-index {
  position: absolute;
  top: 6px;
  right: 14px;
  color: var(--card-index-color);
  font-size: 62px;
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
}

.card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 26px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--green-2);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.pill.orange {
  color: #91431e;
  background: var(--orange-soft);
}

.topic-card h3 {
  margin-bottom: 9px;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.topic-card p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.open-arrow {
  display: grid;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  place-items: center;
  transition: transform 180ms ease;
}

.topic-card:hover .open-arrow {
  transform: translateX(3px);
}

.empty-state {
  display: none;
  padding: 42px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* Topic pages */
.topic-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 46px;
  width: min(1240px, calc(100% - 36px));
  margin: 36px auto 100px;
}

.topic-sidebar {
  position: sticky;
  top: 98px;
  height: calc(100vh - 126px);
  overflow-y: auto;
  padding-right: 8px;
}

.sidebar-label {
  margin: 0 0 10px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.syllabus-nav {
  display: grid;
  gap: 3px;
}

.syllabus-link {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.syllabus-link span {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 10px;
  place-items: center;
}

.syllabus-link:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.syllabus-link.active {
  color: white;
  background: var(--green);
}

.syllabus-link.active span {
  border-color: rgba(255, 255, 255, 0.35);
}

.topic-main {
  min-width: 0;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.breadcrumbs a:hover {
  color: var(--green);
}

.topic-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 36px;
  align-items: end;
  margin-bottom: 44px;
}

.topic-kicker {
  margin-bottom: 12px;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topic-hero h1 {
  margin-bottom: 18px;
  font-size: clamp(43px, 7vw, 76px);
  font-weight: 880;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.topic-deck {
  max-width: 750px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}

.complexity-stamp {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--hover-bg);
}

.stamp-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.stamp-value {
  display: block;
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 850;
}

.stamp-space {
  display: block;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.memory-hook {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 28px;
  padding: 20px 24px;
  border: 1px solid var(--note-border);
  border-radius: 18px;
  background: var(--note-bg);
  color: var(--note-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.hook-icon {
  display: grid;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  color: var(--note-text);
  background: var(--hover-bg);
  font-size: 24px;
  place-items: center;
}

.hook-icon .lucide {
  width: 25px;
  height: 25px;
}

.memory-hook small {
  display: block;
  margin-bottom: 2px;
  color: var(--note-text);
  opacity: 0.8;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.memory-hook strong {
  font-size: 17px;
}

.content-card {
  margin-bottom: 24px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 9px 35px rgba(42, 48, 43, 0.045);
}

.section-heading {
  display: flex;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

.section-number {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: white;
  background: var(--orange);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  place-items: center;
}

.section-heading h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.035em;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.lead {
  color: #43504d;
  font-size: 17px;
  line-height: 1.7;
}

.algorithm-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 26px;
  counter-reset: steps;
}

.algorithm-step {
  position: relative;
  min-height: 150px;
  padding: 48px 17px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--step-bg);
  counter-increment: steps;
}

.algorithm-step::before {
  position: absolute;
  top: 14px;
  left: 16px;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 850;
  content: "0" counter(steps);
}

.algorithm-step p {
  margin: 0;
  font-size: 13px;
}

.visualizer-card {
  padding: 0;
  overflow: hidden;
}

.visualizer-head {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.visualizer-head h2 {
  margin-bottom: 3px;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.visualizer-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.live-badge {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--green-2);
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(20, 107, 92, 0.12);
  content: "";
}

.viz-workspace {
  min-height: 420px;
  padding: 28px;
  background:
    linear-gradient(var(--viz-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--viz-grid) 1px, transparent 1px),
    var(--viz-bg);
  background-size: 24px 24px;
}

.viz-caption {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: 74px;
  padding: 17px 20px;
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: all 200ms ease;
}

.step-count {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 7px;
  color: var(--green-2);
  background: var(--green-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.viz-caption p {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.viz-stage {
  display: grid;
  min-height: 276px;
  align-items: center;
  padding: 24px 0 12px;
}

.viz-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  background: var(--card);
  transition: background-color 300ms ease, border-color 300ms ease;
}

.control-btn {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--btn-bg);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: all 200ms ease;
}

.control-btn:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green);
  background: var(--hover-bg);
}

.control-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.control-btn.primary {
  min-width: 88px;
  border-color: var(--green);
  color: #ffffff;
  background: var(--green);
}

.control-btn.primary:hover:not(:disabled) {
  color: #ffffff;
  background: var(--green-2);
}

.viz-progress {
  height: 5px;
  margin-left: auto;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-2);
  flex: 1 1 140px;
  max-width: 230px;
}

.viz-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 220ms ease;
}

.array-editor {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.array-editor input {
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--input-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  flex: 1;
}

.array-editor input:focus {
  border-color: var(--green);
}

.array-cells {
  display: flex;
  gap: 8px;
  align-items: end;
  justify-content: center;
  min-height: 154px;
}

.array-cell-wrap {
  min-width: 48px;
  text-align: center;
}

.array-pointer {
  height: 26px;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 900;
}

.array-cell {
  display: grid;
  width: 48px;
  height: 58px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--ink);
  box-shadow: var(--cell-shadow);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 850;
  place-items: center;
  transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.array-index {
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.array-cell.active {
  border-color: var(--orange);
  background: var(--orange-soft);
  transform: translateY(-7px);
}

.array-cell.pivot {
  border-color: var(--blue);
  color: white;
  background: var(--blue);
}

.array-cell.sorted,
.array-cell.found {
  border-color: var(--green);
  color: white;
  background: var(--green);
}

.array-cell.dim {
  opacity: 0.22;
}

.split-labels {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 15px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.graph-svg {
  width: 100%;
  height: 250px;
  overflow: visible;
}

.graph-edge {
  stroke: var(--line);
  stroke-linecap: round;
  stroke-width: 3;
  transition: stroke 200ms ease, stroke-width 200ms ease, filter 200ms ease;
}

.graph-edge.active {
  stroke: var(--orange);
  stroke-width: 5;
  filter: drop-shadow(0 0 6px var(--orange));
}

.graph-edge.accepted {
  stroke: var(--green);
  stroke-width: 5;
  filter: drop-shadow(0 0 6px var(--green));
}

.graph-edge.rejected {
  stroke: var(--red);
  stroke-dasharray: 6 7;
}

.edge-weight-bg {
  fill: var(--viz-bg);
  stroke: var(--line);
  transition: fill 300ms ease, stroke 300ms ease;
}

.edge-weight {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 850;
  text-anchor: middle;
}

.graph-node circle {
  fill: var(--node-bg);
  stroke: var(--ink);
  stroke-width: 2.5;
  transition: fill 250ms ease, stroke 250ms ease, stroke-width 250ms ease, filter 250ms ease;
}

.graph-node text {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 850;
  pointer-events: none;
  text-anchor: middle;
}

.graph-node.visited circle {
  fill: var(--green-soft);
  stroke: var(--green);
}

.graph-node.active circle {
  fill: var(--orange);
  stroke: var(--node-active-stroke);
  filter: drop-shadow(0 0 8px var(--orange));
}

.graph-node.active text {
  fill: #ffffff; /* keep text white on active orange node */
}

.graph-node.frontier circle {
  fill: var(--node-frontier-bg);
  stroke: var(--node-frontier-stroke);
  filter: drop-shadow(0 0 6px var(--yellow));
}

.graph-node.rejected circle {
  fill: var(--red-soft);
  stroke: var(--red);
}

.distance-label {
  fill: var(--green);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  text-anchor: middle;
}

.structure-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  transition: background-color 300ms ease, border-color 300ms ease;
}

.structure-label {
  min-width: 74px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.token {
  display: inline-grid;
  min-width: 29px;
  height: 29px;
  padding: 0 7px;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 850;
  place-items: center;
}

.token.muted {
  color: var(--muted);
  background: var(--paper-2);
}

.token.orange {
  background: var(--orange);
}

.matrix-scroll {
  overflow-x: auto;
  padding: 6px 2px 12px;
}

.dp-table {
  border-spacing: 5px;
  margin: auto;
  border-collapse: separate;
  font-family: var(--mono);
  font-size: 11px;
}

.dp-table th {
  min-width: 35px;
  height: 27px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.dp-table td {
  min-width: 39px;
  height: 35px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--btn-bg);
  font-weight: 750;
  text-align: center;
  transition: all 160ms ease;
}

.dp-table td.done {
  color: var(--green);
  background: var(--green-soft);
}

.dp-table td.active {
  border-color: var(--orange);
  color: var(--ink);
  background: var(--orange-soft);
  box-shadow: 0 0 0 2px var(--orange-soft);
}

.dp-table td.source {
  border-color: var(--yellow);
  background: var(--yellow-soft);
}

.dp-table td.blank {
  border-color: transparent;
  background: transparent;
}

.dp-table th.phase-header {
  color: var(--orange);
  font-weight: 850;
}

.dp-table td.phase-cell {
  background: var(--paper-2);
  opacity: 0.85;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 540px;
  margin: 20px auto;
}

.time-slot {
  min-height: 94px;
  padding: 12px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--hover-bg);
  text-align: center;
  transition: all 180ms ease;
}

.time-slot.filled {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-soft);
}

.time-slot.active {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.slot-number {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.job-name {
  display: block;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 900;
}

.job-profit {
  color: var(--muted);
  font-size: 11px;
}

.jobs-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  overflow-x: auto;
  padding: 5px;
}

.job-card {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--btn-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
}

.job-card.active {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.job-card.done {
  opacity: 0.4;
}

.flow-total,
.route-total {
  position: absolute;
  top: 0;
  right: 0;
  padding: 7px 11px;
  border-radius: 9px;
  color: white;
  background: var(--green);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
}

.graph-wrap {
  position: relative;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 20px;
}

.code-block {
  position: relative;
  min-height: 100%;
  margin: 0;
  padding: 24px;
  overflow-x: auto;
  border-radius: 17px;
  color: #e8f2ee;
  background: #172724;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  tab-size: 2;
  white-space: pre;
}

.code-block::before {
  display: block;
  margin-bottom: 17px;
  color: #7ea99d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  content: "PSEUDOCODE";
}

.worked-example {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--step-bg);
}

.worked-example h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.worked-example p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.complexity-table {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  border-collapse: separate;
  border-spacing: 0;
}

.complexity-table th,
.complexity-table td {
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.complexity-table tr:last-child th,
.complexity-table tr:last-child td {
  border-bottom: 0;
}

.complexity-table th {
  width: 33%;
  color: var(--muted);
  background: var(--step-bg);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.complexity-table td {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 850;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.exam-note {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--step-bg);
}

.exam-note h3 {
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.exam-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.exam-note.warning {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.recall {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px solid var(--yellow);
  border-radius: 15px;
  background: var(--yellow-soft);
}

.recall h3 {
  margin-bottom: 9px;
  font-size: 14px;
}

.recall p {
  margin-bottom: 14px;
}

.answer {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
}

.answer.visible {
  display: block;
}

.topic-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}

.page-link {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--hover-bg);
}

.page-link:last-child {
  text-align: right;
}

.page-link small {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-link small .lucide,
.page-link strong .lucide {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
}

.page-link:last-child small {
  justify-content: flex-end;
}

.page-link strong {
  font-size: 14px;
}

.page-link:hover {
  border-color: var(--green);
  background: white;
}

.site-footer {
  padding: 32px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1000px) {
  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-shell {
    display: block;
  }

  .topic-sidebar {
    display: none;
  }

  .algorithm-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .header-inner,
  .container,
  .topic-shell {
    width: min(100% - 24px, 1180px);
  }

  .header-link {
    display: none;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 62px 0 45px;
  }

  .home-hero h1 {
    font-size: clamp(43px, 14vw, 66px);
  }

  .hero-note {
    max-width: 390px;
  }

  .study-strip {
    grid-template-columns: 1fr;
  }

  .study-stat + .study-stat {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .catalog-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search-wrap {
    width: 100%;
  }

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

  .topic-shell {
    margin-top: 24px;
  }

  .topic-hero {
    grid-template-columns: 1fr;
  }

  .complexity-stamp {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .stamp-space {
    margin: 0;
    padding: 0;
    border: 0;
    align-self: end;
  }

  .content-card {
    padding: 22px;
  }

  .visualizer-card {
    padding: 0;
  }

  .visualizer-head,
  .viz-controls {
    padding: 18px;
  }

  .viz-workspace {
    min-height: 390px;
    padding: 18px;
  }

  .array-cells {
    gap: 5px;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .array-cell-wrap {
    min-width: 42px;
  }

  .array-cell {
    width: 42px;
    height: 52px;
  }

  .control-btn span {
    display: none;
  }

  .control-btn.primary span {
    display: inline;
  }

  .two-column,
  .exam-grid {
    grid-template-columns: 1fr;
  }

  .recall {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .algorithm-steps {
    grid-template-columns: 1fr;
  }

  .topic-pagination {
    grid-template-columns: 1fr;
  }

  .page-link:last-child {
    text-align: left;
  }

  .memory-hook {
    grid-template-columns: 1fr;
  }

  .hook-icon {
    width: 42px;
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.viz-scrubber {
  min-width: 100px;
  height: 5px;
  margin-left: auto;
  border-radius: 999px;
  outline: none;
  background: var(--paper-2);
  cursor: pointer;
  accent-color: var(--orange);
  flex: 1 1 180px;
}

.speed-select {
  height: 40px;
  padding: 0 28px 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--btn-bg);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  transition: all 180ms ease;
}

.viz-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  min-height: 26px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.viz-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.legend-dot.orange { background: var(--orange); }
.legend-dot.green { background: var(--green); }
.legend-dot.yellow { background: var(--yellow); }
.legend-dot.blue { background: var(--blue); }
.legend-dot.red { background: var(--red); }
.legend-dot.muted { background: #aab2ae; }

.reference-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.reference-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--step-bg);
}

.reference-item span {
  display: block;
  margin-bottom: 9px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reference-item strong {
  font-size: 13px;
  line-height: 1.55;
}

.doubt-details {
  margin-top: 14px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--step-bg);
}

.doubt-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.doubt-details ol {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  .reference-grid {
    grid-template-columns: 1fr;
  }

  .viz-controls {
    flex-wrap: wrap;
  }

  .viz-scrubber {
    order: 2;
    width: calc(100% - 80px);
    margin-left: 0;
    flex-basis: auto;
  }

  .speed-select {
    order: 2;
  }

  .viz-legend {
    flex-wrap: wrap;
  }
}

/* Video Lecture & Accordion Q&A styling */
.video-card {
  padding: 30px;
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: var(--shadow);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.theory-questions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.qna-details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--step-bg);
  overflow: hidden;
  transition: all 180ms ease;
}

.qna-details[open] {
  background: var(--card);
  box-shadow: var(--shadow);
}

.qna-details summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 750;
  outline: none;
  user-select: none;
  list-style: none; /* Hide default list marker */
}

.qna-details summary::-webkit-details-marker {
  display: none; /* Hide webkit details marker */
}

.qna-details summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: var(--green);
  transition: transform 180ms ease;
}

.qna-details[open] summary::after {
  content: "−";
  transform: rotate(180deg);
}

.qna-answer {
  padding: 0 20px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  border-top: 1px solid var(--line);
  margin-top: -1px;
}

.qna-answer p {
  margin: 12px 0 0;
}
