/* Standardized 3-Tier Bet Dock Layout with Collapsible Quick Chips */
.bet-dock-container {
  position: relative;
  width: 100%;
  max-width: var(--dock-max-width, 480px);
  margin: 0 auto;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--paper-ink, #172738) 76%, #0b1420);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: var(--border-radius-lg, 18px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow: visible;
  z-index: 10;
  min-width: 0;
}

/* Tier 1: Parameter Selection */
.bet-dock-tier-params {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.bet-dock-segmented {
  display: flex;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
  min-width: 0;
}

.bet-dock-segment-btn {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 5px 4px;
  font-family: var(--font-ui, system-ui);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary, rgba(248, 251, 255, 0.65));
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
  text-align: center;
  white-space: nowrap;
}

.bet-dock-segment-btn:hover {
  color: #fff;
}

.bet-dock-segment-btn.active {
  background: color-mix(in srgb, var(--game-accent, #b6d2dc) 22%, var(--paper-ink, #172738));
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Tier 2: Amount Input & Collapsible Quick Chips */
.bet-dock-tier-amount {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.bet-dock-amount-main-row {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.bet-dock-input-group {
  flex: 1 1 132px;
  min-width: 104px;
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(4, 9, 20, 0.65);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.14));
  border-radius: 12px;
  padding: 0 10px;
  height: 44px;
  transition: border-color 0.18s ease;
  box-sizing: border-box;
}

.bet-dock-input-group:focus-within {
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
}

.bet-dock-input-group label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted, rgba(248, 251, 255, 0.5));
  margin-right: 8px;
  white-space: nowrap;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.bet-dock-input-group input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-display, sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  outline: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.bet-dock-quick-multipliers {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  min-width: 0;
}

.bet-dock-multiplier-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text-primary, #f8fbff);
  font-family: var(--font-display, sans-serif);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s ease, background-color .15s ease;
  white-space: nowrap;
}

.bet-dock-multiplier-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}

.bet-dock-multiplier-btn:active {
  transform: scale(0.94);
}

.bet-dock-multiplier-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bet-dock-chip-toggle {
  height: 44px;
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--text-secondary, rgba(248, 251, 255, 0.75));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.bet-dock-chip-toggle.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

/* Collapsible Preset Chips Row — overlay so the stage height stays fixed */
.bet-dock-collapsible-chips {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 12;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  background: var(--bg-dock, rgba(10, 20, 36, 0.96));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  animation: betDockSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes betDockSlideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bet-dock-preset-chip {
  flex: 1;
  min-width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary, #f8fbff);
  font-family: var(--font-display, sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s ease, background-color .15s ease;
}

.bet-dock-preset-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.bet-dock-preset-chip:active {
  transform: scale(0.94);
}

.bet-dock-preset-chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Tier 3: Primary Action CTA */
.bet-dock-tier-cta {
  width: 100%;
}

.bet-dock-cta-btn {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  font-family: var(--font-display, sans-serif);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, filter 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.bet-dock-cta-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.bet-dock-cta-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
  box-shadow: none;
}

/* CTA States */
.bet-dock-cta-btn.state-ready {
  color: #07101e;
  background: linear-gradient(180deg, #d9f5ff 0%, #66c9f3 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--game-accent, #8ad8ff) 58%, white) 0%,
    color-mix(in srgb, var(--game-accent, #8ad8ff) 86%, #152033) 100%
  );
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.38),
    0 8px 22px color-mix(in srgb, var(--game-accent, #8ad8ff) 30%, transparent);
}

.bet-dock-cta-btn.state-cashout {
  color: #07101e;
  background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 100%);
  box-shadow: 0 0 24px var(--color-cashout-glow, rgba(245, 158, 11, 0.45));
}

.bet-dock-cta-btn.state-win {
  color: #07101e;
  background: linear-gradient(180deg, #6ee7b7 0%, #10b981 100%);
  box-shadow: 0 0 24px var(--color-win-glow, rgba(52, 211, 153, 0.45));
}

.bet-dock-cta-btn.state-danger {
  color: #ffffff;
  background: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
  box-shadow: 0 0 24px var(--color-danger-glow, rgba(255, 94, 94, 0.45));
}

/* Footer / Meta info */
.bet-dock-meta-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-secondary, rgba(248, 251, 255, 0.6));
  padding: 0 2px;
  font-family: var(--font-ui, system-ui);
}

.bet-dock-error {
  margin: 0;
  color: var(--color-danger, #ff5e5e);
  font-size: 0.74rem;
  font-weight: 600;
  text-align: center;
  padding: 2px 0;
}

.bet-dock-error-slot:empty {
  display: none;
}

.bet-dock-error-slot {
  min-width: 0;
}

.bet-dock-container :is(button, input):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--game-accent, #8ad8ff) 78%, white);
  outline-offset: 2px;
}

/* Keep the amount field usable on common 390–430 px phones as well as
   narrower screens; sharing a row with four quick actions leaves too little
   room for real wallet-sized values. */
@media (max-width: 430px) {
  .bet-dock-container {
    padding-inline: 9px;
  }

  .bet-dock-amount-main-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .bet-dock-input-group {
    width: 100%;
    min-width: 0;
  }

  .bet-dock-quick-multipliers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .bet-dock-multiplier-btn,
  .bet-dock-chip-toggle {
    width: 100%;
    min-width: 0;
    padding-inline: 4px;
  }

  .bet-dock-collapsible-chips {
    display: grid;
    grid-template-columns: repeat(5, minmax(52px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bet-dock-container *,
  .bet-dock-container *::before,
  .bet-dock-container *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.bet-dock-container :is(button,input):focus-visible {
  outline: 2px solid var(--game-accent-2, #ffdc95);
  outline-offset: -3px;
}
@media (prefers-reduced-motion: reduce) {
  .bet-dock-container :is(button, input) { transition: none; }
  .bet-dock-cta-btn:active:not(:disabled) { transform: none; }
}
.bet-dock-tier-cta .stake-guidance {
  flex-basis: 100%;
  margin: 0 0 4px;
  color: #ffe3a8;
  font-size: .82rem;
  line-height: 1.35;
}

.bet-dock-container button {
  touch-action: manipulation;
}

.bet-dock-tier-cta:has(.stake-guidance) {
  flex-wrap: wrap;
}
