/* DenFur sticker gamble — fits site-theme + site chrome */

.gamble-page {
  padding-bottom: 36px;
  overflow-x: clip;
}

.gamble-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.gamble-title-row .df-page-sub {
  margin-bottom: 0;
}

.gamble-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.gamble-title-row .sticker-btn,
.gamble-mute-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  padding: 0 18px;
  background: transparent;
  border: 1px solid rgba(143, 164, 200, 0.35);
  color: #e2e8f0;
  font: inherit;
  font-weight: 900;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.gamble-title-row .sticker-btn:hover,
.gamble-mute-btn:hover {
  border-color: rgba(125, 211, 252, 0.45);
  background: rgba(61, 95, 154, 0.22);
}

.gamble-mute-btn[aria-pressed="true"] {
  border-color: rgba(251, 113, 133, 0.45);
  color: #fecdd3;
}

.gamble-combo {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 80, 120, 0.9), rgba(255, 180, 40, 0.95));
  color: #1a1200;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  box-shadow: 0 0 18px rgba(255, 120, 80, 0.55);
}

.gamble-slots > .gamble-combo {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
}

.gamble-combo[hidden] {
  display: none !important;
}

.gamble-combo.is-pop {
  animation: gambleComboPop 0.45s cubic-bezier(0.12, 1.4, 0.3, 1);
}

@keyframes gambleComboPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.gamble-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.gamble-stage-wrap.df-panel,
.gamble-board.df-panel {
  margin: 0;
  border: 2px solid rgba(143, 164, 200, 0.26);
  background: rgba(21, 29, 46, 0.92);
  border-radius: 0;
  overflow: hidden;
}

.gamble-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: rgba(26, 39, 64, 0.95);
  border-bottom: 1px solid rgba(143, 164, 200, 0.18);
}

.gamble-panel-head strong {
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: 0.02em;
}

.gamble-panel-head span {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 750;
}

/* Slot stage inside site panels (not OBS chroma) */
.gamble-slots.ov-slots-root {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 10px 10px 0;
  box-sizing: border-box;
  overflow: hidden;
}

.gamble-confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow: hidden;
}

.gamble-confetti-piece {
  position: absolute;
  top: 35%;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  transform: translate3d(0, 0, 0) rotate(0deg);
}

.gamble-confetti.is-on .gamble-confetti-piece {
  animation: gambleConfettiFall var(--d, 1s) ease-out var(--delay, 0s) forwards;
}

@keyframes gambleConfettiFall {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--x, 0), 48vh, 0) rotate(var(--r, 180deg)) scale(0.7);
  }
}

.gamble-float-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 13;
}

.gamble-float-plus {
  position: absolute;
  bottom: 42%;
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 950;
  color: #ffe08a;
  text-shadow:
    0 0 18px rgba(255, 200, 80, 0.85),
    0 4px 16px rgba(0, 0, 0, 0.55);
  animation: gambleFloatPlus 1.1s ease-out forwards;
}

@keyframes gambleFloatPlus {
  0% { opacity: 0; transform: translateY(18px) scale(0.6); }
  25% { opacity: 1; transform: translateY(0) scale(1.2); }
  100% { opacity: 0; transform: translateY(-70px) scale(1); }
}

.gamble-stage-wrap.is-shake,
.ov-slots-stage.is-shake {
  animation: gambleShake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes gambleShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-8px, 2px, 0) rotate(-0.6deg); }
  30% { transform: translate3d(9px, -3px, 0) rotate(0.7deg); }
  45% { transform: translate3d(-7px, 1px, 0) rotate(-0.4deg); }
  60% { transform: translate3d(6px, -2px, 0) rotate(0.35deg); }
  75% { transform: translate3d(-3px, 1px, 0); }
}

.gamble-slots .ov-slots-stage {
  width: 100%;
  height: min(58vh, 520px);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 210, 90, 0.07), transparent 55%),
    rgba(8, 12, 22, 0.55);
  border-radius: 14px;
  border: 1px solid rgba(143, 164, 200, 0.16);
  overflow: hidden;
}

.gamble-slots .ov-slots-stage.is-gone {
  opacity: 1;
  pointer-events: auto;
}

.gamble-slots .ov-slots-machine-frame {
  width: min(100%, 820px);
  border-color: rgba(255, 215, 96, 0.42);
  background:
    linear-gradient(160deg, rgba(36, 48, 78, 0.98), rgba(14, 20, 34, 0.98));
  box-sizing: border-box;
}

.gamble-controls {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  padding: 14px 14px 18px;
  border-top: 1px solid rgba(143, 164, 200, 0.14);
  background: rgba(14, 20, 34, 0.55);
}

.gamble-spin-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  min-width: min(90vw, 260px);
  min-height: 52px;
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1200;
  background: linear-gradient(180deg, #ffe58a 0%, #ffc44a 45%, #f0a020 100%);
  box-shadow:
    0 10px 24px rgba(255, 180, 40, 0.28),
    0 2px 0 rgba(255, 255, 255, 0.4) inset,
    0 -3px 0 rgba(160, 90, 0, 0.3) inset;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.gamble-spin-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.015);
  filter: brightness(1.05);
}

.gamble-spin-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.gamble-spin-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.2);
}

.gamble-spin-btn.is-spinning {
  filter: brightness(1.08);
  box-shadow:
    0 0 0 3px rgba(255, 220, 100, 0.35),
    0 10px 28px rgba(255, 180, 40, 0.45),
    0 2px 0 rgba(255, 255, 255, 0.4) inset;
}

.gamble-spin-btn.is-pulse {
  animation: gambleSpinPulse 0.9s ease-in-out 2;
}

@keyframes gambleSpinPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); filter: brightness(1.12); }
}

.gamble-status {
  margin: 0;
  min-height: 1.35em;
  text-align: center;
  color: #94a3b8;
  font-weight: 750;
  font-size: 0.9rem;
  max-width: 36rem;
  padding: 0 8px;
  line-height: 1.35;
}

.gamble-status.is-error {
  color: #fb7185;
}

.gamble-winner-points {
  margin-top: 0.15rem;
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  background: rgba(8, 12, 22, 0.55);
  border: 1px solid rgba(255, 224, 138, 0.55);
  color: #ffe08a;
  font-weight: 900;
  font-size: clamp(16px, 2.6vw, 22px);
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(255, 200, 80, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.gamble-winner-points[hidden] {
  display: none !important;
}

/*
 * Win reveal portal — mounted on <body> so fixed isn't trapped by
 * .df-stage backdrop-filter (that bug made mobile feel broken).
 */
.gamble-reveal-portal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  pointer-events: none;
  display: none;
}

.gamble-reveal-portal.is-on {
  display: block;
}

.gamble-reveal-portal .ov-slots-flash {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 220, 120, 0.45) 22%, rgba(8, 12, 22, 0.35) 55%, transparent 75%);
}

.gamble-reveal-portal .ov-slots-winner {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding:
    max(72px, calc(env(safe-area-inset-top, 0px) + 56px))
    16px
    max(28px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 200, 80, 0.22) 0%, transparent 42%),
    rgba(6, 10, 18, 0.78);
}

.gamble-reveal-portal .ov-slots-winner-img,
.gamble-slots .ov-slots-winner-img {
  width: min(72vw, 420px);
  height: min(72vw, 420px);
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 0 28px rgba(255, 220, 100, 0.65))
          drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55));
}

.gamble-reveal-portal .ov-slots-winner.is-hold .ov-slots-winner-img {
  animation: ovSlotsFloat 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 36px rgba(255, 230, 120, 0.85))
          drop-shadow(0 0 80px rgba(255, 120, 200, 0.35))
          drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55));
}

.gamble-reveal-portal .ov-slots-winner-name,
.gamble-slots .ov-slots-winner-name {
  font-size: clamp(26px, 6vw, 48px);
  max-width: min(92vw, 520px);
  text-align: center;
  padding: 0 8px;
}

.gamble-reveal-portal .ov-slots-shine {
  width: min(92vw, 640px);
  height: min(92vw, 640px);
}

.gamble-reveal-portal .ov-slots-shockwave {
  width: min(42vw, 240px);
  height: min(42vw, 240px);
}

.gamble-reveal-portal .gamble-confetti {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
}

.gamble-reveal-portal .gamble-float-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
}

/* Hide sticky SPIN / chrome while celebrating — was bleeding through on mobile */
body.gamble-revealing .gamble-controls,
body.gamble-revealing .df-site-header,
body.gamble-revealing .df-header-actions {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Keep reels clipped while stage can show overlays when not portaled */
.gamble-slots .ov-slots-reel {
  overflow: hidden;
}

.gamble-board-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  display: grid;
  gap: 0.45rem;
  max-height: min(70vh, 640px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.gamble-board-empty {
  color: #94a3b8;
  padding: 0.7rem 0.35rem;
  font-weight: 750;
  font-size: 0.9rem;
}

.gamble-board-row {
  display: grid;
  grid-template-columns: 1.6rem 2.6rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem 0.45rem;
  border-radius: 10px;
  background: rgba(8, 12, 22, 0.45);
  border: 1px solid rgba(143, 164, 200, 0.14);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.gamble-board-row.is-hot {
  border-color: rgba(255, 215, 96, 0.55);
  background: rgba(255, 200, 64, 0.12);
}

.gamble-board-rank {
  font-weight: 900;
  color: rgba(255, 224, 138, 0.9);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.gamble-board-thumb {
  width: 2.6rem;
  height: 2.6rem;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(143, 164, 200, 0.2);
}

.gamble-board-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e2e8f0;
}

.gamble-board-pts {
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(61, 95, 154, 0.45);
  border: 1px solid rgba(143, 164, 200, 0.35);
}

/* ===== Tablet ===== */
@media (max-width: 960px) {
  .gamble-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .gamble-board-list {
    max-height: min(42vh, 360px);
  }

  .gamble-slots .ov-slots-stage {
    height: min(50vh, 440px);
  }

  .gamble-slots .ov-slots-reel,
  .gamble-slots .ov-slots-cell {
    height: min(24vh, 180px);
  }
}

/* ===== Phone ===== */
@media (max-width: 720px) {
  .gamble-page {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .gamble-title-row {
    gap: 10px;
    margin-bottom: 4px;
  }

  .gamble-title-row .df-page-sub {
    font-size: 0.88rem;
    max-width: none;
  }

  .gamble-title-actions {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
  }

  .gamble-mute-btn {
    min-width: 48px;
    padding: 0 14px;
  }

  .gamble-title-actions .sticker-btn {
    width: 100%;
  }

  /* Flatten nested cards: one machine surface, not panel > stage > frame */
  .gamble-stage-wrap.df-panel {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .gamble-stage-wrap > .gamble-panel-head {
    display: none;
  }

  .gamble-board .gamble-panel-head {
    padding: 10px 12px;
  }

  .gamble-board .gamble-panel-head strong {
    font-size: 0.95rem;
  }

  .gamble-slots.ov-slots-root {
    padding: 0;
  }

  /* No inner stage chrome — machine frame is the card */
  .gamble-slots .ov-slots-stage {
    height: auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    display: grid;
    place-items: center;
    padding: 0;
  }

  .gamble-slots .ov-slots-machine {
    position: relative;
    inset: auto;
    width: 100%;
    opacity: 1;
    transform: none;
  }

  .gamble-slots .ov-slots-machine.is-out {
    /* Keep layout height during winner blast */
    opacity: 0;
    pointer-events: none;
  }

  .gamble-slots .ov-slots-intro,
  .gamble-slots .ov-slots-winner,
  .gamble-slots .ov-slots-flash,
  .gamble-slots .ov-slots-empty {
    position: absolute;
    inset: 0;
  }

  /* Single primary card = the slot machine */
  .gamble-slots .ov-slots-machine-frame {
    width: 100%;
    max-width: 100%;
    padding: 12px 10px 14px;
    border-radius: 16px;
    border-width: 2px;
    box-shadow:
      0 14px 36px rgba(0, 0, 0, 0.4),
      0 0 28px rgba(255, 200, 64, 0.12);
  }

  .gamble-slots > .gamble-combo {
    top: 10px;
    right: 10px;
  }

  /* Points board stays one simple card */
  .gamble-board.df-panel {
    border-radius: 14px;
    overflow: hidden;
  }

  .gamble-slots .ov-slots-title {
    font-size: clamp(12px, 3.4vw, 16px);
    letter-spacing: 0.16em;
    margin-bottom: 8px;
  }

  .gamble-slots .ov-slots-reels {
    gap: 6px;
    padding: 6px;
    border-radius: 12px;
  }

  .gamble-slots .ov-slots-reel {
    border-radius: 10px;
    border-width: 1px;
  }

  .gamble-slots .ov-slots-reel,
  .gamble-slots .ov-slots-cell {
    height: clamp(112px, 28vw, 168px);
  }

  .gamble-slots .ov-slots-cell {
    padding: 8px;
  }

  .gamble-slots .ov-slots-cell img {
    max-width: 92%;
    max-height: 92%;
  }

  .gamble-slots .ov-slots-intro-text {
    font-size: clamp(26px, 8.5vw, 44px);
    padding: 0 10px;
    line-height: 1.08;
  }

  .gamble-reveal-portal .ov-slots-winner-img,
  .gamble-slots .ov-slots-winner-img {
    width: min(78vw, 300px);
    height: min(78vw, 300px);
  }

  .gamble-reveal-portal .ov-slots-winner-name,
  .gamble-slots .ov-slots-winner-name {
    font-size: clamp(22px, 7vw, 34px);
    max-width: 92vw;
  }

  .gamble-winner-points {
    font-size: clamp(15px, 4vw, 20px);
    padding: 0.35rem 0.9rem;
  }

  .gamble-reveal-portal .ov-slots-winner {
    padding-top: max(64px, calc(env(safe-area-inset-top, 0px) + 48px));
  }

  .gamble-float-plus {
    font-size: clamp(1.8rem, 9vw, 2.8rem);
  }

  /* Spin sits under the machine — not another nested card chrome */
  .gamble-controls {
    position: sticky;
    bottom: 0;
    z-index: 30;
    gap: 0.4rem;
    margin-top: 10px;
    padding: 0 0 calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }

  .gamble-spin-btn {
    width: 100%;
    min-width: 0;
    min-height: 56px;
    font-size: 1.12rem;
    letter-spacing: 0.12em;
    border-radius: 14px;
  }

  .gamble-status {
    font-size: 0.84rem;
    min-height: 1.2em;
  }

  .gamble-board-list {
    max-height: none;
    padding: 8px;
    gap: 0.4rem;
  }

  .gamble-board-row {
    grid-template-columns: 1.4rem 2.4rem minmax(0, 1fr) auto;
    gap: 0.45rem;
    padding: 0.45rem 0.5rem;
    min-height: 48px;
  }

  .gamble-board-thumb {
    width: 2.4rem;
    height: 2.4rem;
  }

  /* Softer shake on small screens */
  @keyframes gambleShake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    20% { transform: translate3d(-4px, 1px, 0); }
    40% { transform: translate3d(5px, -1px, 0); }
    60% { transform: translate3d(-3px, 1px, 0); }
    80% { transform: translate3d(2px, 0, 0); }
  }
}

/* ===== Small phones ===== */
@media (max-width: 420px) {
  .gamble-page .df-crumb {
    margin-bottom: 8px;
  }

  .gamble-page .df-page-title {
    font-size: 1.35rem;
  }

  .gamble-btn-label {
    /* keep short labels readable; icon+text already compact */
  }

  .gamble-mute-btn .gamble-btn-label {
    display: none;
  }

  .gamble-mute-btn {
    width: 48px;
    padding: 0;
  }

  .gamble-slots .ov-slots-reel,
  .gamble-slots .ov-slots-cell {
    height: clamp(100px, 27vw, 140px);
  }

  .gamble-slots .ov-slots-reels {
    gap: 5px;
    padding: 5px;
  }

  .gamble-slots .ov-slots-machine-frame {
    padding: 8px 6px 10px;
  }

  .gamble-spin-btn {
    min-height: 54px;
    letter-spacing: 0.08em;
    font-size: 1.05rem;
  }
}

/* Landscape phones: keep machine usable without huge vertical scroll */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  .gamble-page {
    padding-bottom: 20px;
  }

  .gamble-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.8fr);
  }

  .gamble-title-row .df-page-sub {
    display: none;
  }

  .gamble-slots .ov-slots-stage {
    height: auto;
    padding: 4px;
  }

  .gamble-slots .ov-slots-reel,
  .gamble-slots .ov-slots-cell {
    height: min(42vh, 150px);
  }

  .gamble-controls {
    position: static;
    padding: 10px;
    box-shadow: none;
    backdrop-filter: none;
  }

  .gamble-spin-btn {
    min-height: 46px;
  }

  .gamble-board-list {
    max-height: min(70vh, 280px);
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .gamble-spin-btn.is-pulse,
  .gamble-combo.is-pop,
  .gamble-stage-wrap.is-shake,
  .ov-slots-stage.is-shake,
  .gamble-float-plus,
  .gamble-confetti.is-on .gamble-confetti-piece {
    animation: none !important;
  }
}
