/* ============================================================
   game.css — 原创游戏页壳层 + 模板样式
   首款：硬币对决 (coinflip)
   ============================================================ */

/* ---------- 壳层布局 ---------- */
body.game-mode { background: var(--bg-primary); }

.game-mode .content.page-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 24px;
}

.game-layout {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.game-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- 游戏顶栏 ---------- */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: 12px;
}

.game-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.game-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-secondary);
  background: var(--bg-input);
  font-size: 13px;
  text-decoration: none;
}
.game-back-link:hover { background: var(--bg-hover); color: var(--text-primary); }

.game-title-block { display: flex; flex-direction: column; min-width: 0; }
.game-title { font-size: 16px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.game-title-en { font-size: 11px; color: var(--text-muted); }

.game-header-actions { display: flex; align-items: center; gap: 6px; }
.game-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}
.game-tool-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.game-tool-btn.is-active { color: var(--accent-green); }
.game-tool-btn .game-tool-label { white-space: nowrap; }

/* ---------- 舞台 ---------- */
.game-stage {
  position: relative;
  flex: 1;
  min-height: 420px;
  background:
    radial-gradient(circle at 50% 30%, rgba(36,238,137,0.06), transparent 60%),
    var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- 投注面板 ---------- */
.bet-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: flex-start;
}

.bet-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.bet-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bet-tab.active { background: var(--bg-card); color: var(--text-primary); }

.bet-panel-body { display: flex; flex-direction: column; gap: 12px; }
.bet-panel-body[hidden] { display: none; }

.bet-field { display: flex; flex-direction: column; gap: 5px; }
.bet-label { font-size: 12px; color: var(--text-muted); }

.bet-select,
.bet-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
}
.bet-input:focus,
.bet-select:focus { outline: none; border-color: var(--accent-green); }

.bet-quick-row { display: flex; gap: 6px; }
.bet-quick {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bet-quick:hover { background: var(--bg-hover); color: var(--text-primary); }

.bet-choice-row { display: flex; gap: 8px; }
.bet-choice {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.bet-choice[data-choice="heads"] .bet-choice-dot,
.bet-choice[data-choice="tails"] .bet-choice-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.bet-choice[data-choice="heads"] .bet-choice-dot { background: #22d3ee; }
.bet-choice[data-choice="tails"] .bet-choice-dot { background: #fbbf24; }
.bet-choice.active { border-color: var(--accent-green); background: rgba(36,238,137,0.12); }

.bet-payout-preview { font-size: 13px; color: var(--text-secondary); margin: 0; }
.bet-payout-preview strong { color: var(--text-primary); }

/* 目标倍数步进器（limbo 等 multiplier-target） */
.bet-target-row { display: flex; gap: 6px; align-items: stretch; }
.bet-target-row .bet-input { text-align: center; }
.bet-step {
  flex-shrink: 0;
  width: 40px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.bet-step:hover { background: var(--bg-hover); }
.bet-winchance { font-size: 13px; color: var(--text-secondary); margin: 6px 0 0; }
.bet-winchance strong { color: var(--accent-green); }

.bet-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent-green);
  color: #04130b;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
}
.bet-submit:hover { filter: brightness(1.05); }
.bet-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.bet-submit--secondary { background: var(--bg-input); color: var(--text-primary); }

.bet-balance {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.bet-balance strong { color: var(--accent-green); display: inline-block; }
.bet-balance.flash-win strong { animation: balance-flash-win 0.7s ease; }
.bet-balance.flash-lose strong { animation: balance-flash-lose 0.7s ease; }
@keyframes balance-flash-win {
  0% { transform: scale(1); }
  30% { transform: scale(1.22); color: var(--accent-green); }
  100% { transform: scale(1); }
}
@keyframes balance-flash-lose {
  0% { transform: scale(1); }
  30% { transform: scale(1.12); color: #ef5350; }
  100% { transform: scale(1); }
}

.bet-auto-hint {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
}

.bet-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  opacity: 0.8;
}

/* ============================================================
   模板：coinflip 硬币对决
   ============================================================ */
.coinflip-history {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  min-height: 28px;
}
.coinflip-history::-webkit-scrollbar { height: 4px; }
.coinflip-history::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.coinflip-chip {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #04130b;
}
.coinflip-chip.heads { background: #22d3ee; }
.coinflip-chip.tails { background: #fbbf24; }
.coinflip-chip.latest {
  outline: 2px solid var(--accent-green);
  outline-offset: 1px;
  box-shadow: 0 0 8px rgba(36,238,137,0.5);
}

.coinflip-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.coinflip-coin-wrap { perspective: 900px; }
.coinflip-coin {
  width: 130px;
  height: 130px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.15s cubic-bezier(0.15, 0.85, 0.25, 1);
  will-change: transform;
}
.coinflip-coin.win-glow .coinflip-face { animation: coinflip-glow 0.9s ease; }

.coinflip-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 1px;
  border: 5px solid rgba(255,255,255,0.18);
  box-shadow: inset 0 0 18px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.35);
}
.coinflip-face--heads {
  background: radial-gradient(circle at 35% 30%, #67e8f9, #0891b2 70%);
  color: #04222b;
}
.coinflip-face--tails {
  background: radial-gradient(circle at 35% 30%, #fde68a, #d97706 70%);
  color: #3d2a05;
  transform: rotateY(180deg);
}
.coinflip-face-label { user-select: none; }

@keyframes coinflip-glow {
  0%, 100% { box-shadow: inset 0 0 18px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.35); }
  50% { box-shadow: inset 0 0 18px rgba(0,0,0,0.35), 0 0 0 4px rgba(36,238,137,0.6), 0 8px 30px rgba(36,238,137,0.5); }
}

.coinflip-mult {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}
.coinflip-status {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  min-height: 20px;
}

.coinflip-result-banner {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  min-height: 24px;
  transition: opacity 0.2s;
}
.coinflip-result-banner.win { color: var(--accent-green); }
.coinflip-result-banner.lose { color: #ef5350; }

.coinflip-pick-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
.coinflip-pick-btn {
  min-width: 96px;
  padding: 10px 18px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.coinflip-pick-btn.active { border-color: var(--accent-green); background: rgba(36,238,137,0.12); }

/* ============================================================
   模板：limbo 极限倍数 (multiplier-target)
   ============================================================ */
.limbo-history {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  min-height: 28px;
}
.limbo-history::-webkit-scrollbar { height: 4px; }
.limbo-history::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.limbo-chip {
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--bg-input);
}
.limbo-chip.low { color: var(--text-secondary); }
.limbo-chip.mid { color: var(--accent-green); background: rgba(36,238,137,0.12); }
.limbo-chip.high { color: #fbbf24; background: rgba(251,191,36,0.14); }
.limbo-chip.latest {
  outline: 2px solid var(--accent-green);
  outline-offset: 1px;
  box-shadow: 0 0 8px rgba(36,238,137,0.45);
}

.limbo-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.limbo-number {
  margin: 0;
  font-size: clamp(56px, 12vw, 104px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text-primary);
  transition: color 0.2s, text-shadow 0.2s;
  font-variant-numeric: tabular-nums;
}
.limbo-number .limbo-x { font-size: 0.46em; font-weight: 700; opacity: 0.7; margin-left: 2px; }
.limbo-number[data-state="rolling"] { color: var(--text-primary); }
.limbo-number[data-state="win"] {
  color: var(--accent-green);
  text-shadow: 0 0 26px rgba(36,238,137,0.55);
  animation: limbo-pop 0.4s ease;
}
.limbo-number[data-state="lose"] { color: #ef5350; }
@keyframes limbo-pop {
  0% { transform: scale(0.92); }
  55% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.limbo-status {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  min-height: 20px;
}
.limbo-result-banner {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  min-height: 22px;
  text-align: center;
  transition: opacity 0.2s;
}
.limbo-result-banner.win { color: var(--accent-green); }
.limbo-result-banner.lose { color: #ef5350; }

/* limbo 投注表倍率标签 */
.mult-tag { font-weight: 700; }
.mult-tag.win { color: var(--accent-green); }
.mult-tag.lose { color: var(--text-secondary); }

/* ---------- 底栏投注表 ---------- */
.live-bets {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 14px;
}
.live-bets-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.live-bets-tab {
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.live-bets-tab.active { background: var(--accent-green); color: #04130b; }

.bet-result-tag { font-weight: 700; }
.bet-result-tag.heads { color: #22d3ee; }
.bet-result-tag.tails { color: #fbbf24; }
.bet-profit.win { color: var(--accent-green); }
.bet-profit.lose { color: #ef5350; }
.bet-row-self td { background: rgba(36,238,137,0.06); }

/* ---------- 游戏弹窗 ---------- */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.game-modal.open { display: flex; }
.game-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.game-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 20px;
}
.game-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.game-modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.game-modal-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; color: var(--text-primary); }
.game-modal-body { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.game-modal-body h3 { font-size: 14px; color: var(--text-primary); margin: 12px 0 6px; }
.game-modal-body ol { padding-left: 20px; margin: 0; }
.game-modal-body li { margin-bottom: 6px; }

.fairness-grid { display: flex; flex-direction: column; gap: 10px; }
.fairness-row { display: flex; flex-direction: column; gap: 4px; }
.fairness-key { font-size: 12px; color: var(--text-muted); }
.fairness-val {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-input);
  border-radius: 6px;
  padding: 8px 10px;
  word-break: break-all;
}

/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
  .game-layout { flex-direction: column; }
  .bet-panel {
    width: 100%;
    position: sticky;
    bottom: 0;
    z-index: 20;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.35);
  }
  .game-stage { min-height: 320px; }
  .coinflip-coin { width: 110px; height: 110px; }
}

@media (max-width: 600px) {
  .game-header { flex-wrap: wrap; }
  .game-tool-btn .game-tool-label { display: none; }
  .game-mode .content.page-main { padding: 10px 10px 20px; }
}
