/* style.css — Phase 2.5 新デザイン（GGPoker リファレンス・2.5D）。

構成: 1. デザインシステム変数 → 2. ベース/レイアウト → 3. 上部バー → 4. 3D 卓シーン
     → 5. モーダル/共通部品 → 6. アクションバー → 7. アニメーション。
（シート・カード・チップの詳細は 10-C/D が追記する）
*/

/* ---------------- 1. デザインシステム変数 ---------------- */
:root {
  /* 背景・パネル */
  --bg-dark: #0d1117;
  --bg-panel: #161b22;
  --bg-panel-hi: #1f2630;
  /* レール（GGPoker 風のダークグラファイト） */
  --rail-wood: #23262b;
  --rail-wood-hi: #3a3f46;
  --rail-wood-lo: #0e0f12;
  --rail-stitch: rgba(255, 255, 255, 0.14);
  /* アクセント・テキスト */
  --gold: #d4af37;
  --text: #e8eaed;
  --text-dim: #9aa0a6;
  /* アクションボタン（GGPoker 系） */
  --btn-fold: #8c2b2b;
  --btn-fold-hi: #b93a3a;
  --btn-call: #1f6f43;
  --btn-call-hi: #2c9b5c;
  --btn-raise: #b3681f;
  --btn-raise-hi: #e08b2d;
  /* チップ面額色（t0..t4） */
  --chip-t0: #e8e8e8;
  --chip-t1: #d32f2f;
  --chip-t2: #2e7d32;
  --chip-t3: #2b2b2b;
  --chip-t4: #6a1b9a;
  /* カード */
  --card-w: 86px;
  --card-h: 121px;
  --suit-spade: #2b2b2b;
  --suit-heart: #d32f2f;
  --suit-diamond-4c: #1565c0;
  --suit-club-4c: #2e7d32;
  /* 縦レイアウト */
  --top-bar-h: 56px;
  --action-bar-h: 84px;
}

/* フェルト系のみテーマ切替（blue / green） */
body[data-theme="blue"] {
  --table-felt: #123a5c;
  --table-felt-hi: #1c517d;
  --table-felt-lo: #0b2a45;
  --table-line: rgba(255, 255, 255, 0.14);
}
body[data-theme="green"] {
  --table-felt: #1e7a45;
  --table-felt-hi: #2c9457;
  --table-felt-lo: #12522e;
  --table-line: rgba(255, 255, 255, 0.16);
}

/* ---------------- 2. ベース / レイアウト ---------------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.04), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.55), transparent 65%),
    linear-gradient(180deg, #10151c 0%, var(--bg-dark) 100%);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  overflow: hidden;
  user-select: none;
}

/* ---------------- 3. 上部バー ---------------- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--top-bar-h);
  padding: 0 14px;
  background: linear-gradient(180deg, var(--bg-panel-hi), var(--bg-panel));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.status-item {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.status-item--hand {
  color: var(--gold);
  min-width: 84px;
}

/* ストリートステップ（ピル型） */
.street-steps {
  display: flex;
  gap: 6px;
  margin: 0 auto;
}
.street-step {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.45;
  transition: opacity 0.3s, background 0.3s, box-shadow 0.3s;
}
.street-step--done { opacity: 0.8; background: rgba(255, 255, 255, 0.09); }
.street-step--current {
  opacity: 1;
  color: #10151c;
  background: linear-gradient(180deg, var(--gold), #b08d1e);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.55);
}

/* ---------------- 4. 3D 卓シーン ---------------- */
.scene-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.scene {
  perspective: 1100px;
  width: min(1080px, 94vw);
}

/* ---------------- 4b. 左固定ドック（学習サポート: 推奨％・プロフィール統計） ---------------- */
.cheat-dock {
  position: fixed;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.cheat-dock__tab {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--bg-panel-hi), var(--bg-panel));
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.cheat-dock__tab:hover { color: var(--gold); }

.cheat-dock__body { display: block; width: 300px; }
.seat-profile {
  margin-top: 2px; font-size: 10px; line-height: 1.2; text-align: center;
  color: #cfd6e4; white-space: nowrap;
}
.cheat-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.cheat-tabs__btn {
  flex: 1; padding: 3px 4px; font-size: 11px; border: 1px solid #55555f;
  border-radius: 4px; background: transparent; color: #a8a8b3; cursor: pointer;
}
.cheat-tabs__btn--active { background: #3a6ea5; border-color: #3a6ea5; color: #ffffff; }
.cheat-dock--open .cheat-dock__body {
  max-height: none;
}
.cheat-dock--profile-on .cheat-dock__body { width: 306px; }

.cheat-panel {
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(18, 24, 34, 0.96), rgba(10, 14, 20, 0.96));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}
.cheat-panel__title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold);
}
.cheat-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.cheat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
  font-size: 12px;
  color: var(--text-dim);
}
.cheat-row--recommended { color: #ffffff; font-weight: 700; }
.cheat-row__label { width: 96px; flex: none; text-align: left; }
.cheat-row__bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.cheat-row__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3a7bd5, #63b3ff);
}
.cheat-row--recommended .cheat-row__fill {
  background: linear-gradient(90deg, var(--gold), #ffe08a);
}
.cheat-row__pct { width: 34px; flex: none; text-align: right; }

.cheat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: var(--text-dim);
}
.cheat-table th {
  padding: 4px 2px;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.cheat-table th:first-child,
.cheat-table td:first-child { text-align: left; }
.cheat-table td { padding: 4px 2px; text-align: right; }
.cheat-table__profile {
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
}
.cheat-table__row--out { opacity: 0.45; }
.cheat-table__net--plus { color: #4ade80; font-weight: 800; }
.cheat-table__net--minus { color: #f87171; font-weight: 800; }

/* 推奨アクション（自分のカード右側・卓の外側に浮かせる） */
.advice-float {
  position: absolute;
  left: 59%;
  top: 88%;
  width: 196px;
  margin: 0;
  z-index: 3;
}
.advice-float .cheat-panel__title { margin-bottom: 6px; }
.advice-float .cheat-row {
  gap: 5px;
  margin: 3px 0;
  font-size: 11px;
}
.advice-float .cheat-row__label { width: 92px; }
.advice-float .cheat-row__pct { width: 30px; }
.advice-float .cheat-size {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
}
.advice-float .cheat-odds {
  margin-top: 3px;
  font-size: 11px;
  color: #9fc9ff;
  word-break: keep-all;
}

.table-3d {
  position: relative;
  width: 100%;
  aspect-ratio: 900 / 460;
  /* カードを立てて表示するため、テーブルは傾けない（GGPoker 風の正面ビュー） */
}

/* レール（GGPoker 風のダークグラファイト・厚みのある楕円） */
.table-rail {
  position: absolute;
  inset: -2.2%;
  border-radius: 50% / 50%;
  background:
    repeating-linear-gradient(94deg, rgba(255, 255, 255, 0.02) 0 4px, transparent 4px 10px),
    linear-gradient(160deg, var(--rail-wood-hi) 0%, var(--rail-wood) 40%, var(--rail-wood-lo) 100%);
  box-shadow:
    inset 0 3px 8px rgba(255, 255, 255, 0.16),
    inset 0 -8px 18px rgba(0, 0, 0, 0.8),
    0 22px 48px rgba(0, 0, 0, 0.7);
}

/* フェルト面（レール内側） */
.table-felt {
  position: absolute;
  inset: 5%;
  border-radius: 50% / 50%;
  background:
    radial-gradient(ellipse at 50% 42%, var(--table-felt-hi) 0%, var(--table-felt) 58%, var(--table-felt-lo) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.45),
    inset 0 0 10px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
/* フェルト布目ノイズ（SVG feTurbulence を data URI で薄く重ねる） */
.table-felt::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' seed='7' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
  pointer-events: none;
}
/* 内側のオーバルライン（GGPoker のフェルト内周リング） */
.table-felt::after {
  content: "";
  position: absolute;
  inset: 8%;
  border: 2px solid var(--table-line);
  border-radius: 50% / 50%;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

/* 卓中央ロゴ飾り */
.table-logo {
  position: absolute;
  top: 31%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

/* Total Pot ピル（GGPoker 風: 黒地 + 金文字・1.5倍サイズ） */
.pot-display {
  position: absolute;
  top: 23%;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  padding: 6px 27px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 23px;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* ボード（5 枚分スロット） */
.board {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  perspective: 900px;
}

/* ディーラーボタン（金の D ボタン） */
.dealer-button {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a3, var(--gold) 65%, #a5821d 100%);
  color: #3a2c00;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

/* ---------------- 4b. シート（名前プレート・バッジ・状態） ---------------- */
.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: left 0.4s ease, top 0.4s ease;
  z-index: 2;
}

.seat-plate {
  position: relative;
  min-width: 118px;
  padding: 5px 12px 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(20, 24, 30, 0.96), rgba(10, 13, 17, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  text-align: center;
  white-space: nowrap;
  transition: border-color 0.3s, box-shadow 0.3s, opacity 0.3s;
  z-index: 3;
}

.seat-name { font-size: 12px; font-weight: 700; color: #ffffff; line-height: 1.25; }
.seat-stack { font-size: 15px; font-weight: 800; color: #f2f2f2; line-height: 1.2; }

/* 状態: ユーザー（名前を金色に） */
.seat--user .seat-name { color: var(--gold); }

/* 状態: 自分の番（名前プレートが金色に発光） */
.seat--turn .seat-plate {
  border-color: var(--gold);
  animation: turn-pulse 1.2s ease-in-out infinite;
}

/* 状態: フォールド */
.seat--folded { opacity: 0.45; filter: grayscale(0.8); }

/* 状態: トーナメント退場（バスト） */
.seat--eliminated { opacity: 0.3; filter: grayscale(1); }
.seat--eliminated .seat-stack::after {
  content: " OUT";
  color: #ff6b6b;
  font-weight: 800;
}

/* 状態: オールイン（点滅はせず、赤バッジ + 発光で明示する） */
.seat--allin .seat-badge {
  background: #b3261e;
  box-shadow: 0 0 10px rgba(255, 90, 90, 0.85), 0 2px 6px rgba(0, 0, 0, 0.55);
}

/* アクションバッジ（GGPoker 風バブル・プレートの下に配置） */
.seat-badge {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  padding: 3px 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  background: #555;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  animation: badge-pop 0.25s ease-out;
  z-index: 4;
}
.seat-badge--fold { background: #616161; }
.seat-badge--check { background: #1565c0; }
.seat-badge--call { background: #2e7d32; }
.seat-badge--bet,
.seat-badge--raise { background: #e08b2d; color: #fff; }

/* 自分のバッジはプレート右側に表示する（下側配置のため画面下にはみ出さないように） */
/* 上部席のチップ数はチップの右側に表示する（ピルとの重なり回避） */
.seat--top .seat-bet .chip-stack-label {
  top: 50%;
  bottom: auto;
  left: calc(100% + 6px);
  transform: translateY(-50%);
}

/* 自分の席のバッジも共通ルール（プレート下・中央）で CPU と統一 */

/* 自分のベット額ラベルはチップの上に表示する（下のカードと重ならないように） */
/* 自分の席も共通ルール（チップのすぐ上）で統一 */

/* ホールカード置場（カードは名前プレートの上=淵側・重ならない位置に配置する） */
.seat-cards {
  display: flex;
  gap: 4px;
  min-height: 0;
  perspective: 900px;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) scale(0.72);
  z-index: 1;
}
.seat-cards .card:nth-child(1) { rotate: -8deg; translate: -10px 0; }
.seat-cards .card:nth-child(2) { rotate: 8deg; translate: 10px 0; }

/* シート前ベットチップ（卓中心方向へオフセット） */
.seat-bet {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translate(var(--bet-x, 0), var(--bet-y, 0));
  pointer-events: none;
  z-index: 5;
}

/* ---------------- 4c. カード（2.5D） ---------------- */
.card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0.1, 0.2, 1);
  border-radius: 7px;
  /* 注意: filter を .card に付けると preserve-3d が強制フラット化され、
     3D フリップ（card--open）が視覚的に壊れる。影は .card-face の box-shadow で表現する。 */
}
.card--open { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.55);
}

/* 表面（白地 + 内枠） */
.card-front {
  background: linear-gradient(160deg, #ffffff 0%, #f4f1ea 100%);
  border: 1px solid #b9b9b9;
  transform: rotateY(180deg);
}
.card-front::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 4px;
  pointer-events: none;
}

/* コーナーインデックス（左上・右下は 180° 回転） */
.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-weight: 800;
}
.card-corner--tl { top: 5px; left: 7px; }
.card-corner--br { bottom: 5px; right: 7px; transform: rotate(180deg); }
.corner-rank { font-size: 21px; }
.corner-suit { font-size: 16px; }

/* 中央はスートマークを1つだけ大きく表示する（GGPoker 風） */
.card-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.center-suit { font-size: 48px; line-height: 1; }

/* スート色はカード要素（.card）のクラスで適用する（2色デッキ: ♥♦赤 / ♠♣黒で統一） */
.card.suit-black .card-front { color: var(--suit-spade); }
.card.suit-red .card-front { color: var(--suit-heart); }

/* 裏面（GGPoker 風: 白縁 + 青地の格子パターン + 中央エンブレム） */
.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.09) 0 4px, transparent 4px 8px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 0 4px, transparent 4px 8px),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.10) 0 34%, transparent 35%),
    linear-gradient(160deg, #24466b 0%, #16283c 100%);
  border: 2px solid #ece7d8;
  box-shadow:
    inset 0 0 0 3px #16283c,
    inset 0 0 0 4px rgba(255, 255, 255, 0.28),
    inset 0 0 14px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-back-emblem {
  font-size: 28px;
  color: rgba(232, 226, 208, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* 配りアニメーション（transform を使わず個別プロパティで変形し、
   .card--open の rotateY(180deg) を上書きしない） */
@keyframes card-deal {
  0% { translate: -40px -120px; rotate: -14deg; scale: 0.85; opacity: 0; }
  100% { translate: 0 0; rotate: 0deg; scale: 1; opacity: 1; }
}
.card--dealing { animation: card-deal 0.32s ease-out both; animation-delay: var(--deal-delay, 0ms); }

/* ---------------- 4d. チップ（立体積層） ---------------- */
.chip-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: -29px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  background-image:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.18) 0 46%, transparent 47%),
    conic-gradient(rgba(255, 255, 255, 0.55) 0 12%, transparent 12% 25%,
      rgba(255, 255, 255, 0.55) 25% 37%, transparent 37% 50%,
      rgba(255, 255, 255, 0.55) 50% 62%, transparent 62% 75%,
      rgba(255, 255, 255, 0.55) 75% 87%, transparent 87% 100%),
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 55%);
  background-color: var(--chip-color, #888);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.45),
    0 3px 5px rgba(0, 0, 0, 0.5),
    inset 0 0 0 3px rgba(0, 0, 0, 0.18);
}
.chip:first-child { margin-top: 0; }
.chip--t0 { --chip-color: var(--chip-t0); color: #333; text-shadow: none; }
.chip--t1 { --chip-color: var(--chip-t1); }
.chip--t2 { --chip-color: var(--chip-t2); }
.chip--t3 { --chip-color: var(--chip-t3); }
.chip--t4 { --chip-color: var(--chip-t4); }

.chip-more {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-dim);
}
/* チップの金額ラベルはチップの下に表示する（GGPoker 風・大きめ） */
.chip-stack-label {
  position: absolute;
  top: auto;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  padding: 2px 12px;
  border-radius: 999px;
  white-space: nowrap;
  white-space: nowrap;
}

/* 結果バナー（勝者・金額・ハンドランク） */
.result-display {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(212, 175, 55, 0.7);
  color: var(--gold);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65), 0 0 18px rgba(212, 175, 55, 0.35);
  z-index: 5;
}
.result-display:empty { display: none; }

/* 勝者シートのハイライト（他シートを暗くして勝者を目立たせる） */
.table--result .seat:not(.seat--winner) { opacity: 0.5; filter: grayscale(0.45); }
.seat--winner .seat-plate {
  border-color: var(--gold);
  animation: winner-glow 1.4s ease-in-out infinite;
}
.seat--winner .seat-plate::after {
  content: "WINNER";
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold), #b08d1e);
  color: #10151c;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
@keyframes winner-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.6); }
  50% { box-shadow: 0 0 26px rgba(212, 175, 55, 1); }
}

/* 配当アニメーション（ポット中央 → 勝者シートへ山なりに飛ぶ） */
.distribution-display { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.pot-stack {
  position: absolute;
  top: 26.5%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}
@keyframes chip-distribute {
  0% { left: 50%; top: 21%; opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1.35); }
  55% {
    transform: translate(calc(-50% + var(--drift, 0px)), calc(-50% - var(--lift, 24px))) scale(1.35);
  }
  80% {
    left: var(--target-x);
    top: var(--target-y);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  90% {
    left: var(--target-x);
    top: var(--target-y);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.45);
  }
  100% {
    left: var(--target-x);
    top: var(--target-y);
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.3);
  }
}
.chip-move {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* 配当着地: 勝者プレートのパルス + 獲得額フロート */
.seat--payout .seat-plate { animation: payout-pop 0.5s ease-out; }
@keyframes payout-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); box-shadow: 0 0 24px rgba(212, 175, 55, 0.95); }
  100% { transform: scale(1); }
}
.seat-payout-float {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 20px);
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.65), 0 2px 8px rgba(0, 0, 0, 0.9);
  animation: payout-float 1.2s ease-out both;
  pointer-events: none;
  z-index: 6;
}
@keyframes payout-float {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -24px); }
}

/* ---------------- 5. アクションバー / モーダル / 共通部品 ---------------- */
/* 1つのパネルに全アクションを統合する（ベットコントロールはパネル内に展開） */
.action-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--action-bar-h);
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--bg-panel), #10151c);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.action-status {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  pointer-events: none;
}

/* 共通ピルボタン */
.pill-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-panel-hi);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.2s, filter 0.2s;
}
.pill-btn:hover:not(:disabled) { filter: brightness(1.15); box-shadow: 0 0 10px rgba(255, 255, 255, 0.15); }
.pill-btn:active:not(:disabled) { transform: translateY(1px); }
.pill-btn:disabled { opacity: 0.4; cursor: default; }
.pill-btn--icon { padding: 8px 12px; }

.pill-btn--start { background: linear-gradient(180deg, var(--gold), #b08d1e); color: #10151c; }
.pill-btn--end { background: var(--btn-fold); }
.pill-btn--fold { background: var(--btn-fold); }
.pill-btn--call { background: var(--btn-call); }

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }

.modal {
  min-width: 300px;
  padding: 20px 24px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-panel-hi), var(--bg-panel));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
}
.modal--confirm { text-align: center; }
.modal-title {
  margin: 0 0 14px;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.modal-text { margin: 6px 0 14px; font-size: 14px; }

/* モーダル内の成績表示（バイイン・収支・順位など） */
.modal-stats {
  margin: 4px 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}
.modal-stats:empty { display: none; }
.modal-stats-line {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: nowrap;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.settings-reset { margin-right: auto; }

.settings-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.settings-label { font-size: 13px; color: var(--text-dim); min-width: 96px; }
.settings-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--bg-dark);
  color: var(--text);
  font-size: 13px;
}

/* 設定モーダル（3タブ） */
.modal--settings { min-width: 440px; max-width: min(560px, 94vw); max-height: 84vh; overflow-y: auto; }
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.settings-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.settings-tab:hover { color: var(--text); }
.settings-tab--active { color: var(--gold); border-bottom-color: var(--gold); }

.settings-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.settings-radio { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text); cursor: pointer; }
.settings-toggle { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.settings-note { font-size: 11px; color: var(--text-dim); }
.settings-subtitle {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin: 12px 0 6px;
}

.volume-slider { flex: 1; max-width: 220px; accent-color: var(--gold); }
.volume-value { min-width: 42px; font-size: 12px; color: var(--text-dim); text-align: right; }

.preset-list { display: flex; flex-direction: column; gap: 6px; }
.preset-row { display: flex; align-items: center; gap: 8px; }
.preset-input {
  width: 90px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--bg-dark);
  color: var(--text);
  font-size: 13px;
}
.preset-enabled { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text); cursor: pointer; }
.preset-delete { padding: 3px 10px; font-size: 12px; }
.preset-add { margin-top: 6px; font-size: 12px; padding: 5px 12px; }

/* ---------------- 5b. アクションボタン（GGPoker 風 2段ピル） ---------------- */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 132px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.08s, filter 0.15s, box-shadow 0.15s;
}
.action-btn:hover { filter: brightness(1.18); box-shadow: 0 0 14px rgba(255, 255, 255, 0.2); }
.action-btn:active { transform: translateY(1px); }

.action-btn-type { font-size: 15px; letter-spacing: 0.04em; }
.action-btn-amount { font-size: 11px; font-weight: 700; opacity: 0.92; }

.action-btn--fold { background: linear-gradient(180deg, var(--btn-fold-hi), var(--btn-fold)); }
.action-btn--check { background: linear-gradient(180deg, var(--btn-call-hi), var(--btn-call)); }
.action-btn--call { background: linear-gradient(180deg, var(--btn-call-hi), var(--btn-call)); }
.action-btn--bet,
.action-btn--raise { background: linear-gradient(180deg, var(--btn-raise-hi), var(--btn-raise)); }
.action-btn--allin { background: linear-gradient(180deg, #c0392b, #7f1d1d); }

/* ベットコントロール（Raise 押下でアクションパネル内に展開） */
.bet-overlay {
  position: relative;
  width: min(760px, 94vw);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bet-overlay[hidden] { display: none; }

.bet-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.bet-amount {
  min-width: 130px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
}
.raise-slider {
  flex: 1;
  min-width: 200px;
  max-width: 380px;
  accent-color: var(--gold);
}
.bet-quick { display: flex; gap: 6px; flex-wrap: wrap; }

.bet-quick-btn {
  padding: 10px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--bg-panel-hi);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.bet-quick-btn:hover { filter: brightness(1.2); }
.bet-quick-btn--allin { background: var(--btn-fold); color: #fff; }
#bet-cancel { position: absolute; top: 6px; right: 10px; }
#bet-minus, #raise-slider, #bet-plus { position: relative; right: 20px; }

.pill-btn--raise { background: linear-gradient(180deg, var(--btn-raise-hi), var(--btn-raise)); }
.pill-btn--allin { background: linear-gradient(180deg, #c0392b, #7f1d1d); }

/* ---------------- 5c. アクションログ（ストリート別タイムライン） ---------------- */
.action-log {
  position: fixed;
  top: calc(var(--top-bar-h) + 10px);
  right: 10px;
  width: 246px;
  max-height: calc(100vh - var(--top-bar-h) - var(--action-bar-h) - 20px);
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 20;
  font-size: 11px;
}
.action-log:empty { display: none; }

.log-street { margin-bottom: 6px; }
.log-street-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin: 4px 2px 3px;
  text-transform: uppercase;
}
.log-row {
  display: grid;
  grid-template-columns: 20px 38px 1fr auto;
  gap: 4px;
  align-items: center;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--text-dim);
}
.log-row--new { animation: log-slide-in 0.35s ease-out; background: rgba(212, 175, 55, 0.12); }
.log-seq { color: #5a6472; font-weight: 700; }
.log-pos { font-weight: 800; color: #8fa4c0; }
.log-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-action { font-weight: 700; white-space: nowrap; }
.log-action--fold { color: #9aa0a6; }
.log-action--check { color: #64b5f6; }
.log-action--call { color: #81c784; }
.log-action--bet,
.log-action--raise { color: #ffb74d; }

@keyframes log-slide-in {
  from { transform: translateX(14px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------------- 6. アニメーション ---------------- */
@keyframes turn-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(212, 175, 55, 0.5); }
  50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.95); }
}

@keyframes badge-pop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* E2E テストの高速モード（window.__E2E_SPEED__ > 1 のとき html[data-speed] が付く）。
   ポーリング間隔は main.js 側で短縮済み。演出・トランジションを短縮しテスト待ちを減らす。 */
html[data-speed] *,
html[data-speed] *::before,
html[data-speed] *::after {
  animation-duration: 0.12s !important;
  animation-delay: 0s !important;
  transition-duration: 0.04s !important;
  transition-delay: 0s !important;
}

/* --- AI チャット（Phase 3: AI 対戦モード） --- */
.ai-chat {
  position: fixed;
  left: 12px;
  bottom: 92px;
  width: min(340px, calc(100vw - 24px));
  max-height: 42vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(10, 16, 26, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 8px;
  z-index: 40;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.ai-chat[hidden] { display: none; }
.ai-chat__head { display: flex; gap: 6px; align-items: center; }
.ai-chat__title { font-weight: 700; font-size: 12px; letter-spacing: 0.04em; flex: 1; }
.ai-chat__seat { max-width: 160px; font-size: 12px; }
.ai-chat__log {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  min-height: 56px;
}
.ai-chat__msg { display: flex; gap: 6px; line-height: 1.45; }
.ai-chat__who { flex: 0 0 auto; font-weight: 700; opacity: 0.75; font-size: 11px; min-width: 40px; }
.ai-chat__msg--ai .ai-chat__who { color: #7fd0ff; }
.ai-chat__msg--facts .ai-chat__text { font-family: monospace; font-size: 11px; opacity: 0.9; }
.ai-chat__msg--system { opacity: 0.6; }
.ai-chat__form { display: flex; gap: 6px; }
.ai-chat__form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 6px 8px;
  color: inherit;
  font-size: 12px;
}
.ai-chat__usage {
  font-size: 11px;
  opacity: 0.9;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}
.ai-chat__usage--warn { color: #ffd166; }
.ai-chat__usage--danger { color: #ff6b6b; font-weight: 700; }
