:root {
  --bg: #f6f8fb; --surface: #fff; --text: #1d2733; --muted: #5b6776;
  --accent: #0f6cbd; --border: #dde3ea;
  --code-bg: #0f1b2a; --code-text: #e6edf5; --warn: #fff6e0; --warn-border: #f0c36d;
  --tip: #e7f6ee; --tip-border: #7cc99c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b; --surface: #16202b; --text: #e4eaf0; --muted: #93a1b1;
    --accent: #5aa9ee; --border: #263444;
    --code-bg: #0a1018; --warn: #3a2f12; --warn-border: #8a6d1f;
    --tip: #12301f; --tip-border: #2f7a4d;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); }

.topbar { background: #0b2a4a; color: #fff; padding: .8rem 1.25rem; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.15rem; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }

.layout { display: flex; max-width: 1200px; margin: 0 auto; gap: 2rem; padding: 1.5rem 1.25rem; }
.sidebar { flex: 0 0 250px; position: sticky; top: 4.5rem; align-self: flex-start; display: flex; flex-direction: column; gap: .15rem; }
.sidebar a { padding: .5rem .75rem; border-radius: 6px; text-decoration: none; color: var(--text); font-size: .95rem; }
.sidebar a:hover { background: var(--border); }
.sidebar a.active { background: var(--accent); color: #fff; font-weight: 600; }
.content { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 2rem 2.25rem; }

h1 { margin-top: 0; font-size: 2rem; }
h2 { margin-top: 2rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }
.lead { font-size: 1.15rem; color: var(--muted); }

pre { position: relative; background: var(--code-bg); color: var(--code-text); padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: .88rem; line-height: 1.5; }
code { font-family: Consolas, "Cascadia Mono", monospace; }
p code, li code, td code { background: var(--border); padding: .1rem .35rem; border-radius: 4px; font-size: .88em; }
.copy-btn { position: absolute; top: .4rem; right: .4rem; background: #2b3b4f; color: #fff; border: 0; padding: .2rem .6rem; border-radius: 5px; font-size: .75rem; cursor: pointer; }
.copy-btn:hover { background: var(--accent); }

.callout { border-left: 4px solid; border-radius: 6px; padding: .75rem 1rem; margin: 1.25rem 0; }
.callout.warn { background: var(--warn); border-color: var(--warn-border); }
.callout.tip { background: var(--tip); border-color: var(--tip-border); }

table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
th, td { border: 1px solid var(--border); padding: .55rem .7rem; text-align: left; vertical-align: top; }
th { background: var(--bg); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem; text-decoration: none; color: var(--text); background: var(--bg); transition: transform .1s, border-color .1s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .num { color: var(--accent); font-weight: 700; font-size: .85rem; }
.card h3 { margin: .2rem 0 .3rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }

.pager { display: flex; justify-content: space-between; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.pager a { text-decoration: none; font-weight: 600; }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 1rem 2.5rem; }

@media (max-width: 800px) {
  .menu-toggle { display: block; }
  .layout { flex-direction: column; gap: 1rem; padding: 1rem .75rem; }
  .sidebar { display: none; position: static; flex: none; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem; }
  body.nav-open .sidebar { display: flex; }
  .content { padding: 1.25rem; }
}
