body { margin: 0; background: #08141a; font-family: 'Figtree', system-ui, sans-serif; }

.jar-game { position: relative; width: 100%; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: radial-gradient(120% 90% at 50% 0%, #10222c 0%, #08141a 60%); color: #f9f9fb; overflow: hidden; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.brand { font: 800 21px 'Red Hat Display', 'Figtree', system-ui, sans-serif; letter-spacing: .04em; color: #f9f9fb; white-space: nowrap; }
.brand span { color: #f5b301; text-shadow: 0 0 14px rgba(245, 179, 1, .45); }
.head-right { display: flex; align-items: center; gap: 8px; }
.last { font: 700 15px 'Red Hat Display', 'Figtree', system-ui, sans-serif; color: #8f96a8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.last.win { color: #f5b301; }
.snd { width: 28px; height: 26px; border-radius: 8px; border: 1px solid #2c2c38; background: #14141c; font-size: 13px; line-height: 1; cursor: pointer; padding: 0; }

.stage { flex: 1; min-height: 0; display: flex; gap: 12px; }
.board-wrap { flex: 1; min-width: 0; display: grid; place-items: center; }
canvas { display: block; }

.rail { width: 172px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.miner { width: 128px; height: 172px; object-fit: cover; object-position: 50% 18%; border-radius: 14px; border: 1px solid rgba(245, 179, 1, .55); box-shadow: 0 0 18px rgba(245, 179, 1, .22); }
.miner.cheer { animation: cheer .45s ease-in-out 3; }
@keyframes cheer { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-12px) rotate(-2.5deg); } 65% { transform: translateY(-4px) rotate(2deg); } }

.jar { display: grid; justify-items: center; gap: 3px; }
.jar-lid { width: 74px; height: 10px; border-radius: 5px; background: linear-gradient(#8a5a10, #5d3d0a); border: 1px solid #c99a2e; z-index: 2; }
.jar-glass { position: relative; width: 104px; height: 148px; margin-top: -4px; border: 3px solid rgba(200, 220, 235, .55); border-radius: 12px 12px 22px 22px; overflow: hidden; display: flex; align-items: flex-end; background: linear-gradient(160deg, rgba(160, 200, 225, .10), rgba(13, 42, 56, .55)); box-shadow: inset 0 0 22px rgba(160, 200, 225, .12); }
.jar-fill { width: 100%; height: 0; background: linear-gradient(#ffdf6b, #f5b301 55%, #c07f02); transition: height .5s ease; box-shadow: 0 0 18px rgba(245, 179, 1, .5); }
.jar-shine { position: absolute; top: 8px; left: 10px; width: 16px; height: 62%; border-radius: 8px; background: linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, 0)); pointer-events: none; }
.jar.full .jar-glass { border-color: #f5b301; animation: jarshake .5s ease-in-out 2; }
@keyframes jarshake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3.5deg) scale(1.04); } 60% { transform: rotate(3deg) scale(1.06); } }
.jar-text { font: 800 15px 'Red Hat Display', 'Figtree', system-ui, sans-serif; color: #f5b301; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.jar-sub { font-size: 11.5px; font-weight: 600; color: #9b9bab; text-align: center; font-variant-numeric: tabular-nums; max-width: 168px; }

.winpop { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); z-index: 30; min-width: 150px; padding: 14px 20px 12px; border-radius: 14px; text-align: center; background: linear-gradient(165deg, #123a1e, #0a2413); border: 1px solid #2fbf71; box-shadow: 0 12px 44px rgba(0, 0, 0, .6), 0 0 22px rgba(47, 191, 113, .25); animation: pop .28s cubic-bezier(.2, 1.6, .4, 1); pointer-events: none; }
.winpop.burst { background: linear-gradient(165deg, #4a3205, #241a02); border-color: #f5b301; box-shadow: 0 12px 44px rgba(0, 0, 0, .65), 0 0 34px rgba(245, 179, 1, .5); }
.winpop-title { font: 800 12px 'Red Hat Display', 'Figtree', system-ui, sans-serif; letter-spacing: .22em; color: #c9f5da; }
.winpop.burst .winpop-title { color: #ffe9a8; }
.winpop-x { font: 800 34px/1.15 'Red Hat Display', 'Figtree', system-ui, sans-serif; color: #fff; font-variant-numeric: tabular-nums; }
.winpop-div { height: 1px; margin: 7px 4px; background: rgba(255, 255, 255, .25); }
.winpop-amt { font: 700 14px 'Figtree', system-ui, sans-serif; color: #ffe9a8; font-variant-numeric: tabular-nums; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.8); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

.burstfx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 25; }
.burstfx .spark { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: radial-gradient(circle, #ffe9a8, #f5b301 70%); animation: sparkfly 1.3s ease-out forwards; }
@keyframes sparkfly { to { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; } }

/* Phone: the shell stacks the panel under the zone — keep the zone
   inside the short 364×440 frame. */
@media (max-width: 699px) {
  hb-game::part(zone) { min-height: 0; }
  hb-game::part(panel) { gap: 2px; padding: 4px 8px; font-size: 12px; }
  .jar-game { gap: 5px; padding: 8px; }
  .brand { font-size: 16px; }
  .last { font-size: 12.5px; }
  .stage { gap: 7px; }
  .rail { width: 84px; gap: 4px; }
  .miner { width: 84px; height: 108px; border-radius: 10px; }
  .jar-lid { width: 46px; height: 8px; }
  .jar-glass { width: 62px; height: 96px; border-width: 2px; border-radius: 9px 9px 15px 15px; }
  .jar-text { font-size: 12px; }
  .jar-sub { font-size: 9.5px; max-width: 84px; }
  .winpop { min-width: 118px; padding: 10px 14px 9px; }
  .winpop-x { font-size: 25px; }
}

/* Short phone frame (364×440): shrink the rail further so board + jar fit. */
@media (max-width: 699px) and (max-height: 500px) {
  .jar-game { gap: 4px; padding: 6px 8px; }
  .head { min-height: 21px; }
  .brand { font-size: 14.5px; }
  .snd { width: 24px; height: 22px; font-size: 11px; }
  .miner { height: 76px; }
  .jar-glass { height: 74px; }
  .jar-sub { display: none; }
}
