/* ============================================================
   Algorithms: From Searching to Dynamic Programming
   ============================================================ */

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

:root {
  --bg-start: #667eea;
  --bg-end: #764ba2;
  --dark: #2c3e50;
  --ink: #1a1a2e;
  --muted: #555;
  --accent: #667eea;
  --light: #f7f9fc;
  --border: #eef0f4;
  --code-bg: #2c3e50;
  --code-fg: #ecf0f1;
  --warn: #e67e22;
  --warn-bg: #fef5e7;
  --tip-bg: #eef3ff;
  --tip-border: #667eea;
  --good: #27ae60;
  --bad: #e74c3c;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  min-height: 100vh;
  color: var(--ink);
  line-height: 1.65;
}

.app-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.app-header {
  text-align: center;
  color: white;
  padding: 2rem 0 1.5rem;
}

.back-link {
  display: inline-block;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding: 0.4rem 1rem;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 25px;
  transition: background 0.25s, border-color 0.25s;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.65);
  color: white;
}

.app-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.app-subtitle {
  font-size: 1.1rem;
  opacity: 0.92;
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.7;
}

.app-subtitle code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.16);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.toc {
  background: white;
  border-radius: 15px;
  padding: 1.5rem 1.75rem;
  margin: 1.75rem 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.toc h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.toc ol {
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  margin-bottom: 0.35rem;
}

.toc a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-block;
  padding: 0.15rem 0;
  transition: color 0.2s;
}

.toc a::before {
  content: counter(toc) ". ";
  color: var(--accent);
  font-weight: 700;
}

.toc a:hover {
  color: var(--accent);
}

.section {
  background: white;
  border-radius: 15px;
  padding: 2.25rem 2.25rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.section h2 {
  font-size: 1.7rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}

.section h3 {
  font-size: 1.25rem;
  color: var(--accent);
  margin: 1.75rem 0 0.6rem;
}

.section h4 {
  font-size: 1.05rem;
  color: var(--ink);
  margin: 1.25rem 0 0.4rem;
}

.section p {
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.section ul, .section ol {
  margin: 0.5rem 0 1rem 1.4rem;
  color: var(--muted);
}

.section li {
  margin-bottom: 0.45rem;
}

.section li strong {
  color: var(--ink);
}

.code-block {
  position: relative;
  background: var(--code-bg);
  border-radius: 10px;
  margin: 1rem 0 1.25rem;
  overflow: hidden;
}

.code-block pre {
  padding: 0.6rem 1rem 1rem;
  overflow-x: auto;
}

.code-block code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.86rem;
  color: var(--code-fg);
  line-height: 1.65;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.32rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
}

.copy-btn.copied {
  background: #27ae60;
  border-color: #27ae60;
  color: white;
}

.pro-tip, .warning {
  border-radius: 10px;
  padding: 0.95rem 1.15rem;
  margin: 1rem 0;
  font-size: 0.94rem;
  line-height: 1.6;
}

.pro-tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--tip-border);
  color: #2c3e50;
}

.warning {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
  color: #5a3d12;
}

.pro-tip .label, .warning .label {
  font-weight: 800;
  letter-spacing: 0.3px;
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--light);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

td {
  color: var(--muted);
}

td code, p code, li code, .flow-node code, .pro-tip code, .warning code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85em;
  background: var(--light);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #5a3fc0;
}

.flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.25rem 0;
}

.flow-node {
  background: white;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 460px;
}

.flow-node small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.flow-arrow {
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  margin: 0.15rem 0;
  font-weight: 700;
}

.widget {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  margin: 1.1rem 0 1.4rem;
  background: var(--light);
}

.widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.widget-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.widget-btns {
  display: flex;
  gap: 0.5rem;
}

.step-btn, .reset-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.42rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}

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

.step-btn:hover {
  background: #5568d8;
}

.step-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

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

.reset-btn:hover {
  background: var(--tip-bg);
}

.step-progress {
  height: 6px;
  background: #e3e7f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.step-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--bg-end));
  transition: width 0.35s ease;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.step-list li {
  position: relative;
  padding: 0.55rem 0.7rem 0.55rem 2.6rem;
  margin: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  opacity: 0.5;
  transition: opacity 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.step-list li + li {
  margin-top: 0.3rem;
}

.step-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.7rem;
  top: 0.55rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #d9deee;
  color: #5a5f7a;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-list li.active {
  background: white;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.step-list li.done {
  opacity: 0.85;
}

.step-list li.done::before {
  background: #27ae60;
  color: white;
}

.step-list li.active::before {
  background: var(--accent);
  color: white;
}

.step-list code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85em;
  background: #eceef5;
  padding: 0.08rem 0.32rem;
  border-radius: 4px;
  color: #5a3fc0;
}

.builder-note {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.builder-note.ok {
  color: var(--good);
  font-weight: 600;
}

.app-footer {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  padding: 2.5rem 0 1rem;
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--dark);
  color: white;
  padding: 0.65rem 1.5rem;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}


/* ============================================================
   Algorithms-specific widgets
   ============================================================ */

.section a { color: var(--accent); font-weight: 600; }

.inline-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.inline-label select,
.text-input {
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.38rem 0.5rem;
  border: 1px solid #d7dbe8;
  border-radius: 7px;
  background: white;
  color: var(--ink);
}

.text-input { width: 150px; }
.text-input.num { width: 70px; }

.inline-label select:focus,
.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.inline-label input[type=range],
.slider-wrap input[type=range] { accent-color: var(--accent); }

.widget-btns { flex-wrap: wrap; align-items: center; }
.reset-btn:disabled { opacity: 0.5; cursor: default; }

.target-pill {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 0.05rem 0.6rem;
  border-radius: 20px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.so-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.7rem 0 0.3rem;
}

.so-stats strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.so-stats .ok { color: var(--good); font-weight: 700; }

/* ---------- Search ---------- */

.sr-lane { margin-bottom: 0.9rem; }

.sr-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.sr-label strong { color: var(--ink); }
.sr-range { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.78rem; color: var(--accent); margin-left: 0.4rem; }

.sr-cells {
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  gap: 3px;
}

.sr-cell {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.66rem;
  text-align: center;
  padding: 0.35rem 0;
  background: white;
  border: 1px solid #d7dbe8;
  border-radius: 4px;
  color: var(--ink);
  transition: background 0.2s, opacity 0.2s, border-color 0.2s, color 0.2s;
}

.sr-cell.checked { background: #eceef5; color: #9aa0b4; }
.sr-cell.out { opacity: 0.22; }
.sr-cell.current { background: #fff4e0; border-color: var(--warn); font-weight: 700; }
.sr-cell.found { background: var(--good); border-color: var(--good); color: white; font-weight: 700; }

/* ---------- Sorting ---------- */

.so-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 220px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

.so-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent), var(--bg-end));
  border-radius: 3px 3px 0 0;
  transition: background 0.08s;
}

.so-bar.cmp { background: #f5b041; }
.so-bar.write { background: var(--bad); }
.so-bar.sorted { background: var(--good); }

.so-controls { display: flex; gap: 0.5rem; margin-top: 0.4rem; }

/* ---------- Divide & conquer tree ---------- */

.dc-tree {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dc-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dc-node {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  background: white;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  color: var(--ink);
}

.dc-node.ok { border-color: var(--good); background: #e6f7ef; color: #1d7a4b; font-weight: 700; }
.dc-label { font-size: 0.78rem; color: var(--accent); font-weight: 700; }

/* ---------- Hash table ---------- */

.ht-calc {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.8rem;
  word-break: break-all;
}

.ht-calc .hl { color: #f5b041; font-weight: 700; }

.ht-buckets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.45rem;
}

.ht-bucket {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  min-height: 62px;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.ht-bucket.hit { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); background: var(--tip-bg); }

.ht-idx {
  font-size: 0.7rem;
  font-weight: 700;
  color: #9aa0b4;
  margin-bottom: 0.25rem;
}

.ht-item {
  display: inline-block;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.75rem;
  background: #eceef5;
  color: #5a3fc0;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  margin: 0 0.2rem 0.2rem 0;
  animation: fadeInUp 0.3s ease both;
}

.ht-item.found { background: var(--good); color: white; }
.ht-item + .ht-item::before { content: ''; }

/* ---------- Pathfinding ---------- */

.pf-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.pf-tools-label { font-size: 0.8rem; color: var(--muted); margin-right: 0.2rem; }

.tool-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 0.75rem;
  border-radius: 20px;
  border: 1px solid #d7dbe8;
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.tool-btn:hover { border-color: var(--accent); }
.tool-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.pf-grid {
  display: grid;
  gap: 1px;
  background: #e3e7f0;
  border: 1px solid #e3e7f0;
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.pf-cell {
  aspect-ratio: 1;
  background: white;
  cursor: crosshair;
  transition: background 0.15s;
}

.pf-cell.wall { background: var(--dark); }
.pf-cell.mud { background: #c8a27a; }
.pf-cell.visited { background: #c9d4fb; }
.pf-cell.mud.visited { background: #a98ec4; }
.pf-cell.frontier { background: #f9e79f; }
.pf-cell.path { background: #f5b041; }
.pf-cell.mud.path { background: #d35400; }
.pf-cell.start { background: var(--good); }
.pf-cell.goal { background: var(--bad); }

/* ---------- Coin change ---------- */

.cc-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.cc-box {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  transition: border-color 0.25s, background 0.25s;
}

.cc-box h5 { font-size: 0.92rem; color: var(--ink); margin-bottom: 0.3rem; }
.cc-box p { font-size: 0.88rem; margin: 0; color: var(--muted); }
.cc-box.win { border-color: var(--good); background: #e6f7ef; }
.cc-box.lose { border-color: var(--bad); background: #fdecec; }

.coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 4px;
  border-radius: 50%;
  background: #f5c542;
  border: 2px solid #c99a12;
  font-size: 0.72rem;
  font-weight: 800;
  color: #5a3d12;
  margin: 0 3px 3px 0;
  animation: fadeInUp 0.3s ease both;
}

.cc-table-label { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.35rem; }

.cc-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 3px;
}

.cc-cell {
  background: white;
  border: 1px solid #d7dbe8;
  border-radius: 5px;
  text-align: center;
  padding: 0.2rem 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  transition: background 0.2s, border-color 0.2s;
}

.cc-cell .a { display: block; font-size: 0.62rem; color: #9aa0b4; }
.cc-cell .v { display: block; font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.cc-cell.filled { background: var(--tip-bg); border-color: var(--accent); }
.cc-cell.final { background: var(--good); border-color: var(--good); }
.cc-cell.final .v, .cc-cell.final .a { color: white; }

/* ---------- Fibonacci ---------- */

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.slider-wrap input[type=range] { width: 220px; }

.fib-rows { display: flex; flex-direction: column; gap: 0.5rem; }

.fib-row {
  display: grid;
  grid-template-columns: 150px 1fr 190px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.fib-name { font-weight: 700; color: var(--ink); }
.fib-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.fib-val strong { color: var(--ink); }

.growth-track {
  height: 18px;
  background: white;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.growth-bar { height: 100%; border-radius: 4px; transition: width 0.25s ease; }
.growth-bar.poly { background: linear-gradient(90deg, #6fcf97, var(--good)); }
.growth-bar.exp  { background: linear-gradient(90deg, #f5a462, var(--bad)); }

/* ---------- Use cards ---------- */

.uses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.use-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: var(--light);
  transition: transform 0.25s, box-shadow 0.25s;
}

.use-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); }
.use-ico { font-size: 1.6rem; }
.use-card h5 { font-size: 0.95rem; color: var(--ink); margin: 0.25rem 0; }
.use-card p { font-size: 0.82rem; margin: 0; }

/* ---------- Quiz ---------- */

.quiz-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
  background: var(--light);
  animation: fadeInUp 0.35s ease both;
}

.quiz-q { font-weight: 700; color: var(--ink); margin-bottom: 0.55rem; }
.quiz-opts { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.quiz-opt {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 0.85rem;
  border-radius: 20px;
  border: 1px solid #d7dbe8;
  background: white;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { background: var(--good); border-color: var(--good); color: white; }
.quiz-opt.wrong { background: var(--bad); border-color: var(--bad); color: white; }

.quiz-explain { font-size: 0.88rem; color: var(--muted); margin-top: 0.55rem; animation: fadeIn 0.25s ease; }
.quiz-score { font-weight: 700; color: var(--accent); margin: 0.5rem 0 1rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section { animation: fadeInUp 0.45s ease both; }

@media (max-width: 768px) {
  .app-title { font-size: 1.9rem; }
  .app-subtitle { font-size: 0.95rem; }
  .section { padding: 1.5rem 1.25rem; }
  .section h2 { font-size: 1.4rem; }
  .widget-head { flex-direction: column; align-items: flex-start; }
  .sr-cells { grid-template-columns: repeat(16, 1fr); }
  .so-bars { height: 160px; }
  .cc-results { grid-template-columns: 1fr; }
  .fib-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .slider-wrap input[type=range] { width: 160px; }
}

@media (max-width: 480px) {
  .app-container { padding: 1rem 0.75rem 2rem; }
  .app-title { font-size: 1.55rem; }
  .section { padding: 1.15rem 0.9rem; }
  .code-block code { font-size: 0.78rem; }
  .toc { padding: 1.1rem 1rem; }
  .sr-cells { grid-template-columns: repeat(8, 1fr); }
}
