/* =====================================================================
   VANNAN GAMES — サイト共通のデザイン（トップと文章ページ）

   決めごとの正は、開発リファレンスの UI のルール「サイト共通のデザイン」の節。
   作品紹介ページとゲーム本体は読み込まない（作品ごとの世界観の色）。

   題材は、作品群が共有している「坂下の交差点」。
     - アクセント = 青信号の緑。文字に使うので AA（4.5）を割らない明度に置く
     - 信号の赤と黄は、灯火と小さな印だけに使う（文字には使わない）
     - 区切りの帯 = 横断歩道の白線。ヘッダーの下・ヒーローの下・フッターの上
     - 暗い面 = 夜のアスファルト。ライトのときもヒーローとフッターだけ暗い

   ページ固有の部品は各ページの <style> に置く。<link> は <style> より前に置き、
   ページ側の指定が後勝ちで上書きできるようにしてある。
   ===================================================================== */

:root{
  --bg:#f4f3ef; --panel:#ffffff; --ink:#16181b; --muted:#64666b;
  --accent:#077356; --line:rgba(22,24,27,.1);
  --body-ink:#3d4844; --lead-ink:#2a3430; --soft:#e9f0ec;
  --header-bg:rgba(244,243,239,.82); --header-line:rgba(22,24,27,.08);
  --tint-soft:rgba(7,115,86,.08); --tint-active:rgba(7,115,86,.1);
  --hover:rgba(22,24,27,.05); --on-accent:#ffffff;
  --code-bg:rgba(22,24,27,.06); --code-ink:#2b3a34; --btn-line:rgba(22,24,27,.16);
  --mark:rgba(242,165,22,.3); --accent-glow:rgba(7,115,86,.25);
  --shadow-rest:0 1px 2px rgba(22,24,27,.05), 0 6px 20px rgba(22,24,27,.06);
  --shadow-lift:0 2px 4px rgba(22,24,27,.06), 0 18px 40px rgba(22,24,27,.13);
  /* 夜のアスファルト。ヒーローとフッターの面。ライトでも暗い */
  --asphalt:#17191d; --asphalt-ink:#f1efe9; --asphalt-muted:#a9adb2;
  --asphalt-line:rgba(255,255,255,.12);
  /* 信号の灯火。光っている色なので、ダークでも同じ値のまま使う */
  --lamp-green:#2fd39c; --lamp-red:#ff5446; --lamp-amber:#f2a516;
  --radius:16px; --radius-s:10px;
  --wrap:72rem; --prose:42rem;
  --font-sans:system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  --font-mono:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme:light dark;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#14161a; --panel:#1c1f24; --ink:#eceae6; --muted:#9fa4a9;
    --accent:#44a78d; --line:rgba(255,255,255,.12);
    --body-ink:#c3cbc7; --lead-ink:#d3dad6; --soft:#1b211f;
    --header-bg:rgba(20,22,26,.8); --header-line:rgba(255,255,255,.08);
    --tint-soft:rgba(68,167,141,.12); --tint-active:rgba(68,167,141,.17);
    --hover:rgba(255,255,255,.06); --on-accent:#08201a;
    --code-bg:rgba(255,255,255,.07); --code-ink:#cbd3cf; --btn-line:rgba(255,255,255,.18);
    --mark:rgba(242,165,22,.22); --accent-glow:rgba(68,167,141,.22);
    /* 暗い地では黒い影が見えにくい。カードは --panel と --bg の明るさの差で浮かせ、影は補助にする */
    --shadow-rest:0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.3);
    --shadow-lift:0 2px 4px rgba(0,0,0,.35), 0 18px 40px rgba(0,0,0,.5);
    --asphalt:#0d0f12; --asphalt-ink:#f1efe9; --asphalt-muted:#a9adb2;
    --asphalt-line:rgba(255,255,255,.1);
  }
}

/* ---------------------------------------------------------------- 基本 */
*, *::before, *::after{ box-sizing:border-box; }
[hidden]{ display:none !important; }
html{ -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:var(--font-sans); font-size:1rem; line-height:1.9;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
  overflow-wrap:break-word;
}
a{ color:var(--accent); text-underline-offset:.22em; text-decoration-thickness:1px; }
a:hover{ text-decoration-thickness:2px; }
img{ max-width:100%; }
:focus-visible{ outline:3px solid var(--accent); outline-offset:3px; }
/* 横に流す容器（overflow-x:auto）は上下もはみ出しを切り取る。外に描くとリングが消えるので、内側に描く */
.gnav a:focus-visible, .subnav-links a:focus-visible{ outline-offset:-3px; }
/* フッターはライトでも暗い面。accent のリングだと比が 3.01 しかないので、灯火の緑で描く */
.site-foot :focus-visible{ outline-color:var(--lamp-green); }
::selection{ background:var(--tint-active); }

/* 横断歩道の白線。区切りの帯として使う（装飾なので読み上げない） */
.zebra{
  height:12px;
  background:repeating-linear-gradient(90deg, var(--stripe, var(--asphalt-ink)) 0 30px, transparent 30px 54px);
  opacity:.9;
}

/* ---------------------------------------------------------- ヘッダー */
header.site{
  position:sticky; top:0; z-index:30;
  background:var(--header-bg);
  -webkit-backdrop-filter:blur(18px) saturate(170%);
  backdrop-filter:blur(18px) saturate(170%);
  box-shadow:0 1px 0 var(--header-line);
}
.site-inner{
  max-width:var(--wrap); margin:0 auto; min-height:56px;
  display:flex; align-items:center; gap:1rem;
  padding:0 1.5rem;
}
.brand{
  display:inline-flex; align-items:baseline; flex:none;
  font-weight:800; font-size:1.02rem; letter-spacing:.02em; white-space:nowrap;
  color:var(--ink); text-decoration:none;
}
.brand:hover{ text-decoration:none; }
/* 社名の末尾の「.」を、青信号の灯火にしてある。
   丸はベースラインにぴったり乗せると浮いて見えるので、.03em だけ下へはみ出させる（錯視の補正） */
.brand .dot{
  position:relative; top:.03em;
  display:inline-block; width:.42em; height:.42em; margin-left:.16em;
  border-radius:50%; background:var(--lamp-green);
  box-shadow:0 0 0 2px rgba(47,211,156,.18), 0 0 10px rgba(47,211,156,.55);
}
.gnav{
  display:flex; gap:.15rem; margin-left:auto;
  overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;
}
.gnav::-webkit-scrollbar{ display:none; }
.gnav a{
  flex:none; white-space:nowrap; display:inline-flex; align-items:center; min-height:44px;
  color:var(--muted); text-decoration:none; font-size:.86rem; font-weight:600;
  padding:0 .8rem; border-radius:100px;
  transition:background .15s ease, color .15s ease;
}
.gnav a:hover{ background:var(--hover); color:var(--ink); }
.gnav a[aria-current]{ background:var(--tint-active); color:var(--accent); }

/* 狭い画面: ロゴの行とメニューの行に分ける。読み物のときに画面の高さを取らないよう、固定しない */
@media (max-width:640px){
  header.site{ position:static; }
  .site-inner{ flex-wrap:wrap; gap:0; padding:0 1rem; min-height:0; }
  .brand{ padding:.85rem 0 .3rem; }
  .gnav{
    flex-basis:100%; margin:0 -1rem; padding:0 1.6rem .3rem .6rem;
    /* 320px では「よくある質問」が端で切れる。横に流せると分かるように右端を薄く消す */
    -webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 24px), transparent);
    mask-image:linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  }
  .gnav a{ font-size:.82rem; padding:0 .7rem; }
}

/* 遊び方ガイドの行き来（遊び方ページとよくある質問に出る） */
.subnav{
  border-bottom:1px solid var(--line);
  background:var(--bg);
}
.subnav-inner{
  max-width:var(--wrap); margin:0 auto; padding:.55rem 1.5rem;
  display:flex; align-items:center; gap:.7rem;
}
.subnav-label{
  flex:none; font-size:.76rem; font-weight:800; color:var(--muted); white-space:nowrap;
}
.subnav-links{
  display:flex; gap:.3rem; overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;
  /* 続きがあると分かるように、右端だけ薄く消す */
  -webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  mask-image:linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  padding-right:28px;
}
.subnav-links::-webkit-scrollbar{ display:none; }
.subnav-links a{
  position:relative; isolation:isolate; border-radius:100px;
  flex:none; white-space:nowrap; text-decoration:none;
  /* 押せる高さは 44px、見えるピルは 32px。ピルは ::before で描き、上下 6px は当たり判定だけ */
  display:inline-flex; align-items:center; min-height:44px;
  font-size:.8rem; color:var(--muted); padding:0 .8rem;
}
.subnav-links a::before{
  /* フォーカスリングは外形から内側 3px の帯に描かれる（outline-offset:-3px）。ピルを4辺とも 6px 内側に置いて、
     リングとピルのあいだに全周 3px のすきまを空ける */
  content:""; position:absolute; inset:6px; z-index:-1;
  border-radius:100px; border:1px solid var(--line);
}
.subnav-links a:hover{ color:var(--ink); }
.subnav-links a:hover::before{ border-color:var(--btn-line); }
.subnav-links a[aria-current="page"]{ color:var(--on-accent); font-weight:700; }
.subnav-links a[aria-current="page"]::before{ background:var(--accent); border-color:var(--accent); }
@media (max-width:640px){ .subnav-inner{ padding:.5rem 1rem; } }

/* ---------------------------------------------------------- フッター */
.site-foot{
  margin-top:5rem; background:var(--asphalt); color:var(--asphalt-muted);
  font-size:.84rem;
}
.site-foot .zebra{ height:10px; }
.foot-inner{
  max-width:var(--wrap); margin:0 auto; padding:2.6rem 1.5rem 2.4rem;
  display:grid; grid-template-columns:1fr auto; gap:1.6rem 3rem; align-items:start;
}
.site-foot .brand{ color:var(--asphalt-ink); font-size:1.12rem; }
.foot-tag{ margin:.35rem 0 0; color:var(--asphalt-muted); font-size:.84rem; }
.foot-nav{
  display:grid; grid-template-columns:repeat(2, auto); grid-template-rows:repeat(4, auto);
  grid-auto-flow:column; gap:.35rem 2.4rem;
}
/* 並びが詰まっているので、見た目は変えずに上下の余白で押せる高さを足す */
.foot-nav a{ color:var(--asphalt-ink); text-decoration:none; font-size:.86rem; line-height:1.9; padding:.2rem 0; }
.foot-nav a:hover{ text-decoration:underline; }
.foot-copy{
  grid-column:1 / -1; margin:0; padding-top:1.3rem;
  border-top:1px solid var(--asphalt-line);
  font-family:var(--font-mono); font-size:.72rem; letter-spacing:.08em;
}
@media (max-width:640px){
  .site-foot{ margin-top:3.5rem; }
  .foot-inner{ grid-template-columns:1fr; padding:2.2rem 1.2rem 2rem; }
  .foot-nav{ gap:.2rem 1.6rem; }
}
/* 320px では「セーブデータのバックアップ」が2行に折れて、隣の列に半端な空きができる */
@media (max-width:360px){
  .foot-nav{ grid-template-columns:1fr; grid-template-rows:none; grid-auto-flow:row; }
}

/* ------------------------------------------------- 文章ページの本文 */
main{ display:block; max-width:var(--prose); margin:0 auto; padding:2.6rem 1.5rem 1rem; }
@media (max-width:640px){ main{ padding:1.8rem 1.2rem .5rem; } }

main > h1, .page-title{
  font-size:clamp(1.65rem, 1.25rem + 1.6vw, 2.25rem);
  font-weight:800; line-height:1.38; letter-spacing:.01em;
  font-feature-settings:"palt";
  margin:.2rem 0 1.4rem; color:var(--ink);
}
/* 見出しの下に、横断歩道の白線を短く引く */
main > h1::after, .page-title::after{
  content:""; display:block; width:58px; height:12px; margin-top:.9rem;
  background:repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 13px);
  opacity:.8;
}
/* 見出しの改行を文節で切る（Chrome。BudouX と同じ仕組み）。未対応のブラウザで
   balance だけを掛けると「わた／る。」のように語の途中で割れるので、両方そろうときだけ使う */
@supports (word-break:auto-phrase){
  main > h1, main > h2, .page-title, .entry h2{ word-break:auto-phrase; text-wrap:balance; }
}
main > h2{
  position:relative;
  font-size:1.3rem; font-weight:800; line-height:1.5; letter-spacing:.01em;
  font-feature-settings:"palt";
  color:var(--ink); margin:3.2rem 0 .9rem; padding-left:.95rem;
}
/* 青信号の灯火を縦に置いた印 */
main > h2::before{
  content:""; position:absolute; left:0; top:.32em; bottom:.32em; width:4px;
  border-radius:4px; background:var(--accent);
}
main > h3{ font-size:1.08rem; font-weight:800; font-feature-settings:"palt"; margin:2.2rem 0 .5rem; }
main p, main li{ font-size:1rem; line-height:1.95; color:var(--body-ink); }
main p{ margin:0 0 1.15em; }
main ul, main ol{ padding-left:1.4em; margin:0 0 1.2em; }
main li{ margin:.25em 0; }
/* 強調のマーカーは地の文だけ。表や補足の箱の中では面の色と重なって濁るので付けない */
main strong{ color:var(--ink); font-weight:700; }
main > p strong, main > ul > li strong, main > ol > li strong{
  color:var(--ink); font-weight:700;
  background:linear-gradient(transparent 64%, var(--mark) 64%);
}
.lead{ font-size:1.06rem; line-height:1.95; color:var(--lead-ink); }
.updated{ color:var(--muted); font-size:.82rem; margin-top:2.4rem; }

/* パンくずと日付 */
.crumb{ font-size:.84rem; margin:0 0 1rem; }
.crumb a{ text-decoration:none; font-weight:600; }
.crumb a:hover{ text-decoration:underline; }
main > .meta{
  display:flex; gap:.7rem; align-items:center; flex-wrap:wrap;
  color:var(--muted); font-size:.84rem; margin:-.4rem 0 2.2rem;
}
.meta time{ font-family:var(--font-mono); font-size:.8rem; letter-spacing:.02em; font-variant-numeric:tabular-nums; }
.g-tag{
  display:inline-flex; align-items:center; min-height:24px;
  font-size:.74rem; font-weight:700; line-height:1.4;
  color:var(--accent); background:var(--tint-soft);
  border-radius:100px; padding:0 .75rem; text-decoration:none;
}
a.g-tag:hover{ background:var(--tint-active); }

/* 表 */
main table{
  border-collapse:collapse; width:100%; font-size:.9rem; line-height:1.7;
  margin:1rem 0 1.4rem; background:var(--panel);
  border-radius:var(--radius-s); overflow:hidden; box-shadow:0 0 0 1px var(--line);
}
main th, main td{ border-bottom:1px solid var(--line); padding:.6rem .8rem; text-align:left; vertical-align:top; }
main tr:last-child > td{ border-bottom:none; }
main th{ color:var(--muted); font-weight:700; font-size:.82rem; background:var(--soft); white-space:nowrap; }
main td{ color:var(--body-ink); }
/* 狭い幅では見出しのセルも折り返す。4列の表（notes/why-tencent-edgeone）が 375px で 12px はみ出した */
@media (max-width:640px){
  main th{ white-space:normal; }
  main th, main td{ padding:.55rem .6rem; }
}
/* 4列以上の表は、折り返すと1列目が1〜2字ずつに割れて読めない。1行のまま、表の中だけ横に流す。
   外側の table を横に流す箱にし、中の tbody を表に戻して箱の幅いっぱいに広げる（中身のほうが広いときだけ流れる）。
   tbody を表に戻さないと、中身の幅に縮んだ表が箱の左に寄り、罫と見出しの帯が右端の手前で切れる。
   しきい値は、4列の表が 1行のまま収まる幅（notes/why-tencent-edgeone で 595px）より広いところに置いた。
   thead・tfoot・caption や2つ目の tbody がある表は、部品ごとに別の表になって列がずれるので、対象から外す（折り返す） */
@media (max-width:760px){
  main table:has(tr > :nth-child(4)):not(:has(> thead, > tfoot, > caption, > tbody ~ tbody)){ display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  main table:has(tr > :nth-child(4)):not(:has(> thead, > tfoot, > caption, > tbody ~ tbody)) > tbody{ display:table; width:100%; }
  main table:has(tr > :nth-child(4)):not(:has(> thead, > tfoot, > caption, > tbody ~ tbody)) :is(th, td){ white-space:nowrap; }
}

/* 補足の箱 */
.note-box, main > .note, .contact-note{
  background:var(--soft); border-radius:var(--radius-s);
  border-left:3px solid var(--accent);
  padding:.95rem 1.2rem; margin:1.4rem 0; font-size:.92rem; line-height:1.85; color:var(--body-ink);
}

/* コード。pre の地は意図して暗いままにする（ライトでもダークでも同じ）。
   ダークの地とほぼ同じ色になるので、罫で縁を出す */
code{
  font-family:var(--font-mono); font-size:.86em;
  background:var(--code-bg); color:var(--code-ink);
  border-radius:5px; padding:.08em .38em; overflow-wrap:anywhere;
}
pre{
  background:#1b1f24; color:#e6edf3; border-radius:var(--radius-s);
  padding:1rem 1.15rem; overflow-x:auto;
  font-family:var(--font-mono); font-size:.82rem; line-height:1.75;
  margin:1rem 0 1.4rem; box-shadow:0 0 0 1px var(--line);
}
pre code{ background:none; color:inherit; padding:0; font-size:1em; border-radius:0; }

/* 関連リンク */
.rel-links{
  margin:3rem 0 0; padding:1.2rem 1.4rem;
  background:var(--panel); border-radius:var(--radius); box-shadow:0 0 0 1px var(--line);
  font-size:.92rem;
}
main .rel-links p{ margin:.2rem 0; font-size:.92rem; }

/* 一覧の1件（制作ノート・更新情報） */
.entry{
  position:relative;
  background:var(--panel); border-radius:var(--radius);
  box-shadow:0 0 0 1px var(--line);
  padding:1.25rem 1.5rem 1.35rem; margin:1rem 0;
  transition:box-shadow .25s ease, transform .25s ease;
}
.entry .meta{ display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; color:var(--muted); font-size:.82rem; }
.entry h2{ font-size:1.12rem; font-weight:800; line-height:1.55; letter-spacing:.01em; font-feature-settings:"palt"; margin:.45rem 0 .35rem; }
.entry h2 a{ color:var(--ink); text-decoration:none; }
/* 見出しのリンクをカード全体に広げる（タグのリンクは上に重ねて押せるようにする） */
.entry h2 a::after{ content:""; position:absolute; inset:0; border-radius:inherit; }
.entry a.g-tag{ position:relative; z-index:1; }
/* 浮かせるのは、見出しがリンクになっている一覧（制作ノート）だけ。更新情報は本文を読む箱 */
.entry:has(h2 a):hover{ box-shadow:0 0 0 1px var(--btn-line), var(--shadow-lift); transform:translateY(-2px); }
.entry:hover h2 a{ color:var(--accent); }
/* カードの外側にリングを描く。:has() が使えないブラウザでは、見出しのリンク自身のリングのまま */
@supports selector(:has(*)){
  .entry:has(h2 a:focus-visible){ outline:3px solid var(--accent); outline-offset:3px; }
  .entry h2 a:focus-visible{ outline:none; }
}
main .entry p{ font-size:.94rem; line-height:1.85; margin:.2rem 0 0; }
main .entry p + p{ margin-top:.7rem; }

/* よくある質問の開閉 */
details{
  background:var(--panel); border-radius:var(--radius-s);
  box-shadow:0 0 0 1px var(--line); margin-bottom:.6rem; overflow:hidden;
}
summary{
  cursor:pointer; list-style:none; position:relative;
  font-size:.98rem; font-weight:700; line-height:1.6;
  padding:.9rem 3rem .9rem 1.2rem;
}
summary::-webkit-details-marker{ display:none; }
summary::after{
  content:""; position:absolute; right:1.2rem; top:50%;
  /* 錯視の補正。回した正方形は線が2辺にしかなく、見た目の重心が角の側に寄る。
     数値どおりの中央は、top:50% から自分の高さの半分の .275rem 上。閉じた「v」はそこから .225rem 上へ、
     開いた「^」は .175rem 下へずらして、文字の中心に見た目を合わせる。
     位置も transform に入れて、回るのと同時に動かす。margin で動かすと、回る前に跳ぶ */
  width:.55rem; height:.55rem;
  border-right:2px solid var(--muted); border-bottom:2px solid var(--muted);
  transform:translateY(-.5rem) rotate(45deg); transition:transform .2s ease;
}
details[open] summary::after{ transform:translateY(-.1rem) rotate(225deg); }
summary:hover{ background:var(--hover); }
details .a{
  margin:0; padding:.85rem 1.2rem 1rem; font-size:.95rem;
  border-top:1px solid var(--line); color:var(--body-ink);
}

/* 主ボタン。遊び方ページの「遊ぶ」と 404 の「トップページへ」。高さ・字間・動きをここでそろえる
   （トップのヒーローは暗い面の上なので、トップの <style> に別の形がある） */
.play-cta, .home-btn{
  display:inline-flex; align-items:center; gap:.55em; min-height:48px;
  background:var(--accent); color:var(--on-accent);
  text-decoration:none; font-weight:800; line-height:1.2; letter-spacing:.04em;
  padding:0 1.8rem; border-radius:100px;
  box-shadow:0 6px 18px var(--accent-glow);
  transition:transform .15s ease, box-shadow .15s ease;
}
.play-cta{ margin:1.2rem 0 1.6rem; }
.play-cta:hover, .home-btn:hover{ transform:translateY(-1px); box-shadow:0 10px 24px var(--accent-glow); text-decoration:none; }
.play-cta:active, .home-btn:active{ transform:scale(.97); }
/* ▶ は平らな辺が左を向いていて左が重く見える。svg を 1px 右へ寄せて重心を合わせる（錯視の補正） */
.play-cta svg{ width:12px; height:12px; fill:currentColor; margin-left:1px; }
.lp-link{ font-size:.92rem; margin:.2rem 0 1.6rem; }

.ofuse-widget{ margin:1.2rem 0 1.8rem; display:flex; justify-content:center; }

/* ------------------------------------------- アクセシビリティ設定への追従 */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ transition-duration:.01ms !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; scroll-behavior:auto !important; }
  .entry:has(h2 a):hover{ transform:none; }
}
@media (prefers-reduced-transparency: reduce){
  header.site{ background:var(--bg); -webkit-backdrop-filter:none; backdrop-filter:none; }
}
@media (prefers-contrast: more){
  .entry, details, .rel-links, main table{ box-shadow:0 0 0 1px var(--ink); }
  .gnav a, .subnav-links a{ color:var(--ink); }
}
@media print{
  header.site, .subnav, .site-foot{ display:none; }
  body{ background:#fff; }
}
