/* ============================================================
   官方聯賽下注盤口 (bet-board)
   ============================================================ */

#section-bet-board { padding: 16px; max-width: 1100px; margin: 0 auto; }

/* Hero CTA — 寶石競猜場入口 */
.btn-gem-cta {
  background: linear-gradient(135deg, rgba(240,192,64,0.18), rgba(240,192,64,0.30)) !important;
  border: 1px solid rgba(240,192,64,0.55) !important;
  color: var(--accent) !important;
  font-weight: 700;
}
.btn-gem-cta:hover {
  background: linear-gradient(135deg, var(--accent), #ffd866) !important;
  color: #1a1300 !important;
  box-shadow: 0 6px 20px rgba(240,192,64,0.35);
}

.bb-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bb-header h2 { margin: 0; font-size: 22px; }
.bb-header .bb-sub { color: var(--text-muted); font-size: 13px; }

.bb-tabs { display: flex; gap: 4px; border-bottom: 2px solid rgba(240,192,64,0.20); margin-bottom: 16px; }
.bb-tab {
  background: transparent; border: none; cursor: pointer;
  padding: 12px 18px; font-size: 15px; color: var(--text-secondary);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: all 0.15s; font-weight: 500;
}
.bb-tab:hover { color: var(--text-primary); }
.bb-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.bb-pane { display: none; }
.bb-pane.active { display: block; }

.bb-loading, .bb-empty {
  text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px;
}
.bb-empty small { color: var(--text-muted); opacity: 0.7; display: inline-block; margin-top: 6px; }

/* 日期分組 */
.bb-date-group { margin-bottom: 20px; }
.bb-date-title { font-size: 13px; color: var(--accent); font-weight: 700; padding: 10px 0 8px; border-bottom: 1px solid rgba(240,192,64,0.20); margin-bottom: 10px; letter-spacing: 0.5px; }

/* 比賽卡片 */
.bb-match-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px; padding: 14px; margin-bottom: 10px;
  cursor: pointer; transition: all 0.15s;
  color: var(--text-primary);
}
.bb-match-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(240,192,64,0.15);
}

.bb-match-header { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.bb-sport-tag { background: rgba(240,192,64,0.15); color: var(--accent); padding: 3px 10px; border-radius: 4px; font-weight: 700; }
.bb-kickoff { color: var(--text-secondary); font-weight: 500; }

.bb-match-teams {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 12px; margin-bottom: 14px;
}
.bb-team {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: var(--text-primary);
}
.bb-team--home { justify-content: flex-end; }
.bb-team--away { justify-content: flex-start; }
.bb-team-info { display: flex; flex-direction: column; gap: 2px; }
.bb-team--home .bb-team-info { align-items: flex-end; }
.bb-team--away .bb-team-info { align-items: flex-start; }
.bb-team-name { font-size: 16px; font-weight: 700; line-height: 1.1; }
.bb-team-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 3px; line-height: 1.4;
}
.bb-team-tag--home { background: rgba(76,175,80,0.18); color: #6bd09e; }
.bb-team-tag--away { background: rgba(33,150,243,0.18); color: #5eb8ff; }
.bb-vs { color: var(--text-secondary); font-size: 12px; font-weight: 700; opacity: 0.6; padding: 0 4px; }

/* 隊徽 / 國旗 */
.bb-team-logo {
  object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.4));
}
.bb-team-emoji {
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.4));
}
.bb-team-initial {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, rgba(240,192,64,0.35), rgba(240,192,64,0.15));
  color: var(--accent); font-weight: 800;
}

/* 1X2 快速下注按鈕 */
.bb-1x2-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.bb-1x2-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(240,192,64,0.10);
  border: 1px solid rgba(240,192,64,0.30);
  border-radius: 8px; padding: 10px 4px; cursor: pointer;
  transition: all 0.15s;
  color: var(--text-primary);
}
.bb-1x2-btn:hover {
  background: var(--accent);
  color: #1a1300;
  transform: scale(1.04);
  border-color: var(--accent);
}
.bb-1x2-btn span { font-size: 11px; color: var(--text-secondary); }
.bb-1x2-btn:hover span { color: rgba(26,19,0,0.8); }
.bb-1x2-btn b { font-size: 17px; font-weight: 800; color: var(--accent); letter-spacing: 0.5px; }
.bb-1x2-btn:hover b { color: #1a1300; }

.bb-more { text-align: center; font-size: 12px; color: var(--accent); margin-top: 10px; opacity: 0.8; font-weight: 500; }
.bb-match-card:hover .bb-more { opacity: 1; }

/* ── Modal ─────────────────────────────────────────────── */
.bb-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(7,9,26,0.85);            /* 加深、跟首頁背景同調 */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.18s;
  padding: 16px;
}
.bb-modal-overlay.open { opacity: 1; pointer-events: auto; }

.bb-modal {
  background: #11152a;                            /* 不透明深色背景 */
  border: 1px solid rgba(240,192,64,0.25);
  border-radius: 12px;
  max-width: 600px; width: 100%; max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  color: var(--text-primary);
}
.bb-modal--narrow { max-width: 420px; }
.bb-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid rgba(240,192,64,0.20);
  background: linear-gradient(180deg, rgba(240,192,64,0.06), transparent);
}
.bb-modal-title {
  font-size: 16px; font-weight: 800; color: var(--text-primary);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.bb-modal-title b { font-weight: 800; }
.bb-modal-title small {
  font-size: 9px; padding: 1px 4px; border-radius: 3px; margin-left: 3px;
  background: rgba(76,175,80,0.18); color: #6bd09e; font-weight: 700;
  vertical-align: middle;
}
.bb-modal-title span:last-of-type small { background: rgba(33,150,243,0.18); color: #5eb8ff; }
.bb-modal-vs { color: var(--text-secondary); opacity: 0.6; font-size: 13px; font-weight: 600; }
.bb-modal-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.bb-modal-sub img, .bb-modal-sub .bb-team-emoji { vertical-align: middle; margin: 0 2px; }
.bb-close {
  background: rgba(255,255,255,0.06); border: none; cursor: pointer;
  font-size: 22px; color: var(--text-secondary); padding: 4px 12px;
  line-height: 1; border-radius: 6px;
}
.bb-close:hover { background: rgba(255,255,255,0.15); color: var(--text-primary); }

.bb-modal-body { padding: 14px 16px; overflow-y: auto; }

/* 全盤口 modal */
.bb-market-block { margin-bottom: 18px; }
.bb-market-title {
  font-size: 14px; font-weight: 700; color: var(--accent);
  background: rgba(240,192,64,0.08);
  border-left: 3px solid var(--accent);
  padding: 8px 12px; border-radius: 6px;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}
.bb-sel-grid {
  display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.bb-sel-grid--1x2, .bb-sel-grid--double_chance { grid-template-columns: 1fr 1fr 1fr; }
.bb-sel-grid--totals_2_5, .bb-sel-grid--btts { grid-template-columns: 1fr 1fr; }
.bb-sel-grid--correct_score { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }

.bb-sel-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(240,192,64,0.10);
  border: 1px solid rgba(240,192,64,0.30);
  border-radius: 8px; padding: 12px 6px; cursor: pointer;
  transition: all 0.15s;
  color: var(--text-primary);
}
.bb-sel-btn:hover {
  background: var(--accent);
  color: #1a1300;
  transform: scale(1.04);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(240,192,64,0.4);
}
.bb-sel-lbl { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.bb-sel-btn:hover .bb-sel-lbl { color: rgba(26,19,0,0.85); }
.bb-sel-odd { font-size: 16px; font-weight: 800; color: var(--accent); letter-spacing: 0.5px; }
.bb-sel-btn:hover .bb-sel-odd { color: #1a1300; }

/* 下注確認 modal — 簡化標題 + 對戰雙方排版 */
.bb-modal-header--simple { background: transparent; }
.bb-modal-header--simple .bb-modal-title { font-size: 17px; font-weight: 800; }

.bb-place-matchup {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 8px;
  background: linear-gradient(135deg, rgba(76,175,80,0.10), rgba(33,150,243,0.10));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 14px 12px; margin-bottom: 12px;
}
.bb-place-side { display: flex; align-items: center; gap: 8px; }
.bb-place-side--home { justify-content: flex-end; }
.bb-place-side--away { justify-content: flex-start; }
.bb-place-side-info { display: flex; flex-direction: column; gap: 3px; }
.bb-place-side--home .bb-place-side-info { align-items: flex-end; }
.bb-place-side--away .bb-place-side-info { align-items: flex-start; }
.bb-place-side-name { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.15; }
.bb-place-vs-big {
  font-size: 12px; font-weight: 800; color: var(--text-secondary);
  background: rgba(255,255,255,0.06); padding: 4px 8px; border-radius: 6px;
  letter-spacing: 1px;
}

.bb-place-sel {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: linear-gradient(135deg, rgba(107,208,158,0.12), rgba(60,140,255,0.12));
  border-radius: 10px; padding: 14px; margin-bottom: 12px;
}
.bb-place-mt   { font-size: 12px; color: var(--text-muted); }
.bb-place-pick { font-size: 18px; font-weight: 700; }
.bb-place-odd  { font-size: 22px; font-weight: 800; color: var(--accent); }

.bb-place-bal { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 12px; }
.bb-place-bal b { color: var(--text-primary); }

.bb-stake-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.bb-stake-chip {
  flex: 1; min-width: 60px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; cursor: pointer; font-size: 13px;
  transition: all 0.15s;
}
.bb-stake-chip:hover { background: var(--accent); color: white; }

.bb-stake-input {
  width: 100%; padding: 10px 12px; font-size: 16px; text-align: center;
  border: 2px solid var(--border); border-radius: 8px;
  background: rgba(255,255,255,0.06); color: var(--text-primary);
  margin-bottom: 10px;
}
.bb-stake-input:focus { border-color: var(--accent); outline: none; }

.bb-payout-preview { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 14px; }
.bb-payout-preview b { color: var(--accent); }

.bb-confirm { width: 100%; padding: 12px; font-size: 16px; font-weight: 700; }
.bb-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 戰績 tab ──────────────────────────────────────────── */
.bb-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.bb-stat {
  flex: 1; min-width: 90px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; text-align: center;
}
.bb-stat span { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.bb-stat b { font-size: 20px; font-weight: 700; }

.bb-history-table { display: flex; flex-direction: column; gap: 6px; }
.bb-hist-row {
  display: grid; grid-template-columns: 90px 1fr 90px 60px 80px 90px;
  gap: 8px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.bb-hist-time   { color: var(--text-muted); font-size: 11px; }
.bb-hist-pick   { font-weight: 600; }
.bb-hist-stake  { color: var(--text-muted); }
.bb-hist-odd    { color: var(--accent); font-weight: 600; }
.bb-hist-status { text-align: center; }
.bb-hist-payout { text-align: right; font-weight: 600; }

.bb-st { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.bb-st--p { background: rgba(255,193,7,0.18);  color: #ffc107; }
.bb-st--w { background: rgba(107,208,158,0.18); color: #6bd09e; }
.bb-st--l { background: rgba(255,107,107,0.18); color: #ff6b6b; }
.bb-st--r { background: rgba(150,150,150,0.18); color: #aaa; }

/* ── 派彩慶祝彈窗 ───────────────────────────────────── */
.bb-celebrate-overlay { z-index: 10000; }
.bb-celebrate-modal {
  position: relative;
  background: linear-gradient(135deg, #fff7d6 0%, #ffd700 60%, #ffb800 100%);
  color: #1b1700;
  border-radius: 16px;
  padding: 28px 24px 22px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 70px rgba(0,0,0,0.55), 0 0 0 4px rgba(255,255,255,0.12) inset;
  animation: bbCelebPop 0.45s cubic-bezier(.2,1.5,.5,1);
}
@keyframes bbCelebPop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.bb-celebrate-ribbon {
  display: inline-block;
  background: #1b1700; color: #ffd700;
  padding: 4px 14px; border-radius: 20px;
  font-weight: 800; font-size: 13px; letter-spacing: 1px;
  margin-bottom: 10px;
}
.bb-celebrate-payout {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 42px; font-weight: 900;
  text-shadow: 0 2px 6px rgba(0,0,0,0.18);
  margin: 4px 0 10px;
}
.bb-celebrate-gem {
  display: inline-block; width: 28px; height: 28px;
  background: radial-gradient(#76d9ff, #1e88e5); border-radius: 4px;
  transform: rotate(45deg); box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.bb-celebrate-teams { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.bb-celebrate-pick { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.bb-celebrate-odd  { font-weight: 800; }
.bb-celebrate-sub  { font-size: 12px; opacity: 0.7; margin-bottom: 14px; }
.bb-celebrate-btn  { width: 100%; background: #1b1700 !important; color: #ffd700 !important; }
.bb-celebrate-btn:hover { background: #000 !important; }

/* 紙花 */
.bb-celebrate-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bb-celebrate-confetti i {
  position: absolute; top: -20px; width: 8px; height: 14px;
  background: #ffeb3b; opacity: 0;
  animation: bbConfetti 2.4s ease-in forwards;
}
.bb-celebrate-confetti i:nth-child(odd)  { background: #ff5252; width: 10px; }
.bb-celebrate-confetti i:nth-child(3n)   { background: #4caf50; width: 6px;  height: 10px; }
.bb-celebrate-confetti i:nth-child(5n)   { background: #2196f3; height: 16px; }
.bb-celebrate-confetti i:nth-child(7n)   { background: #ff9800; height: 12px; }
.bb-celebrate-confetti i:nth-child(1)  { left: 5%;  animation-delay: 0s;   }
.bb-celebrate-confetti i:nth-child(2)  { left: 10%; animation-delay: 0.1s; }
.bb-celebrate-confetti i:nth-child(3)  { left: 15%; animation-delay: 0.2s; }
.bb-celebrate-confetti i:nth-child(4)  { left: 22%; animation-delay: 0.05s;}
.bb-celebrate-confetti i:nth-child(5)  { left: 28%; animation-delay: 0.15s;}
.bb-celebrate-confetti i:nth-child(6)  { left: 34%; animation-delay: 0.25s;}
.bb-celebrate-confetti i:nth-child(7)  { left: 40%; animation-delay: 0.0s; }
.bb-celebrate-confetti i:nth-child(8)  { left: 46%; animation-delay: 0.3s; }
.bb-celebrate-confetti i:nth-child(9)  { left: 52%; animation-delay: 0.1s; }
.bb-celebrate-confetti i:nth-child(10) { left: 58%; animation-delay: 0.2s; }
.bb-celebrate-confetti i:nth-child(11) { left: 64%; animation-delay: 0.05s;}
.bb-celebrate-confetti i:nth-child(12) { left: 70%; animation-delay: 0.15s;}
.bb-celebrate-confetti i:nth-child(13) { left: 76%; animation-delay: 0.25s;}
.bb-celebrate-confetti i:nth-child(14) { left: 82%; animation-delay: 0.0s; }
.bb-celebrate-confetti i:nth-child(15) { left: 88%; animation-delay: 0.3s; }
.bb-celebrate-confetti i:nth-child(16) { left: 94%; animation-delay: 0.1s; }
.bb-celebrate-confetti i:nth-child(n+17) { left: 50%; animation-delay: 0.5s; }
@keyframes bbConfetti {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x, 0), 110vh) rotate(720deg); opacity: 0; }
}

/* 行動裝置 */
@media (max-width: 640px) {
  .bb-match-teams { font-size: 14px; }
  .bb-hist-row {
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px; row-gap: 4px;
  }
  .bb-hist-row > * { font-size: 12px; }
  .bb-hist-time   { grid-column: 1 / -1; }
  .bb-hist-pick   { grid-column: 1 / -1; }
  .bb-hist-status { text-align: left; }
  .bb-hist-payout { text-align: right; }
}
