:root {
  --ink: #06141a;
  --teal: #0b3d44;
  --panel: #10282e;
  --gold: #e4c36a;
  --dot: #e23b4a;
  --cream: #f3ead2;
  --mute: #9bb0b4;
  --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, "Gill Sans", "Trebuchet MS", sans-serif;
  background: var(--ink);
  color: var(--cream);
}
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden, [hidden] { display: none !important; }
.view.hidden, .view[hidden] { display: none !important; }

#club {
  height: 100%;
  height: 100svh;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(90% 50% at 50% -8%, rgba(228,195,106,0.16), transparent 55%),
    linear-gradient(180deg, #0a242a, var(--ink) 42%);
  padding: var(--top) 0 0;
}
.board, .scoreline, .gilt { flex-shrink: 0; }
.board {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 6px;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.brand img { width: 36px; height: 36px; }
.brand em { display: block; font-size: 10px; color: var(--gold); font-style: normal; }
.brand strong { display: block; font-size: 15px; }
.purse, .vip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #08181c;
  border: 1px solid #c9a24a;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}
.purse img { width: 16px; height: 16px; }
.vip { color: var(--gold); }
.gilt { height: 3px; margin: 0 14px 6px; background: #1a3338; border-radius: 2px; overflow: hidden; }
.gilt i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--dot), var(--gold)); }

.scoreline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 0 12px 8px;
}
#club.table-open .scoreline { display: none; }
.scoreline button {
  background: none;
  border: 0;
  color: var(--mute);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
}
.scoreline button.on { color: var(--gold); border-bottom-color: var(--gold); }
.scoreline span { color: #5a4a28; }

#stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: 6px 14px calc(28px + var(--safe));
}
.view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: min-content;
  padding-bottom: 36px;
}
.kicker { color: var(--gold); font-size: 11px; text-transform: uppercase; }
h1 { font-size: 28px; line-height: 1.1; }
h2 { font-size: 22px; color: var(--gold); }
h3 { font-size: 15px; }
.blurb, .lead, .note p { color: var(--mute); font-size: 14px; line-height: 1.4; }
.muted { color: var(--mute); font-size: 12px; }
.hero { width: 120px; margin: 4px auto; }

.stat-row { display: flex; gap: 8px; }
.stat-row div {
  flex: 1;
  background: var(--panel);
  border: 1px solid #2a4a50;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.stat-row small { display: block; color: var(--mute); font-size: 11px; }

.go, .lane {
  border: 0;
  background: linear-gradient(180deg, #f0d48a, #b8892d);
  color: #2a1a08;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}
.go:disabled { opacity: 0.45; }
.ghost {
  background: transparent;
  border: 1px solid #c9a24a;
  color: var(--gold);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.play-hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
#court {
  position: relative;
  height: 320px;
  border: 3px solid #c9a24a;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #14524c 0 46%, #0e3a36 46% 100%);
  box-shadow: inset 0 0 0 8px #0a2a28;
}
#court::before {
  content: "";
  position: absolute;
  inset: 18px 22px;
  border: 1px solid rgba(243,234,210,0.35);
  pointer-events: none;
}
.rival { position: absolute; top: 8px; left: 50%; width: 56px; transform: translateX(-50%); }
.net { position: absolute; top: 42%; left: 8%; width: 84%; opacity: 0.92; }
.boxes { position: absolute; left: 10%; right: 10%; bottom: 18%; height: 38%; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.boxes i { border: 1px dashed rgba(228,195,106,0.28); border-radius: 8px; }
#ballWrap {
  position: absolute;
  width: 54px;
  height: 54px;
  margin-left: -27px;
  z-index: 2;
}
#ballWrap img { width: 100%; height: 100%; object-fit: contain; }
#ring {
  position: absolute;
  inset: -10px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  pointer-events: none;
}
#smashFx { position: absolute; width: 90px; left: 50%; top: 48%; transform: translate(-50%, -50%); z-index: 3; }
.call {
  position: absolute;
  left: 0; right: 0; top: 52%;
  text-align: center;
  color: var(--gold);
  font-size: 22px;
  pointer-events: none;
  z-index: 4;
}
.hint { text-align: center; color: var(--mute); font-size: 13px; }
.swings { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.lane { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; }
.lane img { width: 36px; height: 36px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,14,18,0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  z-index: 8;
  text-align: center;
}
.overlay img { width: 88px; }
.over-stats { list-style: none; color: var(--mute); }
.vip-card, .row, .note {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border: 1px solid #2a4a50;
  border-radius: 14px;
  padding: 12px;
}
.vip-card img, .row img { width: 56px; height: 56px; flex-shrink: 0; }
.row { justify-content: space-between; }
.row button { flex-shrink: 0; }
.note { display: block; }
.toggle { display: flex; gap: 10px; align-items: center; padding: 10px 0; }
