/* RimWorld 風: 暗い背景・パネル調。サイトは暗色固定（ゲームの雰囲気に合わせる） */
:root {
  color-scheme: dark;
  --bg: #15171a; --bg2: #1c1f23; --panel: #23272c; --panel2: #2b3036; --line: #3a4048; --line2: #4b525c;
  --text: #e2ded5; --text2: #b9b4a8; --muted: #8d8a83; --accent: #d6b46a; --accent2: #9fc6e0;
  --ok: #6fb37a; --warn: #d8a04a; --bad: #d46a5a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --l1: #6c8fae; --l2: #6aa37f; --l3: #c49a4b; --l4: #b2604f;
  --r: 4px; --gut: 16px;
}
:root[data-theme="light"], :root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { color-scheme: dark; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.65 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; overflow-x: hidden; }
a { color: var(--accent2); }
a:hover { color: #cfe6f5; }
code { font: 12.5px/1.4 ui-monospace, Consolas, monospace; background: #111316; padding: 1px 4px; border-radius: 3px; color: #d9c79e; word-break: break-all; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.3; margin: 1.2em 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.12rem; } h4 { font-size: 1rem; }
small { font-weight: normal; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--gut); }
.muted { color: var(--muted); }
.note { font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: inset 0 1px 0 #ffffff0a, 0 1px 0 #00000080; padding: 14px; }

/* ヘッダ */
.top { position: sticky; top: 0; z-index: 20; background: linear-gradient(#22262b, #1b1e22); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.logo { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.logo-mark { color: var(--accent); margin-right: 6px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--text2); text-decoration: none; padding: 6px 10px; border-radius: var(--r); border: 1px solid transparent; font-size: 14px; }
.nav a[aria-current] { color: var(--text); border-color: var(--line2); background: var(--panel2); }
.nav a:hover { background: var(--panel); }
.nav .lang { border-color: var(--line); }
.foot { margin-top: 48px; border-top: 1px solid var(--line); background: var(--bg2); font-size: 13px; color: var(--text2); padding: 12px 0 24px; }

/* 部品 */
.btn { display: inline-block; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: var(--r); padding: 7px 14px; text-decoration: none; cursor: pointer; font: inherit; font-size: 14px; }
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.sm { padding: 2px 10px; font-size: 12px; vertical-align: middle; margin-left: 8px; }
.badge { display: inline-block; font-size: 11px; line-height: 1.6; padding: 0 6px; border-radius: 3px; background: #394049; color: var(--text); border: 1px solid var(--line2); }
.badge.ok { background: #24412b; border-color: #3d6b47; color: #bfe6c5; }
.badge.warn { background: #4a3a1d; border-color: #7a5f2c; color: #f0d29a; }
.badge.sm { font-size: 10px; }
.mach { display: inline-block; font-size: 11px; padding: 0 6px; border: 1px dashed var(--line2); border-radius: 3px; color: var(--text2); font-weight: normal; }
.stars { letter-spacing: 1px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), #4b525c var(--p, 0%)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ad-slot { margin: 20px 0; min-height: 90px; border: 1px dashed #4a4f57; border-radius: var(--r); display: grid; place-items: center; color: #6f6c66; font-size: 12px; background: repeating-linear-gradient(135deg, transparent 0 10px, #ffffff05 10px 20px); }
.untr { font-size: 13px; color: var(--text2); }
details.fold { margin: 8px 0 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg2); }
details.fold > summary { cursor: pointer; padding: 8px 12px; color: var(--accent); font-size: 14px; }
details.fold[open] > summary { border-bottom: 1px solid var(--line); }
details.fold > :not(summary) { margin: 10px; }
blockquote { margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--line2); color: var(--text2); }

/* 表 */
.tw { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); margin: 8px 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { border-bottom: 1px solid #343a41; padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: #2a2f35; color: var(--text); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
tbody tr:nth-child(even) td { background: #1f2327; }
tbody tr:hover td { background: #2b3138; }
table.num td.n, table.num td:nth-child(n+3) { font-variant-numeric: tabular-nums; }
td.n { text-align: right; white-space: nowrap; }
.up { color: #9fd4a8; font-size: 12px; } .dn { color: #e0a090; font-size: 12px; }

/* トップ */
.hero { margin-top: 20px; background: radial-gradient(ellipse at top right, #33302a, var(--panel) 60%); }
.hero h1 { margin-top: 4px; }
.lead { color: var(--text2); }
.search { display: flex; gap: 8px; max-width: 640px; }
.search input, .filters input, .filters select { flex: 1; min-width: 0; background: #121417; color: var(--text); border: 1px solid var(--line2); border-radius: var(--r); padding: 8px 10px; font: inherit; }
.search button { background: var(--accent); color: #1b1a17; border: 0; border-radius: var(--r); padding: 0 16px; font-weight: 700; cursor: pointer; }
.block { margin-top: 28px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mcard { position: relative; display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; color: var(--text); text-decoration: none; min-width: 0; }
.mcard:hover { border-color: var(--accent); }
.mcard img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #0f1113; border-radius: 3px; }
.mcard .mt { font-size: 13px; font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mcard .mm { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 4px; flex-wrap: wrap; }
.mcard .badge { position: absolute; top: 12px; left: 12px; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rcard { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r); padding: 10px; color: var(--text); text-decoration: none; }
.rcard:hover { border-color: var(--accent); }
.rcard img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 3px; background: #0f1113; }
.rcard .mt { font-weight: 700; }
.rcard .rl { font-size: 13px; color: var(--text2); }

/* 一覧 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.filters input { flex: 2 1 220px; } .filters select { flex: 1 1 150px; }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; white-space: nowrap; }
.mlist { display: grid; gap: 6px; }
.mrow { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px 6px 6px; min-width: 0; }
.mrow img { width: 64px; height: 64px; object-fit: cover; border-radius: 3px; background: #0f1113; }
.mrow .t { font-weight: 600; overflow-wrap: anywhere; }
.mrow .t a { color: var(--text); text-decoration: none; } .mrow .t a:hover { color: var(--accent); }
.mrow .tg { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.mrow .nums { text-align: right; font-size: 12.5px; color: var(--text2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mrow .nums b { color: var(--text); font-size: 14px; }
.rank { color: var(--muted); font-size: 12px; margin-right: 6px; }

/* 詳細ページ: 層 */
.crumb { font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.mod-title { margin-top: 4px; }
.detail { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.toc { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 10px 10px 6px; }
.toc-t { margin: 0 0 6px 6px; font-weight: 700; color: var(--text2); }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 10px; }
.toc > ol { padding-left: 0; }
.toc li { margin: 2px 0; }
.toc a { color: var(--text2); text-decoration: none; display: block; padding: 1px 4px; border-radius: 3px; }
.toc a:hover, .toc a.on { color: var(--text); background: var(--panel2); }
.toc-l > a { font-weight: 700; color: var(--text); margin-top: 6px; }
.toc .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.toc-l.l1 .dot { background: var(--l1); } .toc-l.l2 .dot { background: var(--l2); } .toc-l.l3 .dot { background: var(--l3); } .toc-l.l4 .dot { background: var(--l4); }
.layer { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 14px; margin-bottom: 8px; }
.gauge { position: sticky; top: 64px; height: 120px; display: grid; grid-template-rows: repeat(4, 1fr); gap: 3px; padding-top: 8px; }
.gauge span { border-radius: 2px; background: #2c3137; }
.layer.l1 .gauge span:nth-child(-n+1), .layer.l2 .gauge span:nth-child(-n+2), .layer.l3 .gauge span:nth-child(-n+3), .layer.l4 .gauge span { background: var(--lc); }
.layer.l1 { --lc: var(--l1); } .layer.l2 { --lc: var(--l2); } .layer.l3 { --lc: var(--l3); } .layer.l4 { --lc: var(--l4); }
.layer-body { min-width: 0; border-left: 2px solid var(--lc); padding-left: 16px; }
.layer.l4 .layer-body { background: linear-gradient(90deg, #2a1f1c66, transparent 40%); }
.layer-head { margin: 8px 0 16px; padding: 10px 0 6px; border-bottom: 1px solid var(--line); }
.layer-head h2 { margin: 0; }
.layer-head .lead { margin: 4px 0 0; font-size: 14px; }
.lnum { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 3px; background: var(--lc); color: #121314; font-weight: 700; vertical-align: 3px; margin-right: 6px; }
.deeper { margin: 0 0 6px; color: var(--lc); font-size: 13px; letter-spacing: .08em; }
.site-only { margin: 8px 0 0; padding: 6px 10px; border: 1px solid var(--l4); border-radius: var(--r); color: #f0c2b6; background: #3a221d; font-size: 14px; }
.vnote { font-size: 13px; margin: 4px 0 10px; padding: 4px 10px; border-left: 3px solid #c4302b; background: #2a1d1d; border-radius: 0 var(--r) var(--r) 0; color: var(--text2); }
.sec { margin: 0 0 22px; }
.sec > h3 { border-bottom: 1px solid #343a41; padding-bottom: 4px; }
.l1grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
.oneline { font-size: 1.15rem; font-weight: 700; color: var(--accent); margin-top: 0; }
.rec h4 { margin-top: 0; }
.rec ul { margin: 6px 0; padding-left: 20px; }
.basics { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 13.5px; margin: 14px 0; }
.basics dt { color: var(--muted); } .basics dd { margin: 0; overflow-wrap: anywhere; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.kpi { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; text-align: center; }
.kpi b { display: block; font-size: 1.4rem; color: var(--text); } .kpi span { font-size: 12px; color: var(--muted); }
.video { position: relative; aspect-ratio: 16/9; background: #0d0e10; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video.ph { background-color: #0d0e10; background-size: cover; background-position: center; display: grid; place-items: center; text-align: center; padding: 12px; }
.ph-in p { margin: 4px 0; font-size: 13px; }
.play { display: inline-grid; place-items: center; width: 56px; height: 40px; background: #c4302b; color: #fff; border-radius: 10px; font-size: 18px; }
.hero-img { margin: 12px 0 0; } .hero-img img { width: 100%; border-radius: var(--r); border: 1px solid var(--line); }
figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.gallery figure { margin: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: contain; image-rendering: auto; }
.gallery figcaption { overflow-wrap: anywhere; }
.credit h4 { margin-top: 0; }

/* 動物カード */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.chips a { background: var(--panel2); border: 1px solid var(--line2); border-radius: 20px; padding: 3px 12px; text-decoration: none; color: var(--text); font-size: 13px; }
.cat-h { font-size: 1.1rem; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.acard { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.aimg { display: grid; place-items: center; background: radial-gradient(#2e353c, #1b1e22); border-radius: var(--r); border: 1px solid #343a41; width: 96px; height: 96px; }
.aimg img { width: 88px; height: 88px; object-fit: contain; }
.noimg { font-size: 34px; color: #59606a; font-weight: 700; }
.acard h4 { margin: 0 0 6px; font-size: 15px; } .acard h4 small { color: var(--muted); font-size: 12px; }
.sbar { display: grid; grid-template-columns: 72px minmax(0, 1fr) 46px; gap: 6px; align-items: center; font-size: 12px; margin: 3px 0; }
.sl { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.track { position: relative; height: 10px; background: #15181b; border-radius: 0 4px 4px 0; border: 1px solid #30353b; }
.track b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 0 4px 4px 0; }
.vtick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--s1); box-shadow: 0 0 0 1px var(--panel); }
.over { position: absolute; right: -2px; top: -5px; font-size: 10px; color: var(--accent); font-style: normal; }
.near { font-size: 12px; margin: 6px 0 0; color: var(--text2); }
.show { margin-top: 6px; font-size: 13px; }
.show ul { margin: 4px 0 0; padding-left: 18px; }
.tier { margin: 10px 0; }
.tier h4 { margin-top: 0; }
.trow { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 2px; margin: 2px 0; }
.tlab { background: var(--c); color: #fff; font-weight: 700; display: grid; place-items: center; padding: 6px; font-size: 13px; text-align: center; border-radius: 3px 0 0 3px; text-shadow: 0 1px 2px #0009; }
.ticons { display: flex; flex-wrap: wrap; gap: 2px; background: #1a1d21; padding: 4px; border-radius: 0 3px 3px 0; }
.ticons img { width: 48px; height: 48px; object-fit: contain; display: block; }
.hbars { display: grid; gap: 4px; }
.hb { display: grid; grid-template-columns: 160px minmax(0, 1fr) 46px 150px; gap: 8px; align-items: center; font-size: 12.5px; }
.hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unv li { margin: 4px 0; font-size: 13.5px; color: var(--text2); }

/* 比較ページ */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; margin: 8px 0; }
.lg svg { vertical-align: -2px; margin-right: 4px; }
.lg.s1 svg { fill: var(--s1); } .lg.s2 svg { fill: var(--s2); } .lg.s3 svg { fill: var(--s3); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.chart { margin: 0; padding: 10px; }
.chart figcaption { font-size: 13px; color: var(--text2); margin: 0 0 6px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #2f343a; stroke-width: 1; }
.chart .axis { stroke: #59606a; stroke-width: 1; }
.chart .tick, .chart .albl { fill: var(--muted); font-size: 11px; }
.chart .albl { fill: var(--text2); font-size: 12px; }
.pt { cursor: pointer; }
.pt > :first-child { stroke: var(--panel); stroke-width: 1.5; }
.pt.s1 > :first-child { fill: var(--s1); } .pt.s2 > :first-child { fill: var(--s2); } .pt.s3 > :first-child { fill: var(--s3); }
.pt .hit { fill: transparent; stroke: none; }
.pt.dim { opacity: .12; }
.pt.sel > :first-child { stroke: #fff; stroke-width: 2.5; }
.pt:hover > :first-child { stroke: #fff; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: #0f1113ee; border: 1px solid var(--line2); border-radius: var(--r); padding: 6px 8px; font-size: 12px; max-width: 240px; }
.cmp { margin: 14px 0; }
.cmp h2 { margin-top: 0; font-size: 1.1rem; }
.cmpgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cmpcol { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-width: 0; }
.cmpcol h3 { margin: 0 0 6px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.cmpcol h3 img { width: 40px; height: 40px; object-fit: contain; }
.cmprow { display: grid; grid-template-columns: 110px minmax(0, 1fr) 54px; gap: 6px; align-items: center; font-size: 12.5px; margin: 3px 0; }
.cmprow .track b.win { background: var(--ok); }
#aTable th { cursor: pointer; user-select: none; }
#aTable th.asc::after { content: " ▲"; color: var(--accent); } #aTable th.desc::after { content: " ▼"; color: var(--accent); }
#aTable tbody tr { cursor: pointer; }
#aTable tbody tr.sel td { background: #3a3424; }
#aTable td .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); } .sw.s3 { background: var(--s3); }

/* スマホ */
@media (max-width: 900px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; }
  .toc > ol > li > ol { display: none; }
  .l1grid { grid-template-columns: minmax(0, 1fr); }
  .l1grid > div:last-child { order: -1; }
  .hb { grid-template-columns: 110px minmax(0, 1fr) 40px; } .hv { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .layer { grid-template-columns: 8px minmax(0, 1fr); gap: 8px; }
  .layer-body { padding-left: 10px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .acard { grid-template-columns: 64px minmax(0, 1fr); }
  .aimg { width: 64px; height: 64px; } .aimg img { width: 58px; height: 58px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .mrow { grid-template-columns: 48px minmax(0, 1fr); } .mrow img { width: 48px; height: 48px; } .mrow .nums { grid-column: 2; text-align: left; }
  .cmpgrid { grid-template-columns: minmax(0, 1fr); }
  .trow { grid-template-columns: 76px minmax(0, 1fr); } .ticons img { width: 36px; height: 36px; }
  .basics { grid-template-columns: minmax(0, 1fr); } .basics dt { margin-top: 6px; }
}
/* 表の1列目（名前・キー）は折り返さない。はみ出しは表の中の横スクロールで */
.tw td:first-child { white-space: nowrap; }
.tw td:first-child code { word-break: normal; white-space: nowrap; }

/* ---------------- Vivi Race（旗艦ページ）: 章・機能カード・図 */
.pillars-h { margin-top: 20px; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.pillar { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 2px 10px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--r); padding: 10px; color: var(--text); text-decoration: none; }
.pillar:hover { border-color: var(--accent); }
.pillar img { grid-row: span 2; width: 56px; height: 56px; object-fit: contain; }
.pillar b { font-size: 14px; } .pillar span { font-size: 12.5px; color: var(--text2); }
.chap { margin: 0 0 30px; }
.chap > h3 { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.chn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #1b1a17; font-size: 14px; flex: none; }
.chap > .lead { margin-top: 0; }
.fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.fcard { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-width: 0; }
.fcard.hasimg { grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; } /* 絵を上に大きく（11-01: 画像と文字を半々に） */
.fimg { width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center; background: radial-gradient(#3a3a2c, #1b1e22); border: 1px solid #343a41; border-radius: var(--r); }
.fimg img { width: 70%; height: 86%; object-fit: contain; }
.fbody { min-width: 0; }
.fcard h4 { margin: 0 0 4px; font-size: 14.5px; overflow-wrap: anywhere; }
.fcard p { margin: 0; font-size: 13px; color: var(--text2); overflow-wrap: anywhere; }
.fn { color: var(--muted); font-size: 12px; font-weight: normal; margin-right: 2px; }
.vfig { margin: 10px 0 16px; padding: 12px; }
.vfig > figcaption { font-size: 14px; color: var(--text); font-weight: 600; margin: 0 0 8px; }
.vfig .note { margin: 8px 0 0; }
.figscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.vz { width: 100%; height: auto; display: block; max-width: 760px; }
.vz text { fill: var(--text); font-size: 13px; }
.vz .nt { font-size: 14px; font-weight: 700; } .vz .ns { fill: var(--text2); font-size: 12px; }
.vz .al, .vz .tick, .vz .mu { fill: var(--muted); font-size: 11.5px; } .vz .albl { fill: var(--text2); font-size: 12px; }
.vz .rl { fill: var(--text2); font-size: 12.5px; } .vz .vl { fill: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
.vz .nd rect, .vz .nd path { fill: var(--panel2); stroke: var(--line2); stroke-width: 1; }
.vz .nd.wk rect { stroke: var(--s3); stroke-width: 2; } .vz .nd.qn rect { stroke: var(--s2); stroke-width: 2; }
.vz .nd.dec path { fill: #2f2a1e; stroke: var(--accent); }
.vz .ar { stroke: var(--line2); stroke-width: 2; fill: none; } .vz .ar.loop { stroke: var(--s2); stroke-dasharray: 5 4; }
.vz .ah { fill: var(--line2); }
.vz .grid { stroke: #2f343a; stroke-width: 1; } .vz .axis { stroke: #6b737d; stroke-width: 1.5; }
.vz .rowbg { fill: #1f2327; }
.vz .dot { fill: #3a4048; }
.vz .ser.h rect { fill: var(--s1); } .vz .ser.w rect { fill: var(--s3); } .vz .ser.q rect { fill: var(--s2); }
.vz .ser rect.grow { opacity: .5; } .vz .ser rect.tail { opacity: .25; }
.vz .ser rect:hover { stroke: #fff; stroke-width: 1.5; }
.vz .pea { stroke: var(--panel); stroke-width: 2; fill: #7cc35a; }
.vz .pea.fire { fill: #e8743b; } .vz .pea.ice { fill: #8fd3f0; } .vz .pea.elec { fill: #f2d649; } .vz .pea.fast { fill: #c9e66a; } .vz .pea.plus { fill: #7cc35a; stroke: var(--accent); stroke-width: 3; }
.vz .fo { margin: 0; font-size: 12px; line-height: 1.35; color: var(--text2); }
.vz .fo.foc { font-size: 11px; line-height: 1.2; text-align: center; color: var(--text); overflow-wrap: anywhere; }
.vz .fo.fon { height: 100%; display: flex; align-items: center; font-size: 13px; font-weight: 700; line-height: 1.2; color: var(--text); overflow-wrap: anywhere; }
.vleg { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; margin: 0 0 6px; align-items: center; }
.vleg .lg i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.vleg .lg.w i { background: var(--s3); } .vleg .lg.q i { background: var(--s2); } .vleg .lg.h i { background: var(--s1); }
.rmods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rmod { display: grid; grid-template-columns: 80px minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 2px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; color: var(--text); text-decoration: none; min-width: 0; }
.rmod:hover { border-color: var(--accent); }
.rmod img, .rmod .noimg { grid-row: span 3; width: 80px; height: 80px; object-fit: cover; border-radius: 3px; background: #0f1113; display: grid; place-items: center; }
.rmt { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; } .rms { font-size: 12px; color: var(--text2); } .rms b { color: var(--text); }
.rmw { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.formula p, .formula li { font-size: 13.5px; } .formula ul { padding-left: 20px; }
pre.xml { margin: 0; padding: 10px; background: #111316; border-radius: var(--r); overflow-x: auto; max-height: 520px; }
pre.xml code { background: none; padding: 0; white-space: pre; word-break: normal; font-size: 12px; }
@media (max-width: 560px) {
  .fcards, .rmods { grid-template-columns: minmax(0, 1fr); }
  .fcard.hasimg { grid-template-columns: 96px minmax(0, 1fr); } .fimg { width: 96px; height: 96px; aspect-ratio: auto; } .fimg img { width: 88px; height: 88px; }
  .vfig { padding: 8px; }
}
/* 長い URL・ファイル名でスマホ幅からはみ出さない（表は従来どおり表の中で横スクロール） */
.layer-body, .crumb, .mod-title { overflow-wrap: anywhere; }
.layer-body table { overflow-wrap: normal; }
@media (max-width: 600px) { .figscroll::after { content: "← →"; display: block; text-align: center; font-size: 11px; color: var(--muted); } }
/* 余白はビルド時に切る（lib/trim.mjs）。小さい画像は app.js が整数倍に */
img.px-on { image-rendering: pixelated; }

/* カテゴリ: サイドバー・チップ・一覧（11-01） */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.shell-main { min-width: 0; }
.cside { position: sticky; top: 64px; margin-top: 20px; max-height: calc(100vh - 80px); overflow: auto; font-size: 13.5px; }
.dside { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; display: grid; gap: 10px; align-content: start; }
.dside .cside { position: static; margin: 0; max-height: none; overflow: visible; }
.dside .toc { position: static; max-height: none; overflow: visible; }
details.cs { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
details.cs > summary { cursor: pointer; padding: 8px 10px; font-weight: 700; color: var(--text2); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
details.cs[open] > summary { border-bottom: 1px solid var(--line); }
.cs-cur { font-weight: normal; font-size: 12px; color: var(--accent); }
details.cs ul { list-style: none; margin: 0; padding: 4px; }
details.cs li a { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px; align-items: center; padding: 3px 6px; border-radius: 3px; color: var(--text2); text-decoration: none; line-height: 1.35; }
details.cs li a:hover { background: var(--panel2); color: var(--text); }
details.cs li a[aria-current] { background: #3a3424; color: var(--text); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.cs .ci { text-align: center; } .cs .cc { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cs-all { margin: 2px 10px 8px; font-size: 12.5px; }
.cchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.cchip { font-size: 13px; padding: 2px 10px; border: 1px solid var(--line2); border-radius: 999px; color: var(--text2); text-decoration: none; background: var(--panel); }
.cchip.main { border-color: var(--accent); color: var(--text); }
.cchip:hover { color: var(--text); border-color: var(--accent); }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ccard { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; color: var(--text); text-decoration: none; }
.ccard:hover { border-color: var(--accent); }
.ccard .ci { font-size: 26px; line-height: 1.2; text-align: center; }
.ccard .cb { display: grid; gap: 2px; min-width: 0; } .ccard .cb .muted { font-size: 12.5px; }
.ccard .cx { font-size: 12px; color: var(--text2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cat-title { margin-top: 4px; }
.mrow.haspage { border-left: 3px solid var(--accent); }
.mrow .rl { font-size: 12.5px; color: var(--text2); overflow-wrap: anywhere; }
.mrow .tg a { color: var(--muted); } .mrow .tg a:hover { color: var(--accent2); }
details.fold.more > .mlist { margin: 8px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cside, .dside { position: static; max-height: none; overflow: visible; }
  .cside { margin-top: 12px; }
  details.cs ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
.cat-desc { font-size: 16px; color: var(--text); margin: 0 0 4px; }
details.cs > summary::after { content: "▾"; margin-left: auto; color: var(--muted); font-weight: normal; }
details.cs[open] > summary::after { content: "▴"; }
@media (min-width: 901px) { .shell { grid-template-columns: 236px minmax(0, 1fr); } details.cs li a { font-size: 13px; } }
@media (max-width: 900px) { .dside .cside { display: none; } }

/* ---------------- 詳細ページの絵（11-01: 画像と文字を半々に） */
.hero2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.hero-fig { position: relative; margin: 0; }
.hero-fig img { width: 100%; display: block; border-radius: var(--r); border: 1px solid var(--line); background: #0d0e10; }
.vbadge { position: absolute; left: 10px; top: 10px; background: #000c; color: #fff; font-size: 12.5px; padding: 3px 10px; border-radius: 20px; border: 1px solid #c4302b; }
.hero-side .oneline { font-size: 1.25rem; line-height: 1.5; }
.kpi b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.basics-fold > summary { font-size: 13px; }
.xcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 18px; }
.xcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; scroll-margin-top: 70px; }
.ximg { aspect-ratio: 4 / 3; display: flex; gap: 6px; align-items: center; justify-content: center; padding: 10px; background: radial-gradient(#323a42, #191c20 75%); border-bottom: 1px solid var(--line); }
.ximg img { flex: 1 1 0; min-width: 0; height: 100%; object-fit: contain; image-rendering: pixelated; }
.ximg.photo { padding: 0; } .ximg.photo img { object-fit: cover; image-rendering: auto; }
.xb { padding: 8px 10px 10px; }
.xb h4 { margin: 0 0 4px; font-size: 14.5px; line-height: 1.4; }
.xb p { margin: 0; font-size: 13px; color: var(--text2); line-height: 1.5; }
.xb .fgrp { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.fnum { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; margin-right: 6px; border-radius: 10px; background: #394049; color: var(--text); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.fgroup { margin: 16px 0 4px; color: var(--accent); font-size: 15px; }
.flist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 0; font-size: 13.5px; }
.flist dt { font-weight: 700; margin-top: 8px; } .flist dd { margin: 0 0 0 28px; color: var(--text2); }
/* 流れ図 */
.flow { margin: 6px 0 18px; } .flow figcaption { font-size: 14px; color: var(--text); font-weight: 700; margin: 0 0 8px; }
.flow ol { list-style: none; padding: 0; margin: 0; display: flex; align-items: stretch; gap: 6px; }
.fstep { flex: 1 1 0; min-width: 0; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 10px 8px; text-align: center; }
.fstep p { margin: 6px 0 0; font-size: 13px; line-height: 1.45; } .fstep .fsl { font-size: 11.5px; } .fsl a { margin: 0 2px; }
.fsi { height: 84px; display: flex; gap: 4px; justify-content: center; align-items: center; background: radial-gradient(#323a42, #191c20 75%); border-radius: var(--r); }
.fsi img { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; }
.fsn { font-size: 38px; font-weight: 800; color: var(--accent); opacity: .85; }
.farr { align-self: center; color: var(--accent); font-size: 22px; flex: none; }
/* 画面の図 */
.uiscreen { margin: 10px 0 20px; scroll-margin-top: 70px; }
.uiscreen figcaption { font-size: 14px; color: var(--text); margin: 0 0 6px; } .uopen { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.uiwin { border: 2px solid #59616b; border-radius: 6px; background: #1a1d21; box-shadow: 0 4px 18px #0008; overflow: hidden; }
.uibar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: linear-gradient(#3a4049, #2b3036); padding: 5px 10px; font-size: 13px; color: var(--text); }
.upending { color: var(--muted); font-size: 11.5px; }
.ugrid { display: grid; gap: 8px; padding: 10px; }
.upanel { position: relative; background: #262b31; border: 1px dashed #59616b; border-radius: 4px; padding: 10px 10px 8px 34px; min-height: 92px; }
.upn { position: absolute; left: 8px; top: 8px; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #1a1a1a; font-size: 12px; font-weight: 800; }
.ulegend .upn { position: static; margin-right: 6px; }
.uicons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.uicons img { width: 52px; height: 52px; object-fit: contain; image-rendering: pixelated; background: #15181b; border: 1px solid #3a4048; border-radius: 4px; }
.upl { margin: 0; font-size: 13px; font-weight: 600; } .uplinks { margin: 4px 0 0; font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.uphoto { width: 100%; border-radius: var(--r); border: 1px solid var(--line); }
.ulegend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
/* ギャラリー・相性・隠れた機能 */
.gtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.gt { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; }
.gt img { width: 100%; aspect-ratio: 1; object-fit: contain; background: radial-gradient(#323a42, #191c20 75%); border-radius: 4px; image-rendering: pixelated; }
.gt.big { grid-column: 1 / -1; } .gt.big img { aspect-ratio: auto; max-height: 520px; background: #f4f4f2; image-rendering: auto; }
.gt figcaption { font-size: 12.5px; color: var(--text2); }
/* ゲームの画面から切り出した場面（captions.json の scene:true・11-13）。横長なので2枠ぶん */
.gt.scene { grid-column: span 2; } .gt.scene img { aspect-ratio: 16 / 9; object-fit: cover; image-rendering: auto; background: #000; }
.rlab { font-size: 13px; color: var(--text2); margin: 8px 0 6px; } .rlab.bad { color: #f0b2a6; }
.xmods { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-bottom: 10px; }
.xmod { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); font-size: 12px; line-height: 1.35; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; }
.xmod img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.xmod.bad { border-color: #7a3a30; }
.htips { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.htip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; font-size: 13.5px; }
.htip.has-img { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: start; }
.htip img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; background: radial-gradient(#323a42, #191c20 75%); border-radius: 4px; }
.htip ul { margin: 4px 0 0; padding-left: 18px; }
/* 動物カード（役割ごとの物差し） */
.cards.roles { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.cards.roles .acard { grid-template-columns: minmax(0, 38%) minmax(0, 1fr); align-items: start; }
.cards.roles .aimg { width: 100%; height: auto; aspect-ratio: 1; }
.cards.roles .aimg img { width: 92%; height: 92%; }
.mxs { display: grid; gap: 6px; margin: 2px 0 6px; }
.mx { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 0 6px; background: #1d2125; border: 1px solid #30363d; border-radius: 4px; padding: 5px 8px; }
.mrep { grid-column: 1 / -1; margin-bottom: 2px; }
.mnum b { font-size: 19px; color: var(--accent); font-variant-numeric: tabular-nums; }
.munit { font-size: 12.5px; color: var(--text); } .mlab { font-size: 12px; color: var(--muted); min-width: 0; }
.mnote { grid-column: 1 / -1; font-size: 11.5px; color: var(--text2); }
.reps { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.ri { display: inline-block; width: 26px; height: 26px; flex: none; }
.ri img, .ri svg { width: 26px; height: 26px; object-fit: contain; display: block; }
.ri.part { overflow: hidden; } .ri.part > span { display: block; width: 26px; }
.ri.more { width: auto; color: var(--accent); font-weight: 800; line-height: 26px; }
.bars.vis { margin-top: 2px; }
@media (max-width: 900px) {
  .hero2 { grid-template-columns: minmax(0, 1fr); }
  .flow ol { flex-direction: column; } .farr { transform: rotate(90deg); }
  .fstep { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; text-align: left; align-items: center; } .fstep p { margin: 0; } .fsl { grid-column: 2; }
  .ugrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } .upanel { grid-column: auto !important; }
}
@media (max-width: 560px) {
  .xcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .xb h4 { font-size: 13.5px; } .xb p { font-size: 12.5px; }
  .ugrid { grid-template-columns: minmax(0, 1fr) !important; }
  .cards.roles { grid-template-columns: minmax(0, 1fr); }
  .cards.roles .acard { grid-template-columns: 110px minmax(0, 1fr); }
  .cards.roles .aimg { width: 110px; height: 110px; } .cards.roles .aimg img { width: 100px; height: 100px; }
  .htips { grid-template-columns: minmax(0, 1fr); }
  .gtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fsi { height: 72px; } .fsi img { width: 52px; height: 52px; }
}

.mosaic { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.mosaic a { display: block; aspect-ratio: 1; background: radial-gradient(#323a42, #191c20 75%); border: 1px solid var(--line); border-radius: 4px; padding: 4px; }
.mosaic a:hover { border-color: var(--accent); }
.mosaic img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.udots { color: #6b737d; font-size: 9px; letter-spacing: 2px; }
@media (max-width: 560px) { .mx { grid-template-columns: auto minmax(0, 1fr); } .mx .mlab { grid-column: 1 / -1; } }
/* 機械の解析だけのページ（scan.js・11-06） */
.scan-note { border: 1px dashed var(--line2); border-radius: var(--r); padding: 8px 12px; font-size: 13px; color: var(--text2); }
.scan-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.scan-head img { width: 160px; height: auto; border-radius: var(--r); flex: none; }
.scan-head h1 { margin: 0 0 6px; overflow-wrap: anywhere; }
table.kv th { text-align: left; white-space: nowrap; vertical-align: top; padding-right: 12px; color: var(--text2); }
table.kv td { overflow-wrap: anywhere; }
.scan-desc { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; max-height: 480px; overflow: auto; }
.scan-sum { border-left: 3px solid var(--line2); padding: 2px 10px; margin: 8px 0; }
.scan-sum p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 武器の数値（lib/weapons.mjs・11-13） */
.wcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.wcard { padding: 12px; min-width: 0; }
.wcard img { display: block; width: 100%; height: 110px; object-fit: contain; background: #15181b; border-radius: 3px; margin-bottom: 8px; }
.wcard h4 { margin: 0 0 6px; font-size: 16px; color: var(--accent); }
.wkv { margin: 0; display: grid; gap: 2px; font-size: 13px; }
.wkv > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px; border-bottom: 1px dotted #343a41; padding: 2px 0; }
.wkv dt { color: var(--text2); } .wkv dd { margin: 0; font-variant-numeric: tabular-nums; }
.wflag { margin: 6px 0 0; font-size: 12px; color: #f0d29a; }
.wcmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 4px 0 12px; }
.wbars { margin: 0; padding: 10px; display: grid; gap: 4px; }
.wbars figcaption { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.wbars .hb { grid-template-columns: 150px minmax(0, 1fr) 52px; }
.wbars .hb.van .track b { background: #6f7a86; }
.wbars .hb.van .hl { color: var(--text2); }
table.wtable th { white-space: normal; min-width: 52px; font-size: 12.5px; }
table.wtable td:first-child { color: var(--accent); }
@media (max-width: 900px) { .wbars .hb { grid-template-columns: 110px minmax(0, 1fr) 46px; } .wkv > div { grid-template-columns: 84px minmax(0, 1fr); } }
/* 武器の表を2つに分けた（11-13）: 名前と「近いバニラ」は折り返さない・重さと耐久の表は狭く */
table.wtable td:first-child, table.wtable td.nw { white-space: nowrap; }
table.wtable { width: auto; }
