/**
 * Wheel of Fortune — 幸運倍率大輪盤樣式
 */

:root {
  --bg-dark: #0a0604;
  --bg-card: rgba(22, 13, 8, 0.88);
  --gold-primary: #d4af37;
  --gold-glow: #f39c12;
  --gold-light: #ffd32a;
  --red-accent: #e74c3c;
  --green-win: #2ecc71;
  --border-gold: rgba(212, 175, 55, 0.35);
  --font-serif: 'Cinzel', serif;
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: #0b0705;
  background-image: 
    linear-gradient(180deg, rgba(8, 5, 3, 0.85) 0%, rgba(14, 9, 6, 0.88) 50%, rgba(6, 4, 2, 0.95) 100%),
    radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.08) 0%, transparent 70%),
    url('/assets/casino_bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  font-family: var(--font-sans);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==================== 頂部全域導航 ==================== */
.app-header {
  height: 58px;
  background: rgba(10, 5, 2, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.game-switcher { display: flex; gap: 6px; overflow-x: auto; }
.switch-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #bdc3c7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.switch-tab:hover { background: rgba(212, 175, 55, 0.15); color: #fff; border-color: var(--gold-primary); }
.switch-tab.active {
  background: linear-gradient(135deg, #d4af37, #f39c12);
  color: #000;
  border-color: #ffd32a;
  box-shadow: 0 0 15px rgba(243, 156, 18, 0.5);
}
.badge-hot { font-size: 8px; background: #e74c3c; color: #fff; padding: 1px 4px; border-radius: 6px; font-weight: 800; }

.header-right { display: flex; align-items: center; gap: 10px; }
.wallet-pill {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(212, 175, 55, 0.5);
  padding: 5px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wallet-label { font-size: 11px; color: #bdc3c7; }
.wallet-amount { font-family: var(--font-mono); font-weight: 800; color: #ffd32a; font-size: 15px; }
.wallet-currency { font-size: 11px; color: #e0a96d; font-weight: 700; }
.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== 舞台佈局 ==================== */
.wheel-stage {
  flex: 1;
  display: flex;
  max-width: 1160px;
  width: 100%;
  margin: 18px auto;
  padding: 0 16px;
  gap: 20px;
}

.wheel-sidebar {
  width: 320px;
  flex: 0 0 320px;
  background: rgba(18, 12, 9, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

@media (max-width: 860px) {
  .wheel-stage {
    flex-direction: column;
    margin: 4px auto 0;
    padding: 4px 8px 8px;
    gap: 6px;
    height: calc(100dvh - 56px);
    max-height: calc(100dvh - 56px);
    overflow: hidden;
    box-sizing: border-box;
  }

  .wheel-board-area {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    gap: 4px;
    overflow: hidden;
    border-radius: 12px;
  }

  .board-top-bar {
    width: 100%;
    margin-bottom: 2px;
  }

  .title-block {
    display: none; /* 手機端隱藏標題，釋放空間 */
  }

  .history-strip {
    width: 100%;
    justify-content: flex-start;
    gap: 4px;
  }

  .history-pill {
    font-size: 10px;
    padding: 2px 6px;
  }

  .wheel-container {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  canvas#wheelCanvas {
    width: min(72vw, 42vh) !important;
    height: min(72vw, 42vh) !important;
    max-width: 280px;
    max-height: 280px;
  }

  .wheel-flapper {
    top: calc(50% - min(36vw, 21vh) - 10px);
    font-size: 26px;
  }

  .wheel-sidebar {
    flex: 0 0 auto;
    width: 100%;
    background: rgba(18, 12, 9, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 12px;
    padding: 8px 10px 10px;
    gap: 6px;
    box-sizing: border-box;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
  }

  .panel-section {
    gap: 3px;
  }

  .section-label {
    font-size: 11px;
  }

  .bet-input-row {
    gap: 4px;
  }

  .btn-step {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .bet-input {
    height: 32px;
    font-size: 13px;
  }

  .chip-row {
    display: none; /* 手機端隱藏籌碼列 */
  }

  .sectors-summary {
    display: none; /* 手機端隱藏冗長列表，空間全數給輪盤與 SPIN 按鈕 */
  }

  .action-btn-wrapper {
    margin-top: 2px;
  }

  .btn-spin {
    height: 44px;
    font-size: 15px;
    border-radius: 8px;
  }

  .fairness-badge {
    display: none;
  }
}

.panel-section { display: flex; flex-direction: column; gap: 8px; }
.section-label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #e0a96d; font-weight: 700; }
.hint-text { font-size: 11px; color: #888; }

.bet-input-row { display: flex; gap: 6px; }
.btn-step {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}

.bet-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 8px;
  color: #ffd32a;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  outline: none;
}

.chip-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.btn-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ccc;
  border-radius: 6px;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-chip:hover {
  background: rgba(212, 175, 55, 0.2);
  color: #fff;
  border-color: var(--gold-primary);
}

.sectors-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 10px;
}

.sector-tag {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 11px;
  color: #bdc3c7;
  font-weight: 700;
}

.sec-odds {
  font-family: var(--font-mono);
  color: #ffd32a;
}

.action-btn-wrapper { margin-top: auto; }

.btn-spin {
  width: 100%;
  height: 52px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff;
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.5);
  transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.btn-spin:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 8px 25px rgba(243, 156, 18, 0.7);
}

.btn-spin:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.fairness-badge { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 10px; color: #888; }

/* ==================== 右側大輪盤舞台 ==================== */
.wheel-board-area {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.board-top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.wheel-h1 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #ffffff, #ffd32a 50%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.wheel-sub { font-size: 9px; letter-spacing: 2px; color: #e0a96d; font-weight: 800; }

.history-strip { display: flex; gap: 6px; overflow-x: hidden; }
.history-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 12px;
}

/* 輪盤主體容器 */
.wheel-container {
  flex: 1;
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #1a0b04 0%, #060201 100%);
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

/* 頂部卡榫指針 */
.flapper-assembly {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flapper-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd32a, #d4af37);
  box-shadow: 0 0 10px rgba(255, 211, 42, 0.8);
}

.flapper-arrow {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 26px solid #e74c3c;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.8));
  transition: transform 0.05s ease;
  transform-origin: 50% 0%;
}

.flapper-arrow.tick {
  transform: rotate(-15deg);
}

/* 輪盤圓盤包裝器 */
.wheel-disc-wrapper {
  position: relative;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  border: 8px solid #d4af37;
  box-shadow: 0 0 35px rgba(212, 175, 55, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas#wheelCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* 中心黃金軸心 */
.wheel-center-hub {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, #ffd32a 40%, #b8860b 80%, #593e03 100%);
  border: 4px solid #fff;
  box-shadow: 0 0 20px rgba(255, 211, 42, 0.9), 0 4px 10px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.hub-crest {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 900;
  color: #1a0800;
  letter-spacing: 0.5px;
}

/* 獲獎大額彈窗 */
.wheel-win-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  pointer-events: none;
  background: rgba(10, 4, 1, 0.96);
  border: 2px solid #ffd32a;
  border-radius: 16px;
  padding: 24px 36px;
  box-shadow: 0 0 40px rgba(243, 156, 18, 0.8);
  text-align: center;
  transition: all 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  z-index: 50;
}

.wheel-win-overlay.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.win-title { font-size: 15px; color: #ffd32a; font-weight: 800; margin-bottom: 6px; }
.win-mult { font-family: var(--font-mono); font-size: 42px; font-weight: 900; color: #fff; text-shadow: 0 0 15px rgba(255, 211, 42, 0.9); }
.win-amount { font-family: var(--font-mono); font-size: 20px; color: var(--green-win); font-weight: 800; margin-top: 4px; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 700; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); }
.toast-info { background: #2980b9; color: #fff; }
.toast-success { background: #27ae60; color: #fff; }
.toast-error { background: #c0392b; color: #fff; }
