/* ════════════════════════════════════════════════════════
   手くらべ将棋 — brand.css  共通デザインシステム
   ════════════════════════════════════════════════════════

   使い方:
   1. <link rel="stylesheet" href="/static/common/brand.css"> を <head> 先頭に追加
   2. JS で document.body.classList.add('shogi-3d') （settings.enable3d !== false の場合）
   3D エフェクトはすべて .shogi-3d スコープで高優先度を持つ
   ════════════════════════════════════════════════════════ */

/* ── CSS 変数 ─────────────────────────────────────────── */
:root {
  /* 将棋カラーパレット */
  --kiji-deep:    #1a1208;   /* 漆黒  — ページ背景 */
  --kiji-dark:    #2a1e0a;   /* 濃い木材 — カード */
  --kiji-mid:     #3a2c0a;   /* 中間木材 — ホバー */
  --kiji-border:  #5a4010;   /* 木材ボーダー */
  --kaya-light:   #e8c870;   /* 榧材   — 盤マス */
  --kaya-mid:     #d4a830;   /* 榧材中間 */
  --kaya-dark:    #c4a040;   /* 榧材暗   — 線 */
  --kaya-border:  #8b6914;   /* 盤ボーダー */
  --kin-bright:   #c8a844;   /* 金色明   — アクセント */
  --kin-mid:      #a08030;   /* 金色中 */
  --koma-light:   #f5e8c0;   /* 白木     — 先手駒 */
  --text-main:    #f0e8d0;   /* メインテキスト */
  --text-sub:     #998860;   /* サブテキスト */
  --text-dim:     #665540;   /* 薄いテキスト */

  /* シャドウ */
  --sh-piece:     0 1px 3px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.25);
  --sh-piece-up:  0 5px 12px rgba(0,0,0,.65), 0 2px 4px rgba(0,0,0,.4);
  --sh-board:     0 6px 28px rgba(0,0,0,.7), 0 2px 8px rgba(0,0,0,.4);
  --sh-card:      0 4px 12px rgba(0,0,0,.4);
  --sh-btn:       0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.12);
  --sh-btn-in:    inset 0 2px 5px rgba(0,0,0,.5);
  --sh-bar-in:    inset 0 2px 5px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.06);

  /* トランジション */
  --t-fast:   .10s ease;
  --t-norm:   .18s ease;
  --t-bounce: .20s cubic-bezier(.34,1.56,.64,1);

  /* 角丸 */
  --r-sm:   5px;
  --r-md:   8px;
  --r-lg:  14px;
  --r-pill:20px;
}

/* ════════════════════════════════════════════════════════
   Semi-3D エフェクト  (.shogi-3d スコープ)
   高特異度で inline <style> を安全に上書き
   ════════════════════════════════════════════════════════ */

/* ── ヘッダー ─────────────────────────────────────── */
.shogi-3d #header {
  box-shadow: 0 2px 10px rgba(0,0,0,.6);
}

/* ── 盤ラッパー（浮き上がりシャドウ）────────────── */
.shogi-3d #board-wrap {
  box-shadow: var(--sh-board);
  border-radius: 2px;
}

/* ── マス目テクスチャ ─────────────────────────────── */
.shogi-3d .cell {
  box-shadow: inset 1px 1px 0 rgba(255,255,248,.18),
              inset -1px -1px 0 rgba(0,0,0,.08);
}

/* 昇段ゾーン: 微妙なグラデーションで奥行き感 */
.shogi-3d .cell.zone-sente {
  background: linear-gradient(150deg, #f4e6d0 0%, #e6ceb0 100%);
}
.shogi-3d .cell.zone-gote {
  background: linear-gradient(150deg, #d4f0cc 0%, #baddb4 100%);
}

/* ── 駒テキスト浮き出し ───────────────────────────── */
.shogi-3d .piece {
  text-shadow: 0 1px 0 rgba(255,255,255,.65),
               0 -1px 0 rgba(0,0,0,.35);
  transition: transform var(--t-bounce), filter var(--t-fast);
  will-change: transform;
}
.shogi-3d .piece.gote {
  text-shadow: 0 1px 0 rgba(80,100,200,.5),
               0 -1px 0 rgba(0,0,0,.5);
}
.shogi-3d .piece.prom {
  text-shadow: 0 1px 0 rgba(255,180,180,.6),
               0 -1px 0 rgba(0,0,0,.4) !important;
}

/* 選択駒リフトアップ — 先手（通常向き） */
.shogi-3d .cell.selected .piece:not(.gote):not(.flip-piece),
.shogi-3d .cell.from-sq  .piece:not(.gote):not(.flip-piece) {
  transform: translateY(-3px) scale(1.1);
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.6));
}
/* 選択駒リフトアップ — 後手（180deg 回転済みなので Y 方向反転） */
.shogi-3d .cell.selected .piece.gote,
.shogi-3d .cell.from-sq  .piece.gote,
.shogi-3d .cell.selected .piece.flip-piece,
.shogi-3d .cell.from-sq  .piece.flip-piece {
  transform: rotate(180deg) translateY(3px) scale(1.1);
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.6));
}

/* ── 持ち駒 ──────────────────────────────────────── */
.shogi-3d .hand-piece {
  box-shadow: 0 2px 5px rgba(0,0,0,.35),
              inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform var(--t-bounce),
              box-shadow var(--t-fast),
              border-color var(--t-fast),
              background var(--t-fast);
}
.shogi-3d .hand-piece:hover:not(.selected) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,.4),
              inset 0 1px 0 rgba(255,255,255,.3);
}
.shogi-3d .hand-piece.selected {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 5px 14px rgba(240,160,0,.5),
              inset 0 1px 0 rgba(255,255,255,.25);
}
.shogi-3d .hand-piece.gote.selected {
  box-shadow: 0 5px 14px rgba(96,176,255,.45),
              inset 0 1px 0 rgba(255,255,255,.12);
}

/* ── アクションボタン ────────────────────────────── */
.shogi-3d .action-btn {
  box-shadow: var(--sh-btn);
  transition: transform var(--t-fast),
              box-shadow var(--t-fast),
              filter .15s ease,
              opacity .15s ease;
}
.shogi-3d .action-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.45),
              inset 0 1px 0 rgba(255,255,255,.15);
}
.shogi-3d .action-btn:not(:disabled):active {
  transform: translateY(1px);
  box-shadow: var(--sh-btn-in);
  filter: brightness(.95);
}

/* まった */
.shogi-3d #btn-matta {
  background: linear-gradient(160deg, #d87038, #b04820);
}
/* 候補手 */
.shogi-3d #btn-candidates {
  background: linear-gradient(160deg, #3880d0, #1858a0);
}
/* 手くらべ */
.shogi-3d #btn-tekurabe {
  background: linear-gradient(160deg, #28b068, #188048);
}
/* 投了 */
.shogi-3d #btn-toryo {
  background: linear-gradient(160deg, #a82828, #701818);
}

/* ── 勝率バー ────────────────────────────────────── */
.shogi-3d #win-bar-wrap {
  box-shadow: var(--sh-bar-in);
}
.shogi-3d #win-bar-sente {
  background: linear-gradient(90deg, #f0d460, #c8a018);
  box-shadow: 2px 0 8px rgba(200,168,40,.3);
}
.shogi-3d #win-bar-gote {
  background: linear-gradient(90deg, #2870d8, #1040a8);
  box-shadow: -2px 0 8px rgba(32,80,200,.3);
}

/* ── 成りダイアログ ───────────────────────────────── */
.shogi-3d .promote-card {
  box-shadow: 0 8px 32px rgba(0,0,0,.8),
              inset 0 1px 0 rgba(255,255,255,.06);
}
.shogi-3d #promote-yes {
  background: linear-gradient(160deg, #d4b04c, #a88020);
  box-shadow: var(--sh-btn);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.shogi-3d #promote-yes:active {
  transform: translateY(1px);
  box-shadow: var(--sh-btn-in);
}
.shogi-3d #promote-no {
  background: linear-gradient(160deg, #585858, #383838);
  box-shadow: var(--sh-btn);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.shogi-3d #promote-no:active {
  transform: translateY(1px);
  box-shadow: var(--sh-btn-in);
}

/* ── 終局ボタン ───────────────────────────────────── */
.shogi-3d #btn-review {
  background: linear-gradient(160deg, #d4b04c, #a88020);
  box-shadow: var(--sh-btn);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity .15s;
}
.shogi-3d #btn-review:hover { opacity: .88; }
.shogi-3d #btn-review:active { transform: translateY(1px); box-shadow: var(--sh-btn-in); }

.shogi-3d #btn-restart {
  background: linear-gradient(160deg, #585858, #383838);
  box-shadow: var(--sh-btn);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity .15s;
}
.shogi-3d #btn-restart:hover { opacity: .88; }
.shogi-3d #btn-restart:active { transform: translateY(1px); box-shadow: var(--sh-btn-in); }

/* ── インデックスページ モードカード ─────────────── */
.mode-card {
  transition: transform var(--t-norm),
              border-color var(--t-norm),
              background var(--t-norm),
              box-shadow var(--t-norm);
  box-shadow: var(--sh-card);
}
.mode-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.mode-card.clickable:active {
  transform: translateY(0) scale(.98);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* 再開バナー */
.resume-btn {
  box-shadow: 0 2px 10px rgba(200,168,68,.2);
  transition: transform var(--t-norm), background var(--t-fast), box-shadow var(--t-norm);
}
.resume-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(200,168,68,.3);
}

/* ── セットアップページ ───────────────────────────── */
.opt-btn {
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: all .15s, box-shadow .1s;
}
.opt-btn.selected {
  box-shadow: 0 2px 8px rgba(200,168,68,.4),
              inset 0 1px 0 rgba(255,255,255,.15);
}
#start-btn {
  box-shadow: 0 4px 20px rgba(200,168,68,.4),
              inset 0 1px 0 rgba(255,255,255,.15);
  transition: box-shadow .2s, transform .1s;
}
#start-btn:hover {
  box-shadow: 0 6px 30px rgba(200,168,68,.7),
              inset 0 1px 0 rgba(255,255,255,.2);
  transform: translateY(-1px);
}
#start-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(200,168,68,.3),
              inset 0 2px 4px rgba(0,0,0,.2);
}

/* ── オンライン対戦 match.html ──────────────────── */
.big-btn {
  box-shadow: var(--sh-card);
  transition: border-color .15s, background .15s,
              box-shadow var(--t-norm), transform var(--t-norm);
}
.big-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.big-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.join-btn {
  box-shadow: var(--sh-btn);
  transition: opacity .15s, transform var(--t-fast), box-shadow var(--t-fast);
}
.join-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(200,168,68,.5);
}
.join-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: var(--sh-btn-in);
}
