
:root {
  color-scheme: light dark;
  --bg: #ffffff; --text: #1b1c1e; --muted: #5b6270; --line: #e3e5e9;
  --accent: #1f5fa9; --warn: #a15c00; --bad: #c0392b; --ok: #1a7f4b;
  --panel: #f6f7f9;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15171a; --text: #e8eaee; --muted: #9aa3b0; --line: #2a2e34;
          --accent: #6ea8e8; --panel: #1c1f24; }
}
:root[data-theme="light"] { --bg:#fff; --text:#1b1c1e; --panel:#f6f7f9; --line:#e3e5e9; --muted:#5b6270; }
:root[data-theme="dark"]  { --bg:#15171a; --text:#e8eaee; --panel:#1c1f24; --line:#2a2e34; --muted:#9aa3b0; }

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.bar {
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: -.01em; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--accent); }
.bar-btn { margin-left: auto; align-self: center; padding: 6px 14px; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  text-decoration: none; white-space: nowrap; }
.bar-btn:hover { filter: brightness(1.1); }
.sub { color: var(--muted); font-size: 14px; }

.wrap { display: flex; gap: 40px; max-width: 1180px; margin: 0 auto; padding: 28px 22px 64px; }
.toc { flex: 0 0 230px; position: sticky; top: 20px; align-self: flex-start; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block; padding: 7px 0; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--line); font-size: 15px;
}
.toc a:hover { color: var(--accent); }
.toc a[aria-current="page"] { font-weight: 600; color: var(--accent); }
.toc .n { display: inline-block; width: 22px; color: var(--muted); font-size: 13px; }

main { flex: 1 1 auto; min-width: 0; max-width: 760px; }
h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 21px; margin: 38px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 26px 0 6px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 26px; }

table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table-wrap { overflow-x: auto; }

code, kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
pre {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 14px; line-height: 1.5;
}
.note, .warn {
  border-left: 3px solid var(--accent); background: var(--panel);
  padding: 12px 16px; margin: 20px 0; border-radius: 0 8px 8px 0;
}
.warn { border-left-color: var(--warn); }
.note p:first-child, .warn p:first-child { margin-top: 0; }
.note p:last-child, .warn p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
footer { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
footer a { color: var(--accent); }

figure { margin: 22px 0; }
figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 8px;
}
figure.device img { width: auto; max-width: 250px; margin: 0 auto; }

figure a.zoom { display: block; cursor: zoom-in; border-radius: 8px; }
figure a.zoom:hover img, figure a.zoom:focus-visible img { border-color: var(--accent); }
figure a.zoom:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.zoom-box { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 16px;
  background: rgba(4, 6, 10, .93); cursor: zoom-out; }
.zoom-box[hidden] { display: none; }
.zoom-box img { max-width: 100%; max-height: calc(100vh - 110px); width: auto; height: auto;
  border-radius: 6px; background: #fff; cursor: default;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.zoom-box p { margin: 0; max-width: 1100px; color: #e8edf3; font-size: 15px; line-height: 1.5;
  text-align: center; }
.zoom-box .zoom-x { position: absolute; top: 14px; right: 18px; z-index: 1;
  font: 400 30px/1 system-ui, sans-serif; color: #fff; cursor: pointer;
  background: none; border: 0; padding: 6px 12px; }
.zoom-box .zoom-x:hover { color: var(--accent); }
.zoomed body { overflow: hidden; }

figcaption {
  margin-top: 7px; font-size: 14px; color: var(--muted); line-height: 1.5;
}
figcaption b { color: var(--text); }

.fork { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 30px; }
.fork a { display: block; padding: 14px 16px; border: 1px solid var(--line);
  border-top: 4px solid var(--accent); border-radius: 8px; color: var(--text);
  text-decoration: none; }
.fork a:hover { border-color: var(--accent); }
.fork b { display: block; font-size: 18px; margin-bottom: 4px; color: var(--accent); }
.fork span { color: var(--muted); font-size: 15px; }

.fc-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; margin: 22px 0; }
.fc-strip a { display: block; padding: 8px 10px; border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 6px; color: var(--text);
  text-decoration: none; font-size: 14px; line-height: 1.3; }
.fc-strip a:hover { border-color: var(--accent); }
.fc-strip a.lock { border-left-color: var(--bad); }
.fc-strip span { display: block; font-size: 12px; color: var(--muted); }
.fc-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 18px; }
.fc-legend span { display: inline-flex; align-items: center; gap: 8px; }
.fc-sw::before, .fc-tag::before, .fc-q::before, .fc-ans b:first-child::before {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-right: 8px; vertical-align: -5px;
  border: 2px solid currentColor; border-radius: 5px; font: 700 14px/1 system-ui,
  "Segoe UI Symbol", sans-serif; font-style: normal; letter-spacing: 0;
  text-transform: none; content: "\2192"; color: var(--muted); }
.fc-sw.ask::before, .fc-q::before { content: "?"; color: var(--accent); }
.fc-sw.lock::before, .fc-box.lock .fc-tag::before { content: "!"; color: var(--bad);
  border-style: double; border-width: 4px; }
.fc-sw.done::before, .fc-box.done .fc-tag::before { content: "\2713"; color: var(--ok); }
.fc-sw.go::before, .fc-ans > div.go b:first-child::before { content: "\2193"; color: var(--ok); }
.fc-sw.fix::before, .fc-ans b:first-child::before { content: "\2715"; color: var(--warn); }
.fc-sw::before { margin-right: 0; }
.fc-box.soon .fc-tag::before { content: none; }
.fc-tag { margin-bottom: 2px; }
.fc-strip a.lock span::after { content: " !"; color: var(--bad); font-weight: 700; }

h2 .fc-no { display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin-right: 10px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 16px; vertical-align: 2px; }
h2 + .muted { margin-top: -4px; }

.fc { display: grid; margin: 16px 0 20px; }
.fc > * { position: relative; min-width: 0; }
.fc > * + * { margin-top: 26px; }
.fc > * + *::before { content: ""; position: absolute; left: 28px; top: -26px; height: 18px;
  border-left: 2px solid var(--line); }
.fc > * + *::after { content: ""; position: absolute; left: 23px; top: -9px;
  border: 6px solid transparent; border-top: 7px solid var(--muted); border-bottom: 0; }
.fc-box, .fc-ask { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.fc-box p, .fc-ask p { margin: 4px 0; }
.fc-box ul { margin: 6px 0; padding-left: 20px; }
.fc-tag { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); }
.fc-box.lock { border: 3px double var(--bad); }
.fc-box.lock .fc-tag { color: var(--bad); }
.fc-box.done { border-color: var(--ok); }
.fc-box.done .fc-tag { color: var(--ok); }
.fc-box.soon { border-style: dashed; }
.fc-ask { border: 2px solid var(--accent); background: var(--panel); }
.fc-q { font-weight: 600; }
.fc-qn { display: inline-flex; align-items: center; justify-content: center; width: 24px;
  height: 24px; margin-right: 8px; border: 2px solid var(--accent); border-radius: 5px;
  color: var(--accent); font-size: 13px; }
.fc-q::before, .fc-qn { box-sizing: border-box; width: 26px; height: 26px;
  vertical-align: middle; }
.fc-said { font-style: italic; }
.fc-ans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.fc-ans > div { background: var(--bg); border: 1px solid var(--line);
  border-left: 4px solid var(--warn); border-radius: 6px; padding: 8px 12px; font-size: 15px; }
.fc-ans > div.go { border-left-color: var(--ok); }
.fc-ans b:first-child { display: block; font-size: 13px; letter-spacing: .06em;
  text-transform: uppercase; }
.fc .table-wrap table { margin: 6px 0 0; }

@media (max-width: 820px) {
  .wrap { flex-direction: column; gap: 22px; }
  .toc { position: static; flex-basis: auto; }
  .fc-ans, .fork { grid-template-columns: 1fr; }
}

@media print {
  .bar, .toc { display: none; }
  .wrap { display: block; padding: 0; }
  main { max-width: none; }
  body { font-size: 11.5pt; }
  h2, h3 { page-break-after: avoid; }
  pre, table, .note, .warn, figure, .fc-box, .fc-ask { page-break-inside: avoid; }
  figure img { border-color: #999; }
  .zoom-box { display: none; }
  .note, .warn { border: 1px solid #999; border-left-width: 3px; }
}
