.guide {
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(28px, 4vw, 52px) var(--pad, 44px) var(--sec-gap, 50px);
  color: var(--text);
  font: 15px/1.55 var(--sans, Geist, system-ui, sans-serif);
}

.guide [hidden] { display: none; }
.guide h1, .guide h2, .guide h3 { font-family: inherit; }
.guide h1 {
  margin: 0 0 .25em;
  font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -.06em;
}
.guide h1 span { color: var(--attention); }
.guide h2 {
  margin: 0 0 .4rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -.035em;
}
.guide h3 {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.3;
  letter-spacing: -.018em;
}
.guide p {
  max-width: 70ch;
  margin: 0;
  color: var(--text-2);
}
.guide-intro > p { font-size: 1.05rem; }
.guide a { color: var(--accent); }
.guide a:hover { color: var(--accent-bright); }
.guide :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.guide-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
  font-size: .875rem;
}
.guide-rollup {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 24px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}
.guide-rollup div {
  display: flex;
  flex-direction: column-reverse;
  gap: 5px;
  padding: 18px;
  background: var(--surface);
}
.guide-rollup dt { color: var(--text-2); font-size: .8rem; }
.guide-rollup dd {
  margin: 0;
  color: var(--accent);
  font: 500 1.625rem/1.1 var(--mono, "Geist Mono", monospace);
  font-variant-numeric: tabular-nums;
}
.guide-section { margin-top: var(--sec-gap, 50px); }
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.guide-card {
  min-width: 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.guide-card:target { border-color: var(--accent); }
.guide-card p { font-size: .875rem; }
.guide .guide-card > * + *, .guide-section > .guide-card, .guide .guide-section > .guide-card + p { margin-top: 12px; }
.guide-card pre {
  margin-bottom: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--recess);
  color: var(--accent-bright);
  font: .8rem/1.5 var(--mono, "Geist Mono", monospace);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.guide-card pre:only-child { margin: 0; }
.guide code { font-family: var(--mono, "Geist Mono", monospace); }
.guide-badges, .library-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-badge {
  padding: 4px 7px;
  border: 1px solid var(--line-hi);
  border-radius: 5px;
  color: var(--text-2);
  font: 500 .7rem/1.1 var(--mono, "Geist Mono", monospace);
}
.guide-scan {
  background: var(--accent-soft);
  color: var(--accent);
}
.guide-rerunnable {
  background: var(--success-soft);
  color: var(--success);
}
.library-controls {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.library-controls label { font-size: .875rem; font-weight: 500; }
.library-controls input {
  width: min(100%, 32rem);
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line-hi);
  border-radius: 8px;
  background: var(--recess);
  color: inherit;
  font: inherit;
}
.library-controls input::placeholder {
  color: var(--text-2);
  opacity: 1;
}
.library-filters button {
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid var(--line-hi);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  font: 500 .75rem var(--mono, "Geist Mono", monospace);
  cursor: pointer;
}
.library-filters button:hover, .library-filters button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-bright);
}
#library-status { font-size: .875rem; }

@media (max-width: 920px) {
  .guide { padding-inline: var(--pad, 26px); }
}

@media (max-width: 639px) {
  .guide { padding-inline: var(--pad, 18px); }
  .guide-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .guide-rollup { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-card { padding: 16px; }
}

.lesson-list {border-top:1px solid var(--line)}
.lesson-row {position:relative;padding:20px 0;border-bottom:1px solid var(--line)}
.lesson-row h3 a {color:var(--text);text-decoration:none}.lesson-row h3 a:after {content:"";position:absolute;inset:0}
.lesson-row h3 a:focus-visible,.lesson-row:hover h3 a {color:var(--accent)}
.lesson-row p,.lesson-row small {display:block;margin-top:6px}.lesson-row small {color:var(--accent)}
.lesson-detail {max-width:850px;overflow-wrap:anywhere}
.lesson-detail h1,.lesson-detail h2,.lesson-detail h3,.lesson-detail p {margin-block:1em .5em}
.lesson-detail pre {white-space:pre-wrap;background:var(--recess);padding:1em}
