:root {
  --night: #12041c;
  --velvet: #1c0828;
  --tile: #2a103a;
  --orchid: #c41e7a;
  --gold: #f4c14a;
  --teal: #1ec8b0;
  --cream: #f7ecd8;
  --mute: #c4a8c8;
  --line: #4a2458;
  --safe: env(safe-area-inset-bottom, 0px);
  --top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  height: 100svh;
  overflow: hidden;
}
body {
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  background: var(--night);
  color: var(--cream);
}
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.off, [hidden] { display: none !important; }
.pane.off, .pane[hidden] { display: none !important; }

#clubhouse {
  height: 100%;
  height: 100svh;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(56% 28% at 8% 0%, rgba(30, 200, 176, 0.16), transparent 50%),
    radial-gradient(62% 34% at 94% -8%, rgba(196, 30, 122, 0.34), transparent 54%),
    linear-gradient(180deg, #1a0630, var(--night) 50%);
  padding: var(--top) 0 0;
}
.canopy, .ribbon, .fronds { flex-shrink: 0; }
.canopy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 4px;
}
.crest { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.crest img { width: 42px; height: 42px; }
.crest em { display: block; font-size: 10px; color: var(--teal); font-style: normal; }
.crest strong { display: block; font-size: 16px; color: var(--gold); line-height: 1.15; }
.purse {
  min-width: 58px;
  height: 44px;
  border: 0;
  background: var(--velvet);
  border-radius: 0 18px 4px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--gold);
  font-size: 12px;
}
.purse img { width: 18px; height: 18px; }
.ribbon {
  height: 3px;
  margin: 4px 18px 8px;
  background: linear-gradient(90deg, var(--teal), var(--orchid), var(--gold));
}

.fronds {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 3px;
  padding: 0 10px 10px;
}
.fronds button {
  flex: 1;
  border: 0;
  cursor: pointer;
  height: 46px;
  background: var(--tile);
  color: var(--mute);
  font-size: 11px;
  clip-path: polygon(12% 0, 88% 8%, 100% 100%, 0 92%);
}
.fronds button:nth-child(2) { height: 52px; clip-path: polygon(8% 10%, 92% 0, 100% 100%, 0 88%); }
.fronds button:nth-child(3) { height: 40px; }
.fronds button:nth-child(4) { height: 50px; transform: rotate(2deg); }
.fronds button:last-child { height: 44px; transform: rotate(-3deg); }
.fronds button.lit {
  background: linear-gradient(180deg, var(--gold), var(--orchid));
  color: #1a0810;
  font-weight: 700;
}

#yard {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px calc(20px + var(--safe));
}
.mark {
  font-size: 11px;
  color: var(--teal);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}
h1 { font-size: 24px; line-height: 1.15; margin-bottom: 8px; }
.lede { color: var(--mute); font-size: 14px; line-height: 1.4; margin-bottom: 14px; }
.tallyline, .chime { color: var(--gold); font-size: 13px; margin: 8px 0 10px; min-height: 1.2em; }
.fig { width: 52%; margin: 6px auto 12px; }
.fig.slim { width: 34%; }

.cabinets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cabinet-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 14px 4px 14px 4px;
  padding: 10px;
  cursor: pointer;
  color: inherit;
}
.cabinet-card img { width: 54px; height: 54px; margin: 0 auto 6px; }
.cabinet-card small { display: block; color: var(--teal); font-size: 10px; }
.cabinet-card b { display: block; font-size: 14px; margin: 2px 0; }
.cabinet-card em { display: block; color: var(--mute); font-style: normal; font-size: 11px; }

.cabinet {
  background:
    linear-gradient(180deg, #3a1848, var(--velvet));
  border: 3px solid var(--gold);
  border-radius: 12px;
  padding: 10px 8px;
  margin: 8px 0 12px;
  --cell: 56px;
}
.cabinet.live {
  box-shadow: 0 0 0 2px rgba(244, 193, 74, 0.4), 0 0 28px rgba(196, 30, 122, 0.32);
}
.tracks {
  --cell: 56px;
  display: grid;
  gap: 4px;
  align-items: stretch;
  position: relative;
}
.tracks[data-n="3"] { grid-template-columns: repeat(3, 1fr); }
.tracks[data-n="4"] { grid-template-columns: repeat(4, 1fr); --cell: 54px; }
.tracks[data-n="5"] { grid-template-columns: repeat(5, 1fr); --cell: 50px; }
.tracks[data-n="6"] { grid-template-columns: repeat(6, 1fr); --cell: 46px; }
#tracks::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: linear-gradient(90deg, transparent, rgba(244, 193, 74, 0.7), transparent);
  pointer-events: none;
  z-index: 4;
}
.track {
  background: #0c0414;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  height: calc(var(--cell) * 3);
  box-shadow: inset 0 0 0 1px #2a1434;
}
.track.landed {
  animation: land-thump 0.22s ease-out;
}
@keyframes land-thump {
  0% { transform: translateY(0); }
  35% { transform: translateY(3px); }
  100% { transform: translateY(0); }
}
.reel-window {
  height: 100%;
  overflow: hidden;
  position: relative;
}
.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 18%;
  z-index: 2;
  pointer-events: none;
}
.reel-window::before {
  top: 0;
  background: linear-gradient(180deg, #0c0414 10%, transparent);
}
.reel-window::after {
  bottom: 0;
  background: linear-gradient(0deg, #0c0414 10%, transparent);
}
.reel-strip {
  will-change: transform;
  backface-visibility: hidden;
}
.reel-strip.whirl .cell img {
  transform: scaleY(1.28);
  opacity: 0.88;
}
.cell {
  height: var(--cell);
  min-height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #2a1434;
}
.cell:last-child { border-bottom: 0; }
.cell.mid { background: rgba(244, 193, 74, 0.08); }
.cell.hit {
  background: rgba(244, 193, 74, 0.22);
  box-shadow: inset 0 0 0 2px var(--gold);
  animation: hit-glow 0.7s ease-out;
}
@keyframes hit-glow {
  0% { transform: scale(0.92); }
  55% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.cell img { width: 78%; height: 78%; object-fit: contain; }
.tracks.frozen { pointer-events: none; margin: 10px 0; }
.tracks.frozen::before { display: none; }

.console {
  display: grid;
  grid-template-columns: 48px 1fr 48px 1.4fr;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}
.stake { text-align: center; }
.stake small { display: block; color: var(--mute); font-size: 10px; }
.stake b { color: var(--gold); font-size: 18px; }
.pull {
  border: 0;
  background: linear-gradient(90deg, var(--orchid), #8a1460);
  color: var(--cream);
  font-weight: 700;
  border-radius: 10px;
  height: 48px;
  cursor: pointer;
}
.pull:disabled { opacity: 0.5; cursor: default; }

.seal, .fade {
  border: 0;
  cursor: pointer;
  padding: 12px 14px;
  border-radius: 10px;
  width: 100%;
  margin-top: 6px;
}
.seal {
  background: linear-gradient(90deg, var(--orchid), #7a1458);
  color: var(--cream);
  font-weight: 700;
}
.fade { background: transparent; color: var(--cream); border: 1px solid var(--line); }
.fade.slim { width: auto; margin-top: 0; height: 44px; padding: 0 12px; }
.slate {
  background: var(--velvet);
  border: 1px dashed var(--gold);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
}
.tally {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.tally div {
  background: var(--velvet);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.tally small { display: block; color: var(--mute); font-size: 10px; }
.tally b { display: block; font-size: 15px; margin-top: 2px; color: var(--gold); }
.hollow {
  color: var(--mute);
  text-align: center;
  padding: 28px 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.house { margin: 0 0 16px 18px; color: var(--mute); }
.house li { margin: 6px 0; }

.shot {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.shot small { display: block; color: var(--teal); font-size: 11px; }
.shot b { display: block; margin: 2px 0; }
.shot em { display: block; color: var(--mute); font-style: italic; font-size: 13px; }
.minirow {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.minirow img { width: 28px; height: 28px; }
