#jackpot-dialog {
  inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; border-radius: 0;
  overflow: auto; color: #fff0d5; background: radial-gradient(ellipse at 58% 22%, #372744, #1c1726 70%);
  font-family: Outfit, system-ui, sans-serif; color-scheme: dark;
}
#jackpot-dialog::backdrop { background: #1c1726; }
#jackpot-dialog [hidden] { display: none !important; }
#jackpot-dialog button, #jackpot-dialog select { font: inherit; }
#jackpot-dialog button:focus-visible, #jackpot-dialog select:focus-visible {
  outline: 2px solid #fff3bc; outline-offset: 2px;
}
.jackpot-shell {
  box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 370px) minmax(0, 600px);
  grid-template-areas: "header header" "inventory machine" "prizes machine" "controls result";
  grid-template-rows: auto auto 1fr auto;
  align-items: start; gap: 14px 24px; max-width: 1050px; margin: auto;
  padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}
.jackpot-header {
  grid-area: header; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 3px 16px; border-bottom: 1px solid #8c623b;
}
.jackpot-header p { margin: 0 0 4px; color: #e9bb75; font-size: .72rem; font-weight: 800; letter-spacing: .2em; }
.jackpot-header h2 { margin: 0; font-size: clamp(2rem, 5.5vw, 3.35rem); line-height: 1.02; color: #ffde9e; }
#jackpot-dialog button, #jackpot-dialog select {
  border: 1px solid #a77949; border-radius: 10px; background: #332839;
  color: #fff0d5; cursor: pointer; font-weight: 750; min-height: 42px;
}
#jackpot-dialog button:hover:not(:disabled) { border-color: #f4ce8d; background: #493349; }
#jackpot-dialog button:disabled { opacity: .54; cursor: default; }
.jackpot-close { width: 44px; flex: 0 0 44px; }
.jackpot-inventory { grid-area: inventory; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.jackpot-inventory > strong { margin-right: auto; white-space: nowrap; }
.jackpot-inventory label { position: relative; min-width: 0; }
#jackpot-dialog select { min-height: 42px; max-width: 100%; padding: 0 5px 0 24px; }
.jackpot-inventory i {
  position: absolute; top: 50%; left: 8px; width: 10px; height: 10px; transform: translateY(-50%);
  border-radius: 50%; background: var(--ball); box-shadow: inset 0 1px 2px #fff9, 0 0 7px var(--ball); pointer-events: none;
}
.jackpot-prizes {
  grid-area: prizes; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px;
  list-style: none; padding: 0; margin: 0; align-self: stretch;
}
.jackpot-card {
  position: relative; display: grid; grid-template-rows: minmax(38px, 1fr) auto auto;
  min-width: 0; min-height: 103px; text-align: center; align-content: center;
  border: 1px solid var(--catcher); border-radius: 11px; padding: 5px 2px;
  background: radial-gradient(ellipse at 50% 25%, color-mix(in srgb, var(--catcher) 23%, #2d2236), #211926 84%);
}
.jackpot-card strong { font-size: clamp(.72rem, 2.9vw, .96rem); line-height: 1.06; overflow-wrap: anywhere; }
.jackpot-card-art { display: flex; align-items: center; justify-content: center; min-height: 0; }
.jackpot-card-art .pet-art { width: min(85%, 82px); height: auto; max-height: 84px; }
.jackpot-card-art .pet-art:not(:only-child) { width: 47%; margin-inline: -4%; }
.jackpot-number {
  position: absolute; top: 4px; border-radius: 12px; padding: 1px 5px;
  font-size: .69rem; font-weight: 850; line-height: 1.35; z-index: 1;
}
.jackpot-number { left: 4px; background: var(--catcher); color: #211521; }
.jackpot-rarities { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 2px 3px; margin-top: 3px; }
.jackpot-rarities:empty { margin: 0; }
.jackpot-rarity {
  background: var(--rarity); color: var(--ink); font-weight: 850; font-size: .63rem;
  line-height: 1.2; padding: 1px 4px; border-radius: 4px;
}
.jackpot-fallback { color: #f9dca8; font-size: .61rem; line-height: 1.13; }
.jackpot-token { font-size: clamp(1.75rem, 4.7vw, 2.6rem); line-height: 1; }
.jackpot-coins { color: #ffcf62; text-shadow: 0 2px #995521, 0 0 16px #e6a93465; }
.jackpot-magic { color: #e6b5ff; text-shadow: 0 2px #8256bb, 0 0 16px #d391ff88; }
.jackpot-machine {
  grid-area: machine; min-width: 0; position: relative; padding: 5px 5px 6px;
  border: 2px solid #be8c53; border-radius: 15px;
  background: linear-gradient(140deg,#a8784c,#4d302c 55%,#8b5635);
  box-shadow: 0 10px 28px #10091599, inset 0 0 0 2px #e9b56b45;
}
.jackpot-machine-label {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  color: #ffedc9; font-size: .75rem; font-weight: 800; letter-spacing: .12em; min-height: 22px;
}
.jackpot-machine-label span { color: #efc485; font-size: .57rem; }
.jackpot-board { width: 100%; height: auto; display: block; }
.jackpot-rail { fill: none; stroke: url(#jackpot-rail-metal); stroke-width: 7; stroke-linecap: round; }
.jackpot-pegs { fill: #f7ce8c; stroke: #925b3f; stroke-width: 1; }
.jackpot-gear-shadow { fill: #16111f; stroke: #c88b5144; }
.jackpot-gear-metal { fill: url(#jackpot-rail-metal); stroke: #ffe0a0; stroke-width: 1.2; stroke-linejoin: round; }
.jackpot-gear-face { fill: #3d2d39; stroke: #e3ae64; stroke-width: 1.5; }
.jackpot-spokes { stroke: #b9814d; stroke-width: 5; stroke-linecap: round; }
.jackpot-gear-pin { fill: #ecbc73; stroke: #ffe0a0; stroke-width: 1; }
.jackpot-catcher { color: var(--catcher); }
.jackpot-catcher path { fill: color-mix(in srgb, var(--catcher) 29%, #221929); stroke: currentColor; stroke-width: 2; }
.jackpot-catcher .jackpot-catcher-rim { stroke-width: 3; stroke-linecap: round; }
.jackpot-catcher text {
  fill: #fff0d5; font: 850 18px Outfit, system-ui, sans-serif;
  text-anchor: middle; dominant-baseline: middle;
}
.jackpot-catcher.jackpot-hit path { fill: color-mix(in srgb, var(--catcher) 66%, #221929); stroke: #fff5d2; }
.jackpot-catcher.jackpot-hit text { fill: #1f1625; }
.jackpot-card.jackpot-hit { outline: 2px solid #fff5d2; outline-offset: -2px; box-shadow: 0 0 13px var(--catcher); }
.jackpot-moving-ball circle:first-child { fill: var(--ball); stroke: #fffa; stroke-width: 1.6; filter: drop-shadow(0 0 5px var(--ball)); }
#jackpot-aim {
  position: absolute; box-sizing: border-box; top: 26px; left: 5%; width: 90%; height: 36px;
  margin: 0; opacity: 0; cursor: ew-resize; touch-action: none;
}
#jackpot-aim:disabled { pointer-events: none; }
.jackpot-machine:has(#jackpot-aim:focus-visible) .jackpot-dropper { filter: drop-shadow(0 0 5px #fff2b5); }
.jackpot-controls { grid-area: controls; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; }
.jackpot-controls small { grid-column: 1 / -1; text-align: center; color: #dec4a8; font-size: .76rem; }
#jackpot-dialog .jackpot-gold-refresh{
 grid-column:1 / -1;min-height:44px;border:1px solid #ffe39c;border-radius:13px;
 background:linear-gradient(160deg,#ffecc0,#dda637);color:#422c21;
 font-weight:800;box-shadow:0 3px 0 #8d652a,0 0 12px #edc35e66
}
#jackpot-dialog .jackpot-gold-refresh:disabled{box-shadow:none;opacity:.62;cursor:default}
#jackpot-dialog .jackpot-gold-refresh:hover:not(:disabled){background:#fff0c0;color:#392825}

#jackpot-dialog .jackpot-primary {
  background: linear-gradient(#ffe4ab, #e9ad65); color: #2b1b21; padding: 0 7px; border-color: #f0ce92;
}
#jackpot-dialog .jackpot-primary:hover:not(:disabled) { background: #ffebbb; }
.jackpot-result {
  grid-area: result; min-width: 0; min-height: 0; position: relative; display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--catcher, #9f764e); border-radius: 11px; padding: 5px 9px; color: #fff0d5; background: #251b2b;
}
.jackpot-result:empty { display: none; }
.jackpot-result strong, .jackpot-result small { display: block; }
.jackpot-result strong { font-size: 1rem; }
.jackpot-result small { color: #ffe0b3; line-height: 1.18; }
.jackpot-win-art { display: flex; flex: 0 0 auto; }
.jackpot-win-art .pet-art { width: 54px; height: 54px; }
.jackpot-kin-win { animation: jackpot-reveal .42s ease-out; }
.jackpot-big-win {
  background: radial-gradient(ellipse at 10% 50%, color-mix(in srgb, var(--catcher) 35%, #251b2b), #251b2b);
  box-shadow: 0 0 20px color-mix(in srgb, var(--catcher) 60%, transparent);
}
.jackpot-big-win strong { color: #ffdf8f; font-size: 1.2rem; }
.jackpot-sparkles { margin-left: auto; flex: 0 0 auto; font-size: .86rem; color: #ffd98d; letter-spacing: .14em; }
.jackpot-big-win .jackpot-sparkles { font-size: 1.25rem; animation: jackpot-sparks .8s ease-out; }
@keyframes jackpot-reveal { from { transform: translateY(6px); opacity: .35; } }
@keyframes jackpot-sparks { from { transform: translateX(-10px) scale(.5); opacity: .2; } }
.jackpot-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 700px) {
  .jackpot-shell {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: none;
    grid-template-areas: "header" "inventory" "prizes" "machine" "result" "controls";
    max-width: 500px; gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) max(11px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom)) max(11px, env(safe-area-inset-left));
  }
  .jackpot-header { padding: 2px 2px 8px; }
  .jackpot-card { min-height: 93px; }
  .jackpot-card-art .pet-art { max-height: 52px; width: 60px; }
  .jackpot-card-art .pet-art:not(:only-child) { width: 51px; max-width: 47%; }
  .jackpot-result small { font-size: .76rem; }
  .jackpot-win-art .pet-art { width: 46px; height: 46px; }
  .jackpot-sparkles { letter-spacing: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .jackpot-gear, .jackpot-kin-win, .jackpot-big-win .jackpot-sparkles { animation: none; }
}

/* Match the larger game controls on tablets/desktops; phone layouts keep their existing sizes. */
@media(min-width:621px) and (min-height:541px){
  .jackpot-controls{grid-template-columns:52px minmax(0,1fr) 52px}
  #jackpot-dialog .jackpot-controls button{min-height:52px}
}


.jackpot-rule { flex-basis: 100%; color: #dec4a8; font-size: .76rem; }

/* Pop feedback follows recorded collision times; no idle flashing or extra sound. */
.jackpot-bumper-flash { fill: none; stroke: #b6fff2; stroke-width: 3; }
