/* [board] */
div.board {
  display: flex;
  justify-content: center;
  margin-bottom: 1em;
}

/* [move] */
/* 実際に出力される基底タグは span.move。inline-block にして [move] を並べると横方向に並ぶ */
span.move {
  display: inline-block;
  text-align: center;
  margin-bottom: 1em;
}
/* span.move を直接子に持つ親（wpautop の <p>、スライダーの .scs-slide-inner 等）を中央寄せ。
   単独でも複数でも横方向中央に並ぶ */
:has(> span.move) {
  text-align: center;
}
/* スマホでも inline-block のまま横方向に並べる（入りきらない分だけ折り返す）。
   ボタンを一回り小さくして、できるだけ左右に並ぶようにする */
@media (max-width: 640px) {
  button.move {
    margin: .4em .2em;
    padding: 8px 14px;
    font-size: 13px;
  }
}
/* 形状・余白・太さは Simple LMS の .slms-btn / .slms-btn-primary に合わせる。
   色は「設定 → Backgammon Image」で変えられる。変数のフォールバックが従来のピンクなので、
   設定を触っていなければ（インラインの <style> が出力されなければ）今までと同じ見た目になる */
button.move {
  margin: .5em .35em;
  padding: 10px 22px;
  border: 2px solid transparent;
  border-radius: 24px;
  background: var(--bgi-move-bg, #d91470);
  color: var(--bgi-move-text, #fff);
  box-shadow: none;
  text-transform: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  height: auto;
}
button.move:hover {
  background: var(--bgi-move-hover-bg, #b0105b);
  color: var(--bgi-move-text, #fff);
}
/* ボタン非活性時の色を変更 */
button.move:disabled {
  background: #888;
  cursor: default;
}

/* [dicemap] */
div.dicemap {
  display: flex;
  justify-content: center;
  margin-bottom: 1em;
}
/* 背後の行・列レイヤーをクリックしやすくするため、ダイスマップ上のダイスをクリックできないようにする */
svg.dice {
  pointer-events: none;
}

/* [xg] */
/* 解説欄（.slms-result-explanation の灰色背景）の上に載るので、白背景＋細枠で浮かせる */
div.xg {
  box-sizing: border-box;
  max-width: 460px;
  margin: 0 0 1em;
  padding: 10px 12px;
  border: 1px solid #c9c9c9;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
div.xg-move {
  max-width: 100%;
}

/* アコーディオン。<details> はブラウザ標準なので JS が要らない
   （解説は exam.js が後から innerHTML で差し込むため、JS 初期化型は動かない） */
details.xg-fold {
  box-sizing: border-box;
  max-width: 460px;
  margin: 0 0 1em;
  border: 1px solid #c9c9c9;
  border-radius: 4px;
  background: #fff;
}
details.xg-fold-move {
  max-width: 100%;
}
/* 中のパネルは枠を持たない（枠の二重化を避ける） */
details.xg-fold > div.xg {
  max-width: none;
  margin: 0;
  padding-top: 0;
  border: 0;
  border-radius: 0;
}
summary.xg-fold-summary {
  display: flex;
  align-items: center;
  gap: .5em;
  padding: 8px 12px;
  color: #444;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  /* 標準の三角マーカーを消して自前のアイコンに差し替える */
  list-style: none;
}
summary.xg-fold-summary::-webkit-details-marker {
  display: none;
}
/* 開閉アイコン（右向き「>」。開いたら45度回転）。simple-lms の試験アコーディオンに合わせている */
summary.xg-fold-summary .xg-fold-icon {
  width: 7px;
  height: 7px;
  flex: none;
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
details.xg-fold[open] > summary .xg-fold-icon {
  transform: rotate(45deg);
}
/* 見出し（[xg]「XG解析結果」／[pip]「ピップ数」共通） */
div.xg .xg-title,
div.pip .xg-title {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e4e4e4;
  color: #444;
  font-size: 13px;
  font-weight: 700;
}

/* エクイティや勝率が桁で揃うように等幅数字にする */
div.xg .xg-num,
div.xg .xg-pct,
div.xg .xg-cubeless-val {
  font-variant-numeric: tabular-nums;
}
div.xg .xg-sec {
  margin-bottom: 10px;
}
div.xg .xg-sec:last-child {
  margin-bottom: 0;
}
div.xg .xg-sec-title {
  margin-bottom: 3px;
  color: #555;
  font-size: 12px;
  font-weight: 700;
}
div.xg .xg-sub {
  margin-left: .4em;
  color: #777;
  font-size: 11px;
}

/* 各確率の2行 */
div.xg .xg-win {
  display: flex;
  align-items: center;
  gap: .3em;
}
/* 色（background-color / border-color）は CHECKER_COLORS 由来の inline style で入る */
div.xg .xg-chk {
  flex: none;
  width: 13px;
  height: 13px;
  border: 1px solid;
  border-radius: 50%;
}
div.xg .xg-pct {
  font-weight: 700;
}

/* キューブレスエクイティのバー。6セグメントの合計が必ず100% */
div.xg .xg-cubeless {
  display: flex;
  align-items: center;
  gap: 10px;
}
div.xg .xg-bar {
  position: relative;
  display: flex;
  flex: 1;
  height: 14px;
  overflow: hidden;
  border: 1px solid #6b6b6b;
}
div.xg .xg-seg {
  height: 100%;
}
div.xg .xg-seg-ybg { background: #14521a; }
div.xg .xg-seg-yg  { background: #2f8f36; }
div.xg .xg-seg-yw  { background: #71c274; }
div.xg .xg-seg-ow  { background: #ded99a; }
div.xg .xg-seg-og  { background: #bdb43f; }
div.xg .xg-seg-obg { background: #8a8324; }
/* 50% の目印 */
div.xg .xg-bar-mid {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: #333;
}
div.xg .xg-cubeless-val {
  flex: none;
  font-size: 12px;
  font-weight: 700;
}
div.xg .xg-cubeless-val span {
  display: block;
}

/* キューブフルエクイティの3行 */
div.xg table.xg-eq {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  font-size: 13px;
}
div.xg table.xg-eq th,
div.xg table.xg-eq td {
  padding: 2px 4px;
  border: 0;
  background: none;
  font-size: inherit;
}
div.xg table.xg-eq th {
  font-weight: 400;
  text-align: left;
}
div.xg table.xg-eq td {
  text-align: right;
  white-space: nowrap;
}
div.xg .xg-dim {
  color: #888;
}
div.xg tr.xg-best th,
div.xg tr.xg-best td {
  background: #fff6d9;
  font-weight: 700;
}
div.xg tr.xg-best .xg-dim {
  font-weight: 400;
}
div.xg .xg-best-choice {
  display: flex;
  align-items: baseline;
  gap: .4em;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #e4e4e4;
}

/* ムーブ解析の表 */
/* 列が多いので、はみ出す分はテーブル単位で横スクロールさせる（ページ本体は横に伸ばさない） */
div.xg .xg-scroll {
  overflow-x: auto;
}
div.xg table.xg-plays {
  width: 100%;
  min-width: 420px;
  margin: 0;
  border-collapse: collapse;
  font-size: 13px;
}
div.xg table.xg-plays th,
div.xg table.xg-plays td {
  padding: 4px 6px;
  border: 1px solid #e0e0e0;
  background: none;
  font-size: inherit;
  vertical-align: top;
  white-space: nowrap;
}
div.xg table.xg-plays thead th {
  background: #f2f2f2;
  color: #555;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
div.xg table.xg-plays td.xg-rank {
  color: #777;
  text-align: center;
}
div.xg table.xg-plays td.xg-num {
  text-align: right;
}
/* 勝率セル。プレーヤー／対戦相手を2行に積む */
div.xg td.xg-win-cell {
  padding-top: 2px;
  padding-bottom: 2px;
}
div.xg .xg-w {
  display: flex;
  align-items: center;
  gap: .35em;
}
div.xg .xg-w .xg-num {
  min-width: 3.6em;
  text-align: right;
}
div.xg .xg-w .xg-chk {
  width: 10px;
  height: 10px;
}
div.xg table.xg-plays .xg-sub {
  margin-left: 0;
}
div.xg-error {
  border-color: #d91470;
  color: #d91470;
}

@media (max-width: 640px) {
  div.xg {
    font-size: 12px;
  }
  div.xg table.xg-eq,
  div.xg table.xg-plays {
    font-size: 12px;
  }
}

/* [pip] */
div.pip {
  box-sizing: border-box;
  max-width: 460px;
  margin: 0 0 1em;
  padding: 10px 12px;
  border: 1px solid #c9c9c9;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  text-align: left;
}
div.pip .pip-row {
  display: flex;
  align-items: center;
  gap: 1.2em;
}
div.pip .pip-item {
  display: inline-flex;
  align-items: center;
  gap: .4em;
}
/* 色（background-color / border-color）は CHECKER_COLORS 由来の inline style で入る */
div.pip .pip-chk {
  flex: none;
  width: 13px;
  height: 13px;
  border: 1px solid;
  border-radius: 50%;
}
div.pip .pip-num {
  font-weight: 700;
}
