/* 色はアプリの docs/DESIGN.md（Dark Slate / 紙・案 LA）と同じ */
:root {
  --bg: #0B0C14; --surface: #151726; --text: #E8EAF4; --sub: #8A8FA8; --dim: #555A73;
  --rule: #1F2236; --accent: #9A8CFF; --accent-soft: rgba(154,140,255,.15); --success: #3DDC97;
  --on-accent: #0B0C14;
  color-scheme: dark;
}
/* 自動は端末に従い、明示の選択（JS が覚えた html の data-scheme、または上のバーのラジオ）を優先する */
@media (prefers-color-scheme: light) {
  :root:not([data-scheme="dark"]):not(:has(#theme-dark:checked)) {
    --bg: #F5F4EF; --surface: #FFFFFF; --text: #14151F; --sub: #62657A; --dim: #8B8E9E;
    --rule: #E2E0D8; --accent: #5B4BD6; --accent-soft: rgba(91,75,214,.12); --success: #1C7F52;
    --on-accent: #FFFFFF;
    color-scheme: light;
  }
}
:root:is([data-scheme="light"], :has(#theme-light:checked)) {
  --bg: #F5F4EF; --surface: #FFFFFF; --text: #14151F; --sub: #62657A; --dim: #8B8E9E;
  --rule: #E2E0D8; --accent: #5B4BD6; --accent-soft: rgba(91,75,214,.12); --success: #1C7F52;
  --on-accent: #FFFFFF;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0 20px 80px; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 17px; line-height: 1.9;
}
main { max-width: 720px; margin: 0 auto; }
a { color: var(--accent); }
.topbar { max-width: 720px; margin: 0 auto; padding: 14px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 8px; margin-inline-end: auto; color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
.brand img { border-radius: 7px; }
.pages { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; }
.pages a { color: var(--sub); text-decoration: none; }
.pages a[aria-current="page"] { color: var(--text); font-weight: 600; }
.display-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.themes { display: flex; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; font-size: 14px; line-height: 1.8; }
.themes { min-inline-size: 0; margin: 0; }
.themes label { padding: 4px 8px; border-radius: 999px; color: var(--sub); text-decoration: none; white-space: nowrap; }
.themes label { cursor: pointer; }
.themes input:checked + label { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.themes input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* 狭い画面: アプリ名、言語とテーマ、ページの順に折り返す。 */
@media (max-width: 560px) {
  .brand, .pages { width: 100%; }
}
main > header { border-bottom: 1px solid var(--rule); padding: 32px 0 18px; margin-bottom: 32px; }
.app-name { font-size: 14px; letter-spacing: .18em; color: var(--sub); margin: 0 0 8px; }
h1 { font-size: 30px; font-weight: 600; line-height: 1.3; margin: 0 0 8px; }
h2 { font-size: 21px; margin: 36px 0 8px; }
.updated { font-size: 14px; color: var(--sub); margin: 0; }
.i18n-note { font-size: 15px; color: var(--sub); border-inline-start: 3px solid var(--rule); padding-inline-start: 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: start; border-bottom: 1px solid var(--rule); padding: 8px 10px; vertical-align: top; }
th { color: var(--sub); font-weight: 500; }
footer { max-width: 720px; margin-inline: auto; border-top: 1px solid var(--rule); margin-top: 56px; padding-top: 20px; font-size: 14px; color: var(--sub); }
footer p { margin: 6px 0; }
footer a { color: var(--sub); }

/* 言語ごとの書体。Hiragino を全言語の既定にすると、zh が日本語の字形で描かれ、ru・vi が和文書体の欧文になる */
:lang(ja) body { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif; }
:lang(zh-Hans) body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
:lang(zh-Hant) body { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif; }
:lang(ko) body { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
/* アラビア文字は字をつなげて書くので、字間を広げると切れる */
:lang(ar) .app-name, :lang(ar) h1 { letter-spacing: 0; }

/* 言語切替。今の言語だけを出し、details/summary で開閉する（JS なし。N-Back の LP と同じ作り） */
.langpick { position: relative; font-size: 14px; line-height: 1.8; }
.langpick > summary { list-style: none; cursor: pointer; color: var(--sub); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.langpick > summary::-webkit-details-marker { display: none; }
.langpick > summary::after { content: " \25BE"; color: var(--accent); }
.langpick > summary:hover, .langpick[open] > summary { color: var(--text); }
.langpick[open] > summary { border-color: var(--accent); }
.langpick > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.langpick ul { position: absolute; inset-inline-start: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; list-style: none; min-width: 11rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.langpick li { margin: 0; }
.langpick ul a { display: block; padding: 4px 10px; border-radius: 8px; color: var(--sub); text-decoration: none; white-space: nowrap; }
.langpick ul a:hover { background: var(--accent-soft); color: var(--text); }
/* 今いる言語は移動先ではないので、リンクらしく見せない */
.langpick ul a[aria-current="true"] { color: var(--text); font-weight: 600; }
