/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-feature-settings: 'liga' 1, 'calt' 1, 'kern' 1;
  background: #ffffff;
  color: #222222;
  line-height: 1.75;
  min-height: 100vh;
  letter-spacing: -0.011em;
}
h1, h2, h3, h4, h5, h6, .topbar, .sidebar, .tag, .breadcrumb, .label, th, .step-num, .num, .lang-label, button {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-feature-settings: 'liga' 1, 'calt' 1, 'kern' 1;
}

/* === LAYOUT === */
.container { max-width: 880px; margin: 0 auto; padding: 2rem 2rem; }
.wide { max-width: 1100px; }

/* === TOP BAR === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid #e5e5e5;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 52px;
}
.topbar .logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: #000000;
  text-decoration: none;
  letter-spacing: -0.03em;
}
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: #222222;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  border-color: #000000;
  background: #fafafa;
}
.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #222222;
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.hamburger-icon {
  position: relative;
}
.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
}
.hamburger-icon::before { top: -5px; }
.hamburger-icon::after { top: 5px; }
.sidebar-open .sidebar-toggle .hamburger-icon {
  background: transparent;
}
.sidebar-open .sidebar-toggle .hamburger-icon::before {
  top: 0;
  transform: rotate(45deg);
}
.sidebar-open .sidebar-toggle .hamburger-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
  height: 52px;
}
.sidebar-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #333333;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666666;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.sidebar-close:hover {
  color: #000000;
  background: #f5f5f5;
}

/* === SIDEBAR SEARCH === */
.sidebar-search {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
  position: relative;
}
.sidebar-search-input {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #d4d4d4;
  border-radius: 6px;
  outline: none;
  background: #fafafa;
  color: #222222;
  width: 100%;
  transition: border-color 0.15s;
}
.sidebar-search-input::placeholder { color: #999999; }
.sidebar-search-input:focus {
  border-color: #000000;
  background: #ffffff;
}
.sidebar-search-results {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  margin-top: 0.35rem;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}
.sidebar-search-results.visible { display: block; }
.sidebar-search-results a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #333333;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.1s;
}
.sidebar-search-results a:last-child { border-bottom: none; }
.sidebar-search-results a:hover,
.sidebar-search-results a.highlighted {
  background: #f5f5f5;
  color: #000000;
}
.sidebar-search-results .no-results {
  padding: 0.5rem 0.75rem;
  color: #999999;
  font-size: 0.82rem;
}

/* === SIDEBAR NAV LINKS === */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}
.sidebar-group {
  padding: 0.25rem 0;
}
.sidebar-group-label {
  font-size: 0.72rem;
  font-weight: 650;
  color: #999999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.25rem 0.35rem;
}
.sidebar-nav a {
  display: block;
  padding: 0.45rem 1.25rem;
  color: #555555;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  letter-spacing: -0.01em;
}
.sidebar-nav a:hover {
  color: #000000;
  background: #fafafa;
}
.sidebar-nav a.active {
  color: #000000;
  font-weight: 600;
  background: #f5f5f5;
  border-right: 2px solid #000000;
}

/* === SIDEBAR BACKDROP === */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-backdrop.visible {
  opacity: 1;
  visibility: visible;
}
body.sidebar-open {
  overflow: hidden;
}

/* === HERO === */
.hero {
  text-align: center;
  padding: 4.5rem 1rem 3rem;
}
.hero h1 {
  font-size: 2.75rem; font-weight: 800;
  color: #000000;
  margin-bottom: 1rem;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.hero p {
  color: #555555;
  font-size: 1.1rem;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.7;
}

/* === SECTION DIVIDER === */
.section-title {
  font-size: 1.35rem; font-weight: 700; color: #000000;
  margin: 3rem 0 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1.5px solid #e5e5e5;
  letter-spacing: -0.025em;
}

/* === CARDS GRID === */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1.25rem 0;
}
.card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 1.5rem 1.6rem;
  transition: transform 0.18s ease, border-color 0.2s, box-shadow 0.2s;
  text-decoration: none; color: inherit;
  display: block;
}
.card:hover {
  transform: translateY(-2px);
  border-color: #b0b0b0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.card .icon { font-size: 1.75rem; margin-bottom: 0.65rem; }
.card h3 {
  font-size: 1.1rem; color: #000000;
  margin-bottom: 0.4rem; font-weight: 650;
  letter-spacing: -0.02em;
}
.card p { color: #555555; font-size: 0.88rem; line-height: 1.55; }
.card .tag {
  display: inline-block; margin-top: 0.75rem;
  padding: 0.2rem 0.65rem; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
  background: #f5f5f5; color: #333333;
  border: 1px solid #e5e5e5;
  letter-spacing: 0.01em;
}
.tag.green { background: #f5f5f5; color: #333333; }
.tag.orange { background: #f5f5f5; color: #333333; }
.tag.red { background: #f5f5f5; color: #333333; }

/* === CONTENT PAGES === */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 2.5rem;
}
.page-header h1 {
  font-size: 2.1rem; font-weight: 800; color: #000000;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.page-header p { color: #555555; font-size: 1.05rem; line-height: 1.7; }
.breadcrumb { color: #999999; font-size: 0.82rem; margin-bottom: 0.5rem; }
.breadcrumb a { color: #333333; text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { color: #000000; }

/* === SECTIONS === */
section { margin-bottom: 3rem; }
section h2 {
  font-size: 1.5rem; font-weight: 700; color: #000000;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1.5px solid #e5e5e5;
  letter-spacing: -0.025em;
}
section h3 {
  font-size: 1.15rem; font-weight: 600; color: #111111;
  margin: 1.75rem 0 0.75rem;
  letter-spacing: -0.015em;
}
p { margin-bottom: 1rem; }
strong { color: #000000; font-weight: 650; }
img { max-width: 100%; height: auto; }

/* === CONTENT BOXES -- all white/black/gray === */
.formula-box {
  background: #fafafa;
  border-left: 3px solid #000000;
  border-radius: 0 6px 6px 0;
  padding: 1.2rem 1.5rem;
  margin: 1.25rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-feature-settings: 'liga' 1, 'calt' 1;
  font-size: 0.95rem;
  color: #222222;
  overflow-x: auto;
  line-height: 1.65;
}
.example-box {
  background: #fafafa;
  border-left: 3px solid #888888;
  border-radius: 0 6px 6px 0;
  padding: 1.2rem 1.5rem;
  margin: 1.25rem 0;
}
.example-box .label {
  font-weight: 700; color: #000000;
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.warning-box {
  background: #fafafa;
  border-left: 3px solid #555555;
  border-radius: 0 6px 6px 0;
  padding: 1.2rem 1.5rem;
  margin: 1.25rem 0;
}
.warning-box .label {
  font-weight: 700; color: #000000;
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.tip-box {
  background: #fafafa;
  border-left: 3px solid #333333;
  border-radius: 0 6px 6px 0;
  padding: 1.2rem 1.5rem;
  margin: 1.25rem 0;
}
.tip-box .label {
  font-weight: 700; color: #000000;
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

/* === CODE BLOCKS === */
pre {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  position: relative;
  line-height: 1.6;
}
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-feature-settings: 'liga' 1, 'calt' 1;
  font-size: 0.85rem;
  color: #222222;
}
:not(pre) > code {
  background: #f3f3f3;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}
pre .lang-label {
  position: absolute; top: 0.5rem; right: 0.8rem;
  font-size: 0.68rem; font-weight: 600;
  color: #999999; text-transform: uppercase;
  letter-spacing: 0.03em;
}
.keyword { color: #555555; font-weight: 600; }
.string { color: #333333; }
.number { color: #333333; }
.comment { color: #999999; font-style: italic; }
.function { color: #000000; font-weight: 500; }
.builtin { color: #444444; }

/* === TABLES === */
table {
  width: 100%; border-collapse: collapse;
  margin: 1.25rem 0;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e5e5;
}
th {
  background: #fafafa;
  color: #333333; font-weight: 600;
  font-size: 0.82rem; text-transform: uppercase;
  letter-spacing: 0.04em;
}
td { color: #333333; }
tr:hover td { background: #fafafa; }

/* === LISTS === */
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.45rem; color: #333333; line-height: 1.7; }
li::marker { color: #555555; }

/* === LINKS === */
a.resource-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: #000000; text-decoration: underline;
  text-decoration-color: #cccccc;
  text-underline-offset: 3px;
  font-weight: 500; transition: text-decoration-color 0.15s;
}
a.resource-link:hover { text-decoration-color: #000000; }

/* === TABLE OF CONTENTS === */
.toc {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 2.5rem;
}
.toc h4 {
  color: #333333; font-size: 0.78rem;
  text-transform: uppercase; margin-bottom: 0.75rem;
  letter-spacing: 0.06em; font-weight: 650;
}
.toc a {
  display: block; color: #555555;
  text-decoration: none; padding: 0.3rem 0;
  font-size: 0.92rem; transition: color 0.15s;
}
.toc a:hover { color: #000000; }

/* === PROGRESS BAR === */
.progress-track {
  background: #e5e5e5;
  border-radius: 20px; height: 7px;
  margin: 0.5rem 0;
}
.progress-fill {
  height: 100%; border-radius: 20px;
  background: #000000;
}

/* === SIDEBAR TOC (for content pages) === */
@media (min-width: 1200px) {
  .page-with-toc { display: flex; gap: 2rem; max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
  .page-with-toc .content { flex: 1; min-width: 0; }
  .page-with-toc .sidebar-toc {
    width: 240px; flex-shrink: 0;
    position: sticky; top: 68px;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
  }
}

/* === QUIZ === */
.quiz { margin: 1.5rem 0; }
.quiz-q {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.quiz-q h4 { color: #000000; margin-bottom: 1rem; font-weight: 650; }
.quiz-q button {
  display: block; width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  color: #333333;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.92rem;
  line-height: 1.5;
}
.quiz-q button:hover { border-color: #000000; background: #fafafa; }
.quiz-q button.correct { border-color: #000000; background: #f5f5f5; color: #000000; font-weight: 600; }
.quiz-q button.wrong { border-color: #999999; background: #f5f5f5; color: #666666; text-decoration: line-through; }
.quiz-q .explanation {
  margin-top: 0.8rem; padding: 0.8rem 1rem;
  background: #f5f5f5;
  border-radius: 6px; color: #333333;
  display: none; font-size: 0.9rem;
  line-height: 1.6;
}

/* === INTERACTIVE PRACTICE QUIZ (times tables etc.) === */
.practice-quiz {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.25rem 0;
}
.practice-quiz .label {
  font-weight: 700; color: #000000;
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
.practice-quiz .quiz-question {
  font-size: 2rem; text-align: center;
  color: #000000; font-weight: 700;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-feature-settings: 'liga' 1, 'calt' 1;
}
.practice-quiz input[type="number"] {
  font-size: 1.3rem; padding: 0.5rem 1rem;
  width: 140px; text-align: center;
  border-radius: 6px; border: 1.5px solid #d4d4d4;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: border-color 0.15s;
}
.practice-quiz input[type="number"]:focus {
  border-color: #000000;
}
.practice-quiz button {
  font-size: 0.92rem; padding: 0.5rem 1.2rem;
  background: #000000; color: #ffffff;
  border: none; border-radius: 6px;
  cursor: pointer; font-weight: 600;
  transition: background 0.15s;
}
.practice-quiz button:hover { background: #333333; }
.practice-quiz button.secondary {
  background: #ffffff; color: #000000;
  border: 1.5px solid #d4d4d4;
}
.practice-quiz button.secondary:hover {
  border-color: #000000; background: #fafafa;
}
.practice-quiz .score {
  text-align: center; color: #555555;
  font-size: 0.9rem; margin: 0.75rem 0;
}
.practice-quiz select {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1.5px solid #d4d4d4;
  font-size: 0.88rem;
  outline: none;
}
.practice-quiz select:focus { border-color: #000000; }

/* === ROADMAP === */
.roadmap {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 1rem 0;
}
.roadmap-step {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.8rem 1.2rem;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  color: #333333;
  font-size: 0.92rem;
  transition: border-color 0.15s;
}
.roadmap-step { text-decoration: none; }
.roadmap-step:hover { border-color: #b0b0b0; }
.roadmap-step .step-num {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: #f5f5f5;
  color: #000000;
  border-radius: 50%;
  font-weight: 700; font-size: 0.82rem;
  flex-shrink: 0;
}
.roadmap-step .step-label { color: #000000; font-weight: 600; }
.roadmap-step .step-desc { color: #777777; font-size: 0.82rem; margin-left: auto; }

/* === STRATEGY LIST === */
.strategy-list {
  list-style: none; padding: 0;
}
.strategy-list li {
  display: flex; align-items: flex-start; gap: 0.8rem;
  padding: 1rem 1.2rem;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  margin-bottom: 0.6rem;
  color: #333333;
  font-size: 0.92rem;
  line-height: 1.65;
}
.strategy-list li .num {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: #f5f5f5;
  color: #000000;
  border-radius: 50%;
  font-weight: 700; font-size: 0.78rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.strategy-list li strong { color: #000000; }

/* === DIFFICULTY BADGES (DSA) === */
.diff-easy { color: #333333; font-weight: 600; }
.diff-medium { color: #333333; font-weight: 600; }
.diff-hard { color: #333333; font-weight: 600; font-style: italic; }

/* === MEMORY DIAGRAM (DSA) === */
.memory-diagram {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 1.25rem;
  margin: 1.25rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-feature-settings: 'liga' 1, 'calt' 1;
  font-size: 0.82rem;
  color: #333333;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

/* === SELECTION === */
::selection {
  background: #000000;
  color: #ffffff;
}


/* === RESPONSIVE: TABLET (≤768px) === */
@media (max-width: 768px) {
  /* Top bar */
  .topbar { padding: 0.75rem 1rem; }

  /* Hero */
  .hero { padding: 3rem 1rem 2rem; }
  .hero h1 { font-size: 2.25rem; }

  /* Container */
  .container { padding: 1.5rem 1.25rem; }

  /* Page header */
  .page-header h1 { font-size: 1.75rem; }
  .page-header { padding: 2rem 0 1.5rem; margin-bottom: 2rem; }

  /* Tables: scrollable wrapper */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  thead, tbody, tr { display: table; width: 100%; table-layout: auto; }
  th, td { padding: 0.6rem 0.75rem; font-size: 0.88rem; }

  /* Code blocks */
  pre { padding: 1rem; }
  code { font-size: 0.8rem; }

  /* Content boxes */
  .example-box, .warning-box, .tip-box, .formula-box { overflow-x: auto; }

  /* Images */
  img { max-width: 100%; height: auto; }

  /* Mobile TOC override */
  #mobile-toc { display: block !important; }

  /* Touch targets */
  .quiz-q button { min-height: 44px; padding: 0.75rem 1rem; }
  .practice-quiz button { min-height: 44px; }
  .practice-quiz input[type="number"] { min-height: 44px; }

  /* Strategy list mobile */
  .strategy-list li { font-size: 0.88rem; padding: 0.85rem 1rem; }
}

/* === RESPONSIVE: PHONE (≤600px) === */
@media (max-width: 600px) {
  html { font-size: 15px; }
  .hero h1 { font-size: 2rem; }
  .hero { padding: 2.5rem 0.75rem 1.75rem; }
  .hero p { font-size: 1rem; }
  .container { padding: 1.25rem 1rem; }
  .roadmap-step .step-desc { display: none; }
  .cards { gap: 0.75rem; grid-template-columns: 1fr; }
  .card { padding: 1.25rem 1.3rem; }
  .formula-box { padding: 1rem 1.1rem; font-size: 0.85rem; }
  .example-box, .warning-box, .tip-box { padding: 1rem 1.1rem; }
  pre { padding: 0.9rem 1rem; }
  code { font-size: 0.78rem; }
  th, td { padding: 0.5rem 0.6rem; font-size: 0.82rem; }
  .practice-quiz input[type="number"] { width: auto; max-width: 140px; }
  section h2 { font-size: 1.3rem; }
  section h3 { font-size: 1.05rem; }
  .toc { padding: 1.1rem 1.2rem; }
  .toc a { font-size: 0.85rem; }
  .page-header h1 { font-size: 1.5rem; }
  .page-header p { font-size: 0.95rem; }
  .section-title { font-size: 1.2rem; }
  .roadmap-step { padding: 0.7rem 1rem; font-size: 0.88rem; }
  .memory-diagram { font-size: 0.75rem; }
}

/* === RESPONSIVE: VERY SMALL (≤400px) === */
@media (max-width: 400px) {
  html { font-size: 14px; }
  .container { padding: 1rem 0.75rem; }
  .topbar { padding: 0.6rem 0.75rem; }
  .sidebar { width: 260px; }
  .hero h1 { font-size: 1.75rem; }
  .page-header h1 { font-size: 1.35rem; }
  pre { padding: 0.75rem 0.8rem; }
  code { font-size: 0.72rem; }
  .formula-box { font-size: 0.8rem; padding: 0.85rem 0.9rem; }
  .example-box, .warning-box, .tip-box { padding: 0.85rem 0.9rem; }
}

/* === FOOTER === */
footer {
  text-align: center; padding: 3rem 1rem;
  color: #999999; font-size: 0.82rem;
  border-top: 1px solid #e5e5e5;
  margin-top: 3rem;
  letter-spacing: -0.01em;
}
footer a { color: #000000; text-decoration: none; font-weight: 500; }
footer .edit-link { color: #999999; text-decoration: none; font-weight: 400; }
footer .edit-link:hover, footer .edit-link:focus { text-decoration: underline; }
