/**
 * Limbo — 極限火箭秒開樣式
 */

: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;
}

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

.limbo-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) {
  .limbo-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;
  }

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

  .board-top-bar {
    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;
  }

  .display-chamber {
    flex: 1 1 auto;
    min-height: 180px;
    max-height: 46vh;
    border-radius: 8px;
  }

  .hud-row {
    padding: 6px 8px;
  }

  .hud-badge {
    font-size: 9px;
    padding: 2px 6px;
  }

  .mult-huge {
    font-size: 42px;
  }

  .limbo-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);
  }

  /* 手機端並排下注額與目標倍率 */
  .mobile-limbo-row {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .mobile-limbo-row .panel-section {
    flex: 1;
    min-width: 0;
  }

  .panel-section {
    gap: 3px;
  }

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

  .win-chance {
    font-size: 9px;
  }

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

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

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

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

  .quick-mults {
    gap: 3px;
    margin-top: 2px;
  }

  .btn-qmult {
    padding: 4px 0;
    font-size: 10px;
  }

  .payout-card {
    padding: 4px 8px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .payout-label {
    font-size: 9px;
  }

  .payout-val {
    font-size: 13px;
  }

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

  .btn-launch {
    height: 42px;
    font-size: 14px;
    border-radius: 8px;
  }

  .fairness-badge {
    display: none;
  }
}

.mobile-limbo-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-section { display: flex; flex-direction: column; gap: 8px; }
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #f1c40f;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.hint-text {
  font-size: 11px;
  color: #bdc3c7;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.win-chance {
  font-size: 11px;
  color: var(--green-win);
  font-family: var(--font-mono);
  font-weight: 800;
  text-shadow: 0 0 8px rgba(46, 204, 113, 0.4);
}

.bet-input-row, .target-input-row { display: flex; gap: 6px; position: relative; }
.btn-step {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: #fff;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-step:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: #ffd32a;
}

.bet-input, .target-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.85);
  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;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.unit-x {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #bdc3c7;
  font-family: var(--font-mono);
  font-weight: 800;
}

.chip-row, .quick-mults { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.quick-mults { grid-template-columns: repeat(5, 1fr); }

.btn-chip, .btn-qmult {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #ecf0f1;
  border-radius: 6px;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-chip:hover, .btn-qmult:hover {
  background: rgba(212, 175, 55, 0.25);
  color: #ffd32a;
  border-color: #ffd32a;
}

.btn-qmult.active {
  background: linear-gradient(135deg, #d4af37, #f39c12);
  color: #000;
  font-weight: 800;
  border-color: #f39c12;
}

/* 預計派彩卡片 */
.payout-card {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}
.payout-label {
  font-size: 11px;
  color: #e0a96d;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.payout-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: var(--green-win);
  text-shadow: 0 0 10px rgba(46, 204, 113, 0.4);
}

.payout-card {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.payout-label { font-size: 11px; color: #888; }
.payout-val { font-family: var(--font-mono); font-size: 18px; font-weight: 800; color: var(--green-win); }

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

.btn-launch {
  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, #ff4757, #ff6b81);
  color: #fff;
  box-shadow: 0 6px 22px rgba(255, 71, 87, 0.5);
  transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.btn-launch:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 8px 28px rgba(255, 71, 87, 0.7);
}

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

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

/* ==================== 右側巨幕儀表艙 ==================== */
.limbo-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; }
.limbo-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;
}
.limbo-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;
}
.history-pill.win { background: rgba(46, 204, 113, 0.2); color: var(--green-win); border: 1px solid rgba(46, 204, 113, 0.4); }
.history-pill.lose { background: rgba(231, 76, 60, 0.2); color: var(--red-accent); border: 1px solid rgba(231, 76, 60, 0.4); }

.display-chamber {
  flex: 1;
  position: relative;
  min-height: 480px;
  background: #020101;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

canvas#rocketCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.chamber-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 16px 20px;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 10;
}

.telemetry-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: rgba(8, 10, 20, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 16px;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 11px;
}

.tele-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tele-lbl {
  color: #7f8c8d;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.tele-val {
  color: #00d2d3;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(0, 210, 211, 0.6);
}

.multiplier-display-box {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.giant-multiplier {
  font-family: var(--font-mono);
  font-size: 78px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.95), 0 0 35px rgba(255, 211, 42, 0.55);
  transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.giant-multiplier.win {
  color: var(--green-win);
  text-shadow: 0 0 30px rgba(46, 204, 113, 0.9), 0 0 60px rgba(46, 204, 113, 0.5);
  transform: scale(1.08);
}

.giant-multiplier.lose {
  color: var(--red-accent);
  text-shadow: 0 0 25px rgba(231, 76, 60, 0.9);
  transform: scale(0.96);
}

.target-indicator {
  margin-top: 8px;
  font-size: 14px;
  color: #bdc3c7;
  background: rgba(0, 0, 0, 0.65);
  padding: 4px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
}

.target-indicator strong {
  color: #ffd32a;
  font-family: var(--font-mono);
}

/* 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; }
