:root {
  --bg: #f6f8fa; --surface: #fff; --text: #1f2933; --muted: #5f6c7b; --border: #dfe4ea;
  --brand: #1b7f5c; --brand-dark: #135c42; --brand-soft: #e4f4ed;
  --note: #e8f1fb; --note-b: #2b6cb0; --warn: #fff6e0; --warn-b: #b7791f;
  --code-bg: #eef1f4; --shadow: 0 1px 3px rgba(0,0,0,.08);
  --header-h: 60px; --side-w: 270px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#12171c; --surface:#1a2128; --text:#e6ebf0; --muted:#9aa7b4; --border:#2c3640;
    --brand:#3fb68b; --brand-dark:#6fd3ae; --brand-soft:#173128; --note:#16263a; --note-b:#63a4e8;
    --warn:#33290f; --warn-b:#e0a93b; --code-bg:#242d36; --shadow:none; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-anchor: auto; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand-dark); }
header.rb-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; gap: 16px;
  padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.rb-brand { font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; }
.rb-brand span { color: var(--brand); }
.rb-menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; color: var(--text); font-size: 18px; cursor: pointer; }
.rb-search { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.rb-search input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; background: var(--bg); color: var(--text); }
.rb-search input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.rb-results { position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; max-height: 70vh; overflow: auto; overscroll-behavior: contain; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); display: none; }
.rb-results.open { display: block; }
.rb-results a { display: block; padding: 10px 14px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.rb-results a:last-child { border-bottom: 0; }
.rb-results a:hover, .rb-results a.active { background: var(--brand-soft); }
.rb-results .r-mod { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rb-results .r-head { font-weight: 600; }
.rb-results .r-snip { font-size: 14px; color: var(--muted); }
.rb-results mark { background: #ffe58a; color: #000; border-radius: 2px; }
.rb-results .r-empty { padding: 14px; color: var(--muted); }
.rb-layout { display: flex; align-items: flex-start; }
aside.rb-side { position: sticky; top: var(--header-h); width: var(--side-w); flex: none; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain;
  padding: 16px; background: var(--surface); border-right: 1px solid var(--border); }
aside.rb-side h4 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
aside.rb-side h4:first-child { margin-top: 0; }
aside.rb-side ul { list-style: none; margin: 0; padding: 0; }
aside.rb-side a { display: block; padding: 5px 10px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: 14.5px; }
aside.rb-side a:hover { background: var(--brand-soft); }
aside.rb-side a.current { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
aside.rb-side ul ul { margin-left: 10px; border-left: 2px solid var(--border); }
main.rb-main { flex: 1; min-width: 0; padding: 32px clamp(16px, 4vw, 48px) 64px; max-width: 980px; }
main h1 { margin-top: 0; font-size: 2rem; line-height: 1.25; }
main h2 { margin-top: 2.4rem; padding-bottom: 6px; border-bottom: 2px solid var(--brand-soft); }
main h3 { margin-top: 1.6rem; }
.lead { font-size: 1.1rem; color: var(--muted); }
.rb-section { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 24px 20px; margin: 24px 0; box-shadow: var(--shadow); }
.rb-section > h2:first-child { margin-top: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; font-size: 13px; }
.meta .chip { background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 2px 10px; }
.menu-path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--code-bg); padding: 1px 6px; border-radius: 4px; }
ol.steps { counter-reset: s; list-style: none; padding-left: 0; }
ol.steps > li { counter-increment: s; position: relative; padding: 4px 0 10px 44px; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.callout { border-left: 4px solid var(--note-b); background: var(--note); padding: 10px 14px; border-radius: 6px; margin: 14px 0; }
.callout.warn { border-color: var(--warn-b); background: var(--warn); }
.callout strong:first-child { display: block; margin-bottom: 2px; }
table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 8px 12px; border: 1px solid var(--border); vertical-align: top; }
th { background: var(--code-bg); }
figure.shot { margin: 16px 0; }
figure.shot img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); display: block; }
figure.shot figcaption { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.shot-pending { border: 2px dashed var(--warn-b); background: var(--warn); border-radius: 8px; padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.shot-pending code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 20px 0; }
.card { display: block; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card h3 { margin: 0 0 6px; color: var(--brand-dark); }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; }
footer.rb-footer { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
@media (max-width: 900px) {
  .rb-menu-btn { display: inline-block; }
  aside.rb-side { position: fixed; z-index: 40; left: 0; top: var(--header-h); transform: translateX(-100%); transition: transform .2s; }
  body.nav-open { overflow: hidden; }
  body.nav-open aside.rb-side { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .rb-brand span.long { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { header.rb-header, aside.rb-side, .pager { display: none; } .rb-section { box-shadow: none; break-inside: avoid-page; } }
