/* なんぷれ日和のサイト。元はアプリのサイトと同じスタイル（色は末尾の np.css で替える）。外部のフォントは読み込まない。 */
:root {
  --paper: #edf0f3;      /* 藍を薄めた白 */
  --paper-2: #e2e7ec;
  --ink: #1a1f2b;        /* 墨 */
  --mute: #5b6577;       /* 鈍色 */
  --line: #c3cbd6;
  --ai: #24345a;         /* 藍 */
  --ai-tint: rgba(36, 52, 90, .10);
  --shu: #c23b2a;        /* 朱（判子だけ） */
  --logo: url("logo_np_b.webp?v=b6efbdf8d2");
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", "Iowan Old Style", Georgia, serif;
  --gothic: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121a2c;
    --paper-2: #18223a;
    --ink: #e4e8ee;
    --mute: #98a3b5;
    --line: #2f3b55;
    --ai: #9fb3e0;
    --ai-tint: rgba(159, 179, 224, .14);
    --shu: #e0604c;
    --logo: url("logo_np_w.webp?v=ac16a46c72");
  }
}

/* アプリから開いたときは、アプリのテーマ（<html> の theme-dark・theme-light）を端末の設定より優先する。
   :root.theme-* は :root より強いので、上の @media の規則に勝つ */
:root.theme-light {
  --paper: #edf0f3;      /* 藍を薄めた白 */
  --paper-2: #e2e7ec;
  --ink: #1a1f2b;        /* 墨 */
  --mute: #5b6577;       /* 鈍色 */
  --line: #c3cbd6;
  --ai: #24345a;         /* 藍 */
  --ai-tint: rgba(36, 52, 90, .10);
  --shu: #c23b2a;        /* 朱（判子だけ） */
  --logo: url("logo_np_b.webp?v=b6efbdf8d2");
  color-scheme: light;
}
:root.theme-dark {
  --paper: #121a2c;
  --paper-2: #18223a;
  --ink: #e4e8ee;
  --mute: #98a3b5;
  --line: #2f3b55;
  --ai: #9fb3e0;
  --ai-tint: rgba(159, 179, 224, .14);
  --shu: #e0604c;
  --logo: url("logo_np_w.webp?v=ac16a46c72");
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* 文字の大きさはここだけで決める。ほかの大きさ・余白はすべて rem・em（この何倍か）で書く。
   右上の「文字 小・中・大」で <html> に fs-s・fs-l が付く（中は印なし） */
:root { --fs: 15px; }
:root.fs-s { --fs: 14px; }
:root.fs-l { --fs: 17px; }
html { -webkit-text-size-adjust: 100%; font-size: var(--fs); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.7 var(--gothic);
}
a { color: var(--ai); text-underline-offset: .2em; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }

/* 頭と足 */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 64rem; margin: 0 auto; padding: 1rem 1rem .5rem;
}
.bar .home { display: block; width: 7.5rem; height: 2.6rem; background: var(--logo) left center / contain no-repeat; }
.bar .home span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bar nav { display: flex; gap: 1.1rem; font-size: .9rem; }
.bar nav a { color: var(--mute); text-decoration: none; }
.bar nav a[aria-current="page"], .bar nav a:hover { color: var(--ink); }
.foot { max-width: 64rem; margin: 4rem auto 0; padding: 1.2rem 1rem 2.2rem; border-top: 1px solid var(--line); color: var(--mute); font-size: .85rem; }
.foot a { color: var(--mute); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
.foot-end { max-width: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.5rem; margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin-right: auto; }

/* アプリの中で見せるとき（<html class="in-app">）は、頭・足・パンくずを隠す */
.in-app .foot, .in-app .crumb { display: none; }
.in-app main { padding-top: 1rem; }

/* 本文 */
main { max-width: 64rem; margin: 0 auto; padding: 0 1rem; }
.page { max-width: 40rem; }
.crumb { margin: 2.5rem 0 .25rem; font-size: .85rem; color: var(--mute); }
.crumb a { color: var(--mute); }
h1, h2, h3 { font-family: var(--mincho); font-weight: 600; line-height: 1.35; letter-spacing: .02em; }
h1 { font-size: 1.6rem; margin: .2rem 0 1.2rem; }
h2 { font-size: 1.2rem; margin: 2.6rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: 1.8rem 0 .4rem; }
p, li { max-width: 38rem; }
.lead { color: var(--mute); }
.note { color: var(--mute); font-size: .92rem; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 1rem 0; }
dl.facts dt { color: var(--mute); }
dl.facts dd { margin: 0; }

/* 表（行の間に細い横線だけ。見出しの行は薄い字） */
table.data { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .875rem; }
table.data th, table.data td { text-align: start; vertical-align: top; padding: .45rem .7rem .45rem 0; border-bottom: 1px solid var(--line); }
table.data th { color: var(--mute); font-weight: 600; }
table.data th:not(:last-child), table.data td:first-child, table.data .nw { white-space: nowrap; }
table.data td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 判子（まだ書いていないところ） */
.seal {
  display: inline-flex; align-items: center; gap: .45em;
  padding: .15em .55em; margin: 0 .2em;
  border: 2px solid var(--shu); border-radius: 3px;
  color: var(--shu); font: 600 .8rem/1.4 var(--mincho);
  transform: rotate(-3deg); white-space: nowrap; vertical-align: .1em;
}
.seal::before { content: "未"; font-size: 1.05em; padding-right: .45em; border-right: 1px solid var(--shu); }
.tbd-block {
  margin: 1.2rem 0; padding: 1rem 1.2rem;
  border: 1px dashed var(--line); border-radius: 4px; color: var(--mute);
}
.tbd-block .seal { margin: 0 0 .5rem; }

/* 順番のある目次（チュートリアル） */
ol.steps { list-style: none; margin: 2rem 0; padding: 0; counter-reset: step; }
ol.steps li { position: relative; counter-increment: step; display: grid; grid-template-columns: 3rem 1fr; gap: 0 1rem; padding: 1.1rem 0; border-top: 1px solid var(--line); max-width: none; }
ol.steps li:last-child { border-bottom: 1px solid var(--line); }
/* 番号は筆の大字の画像（tools/site/numerals.py で作る型）。色は墨色で、暗い表示では白になる */
ol.steps li::before {
  content: ""; grid-row: span 2; width: 2.7rem; height: 2.7rem; margin-top: .1rem;
  background: var(--ink);
  -webkit-mask: var(--n) left top / contain no-repeat; mask: var(--n) left top / contain no-repeat;
}
ol.steps a { font: 600 1.15rem/1.4 var(--mincho); text-decoration: none; color: var(--ink); }
ol.steps a:hover { color: var(--ai); }
/* 大字の上にもリンクの当たりを広げる（大字を押してもタイトルと同じページへ） */
ol.steps a::after { content: ""; position: absolute; left: 0; top: 1.1rem; width: 2.7rem; height: 2.8rem; }
ol.steps li:has(a:hover)::before { background: var(--ai); }
ol.steps p { margin: .2rem 0 0; color: var(--mute); font-size: .93rem; }

/* 順番のない一覧（サポート） */
ul.links { list-style: none; margin: 1.5rem 0; padding: 0; }
ul.links li { padding: .9rem 0; border-top: 1px solid var(--line); max-width: none; }
ul.links li:last-child { border-bottom: 1px solid var(--line); }
ul.links a { font: 600 1.08rem/1.4 var(--mincho); text-decoration: none; color: var(--ink); }
ul.links a:hover { color: var(--ai); }
ul.links p { margin: .15rem 0 0; color: var(--mute); font-size: .92rem; }

/* 盤の図 */
figure.board { margin: 1rem 0 .5rem; }
.grid {
  display: grid; grid-template-columns: 1.4rem repeat(9, 1fr); gap: 0;
  width: min(100%, 27rem); font-family: var(--mincho);
}
.grid .lab { display: flex; align-items: center; justify-content: center; font: .72rem/1 var(--gothic); color: var(--mute); }
.grid .colhead { height: 1.4rem; }
.grid .c {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.grid .c.l { border-left: 2px solid var(--ink); }
.grid .c.r3 { border-right: 2px solid var(--ink); }
.grid .c.t { border-top: 2px solid var(--ink); }
.grid .c.b3 { border-bottom: 2px solid var(--ink); }
.grid .c.hl { background: var(--ai-tint); }
.grid .c.see { color: var(--ai); font-weight: 600; }
.grid .c.goal { box-shadow: inset 0 0 0 2px var(--shu); color: var(--shu); font-weight: 600; }
figure.board figcaption { margin-top: .6rem; font-size: .88rem; color: var(--mute); max-width: 32rem; }

/* 画面の写真 */
figure.shot { margin: 1rem 0 .5rem; }
figure.shot img { display: block; width: min(100%, 20rem); height: auto; border: 1px solid var(--line); border-radius: 10px; }
figure.shot figcaption { margin-top: .6rem; font-size: .88rem; color: var(--mute); max-width: 32rem; }

/* トップ */
.hero {
  position: relative; overflow: hidden;
  min-height: min(78vh, 40rem); display: grid; align-content: center;
  padding: 3rem 1rem 4rem; margin: 0 -1rem;
}
.hero::before {
  /* 障子の桟のような格子。マスは正方形（1 辺 --cell）で、3 マスごとに太い線（ナンプレの盤と同じ）。
     枠の大きさで割ると横長のマスになるので、マスの大きさを決めて敷きつめる */
  --cell: clamp(2.6rem, 6.2vw, 4.6rem);
  /* 和紙の地の上でも線が見えるように、線を墨の色に寄せて濃くする */
  --line: color-mix(in srgb, var(--ink) 30%, transparent);
  content: ""; position: absolute; inset: -2px; z-index: 0; pointer-events: none;
  background:
    linear-gradient(var(--line) 2px, transparent 2px) 0 0 / calc(var(--cell) * 3) calc(var(--cell) * 3),
    linear-gradient(90deg, var(--line) 2px, transparent 2px) 0 0 / calc(var(--cell) * 3) calc(var(--cell) * 3),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / var(--cell) var(--cell),
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / var(--cell) var(--cell);
  opacity: .8;
  mask-image: radial-gradient(ellipse at 40% 50%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 40% 50%, #000 20%, transparent 75%);
}
.hero > * { position: relative; z-index: 1; }
.hero .logo {
  width: min(92vw, 46rem); aspect-ratio: 1024 / 395;
  background: var(--logo) center / contain no-repeat;
  animation: ink 1.6s cubic-bezier(.2, .7, .2, 1) both;
}
.hero .logo span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@keyframes ink { from { opacity: 0; filter: blur(10px); transform: scale(1.03); } to { opacity: 1; filter: none; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hero .logo { animation: none; } }
.hero .tag { margin: 1.6rem 0 0 .3rem; font: 600 1.2rem/1.6 var(--mincho); max-width: 40rem; }
.hero .tag-en { margin: .2rem 0 0 .3rem; color: var(--mute); font-size: .95rem; }
/* 言語の付かない入口: ロゴの下に言語のボタン */
.entry-langs { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem; margin: 2.2rem 0 0 .3rem; padding: 0; }
.entry-langs li { max-width: none; }
.entry-langs a { display: inline-block; padding: .65rem 2rem; border: 1px solid var(--ink); border-radius: 999px; background: var(--paper);
  font: 600 1.08rem/1.4 var(--mincho); color: var(--ink); text-decoration: none; }
.entry-langs a:hover { background: var(--ink); color: var(--paper); }

.gates { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 3rem; margin: 1rem 0 0; }
.gate { padding: 1.6rem 0; border-top: 2px solid var(--ink); }
.gate h2 { margin: 0 0 .3rem; font-size: 1.5rem; }
.gate h2 a { color: var(--ink); text-decoration: none; }
.gate h2 a:hover { color: var(--ai); }
.gate p { margin: 0 0 .8rem; color: var(--mute); }
.gate .langs { display: flex; gap: 1.2rem; }
.gate .langs a { font-weight: 600; }
.store { margin: 3rem 0 0; color: var(--mute); }

@media (max-width: 40rem) {
  h1 { font-size: 1.45rem; }
  .bar { flex-wrap: wrap; }
  .bar .home { width: 6rem; height: 2.1rem; }
  .bar nav { gap: .8rem; font-size: .85rem; }
  .hero { min-height: 60vh; }
}

/* 候補（メモ）のある図 */
.grid .c.notes { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 1px; font: .62rem/1 var(--gothic); color: var(--mute); }
.grid .c.notes i { display: flex; align-items: center; justify-content: center; font-style: normal; }
.grid .c.notes i.key { color: var(--ai); font-weight: 700; }
.grid .c.notes i.del { color: var(--shu); text-decoration: line-through; text-decoration-thickness: 1.5px; font-weight: 700; }
.grid .c.notes.goal { box-shadow: inset 0 0 0 2px var(--shu); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin: .4rem 0 0; font-size: .82rem; color: var(--mute); }
.legend b { color: var(--ai); }
.legend s { color: var(--shu); text-decoration-thickness: 1.5px; font-weight: 700; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.pager a { font-family: var(--mincho); }
@media (min-width: 40rem) { .grid .c.notes { font-size: .78rem; } }

/* 右上の言語の切り替え */
.bar { flex-wrap: wrap; }
.bar nav { margin-left: auto; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-size: .82rem; }
.lang-switch > * { padding: .2rem .75rem; line-height: 1.6; }
.lang-switch a { color: var(--mute); text-decoration: none; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch [aria-current] { background: var(--ai); color: var(--paper); font-weight: 600; }

/* 文字の大きさの切り替え（言語の切り替えの隣）。アプリの中では頭を隠すが、これだけは出す */
.fs-switch { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-size: .82rem; }
.fs-switch span { padding: .2rem .2rem .2rem .75rem; color: var(--mute); line-height: 1.6; }
.fs-switch button { padding: .2rem .55rem; border: 0; background: none; color: var(--mute); font: inherit; line-height: 1.6; cursor: pointer; }
.fs-switch button:hover { color: var(--ink); }
.fs-switch button[aria-pressed="true"] { background: var(--ai); color: var(--paper); font-weight: 600; }
.fs-switch button:focus-visible { outline: 2px solid var(--shu); outline-offset: -2px; }
/* 頭の切り替え（文字の大きさ・言語）は同じ高さにそろえる（中身は縦のまん中） */
.bar .fs-switch, .bar .lang-switch { box-sizing: border-box; height: 1.9rem; align-items: stretch; }
.bar .fs-switch > *, .bar .lang-switch > * { display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; }
.in-app .bar { display: flex; justify-content: flex-end; padding-bottom: 0; }
.in-app .bar > :not(.fs-switch) { display: none; }

/* 解法のページの手順と凡例の枠 */
ol.reason { margin: 1.2rem 0 0; padding-left: 1.6em; }
ol.reason li { margin: .35rem 0; padding-left: .2em; }
ol.reason li::marker { font-family: var(--mincho); font-weight: 600; color: var(--ai); }
.legend .box { display: inline-block; width: .95em; height: .95em; vertical-align: -.12em; box-shadow: inset 0 0 0 2px var(--shu); }

/* 詳しいマニュアルの目次と章 */
.toc { margin: 2rem 0 1rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 4px; }
.toc h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.toc ol { margin: 0; padding-left: 1.6em; columns: 2 14rem; column-gap: 2rem; }
.toc li { margin: .2rem 0; break-inside: avoid; }
.toc li::marker { font-family: var(--mincho); font-weight: 600; color: var(--ai); }
.chapter { scroll-margin-top: 1rem; }
.chapter h2 { padding-top: 1.2rem; border-top: 2px solid var(--ink); }
.chapter-no { display: inline-block; min-width: 1.6em; margin-right: .4em; color: var(--ai); }
.to-toc { margin: 1.5rem 0 0; font-size: .85rem; }
.to-toc a { color: var(--mute); }
@media (max-width: 40rem) {
  .chapter dl.facts { grid-template-columns: 1fr; gap: .1rem 0; }
  .chapter dl.facts dd { margin: 0 0 .6rem; }
}

/* ---- 和紙ふうの地 ----
   ページの余白に見える（盤の図など、自分の地の色を塗る箱には透けない）。模様は tools/site_np/make_washi.py が作る
   （ライト用とダーク用。地の色を焼き込んであるので、--paper を変えたら作り直す）。
   濃さは --washi（0 で無し）。画面に貼りつけて、スクロールしても動かない。アプリの中（in-app）では出さない。 */
:root { --washi-img: url("washi_light.webp?v=826ba14dbe"); --washi: 1; }
@media (prefers-color-scheme: dark) { :root { --washi-img: url("washi_dark.webp?v=3b3e0bb5c2"); } }
:root.theme-light { --washi-img: url("washi_light.webp?v=826ba14dbe"); }
:root.theme-dark { --washi-img: url("washi_dark.webp?v=3b3e0bb5c2"); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--washi-img) 0 0 / 512px 512px; opacity: var(--washi); }
.in-app body::before { display: none; }

/* 豆知識の囲み（電球の印つき） */
aside.tip { display: flex; gap: .75rem; align-items: flex-start; margin: 1.2rem 0; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--ai-tint); }
aside.tip .tip-ico { flex: none; width: 1.5rem; height: 1.5rem; margin-top: .1rem; color: var(--ai); }
aside.tip > div { min-width: 0; }
aside.tip p { margin: 0; }
aside.tip .tip-label { font-weight: 700; color: var(--ai); font-size: .9em; margin-bottom: .2rem; }

/* ---------- なんぷれ日和だけの色と飾り（np_pages.py が style.css の後ろに足す） ----------
   色は遊ぶ所（apps/number_place/lib/app/site_theme.dart）の紙の地・墨・藍に合わせる。朱は判子（TBD）だけ。 */
:root {
  --paper: #faf6ec;
  --paper-2: #f1ebdc;
  --ink: #1f1d18;
  --mute: #6b6558;
  --line: #ddd3bf;
  --ai: #3a5a80;
  --ai-tint: rgba(58, 90, 128, .10);
  --shu: #d82e1a;
}
/* 色の設定は遊ぶ所（Flutter）と同じ 1 つ（localStorage の flutter.themeMode）。頭のスクリプトが
   <html data-theme="light|dark"> を付ける。印が無い（端末に合わせる）ときは端末の設定に従う */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b1c1f;
    --paper-2: #24262b;
    --ink: #ece8de;
    --mute: #a29c8f;
    --line: #3a3c42;
    --ai: #9fb6d6;
    --ai-tint: rgba(159, 182, 214, .14);
    --shu: #f2553a;
  }
}
:root[data-theme="light"] { --logo: url("logo_np_b.webp?v=b6efbdf8d2"); color-scheme: light; }
:root[data-theme="dark"] {
  --paper: #1b1c1f;
  --paper-2: #24262b;
  --ink: #ece8de;
  --mute: #a29c8f;
  --line: #3a3c42;
  --ai: #9fb6d6;
  --ai-tint: rgba(159, 182, 214, .14);
  --shu: #f2553a;
  --logo: url("logo_np_w.webp?v=ac16a46c72");
  color-scheme: dark;
}
/* 色の切り替え（ライト・ダーク・システム）。形は文字の大きさの切り替え（style.css の .fs-switch）と同じ。
   頭（広い画面）ではアイコンだけ、≡ のメニューでは名前と文字も出す */
.theme-switch { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-size: .82rem; }
.theme-switch button { display: inline-flex; align-items: center; gap: .3em; padding: .2rem .55rem; border: 0; background: none; color: var(--mute);
  font: inherit; line-height: 1.6; cursor: pointer; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--ai); color: var(--paper); font-weight: 600; }
.theme-switch button:focus-visible { outline: 2px solid var(--shu); outline-offset: -2px; }
.np-ico { width: 1.1em; height: 1.1em; flex: 0 0 auto; }
.np-tools .sw-name, .np-tools .sw-text { display: none; }
.np-tools .theme-switch button { padding: 0 .6rem; }
/* 頭の 3 つの切り替え（文字・色・言語）は同じ高さにそろえる（中身は縦のまん中）。
   高さはレベルのボタン（.np-levels button: 字 .78rem × 1.4 + 上下の余白 .5rem + 枠 2px）と同じ */
.np-tools > .fs-switch, .np-tools > .theme-switch, .np-tools > .lang-switch { box-sizing: border-box; height: calc(1.592rem + 2px); align-items: stretch; }
.np-tools > .fs-switch > *, .np-tools > .lang-switch > * { display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; }
/* ロゴは横長（約 2.8 : 1） */
.bar .home { width: 7.2rem; }
.hero .logo { aspect-ratio: 1802 / 640; width: min(88vw, 36rem); }

/* 「遊ぶ」のボタン */
.play-button {
  display: inline-block; padding: .7rem 2.6rem; border-radius: 999px;
  background: var(--ai); color: var(--paper); font: 700 1.2rem/1.4 var(--gothic); text-decoration: none;
}
.play-button:hover { filter: brightness(1.1); }
.cta { margin: 1.8rem 0 0 .3rem; }
.bar nav a[data-play] { font-weight: 700; }

/* 入口のレベルの一覧 */
.levels { margin: 1rem 0 0; }
.levels h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
.levels ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .4rem 2rem; }
.levels li { display: flex; flex-direction: column; padding: .5rem 0; border-top: 1px solid var(--line); }
.levels b { font: 600 1.05rem/1.5 var(--mincho); }
.levels span { color: var(--mute); font-size: .92rem; }

/* 同意の文の引用 */
blockquote.consent { margin: 1rem 0; padding: .6rem 1rem; border-left: 3px solid var(--ai); background: var(--ai-tint); }
blockquote.consent p { margin: 0; }

/* ---------- 頭と左のメニュー（全部のページ。設計書 2026-11-22-number-place-top-board-design.md の 2・4.4） ----------
   境目: 768px から左のメニューの列、1200px からトップは 3 列（下のトップの盤）。狭い画面は ≡ で開く */
.np-head { display: flex; align-items: center; gap: 1rem; max-width: 84rem; margin: 0 auto; padding: .8rem 1rem .6rem; }
/* ロゴは 2 段分の高さ。右に 2 段: 上に英語の名前（英語のページだけ。日本語は空き）、下にキャッチコピー。下をそろえる */
.np-brand { display: flex; flex-direction: row; align-items: flex-end; gap: 1rem; min-width: 0; }
.np-h1 { margin: 0; font: inherit; line-height: inherit; }
.np-head .home { display: block; flex: none; width: 12.4rem; height: 4rem; background: var(--logo) left center / contain no-repeat; }
.np-head .home span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.np-tag { margin: 0; padding-bottom: .35rem; font-size: .78rem; line-height: 1.4; color: var(--mute); max-width: none;
  display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
/* 英語: 上の段に英語の名前（2 段でロゴの高さとほぼ同じ） */
.np-name { font: 700 1.05rem/1.3 var(--gothic); letter-spacing: .01em; color: var(--ink); white-space: nowrap; }
.np-shu { color: var(--shu); }
/* 「このサイトについて」の頭の大きめのロゴ（真ん中。画像は頭と同じ --logo） */
.np-about-logo { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem; margin: 1rem 0 1.6rem; padding: 2.6rem 0; }
/* 後ろに入口（/）と同じ格子（3 マスごとに太い線）。ロゴの周りだけ見せ、外へ向けて消す */
.np-about-logo::before {
  --cell: clamp(2.6rem, 6.2vw, 4.6rem);
  --line: color-mix(in srgb, var(--ink) 30%, transparent);
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(var(--line) 2px, transparent 2px) 0 0 / calc(var(--cell) * 3) calc(var(--cell) * 3),
    linear-gradient(90deg, var(--line) 2px, transparent 2px) 0 0 / calc(var(--cell) * 3) calc(var(--cell) * 3),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / var(--cell) var(--cell),
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / var(--cell) var(--cell);
  opacity: .8;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 20%, transparent 70%);
}
.np-about-logo > * { position: relative; z-index: 1; }
.np-about-logo .logo { display: block; width: min(70vw, 24rem); aspect-ratio: 1200 / 387; background: var(--logo) center / contain no-repeat; }
.np-about-name { font: 700 1.3rem/1.3 var(--gothic); letter-spacing: .02em; color: var(--ink); }
.np-tools { margin-left: auto; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; justify-content: flex-end; }
.np-burger { display: none; width: 2.6rem; height: 2.6rem; margin-left: auto; border: 1px solid var(--line); border-radius: .5rem;
  background: transparent; color: var(--ink); cursor: pointer; align-items: center; justify-content: center; position: relative; }
/* 指で押せる範囲は見た目より広くする（まわりに .5rem）。続けて押してもダブルタップの拡大と取られないようにする */
.np-burger::after { content: ""; position: absolute; inset: -.5rem; }
.np-head button, .np-head a, .np-menu a, .np-menu button, .np-levels button, .play-button { touch-action: manipulation; }
.np-burger span, .np-burger span::before, .np-burger span::after { display: block; width: 1.1rem; height: 2px; background: currentColor; border-radius: 1px; position: relative; }
.np-burger span::before, .np-burger span::after { content: ""; position: absolute; left: 0; }
.np-burger span::before { top: -6px; }
.np-burger span::after { top: 6px; }
.np-burger[aria-expanded="true"] span { background: transparent; }
.np-burger[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); background: currentColor; }
.np-burger[aria-expanded="true"] span::after { top: 0; transform: rotate(-45deg); background: currentColor; }

.np-shell { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 0 2.2rem; max-width: 84rem; margin: 0 auto; padding: 0 1rem; }
.np-shell > main { max-width: none; margin: 0; padding: 0; min-width: 0; }
.np-menu { position: sticky; top: 1rem; align-self: start; font-size: .92rem; padding-top: .6rem; }
.np-menu ul { list-style: none; margin: 0; padding: 0; }
.np-menu li { max-width: none; margin: .05rem 0; }
.np-menu > ul > li + li { margin-top: .35rem; }
.np-menu a { display: block; padding: .35rem .65rem; border-radius: .45rem; color: var(--ink); text-decoration: none; }
.np-menu a:hover { background: var(--ai-tint); }
.np-menu a[aria-current="page"], .np-menu a[aria-current="true"] { background: var(--ai-tint); color: var(--ai); font-weight: 700; }
/* 「ホーム」の頭の家のアイコン */
.np-menu > ul .np-ico { margin-right: .4em; vertical-align: -.16em; }
.np-menu ul ul a { padding-left: 1.5rem; color: var(--mute); font-size: .88rem; }
.np-menu ul ul a[aria-current="page"] { color: var(--ai); }
.np-menu-tools { display: none; }
/* 右の列（広告などの場所。まだ何も置かない）: 1200px から、どのページも 3 列目に出す */
.np-side { display: none; }
@media (min-width: 1200px) {
  .np-shell { grid-template-columns: 12rem minmax(0, 1fr) 300px; }
  .np-side { display: block; }
  .np-side-box { position: sticky; top: 1rem; height: 600px; margin-top: .9rem; border: 1px dashed var(--line); border-radius: .7rem; }
}

@media (max-width: 767.98px) {
  .np-head { padding: .6rem 1rem; }
  .np-head .home { width: 7.4rem; height: 2.4rem; }
  .np-copy, .np-head .np-tools, .np-brand-ja .np-tag { display: none; }
  /* 英語: 英語の名前だけをロゴの右に小さく、下をそろえる */
  .np-brand-en { gap: .5rem; }
  .np-brand-en .np-tag { padding-bottom: .3rem; }
  .np-brand-en .np-name { font-size: .85rem; }
  .np-burger { display: inline-flex; }
  .np-shell { display: block; position: relative; }
  /* ≡ のメニューは、ページを押し下げずに上に重ねて開く。後ろは暗くし、外を押すと閉じる（NP_MENU_JS） */
  .np-menu { display: none; position: absolute; top: 0; left: 0; right: 0; z-index: 30; padding: .6rem 1rem 1rem;
    background: var(--paper); border-top: 1px solid var(--line); border-radius: 0 0 1rem 1rem; box-shadow: 0 .8rem 1.6rem rgba(0, 0, 0, .28); }
  html.np-menu-open .np-menu { display: block; }
  html.np-menu-open .np-shell::before { content: ""; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .4); }
  /* 頭（ロゴと ×）は暗い幕の上に残す */
  html.np-menu-open .np-head { position: relative; z-index: 30; background: var(--paper); }
  /* メニューの中の切り替えは 1 行に 1 つ: 左に名前、右に切り替え（文字サイズ・ダークモード・言語） */
  .np-menu-tools { display: flex; flex-direction: column; gap: .55rem; padding: .3rem .65rem .9rem; margin-bottom: .5rem; border-bottom: 1px solid var(--line); }
  .np-menu-tools > div { display: flex; align-items: center; border: 0; border-radius: 0; overflow: visible; font-size: .84rem; white-space: nowrap; }
  .np-menu-tools .sw-name { margin-right: auto; padding: 0; color: var(--ink); background: none; font-weight: 400; }
  /* 3 つの行（文字・色・言語）のボタンは同じ高さにそろえる（中身は縦のまん中） */
  .np-menu-tools > div > :not(.sw-name) { box-sizing: border-box; height: 2.1rem; display: inline-flex; align-items: center;
    padding: 0 .7rem; border: 1px solid var(--line); margin-left: -1px; line-height: 1.6; }
  .np-menu-tools .theme-switch > button { padding: 0 .5rem; }
  .np-menu-tools > div > :nth-child(2) { border-radius: 999px 0 0 999px; }
  .np-menu-tools > div > :last-child { border-radius: 0 999px 999px 0; }
}

/* ---------- トップ: レベルの帯・盤の枠・広告の場所（1200px から 3 列目に広告の場所） ---------- */
.np-top { padding-top: .4rem; }
.np-play { max-width: 36rem; margin: 0 auto; }
.np-levels { display: flex; gap: .25rem; overflow-x: auto; padding: 0 0 .55rem; scrollbar-width: none; }
.np-levels::-webkit-scrollbar { display: none; }
.np-levels button { flex: 0 0 auto; padding: .25rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--ink); font: 600 .78rem/1.4 var(--gothic); cursor: pointer; }
.np-levels button:hover { border-color: var(--ai); }
.np-levels button[aria-pressed="true"] { background: var(--ai); border-color: var(--ai); color: var(--paper); }
/* レベルは盤の上の列だけで選ぶ（メニューには出さない）。ボタンは画面の幅によらず同じ小さめの大きさ */

/* 盤の枠: Flutter が入った後と同じ大きさを先に取る（入れ替わるときにページがずれないように） */
.np-stage { position: relative; width: 100%; aspect-ratio: 10 / 16; max-height: calc(100svh - 8.8rem); min-height: 28rem;
  border-radius: 1rem; background: var(--paper); border: 1px solid var(--line); overflow: hidden; container-type: size; }
.np-host { position: absolute; inset: 0; }
/* 止まった盤は、動いている盤（Flutter の対局の画面）と同じ並びにする: 上に 2 行（題・タイム）、真ん中に盤、
   下にボタンの行と数字の列。「スタート」を押したときに、盤や数字の位置が跳ねないように */
.np-still { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  /* 遊ぶ所（packages/sudoku_play の PlayBoardView）と同じ式で、枠の幅と高さから大きさを出す。式を変えたらここも直す。
     --f は機能のボタンの行の見積もり（盤の大きさを決めるのに使う）、--fr は実際の高さ。指で触る端末は 8 高い */
  --f: 51px; --fr: 43.6px;
  --w: min(100cqw, 560px);
  --fb: calc(100cqh - 84px);
  --b: clamp(200px, min(var(--w) - 4px, (var(--fb) - var(--f) - 5.294px) / 1.130719), 600px);
  --dh: calc((var(--b) / 9 - 4px) / .85);
  --spread: calc(max(0px, var(--fb) - var(--f) - 10px - var(--dh) - var(--b)) / 3); }
@media (hover: none) and (pointer: coarse) { .np-still { --f: 59px; --fr: 51.6px; } }
/* 上の 2 行: 題と一時停止（48）、間 4、ミスとタイム（28）、間 2 */
.np-still-top { flex: none; width: var(--b); height: 82px; display: flex; flex-direction: column; padding: 0 6px; box-sizing: border-box; }
.np-still-bar { display: flex; justify-content: space-between; align-items: center; height: 48px; }
.np-still-bar + .np-still-bar { height: 28px; margin-top: 4px; }
.np-still-bar span { display: block; width: 26%; height: 12px; border-radius: 6px; background: var(--line); opacity: .7; }
.np-still-bar span:first-child { width: 44%; }
.np-still-mid { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.np-grid { width: var(--b); box-sizing: border-box; aspect-ratio: 1; display: grid; grid-template-columns: repeat(9, 1fr); border: 2px solid var(--ink); background: var(--paper); }
.np-cell { display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font: 400 calc(var(--b) / 9 * .62)/1 var(--gothic); color: var(--ink); }
.np-cell:nth-child(9n) { border-right: 0; }
.np-cell:nth-child(9n+3), .np-cell:nth-child(9n+6) { border-right: 2px solid var(--ink); }
.np-cell:nth-child(n+19):nth-child(-n+27), .np-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--ink); }
.np-cell:nth-child(n+73) { border-bottom: 0; }
/* 盤の下: 間 2、機能のボタンの行、間（6 + 余りの 3 分の 1）、数字の列、下のゆとり */
.np-still-pad { flex: none; width: var(--b); height: calc(var(--f) + 10px + var(--dh) + var(--spread)); margin-top: 2px; }
.np-digits, .np-tools-row { display: grid; opacity: .45; }
.np-tools-row { height: var(--fr); grid-template-columns: repeat(5, 1fr); gap: 8px; color: var(--ai); text-align: center; }
.np-tools-row span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0;
  font: 700 12px/17.4px var(--gothic); white-space: nowrap; }
.np-tools-row svg { width: 24px; height: 24px; margin-bottom: 1px; flex: none; }
.np-digits { height: var(--dh); margin-top: calc(6px + var(--spread)); grid-template-columns: repeat(9, 1fr); }
.np-digit { display: flex; align-items: center; justify-content: center; margin: 0 2px; border-radius: 10px; background: var(--ai); color: var(--paper);
  font: 500 clamp(16px, (var(--b) / 9 - 4px) * .45, 30px)/1 var(--gothic); }
.np-cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--paper) 45%, transparent); }
.np-cover .play-button { border: 0; cursor: pointer; font-size: 1.35rem; padding: .95rem 3.4rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.np-cover .play-button:disabled { cursor: progress; filter: saturate(.6); }
.np-running .np-still, .np-running .np-cover { display: none; }
/* デイリー: 「スタート」の代わりに今日の 3 つの札（印は遊ぶ所の写し np.daily）とカレンダー */
.np-daily { width: min(100%, 26rem); padding: 1.2rem; border-radius: 1rem; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12); text-align: center; }
.np-daily[hidden], .play-button[hidden], .np-dcards[hidden], .np-dprep[hidden], .np-dcal[hidden] { display: none; }
.np-dprep { margin: .4rem 0; color: var(--mute); }
/* 鍵の閉じたレベル（超難問）: ボタンに錠前、選ぶと「スタート」の代わりに開け方 */
.np-levels button.np-locked::after { content: " 🔒"; font-size: .9em; }
.np-lock { margin: 0; width: min(100% - 2rem, 26rem); text-wrap: balance; padding: 1rem 1.2rem; border-radius: 1rem; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12); color: var(--ink); text-align: center; }
.np-lock::before { content: "🔒"; display: block; margin-bottom: .3rem; }
.np-lock[hidden] { display: none; }
.np-dname { margin: 0 0 .8rem; font: 700 1.1rem/1.4 var(--gothic); color: var(--ink); }
.np-ddate { margin-left: 1em; font-weight: 400; font-size: .875rem; color: var(--mute); }
.np-dcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.np-dcard { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .8rem .3rem; border: 1px solid var(--line);
  border-radius: .8rem; background: var(--paper); color: var(--ink); font: 400 .78rem/1.3 var(--gothic); cursor: pointer; touch-action: manipulation; }
.np-dcard:hover { border-color: var(--ai); }
.np-dcard b { font: 700 .9rem/1.3 var(--gothic); }
.np-dcard span { color: var(--mute); }
.np-dot { display: block; width: 14px; height: 14px; border-radius: 50%; border: 1.2px solid var(--line); }
/* 途中は左半分を塗る（遊ぶ所のステージの丸・日めくりの印と同じ） */
.np-dot[data-mark="s"] { border-color: var(--ai); background: linear-gradient(90deg, var(--ai) 50%, transparent 50%); }
.np-dot[data-mark="l"] { background: var(--mute); border-color: var(--mute); }
.np-dot[data-mark="a"] { background: #eb9a8a; border-color: #eb9a8a; }
.np-dot[data-mark="c"] { background: var(--shu); border-color: var(--shu); }
.np-dcal { display: inline-flex; align-items: center; gap: .4em; margin-top: .9rem; padding: .35rem 1rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--ai); font: 600 .9rem/1.4 var(--gothic); cursor: pointer; touch-action: manipulation; }
.np-dcal:hover { background: color-mix(in srgb, var(--ai) 12%, transparent); }
.np-dcal:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }
.np-daily button:disabled { cursor: progress; opacity: .6; }
/* 始まりの日より前: 札は灰色で押せない（名前だけ）。下に「何日から」 */
.np-daily.np-soon .np-dcard:disabled { cursor: default; opacity: .45; border-color: var(--line); }
.np-daily.np-soon .np-dot, .np-daily.np-soon .np-dcard span { display: none; }
.np-dsoon { margin: .8rem 0 0; color: var(--mute); text-wrap: balance; }
.np-dsoon[hidden] { display: none; }

/* 盤の下の広告の場所（1200px 未満だけ。広い画面では右の列 .np-side が代わる。後で広告が入っても盤が動かないように場所だけ取る） */
.np-ad { min-height: 100px; margin: 1.4rem 0; border: 1px dashed var(--line); border-radius: .7rem; }
.np-below { margin-top: 1rem; }
.np-title { font: 700 1.5rem/1.4 var(--mincho); margin: 1rem 0 .3rem; }
.np-lead { color: var(--mute); margin: 0 0 1.4rem; }
@media (min-width: 1200px) {
  .np-ad { display: none; }
}
/* ステージのページ: 読み込むまでの文 */
.np-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 2rem;
  text-align: center; color: var(--mute); }
.np-running .np-wait { display: none; }
@media (max-width: 767.98px) {
  /* 狭い画面はアプリの対局の画面のように、画面の高さいっぱいを使う */
  .np-stage { aspect-ratio: auto; height: calc(100svh - 7.5rem); max-height: none; min-height: 30rem; border-radius: .7rem; }
  /* トップの盤の枠は、高さを幅の 1.7 倍まで（縦に長い画面で盤の上下が空きすぎず、枠の下に続きが見えてページを送れる）。
     ステージのページの枠は一覧が 6 行あるので、画面の高さいっぱいのまま */
  #np-stage { height: min(calc(100svh - 7.5rem), calc((100vw - 2rem) * 1.7)); }
}

/* ---- 和紙ふうの地（仕組みは style.css。ここは色の切り替えの印〈data-theme〉に合わせるだけ） ---- */
@media (prefers-color-scheme: dark) { :root[data-theme="light"] { --washi-img: url("washi_light.webp?v=826ba14dbe"); } }
:root[data-theme="light"] { --washi-img: url("washi_light.webp?v=826ba14dbe"); }
:root[data-theme="dark"] { --washi-img: url("washi_dark.webp?v=3b3e0bb5c2"); }

/* ---- 広告を入れるまで: 空の枠を見せない（ユーザー、2026-11-24） ----
   広告（AdSense）を入れるときは、この 2 行を消す。HTML の枠（.np-ad・.np-side）はそのまま残してある。
   - 盤の下の枠は、場所ごと無くす（スマホで盤の下が 100px 空くのをやめる）
   - 広い画面の右の列は、列の幅は残して枠の線だけ消す（広告を入れても、盤とメニューの位置が動かない） */
.np-ad { display: none; }
.np-side-box { border-color: transparent; }

/* ---------- 名前つきの順位表のページ（/<lang>/ranking。np_pages.py の NP_RANK） ----------
   名前は左右の向きの違う字に備えて dir="auto" と isolate。長い名前は 1 行で切る */
.np-rank-table { width: 100%; max-width: 32rem; border-collapse: collapse; table-layout: fixed; margin: .6rem 0 .4rem; }
.np-rank-table th, .np-rank-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: left; }
.np-rank-table th { font-weight: 600; color: var(--mute); font-size: .88rem; }
.np-rank-table th:first-child { width: 3.5rem; }
.np-rank-table th:last-child, .np-rank-table .np-rank-time { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.np-rank-name { unicode-bidi: isolate; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-rank-anon { color: var(--mute); }
.np-rank-id { font-size: .75em; color: var(--mute); font-weight: 400; }
.np-rank-prov { color: var(--ai); font-weight: 600; margin: 0 0 .3rem; }
.np-rank-count { color: var(--mute); font-size: .88rem; margin: 0 0 1rem; }
.np-rank-table[hidden], .np-rank-count[hidden], .np-rank-prov[hidden], .np-rank-status[hidden], .np-rank-id[hidden] { display: none; }
