/* レイアウト: 1段組みの読み物。ビットの「マス目」を図の共通部品にして、数字は等幅でそろえる */
:root {
  --bg: #f7f9f8;
  --surface: #ffffff;
  --fg: #1c2a2a;
  --muted: #5a6b6b;
  --line: #d5dedc;
  --accent: #0b7a75;
  --accent-soft: #dff1ef;
  --on: #0b7a75;
  --on-fg: #ffffff;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4a00;
  --font-body: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121a1a; --surface: #1a2525; --fg: #e4eceb; --muted: #9db0ae; --line: #2f3f3e;
    --accent: #4fc4bd; --accent-soft: #1d3a38; --on: #4fc4bd; --on-fg: #0c1616;
    --warn-bg: #3a3112; --warn-fg: #f0d98a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121a1a; --surface: #1a2525; --fg: #e4eceb; --muted: #9db0ae; --line: #2f3f3e;
  --accent: #4fc4bd; --accent-soft: #1d3a38; --on: #4fc4bd; --on-fg: #0c1616;
  --warn-bg: #3a3112; --warn-fg: #f0d98a; color-scheme: dark;
}
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.9;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 2rem 4rem;
}
main { max-width: 42rem; margin: 0 auto; display: flex; flex-direction: column; gap: 2.5rem; }
header { display: flex; flex-direction: column; gap: .75rem; }
.draft { background: var(--warn-bg); color: var(--warn-fg); padding: .6rem .9rem; border-radius: 4px; font-size: .9rem; line-height: 1.6; }
.path { color: var(--muted); font-size: .85rem; }
h1 { font-size: 1.9rem; line-height: 1.3; margin: 0; text-wrap: balance; }
h2 { font-size: 1.35rem; line-height: 1.4; margin: 0; padding-bottom: .4rem; border-bottom: 2px solid var(--accent); text-wrap: balance; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: 0; }
section { display: flex; flex-direction: column; gap: 1rem; }
ul { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .3rem; }
.mono, code { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--accent-soft); padding: .05em .35em; border-radius: 3px; }
.point { background: var(--accent-soft); padding: .8rem 1rem; border-radius: 4px; font-weight: 500; }
.bits { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bit { width: 2rem; height: 2rem; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); font-family: var(--font-mono); font-weight: 700; border-radius: 3px; }
.bit.on { background: var(--on); color: var(--on-fg); border-color: var(--on); }
.caption { color: var(--muted); font-size: .88rem; line-height: 1.6; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: .45rem .7rem; text-align: left; line-height: 1.5; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 12rem; }
th { background: var(--accent-soft); font-weight: 700; }
.talk { border: 1px dashed var(--line); padding: .9rem 1rem; border-radius: 4px; display: flex; flex-direction: column; gap: .5rem; }
.talk h3 { color: var(--accent); }
.todo { color: var(--muted); font-size: .9rem; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: .7rem 1rem; }
summary { cursor: pointer; font-weight: 500; }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
details > div { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.quiz { display: flex; flex-direction: column; gap: .7rem; }
footer { color: var(--muted); font-size: .85rem; line-height: 1.7; border-top: 1px solid var(--line); padding-top: 1rem; }
a { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.site { font-weight: 700; font-size: .95rem; }
.site a { text-decoration: none; }
.list { list-style: none; padding: 0; gap: .6rem; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: .7rem 1rem; }
.list small { display: block; color: var(--muted); line-height: 1.6; }
