.guide { --g-fs: 0.84rem; --g-code: 0.74rem; }
.guide.slide { padding-top: clamp(14px, 2.2vh, 64px) !important; padding-bottom: clamp(14px, 2.2vh, 64px) !important; }
.guide.slide .section-head { margin-bottom: clamp(10px, 1.6vh, 28px); }
.guide .section-head { max-width: min(72%, 62rem); gap: 10px; }
.guide .section-head p code { font-size: 0.86em; color: var(--ink); }
.guide .section-head h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }

/* ------------------------------------------------------------------ columns */
.guide-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-block: 1px solid var(--line-strong);
}
.guide-grid.wide-left { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.guide-grid.wide-left-s { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.guide-col { min-width: 0; padding: 16px 28px 16px 0; display: flex; flex-direction: column; gap: 10px; }
.guide-col + .guide-col { padding: 16px 0 16px 28px; border-left: 1px solid var(--line); }

/* ------------------------------------------------------------------ text */
.guide-label {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500; line-height: 1.4;
  letter-spacing: 0.02em; color: var(--muted);
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.guide-label:not(:first-child) { margin-top: 6px; }
.guide-text, .guide-note { font-size: var(--g-fs); line-height: 1.65; color: var(--ink-2); }
.guide-note { font-size: 0.8rem; color: var(--muted); }
.guide-note.verdict { color: var(--ink-2); font-size: var(--g-fs); padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--r-xs); background: var(--paper); }
.guide :is(.guide-text, .guide-note, .guide-list, .guide-table) code { font-size: 0.88em; color: var(--ink); overflow-wrap: anywhere; }

.guide-list { list-style: none; margin: 0; padding: 0; counter-reset: g; display: grid; font-size: var(--g-fs); line-height: 1.6; color: var(--ink-2); }
.guide-list > li { counter-increment: g; position: relative; padding: 5px 0 5px 2.2rem; }
.guide-list > li + li { border-top: 1px solid var(--line); }
.guide-list > li::before { content: counter(g, decimal-leading-zero); position: absolute; left: 0; top: 5px; font-family: var(--mono); font-size: 0.74rem; line-height: 1.6rem; color: var(--ruri-text); }
.guide-list.compact { font-size: 0.8rem; }
.guide-list.compact > li { padding-block: 3px; line-height: 1.55; }
.guide-list.compact > li::before { top: 3px; }
.guide-list.plain > li::before { content: "·"; font-size: 1rem; color: var(--muted); }

.guide .st { display: inline-block; font-size: 0.74rem; line-height: 1.5; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.guide .st.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.guide .st.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); }
.guide .st.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.guide-list.steps-out .st { margin-left: 4px; }

/* ------------------------------------------------------------------ tables */
.guide-table { min-width: 0; width: 100%; font-size: 0.8rem; line-height: 1.5; border: 1px solid var(--line-strong); background: var(--paper); }
.guide-table th, .guide-table td { padding: 5px 10px; color: var(--ink-2); }
.guide-table thead th { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); font-weight: 500; background: var(--paper-2); }
.guide-table thead th:nth-child(2) { color: var(--muted); font-weight: 500; }
.guide-table tbody td:nth-child(2) { background: none; color: var(--ink-2); }
.guide-table tbody th { font-weight: 500; color: var(--ink); }
.guide-table tbody th code { color: var(--ink); }
.guide-table tbody tr:last-child > * { border-bottom: 0; }

.guide-table.fields tbody th { width: 25%; line-height: 1.6; }
.guide-table.fields tbody th code { display: inline-block; margin-right: 6px; }
.guide-table.fields .req { white-space: nowrap; color: var(--muted); }
.guide-table.fields .req.must { color: var(--ink); font-weight: 600; }

.guide-table.methods tbody th { white-space: nowrap; }
.guide-table.methods td:last-child { width: 26%; color: var(--ink); }

.guide-table.statuses tbody th { white-space: nowrap; }
.guide-table.statuses td:nth-child(2) { width: 34%; }
.guide-table .codes { line-height: 1.6; }
.guide-table .codes code { font-size: 0.68rem; color: var(--muted); margin-right: 6px; white-space: nowrap; }

.guide-table.exits tbody th { width: 2.6rem; text-align: center; }
.guide-table.exits tbody th code { color: var(--ruri-text); font-weight: 500; }

.guide .agree { display: grid; gap: 8px; }
.guide .agree dl { margin: 0; display: flex; flex-wrap: wrap; border: 1px solid var(--line-strong); background: var(--paper); font-size: 0.8rem; }
.guide .agree dl > div { flex: 1 1 0; min-width: 9rem; display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; }
.guide .agree dl > div + div { border-left: 1px solid var(--line); }
.guide .agree dt code { font-size: 0.74rem; }
.guide .agree dd { margin: 0; color: var(--ink-2); }

.guide-table.ext tbody th { white-space: nowrap; width: 9.5rem; }
.guide-table.ext tbody th code { display: block; }
.guide-table.ext td:nth-child(2) { width: 52%; }
.guide-table.ext td:last-child { padding: 6px; background: var(--code-bg); }
.guide-table.ext .guide-code { border: 0; padding: 4px 6px; background: none; font-size: 0.68rem; line-height: 1.55; }
.guide .guide-note.alg { margin-top: 12px; }

/* ------------------------------------------------------------------ code cells */
.guide-cell { margin: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--paper); }
.guide-cell > figcaption { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.guide-code {
  margin: 0; padding: 10px 14px;
  font-size: var(--g-code); line-height: 1.5; color: var(--ink);
  background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  white-space: pre; overflow-x: auto; overflow-wrap: normal;
}
.guide-cell .guide-code { border: 0; border-radius: 0; }
.guide-cell .guide-code + .guide-code, .guide-cell .slices + .guide-code { border-top: 1px solid var(--line); }
.guide-cell > .guide-note { padding: 8px 12px; border-top: 1px solid var(--line); }
.guide-code .k { color: var(--ruri-text); font-weight: 500; }
.guide-code .x { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.guide-code.payload { background: color-mix(in srgb, var(--ruri-soft) 45%, var(--code-bg)); }
.guide-code.formula { font-size: 0.72rem; }

/* ------------------------------------------------------------------ slice diagram */
.slices {
  --lh: 1.36rem;
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr) 7.2rem 7.2rem;
  grid-auto-rows: var(--lh);
  counter-reset: ln;
  padding: 10px 12px 10px 0;
  background: var(--code-bg);
  font-family: var(--mono); font-size: var(--g-code);
}
.slices .ln {
  grid-column: 2; counter-increment: ln; position: relative;
  line-height: var(--lh); padding-left: 2.6rem; padding-right: 10px;
  white-space: pre; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2);
}
.slices .ln::before { content: counter(ln); position: absolute; left: 0; width: 1.8rem; text-align: right; color: var(--muted); opacity: 0.7; font-size: 0.66rem; }
.slices .ln:first-child { font-family: var(--sans); font-weight: 700; color: var(--ink); }
.slices .ln.blk { color: var(--muted); }
.slices .ln.b1 { background: color-mix(in srgb, var(--ok) 9%, transparent); }
.slices .ln.b2 { background: color-mix(in srgb, var(--ruri) 9%, transparent); }
.slices .ln.open, .slices .ln.close { color: var(--ink-2); }

.slices .tag { grid-column: 1; align-self: stretch; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-family: var(--sans); font-size: 0.68rem; color: var(--muted); border-right: 1px solid var(--line-strong); }
.slices .t-body { grid-row: 1 / 5; }
.slices .t-b1 { grid-row: 5 / 10; color: var(--ok); }
.slices .t-b2 { grid-row: 10 / 15; color: var(--ruri-text); }

.slices .bar { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding-left: 18px; font-family: var(--sans); font-size: 0.68rem; line-height: 1.3; color: var(--ink-2); }
.slices .bar::before { content: ""; position: absolute; left: 4px; top: 3px; bottom: 3px; width: 8px; border: 2px solid currentColor; border-left: 0; border-radius: 0 3px 3px 0; }
.slices .bar b { font-family: var(--mono); font-weight: 600; font-size: 0.74rem; }
.slices .bar span { color: var(--muted); }
.slices .s1 { grid-column: 3; grid-row: 1 / 5; color: var(--ok); }
.slices .s2 { grid-column: 4; grid-row: 1 / 10; color: var(--ruri-text); }

/* ------------------------------------------------------------------ reference link */
.guide-ref { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 0.8rem; }
.guide-ref a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-strong); padding-bottom: 1px; }
.guide-ref a:hover { color: var(--ruri-text); border-bottom-color: currentColor; }
.guide-ref .lucide { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ narrow screens */
@media (max-width: 980px) {
  .guide .section-head { max-width: none; }
  .guide-grid, .guide-grid.wide-left, .guide-grid.wide-left-s { grid-template-columns: minmax(0, 1fr); }
  .guide-col { padding: 18px 0; }
  .guide-col + .guide-col { padding: 18px 0; border-left: 0; border-top: 1px solid var(--line); }
  .guide-table.ext, .guide-table.ext tbody, .guide-table.ext tr, .guide-table.ext th, .guide-table.ext td { display: block; width: auto; }
  .guide-table.ext thead { display: none; }
  .guide-table.ext tr { border-bottom: 1px solid var(--line-strong); }
  .guide-table.ext tr:last-child { border-bottom: 0; }
  .guide-table.ext th, .guide-table.ext td, .guide-table.ext td:nth-child(2) { border: 0; width: auto; }
  .guide-table.ext tbody th code { display: inline; margin-right: 8px; }
}
@media (max-width: 560px) {
  .slices { grid-template-columns: 0 minmax(0, 1fr) 5.4rem 5.4rem; }
  .slices .tag { visibility: hidden; }
  .slices .ln { padding-left: 2.2rem; }
  .slices .bar span { display: none; }
  .guide-table.statuses .codes code { white-space: normal; }
  .guide .agree dl > div + div { border-left: 0; border-top: 1px solid var(--line); }
}
