/* 戦術将棋 - スタイル（和風の盤 × ファンタジー戦術の雰囲気） */
:root {
  --bg: #14121c;
  --bg2: #1d1a28;
  --panel: #232033;
  --panel2: #2b2740;
  --line: #3b3552;
  --text: #ece6d6;
  --muted: #a49db5;
  --gold: #e2b85c;
  --gold-dim: #9c7c3a;
  --wood1: #f0d49a;
  --wood2: #ddb46c;
  --grid: #5a3d1a;
  --koma1: #fbeac4;
  --koma2: #e6c788;
  --ink: #1b140c;
  --red: #c8352b;
  --sp1: #3f2a5c;
  --sp2: #241838;
  --move: rgba(46, 160, 92, .55);
  --shoot: #e04646;
  --push: #f08a24;
  --drop: rgba(60, 130, 220, .55);
  --last: rgba(255, 220, 90, .35);
  --sel: rgba(255, 215, 110, .65);
  --cell: min(54px, calc((100vw - 34px) / 9.4));
  --radius: 10px;
  --font-jp: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "MS PMincho", serif;
  --font-ui: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #2d2546 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- ヘッダー ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(43,39,64,.95), rgba(29,26,40,.95));
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand h1 { margin: 0; font-family: var(--font-jp); font-size: 20px; letter-spacing: .12em; color: var(--gold); }
.brand small { color: var(--muted); font-size: 11px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav button {
  background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 12px; color: var(--muted);
}
.nav button:hover { color: var(--text); border-color: var(--line); }
.nav button.active { color: var(--ink); background: var(--gold); border-color: var(--gold); font-weight: 700; }

main { padding: 12px; max-width: 1280px; margin: 0 auto; }

/* ---------- 汎用 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 7px 12px;
  transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--gold-dim); background: #353050; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #f0c86e, #c99a3e); color: var(--ink); border-color: #f0c86e; font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #f7d585, #d4a548); }
.btn.danger { border-color: #7a3030; color: #ffb3a8; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.on { border-color: var(--gold); color: var(--gold); }
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.panel h3 { margin: 0 0 8px; font-size: 13px; color: var(--gold); letter-spacing: .08em; font-weight: 700; }
.muted { color: var(--muted); }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
details.panel > summary { cursor: pointer; color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: .08em; list-style: none; }
details.panel > summary::before { content: "▸ "; }
details.panel[open] > summary::before { content: "▾ "; }
details.panel[open] > summary { margin-bottom: 8px; }

/* ---------- 対局画面レイアウト ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.board-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.side-col { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 900px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  main { padding: 8px; }
}

.turn-bar {
  width: 100%; max-width: calc(var(--cell) * 9 + 40px);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line);
}
.turn-bar .who { font-family: var(--font-jp); font-size: 16px; font-weight: 700; }
.turn-bar .who.sente { color: #f4ead2; }
.turn-bar .who.gote { color: #b9d3ff; }
.check-badge { background: var(--red); color: #fff; padding: 2px 10px; border-radius: 99px; font-weight: 700; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .75; } to { opacity: 1; } }

/* ---------- 持ち駒 ---------- */
.hand {
  width: 100%; max-width: calc(var(--cell) * 9 + 40px);
  min-height: calc(var(--cell) * .9 + 14px);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 8px; border-radius: 8px; background: rgba(0,0,0,.25); border: 1px solid var(--line);
}
.hand .label { font-size: 12px; color: var(--muted); min-width: 3.2em; }
.hand .label b { color: var(--text); font-family: var(--font-jp); }
.hand .empty { color: var(--muted); font-size: 12px; }
.hand-item { position: relative; background: none; border: 2px solid transparent; border-radius: 8px; padding: 1px; }
.hand-item.selectable:hover { border-color: var(--gold-dim); }
.hand-item.selected { border-color: var(--gold); background: rgba(226,184,92,.18); }
.hand-item.locked { opacity: .5; }
.hand-item .count { position: absolute; right: -4px; bottom: -4px; background: var(--gold); color: var(--ink); font-size: 11px; font-weight: 700; border-radius: 99px; min-width: 18px; padding: 0 4px; text-align: center; }
.hand-item .lock { position: absolute; left: -4px; top: -4px; background: #6b2a2a; color: #fff; font-size: 10px; border-radius: 4px; padding: 0 3px; }
.banished { font-size: 11px; color: var(--muted); margin-left: auto; }

/* ---------- 盤 ---------- */
.board-wrap { position: relative; padding: 18px 20px 6px 6px; border-radius: 12px;
  background: linear-gradient(135deg, #6a4521, #3d260f); box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 2px #8a6232; }
.coords-top, .coords-right { position: absolute; color: #f5deb0; font-size: 11px; font-family: var(--font-jp); opacity: .85; }
.coords-top { top: 2px; left: 6px; display: grid; grid-template-columns: repeat(9, var(--cell)); text-align: center; }
.coords-right { top: 18px; right: 3px; display: grid; grid-template-rows: repeat(9, var(--cell)); align-items: center; width: 14px; text-align: center; }
.board {
  display: grid; grid-template-columns: repeat(9, var(--cell)); grid-template-rows: repeat(9, var(--cell));
  background: linear-gradient(160deg, var(--wood1), var(--wood2));
  border: 2px solid var(--grid);
  position: relative;
}
.cell {
  position: relative; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid);
  display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none;
}
.cell:nth-child(9n) { border-right: none; }
.cell:nth-last-child(-n+9) { border-bottom: none; }
.cell.star::after { content: ""; position: absolute; right: -3.5px; bottom: -3.5px; width: 6px; height: 6px; border-radius: 50%; background: var(--grid); z-index: 1; }
.cell.zone-top { box-shadow: inset 0 0 0 999px rgba(120, 80, 160, .05); }
.cell.last { background: var(--last); }
.cell.selected { background: var(--sel); box-shadow: inset 0 0 0 3px #f5c542; }
.cell.in-check { background: radial-gradient(circle, rgba(220,40,40,.65), rgba(220,40,40,.15)); }
.cell.checker { box-shadow: inset 0 0 0 3px rgba(220,40,40,.8); }
.cell .hl { position: absolute; inset: 0; pointer-events: none; z-index: 3; display: flex; align-items: center; justify-content: center; }
.cell .hl.move::before { content: ""; width: 28%; height: 28%; border-radius: 50%; background: var(--move); }
.cell .hl.capture { box-shadow: inset 0 0 0 3px rgba(46,160,92,.85); }
.cell .hl.drop::before { content: ""; width: 26%; height: 26%; border-radius: 50%; background: var(--drop); }
.cell .hl.shoot { box-shadow: inset 0 0 0 3px var(--shoot); background: rgba(224,70,70,.18); }
.cell .hl.shoot::after { content: "✛"; position: absolute; top: 0; right: 2px; color: var(--shoot); font-size: 12px; font-weight: 700; }
.cell .hl.push { box-shadow: inset 0 0 0 3px var(--push); background: rgba(240,138,36,.18); }
.cell .hl.push span { position: absolute; top: 0; right: 2px; color: var(--push); font-weight: 900; font-size: 13px; }
.cell .hl.pushdest::before { content: ""; position: absolute; inset: 22%; border: 2px dashed var(--push); border-radius: 6px; }
.cell .hl.place::before { content: ""; width: 30%; height: 30%; border-radius: 50%; background: var(--drop); }
.cell.dim .koma { opacity: .35; }

/* ---------- 駒 ---------- */
.koma {
  --kw: calc(var(--cell) * .84);
  width: var(--kw); height: calc(var(--kw) * 1.05);
  position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column;
  font-family: var(--font-jp); font-weight: 700; font-size: calc(var(--cell) * .48); line-height: 1;
  color: var(--ink); z-index: 2;
  filter: drop-shadow(0 2px 1.5px rgba(0,0,0,.35));
}
.koma::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  clip-path: polygon(50% 0%, 86% 16%, 100% 100%, 0% 100%, 14% 16%);
  background: linear-gradient(170deg, var(--koma1), var(--koma2));
}
.koma.gote { transform: rotate(180deg); }
.koma.promoted { color: var(--red); }
.koma.special { color: var(--gold); }
.koma.special::before { background: linear-gradient(170deg, var(--sp1), var(--sp2)); }
.koma.special::after {
  content: ""; position: absolute; inset: 2px; z-index: -1;
  clip-path: polygon(50% 0%, 86% 16%, 100% 100%, 0% 100%, 14% 16%);
  background: none; border: 0;
  box-shadow: inset 0 0 0 1.5px rgba(226,184,92,.6);
}
.koma.royal { font-size: calc(var(--cell) * .5); }
.koma .pips { position: absolute; bottom: 6%; font-size: calc(var(--cell) * .14); letter-spacing: 1px; color: #7dd3a0; font-family: var(--font-ui); }
.koma.damaged .pips { color: #ff8a5c; }
.koma.damaged::before { background: linear-gradient(170deg, #6a2d38, #3a1620); }
.koma.buffed .buff { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-size: calc(var(--cell) * .16); color: #7fc4ff; font-family: var(--font-ui); }
.koma.buffed { }
.koma.trap-own { opacity: .8; color: #e9c46a; }
.koma.trap-own::before { background: repeating-linear-gradient(45deg, rgba(60,40,20,.55) 0 6px, rgba(30,20,10,.55) 6px 12px); }
.koma.trap-revealed { color: #ffd2c8; }
.koma.trap-revealed::before { background: linear-gradient(170deg, #8b1e1e, #4d0f0f); }
.koma.small { --kw: 34px; font-size: 18px; }
.koma.small .pips { font-size: 7px; }
.koma.mini { --kw: 26px; font-size: 14px; }
.hidden-tag { position: absolute; top: 1px; left: 2px; font-size: 9px; color: #e9c46a; z-index: 4; font-family: var(--font-ui); }

/* ---------- 情報パネル ---------- */
.info-name { font-family: var(--font-jp); font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); margin-right: 4px; }
.tag.gold { border-color: var(--gold-dim); color: var(--gold); }
.tag.red { border-color: #7a3030; color: #ff9b8f; }
.tag.blue { border-color: #2d5a85; color: #8cc6ff; }
.info-body { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin-top: 8px; }
.info-text { font-size: 13px; }

.diagram { display: grid; grid-template-columns: repeat(7, 13px); grid-template-rows: repeat(7, 13px); gap: 1px; background: #4a3a22; padding: 1px; border-radius: 3px; }
.diagram div { background: #e7cf9d; position: relative; }
.diagram .c { background: var(--gold); }
.diagram .m { background: #3aa86b; }
.diagram .s { background: #2a8a55; background-image: linear-gradient(45deg, rgba(255,255,255,.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%); background-size: 6px 6px; }
.diagram .a { background: var(--shoot); }
.diagram .ms { background: linear-gradient(135deg, #3aa86b 50%, var(--shoot) 50%); }
.diagram .p { background: var(--push); }
.diagram .aura { background: #7fc4ff; }
.diagram .bf { background: #7fc4ff; }
.legend { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 3px; }

.history { max-height: 260px; overflow-y: auto; font-family: var(--font-jp); font-size: 13px; margin: 0; padding-left: 2.4em; }
.history li { padding: 1px 0; border-bottom: 1px dotted rgba(255,255,255,.06); }
.history li:last-child { color: var(--gold); }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- オーバーレイ ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,6,14,.78); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--gold-dim); border-radius: 14px; padding: 18px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal h2 { margin: 0 0 8px; font-family: var(--font-jp); color: var(--gold); font-size: 20px; }
.modal p { margin: 6px 0 12px; }
.modal .choices { display: flex; flex-direction: column; gap: 8px; }
.modal .choices .btn { text-align: left; padding: 10px 12px; }
.cover { text-align: center; }
.cover .big { font-family: var(--font-jp); font-size: 28px; color: var(--gold); margin: 6px 0; }

.toast { pointer-events: none; position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1a1726; border: 1px solid var(--gold-dim); padding: 9px 16px; border-radius: 10px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 92vw; animation: tin .2s; }
@keyframes tin { from { opacity: 0; transform: translate(-50%, 8px); } }
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: calc(var(--cell) * .3); color: #fff; text-shadow: 0 0 6px #000; animation: fx 1.1s forwards; }
@keyframes fx { 0% { opacity: 0; transform: scale(.6); } 20% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1); } }

/* ---------- 編成画面 ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .form-layout { grid-template-columns: minmax(0, 1fr); } }
.side-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.side-tabs .btn.active { border-color: var(--gold); color: var(--gold); background: rgba(226,184,92,.1); }
.budget { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.budget .num { font-family: var(--font-jp); font-size: 22px; font-weight: 700; color: var(--gold); }
.budget .num.over { color: var(--red); }
.bar { height: 8px; border-radius: 99px; background: #15121e; overflow: hidden; border: 1px solid var(--line); }
.bar > div { height: 100%; background: linear-gradient(90deg, #c99a3e, #f0c86e); }
.camp-board { grid-template-rows: repeat(3, var(--cell)); }
.enemy-ghost { display: grid; grid-template-columns: repeat(9, var(--cell)); grid-template-rows: repeat(1, calc(var(--cell) * .5)); opacity: .35; border: 2px solid var(--grid); border-bottom: none; background: repeating-linear-gradient(90deg, var(--wood2) 0 calc(var(--cell) - 1px), var(--grid) calc(var(--cell) - 1px) var(--cell)); }
.cell .ghost { opacity: .28; }
.cell .restore-hint { position: absolute; bottom: 1px; font-size: 9px; color: #5a3d1a; z-index: 3; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.shop-item { display: flex; gap: 8px; align-items: center; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.shop-item:hover:not(:disabled) { border-color: var(--gold-dim); }
.shop-item.selected { border-color: var(--gold); background: rgba(226,184,92,.14); }
.shop-item:disabled { opacity: .45; cursor: not-allowed; }
.shop-item .nm { font-weight: 700; font-family: var(--font-jp); }
.shop-item .meta { font-size: 11px; color: var(--muted); }
.errors { color: #ff9b8f; font-size: 12px; margin: 6px 0 0; padding-left: 1.2em; }
.inline-input { background: #15121e; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-width: 0; flex: 1; }
select.inline-input { flex: 1; }

/* ---------- ルール・設定 ---------- */
.doc { max-width: 900px; margin: 0 auto; }
.doc h2 { font-family: var(--font-jp); color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 28px; }
.doc h3 { color: var(--gold); margin-bottom: 4px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 13px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.doc th { background: var(--panel2); }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.catalog .panel { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.setting .desc { font-size: 12px; color: var(--muted); }
.switch { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: #3a3550; position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #ddd; transition: left .15s; }
.switch:checked { background: var(--gold-dim); }
.switch:checked::after { left: 21px; background: var(--gold); }

@media (max-width: 560px) {
  .brand small { display: none; }
  .nav button { padding: 5px 8px; font-size: 13px; }
  .board-wrap { padding: 16px 16px 4px 4px; }
  .coords-top { left: 4px; } .coords-right { top: 16px; right: 1px; }
  .history { max-height: 180px; }
}

/* ---------- 差額コスト方式の編成 ---------- */
.swap-badge { position: absolute; top: 1px; right: 2px; z-index: 4; font-size: 10px; font-weight: 700; color: #fff; background: #b07a1e; border-radius: 6px; padding: 0 4px; line-height: 15px; }
.swap-badge.minus { background: #2f7a55; }
.cell .hl.place-swap { box-shadow: inset 0 0 0 3px rgba(60,130,220,.9); background: rgba(60,130,220,.18); }
.cell .hl.place-swap span { position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%); background: #1d4f8a; color: #fff; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 0 5px; line-height: 15px; }
.cost-plus { color: var(--gold); }
.cost-minus { color: #7dd3a0; }
.err-mini { color: #ff9b8f; font-size: 10px; }
.budget .num.small-num { font-size: 18px; }
.swap-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.swap-line .arrow { font-size: 18px; color: var(--gold); }
.swap-diff { margin-left: auto; font-weight: 700; color: var(--gold); }
.swap-diff.minus { color: #7dd3a0; }
.swap-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.swap-table th, .swap-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.swap-table th { color: var(--muted); font-weight: 400; font-size: 12px; }
.swap-table tr.total td { font-weight: 700; color: var(--gold); border-bottom: none; }
.panel { overflow-x: auto; }

/* ---------- v0.4 CPU対戦・自動対戦・リプレイ ---------- */
:root { --viz-1: #3987e5; --viz-2: #d95926; --viz-ref: #a49db5; }
.small { font-size: 12px; }
.muted.small { font-size: 12px; }
.small-select { flex: 0 0 auto; padding: 3px 6px; }
.thinking-badge { display: inline-flex; align-items: center; gap: 6px; color: #8cc6ff; font-weight: 700; font-size: 13px; }
.spinner { width: 12px; height: 12px; border: 2px solid rgba(140,198,255,.3); border-top-color: #8cc6ff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cpu-mark { font-size: 10px; color: #8cc6ff; border: 1px solid #2d5a85; border-radius: 4px; padding: 0 3px; font-family: var(--font-ui); }
.cpu-info { margin-top: 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.mode-panel { margin-bottom: 10px; }
.mode-panel label { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.doc.wide { max-width: 1280px; }
.sim-config { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 10px; }
@media (max-width: 900px) { .sim-config { grid-template-columns: 1fr; } }
.sim-config select.inline-input { width: 100%; }
.form-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 13px; }
.sim-progress { background: var(--panel); border: 1px solid var(--gold-dim); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0; }
.stat-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); font-family: var(--font-jp); }
.stat-sub { font-size: 11px; color: var(--muted); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; margin: 10px 0; }
.hbar-chart { display: flex; flex-direction: column; gap: 4px; }
.hbar-row { display: grid; grid-template-columns: 4.5em 1fr 6.5em; gap: 8px; align-items: center; font-size: 12px; padding: 2px 0; border-radius: 4px; }
.hbar-row:hover { background: rgba(255,255,255,.05); }
.hbar-label { color: var(--text); white-space: nowrap; }
.hbar-value { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { position: relative; height: 14px; display: block; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; display: block; }
.hbar-stack { display: flex; flex-direction: column; gap: 2px; }
.hbar-row.two .hbar-track { height: 10px; }
.hbar-ref { position: absolute; top: -2px; bottom: -2px; width: 0; border-left: 1px dashed var(--viz-ref); }
.viz-legend { margin: 0 0 6px; }
.viz-legend .ref-key { width: 0; height: 10px; border-left: 1px dashed var(--viz-ref); border-radius: 0; }
.table-wrap { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; white-space: nowrap; vertical-align: middle; }
.data-table th { color: var(--muted); font-weight: 400; }
.data-table .koma.mini { display: inline-flex; vertical-align: middle; }
.replay-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.replay-item { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 13px; padding: 4px; border-radius: 6px; }
.replay-item.on { background: rgba(226,184,92,.12); }
.replay-controls { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.replay-range { width: 100%; max-width: calc(var(--cell) * 9 + 40px); accent-color: var(--gold); }
.replay-moves li { cursor: pointer; }
.replay-moves li.cur { color: var(--gold); font-weight: 700; }
.replay-moves li:last-child { color: inherit; }
.replay-moves li.cur:last-child { color: var(--gold); }
.history li.cpu-move { }
