:root {
  --bg: #1d1712;
  --bg-alt: #261e17;
  --panel: #2f251c;
  --line: #4a3a2b;
  --text: #e9e0d2;
  --muted: #b3a593;
  --accent: #d9b56f;
  --accent-ink: #1d1712;
  --head-font: "EB Garamond", Georgia, serif;
  --body-font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 56px; scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--body-font);
}

a { color: var(--accent); }
img { display: block; max-width: 100%; height: auto; }

/* ヘッダ */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; gap: 28px; align-items: center; }
.nav a {
  color: var(--text);
  text-decoration: none;
  font: 600 19px var(--head-font);
  letter-spacing: .04em;
}
.nav a:hover { color: var(--accent); }
.nav .lang { color: var(--muted); font-size: 14px; }
.nav .lang a { font: inherit; color: var(--muted); }
.nav .lang a:hover { color: var(--text); }
/* 選んでいる言語＝文字色を明るく太く、下線で印を付ける */
.nav .lang [aria-current] { color: var(--accent); font-weight: 600; border-bottom: 2px solid var(--accent); }

/* ファーストビュー */
main { padding-top: 56px; }
.hero img { width: 100%; height: auto; }

/* 一行と動画 */
.intro { max-width: 960px; margin: 0 auto; padding: 96px 32px 64px; text-align: center; }
.lead { font: 500 28px/1.45 var(--head-font); margin: 0 0 48px; }
.media img { border: 1px solid var(--line); border-radius: 6px; }
.media { margin: 0; }

/* 特徴 */
.features { max-width: 1120px; margin: 0 auto; padding: 32px 32px 64px; display: grid; gap: 72px; }
.feature { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.feature:nth-child(even) img { order: 2; }
.feature img { border: 1px solid var(--line); border-radius: 6px; }
.feature h2 { font: 600 34px/1.2 var(--head-font); margin: 0 0 12px; color: var(--accent); }
.feature p { margin: 0 0 12px; }
.feature .more { font-size: 15px; color: var(--muted); }

/* 遊ぶ */
.play { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; padding: 72px 32px; }
.play h2 { font: 600 36px var(--head-font); margin: 0 0 8px; }
.play p { color: var(--muted); margin: 0 0 28px; }
.button {
  display: inline-block;
  padding: 14px 36px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 4px;
  text-decoration: none;
  font: 600 20px var(--head-font);
  letter-spacing: .03em;
}
.button:hover { filter: brightness(1.08); }

/* フッター */
.site-footer {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 32px;
  color: var(--muted);
  font-size: 14px;
}
.site-footer a { color: var(--muted); }

/* ストアへの道（右下に常に出す）。ロゴは公式の絵をそのまま使う（doc/sales/site.md ヘッダとフッター）。
   Steam はストアページができるまでリンクを持たず、カーソルで押せないことを示す。 */
.stores { position: fixed; right: 16px; bottom: 16px; z-index: 10; display: flex; gap: 12px; }
.store { display: block; padding: 12px; background: var(--bg); border-radius: 8px; line-height: 0; }
.store img { display: block; height: 50px; width: auto; }
.store.steam { cursor: not-allowed; }
.site-footer { padding-bottom: 120px; }
.site-footer .tm { flex-basis: 100%; text-align: center; font-size: 12px; }

/* ヘッダの左端＝ロゴ。どのページでも同じものを置く＝メニューの位置がページで変わらない */
.home { display: flex; align-items: center; flex: none; }
.home img { height: 44px; width: auto; }

/* マニュアル */
.manual {
  max-width: 1280px;
  margin: 0 auto;
  padding: 88px 32px 64px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.toc { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 15px; scrollbar-color: var(--line) transparent; }
.toc summary { display: none; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 14px; border-left: 1px solid var(--line); margin: 4px 0 8px 4px; }
.toc li { margin: 2px 0; }
.toc a { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px; color: var(--text); text-decoration: none; }
.toc a:hover { background: var(--panel); }
.toc a[aria-current="page"] { background: var(--panel); color: var(--accent); }
.toc img { width: 20px; height: 20px; object-fit: contain; flex: none; }
.toc .toc-group { display: block; padding: 6px 8px 2px; color: var(--muted); font-size: 13px; letter-spacing: .05em; }

.manual-body { min-width: 0; }
.manual-body h1 { font: 600 38px/1.2 var(--head-font); color: var(--accent); margin: 0 0 20px; }
.manual-body h2 { font: 600 26px/1.3 var(--head-font); color: var(--accent); margin: 36px 0 10px; }
.manual-body p { margin: 0 0 14px; }
.manual-body dl { margin: 0 0 14px; }
.manual-body dt { color: var(--accent); margin-top: 10px; }
.manual-body dd { margin: 2px 0 0 16px; }
.manual-body figure { margin: 0 0 14px; }
.manual-body table { border-collapse: collapse; margin: 0 0 14px 16px; }
.manual-body th, .manual-body td { padding: 4px 16px 4px 0; text-align: left; }
.manual-body th { color: var(--accent); font-weight: 500; border-bottom: 1px solid var(--line); }
.rules { margin: 0 0 14px; padding-left: 32px; }
.rules li { margin-bottom: 10px; }
.rules li::marker { color: var(--accent); }
.rules .cond { margin: 0; }
.rules .act { margin: 0; color: var(--accent); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.col-side { display: grid; gap: 12px; }

/* ユニット */
/* 左に一覧のペイン、右に本文（マニュアルの目次と本文と同じ形） */
.units-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 88px 32px 64px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.side-list { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 15px; scrollbar-color: var(--line) transparent; }
.side-list .toc-group { display: block; margin: 10px 0 2px; padding: 0 8px; color: var(--muted); font-size: 13px; letter-spacing: .05em; }
.side-list ul { list-style: none; margin: 0; padding: 0; }
.side-list a, .side-list .unknown span { display: flex; align-items: center; gap: 8px; padding: 2px 8px; border-radius: 4px; color: var(--text); text-decoration: none; }
.side-list a:hover { background: var(--panel); }
.side-list a[aria-current="page"] { background: var(--panel); color: var(--accent); }
.side-list .unknown span { color: var(--muted); }
.unit-icon { width: 32px; height: 32px; object-fit: contain; flex: none; }
.unit-page .back { display: none; }
.units h1, .unit-page h1 { font: 600 38px/1.2 var(--head-font); color: var(--accent); margin: 0 0 20px; }
.units h2 { font: 600 26px/1.3 var(--head-font); color: var(--accent); margin: 36px 0 12px; }
.unit-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.unit-grid li { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.unit-grid a { display: block; color: var(--text); text-decoration: none; border-radius: 6px; }
.unit-grid a:hover { background: var(--bg-alt); }
/* 陣形スキルの格子＝要るユニットの黒塗りと名前（カットインの絵は出さない） */
.skill-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.skill-grid li { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.skill-grid a { display: block; color: var(--text); text-decoration: none; }
.skill-grid a:hover { background: var(--bg-alt); }
.skill-grid .lineup { justify-content: center; height: 72px; padding: 14px 8px 0; margin: 0; }
.skill-grid .lineup .member { height: 56px; }
.skill-name { display: block; text-align: center; padding: 6px 4px 8px; font-size: 14px; }
/* 要るユニットの黒塗り。高さは固定＝絵を読み込んだときに下の文字が動かない */
.lineup { display: flex; gap: 12px; align-items: flex-end; height: 96px; margin: 0 0 20px; }
.lineup .member { height: 96px; width: auto; }

/* 盤の絵はキャンバス（384角）のまま載せ、キャンバスの下端 260px（200×1.3）を面の高さに当てる
   ＝盤と同じ大小関係（クロニクルのカードと同じ。godot/presentation/chronicle/figure_face.gd）。
   はみ出す駒は切らない。 */
.unit-face { --face-h: 110px; display: block; position: relative; height: var(--face-h); }
.unit-face img { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); height: calc(var(--face-h) * 384 / 260); width: auto; max-width: none; pointer-events: none; }
.unit-name { display: block; text-align: center; padding: 6px 4px 8px; font-size: 14px; }
.unit-grid .unknown .unit-name { color: var(--muted); }

.unit-page { max-width: 760px; }
.unit-page h2 { font: 600 24px/1.3 var(--head-font); color: var(--accent); margin: 28px 0 8px; }
.unit-page p { margin: 0 0 14px; }
/* 絵の段の高さは固定＝絵を読み込んだときに下の文字が動かない。背の低い駒は下揃えで上が空く */
.unit-art { display: flex; gap: 24px; align-items: flex-end; height: 300px; margin: 0 0 20px; }
.unit-art img.map { max-height: 160px; width: auto; }
.unit-art img.combat, .unit-art img.showcase { max-height: 300px; width: auto; }
.stats { border-collapse: collapse; margin: 0 0 14px; }
.stats th { text-align: left; font-weight: 400; color: var(--muted); padding: 3px 24px 3px 0; }
.stats td { padding: 3px 0; }
.traits span { color: var(--muted); margin-right: 8px; }

@media (max-width: 899px) {
  .site-header { padding: 0 16px; gap: 12px; }
  .nav { gap: 8px; }
  .nav a { font-size: 14px; white-space: nowrap; }
  .nav .lang { white-space: nowrap; font-size: 12px; }
  /* スマホは幅が足りない＝トップへはロゴで戻り、言語は今いない方だけを出す */
  .nav-top, .nav .lang [aria-current], .nav .lang .sep { display: none; }
  .home img { height: 32px; }
  .manual { display: block; padding: 72px 16px 48px; }
  .units-main { display: block; padding: 72px 16px 48px; }
  .side-list { display: none; }
  .unit-page .back { display: block; margin: 0 0 16px; }
  .unit-page .back a { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); text-decoration: none; }
  .unit-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .unit-face { --face-h: 84px; }
  .unit-art { height: 220px; }
  .unit-art img.combat, .unit-art img.showcase { max-height: 220px; }
  .toc { position: static; max-height: none; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
  .toc summary { display: block; cursor: pointer; color: var(--accent); font: 600 18px var(--head-font); padding: 4px 8px; }
  .cols { display: block; }
  .manual-body h1 { font-size: 30px; }
  .manual-body table { margin-left: 0; display: block; overflow-x: auto; }
  .stores { position: static; justify-content: center; padding: 16px; }
  .site-footer { padding-bottom: 32px; }
}
