:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --bg-alt: #efe6d8;
  --surface: #ffffff;
  --surface-alt: #faf6ef;
  --ink: #1e1b16;
  --muted: #5a5249;
  --accent: #d24b33;
  --accent-soft: #f3c7b8;
  --teal: #1d6f73;
  --highlight: #f1c453;
  --border: #e2d7c7;
  --shadow: 0 16px 40px rgba(30, 27, 22, 0.12);
  --font-body: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Playfair Display", "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #fdf8f1 0%, transparent 45%),
    radial-gradient(circle at 20% 40%, #f0dfc7 0%, transparent 50%),
    linear-gradient(135deg, var(--bg) 0%, #f8f3eb 45%, var(--bg-alt) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(30, 27, 22, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  opacity: 0.35;
}

.page {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 24px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.4px;
}

.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-bottom-color: var(--accent);
}

.hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  padding: 24px 0 48px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--teal);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 2vw + 2rem, 3.4rem);
  margin: 12px 0 12px;
}

.hero-subtitle {
  color: var(--muted);
  line-height: 1.6;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button-link:hover,
.button-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(210, 75, 51, 0.25);
}

.button-link.outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.button-link.ghost {
  background: rgba(29, 111, 115, 0.1);
  border-color: rgba(29, 111, 115, 0.2);
  color: var(--teal);
}

.search-bar {
  margin-top: 20px;
  background: var(--surface);
  padding: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.search-bar input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: var(--font-body);
}

.search-bar input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.search-meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.hero-stats div {
  background: var(--surface-alt);
  border-radius: 14px;
  padding: 12px 16px;
  min-width: 140px;
  border: 1px solid var(--border);
}

.hero-stats strong {
  display: block;
  font-size: 1.5rem;
  color: var(--accent);
}

.hero-panel {
  background: var(--surface);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.hero-panel h2 {
  font-family: var(--font-display);
  margin-top: 0;
}

.hero-panel ol,
.hero-panel ul {
  padding-left: 18px;
  line-height: 1.6;
}

.hero-list {
  margin: 0;
}

.hero--compact {
  padding: 18px 0 36px;
}

.hero-callout {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-radius: 12px;
  border: 1px solid rgba(210, 75, 51, 0.2);
}

.section {
  margin-top: 48px;
}

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

.section-head h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.section-link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(210, 75, 51, 0.35);
  transition: background 0.2s ease, color 0.2s ease;
}

.section-link:hover,
.section-link:focus-visible {
  background: rgba(210, 75, 51, 0.1);
}

.section-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 16px;
}

.card {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(30, 27, 22, 0.08);
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card[open] {
  box-shadow: 0 18px 36px rgba(30, 27, 22, 0.12);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(30, 27, 22, 0.12);
}

.pattern-card {
  text-align: left;
  width: 100%;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0;
  font: inherit;
  appearance: none;
  position: relative;
  border-left: 4px solid transparent;
}

.pattern-card:hover {
  transform: translateY(-2px);
}

.pattern-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pattern-card-body {
  padding: 18px;
}

.pattern-card.is-selected {
  border-color: rgba(210, 75, 51, 0.6);
  border-left-color: var(--accent);
  box-shadow: 0 14px 32px rgba(210, 75, 51, 0.2);
}

.card summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 18px 14px;
}

.card summary::-webkit-details-marker {
  display: none;
}

.card summary h4 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.card summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.card-summary-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.tag.accent {
  background: rgba(210, 75, 51, 0.1);
  border-color: rgba(210, 75, 51, 0.25);
  color: var(--accent);
}

.card-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
}

.card-body h5 {
  margin: 18px 0 8px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--teal);
}

.card-body p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.card-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.card-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
}

.card-meta strong {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.card-meta span {
  display: block;
  margin-top: 4px;
  font-weight: 600;
}

.code-block {
  margin-top: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f1116;
  color: #f7f2e9;
  padding: 12px;
}

.code-block summary {
  cursor: pointer;
  font-weight: 600;
  color: #f7f2e9;
  list-style: none;
}

.code-block summary::-webkit-details-marker {
  display: none;
}

.code-block pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.card-examples {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(29, 111, 115, 0.08);
  border: 1px solid rgba(29, 111, 115, 0.2);
}

.card-examples ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

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

.about-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.overview-list {
  display: grid;
  gap: 16px;
}

.overview-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(30, 27, 22, 0.08);
}

.overview-item h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
}

.overview-item p {
  margin: 0;
  color: var(--muted);
}

.overview-meta {
  text-align: right;
  min-width: 90px;
}

.overview-meta strong {
  display: block;
  font-size: 1.4rem;
  color: var(--accent);
}

.overview-meta span {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.overview-link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(210, 75, 51, 0.35);
  transition: background 0.2s ease, color 0.2s ease;
}

.overview-link:hover,
.overview-link:focus-visible {
  background: rgba(210, 75, 51, 0.1);
}

.pattern-layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.pattern-list {
  grid-template-columns: 1fr;
}

.side-panel {
  position: sticky;
  top: 24px;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  min-height: 240px;
}

.side-panel-header h3 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
}

.side-panel-summary {
  color: var(--muted);
  margin: 0 0 12px;
}

.side-panel-body p {
  color: var(--muted);
  line-height: 1.6;
}

.op-chart {
  margin: 16px 0;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.op-chart-title {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--teal);
}

.op-chart-note {
  margin: 6px 0 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.op-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 12px;
  align-items: center;
}

.op-row + .op-row {
  margin-top: 10px;
}

.op-name {
  display: block;
  font-weight: 600;
}

.op-note {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.op-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(29, 111, 115, 0.12);
  overflow: hidden;
}

.op-fill {
  position: absolute;
  inset: 0;
  width: calc(var(--rank) * 20%);
  background: linear-gradient(90deg, rgba(29, 111, 115, 0.9) 0%, rgba(210, 75, 51, 0.9) 100%);
}

.op-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
}

.side-panel-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}

.simulator {
  margin: 18px 0;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fdf6ea 0%, var(--surface-alt) 65%);
  border: 1px solid var(--border);
  box-shadow: 0 12px 26px rgba(30, 27, 22, 0.08);
}

.simulator-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.simulator-header h4 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.simulator-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.simulator-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sim-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sim-button:hover,
.sim-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(30, 27, 22, 0.12);
}

.sim-button.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sim-button.ghost {
  background: rgba(29, 111, 115, 0.08);
  border-color: rgba(29, 111, 115, 0.2);
  color: var(--teal);
}

.simulator-track {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.sim-problem {
  margin-top: 12px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  font-size: 0.9rem;
}

.sim-problem strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 4px;
}

.sim-problem p {
  margin: 0;
  color: var(--ink);
}

.sim-problem-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.sim-array {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
}

.sim-graph {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.sim-graph-canvas {
  position: relative;
  min-height: 240px;
  border-radius: 14px;
  background: #fff;
  background-image: radial-gradient(circle at 1px 1px, rgba(29, 111, 115, 0.08) 1px, transparent 0);
  background-size: 22px 22px;
  border: 1px dashed rgba(29, 111, 115, 0.2);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.sim-graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sim-edge {
  color: rgba(29, 111, 115, 0.6);
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.sim-edge.is-selected {
  color: rgba(29, 111, 115, 0.95);
  stroke-width: 3;
  filter: drop-shadow(0 4px 8px rgba(29, 111, 115, 0.25));
}

.sim-edge.is-active {
  color: var(--accent);
  stroke-width: 3.2;
  filter: drop-shadow(0 6px 10px rgba(210, 75, 51, 0.25));
}

.sim-edge.is-muted {
  color: rgba(30, 27, 22, 0.2);
}

.sim-edge-weight {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  fill: rgba(30, 27, 22, 0.7);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
}

.sim-graph-node {
  position: absolute;
  transform: translate(-50%, -50%);
}

.sim-node.is-selected {
  border-color: rgba(29, 111, 115, 0.75);
  background: rgba(29, 111, 115, 0.08);
}

.sim-node.is-dependency {
  border-color: rgba(241, 196, 83, 0.8);
  background: rgba(241, 196, 83, 0.1);
}

.sim-matrix {
  display: grid;
  gap: 10px;
  justify-content: center;
}

.sim-matrix-row {
  display: flex;
  gap: 10px;
}

.sim-cell.is-dependency {
  border-color: rgba(241, 196, 83, 0.8);
  background: rgba(241, 196, 83, 0.1);
}

.sim-cell.is-base {
  border-color: rgba(29, 111, 115, 0.6);
  background: rgba(29, 111, 115, 0.08);
  color: var(--teal);
}

.sim-split {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.sim-stack {
  display: grid;
  gap: 12px;
}

.sim-node-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sim-node {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fff 0%, #f2f7f6 100%);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 8px 16px rgba(30, 27, 22, 0.08);
}

.sim-node.is-visited {
  background: rgba(29, 111, 115, 0.12);
  border-color: rgba(29, 111, 115, 0.4);
  color: var(--teal);
}

.sim-node.is-frontier {
  border-color: rgba(241, 196, 83, 0.6);
  color: #9a6b12;
}

.sim-node.is-active {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(210, 75, 51, 0.25);
  transform: translateY(-2px);
}

.sim-degree {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.sim-heaps {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.sim-heap {
  background: var(--surface-alt);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
}

.sim-heap h5 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--teal);
}

.sim-heap-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sim-heap-value {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.sim-heap-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.sim-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 16px;
}

.sim-cell {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.sim-cell.is-window {
  background: rgba(29, 111, 115, 0.1);
  border-color: rgba(29, 111, 115, 0.35);
  color: var(--teal);
}

.sim-cell.is-active {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(210, 75, 51, 0.2);
  transform: translateY(-2px);
}

.sim-cell.is-left {
  border-color: rgba(29, 111, 115, 0.6);
}

.sim-cell.is-right {
  border-color: rgba(210, 75, 51, 0.6);
}

.sim-cell.is-mid {
  border-color: rgba(241, 196, 83, 0.8);
}

.sim-cell.is-pivot {
  border-color: var(--accent);
}

.sim-cell.is-index {
  border-color: rgba(29, 111, 115, 0.6);
}

.sim-cell.is-swap {
  border-color: rgba(210, 75, 51, 0.6);
  background: rgba(210, 75, 51, 0.1);
}

.sim-index {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.sim-pointer {
  position: absolute;
  top: 0;
  transform: translateY(-100%);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
}

.sim-pointer.is-left,
.sim-pointer.is-index {
  color: var(--teal);
}

.sim-pointer.is-right,
.sim-pointer.is-swap {
  color: var(--accent);
}

.sim-pointer.is-pivot {
  color: var(--accent);
}

.sim-pointer.is-mid {
  color: var(--highlight);
}

.simulator-state {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  font-size: 0.85rem;
}

.sim-state-item strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.sim-state-item span {
  font-weight: 600;
}

.preview-card {
  padding: 0;
}

.preview-card-body {
  padding: 18px;
}

.preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.preview-link:hover,
.preview-link:focus-visible {
  text-decoration: underline;
}

.info-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 26px rgba(30, 27, 22, 0.08);
}

.info-card h3 {
  margin-top: 0;
}

.info-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.guide-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.guide-surface {
  background: linear-gradient(135deg, #fdf6ea 0%, var(--surface-alt) 70%);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.guide-grid {
  margin-top: 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.guide-grid--tight {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.guide-grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.guide-card-body {
  padding: 18px;
}

.guide-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
}

.guide-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.guide-card .card-summary-tags {
  margin-bottom: 10px;
}

.guide-card .card-list {
  margin: 0 0 12px;
}

.guide-card .code-block {
  margin-top: 10px;
}

.guide-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.9rem;
}

.guide-section--syntax .guide-card {
  border-left: 4px solid rgba(29, 111, 115, 0.8);
}

.guide-section--structures .guide-card {
  border-left: 4px solid rgba(210, 75, 51, 0.7);
}

.guide-section--problems .guide-card {
  border-left: 4px solid rgba(241, 196, 83, 0.8);
}

.playground-layout {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.playground-library {
  position: sticky;
  top: 24px;
  align-self: start;
}

.playground-library-head h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
}

.playground-library-head p {
  margin: 0 0 16px;
  color: var(--muted);
}

.playground-snippet-list {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.playground-snippet {
  text-align: left;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.playground-snippet:hover {
  transform: translateY(-2px);
}

.playground-snippet.is-selected {
  border-color: rgba(210, 75, 51, 0.6);
  border-left-color: var(--accent);
  box-shadow: 0 14px 32px rgba(210, 75, 51, 0.2);
}

.playground-snippet-body {
  padding: 14px 16px;
}

.playground-snippet-body h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.playground-snippet-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.playground-workspace {
  display: grid;
  gap: 18px;
}

.playground-panel {
  background: var(--surface);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.playground-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.playground-title h3 {
  margin: 6px 0 6px;
  font-family: var(--font-display);
}

.playground-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.playground-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.playground-status {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(29, 111, 115, 0.2);
  background: rgba(29, 111, 115, 0.1);
  color: var(--teal);
}

.playground-status.is-loading {
  border-color: rgba(241, 196, 83, 0.3);
  background: rgba(241, 196, 83, 0.2);
  color: #7a5e0f;
}

.playground-status.is-error {
  border-color: rgba(210, 75, 51, 0.3);
  background: rgba(210, 75, 51, 0.15);
  color: var(--accent);
}

.playground-editor,
.playground-stdin {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  background: #0f1116;
  color: #f7f2e9;
}

.playground-editor {
  min-height: 280px;
}

.playground-stdin {
  min-height: 120px;
  background: #11131a;
}

.playground-editor:focus,
.playground-stdin:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.playground-io {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 18px;
}

.playground-output-head h4 {
  margin: 0;
  font-family: var(--font-display);
}

.playground-output-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.playground-output {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f1116;
  color: #f7f2e9;
  min-height: 140px;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.playground-output.is-error {
  border-color: rgba(210, 75, 51, 0.4);
  color: var(--accent-soft);
}

.walkthrough-note {
  margin-bottom: 24px;
}

.walkthrough-block + .walkthrough-block {
  margin-top: 32px;
}

.walkthrough-grid {
  margin-top: 0;
}

.playground-code-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.playground-code-actions .sim-button {
  background: rgba(255, 255, 255, 0.1);
  color: #f7f2e9;
  border-color: rgba(255, 255, 255, 0.2);
}

.playground-code-actions .sim-button:hover,
.playground-code-actions .sim-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.site-footer {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

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

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .pattern-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  .overview-item {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .overview-meta {
    text-align: left;
  }

  .guide-surface {
    padding: 18px;
  }

  .guide-grid--wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .playground-layout {
    grid-template-columns: 1fr;
  }

  .playground-library {
    position: static;
  }

  .playground-io {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 20px 16px 48px;
  }

  .hero-panel {
    padding: 18px;
  }

  .hero-stats {
    gap: 12px;
  }

  .op-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .op-value {
    justify-self: start;
  }

  .sim-cell {
    width: 38px;
    height: 38px;
  }

  .sim-node {
    width: 38px;
    height: 38px;
  }

  .sim-array {
    gap: 8px;
  }

  .playground-editor {
    min-height: 220px;
  }
}
