:root {
  color-scheme: light dark;
  --bg: #faf9f7;
  --panel: #ffffff;
  --ink: #1b1d1f;
  --muted: #5d636a;
  --line: #e2e0dc;
  --accent: #2f5fb3;
  --warn-bg: #fff4e0;
  --warn-ink: #7a4a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --panel: #1c1e21;
    --ink: #e8e6e3;
    --muted: #9aa0a6;
    --line: #2e3136;
    --accent: #8fb1ff;
    --warn-bg: #3a2c12;
    --warn-ink: #f3c46b;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  /* ノッチのある端末の横向きで、左右の切り欠きに文字が潜らないように */
  padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
}
main, .masthead, footer.site { max-width: 820px; margin: 0 auto; }
/* ナビゲーションバー。見出しと同じ行に、その場で開くもの（QR・共有）を並べる */
.masthead { display: flex; align-items: center; gap: 14px; padding: 1rem 0; }
.masthead .logo { font-weight: 700; color: inherit; text-decoration: none; letter-spacing: -0.01em; }
.navbar { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: 12px; color: var(--muted); background: none;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.pill:hover { border-color: var(--accent); color: var(--ink); }
.pill svg { flex: none; }
@media (max-width: 460px) { .navbar .pill .t { display: none; } .navbar .pill { padding: 6px 9px; } }

/* QR のポップオーバー。URL は固定なので、生成済みの SVG を置いている（README 参照） */
.qr-pop {
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 18px;
  background: var(--panel); color: var(--ink); text-align: center;
  width: min(300px, calc(100vw - 32px));
}
.qr-pop::backdrop { background: rgb(0 0 0 / 0.55); }
.qr-pop img { display: block; width: 100%; height: auto; border-radius: 8px; }
.qr-pop p { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.qr-pop .url { margin-top: 4px; color: var(--ink); font-size: 11px; word-break: break-all; }
.qr-pop .pill { margin-top: 14px; padding: 7px 26px; }
a { color: var(--accent); }

h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 1.25; margin: 0.25rem 0 0.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.crumb { margin: 0; color: var(--muted); font-size: 0.85rem; }
.lead { margin: 0 0 1rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.chips, .device-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips li {
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.device-list { gap: 0.3rem 1rem; }

.screen {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.screen h2 { margin-top: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem 1.5rem; margin: 0 0 1rem; }
.facts dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.sub { display: block; font-size: 0.72rem; color: var(--muted); }

code { font: 0.88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 0.1em 0.3em; border-radius: 4px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; overflow-x: auto; }
pre code { background: none; padding: 0; }

/* トップの早見表 */
main:has(.atlas) { max-width: 1180px; }
.masthead:has(+ .qr-pop + main .atlas) { max-width: 1180px; }
.toc { display: flex; gap: 1rem; margin: 0 0 1rem; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.25rem 1.5rem; margin: 0 0 1rem; font-size: 0.8rem; color: var(--muted); }
.legend dt { font-weight: 600; color: var(--ink); }
.legend dd { margin: 0; }
.family h2 { margin-top: 2rem; }
.atlas { font-size: 0.85rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; }
.atlas th, .atlas td { vertical-align: top; }
.atlas thead th { position: sticky; top: 0; background: var(--panel); }
.atlas tbody tr:last-child > * { border-bottom: 0; }
.atlas tbody tr:hover > * { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.atlas .num { text-align: right; }
.atlas .strong { font-weight: 700; }
.atlas .unit { margin-left: 0.2em; font-size: 0.75em; font-weight: 400; color: var(--muted); }
.atlas .names { font-weight: 400; white-space: normal; min-width: 16rem; max-width: 26rem; }
.atlas .names a { white-space: nowrap; }
.atlas .names a:not(:last-child)::after { content: ","; margin-right: 0.35em; color: var(--muted); }
.atlas tr.mode > * { color: var(--muted); }
.atlas tr.mode .names a { color: color-mix(in srgb, var(--accent) 70%, var(--muted)); }
.atlas .sub { display: block; font-size: 0.72rem; color: var(--muted); }
.atlas .modes { display: flex; justify-content: flex-end; gap: 0.25rem; margin-top: 0.2rem; }
.tag { font-size: 0.75rem; padding: 0.05rem 0.45rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.warn { border-color: transparent; background: var(--warn-bg); color: var(--warn-ink); }

/* 詳細ページの「同じ画面の機種」 */
.same { margin-top: 1rem; }
.same h3 { margin: 0 0 0.35rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.same ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: 0.9rem; }

footer.site { margin-top: 3rem; padding: 1.25rem 0 2rem; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); }
footer.site p { margin: 0 0 0.4rem; }
/* appbatake へ戻る導線 */
footer.site .credit { margin-top: 0.9rem; }
footer.site .credit a { color: var(--ink); font-weight: 600; text-decoration: none; }
footer.site .credit a:hover { text-decoration: underline; text-underline-offset: 2px; }
main:has(.atlas) + footer.site { max-width: 1180px; }

/* 発表年のメニュー（<details> で開閉する） */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 0 0 1rem; }
.controls .toc { margin: 0; }
.menu { position: relative; }
.menu summary {
  /* 「すべて」と「2026 年」で幅が変わると、右の矢印がずれる。いちばん長い表示に合わせて固定する */
  display: block;
  box-sizing: border-box;
  width: 11rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  list-style: none;
  cursor: pointer;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.9rem;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: "▾"; margin-left: 0.4em; color: var(--muted); }
.menu[open] summary::after { content: "▴"; }
.menu ul {
  position: absolute;
  z-index: 2;
  top: calc(100% + 0.3rem);
  left: 0;
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  min-width: 10rem;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.12);
}
.menu li a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0.9rem; color: inherit; text-decoration: none; font-variant-numeric: tabular-nums; }
.menu li a:hover { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.menu li a[aria-current="page"] { font-weight: 700; color: var(--accent); }
.menu .count { color: var(--muted); font-size: 0.8em; }

/* 発表年を 1 年ずつ動くボタン */
.year-nav { display: flex; align-items: center; gap: 0.4rem; }
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; flex: none;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--ink);
  font-size: 1.1rem; line-height: 1; text-decoration: none;
}
a.step:hover { border-color: var(--accent); color: var(--accent); }
.step[aria-disabled="true"] { color: var(--muted); opacity: 0.4; cursor: default; }
.legend-wrap h2 { font-size: 0.95rem; margin: 2.5rem 0 0.5rem; }
