/* FakeStake dice/plinko embedded in Tidebet — site palette + typography */

.fs-fakestake-mount.fs-tidebet-theme {
  --fs-surface: var(--bg-base, rgb(12 16 43));
  --fs-panel: var(--bg-panel, rgb(24 30 60));
  --fs-elevated: var(--bg-elevated, rgb(18 23 49));
  --fs-control: var(--bg-panel-hover, rgb(31 37 70));
  --fs-input: var(--ax-input-bg, rgb(7 11 35));
  --fs-border: var(--border-subtle, rgba(52, 60, 100, 0.45));
  --fs-win: var(--success, rgb(32 208 149));
  --fs-loss: var(--danger, rgb(232 48 94));
  --fs-accent: var(--tb-accent, var(--accent, rgb(43 99 244)));
  --fs-text: var(--text-primary, #fff);
  --fs-text-muted: var(--text-secondary, rgb(164 170 198));
  color: var(--fs-text);
  font-family: var(--font, TT-Interphases-Pro, system-ui, sans-serif);
}

.fs-tidebet-theme .tide-plinko-row,
.fs-tidebet-theme .max-w-6xl.bg-\[\#0f1923\],
.fs-tidebet-theme .bg-\[\#0f1923\] {
  background-color: var(--fs-surface) !important;
}

.fs-tidebet-theme .tide-plinko-panel,
.fs-tidebet-theme .bg-\[\#1a2330\],
.fs-tidebet-theme .bg-\[\#1a2330\] {
  background-color: var(--fs-panel) !important;
}

.fs-tidebet-theme .bg-\[\#0d1b2a\],
.fs-tidebet-theme .bg-\[\#1a2a3a\],
.fs-tidebet-theme .bg-\[\#1e2a36\] {
  background-color: var(--fs-elevated) !important;
}

.fs-tidebet-theme .bg-\[\#1e2a36\],
.fs-tidebet-theme .bg-\[\#2c3a47\] {
  background-color: var(--fs-control) !important;
}

.fs-tidebet-theme .border-\[\#2c3a47\] {
  border-color: var(--fs-border) !important;
}

.fs-tidebet-theme .text-gray-400,
.fs-tidebet-theme .text-white\/50 {
  color: var(--fs-text-muted) !important;
}

.fs-tidebet-theme .bg-success,
.fs-tidebet-theme .bg-\[\#22c55e\] {
  background-color: var(--fs-win) !important;
  color: #07111f !important;
}

.fs-tidebet-theme .bg-red-500,
.fs-tidebet-theme .bg-\[\#ef4444\] {
  background-color: var(--fs-loss) !important;
  color: #fff !important;
}

.fs-tidebet-theme .bg-red-500.text-white,
.fs-tidebet-theme .bg-red-500 .text-white {
  color: #fff !important;
}

.fs-tidebet-theme button[type="button"]:not(:disabled),
.fs-tidebet-theme .bg-\[\#2c3a47\].text-white {
  transition: background-color 0.15s var(--ease-out, ease);
}

.fs-tidebet-theme button[type="button"]:not(:disabled):hover {
  filter: brightness(1.06);
}

.fs-tidebet-theme .bg-\[\#4a6880\] {
  background-color: color-mix(in srgb, var(--fs-accent) 55%, var(--fs-control)) !important;
  border-color: color-mix(in srgb, var(--fs-accent) 70%, transparent) !important;
}

.fs-tidebet-theme .tide-dice-roll-marker .bg-success,
.fs-tidebet-theme .tide-dice-roll-marker .bg-red-500 {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.fs-tidebet-theme input,
.fs-tidebet-theme [role="combobox"] {
  font-family: inherit;
}

/* Dice: FakeStake sizes the controls at md:w-1/3, which is ~286px once the chat column takes
   its 400px, so the bet panel overflowed ("Balance: $0.0", clipped 2x / profit). Let the row
   size itself and wrap to a single column when there isn't room for both. */
@media (min-width: 768px) {
  .fs-tidebet-theme .max-w-6xl.md\:flex-row {
    flex-wrap: wrap;
    row-gap: 1rem;
  }
  .fs-tidebet-theme .max-w-6xl.md\:flex-row > .md\:w-1\/3 {
    width: auto;
    flex: 1 1 340px;
    max-width: 420px;
    min-width: 0;
  }
  .fs-tidebet-theme .max-w-6xl.md\:flex-row > :not(.md\:w-1\/3) {
    flex: 999 1 380px;
    min-width: 0;
  }
}

/* Phones: the game card stacked three paddings (panel 22px + two p-4 wrappers), which pushed
   the dice bet panel ~40px past the screen edge. */
@media (max-width: 767px) {
  .original-panel--fs-fakestake {
    padding: 12px 8px 16px !important;
  }
  .fs-tidebet-theme .md\:w-1\/3 > .p-4,
  .fs-tidebet-theme .max-w-md.p-4 {
    padding: 8px !important;
  }
  .fs-tidebet-theme .max-w-md {
    max-width: 100%;
    min-width: 0;
  }
}

/* ===================================================================================
   Plinko + Dice polish: rounded cards, segmented toggles, pill inputs, glowing bet button.
   Everything is scoped to .fs-tidebet-theme (and the Radix dropdown portal on game pages).
   =================================================================================== */
.fs-fakestake-mount.fs-tidebet-theme {
  --fs-r-xl: 20px;
  --fs-r-lg: 14px;
  --fs-r-md: 10px;
  --fs-line: rgba(148, 163, 214, 0.12);
  --fs-line-strong: rgba(148, 163, 214, 0.22);
  --fs-ring: color-mix(in srgb, var(--fs-accent) 55%, transparent);
}

/* Outer game card */
.fs-tidebet-theme .max-w-6xl.bg-\[\#0f1923\],
.fs-tidebet-theme .tide-plinko-row {
  border-radius: var(--fs-r-xl);
  border: 1px solid var(--fs-line);
  background:
    radial-gradient(120% 80% at 70% 0%, color-mix(in srgb, var(--fs-accent) 7%, transparent), transparent 60%),
    var(--fs-surface) !important;
  padding: 16px !important;
  gap: 16px;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.7);
}
@media (min-width: 768px) {
  .fs-tidebet-theme .max-w-6xl.bg-\[\#0f1923\],
  .fs-tidebet-theme .tide-plinko-row {
    padding: 20px !important;
  }
}

/* Controls panel */
.fs-tidebet-theme .tide-plinko-panel,
.fs-tidebet-theme .max-w-6xl > .md\:w-1\/3 {
  border-radius: var(--fs-r-lg);
  border: 1px solid var(--fs-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--fs-panel) 100%, #fff 2%), var(--fs-panel)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.fs-tidebet-theme .max-w-6xl > .md\:w-1\/3 > .p-4 {
  padding: 16px !important;
}
/* inner FakeStake card: no extra box, just spacing */
.fs-tidebet-theme .max-w-md.p-4 {
  padding: 0 !important;
  gap: 18px;
  max-width: none;
  /* mx-auto inside a flex column shrinks it to its content; fill the panel instead */
  width: 100%;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}
.fs-tidebet-theme .tide-plinko-panel > .max-w-md.p-4 {
  padding: 16px !important;
  max-width: 28rem;
}

/* Labels ("Bet Amount", "Risk Level", ...) */
.fs-tidebet-theme .text-\[\#b0b9d2\] {
  color: var(--fs-text-muted) !important;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fs-tidebet-theme .flex.justify-between.mb-2 {
  align-items: baseline;
  margin-bottom: 8px;
}
.fs-tidebet-theme .flex.justify-between.mb-2 > .text-white {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--fs-text) !important;
}

/* Manual / Auto segmented toggle */
.fs-tidebet-theme .flex.rounded-lg.p-1:has(> button + button) {
  border-radius: 999px !important;
  padding: 4px !important;
  background: var(--fs-input) !important;
  border: 1px solid var(--fs-line);
  margin-bottom: 0;
}
.fs-tidebet-theme .flex.rounded-lg.p-1:has(> button + button) > button {
  border-radius: 999px !important;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.fs-tidebet-theme .flex.rounded-lg.p-1 > button.bg-\[\#2c3a47\] {
  background: linear-gradient(180deg, color-mix(in srgb, var(--fs-accent) 92%, #fff 8%), var(--fs-accent)) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--fs-accent) 70%, transparent);
}

/* Bet amount group (input + ½ + 2×) */
.fs-tidebet-theme [container-type\:inline-size] > .flex,
.fs-tidebet-theme .\[container-type\:inline-size\] > .flex {
  border-radius: var(--fs-r-md) !important;
  background: var(--fs-input) !important;
  border: 1px solid var(--fs-line-strong);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fs-tidebet-theme .\[container-type\:inline-size\] > .flex:focus-within {
  border-color: var(--fs-accent);
  box-shadow: 0 0 0 3px var(--fs-ring);
}
.fs-tidebet-theme .\[container-type\:inline-size\] input {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.fs-tidebet-theme .\[container-type\:inline-size\] button {
  border-color: var(--fs-line) !important;
  font-weight: 600;
  color: var(--fs-text-muted) !important;
}
.fs-tidebet-theme .\[container-type\:inline-size\] button:not(:disabled):hover {
  background: var(--fs-control) !important;
  color: var(--fs-text) !important;
}

/* Read-only "Profit on Win" field */
.fs-tidebet-theme .flex.bg-\[\#1e2a36\].rounded-md.overflow-hidden {
  border-radius: var(--fs-r-md) !important;
  background: var(--fs-input) !important;
  border: 1px solid var(--fs-line);
}
.fs-tidebet-theme .flex.bg-\[\#1e2a36\].rounded-md.overflow-hidden input {
  background: transparent !important;
  font-variant-numeric: tabular-nums;
}

/* Risk / Rows dropdown triggers */
.fs-tidebet-theme [role="combobox"] {
  height: 44px !important;
  border-radius: var(--fs-r-md) !important;
  border: 1px solid var(--fs-line-strong) !important;
  background: var(--fs-input) !important;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0 14px !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fs-tidebet-theme [role="combobox"]:hover {
  border-color: color-mix(in srgb, var(--fs-accent) 45%, var(--fs-line-strong)) !important;
}
.fs-tidebet-theme [role="combobox"][data-state="open"],
.fs-tidebet-theme [role="combobox"]:focus-visible {
  border-color: var(--fs-accent) !important;
  box-shadow: 0 0 0 3px var(--fs-ring) !important;
}
/* Dropdown menu (rendered in a portal outside the game root) */
body.tide-game-page [data-radix-popper-content-wrapper] [role="listbox"],
body.tide-game-page [data-radix-popper-content-wrapper] > div {
  border-radius: 12px !important;
  border: 1px solid rgba(148, 163, 214, 0.2) !important;
  background: rgb(18 23 49) !important;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6) !important;
  overflow: hidden;
}
body.tide-game-page [data-radix-popper-content-wrapper] [role="option"] {
  border-radius: 8px;
  margin: 2px 4px;
}
body.tide-game-page [data-radix-popper-content-wrapper] [role="option"][data-highlighted] {
  background: rgba(43, 99, 244, 0.22) !important;
}

/* Sound toggle */
.fs-tidebet-theme button[aria-label="Mute"],
.fs-tidebet-theme button[aria-label="Unmute"] {
  border-radius: var(--fs-r-md) !important;
  background: var(--fs-input) !important;
  border: 1px solid var(--fs-line);
  padding: 10px 14px !important;
}

/* Main bet button */
.fs-tidebet-theme .w-full.py-3.rounded-md.bg-success {
  border-radius: 12px !important;
  padding: 14px 16px !important;
  font-size: 0.975rem;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, color-mix(in srgb, var(--fs-win) 88%, #fff 12%), var(--fs-win)) !important;
  color: #04140d !important;
  box-shadow:
    0 10px 24px -10px color-mix(in srgb, var(--fs-win) 75%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.fs-tidebet-theme .w-full.py-3.rounded-md.bg-success:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.fs-tidebet-theme .w-full.py-3.rounded-md.bg-success:not(:disabled):active {
  transform: translateY(1px) scale(0.995);
}
.fs-tidebet-theme .w-full.py-3.rounded-md.bg-success:disabled {
  background: var(--fs-control) !important;
  color: var(--fs-text-muted) !important;
  box-shadow: inset 0 0 0 1px var(--fs-line-strong);
  opacity: 1;
}

/* ---------- Plinko board ---------- */
.fs-tidebet-theme .tide-plinko-board {
  border-radius: var(--fs-r-lg);
  border: 1px solid var(--fs-line);
  background:
    radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--fs-accent) 10%, transparent), transparent 70%),
    var(--fs-input) !important;
  overflow: hidden;
  padding-top: 8px;
}
.fs-tidebet-theme .tide-plinko-board canvas {
  background: transparent !important;
}
.fs-tidebet-theme .tide-plinko-board .flex-1.rounded-xs {
  border-radius: 6px !important;
}
@media (min-width: 1024px) {
  .fs-tidebet-theme .tide-plinko-board .flex-1.rounded-xs {
    border-radius: 8px !important;
  }
}

/* ---------- Dice playfield ---------- */
.fs-tidebet-theme .bg-\[\#0d1b2a\].rounded-xl {
  border-radius: var(--fs-r-lg) !important;
  border: 1px solid var(--fs-line);
  background:
    radial-gradient(100% 80% at 50% 0%, color-mix(in srgb, var(--fs-accent) 9%, transparent), transparent 70%),
    var(--fs-input) !important;
}
/* scale labels */
.fs-tidebet-theme .bg-\[\#0d1b2a\] .flex.justify-between.text-xs {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* track */
.fs-tidebet-theme .bg-\[\#0d1b2a\] .h-5.rounded-full {
  height: 14px !important;
  padding: 0;
  border-radius: 999px !important;
  background: var(--fs-control) !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 0 6px color-mix(in srgb, var(--fs-control) 55%, transparent);
}
/* handle */
.fs-tidebet-theme .bg-\[\#0d1b2a\] .w-8.h-9.rounded-lg {
  width: 30px !important;
  height: 38px !important;
  border-radius: 10px !important;
  border: 0 !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--fs-accent) 85%, #fff 15%), var(--fs-accent)) !important;
  box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--fs-accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
}
.fs-tidebet-theme .bg-\[\#0d1b2a\] .w-8.h-9 .bg-white\/40 {
  background: rgba(255, 255, 255, 0.7) !important;
}
/* Multiplier / Roll over / Win chance boxes */
.fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border {
  border-radius: var(--fs-r-md) !important;
  border-color: var(--fs-line-strong) !important;
  background: var(--fs-surface) !important;
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border:focus-within,
.fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border:hover {
  border-color: color-mix(in srgb, var(--fs-accent) 55%, var(--fs-line-strong)) !important;
}
.fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border > button:first-child,
.fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border > input {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.fs-tidebet-theme .grid.grid-cols-3 .text-xs.text-gray-400 {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.6875rem;
}
/* roll result marker + history pills */
.fs-tidebet-theme .tide-dice-roll-marker > div:first-child {
  border-radius: 8px !important;
  padding: 4px 8px !important;
}
.fs-tidebet-theme .no-scrollbar > * {
  border-radius: 999px !important;
}

@media (prefers-reduced-motion: reduce) {
  .fs-tidebet-theme * {
    transition: none !important;
  }
}

@media (max-width: 767px) {
  .fs-tidebet-theme .max-w-md.p-4 {
    width: 100%;
    margin: 0 !important;
    box-sizing: border-box;
  }
  .fs-tidebet-theme .grid.grid-cols-3 > div {
    min-width: 0;
  }
  .fs-tidebet-theme .grid.grid-cols-3 {
    gap: 6px;
  }
  .fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border > button:first-child {
    min-width: 0;
    padding-left: 8px !important;
    padding-right: 0 !important;
    font-size: 0.8125rem;
  }
  .fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border > :not(:first-child) {
    padding-left: 4px !important;
    padding-right: 6px !important;
  }
}

/* Plinko: the controls column was capped at 34% of the row, so at tablet widths (chat open)
   it shrank to ~130px. Same wrap-when-narrow layout as dice. */
@media (min-width: 768px) {
  .fs-tidebet-theme .tide-plinko-row {
    flex-wrap: wrap;
  }
  .fs-tidebet-theme .tide-plinko-row > .tide-plinko-panel {
    flex: 1 1 280px;
    width: auto;
    max-width: 320px;
    min-width: 0;
  }
  .fs-tidebet-theme .tide-plinko-row > .tide-plinko-board {
    flex: 999 1 360px;
  }
}
/* Read-only profit input had an intrinsic width wider than small phones */
.fs-tidebet-theme .flex.bg-\[\#1e2a36\].rounded-md.overflow-hidden > input[readonly] {
  min-width: 0;
  width: 0;
}

/* Tablet widths: when the board wraps under the controls, let the controls use the full row. */
@media (min-width: 768px) and (max-width: 1023px) {
  .fs-tidebet-theme .tide-plinko-row > .tide-plinko-panel,
  .fs-tidebet-theme .max-w-6xl.md\:flex-row > .md\:w-1\/3 {
    max-width: none;
  }
}
@media (max-width: 379px) {
  .fs-tidebet-theme .grid.grid-cols-3 {
    gap: 4px;
  }
  .fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border > button:first-child {
    font-size: 0.75rem;
    padding-left: 6px !important;
    letter-spacing: -0.01em;
  }
  .fs-tidebet-theme .grid.grid-cols-3 .rounded-lg.border > :not(:first-child) {
    padding-left: 2px !important;
    padding-right: 4px !important;
  }
}
