.plinko-layout {
  min-height: clamp(620px, calc(100vh - 108px), 760px);
  width: min(1198px, calc(100vw - 28px));
  padding: 0;
  gap: 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.plinko-left-rail {
  gap: 16px;
  background: #082f23;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 18px 35px rgba(0, 20, 11, 0.22);
}

.mode-toggle {
  border: 0;
  border-radius: 8px;
  background: #071f19;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.mode-btn {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #547568;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-btn.is-active {
  background: #273d37;
  color: #ffffff;
}

.mode-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.plinko-balance-text {
  font-size: 0.78rem;
  color: #9cb8ac;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
}

.plinko-left-rail .spin-btn {
  border: 0;
  background: #00c838;
  color: #ffffff;
  box-shadow: none;
}

.plinko-left-rail .bet-pill {
  border: 0;
  background: #071f19;
  box-shadow: none;
}

.plinko-left-rail .mini-btn {
  border: 0;
  background: #193c31;
  color: #ffffff;
}

.plinko-left-rail .risk-toggle {
  border: 0;
  background: #071f19;
  padding: 4px;
}

.plinko-left-rail .risk-btn {
  color: #d7e7df;
}

.plinko-left-rail .risk-btn.is-active {
  background: #00c838;
  color: #ffffff;
}

.plinko-right-rail {
  --plinko-board-width: min(88%, 780px);
  background: #10251f;
  border: 0;
  border-radius: 10px;
  padding: 26px 28px 12px;
  box-shadow: 0 18px 35px rgba(0, 20, 11, 0.2);
}

.plinko-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  gap: 8px;
}

.plinko-stage-header {
  min-height: 20px;
  width: var(--plinko-board-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plinko-speed-toggle {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: #193c31;
  color: #ffffff;
  font-size: 1.08rem;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.plinko-speed-toggle svg {
  width: 16px;
  height: 16px;
  color: #ffffff;
}

.plinko-speed-toggle.is-fast {
  background: #00c838;
}

.plinko-speed-toggle:not(.is-fast) {
  background: #193c31;
}

.plinko-history-rail {
  margin-left: auto;
  min-height: 30px;
  max-width: min(520px, 74%);
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
  gap: 4px;
  align-items: center;
  overflow: hidden;
}

.plinko-history-chip {
  --chip-bg: #ffc10f;
  --chip-fg: #061b14;
  height: 30px;
  min-width: 46px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--chip-bg);
  color: var(--chip-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.plinko-history-chip.is-enter {
  animation: history-enter 210ms ease-out 1;
}

.plinko-history-chip.is-exit {
  animation: history-exit 220ms ease-in 1 forwards;
}

@keyframes history-enter {
  0% {
    opacity: 0;
    transform: translateX(14px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes history-exit {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(-10px);
  }
}

.plinko-board {
  position: relative;
  width: var(--plinko-board-width);
  height: clamp(430px, calc(100vh - 286px), 575px);
  min-height: 430px;
  margin: 0 auto;
  border: 0;
  border-radius: 10px;
  background:
    linear-gradient(rgba(15, 36, 31, 0.92), rgba(15, 36, 31, 0.92)),
    radial-gradient(circle at 50% 34%, rgba(90, 135, 113, 0.22) 0 2px, transparent 2.4px),
    radial-gradient(circle at 38% 52%, rgba(90, 135, 113, 0.2) 0 2px, transparent 2.4px),
    radial-gradient(circle at 62% 52%, rgba(90, 135, 113, 0.2) 0 2px, transparent 2.4px),
    radial-gradient(circle at 50% 68%, rgba(90, 135, 113, 0.18) 0 1.8px, transparent 2.2px),
    #10251f;
  background-size: auto, 58px 58px, 58px 58px, 58px 58px, 58px 58px, auto;
  overflow: hidden;
}

.peg-layer,
.trail-layer,
.bucket-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.trail-layer {
  pointer-events: none;
  z-index: 3;
}

.bucket-layer {
  z-index: 4;
}

.peg {
  position: absolute;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #8b9993;
  opacity: 0.95;
}

.drop-ball {
  position: absolute;
  width: 15px;
  height: 15px;
  margin-left: -7.5px;
  margin-top: -7.5px;
  border-radius: 50%;
  background: #f5fff8;
  box-shadow: 0 0 12px rgba(214, 255, 224, 0.46);
  z-index: 6;
  will-change: left, top;
}

.peg-hit {
  position: absolute;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border-radius: 50%;
  background: rgba(224, 255, 232, 0.9);
  box-shadow: 0 0 0 0 rgba(54, 224, 109, 0.38);
  pointer-events: none;
  z-index: 5;
  animation: peg-hit-pulse 360ms ease-out forwards;
}

@keyframes peg-hit-pulse {
  0% {
    opacity: 0.95;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(54, 224, 109, 0.34);
  }
  100% {
    opacity: 0;
    transform: scale(2);
    box-shadow: 0 0 0 12px rgba(54, 224, 109, 0);
  }
}

.bucket-btn {
  --bucket-heat: 0;
  --bucket-hue: calc(44 - (64 * var(--bucket-heat)));
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 8px;
  background: #17372d;
  color: #7fa091;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 0.71rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 3px;
  cursor: pointer;
  transition: transform 110ms ease, filter 110ms ease;
}

.bucket-btn.is-on {
  background: hsl(var(--bucket-hue) 96% 52%);
  color: #061b14;
}

.bucket-btn:hover:not(:disabled) {
  transform: translate(-50%, -52%);
  filter: brightness(1.03);
}

.bucket-btn.is-hit {
  box-shadow: 0 0 0 2px rgba(255, 220, 91, 0.48);
}

.bucket-btn.is-miss {
  box-shadow: 0 0 0 2px rgba(255, 90, 118, 0.38);
}

.bucket-btn.is-impact {
  animation: bucket-impact 300ms cubic-bezier(0.2, 0.85, 0.25, 1) 1;
}

@keyframes bucket-impact {
  0% {
    transform: translate(-50%, -50%);
  }
  30% {
    transform: translate(-50%, -43%);
  }
  62% {
    transform: translate(-50%, -54%);
  }
  100% {
    transform: translate(-50%, -50%);
  }
}

.plinko-footer-row {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 2px 2px 0;
}

.plinko-foot-pill {
  border: 0;
  border-radius: 7px;
  background: #193c31;
  color: #a6c3b6;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  padding: 5px 12px;
}

.plinko-foot-btn {
  font-family: inherit;
  cursor: pointer;
}

.plinko-foot-btn[aria-expanded="true"] {
  color: #ffffff;
  background: #00c838;
}

.plinko-fair-panel {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 30;
}

.plinko-fair-card {
  width: min(340px, calc(100vw - 28px));
  border: 0;
  border-radius: 10px;
  background: #082f23;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.34);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.fair-title-row strong {
  font-size: 1.02rem;
}

.fair-seed-input {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #071f19;
  color: #f7fff9;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 0.9rem;
  padding: 0 10px;
  outline: none;
}

.fair-seed-input:focus-visible {
  box-shadow: 0 0 0 2px rgba(54, 224, 109, 0.32);
}

.fair-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fair-line {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.72rem;
  line-height: 1.3;
}

.fair-line code {
  color: #e7fff0;
}

@media (max-width: 980px) {
  .plinko-layout {
    min-height: auto;
  }

  .plinko-right-rail {
    --plinko-board-width: min(90%, 760px);
  }

  .plinko-board {
    height: clamp(360px, 54vh, 540px);
    min-height: 360px;
  }
}

@media (max-width: 760px) {
  .plinko-right-rail {
    --plinko-board-width: min(96%, 690px);
    padding: 10px 12px 8px;
  }

  .plinko-board {
    height: clamp(340px, 50vh, 500px);
    min-height: 340px;
  }

  .plinko-footer-row {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .plinko-history-rail {
    max-width: min(62vw, 420px);
  }

  .fair-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .plinko-balance-text {
    font-size: 0.96rem;
  }

  .plinko-foot-pill {
    font-size: 0.68rem;
    padding: 4px 8px;
  }
}
