
:root {
  color-scheme: dark;
  --bg: #08050f;
  --gold: #ffd45e;
  --purple: #6d20bb;
  --cell-size: 100px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body {
  min-height: 100svh;
  overflow-x: hidden;
  color: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% 42%, rgba(103, 31, 159, .30), transparent 43%),
    radial-gradient(circle at 50% 14%, rgba(255, 203, 86, .08), transparent 32%),
    #08050f;
}
button { font: inherit; }
.daily-spin-app {
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
}
.prototype-hud {
  width: min(97vw, 1120px);
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  position: relative;
  z-index: 20;
}
.hud-item, .hud-status {
  min-width: 126px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 214, 91, .48);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(60, 24, 101, .97), rgba(24, 10, 43, .97));
  box-shadow: 0 8px 24px rgba(0,0,0,.30), inset 0 1px rgba(255,255,255,.08);
  display: grid;
  gap: 1px;
}
.hud-item span, .hud-status span {
  color: #dfd1ed;
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.hud-item strong, .hud-status strong {
  color: #fff3b6;
  font-size: 18px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hud-status { min-width: 180px; }
.sound-toggle {
  min-width: 72px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 214, 91, .48);
  border-radius: 12px;
  color: #fff3b6;
  background: linear-gradient(180deg, rgba(60, 24, 101, .97), rgba(24, 10, 43, .97));
  box-shadow: 0 8px 24px rgba(0,0,0,.30), inset 0 1px rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.sound-toggle span { font-size: 18px; line-height: 1; }
.sound-toggle strong { font-size: 10px; letter-spacing: .08em; }
.sound-toggle[aria-pressed="false"] { opacity: .62; filter: grayscale(.35); }
.sound-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.machine-wrap { width: 100%; display: grid; place-items: center; }
.machine-stage {
  position: relative;
  width: min(98vw, calc(80svh * 1.56886), 1280px);
  aspect-ratio: 1310 / 835;
  overflow: hidden;
  user-select: none;
  filter: drop-shadow(0 20px 34px rgba(0,0,0,.55));
  opacity: 0;
  transition: opacity .18s ease;
}
.machine-stage.assets-ready { opacity: 1; }
.machine-base, .lever-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  -webkit-user-drag: none;
}
.machine-base { z-index: 1; }
.lever-layer { z-index: 5; }
.reel-window {
  position: absolute;
  left: 16.34%;
  top: 34.85%;
  width: 67.18%;
  height: 48.02%;
  display: grid;
  grid-template-columns: 31.65% 34.175% 34.175%;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf8 0%, #eee5d7 52%, #faf6ed 100%);
  border: 0;
  border-radius: .35%;
  box-shadow: inset 0 0 18px rgba(43, 24, 12, .18), inset 0 1px 0 #fff;
  z-index: 3;
}
.reel {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: linear-gradient(90deg, rgba(82,44,17,.06), transparent 13%, transparent 87%, rgba(82,44,17,.06));
}
.reel + .reel {
  border-left: clamp(2px, .25vw, 5px) solid #2d170b;
  box-shadow: -2px 0 #dcae3e, -5px 0 rgba(54,20,4,.22);
}
.reel-track {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  will-change: transform;
  transform: translate3d(0,0,0);
}
.symbol-cell {
  width: 100%;
  height: var(--cell-size);
  display: grid;
  place-items: center;
  padding: 2.5% 10%;
  border-bottom: 1px solid rgba(74, 42, 17, .17);
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0));
}
.symbol-cell img {
  display: block;
  width: calc(var(--cell-size) * .94);
  height: calc(var(--cell-size) * .94);
  max-width: 72%;
  object-fit: contain;
  object-position: 50% 50%;
  filter: drop-shadow(0 5px 4px rgba(48,20,7,.24));
}
.reel:first-child .symbol-cell { padding-left: 15%; padding-right: 7%; }
.reel:last-child .symbol-cell { padding-left: 7%; padding-right: 15%; }
.payline {
  position: absolute;
  left: 0; right: 0; top: 33.333%; height: 33.334%;
  z-index: 8;
  pointer-events: none;
  border-top: 2px solid rgba(255, 202, 58, .65);
  border-bottom: 2px solid rgba(255, 202, 58, .65);
  background: linear-gradient(90deg, transparent, rgba(255,231,160,.06) 18%, rgba(255,237,185,.12) 50%, rgba(255,231,160,.06) 82%, transparent);
}
.reel.spinning .symbol-cell img { filter: blur(1.2px) drop-shadow(0 5px 4px rgba(48,20,7,.16)); }
.spin-hotspot {
  position: absolute;
  left: 37.1%; top: 86.0%; width: 25.3%; height: 12.2%;
  z-index: 9;
  border: 0;
  border-radius: 38%;
  background: transparent;
  cursor: pointer;
}
.spin-hotspot:not(:disabled):hover { box-shadow: 0 0 28px rgba(255,222,111,.56), inset 0 0 18px rgba(255,255,255,.18); }
.spin-hotspot:not(:disabled):active { transform: translateY(1px) scale(.985); }
.spin-hotspot:disabled { cursor: not-allowed; }
.lever-hotspot {
  position: absolute;
  right: 0;
  top: 23%;
  width: 12%;
  height: 69%;
  z-index: 10;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.spin-hotspot:focus-visible, .lever-hotspot:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.machine-stage.is-spinning .spin-hotspot, .machine-stage.is-spinning .lever-hotspot { pointer-events: none; }
.machine-stage.denied { animation: deny .38s ease; }
@keyframes deny { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.loading-card, .load-error {
  position: fixed;
  z-index: 50;
  left: 50%; top: 50%; transform: translate(-50%,-50%);
  padding: 12px 18px;
  border-radius: 13px;
  border: 1px solid rgba(255,214,91,.55);
  background: rgba(20,8,36,.94);
  color: #fff1b2;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}
.load-error { color: #ffd2d2; border-color: #ff7785; max-width: 520px; text-align: center; }
.reward-panel {
  width: min(92vw, 590px);
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translate(-50%, 130%);
  z-index: 30;
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid #e8b83e;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(89,27,142,.98), rgba(29,10,52,.98));
  box-shadow: 0 18px 60px rgba(0,0,0,.55), 0 0 34px rgba(214,144,255,.25);
  transition: transform .45s cubic-bezier(.2,.9,.25,1.2);
}
.reward-panel.show { transform: translate(-50%, 0); }
.reward-panel img { width: 68px; height: 68px; object-fit: contain; }
.reward-panel div { display: grid; gap: 2px; }
.reward-panel span { font-size: 11px; letter-spacing: .14em; color: #e9cfff; }
.reward-panel strong { font-size: 24px; color: #fff0a8; }
.reward-panel small { color: #e8ddec; }
.reward-panel button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.24); color: #fff; background: rgba(0,0,0,.25); cursor: pointer; }
.debug-panel { position: fixed; right: 10px; bottom: 10px; z-index: 40; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.84); display: flex; gap: 6px; align-items: center; }
.debug-panel button { border: 0; border-radius: 7px; padding: 6px 9px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-height: 620px) and (orientation: landscape) {
  .daily-spin-app { gap: 2px; padding-block: 2px; }
  .prototype-hud { position: fixed; top: 4px; left: 4px; width: auto; justify-content: flex-start; pointer-events: none; }
  .hud-item { display: none; }
  .sound-toggle { min-width: 48px; padding: 4px 7px; }
  .sound-toggle strong { display: none; }
  .hud-status { min-width: 142px; padding: 4px 8px; background: rgba(24,10,43,.88); }
  .hud-status span { font-size: 9px; }
  .hud-status strong { font-size: 14px; }
  .machine-stage { width: min(99vw, calc(98svh * 1.56886)); }
}
@media (max-width: 700px) and (orientation: portrait) {
  .machine-stage { width: 98vw; }
  .prototype-hud { gap: 5px; }
  .hud-item { min-width: 102px; padding: 5px 8px; }
  .hud-status { min-width: 150px; }
  .hud-item strong, .hud-status strong { font-size: 15px; }
}
