/* ============================================================
   Aviator Crash Game Platform — Modern Dark Cyberpunk Aesthetic
   ============================================================ */

:root {
  --bg-primary: #0a0c14;
  --bg-secondary: #121524;
  --bg-tertiary: #1b2035;
  --bg-card: #15192a;
  --bg-card-hover: #1c223a;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 71, 87, 0.5);

  --accent-red: #ff3838;
  --accent-red-glow: rgba(255, 56, 56, 0.4);
  --accent-orange: #ff9f1a;
  --accent-orange-glow: rgba(255, 159, 26, 0.4);
  --accent-green: #2ed573;
  --accent-green-glow: rgba(46, 213, 115, 0.4);
  --accent-purple: #9b59b6;
  --accent-blue: #1e90ff;

  --text-main: #f1f2f6;
  --text-muted: #8395a7;
  --text-dim: #576574;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
}

/* ==================== 頂部導航列 ==================== */
.app-header {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 10001;
  width: 100%;
  max-width: 100vw;
  overflow: visible !important;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  overflow: visible !important;
  position: relative;
  z-index: 10002;
}

.game-switcher {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2px 4px;
  gap: 3px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  overscroll-behavior-x: contain;
}

.game-switcher::-webkit-scrollbar {
  display: none;
}

.switch-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}

.switch-tab:hover {
  color: #fff;
}

.switch-tab.active {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
}

.badge-hot {
  background: #f1c40f;
  color: #120904;
  font-size: 8px;
  font-weight: 900;
  padding: 1px 3px;
  border-radius: 3px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.logo-plane {
  font-size: 22px;
  animation: planeFloat 3s ease-in-out infinite;
}

@keyframes planeFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(4deg); }
}

.logo-text {
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 1px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
}

.logo-badge {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
}

.network-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.network-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffaa00;
  box-shadow: 0 0 6px #ffaa00;
  transition: all 0.3s;
}

.network-badge.online .dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.network-badge.offline .dot {
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
}

.wallet-pill {
  background: linear-gradient(145deg, #181d30, #131726);
  border: 1px solid rgba(255, 215, 0, 0.25);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  padding: 5px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wallet-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.wallet-amount {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 15px;
  color: #ffd32a;
}

.wallet-currency {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-icon {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 1px solid var(--border-color);
}

/* ==================== 歷史倍率膠囊條 ==================== */
.history-bar-container {
  background: #0d101c;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.history-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.history-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.history-pills::-webkit-scrollbar {
  display: none;
}

.pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  animation: pillSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pillSlideIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

.pill:hover {
  transform: translateY(-2px);
  filter: brightness(1.2);
}

/* 低倍率 (< 2.00x) 藍灰色調 */
.pill-low {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

/* 中倍率 (2.00x - 10.00x) 亮紫色調 */
.pill-mid {
  background: rgba(155, 89, 182, 0.18);
  color: #be2edd;
  border: 1px solid rgba(190, 46, 221, 0.35);
}

/* 高倍率 (>= 10.00x) 琥珀金色調 */
.pill-high {
  background: rgba(241, 196, 15, 0.18);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.4);
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.2);
}

/* ==================== 主要佈局 ==================== */
.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 12px;
  padding: 12px 16px;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
  }
}

.game-display-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==================== 畫布區塊 ==================== */
.canvas-wrapper {
  position: relative;
  background: radial-gradient(circle at 50% 50%, #151b2d 0%, #0c0e18 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7), 0 4px 20px rgba(0, 0, 0, 0.3);
  height: 380px;
  overflow: hidden;
}

@media (max-width: 600px) {
  .canvas-wrapper {
    height: clamp(180px, 32vh, 240px);
  }

  .main-layout {
    gap: 6px;
    margin-top: 4px;
  }

  .game-display-section {
    gap: 4px;
  }

  .history-bar-container {
    padding: 3px 6px;
    min-height: 28px;
  }

  .history-label {
    display: none; /* 手機端隱藏標籤，留給歷史倍率標籤更完整展示 */
  }

  .mobile-panel-tabs {
    margin-bottom: 2px;
  }

  .mobile-tab-btn {
    padding: 6px 0;
  }

  .bet-card {
    padding: 8px 10px 10px;
    gap: 6px;
    border-radius: 10px;
  }

  .card-header {
    margin-bottom: 2px;
  }

  .btn-main-action {
    height: 48px;
  }
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 下注倒數階段 */
.betting-stage {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.betting-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.countdown-number {
  font-family: var(--font-mono);
  font-size: 54px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
}

.countdown-bar {
  width: 220px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.countdown-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff4757, #ff6b81);
  border-radius: 4px;
  transition: width 0.1s linear;
}

/* 飛行中巨型倍率 */
.flying-stage {
  text-align: center;
  animation: pulseScale 0.8s ease-in-out infinite alternate;
}

@keyframes pulseScale {
  0% { transform: scale(1); }
  100% { transform: scale(1.02); }
}

.flying-multiplier {
  font-family: var(--font-mono);
  font-size: 72px;
  font-weight: 900;
  background: linear-gradient(180deg, #ffffff 30%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(255, 255, 255, 0.3));
}

@media (max-width: 600px) {
  .flying-multiplier {
    font-size: 52px;
  }
}

.flying-subtitle {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--accent-red);
  text-transform: uppercase;
  margin-top: -6px;
}

/* 墜毀階段 */
.crashed-stage {
  text-align: center;
  animation: crashShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes crashShake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

.crashed-badge {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--accent-red);
  text-transform: uppercase;
  text-shadow: 0 0 20px var(--accent-red-glow);
}

.crashed-multiplier {
  font-family: var(--font-mono);
  font-size: 60px;
  font-weight: 900;
  color: var(--accent-red);
  text-shadow: 0 0 30px rgba(255, 56, 56, 0.6);
}

.crashed-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.round-meta-tag {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  font-family: var(--font-mono);
  z-index: 5;
}

.hash-preview {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hash-preview:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* ==================== 手機版專屬下注 Tab 切換 ==================== */
.mobile-panel-tabs {
  display: none;
  background: rgba(16, 21, 37, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 6px;
  margin-bottom: 2px;
}

.mobile-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.mobile-tab-btn.active {
  background: linear-gradient(135deg, rgba(235, 47, 6, 0.25) 0%, rgba(255, 71, 87, 0.15) 100%);
  color: #fff;
  border: 1px solid rgba(255, 71, 87, 0.4);
  box-shadow: 0 2px 10px rgba(235, 47, 6, 0.2);
}

.panel-badge-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: all 0.2s;
}

.panel-badge-status.active-betting {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* ==================== 雙下注面板 ==================== */
.betting-panels-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .app-header {
    height: 48px;
    padding: 0 8px;
    gap: 6px;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .game-switcher {
    flex: 1 1 auto;
    max-width: calc(100vw - 165px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .header-right {
    gap: 4px;
    flex-shrink: 0;
  }

  .user-avatar {
    display: none !important;
  }

  .network-badge {
    padding: 2px 5px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .network-badge .text {
    display: none;
  }

  .wallet-pill {
    padding: 3px 8px;
    gap: 3px;
  }

  .wallet-label {
    display: none;
  }

  .wallet-amount {
    font-size: 13px;
  }

  .btn-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .history-bar-container {
    padding: 6px 8px;
    gap: 8px;
    max-width: 100vw;
    box-sizing: border-box;
    overflow: hidden;
  }

  .history-label {
    display: none;
  }

  .history-pills {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .main-layout {
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 8px;
    gap: 8px;
  }

  .mobile-panel-tabs {
    display: flex;
  }

  .betting-panels-container {
    display: block;
  }

  .bet-card {
    display: none !important;
  }

  .bet-card.active {
    display: flex !important;
  }

  .canvas-wrapper {
    height: 230px !important;
  }

  .sidebar-section {
    margin-top: 10px;
  }
}

.bet-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

.bet-card.active-bet {
  border-color: rgba(46, 213, 115, 0.4);
  box-shadow: 0 0 20px rgba(46, 213, 115, 0.1);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
}

.auto-cashout-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.switch-label input {
  display: none;
}

.switch-slider {
  width: 28px;
  height: 16px;
  background: #333a52;
  border-radius: 10px;
  position: relative;
  transition: 0.2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch-label input:checked + .switch-slider {
  background: var(--accent-orange);
}

.switch-label input:checked + .switch-slider::before {
  transform: translateX(12px);
}

.auto-input-wrapper {
  position: relative;
  width: 70px;
}

.auto-input-wrapper input {
  width: 100%;
  background: #0f121d;
  border: 1px solid var(--border-color);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  padding: 3px 18px 3px 6px;
  border-radius: 4px;
  outline: none;
}

.auto-input-wrapper input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.auto-input-wrapper .unit {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.card-body {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
  align-items: center;
}

.amount-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-row {
  display: flex;
  align-items: center;
  background: #0f121d;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.step-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 34px;
  height: 38px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.step-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.bet-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 16px;
  text-align: center;
  outline: none;
  width: 100%;
}

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.quick-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

/* 核心按鈕狀態：BET / WAITING / CASH OUT / CANCEL */
.action-btn {
  height: 68px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.btn-label-primary {
  font-size: 18px;
}

.btn-label-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  opacity: 0.9;
}

/* 狀態 1：可下注綠色按鈕 */
.btn-bet {
  background: linear-gradient(180deg, #2ed573 0%, #10ac84 100%);
  color: #fff;
  border: 1px solid #7bed9f;
}

.btn-bet:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-green-glow);
}

.btn-bet:active {
  transform: translateY(1px);
}

/* 狀態 2：已下注等待升空/可取消紅色按鈕 */
.btn-cancel {
  background: linear-gradient(180deg, #ff4757 0%, #c0392b 100%);
  color: #fff;
  border: 1px solid #ff6b81;
}

.btn-cancel:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-red-glow);
}

/* 狀態 3：升空飛行中 巨大橘金色 CASH OUT 按鈕 */
.btn-cashout {
  background: linear-gradient(180deg, #ffa502 0%, #e67e22 100%);
  color: #fff;
  border: 1px solid #ffd32a;
  animation: cashoutPulse 0.8s ease-in-out infinite alternate;
}

@keyframes cashoutPulse {
  0% { transform: scale(1); box-shadow: 0 0 15px var(--accent-orange-glow); }
  100% { transform: scale(1.02); box-shadow: 0 0 25px rgba(255, 165, 2, 0.8); }
}

.btn-cashout .btn-label-primary {
  font-size: 19px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-cashout .btn-label-sub {
  font-size: 12px;
  color: #fff;
}

/* 狀態 4：成功獲利提現 亮綠金光芒按鈕 */
.btn-won {
  background: linear-gradient(180deg, #10ac84 0%, #05c46b 100%);
  color: #fff;
  border: 1px solid #7bed9f;
  animation: winFlash 0.5s ease-in-out infinite alternate;
  box-shadow: 0 0 25px rgba(46, 213, 115, 0.6);
}

@keyframes winFlash {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.03); filter: brightness(1.2); }
}

.bet-row.lost {
  background: rgba(255, 71, 87, 0.08);
  border-left: 2px solid var(--accent-red);
}

.bet-row.lost .bet-payout {
  color: var(--accent-red);
}

/* ==================== 右側邊欄：全服下注實況 ==================== */
.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 540px;
}

@media (max-width: 960px) {
  .sidebar-section {
    height: 320px;
  }
}

.sidebar-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
  padding: 12px 0;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tab-btn.active {
  color: #fff;
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 20%;
  width: 60%;
  height: 2px;
  background: var(--accent-red);
}

.bets-list-header {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.text-right {
  text-align: right;
}

.bets-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bet-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s;
}

.bet-row.cashed-out {
  background: rgba(46, 213, 115, 0.08);
  border-left: 2px solid var(--accent-green);
}

.bet-row.is-me {
  background: rgba(255, 159, 26, 0.1);
  border-left: 2px solid var(--accent-orange);
}

.bet-player {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bet-amount {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.bet-mult {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-purple);
}

.bet-payout {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--accent-green);
  text-align: right;
}

/* ==================== 模態框 (Provably Fair) ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.15s;
}

.btn-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-intro {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.form-group input {
  background: #0f121d;
  border: 1px solid var(--border-color);
  padding: 9px 12px;
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent-red);
}

.btn-submit {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.2s;
}

.btn-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.verify-result {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.result-row .lbl {
  color: var(--text-muted);
}

.result-mult {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 900;
  color: #ffd32a;
}

.result-hash {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #70a1ff;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== 吐司通知 ==================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(21, 25, 42, 0.95);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: opacity 0.3s;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-success {
  border-left: 3px solid var(--accent-green);
}

.toast-error {
  border-left: 3px solid var(--accent-red);
}

.toast-info {
  border-left: 3px solid var(--accent-orange);
}

/* ============================================================
   全螢幕遊戲啟動載入畫面 (Game Loading / Splash Screen)
   ============================================================ */
.game-loading-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #090b12;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

.game-loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(235, 47, 6, 0.22) 0%, rgba(255, 71, 87, 0.08) 45%, transparent 70%);
  border-radius: 50%;
  filter: blur(50px);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 1; }
}

.loading-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 480px;
  width: 90%;
  padding: 24px;
}

/* 合作夥伴聯名區 */
.partner-branding-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  backdrop-filter: blur(10px);
  animation: partnerFadeIn 0.8s ease;
}

@keyframes partnerFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.partner-logo {
  max-height: 34px;
  max-width: 140px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.partner-collab-x {
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  font-weight: 700;
}

/* 核心遊戲品牌視覺 */
.game-brand-logo {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.plane-pulse-icon {
  width: 90px;
  height: 90px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 25px rgba(235, 47, 6, 0.75));
  animation: planeFloat 3s ease-in-out infinite;
}

.svg-plane-icon {
  width: 100%;
  height: 100%;
}

@keyframes planeFloat {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(1deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

.loading-game-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 5px;
  background: linear-gradient(135deg, #ffffff 0%, #ff6b81 50%, #eb2f06 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  line-height: 1.1;
  text-shadow: 0 4px 20px rgba(235, 47, 6, 0.4);
}

.loading-game-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 6px;
}

/* 科技感進度條 */
.loading-bar-wrapper {
  width: 100%;
  max-width: 380px;
  margin-bottom: 28px;
}

.loading-bar-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #eb2f06 0%, #ff4757 50%, #ffa502 100%);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(255, 71, 87, 0.8);
  transition: width 0.18s ease-out;
  position: relative;
}

.loading-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-meta-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.loading-status-text {
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.loading-percentage {
  color: #ffa502;
  font-weight: 800;
}

/* 底部背書與安全銘牌 */
.loading-footer-endorse {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--font-mono);
  letter-spacing: 1px;
}

.security-seal {
  color: rgba(46, 213, 115, 0.85);
  font-weight: 600;
}

/* ============================================================
   音效與可調節音量滑桿懸浮窗 (Volume Slider Popover)
   ============================================================ */
.sound-control-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.volume-slider-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 170px;
  background: rgba(18, 20, 29, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 71, 87, 0.4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 71, 87, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sound-control-wrapper:hover .volume-slider-popover,
.sound-control-wrapper:focus-within .volume-slider-popover,
.sound-control-wrapper.open .volume-slider-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.vol-pop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #d1d5db;
  letter-spacing: 0.5px;
}

.vol-pop-val {
  color: #ff4757;
  font-family: 'JetBrains Mono', monospace, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.vol-pop-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vol-min-icon, .vol-max-icon {
  font-size: 12px;
  user-select: none;
  opacity: 0.85;
}

.vol-range-input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.vol-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ff4757;
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.8);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.vol-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(255, 71, 87, 1);
}

.vol-range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ff4757;
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.8);
  cursor: pointer;
}

