.guide-body { background: var(--page); }

.guide-skip { position: absolute; left: 1rem; top: -6rem; z-index: 2; padding: .5rem; background: var(--paper); }
.guide-skip:focus { top: .5rem; }
.guide-layout { display: grid; grid-template-columns: 13.375rem minmax(0,1fr); gap: clamp(2rem,4.5vw,5rem); width: min(calc(100% - 2 * var(--sp)), 85rem); margin: 0 auto; align-items: start; }
.guide-rail { position: sticky; top: 0; border-right: 1px solid var(--line); padding: 2.6rem 1.1rem 1.3rem 0; height: 100vh; max-height: 100dvh; overflow-y: auto; }
.guide-rail, .mobile-guide-menu { font-size: .9375rem; font-weight: 400; line-height: 1.5; }
.toc-group { margin-block-end: 1.25rem; }
.toc-group :is(a,h2,h3) {
  display: block; margin: 0; padding: .3125rem .625rem;
  border-inline-start: 3px solid transparent; font: inherit; color: var(--text); text-decoration: none;
}
.toc-group :is(h2,h3) { color: var(--ink); font-weight: 600; }
.toc-group .feature-toc:not(:first-child) { margin-block-start: .5rem; }
.feature-toc a { padding-inline-start: 1.5rem; }
.guide-rail a:hover { background: var(--hover); }
.toc-group a[aria-current] { background: var(--accent-tint); color: var(--accent); border-inline-start-color: var(--accent); }
.guide-content { min-width: 0; padding: 2.5rem 0 4rem; }
.guide-content article { min-width: 0; }
.guide-content .guide-crumb { display: flex; gap: .6rem; align-items: center; color: var(--muted); font-size: .77rem; margin: 0 0 1.75rem; }
.guide-crumb span { color: var(--muted); }
.guide-content h1 { color: var(--ink); font-size: clamp(2rem,3.2vw,3rem); font-weight: 800; line-height: 1.12; letter-spacing: -.045em; }
.guide-content h1:focus:not(:focus-visible) { outline: 0; }
.guide-content article > h2 { font-size: 1.35rem; color: var(--ink); margin: 2.45rem 0 .85rem; }
.guide-content article > p:not(.guide-crumb), .guide-content article > ol { color: var(--text); max-width: 82ch; font-size: .98rem; line-height: 1.9; margin: .85rem 0 1.15rem; }
.guide-content article > p.guide-lead { font-size: 1.07rem; margin: 1rem 0 1.65rem; }
.guide-content li { padding-inline-start: .25rem; margin: .35rem 0; }
.guide-content :is(p,td,li) code { background: var(--surface); color: var(--text); padding: .08em .27em; border-radius: 3px; font: .91em var(--mono); overflow-wrap: anywhere; }
.guide-intro { display: grid; grid-template-columns: 1fr minmax(17.5rem, .92fr); align-items: center; gap: clamp(1rem,3.4vw,3rem); padding-bottom: 1.9rem; border-bottom: 1px solid var(--line); }
.intro-copy h1 { font-size: clamp(2.9rem,4.9vw,4.8rem); }
.intro-copy > p { max-width: 31em; line-height: 1.85; font-size: .99rem; color: var(--text); margin: 1.1rem 0; }
.guide-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.guide-actions a { display: inline-flex; justify-content: space-between; gap: .85rem; align-items: center; font-size: .88rem; padding: .58rem .88rem; min-height: 40px; font-weight: 650; border: 1px solid var(--accent); border-radius: 4px; text-decoration: none; }
.guide-primary { background: var(--accent); color: var(--on-accent); }
.guide-actions .guide-secondary { background: transparent; color: var(--ink); border-color: var(--control); }
.guide-actions a:hover { filter: brightness(.94); }
.live-example { padding: 1.1rem 1.25rem .4rem; color: var(--ink); border-radius: 3px; border: 1px solid #193a2d; background-color: #254537; background-image: linear-gradient(#b7caa00b 1px, transparent 1px),linear-gradient(90deg,#b7caa00b 1px, transparent 1px),radial-gradient(at top right,#375a45,transparent 76%); background-size: 20px 20px,20px 20px,100% 100%; }
.live-top, .live-bottom { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.live-top { font-size: .72rem; color: var(--muted); font-weight: 650; letter-spacing: .09em; }
.live-top code { font: .72rem var(--mono); color: var(--accent); letter-spacing: .025em; }
.live-top code:not(:empty)::before { content: ''; display: inline-block; width: .43rem; height: .43rem; border-radius: 50%; background: #c4d99a; margin-right: .44rem; }
.live-example h2 { margin: .8rem 0 .1rem; font-size: 1.32rem; }
.live-example > p { color: var(--text); font-size: .82rem; }
.live-example .stone-mat { min-height: 78px; }
.live-bottom { margin-top: .9rem; padding-top: .18rem; border-top: 1px solid var(--line); color: var(--line); font-size: .72rem; }
.live-bottom i { padding: 0 .3rem; font-style: normal; opacity: .68; }
.live-bottom button { background: transparent; padding: .4rem 0; border: 0; color: var(--text); min-height: 35px; font-weight: 500; font-size: .77rem; }
.live-bottom button:hover:not(:disabled) { color: white; background: transparent; text-decoration: underline; }
.reading-paths { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .8rem; }
.reading-paths a { border: 1px solid var(--line); border-radius: 3px; padding: 1rem 1rem 1.15rem; text-decoration: none; background: var(--paper); }
.reading-paths a:hover { background: var(--hover); border-color: var(--control); }
.reading-paths code { font: .73rem var(--mono); color: var(--accent); }
.reading-paths h3 { display: flex; justify-content: space-between; align-items: center; font-size: 1.01rem; margin: .4rem 0; }
.reading-paths h3 span { font-size: .8rem; font-weight: 500; }
.reading-paths p { color: var(--muted); font-size: .85rem; line-height: 1.65; }
.code-box { margin: 1.25rem 0; border: 1px solid var(--line); border-radius: 3px; background: var(--dark); color: var(--ink); overflow: hidden; }
.code-box figcaption { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--text); padding: .35rem 1rem; font-size: .78rem; }
.code-box button { background: transparent; color: var(--text); border: 1px solid var(--control); border-radius: 3px; font-size: .73rem; padding: .15rem .55rem; min-height: 28px; }
.code-box button:hover:not(:disabled) { background: var(--hover); }
.code-box pre { margin: 0; overflow: auto; padding: 1rem 1.1rem 1.2rem; tab-size: 2; }
.code-box code { font: .85rem/1.75 var(--mono); }
.ref-table { overflow-x: auto; margin: 1.2rem 0; border: 1px solid var(--line); border-radius: 3px; }
.ref-table table { border-collapse: collapse; width: 100%; font-size: .9rem; line-height: 1.65; }
.ref-table th,.ref-table td { border: 0; border-bottom: 1px solid var(--line); padding: .7rem .9rem; text-align: left; vertical-align: top; }
.ref-table tr:last-child td { border-bottom: 0; }
.ref-table th { background: var(--surface); color: var(--ink); }
.ref-table td:first-child { width: 31%; color: var(--ink); }
.ref-table td { background: var(--paper); }
.source-links { display: flex; flex-wrap: wrap; gap: .7rem 1.3rem; }
.source-links a,.chapter-links a { font-size: .87rem; font-weight: 600; }
.chapter-links { border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 2.3rem; display: flex; justify-content: space-between; gap: 1rem; }
.chapter-links a { display: grid; gap: .15rem; max-width: 50%; }
.chapter-links a[rel=next] { margin-inline-start: auto; text-align: end; }
.chapter-links a span { font-size: .78rem; font-weight: 400; color: var(--muted); }
.mobile-guide-menu { display: none; }
@media (max-width: 950px) { .guide-layout { grid-template-columns: 10rem minmax(0,1fr); gap: 1.5rem; } .guide-intro { grid-template-columns: minmax(0,1fr) minmax(14rem,.93fr); } }
@media (max-width: 760px) {
  .guide-layout { display: block; }
  .guide-rail { display: none; }
  .guide-content { padding-top: 1rem; }
  .mobile-guide-menu { display: flex; align-items: center; gap: .8rem; font-size: 1rem; color: var(--muted); padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; }
  .mobile-guide-menu select { flex: 1; width: auto; min-width: 0; min-height: 44px; }
  .mobile-guide-menu :is(optgroup,option) { font: inherit; }
  .mobile-guide-menu optgroup { font-weight: 600; }
  .mobile-guide-menu option { font-weight: 400; }
  .guide-content .guide-crumb { margin-bottom: 1rem; }
}
@media (max-width: 580px) {
  .guide-intro { grid-template-columns: 1fr; gap: 1.3rem; }
  .intro-copy h1 { font-size: clamp(2.35rem,9.2vw,3.1rem); }
  .intro-copy h1 br { display: none; }
  .reading-paths { grid-template-columns: 1fr; gap: .55rem; }
  .reading-paths a { padding: .75rem 1rem; }
  .ref-table th,.ref-table td { padding: .5rem; }
}
