/* 土台: 配色（明るい・セピア・暗い）・文字・共通の部品。
   本文の対比は3配色とも 7:1 以上、補助の文字は 4.5:1 以上（設計図 §6.3）。
   描画側（B）が使う色の名前 --bg --fg --muted --line --card --accent と、文字の大きさ --fs（px）も出す。 */
:root {
  --fs: 17px;
  --lh: 1.85;
  --font-sans: system-ui, -apple-system, "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-serif: "Noto Serif JP", "Noto Serif CJK JP", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --font-body: var(--font-sans);
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", "Noto Sans Mono CJK JP", monospace;
  --top-h: 52px;
  --bot-h: 58px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --view-h: calc(100dvh - var(--top-h) - var(--bot-h) - var(--safe-t) - var(--safe-b));

  /* 明るい（紙の白・墨） */
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #1F2328;
  --sub: #59616B;
  --line: #DEDED8;
  --line-strong: #BDBDB5;
  --accent: #245789;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(36, 87, 137, .10);
  --press: rgba(0, 0, 0, .07);
  --code-bg: #F0F0EA;
  --th-bg: #F0F0EA;
  --th2-bg: #F6F6F1;
  --mark: #FFF0A6;
  --hl: #FFE066;
  --hl-cur: #F08C00;
  --hl-cur-ink: #FFFFFF;
  --shade: rgba(0, 0, 0, .16);
  color-scheme: light;
}
:root[data-theme="sepia"] {
  --bg: #F5EEDC;
  --surface: #FBF6EA;
  --ink: #3A2E21;
  --sub: #66563F;
  --line: #E1D6BC;
  --line-strong: #C7B796;
  --accent: #7A4A17;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(122, 74, 23, .10);
  --press: rgba(58, 46, 33, .08);
  --code-bg: #EDE4CC;
  --th-bg: #EDE4CC;
  --th2-bg: #F2EAD6;
  --mark: #F6DE8C;
  --hl: #F2CF5B;
  --hl-cur: #C0620E;
  --shade: rgba(58, 46, 33, .18);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15171A;
  --surface: #1D2024;
  --ink: #D7DADF;
  --sub: #9BA2AB;
  --line: #30343A;
  --line-strong: #4A5058;
  --accent: #82B4E8;
  --accent-ink: #0E1116;
  --accent-soft: rgba(130, 180, 232, .14);
  --press: rgba(255, 255, 255, .08);
  --code-bg: #22262B;
  --th-bg: #24282E;
  --th2-bg: #1F2328;
  --mark: #5B4B12;
  --hl: #7A6420;
  --hl-cur: #D9771F;
  --hl-cur-ink: #0E1116;
  --shade: rgba(0, 0, 0, .55);
  color-scheme: dark;
}
:root {
  --fg: var(--ink);
  --muted: var(--sub);
  --card: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-sans);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow: hidden; font-size: 16px; line-height: 1.5; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .4; cursor: default; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.offscreen { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.aa { font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.noscript { padding: 24px; }

/* 検索の強調（全種類で共通） */
mark.dv-hl { background: var(--hl); color: inherit; border-radius: 2px; }
mark.dv-hl.cur { background: var(--hl-cur); color: var(--hl-cur-ink, #fff); }
