/* Plinko (public/js/pages/plinko.js) */
/* Let the single-column (phone) layout shrink below the bet field's number-input width */
.plinko-page .game-layout > * { min-width: 0; }
.plinko-page .game-stage {
  padding: 16px;
  background:
    radial-gradient(ellipse 42% 48% at 50% 0%, rgba(239, 59, 59, .13), transparent),
    radial-gradient(ellipse 40% 26% at 50% 88%, rgba(228, 174, 57, .07), transparent),
    var(--panel);
}
.plinko-page .seg-options button:disabled { opacity: .45; cursor: not-allowed; }
.plinko-page .bet-input:has(.input:disabled) { opacity: .6; }

/* ---------------------------------------------------------------- controls */
.plinko-field-head { display: flex; align-items: center; justify-content: space-between; min-height: 18px; }
.plinko-field-head span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.plinko-field-head b { font-family: var(--display); font-weight: 400; font-size: 16px; color: var(--accent-hi); font-variant-numeric: tabular-nums; }

.plinko-range { --p: 100%; -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer; }
.plinko-range:focus { outline: none; }
.plinko-range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-lo), var(--accent) var(--p), var(--line2) var(--p));
}
.plinko-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%;
  background: #fff; border: 4px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(239, 59, 59, .18), 0 2px 8px rgba(0, 0, 0, .45);
  transition: transform .12s, box-shadow .12s;
}
.plinko-range:not(:disabled):hover::-webkit-slider-thumb,
.plinko-range:focus-visible::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(239, 59, 59, .22), 0 2px 8px rgba(0, 0, 0, .45); }
.plinko-range::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line2); }
.plinko-range::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--accent); }
.plinko-range::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(239, 59, 59, .18), 0 2px 8px rgba(0, 0, 0, .45);
}
.plinko-range:disabled { opacity: .45; cursor: not-allowed; }
.plinko-range-ticks { display: flex; justify-content: space-between; padding: 0 3px; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }

.plinko-auto { display: flex; flex-direction: column; gap: 14px; }
.plinko-drop { font-family: var(--display); font-weight: 400; letter-spacing: .05em; touch-action: manipulation; }
.plinko-drop.plinko-stop {
  background: linear-gradient(180deg, #34252a, #241a1d); color: var(--accent-hi);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 22px -6px rgba(239, 59, 59, .6);
  animation: plinko-pulse 1.6s ease-in-out infinite;
}
.plinko-lock { margin-top: -6px; font-size: 12px; text-align: center; }
.plinko-stats { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.plinko-stats .price { gap: 4px; }
.plinko-pos { color: var(--green); }
.plinko-neg { color: var(--red); }

/* ---------------------------------------------------------------- board */
.plinko-stage { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 14px; align-items: stretch; }
.plinko-board { position: relative; min-height: 300px; display: grid; place-items: center; }
.plinko-svg {
  display: block; width: 100%; height: auto; max-height: min(76vh, 700px);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}

.plinko-peg { fill: #e6dade; transform-box: fill-box; transform-origin: center; }
.plinko-halo { fill: rgba(255, 107, 107, .5); transform-box: fill-box; transform-origin: center; pointer-events: none; }
.plinko-ball { pointer-events: none; }
.plinko-emitter { pointer-events: none; }
.plinko-emitter-ring {
  fill: rgba(239, 59, 59, .07); stroke: rgba(239, 59, 59, .5); stroke-width: 2; stroke-dasharray: 4 5;
  transform-box: fill-box; transform-origin: center; animation: plinko-spin 9s linear infinite;
}
.plinko-emitter-arrow {
  fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: .75;
  animation: plinko-nudge 1.4s ease-in-out infinite;
}

.plinko-bucket { cursor: help; }
.plinko-bucket text { font-family: var(--font); font-weight: 800; letter-spacing: -.02em; pointer-events: none; }
.plinko-bucket:hover .plinko-bucket-inner { filter: brightness(1.12); }
.plinko-float {
  font-family: var(--display); pointer-events: none;
  paint-order: stroke; stroke: rgba(10, 6, 8, .75); stroke-width: 5px; stroke-linejoin: round;
}

/* ---------------------------------------------------------------- last results */
.plinko-history { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: hidden; contain: size; padding-top: 2px; }
.plinko-hist {
  --c: #888; flex: none; height: 34px; padding: 0 4px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--c); color: #1a0b0b; font: 800 12.5px/1 var(--font); font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .3);
  animation: plinko-hist-in .38s cubic-bezier(.2, .9, .3, 1.35);
  transition: transform .12s, filter .12s;
}
.plinko-hist:not(.up) { filter: saturate(.55) brightness(.78); }
.plinko-hist:hover { transform: translateY(-1px); filter: none; }
.plinko-hist:first-child { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .28), 0 0 0 2px rgba(255, 255, 255, .85); }

/* ---------------------------------------------------------------- info bar */
.plinko-info {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; min-height: 42px; margin-top: 12px; padding: 9px 14px;
  border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: 13.5px;
}
.plinko-info > b { font-family: var(--display); font-weight: 400; font-size: 17px; }
.plinko-info .price { font-size: 13.5px; }
.plinko-key { color: var(--dim); font-size: 12.5px; }
.plinko-key kbd {
  display: inline-block; padding: 1px 7px; margin-right: 4px; border-radius: 5px; border: 1px solid var(--line2);
  border-bottom-width: 2px; background: var(--panel2); color: var(--muted); font: 600 11.5px/1.5 var(--font);
}

/* ---------------------------------------------------------------- drop details (modal) */
.plinko-detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.plinko-detail > div { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.plinko-detail > div b { text-transform: capitalize; }
.plinko-detail span,
.plinko-proof span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.plinko-path { display: flex; flex-wrap: wrap; gap: 4px; }
.plinko-path i {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-style: normal;
  font-size: 11px; font-weight: 700; background: var(--panel3); color: var(--muted);
}
.plinko-path i.r { background: rgba(239, 59, 59, .18); color: var(--accent-hi); }
.plinko-proof { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.plinko-proof code {
  display: block; margin-top: 3px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg2); font-size: 12px; word-break: break-all;
}

@keyframes plinko-hist-in { from { transform: translateY(-12px) scale(.75); opacity: 0; } }
@keyframes plinko-spin { to { transform: rotate(360deg); } }
@keyframes plinko-nudge { 50% { transform: translateY(3px); } }
@keyframes plinko-pulse { 50% { box-shadow: inset 0 0 0 1px var(--accent-hi), 0 0 30px -4px rgba(239, 59, 59, .75); } }

/* Stacked layout: the drop button goes right under the board */
@media (max-width: 900px) {
  .plinko-page .game-controls > .plinko-drop,
  .plinko-page .game-controls > .plinko-lock { order: -1; }
  .plinko-lock { margin-top: -8px; }
}

@media (max-width: 600px) {
  .plinko-page .game-stage { padding: 10px; }
  .plinko-stage { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .plinko-board { min-height: 240px; }
  .plinko-history { order: -1; flex-direction: row; height: 30px; contain: none; padding: 2px; }
  .plinko-hist { height: 26px; min-width: 50px; font-size: 12px; }
  .plinko-hist:first-child { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .28), 0 0 0 1.5px rgba(255, 255, 255, .85); }
  .plinko-key { display: none; }
  .plinko-info { font-size: 12.5px; gap: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .plinko-emitter-ring, .plinko-emitter-arrow, .plinko-drop.plinko-stop { animation: none; }
}
