@font-face {
  font-family: "Yellowtail Brush";
  src: url("yellowtail-brush.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit Clean";
  src: url("outfit-clean.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --gold: #ffd700;
  --gold-deep: #c9a400;
  --clover: #006400;
  --ink: #14361c;
  --moss: #1f5a2c;
  --line: rgba(0, 100, 0, 0.14);
  --shadow: 0 12px 28px rgba(0, 100, 0, 0.08);
}

* {
  box-sizing: border-box;
  text-decoration: none !important;
  text-decoration-line: none !important;
  text-decoration-color: transparent !important;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #ffffff;
}

body {
  min-height: 100dvh;
  font-family: "Outfit Clean", sans-serif;
  color: var(--ink);
  background: #ffffff url("linen-meadow.jpg") center / cover no-repeat fixed;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  text-size-adjust: 100%;
}

button,
input,
a,
p,
h1,
h2,
h3,
span,
small,
strong,
label,
em {
  text-decoration: none;
  text-decoration-line: none;
  text-decoration-color: transparent;
}

button,
input {
  font-family: inherit;
  outline: none;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
.switch input:focus-visible + span {
  outline: 3px solid var(--clover);
  outline-offset: 3px;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
.wheel-name,
.eyebrow {
  font-family: "Yellowtail Brush", cursive;
  font-weight: 400;
  color: var(--clover);
  line-height: 1.15;
  margin: 0;
  padding: 0.08em 0 0.02em;
  text-decoration: none;
}

.stage {
  width: min(100%, 560px);
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--paper);
}

.screen > * {
  min-width: 0;
}

.screen.on {
  display: flex;
  animation: rise 0.38s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 62px;
  padding: max(12px, env(safe-area-inset-top)) 16px 8px;
  flex: 0 0 auto;
}

.seal {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.balance {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  color: var(--clover);
  font-weight: 800;
}

.balance img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.ghost {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--clover);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
  font-size: 0.95rem;
}

.cta {
  appearance: none;
  border: 0;
  background: var(--gold);
  color: var(--clover);
  font-weight: 800;
  font-size: 1.05rem;
  border-radius: 999px;
  min-height: 54px;
  padding: 0 22px;
  box-shadow: 0 7px 0 var(--gold-deep);
}

.cta:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--gold-deep);
}

.cta:disabled {
  opacity: 0.72;
  transform: none;
}

.cta.poor,
.cta.maxed {
  background: var(--paper);
  box-shadow: none;
  border: 2px solid var(--line);
}

.home {
  background: #ffffff url("linen-meadow.jpg") center / cover no-repeat;
}

.home-hero {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 20px 4px;
}

.mascot {
  width: min(28vw, 120px);
  height: auto;
  animation: bob 2.6s ease-in-out infinite;
}

.home-hero h1 {
  font-size: clamp(2.35rem, 10vw, 3.9rem);
  max-width: 100%;
  padding-inline: 0.12em;
  text-align: center;
  overflow-wrap: break-word;
}

.home-hero p,
.lead,
.copy,
.help p,
.last-line,
#lastPrize,
#aimHint,
.offer p,
.row small,
.empty p {
  text-decoration: none;
}

.home-hero p {
  margin: 4px 0 0;
  color: var(--moss);
  font-weight: 700;
  font-size: 1.05rem;
}

.menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 8px 16px max(18px, env(safe-area-inset-bottom));
}

.menu button {
  appearance: none;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 22px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--clover);
  font-weight: 800;
  font-size: clamp(1rem, 3.6vw, 1.15rem);
  box-shadow: var(--shadow);
}

.menu button img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.menu button.primary {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 8px 0 var(--gold-deep);
}

.intro {
  background: #ffffff;
}

.wash {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 0;
  transition: opacity 0.55s ease;
  z-index: 0;
}

.wash.on { opacity: 1; }
.wash.meadow { background-image: url("linen-meadow.jpg"); }
.wash.spark { background-image: url("spark-cloverfield.jpg"); }
.wash.citrus { background-image: url("citrus-canopy.jpg"); }

.skip {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.92);
}

.intro-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.orbit,
.hero,
.tally,
.burst {
  position: absolute;
  left: 50%;
  top: 46%;
}

.orbit {
  width: min(78vw, 360px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.orbit img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  object-fit: contain;
  --r: clamp(78px, 22vw, 124px);
  animation: orbitSpin 16s linear infinite;
}

@keyframes orbitSpin {
  from { transform: rotate(var(--a)) translateY(calc(var(--r) * -1)) rotate(calc(var(--a) * -1)); }
  to { transform: rotate(calc(var(--a) + 360deg)) translateY(calc(var(--r) * -1)) rotate(calc((var(--a) + 360deg) * -1)); }
}

.hero {
  width: min(30vw, 124px);
  z-index: 2;
  animation: heroBob 2.4s ease-in-out infinite;
}

.intro[data-scene="win"] .hero {
  width: min(54vw, 240px);
}

.rain {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  display: none;
}

.rain img {
  position: absolute;
  top: -18%;
  width: 46px;
  height: 46px;
  object-fit: contain;
  animation: fall linear infinite;
}

@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  14% { opacity: 1; }
  100% { transform: translateY(108vh) rotate(70deg); opacity: 0.15; }
}

.tally {
  top: 20%;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: clamp(2.6rem, 12vw, 4.2rem);
  color: var(--clover);
  margin: 0;
  z-index: 2;
  display: none;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  padding: 2px 18px 6px;
  box-shadow: 0 8px 22px rgba(0, 100, 0, 0.1);
}

.burst {
  width: min(70vw, 300px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: none;
  pointer-events: none;
}

.burst i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(0, 100, 0, 0.15);
  animation: spark 1.5s ease-in-out infinite;
}

.burst i:nth-child(1) { --x: -90px; --y: -30px; animation-delay: 0s; }
.burst i:nth-child(2) { --x: 86px; --y: -24px; animation-delay: 0.1s; }
.burst i:nth-child(3) { --x: -40px; --y: -96px; animation-delay: 0.2s; }
.burst i:nth-child(4) { --x: 48px; --y: -100px; animation-delay: 0.15s; }
.burst i:nth-child(5) { --x: -110px; --y: 36px; animation-delay: 0.25s; }
.burst i:nth-child(6) { --x: 112px; --y: 28px; animation-delay: 0.05s; }
.burst i:nth-child(7) { --x: -20px; --y: 90px; animation-delay: 0.3s; }
.burst i:nth-child(8) { --x: 24px; --y: 96px; animation-delay: 0.18s; }

@keyframes spark {
  0%, 100% { transform: translate(-50%, -50%) scale(0.3); opacity: 0.15; }
  50% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1); opacity: 1; }
}

.intro[data-scene="collect"] .orbit,
.intro[data-scene="collect"] .hero,
.intro[data-scene="collect"] .burst,
.intro[data-scene="win"] .orbit,
.intro[data-scene="win"] .tally,
.intro[data-scene="choose"] .tally,
.intro[data-scene="choose"] .burst,
.intro[data-scene="choose"] .rain {
  display: none;
}

.intro[data-scene="collect"] .rain,
.intro[data-scene="collect"] .tally,
.intro[data-scene="win"] .burst {
  display: block;
}

.intro-card {
  position: relative;
  z-index: 2;
  width: calc(100% - 28px);
  max-width: calc(100% - 28px);
  margin: 0 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-radius: 28px;
  padding: 16px 18px 16px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 100, 0, 0.12);
}

.eyebrow {
  font-size: 1.35rem;
  margin-bottom: 2px;
}

.intro-card h1 {
  font-size: clamp(1.95rem, 7.6vw, 2.75rem);
  line-height: 1.18;
  padding-inline: 0.18em;
}

.copy {
  margin: 6px 0 0;
  color: var(--moss);
  font-weight: 650;
  font-size: 0.98rem;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.petals {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}

.petals img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0.28;
}

.petals img.on { opacity: 1; }

.intro-card .cta { width: 100%; }

.swap h1,
.swap .copy {
  animation: titleIn 0.48s ease;
}

@keyframes titleIn {
  from { opacity: 0; transform: translateY(10px) rotate(-2deg); }
  to { opacity: 1; transform: none; }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes heroBob {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, calc(-50% - 10px)); }
}

.play {
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255, 215, 0, 0.2), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f4fff6 70%, #fff8dc 100%);
}

.combo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px;
  flex: 0 0 auto;
}

#comboPill {
  background: var(--clover);
  color: #ffffff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

#aimHint {
  color: var(--moss);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: right;
  line-height: 1.25;
}

.wheel-name {
  text-align: center;
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  margin: 0;
  flex: 0 0 auto;
}

.stat {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 16px;
  min-width: 74px;
  text-align: center;
  padding: 3px 8px 4px;
}

.stat small {
  display: block;
  color: var(--moss);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat strong {
  color: var(--clover);
  font-size: 1.15rem;
  font-weight: 800;
}

.wheel-box {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 10px;
}

.wheel-sizer {
  position: relative;
  width: min(92%, 450px, calc(100dvh - 292px));
  aspect-ratio: 1;
}

.pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: 0;
  height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 24px solid var(--clover);
  filter: drop-shadow(0 3px 0 var(--gold));
}

.scia {
  position: absolute;
  inset: -7%;
  width: 114%;
  height: 114%;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
}

.scia circle {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid var(--clover);
  box-shadow: 0 0 0 6px var(--gold), 0 16px 34px rgba(0, 100, 0, 0.16);
  overflow: hidden;
  will-change: transform;
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 215, 0, 0.85);
  z-index: 3;
  pointer-events: none;
}

.glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255, 215, 0, 0.62) 0deg 45deg, transparent 45deg 360deg);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
}

.slice-icon {
  position: absolute;
  width: 15%;
  height: 15%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
}

.slice-icon.bonus {
  width: 18%;
  height: 18%;
}

.hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border: 4px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  z-index: 4;
  box-shadow: 0 6px 16px rgba(0, 100, 0, 0.12);
}

.hub img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.pop {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  z-index: 7;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  color: var(--clover);
}

.pop.show { animation: floatPop 0.95s ease; }

.pop strong {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
}

.pop em,
.pop small {
  display: block;
  font-style: normal;
  font-weight: 800;
  font-size: 0.85rem;
}

@keyframes floatPop {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.92); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -26px) scale(1); }
}

.play-foot {
  flex: 0 0 auto;
  padding: 4px 16px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#lastPrize {
  margin: 0;
  text-align: center;
  color: var(--moss);
  font-weight: 750;
  min-height: 2.5em;
  line-height: 1.3;
}

.cta.big {
  width: 100%;
  font-size: 1.22rem;
  min-height: 58px;
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.shop,
.records,
.settings {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.94)),
    url("spark-cloverfield.jpg") center / cover no-repeat;
}

.settings {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.96)),
    url("linen-meadow.jpg") center / cover no-repeat;
}

.topbar h2 {
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  flex: 1;
  text-align: center;
}

.lead {
  margin: 0 16px 12px;
  color: var(--moss);
  font-weight: 700;
  line-height: 1.35;
}

.offer {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  margin: 0 16px 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.offer > img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.offer h3 {
  font-size: 1.85rem;
}

.offer p {
  margin: 2px 0 8px;
  color: var(--moss);
  font-weight: 650;
  font-size: 0.94rem;
  line-height: 1.35;
}

.pips {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.pips i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #e6eee6;
  display: block;
}

.pips i.on {
  background: var(--gold);
  box-shadow: inset 0 0 0 1.5px var(--clover);
}

.offer .cta {
  min-height: 44px;
  width: 100%;
  font-size: 0.95rem;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 16px 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid var(--line);
}

.rank {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3fff4;
  color: var(--clover);
  font-weight: 800;
  flex: 0 0 auto;
}

.row:first-child .rank { background: var(--gold); }
.row strong { display: block; color: var(--clover); font-size: 1.05rem; }
.row small { color: var(--moss); font-weight: 700; }

.empty {
  margin: 24px 20px;
  text-align: center;
  color: var(--moss);
  font-weight: 700;
}

.empty img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 12px auto 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 16px 10px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  border: 2px solid var(--line);
  font-weight: 800;
  color: var(--clover);
}

.switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #d5e4d6;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.switch input:checked + span { background: var(--clover); }
.switch input:checked + span::after {
  transform: translateX(20px);
  background: var(--gold);
}

.help {
  margin: 6px 16px 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid var(--line);
}

.help h3 { font-size: 1.9rem; }
.help p {
  margin: 4px 0 0;
  color: var(--moss);
  font-weight: 650;
  line-height: 1.4;
}

.danger {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 8px;
  min-height: 50px;
}

.modal {
  position: absolute;
  inset: 0;
  background: rgba(20, 54, 28, 0.38);
  display: grid;
  align-items: end;
  justify-content: center;
  z-index: 30;
  padding: 16px;
}

.modal[hidden] { display: none; }

.sheet {
  width: min(100%, 440px);
  background: #ffffff;
  border-radius: 24px;
  padding: 18px 16px 16px;
  margin-bottom: max(6px, env(safe-area-inset-bottom));
}

.sheet h3 { font-size: 2.1rem; }
.sheet p {
  color: var(--moss);
  font-weight: 700;
  line-height: 1.35;
}

.sheet-actions {
  display: flex;
  gap: 10px;
}

.sheet-actions .ghost,
.sheet-actions .cta {
  flex: 1;
}

.toast {
  position: absolute;
  left: 50%;
  top: max(74px, calc(env(safe-area-inset-top) + 66px));
  transform: translate(-50%, -12px);
  background: var(--clover);
  color: #ffffff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  max-width: calc(100% - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  transition: 0.25s ease;
}

@media (min-width: 760px) {
  .stage {
    width: min(92vw, 640px);
    height: min(100dvh, 980px);
    margin-top: max(0px, calc((100dvh - 980px) / 2));
    border-radius: 32px;
    box-shadow: 0 24px 60px rgba(0, 100, 0, 0.12);
  }
}

@media (max-width: 360px) {
  .menu { gap: 8px; }
  .menu button { min-height: 96px; }
  .menu button img { width: 42px; height: 42px; }
  .stat { min-width: 64px; padding-inline: 6px; }
  .orbit img { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
}

@media (max-height: 700px) {
  .home-hero h1 { font-size: clamp(2.2rem, 9vw, 3rem); }
  .mascot { width: 72px; }
  .menu button { min-height: 88px; }
  .intro-card { padding: 12px 14px; }
  .intro-card h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); }
  .wheel-name { font-size: 1.45rem; }
  .wheel-sizer { width: min(86%, 380px, calc(100dvh - 248px)); }
  .hero { top: 44%; }
}

@media (min-width: 900px) and (min-height: 800px) {
  .menu button { min-height: 140px; }
  .menu button img { width: 64px; height: 64px; }
  .wheel-sizer { width: min(78%, 470px, calc(100dvh - 300px)); }
}

@media (prefers-reduced-motion: reduce) {
  .orbit img,
  .rain img,
  .burst i,
  .mascot,
  .hero,
  .screen.on,
  .swap h1,
  .swap .copy {
    animation: none;
  }
}
