/* =============================================
   Shogi Player Component
   ============================================= */
.shogi-player {
  display: inline-block;
  font-family: 'Zen Kaku Gothic Antique', sans-serif;
  font-weight: 700;
  user-select: none;
}
/* 持ち駒 */
.sp-hand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 1.8rem;
  font-size: 0.85rem;
  margin: 5px 0;
}
.sp-hand-label {
  color: var(--color-text-muted, #666);
  font-size: 0.8rem;
  margin-right: 2px;
  white-space: nowrap;
}
.sp-hand-piece {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
}
.sp-hand-piece sup {
  font-size: 0.6rem;
  font-weight: normal;
  vertical-align: super;
}
.sp-hand-empty {
  color: var(--color-text-muted, #999);
  font-size: 0.8rem;
}
/* 列ラベル */
.sp-col-labels {
  display: grid;
  grid-template-columns: repeat(9, 40px);
  margin-left: 2px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted, #888);
  margin-bottom: 2px;
}
/* 盤面 + 行ラベルを横並び */
.sp-board-and-rows {
  display: flex;
  align-items: stretch;
}
/* 盤面グリッド */
.sp-board {
  display: grid;
  grid-template-columns: repeat(9, 40px);
  grid-template-rows: repeat(9, 46px);
  border-top: 3px solid #4a2c0a;
  border-left: 3px solid #4a2c0a;
}
.sp-cell {
  width: 40px;
  height: 46px;
  border-right: 1px solid #4a2c0a;
  border-bottom: 1px solid #4a2c0a;
  background: var(--sp-board-bg, #f2e8d8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.sp-cell.sp-highlight {
  background: var(--sp-board-hl, #f0ee88);
}
/* 外枠の右・下 */
.sp-cell:nth-child(9n)   { border-right: 3px solid #4a2c0a; }
.sp-cell:nth-child(n+73) { border-bottom: 3px solid #4a2c0a; }
/* 星目 */
.sp-cell.sp-hoshi::after {
  content: '';
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 6px;
  height: 6px;
  background: #4a2c0a;
  border-radius: 50%;
  z-index: 2;
}
/* 行ラベル */
.sp-row-labels {
  display: flex;
  flex-direction: column;
}
.sp-row-label {
  height: 46px;
  display: flex;
  align-items: center;
  padding-left: 5px;
  font-size: 0.75rem;
  color: var(--color-text-muted, #888);
}
/* 駒 */
.sp-piece {
  font-size: 1.55rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
}
.sp-piece.sp-white {
  transform: rotate(180deg);
  display: inline-block;
}
.sp-piece.sp-promoted {
  color: #b22222;
}
/* コントロール */
.sp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.sp-btn {
  padding: 4px 10px;
  border: 1px solid var(--color-border, #ccc);
  border-radius: 4px;
  background: var(--color-surface, #fff);
  color: var(--color-text, #333);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  transition: background 0.1s;
}
.sp-btn:hover { background: var(--color-hover, #f0f0f0); }
.sp-btn:disabled { opacity: 0.35; cursor: default; }
.sp-info {
  font-size: 0.78rem;
  color: var(--color-text-muted, #666);
  min-width: 90px;
  text-align: center;
}
.sp-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}
/* 盤面 + 棋譜の横並びレイアウト */
.sp-layout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
/* 棋譜リスト */
.sp-kifu {
  flex: 0 0 130px;
  max-height: 416px;
  overflow-y: auto;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  scroll-behavior: smooth;
}
.sp-kifu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.1s;
}
.sp-kifu-row:hover { background: var(--color-hover, #f0f0f0); }
.sp-kifu-row.is-current {
  background: var(--color-primary, #1B2D4F);
  color: #fff;
}
.sp-kifu-num {
  min-width: 22px;
  text-align: right;
  font-size: 0.72rem;
  color: var(--color-text-muted, #999);
  flex-shrink: 0;
}
.sp-kifu-row.is-current .sp-kifu-num { color: rgba(255,255,255,0.6); }
/* テーマスイッチャー */
.sp-theme-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 1.5rem;
  flex-wrap: wrap;
}
.sp-theme-label {
  font-size: 0.75rem;
  color: var(--color-text-muted, #888);
}
.sp-theme-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  outline-offset: 2px;
  transition: border-color 0.15s, transform 0.1s;
}
.sp-theme-btn:hover  { transform: scale(1.15); }
.sp-theme-btn.is-active { border-color: #333; }

/* =============================================
   Castle Course Components
   ============================================= */
.castle-entry {
  margin-bottom: 3.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--color-border, #e0e0e0);
}
.castle-entry:last-of-type {
  border-bottom: none;
}
.castle-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-size: 0.82rem;
  color: var(--color-text-muted, #666);
  margin: 0.5rem 0 1.2rem;
  align-items: center;
}
.castle-stars { color: #b08000; }
.rec-badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}
.rec-great { background: #e8f5e9; color: #2e7d32; }
.rec-good  { background: #e3f2fd; color: #1565c0; }
.rec-ok    { background: #f5f5f5; color: #757575; }
.board-center {
  display: flex;
  justify-content: center;
  margin: 1.2rem 0;
}
