:root {
  --void: #12061c;
  --panel: #1c0a2a;
  --ink: #ffe8fb;
  --mute: #d4a0c8;
  --line: #4a1a5a;
  --pink: #ff2db8;
  --hot: #ff5ad1;
  --gold: #f5d06a;
  --blue: #3a1a8a;
  --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: "Avenir Next", "Segoe UI", Candara, sans-serif;
  background: var(--void);
  color: var(--ink);
}
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden, [hidden] { display: none !important; }

#flare {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(55% 35% at 85% -5%, rgba(255,45,184,0.45), transparent 55%),
    radial-gradient(45% 30% at 8% 5%, rgba(245,208,106,0.22), transparent 50%),
    radial-gradient(40% 25% at 50% 100%, rgba(90,20,140,0.5), transparent 60%);
}

#salon {
  position: relative;
  z-index: 1;
  height: 100%;
  height: 100svh;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--top) 0 0;
  background: linear-gradient(180deg, #1a0830 0%, var(--void) 45%);
}

.ribbon, .pits { flex-shrink: 0; }
.ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 0 12px rgba(255,45,184,0.65));
}
.brand em {
  display: block;
  font-size: 11px;
  color: var(--gold);
  font-style: normal;
  text-transform: uppercase;
}
.brand strong {
  display: block;
  font-size: 20px;
  color: var(--hot);
  text-shadow: 0 0 14px rgba(255,45,184,0.55);
}
.purse {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: rgba(255,45,184,0.15);
  box-shadow: 0 0 16px rgba(245,208,106,0.35);
}
.purse img { width: 22px; height: 22px; }
.purse b { color: var(--gold); font-size: 15px; }

.pits {
  display: flex;
  gap: 6px;
  padding: 8px 10px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pits::-webkit-scrollbar { display: none; }
.pits button {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 60px;
  padding: 8px 10px;
  border: 2px solid var(--gold);
  border-radius: 18px 8px 20px 12px;
  background: linear-gradient(160deg, #3a1450, var(--panel));
  color: var(--mute);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255,45,184,0.2), 0 3px 0 #0a0410;
  transform: rotate(-2deg);
}
.pits button:nth-child(even) {
  border-radius: 8px 20px 10px 18px;
  transform: rotate(3deg) translateY(5px);
}
.pits button:nth-child(3) {
  transform: rotate(-4deg) scale(1.06);
  border-color: var(--hot);
}
.pits button img { width: 30px; height: 30px; }
.pits button span { font-size: 10px; }
.pits button.on {
  background: linear-gradient(160deg, var(--hot), #8a1060);
  color: #fff;
  box-shadow: 0 0 20px rgba(255,45,184,0.65), 0 3px 0 #5a0840;
}

#stage {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px calc(18px + var(--safe));
}
.view { padding-bottom: 12px; }
.kicker {
  font-size: 11px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 4px;
}
h1 {
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 8px;
  color: var(--hot);
  text-shadow: 0 0 20px rgba(255,45,184,0.45);
}
.blurb {
  color: var(--mute);
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 14px;
}
.hero {
  width: 110px;
  height: 110px;
  margin: 4px 0 14px;
  filter: drop-shadow(0 0 16px rgba(255,45,184,0.5));
}
.hero.slim { width: 80px; height: 80px; }

.go {
  width: 100%;
  min-height: 54px;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: linear-gradient(90deg, var(--pink), #c41890);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(255,45,184,0.55);
}
.go.hot:active { transform: scale(0.98); }
.ghost {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--mute);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  margin-bottom: 10px;
}
.ghost.tiny { font-size: 12px; margin: 0; }
.ghost.danger {
  color: #ff8ab8;
  border-color: #5a1840;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
}

.glance {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.glance .card {
  padding: 12px;
  border-radius: 14px;
  border: 2px solid var(--gold);
  background: rgba(28,10,42,0.95);
  box-shadow: 0 0 14px rgba(255,45,184,0.2);
}
.glance em { display: block; font-size: 11px; color: var(--mute); font-style: normal; }
.glance b { font-size: 20px; color: var(--gold); }

.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--gold);
}
.hud span { flex: 1; text-align: center; }
#hudScore { color: var(--hot); font-weight: 700; }

#court {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 16px;
  border: 2px solid var(--gold);
  background: #0a0414;
  box-shadow: 0 0 24px rgba(255,45,184,0.35), inset 0 0 40px rgba(90,20,140,0.4);
  touch-action: none;
}
.hint {
  text-align: center;
  color: var(--mute);
  font-size: 12px;
  margin-top: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.lvl {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid var(--gold);
  background: linear-gradient(160deg, #2a1040, #140820);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(255,45,184,0.2);
}
.lvl.on {
  background: linear-gradient(160deg, var(--hot), #8a1060);
  box-shadow: 0 0 16px rgba(255,45,184,0.55);
}
.lvl.lock { opacity: 0.4; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.deal {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid var(--gold);
  background: rgba(28,10,42,0.95);
  text-align: left;
  color: inherit;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255,45,184,0.2);
}
.deal img { width: 52px; height: 52px; }
.deal b { display: block; font-size: 15px; color: var(--hot); }
.deal small { color: var(--mute); font-size: 12px; }
.deal .price {
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.deal.done {
  opacity: 0.7;
  border-color: var(--pink);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  padding: 14px;
  border-radius: 14px;
  border: 2px solid var(--gold);
  background: rgba(28,10,42,0.95);
}
.stat em { display: block; font-size: 11px; color: var(--mute); font-style: normal; }
.stat b { font-size: 22px; color: var(--gold); }
.stat.wide { grid-column: 1 / -1; }

.rules {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.rules li {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--hot);
  background: rgba(28,10,42,0.8);
  font-size: 14px;
  color: var(--ink);
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid var(--gold);
  margin-bottom: 12px;
}
.toggle input { width: 22px; height: 22px; accent-color: var(--pink); }

@keyframes neonPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255,45,184,0.3); }
  50% { box-shadow: 0 0 26px rgba(245,208,106,0.55); }
}
.go.hot { animation: neonPulse 2.2s ease-in-out infinite; }
.pits button.on { animation: neonPulse 1.8s ease-in-out infinite; }
