@font-face { font-family: 'Pacifico'; src: url('fonts/Pacifico-subset.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'Luckiest Guy'; src: url('fonts/LuckiestGuy-subset.ttf') format('truetype'); font-display: block; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; user-select: none; -webkit-user-select: none;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; touch-action: manipulation; }
body {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, rgba(200,16,46,.85) 25%, transparent 25%, transparent 75%, rgba(200,16,46,.85) 75%),
    linear-gradient(45deg, rgba(200,16,46,.85) 25%, transparent 25%, transparent 75%, rgba(200,16,46,.85) 75%);
  background-size: 64px 64px; background-position: 0 0, 32px 32px;
}
#app { display: grid; grid-template-columns: 360px 1fr 410px; gap: 18px; height: 100vh; padding: 18px;
  padding-top: max(18px, env(safe-area-inset-top)); }
.panel { background: rgba(255, 250, 240, .96); border: 5px solid #8b1a10; border-radius: 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 14px; display: flex; flex-direction: column; }
#logo svg { width: 100%; height: auto; display: block; }
#rules { font-size: 15px; line-height: 1.3; color: #3b1d0f; flex: 1; overflow: hidden; }
#rules p { margin: 8px 0; }
#rules .fine { font-size: 12.5px; color: #6b4a33; font-style: italic; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meter { background: #1a1a1a; border: 3px solid #f0b862; border-radius: 12px; padding: 6px 10px; text-align: center; }
.meter span { display: block; color: #f0b862; font-size: 13px; font-weight: 700; letter-spacing: 1.5px; }
.meter b { display: block; color: #ff3b3b; font: 700 34px/1.1 "Courier New", monospace; text-shadow: 0 0 6px #f00; }
.meter.basket b { color: #7dff6b; text-shadow: 0 0 6px #2f2; }

#center { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-width: 0; padding: 14px;
  background: linear-gradient(#7a1410, #4a0a08); border: 5px solid #c9a24a; border-radius: 22px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
#message { background: #1d2a6b; color: #fff36b; border: 4px solid #f0b862; border-radius: 16px; text-align: center;
  font-size: 34px; font-weight: 800; padding: 22px 12px; min-height: 92px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
#reels-frame { position: relative; flex: none; background: linear-gradient(#3b0a0a, #6b1010); border: 8px solid #c9a24a;
  border-radius: 24px; padding: 18px; box-shadow: inset 0 0 30px #000, 0 8px 24px rgba(0,0,0,.4); }
#reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.reel { position: relative; overflow: hidden; aspect-ratio: 1 / 3.15; border-radius: 12px;
  background: linear-gradient(#d6d6d6 0%, #fff 12%, #fff 88%, #d6d6d6 100%); box-shadow: inset 0 0 18px rgba(0,0,0,.5); }
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.cell { display: flex; align-items: center; justify-content: center; border-bottom: 1px solid rgba(0,0,0,.08); }
.cell svg { width: 100%; height: 100%; padding: 6px 4px; }
.cell.hit { background: rgba(255, 243, 107, .55); }
#payline { position: absolute; left: 6px; right: 6px; top: 50%; height: 4px; margin-top: -2px; background: #ff2a2a;
  box-shadow: 0 0 8px #f00; pointer-events: none; }
#buttons { display: grid; grid-template-columns: .9fr 1fr 1fr 1.5fr; gap: 12px; }
.btn { min-height: 140px; border-radius: 20px; border: 4px solid #5c0d06; font-size: 26px; font-weight: 900;
  color: #fff; background: linear-gradient(#ff5a4a, #b3121f); box-shadow: 0 6px 0 #5c0d06, 0 10px 18px rgba(0,0,0,.4);
  letter-spacing: 1px; cursor: pointer; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #5c0d06; }
.btn.small { font-size: 17px; background: linear-gradient(#777, #333); border-color: #222; box-shadow: 0 6px 0 #111; }
.btn.spin { font-size: 40px; background: linear-gradient(#ffe36b, #e89a12); color: #5c0d06; border-color: #8a5400;
  box-shadow: 0 6px 0 #8a5400, 0 10px 18px rgba(0,0,0,.4); }
.btn:disabled { opacity: .5; }
.btn.spin.stopping { background: linear-gradient(#ff6b5a, #c4141f); color: #fff; border-color: #6a0b08; box-shadow: 0 6px 0 #6a0b08, 0 10px 18px rgba(0,0,0,.4); }

#right { align-items: center; gap: 8px; }
#pie { width: 100%; }
#pie svg { width: 100%; height: auto; display: block; }
#pie-reels { position: relative; width: 100%; height: 16px; margin-top: -4px; font-size: 12px; letter-spacing: .5px; color: #7a5a40; opacity: .8; }
#pie-reels span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
#paytable { width: 100%; border-collapse: collapse; font-size: 16px; margin-top: 6px; color: #3b1d0f; }
#paytable th { background: #8b1a10; color: #fff; padding: 3px 6px; font-size: 13px; }
#paytable td { padding: 4px 6px; border-bottom: 1px solid #e3cfae; text-align: right; }
#paytable td:first-child { text-align: left; }
#paytable tr.lit td { background: #fff36b; font-weight: 700; }
#paytable col.active { background: rgba(255, 220, 120, .35); }
#rotate { display: none; position: fixed; inset: 0; background: #b3121f; color: #fff; font-size: 32px;
  align-items: center; justify-content: center; text-align: center; padding: 40px; }
@media (orientation: portrait) { #rotate { display: flex; } }

#toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: auto; }
.toggle { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 64px; padding: 0 6px; border-radius: 16px;
  border: 3px solid #5c0d06; background: linear-gradient(#ff5a4a, #b3121f); color: #fff; font: 800 14px/1.05 -apple-system, Arial, sans-serif;
  letter-spacing: 1px; box-shadow: 0 5px 0 #5c0d06; cursor: pointer; }
.toggle:active { transform: translateY(3px); box-shadow: 0 2px 0 #5c0d06; }
.toggle svg { width: 24px; height: 24px; flex: none; }
.toggle .slash { display: none; }
.toggle.off { background: linear-gradient(#777, #333); border-color: #222; box-shadow: 0 5px 0 #111; color: #ddd; }
.toggle.off .slash { display: inline; } .toggle.off .wave { display: none; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.flyer { position: absolute; left: 0; top: 0; opacity: 0; width: 40px; height: 40px; filter: drop-shadow(0 3px 3px rgba(0,0,0,.45)); }
.flyer svg { width: 100%; height: 100%; }
.meter.rolling { box-shadow: 0 0 18px #fff36b; border-color: #fff36b; }
.meter.bump { animation: bump .4s ease-out; }
@keyframes bump { 40% { transform: scale(1.12); } }
#pie.munching svg { animation: wobble .35s ease-in-out infinite; }
@keyframes wobble { 50% { transform: scale(.96) rotate(-2deg); } }

/* --- full version: canvas reels, pack pie, overlays --- */
#reels-frame { display: flex; justify-content: center; align-items: center; }
#reels { display: block; height: auto; }
#pie { width: 100%; aspect-ratio: 1 / 1; position: relative; }
#pie > svg { width: 100%; height: 100%; }
#toggles { grid-template-columns: 1fr 1fr 1fr; }
.toggle.pays { background: linear-gradient(#3b4fb0, #1d2a6b); border-color: #0d1540; box-shadow: 0 5px 0 #0d1540; }
#overlay { position: fixed; inset: 0; z-index: 80; display: none; background: rgba(20, 4, 4, .82); padding: 30px; }
#overlay.open { display: flex; align-items: center; justify-content: center; }
#overlay .sheet { position: relative; width: 1100px; max-width: 100%; max-height: 100%; overflow: auto; background: #fffaf0;
  border: 6px solid #8b1a10; border-radius: 24px; padding: 26px 34px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px;
  color: #3b1d0f; font-size: 19px; line-height: 1.4; }
#overlay h2 { margin: 0 0 10px; color: #b3121f; font: italic 700 34px Georgia, serif; }
#overlay table { width: 100%; border-collapse: collapse; font-size: 19px; }
#overlay th { background: #8b1a10; color: #fff; padding: 6px; } #overlay td { padding: 6px 8px; border-bottom: 1px solid #e3cfae; text-align: right; }
#overlay td:first-child { text-align: left; }
#overlay .sym { display: inline-block; width: 40px; height: 40px; vertical-align: middle; margin-right: 6px; }
#overlay .sym svg { width: 100%; height: 100%; }
#btn-close { position: absolute; top: 14px; right: 14px; width: 64px; height: 64px; border-radius: 50%; font-size: 30px; font-weight: 900;
  border: 4px solid #5c0d06; background: linear-gradient(#ff5a4a, #b3121f); color: #fff; cursor: pointer; }
#attract { position: fixed; inset: 0; z-index: 70; display: none; cursor: pointer; }
#attract.on { display: block; }
#attract .tap { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); background: rgba(29, 42, 107, .92);
  color: #fff36b; border: 5px solid #f0b862; border-radius: 26px; padding: 26px 50px; font: 900 54px/1 -apple-system, Arial, sans-serif;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: tapPulse 1.6s ease-in-out infinite; white-space: nowrap; }
@keyframes tapPulse { 50% { transform: translate(-50%, -50%) scale(1.06); } }
#reels-frame.shimmer::after { content: ''; position: absolute; inset: 0; border-radius: 16px; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); background-size: 250% 100%;
  animation: shimmer 2.8s linear infinite; }
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -130% 0; } }
@media (prefers-reduced-motion: reduce) {
  #attract .tap, #reels-frame.shimmer::after, #pie.munching svg, .meter.bump { animation: none !important; }
  #reels-frame.shimmer::after { background: rgba(255,255,255,.12); }
}
html.rm #attract .tap, html.rm #reels-frame.shimmer::after { animation: none !important; }
/* v6: PAYS sheet follows the stage scale (js/fit.js sets --stage-scale) so it fits smaller iPads like it fits 1366x1024 */
#overlay { padding: calc(30px * var(--stage-scale, 1)); }
#overlay .sheet { flex: none; transform: scale(var(--stage-scale, 1)); transform-origin: center;
  max-width: calc(100vw / var(--stage-scale, 1) - 60px); max-height: calc(100vh / var(--stage-scale, 1) - 60px); }
/* v6: shown only while audio isn't running (iOS needs a tap; also after a phone call / Siri interruption) */
#sound-hint { position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70;
  display: none; pointer-events: none; white-space: nowrap; background: rgba(29, 42, 107, .92); color: #fff36b; border: 2px solid #f0b862;
  border-radius: 999px; padding: 6px 16px; font: 700 15px/1.2 -apple-system, Arial, sans-serif; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
#sound-hint.show { display: block; }
/* v7: picnic basket replaces the BASKET meter. Pie shrinks to 80% (right), basket tucked at its lower-left like the original. */
.meters { grid-template-columns: 1fr 1fr; }
.meters .meter:first-child { grid-column: span 2; }
#pie-reels { width: 80%; margin-left: auto; margin-top: 0; margin-bottom: -2px; }
#pie-area { position: relative; width: 100%; padding-bottom: 122px; }
#pie-area #pie { width: 80%; margin-left: auto; }
#basket-wrap { position: absolute; left: -8px; bottom: 0; width: 54%; aspect-ratio: 248 / 196; }
#basket-wrap .basket-art, #basket-wrap svg { width: 100%; height: 100%; display: block; }
#basket-wrap .bc { opacity: 0; transition: opacity .25s; }
#basket-wrap .bc.on { opacity: 1; }
#basket-wrap .basket-num { position: absolute; left: 32.3%; width: 33.9%; top: 56.1%; height: 23.5%; display: flex; align-items: center;
  justify-content: center; overflow: hidden; white-space: nowrap; color: #7dff6b; text-shadow: 0 0 6px #2f2; font: 700 30px/1 "Courier New", monospace; }
#basket-wrap.land { animation: basketLand .32s ease-out; }
@keyframes basketLand { 30% { transform: translateY(3px) scaleY(.96); } 70% { transform: translateY(-1px); } }
#basket-wrap .basket-num.tick { color: #fff36b; text-shadow: 0 0 8px #ff0; }
.flyer.spill { z-index: 2; filter: drop-shadow(0 0 5px #fff36b) drop-shadow(0 3px 3px rgba(0,0,0,.45)); }
html.rm #basket-wrap.land { animation: none; }
@media (prefers-reduced-motion: reduce) { #basket-wrap.land { animation: none; } #basket-wrap .bc { transition: none; } }
