:root {
  --bg: #f6fbff; --card: #fff; --ink: #1f2933; --muted: #6b7785; --line: #dbe7f0;
  --brand: #1d8fd1; --brand-soft: #e3f4fd; --pass: #2e9d5b; --pass-soft: #e5f6ec;
  --fail: #c9792f; --fail-soft: #fdf1e4;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.7 "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
main.wrap.wide { max-width: 1200px; }
header.site { background: #fff; border-bottom: 3px solid #99e3ff; }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding-top: 10px; padding-bottom: 10px; }
.logo { color: var(--ink); font-size: 1.1rem; }
.logo b { color: var(--brand); }
nav a { margin-right: 14px; white-space: nowrap; }
nav a:last-child { margin-right: 0; }
main { padding-top: 8px; padding-bottom: 32px; }
footer { color: var(--muted); font-size: .85rem; padding-bottom: 32px; border-top: 1px solid var(--line); padding-top: 12px; }
h1 { font-size: 1.6rem; margin: 20px 0 12px; }
h1 small { font-size: .9rem; color: var(--muted); font-weight: normal; }
h2 { font-size: 1.2rem; margin: 28px 0 10px; }
h2 small { font-size: .85rem; color: var(--muted); font-weight: normal; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.hero { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 20px 16px; margin-top: 16px; }
.figures { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.figures b { color: var(--ink); }
.search-big { max-width: 520px; }
.search-big > div { display: flex; gap: 8px; }
.search-big input { flex: 1; min-width: 0; }
.search-big label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.search-big.inline { margin: 8px 0 12px; }
.search-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 20px; margin: 8px 0; }
input, select, button { font: inherit; padding: 6px 10px; border: 1px solid #b9cbd8; border-radius: 6px; background: #fff; }
button { background: var(--brand); color: #fff; border-color: var(--brand); cursor: pointer; padding: 6px 16px; }
.notice { background: var(--brand-soft); border-radius: 8px; padding: 8px 14px; font-size: .9rem; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); }
.filters label input { width: 10em; }
.count { color: var(--muted); margin: 10px 0 4px; }

ol.games { list-style: none; padding: 0; margin: 0; }
.game { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 8px 14px; margin: 8px 0; }
.game.pass { border-left-color: var(--pass); }
.game.fail { border-left-color: var(--fail); }
.game .head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.game .date { color: var(--muted); font-variant-numeric: tabular-nums; }
.game .who { font-weight: bold; }
.game .by { font-size: .9rem; color: var(--muted); }
.game .comment { white-space: pre-line; margin: 4px 0; overflow-wrap: anywhere; }
.game .foot { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); }
.game .note { color: var(--ink); }
.badge { font-size: .8rem; border-radius: 99px; padding: 1px 10px; font-weight: bold; white-space: nowrap; }
.badge.pass { background: var(--pass-soft); color: var(--pass); }
.badge.fail { background: var(--fail-soft); color: var(--fail); }
.badge.none { background: #eee; color: var(--muted); }
.mark { font-size: .75rem; background: var(--brand-soft); color: var(--brand); border-radius: 4px; padding: 0 6px; white-space: nowrap; }

.pager { display: flex; gap: 16px; justify-content: center; margin: 16px 0; }
dl.profile { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
dl.profile dt { color: var(--muted); }
dl.profile dd { margin: 0; }
dd.rank { font-size: 1.4rem; font-weight: bold; color: var(--brand); line-height: 1.3; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; }
table.list th { background: var(--brand-soft); font-size: .85rem; }
table.bars { width: 100%; border-collapse: collapse; }
table.bars th { width: 4em; text-align: left; font-weight: normal; font-variant-numeric: tabular-nums; }
table.bars td { padding: 2px 0; }
table.bars td.num { width: 5em; padding-left: 8px; }
.bar { display: block; height: 14px; background: var(--fail); border-radius: 3px; min-width: 2px; overflow: hidden; }
.bar.solid { background: var(--brand); }
.bar-pass { display: block; height: 100%; background: var(--pass); }
.legend { font-size: .8rem; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; }
.sw.pass { background: var(--pass); } .sw.fail { background: var(--fail); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 2px 12px; }
ul.names { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
ul.names li.inactive a { color: #9fb3c2; }
.group h2 { border-bottom: 1px solid var(--line); padding-bottom: 4px; }

/* 棋譜ビュワー */
.viewer { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 16px; max-width: 620px; outline: none; }
.viewer:focus-visible { box-shadow: 0 0 0 3px var(--brand-soft); }
.v-info { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin-bottom: 8px; }
.v-player { font-weight: bold; display: inline-flex; align-items: center; gap: 6px; }
.v-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #333; }
.v-dot.b { background: #111; } .v-dot.w { background: #fff; }
.v-meta { color: var(--muted); font-size: .9rem; }
.v-board { width: 100%; height: auto; display: block; }
.v-coord { font-size: 11px; fill: #5a4520; }
.v-num { font-weight: bold; font-family: sans-serif; }
.v-ctrl { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.v-ctrl button { min-width: 46px; padding: 6px 8px; }
.v-range { width: 100%; margin: 10px 0 4px; }
.v-status { text-align: center; font-variant-numeric: tabular-nums; }
.v-nums { display: block; text-align: center; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.v-comment { white-space: pre-line; background: var(--brand-soft); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.comment-inline { white-space: pre-line; }
.kifu-link { font-weight: bold; }
.v-jump { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.v-jump-head { font-size: .85rem; color: var(--muted); }
.v-jump button { text-align: left; background: var(--card); color: var(--ink); border-color: var(--line); padding: 4px 10px; font-size: .85rem; display: flex; gap: 10px; }
.v-jump button b { color: var(--brand); white-space: nowrap; }
.v-jump button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-varbar { display: none; align-items: center; justify-content: space-between; gap: 8px; background: #fff4d6; border-radius: 8px; padding: 4px 10px; margin-bottom: 6px; font-size: .9rem; }
.v-varbar button { padding: 2px 10px; font-size: .85rem; }
.viewer.in-var .v-varbar { display: flex; }
.viewer.in-var .v-board rect:first-child { fill: #e4c47a; }

/* 囲碁きっず２の棋譜（kifu-search と同じ構成） */
.kb-layout { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
@media (max-width: 860px) { .kb-layout { grid-template-columns: minmax(0, 1fr); } }
.kb-left .viewer { margin-top: 0; max-width: none; }
.kb-ctrl { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: center; margin-top: 10px; }
.kb-movenum { display: inline-flex; gap: 4px; }
.kb-movenum input { width: 4em; text-align: right; padding: 4px 6px; }
.kb-btns { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.kb-btns button { min-width: 40px; padding: 5px 8px; }
.kb-btns button.on { background: #e33; border-color: #e33; }
button.sub { background: var(--card); color: var(--brand); border-color: var(--line); padding: 4px 10px; }
.kb-speed select { padding: 3px 6px; }
.kb-info { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; font-size: .9rem; }
.kb-rule { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 16px; padding: 6px 0 0; margin: 8px 0 0; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.kb-stone { cursor: pointer; }
.kb-players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kb-player { background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.kb-player.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.kb-player .v-dot { float: left; margin: 4px 8px 0 0; }
.kb-pname { font-weight: bold; overflow-wrap: anywhere; }
.kb-agehama { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.kb-tabs { display: flex; gap: 4px; margin-top: 12px; border-bottom: 2px solid var(--brand); }
.kb-tabs button { background: var(--brand-soft); color: var(--brand); border: none; border-radius: 6px 6px 0 0; padding: 6px 16px; }
.kb-tabs button.current { background: var(--brand); color: #fff; }
.kb-tabcontent { background: var(--card); border: 1px solid var(--line); border-top: none; border-radius: 0 0 10px 10px; padding: 8px 10px; }
.kb-viewtype { font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; }
.kb-scroll { max-height: 520px; overflow-y: auto; position: relative; }
dl.kb-sec { display: flex; justify-content: space-between; gap: 8px; background: var(--brand-soft); border-radius: 6px; padding: 4px 10px; margin: 8px 0 4px; font-size: .9rem; }
dl.kb-sec dt { font-weight: bold; } dl.kb-sec dd { margin: 0; color: var(--muted); }
dl.kb-sec.head { margin-top: 0; }
dl.kb-toc { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 6px; margin: 0; font-size: .9rem; }
dl.kb-toc dd { margin: 0; color: var(--muted); }
.kb-branches { font-size: .9rem; padding: 2px 10px 4px; }
.kb-comment { display: grid; grid-template-columns: 8em 1fr; gap: 10px; border-bottom: 1px dashed var(--line); padding: 6px 4px; }
.kb-author { font-size: .85rem; font-weight: bold; overflow-wrap: anywhere; }
.kb-chead { font-size: .8rem; color: var(--muted); }
.kb-cbody { overflow-wrap: anywhere; }
.kb-endline { text-align: center; color: #c33; font-size: .85rem; border-top: 1px solid #f0c0c0; border-bottom: 1px solid #f0c0c0; margin: 6px 0; padding: 2px; }
