@font-face {
  font-family: "Fraunces Soft";
  src: url("fraunces-soft.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --gold: #FFD700;
  --leaf: #2E7D32;
  --leaf-deep: #1B5E20;
  --ink: #17301C;
  --cream: #FFFDF7;
  --muted: #4E6A52;
  --shadow: 0 12px 30px rgba(23, 48, 28, 0.12);
  --font-display: "Fraunces Soft", "Iowan Old Style", Palatino, serif;
  --font-ui: "Outfit Clean", "Avenir Next", "Trebuchet MS", sans-serif;
  --grove-image: url("sunleaf-canopy.webp");
  color-scheme: light;
}

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

*::before,
*::after {
  text-decoration: none;
}

::spelling-error,
::grammar-error {
  text-decoration: none;
  background: transparent;
  color: inherit;
}

::selection {
  background: #2E7D32;
  color: #FFFFFF;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: var(--ink);
  background: #12301c;
  user-select: none;
  -webkit-user-select: none;
}

button,
input {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
}

input {
  user-select: text;
  -webkit-user-select: text;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid #1B5E20;
  outline-offset: 3px;
}

img {
  display: block;
  border: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--leaf-deep);
}

.shell {
  height: 100dvh;
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.shell-wash {
  position: absolute;
  inset: -24px;
  background-image: var(--grove-image);
  background-size: cover;
  background-position: center;
  filter: blur(16px) saturate(1.05);
  transform: scale(1.06);
}

.stage {
  width: min(100%, 560px);
  height: 100dvh;
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: var(--cream);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream);
}

.screen.on {
  display: flex;
}

#home,
#intro,
#play {
  background-image: var(--grove-image);
  background-size: cover;
  background-position: center;
}

.kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  background: var(--gold);
  color: var(--leaf-deep);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.solid,
.ghost,
.quiet,
.menu-btn {
  border-radius: 16px;
  min-height: 52px;
  padding: 0 16px;
  font-weight: 650;
  letter-spacing: 0;
}

.solid {
  background: linear-gradient(180deg, #388E3C, #2E7D32);
  color: #FFFFFF;
  box-shadow: 0 10px 18px rgba(46, 125, 50, 0.24);
}

.ghost {
  background: #FFFFFF;
  color: var(--leaf-deep);
  box-shadow: inset 0 0 0 1.5px rgba(46, 125, 50, 0.28);
}

.quiet {
  background: transparent;
  color: var(--leaf-deep);
  min-height: 44px;
}

.danger {
  background: linear-gradient(180deg, #A14B42, #8E3B32);
  box-shadow: none;
}

.action-row,
.stack {
  display: flex;
  gap: 10px;
}

.action-row .solid,
.stack .solid,
.stack .ghost {
  flex: 1;
}

.stack {
  flex-direction: column;
}

.purse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--leaf-deep);
  border-radius: 999px;
  padding: 6px 10px 6px 6px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

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

.intro-art {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  overflow: hidden;
}

.corner-leaf {
  position: absolute;
  width: min(34vw, 150px);
  pointer-events: none;
  filter: drop-shadow(0 10px 12px rgba(23, 48, 28, 0.16));
}

.leaf-nw {
  top: -8px;
  left: -18px;
  transform: rotate(-18deg);
}

.leaf-se {
  right: -24px;
  bottom: -6px;
  transform: rotate(150deg);
  width: min(28vw, 120px);
}

.orbit-slot {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(74vw, 290px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}

.step-coins .orbit-slot,
.step-win .orbit-slot {
  opacity: 1;
}

.spin-slow,
.spin-fast {
  position: absolute;
  inset: 0;
  animation: reel 9s linear infinite;
}

.spin-fast {
  animation-duration: 6.4s;
  animation-direction: reverse;
}

.spin-slow img,
.spin-fast img {
  position: absolute;
  width: 23%;
  left: 50%;
  top: 0;
  transform: translate(-50%, -10%);
}

.spin-fast img {
  width: 16%;
  top: auto;
  bottom: 4%;
}

.banana-anchor {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(46vw, 210px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease;
  z-index: 1;
}

.step-win .banana-anchor {
  width: min(34vw, 160px);
}

.spin-piece {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: spin 7s linear infinite;
  filter: drop-shadow(0 16px 16px rgba(23, 48, 28, 0.18));
}

.win-star,
.win-cup {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.win-star {
  width: 72px;
  right: 14%;
  top: 16%;
  transform: scale(0.7);
}

.win-cup {
  width: 96px;
  left: 10%;
  bottom: 6%;
  transform: translateY(16px);
}

.step-win .win-star,
.step-win .win-cup {
  opacity: 1;
  transform: none;
  transition: opacity 0.4s ease, transform 0.45s ease;
}

.intro-sheet {
  position: relative;
  z-index: 2;
  background: rgba(255, 253, 247, 0.96);
  border-radius: 28px 28px 0 0;
  padding: 20px 18px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 -12px 30px rgba(23, 48, 28, 0.08);
}

.intro-sheet h1 {
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  line-height: 1.02;
  margin-top: 8px;
}

.dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: rgba(46, 125, 50, 0.25);
}

.dots i.on {
  width: 22px;
  background: var(--leaf);
}

.rise {
  animation: rise 0.45s ease;
}

.home-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.72), rgba(255, 253, 247, 0.9) 30%, rgba(255, 248, 220, 0.94));
}

.home-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(16px + env(safe-area-inset-bottom));
}

.home-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.home-top h1 {
  font-size: clamp(1.8rem, 8vw, 3rem);
  line-height: 0.95;
  margin: 8px 0 6px;
}

.best-line {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.hero {
  position: relative;
  flex: 1 1 auto;
  min-height: 150px;
  display: grid;
  place-items: center;
}

.hero-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(52vw, 230px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.hero-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(46, 125, 50, 0.28);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 215, 0, 0.18) 62%, transparent 63%);
  animation: reel 22s linear infinite;
}

.hero-banana {
  width: min(42vw, 190px);
  position: relative;
  z-index: 1;
  animation: spin 9s linear infinite;
  filter: drop-shadow(0 16px 14px rgba(23, 48, 28, 0.16));
}

.hero-coin {
  position: absolute;
  width: 54px;
  right: 14%;
  top: 18%;
  animation: floaty 3.2s ease-in-out infinite;
}

.hero-leaf {
  position: absolute;
  width: 78px;
  left: 10%;
  bottom: 12%;
  transform: rotate(-24deg);
}

.menu {
  display: grid;
  gap: 10px;
}

.menu-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--leaf-deep);
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  text-align: left;
}

.menu-btn img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.menu-btn.primary {
  background: linear-gradient(180deg, #388E3C, #2E7D32);
  color: #FFFFFF;
  min-height: 68px;
  box-shadow: 0 12px 22px rgba(46, 125, 50, 0.28);
}

#play {
  background-color: #FFE56A;
}

.wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 48%, rgba(255, 253, 247, 0.78) 0 16%, rgba(255, 253, 247, 0.34) 42%, rgba(255, 247, 214, 0.08) 68%, rgba(23, 48, 28, 0.14) 100%);
}

#play.slow .wash {
  background: radial-gradient(circle at 50% 48%, rgba(255, 243, 176, 0.86) 0 20%, rgba(255, 253, 247, 0.4) 48%, rgba(23, 48, 28, 0.16) 100%);
}

#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  z-index: 1;
}

.hud {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
}

.pause-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  display: grid;
  grid-auto-flow: column;
  place-content: center;
  gap: 4px;
  flex: 0 0 auto;
}

.pause-btn i {
  width: 4px;
  height: 16px;
  border-radius: 4px;
  background: var(--leaf-deep);
}

.hud-stack {
  min-width: 0;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  padding: 6px 12px 7px;
  box-shadow: var(--shadow);
}

.hud-stack span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hud-stack strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5vw, 1.7rem);
  color: var(--leaf-deep);
  line-height: 1;
}

.hud-side {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.hearts {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  padding: 4px 8px;
  box-shadow: var(--shadow);
}

.hearts img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.hearts img.lost {
  filter: grayscale(1);
  opacity: 0.35;
}

.hud-mini {
  display: flex;
  gap: 6px;
}

#comboLabel,
.run-coins {
  background: rgba(255, 255, 255, 0.94);
  color: var(--leaf-deep);
  border-radius: 999px;
  min-height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}

#comboLabel.hot {
  background: var(--gold);
}

.run-coins img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-right: 4px;
}

.hint,
.banner {
  position: absolute;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  text-align: center;
}

.hint {
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: min(92%, 360px);
  background: rgba(255, 253, 247, 0.94);
  color: var(--leaf-deep);
  border-radius: 16px;
  padding: 10px 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: opacity 0.4s ease;
}

.hint.hide {
  opacity: 0;
}

.banner {
  top: 22%;
  background: #FFFFFF;
  color: var(--leaf-deep);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  padding: 8px 18px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -8px);
}

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

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(18, 48, 28, 0.34);
  padding: 16px;
}

.overlay.on {
  display: flex;
}

.sheet {
  width: min(100%, 440px);
  max-height: calc(100% - 8px);
  overflow: auto;
  background: var(--cream);
  border-radius: 26px;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet h2 {
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  line-height: 0.95;
}

.result-mark {
  width: 84px;
  height: 84px;
  object-fit: contain;
  margin: 0 auto;
}

.paper {
  background:
    linear-gradient(#FFD700, #FFD700) top / 100% 7px no-repeat,
    var(--cream);
}

.bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 8px;
}

.bar h2 {
  text-align: center;
  font-size: clamp(1.5rem, 5vw, 2rem);
}

.back {
  justify-self: start;
}

.bar-cup {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.bar-spacer {
  width: 52px;
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px 16px calc(20px + env(safe-area-inset-bottom));
}

.group-title {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--leaf);
  margin: 12px 0 8px;
}

.card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: #FFFFFF;
  border-radius: 18px;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.swatch {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: #FFE56A center / cover no-repeat;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.swatch img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.copy h3 {
  font-family: var(--font-ui);
  font-size: 1rem;
  letter-spacing: 0;
}

.copy p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.buy {
  min-width: 76px;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--leaf);
  color: #FFFFFF;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.buy img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.buy.worn {
  background: #FFFFFF;
  color: var(--leaf-deep);
  box-shadow: inset 0 0 0 2px var(--leaf);
}

.buy.poor {
  background: #E7E2D2;
  color: #667064;
}

.record {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: #FFFFFF;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 8px 18px rgba(23, 48, 28, 0.06);
}

.record.latest {
  background: #E8F5E9;
}

.rank {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--leaf);
  text-align: center;
}

.who strong,
.who span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who span {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.record b {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--leaf-deep);
}

.empty {
  text-align: center;
  padding: 28px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty img {
  width: 92px;
  height: 92px;
  object-fit: contain;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-weight: 700;
  color: var(--leaf-deep);
}

.field input {
  height: 52px;
  border-radius: 14px;
  background: #FFFFFF;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px rgba(46, 125, 50, 0.28);
}

.field input:focus {
  box-shadow: inset 0 0 0 2px #2E7D32;
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: #17301C;
  box-shadow: inset 0 0 0 1000px #FFFFFF;
}

.note {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 8px 0 14px;
}

.switch {
  width: 100%;
  min-height: 56px;
  margin-bottom: 10px;
  padding: 0 14px;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 650;
  color: var(--leaf-deep);
}

.switch i {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #D9D3C3;
  position: relative;
  flex: 0 0 auto;
}

.switch i::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  top: 3px;
  left: 3px;
}

.switch[aria-pressed="true"] i {
  background: #2E7D32;
}

.switch[aria-pressed="true"] i::after {
  transform: translateX(20px);
}

.danger-text {
  width: 100%;
  margin-top: 8px;
  color: #8E3B32;
}

.confirm {
  background: #FFFFFF;
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm[hidden] {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes reel {
  to { transform: rotate(360deg); }
}

@keyframes floaty {
  50% { transform: translateY(-8px); }
}

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

@media (max-width: 760px) {
  .shell-wash { display: none; }
}

@media (min-width: 860px) {
  .shell { align-items: center; }
  .stage {
    width: min(440px, calc(100vw - 40px));
    height: min(940px, calc(100dvh - 36px));
    border-radius: 32px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  }
}

html.still *,
html.still *::before,
html.still *::after {
  animation: none !important;
  transition: none !important;
}

@media (max-height: 700px) {
  .hero { min-height: 92px; }
  .hero-banana { width: 112px; }
  .hero-slot { width: 140px; }
  .hero-coin { width: 36px; }
  .hero-leaf { width: 48px; }
  .menu-btn { min-height: 48px; font-size: 1.15rem; }
  .menu-btn.primary { min-height: 54px; }
  .menu-btn img { width: 32px; height: 32px; }
  .intro-sheet { gap: 10px; padding-top: 14px; }
  .intro-sheet h1 { font-size: 1.55rem; }
  .lede { font-size: 0.9rem; }
  .intro-art { min-height: 120px; }
}

@media (max-width: 360px) {
  .card { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .swatch, .swatch img { width: 56px; height: 56px; }
  .buy { min-width: 68px; padding: 0 8px; }
  .home-top h1 { font-size: 1.7rem; }
}
