* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #14101f; color: #fff;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: manipulation;
}
body { transition: background 0.4s; }
#app {
  height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  text-align: center;
}
h1 { margin: 0; font-size: 34px; line-height: 1.1; }
h2 { margin: 0; font-size: 22px; opacity: 0.85; font-weight: 600; }
p { margin: 0; opacity: 0.75; font-size: 17px; }
.huge { font-size: 120px; font-weight: 900; line-height: 1; }

input {
  width: 100%; max-width: 340px; font: inherit; font-size: 22px; padding: 16px 18px;
  border-radius: 18px; border: 2px solid #ffffff30; background: #ffffff12; color: #fff; text-align: center;
  user-select: text; -webkit-user-select: text;
}
.teams { display: flex; gap: 12px; width: 100%; max-width: 340px; }
.team {
  flex: 1; padding: 22px 8px; border-radius: 20px; border: 3px solid transparent;
  font: inherit; font-size: 20px; font-weight: 800; color: #fff; background: #ffffff14;
}
.team.boy.sel { background: #3da5ff; border-color: #fff; }
.team.girl.sel { background: #ff5fa8; border-color: #fff; }
.go {
  width: 100%; max-width: 340px; padding: 20px; border: 0; border-radius: 20px; font: inherit;
  font-size: 22px; font-weight: 900; background: #fff; color: #14101f;
}
.go:disabled { opacity: 0.35; }

/* The giant controller button, in your team's colour */
body { --tc: #ffd84d; --tcd: #b86a00; --heat: 0; }
body[data-team="boy"] { --tc: #3da5ff; --tcd: #1a63b0; }
body[data-team="girl"] { --tc: #ff5fa8; --tcd: #b8336f; }
body { box-shadow: inset 0 0 calc(var(--heat) * 140px) calc(var(--heat) * 20px) var(--tc); transition: background 0.4s, box-shadow 0.15s; }
.pad {
  width: min(78vw, 46dvh); aspect-ratio: 1; border-radius: 50%; border: 0;
  font: inherit; font-size: 44px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 #0003;
  background: radial-gradient(circle at 35% 30%, #fff, var(--tc) 50%, var(--tcd));
  box-shadow: 0 14px 0 var(--tcd), 0 0 calc(30px + var(--heat) * 120px) var(--tc);
  touch-action: none; transition: box-shadow 0.15s;
}
.pad.down { translate: 0 8px; box-shadow: 0 6px 0 var(--tcd), 0 0 calc(30px + var(--heat) * 120px) var(--tc); }
.float { position: fixed; font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 0 12px var(--tc), 0 2px 0 var(--tcd); pointer-events: none; z-index: 6; }
.ropewrap { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 380px; font-size: 13px; font-weight: 800; opacity: 0.9; }
.rope { flex: 1; height: 14px; border-radius: 99px; background: #ff5fa8; position: relative; overflow: hidden; }
.rope div { position: absolute; inset: 0 auto 0 0; width: 50%; background: #3da5ff; transition: width 0.3s ease-out; box-shadow: 2px 0 8px #fff; }
.count { font-size: 64px; font-weight: 900; color: var(--tc); text-shadow: 0 0 calc(var(--heat) * 30px) var(--tc); }
.timer { font-size: 22px; font-weight: 800; opacity: 0.8; }

.shake-ico { font-size: 140px; animation: wiggle 0.25s infinite alternate; }
@keyframes wiggle { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }

.drum { font-size: 130px; animation: bounce 0.18s infinite alternate; }
@keyframes bounce { to { transform: translateY(-14px) scale(1.06); } }

.teams.big .team { padding: 40px 8px; font-size: 26px; }

#offline { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: #ff3355; padding: 6px 14px; border-radius: 99px; font-size: 14px; display: none; }
body.offline #offline { display: block; }
.huge.tick { animation: pop 0.9s ease-out both; }
@keyframes pop { from { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } }

/* ---------- rounds ---------- */
body.playing #app { justify-content: flex-start; }
.field { position: fixed; inset: 0; z-index: 1; touch-action: none; overflow: hidden; }
.field.center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding-top: 90px; }
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 3; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: max(12px, env(safe-area-inset-top)) 16px 10px; background: linear-gradient(#14101fee, #14101f00); }
.hudrow { display: flex; width: 100%; max-width: 380px; justify-content: space-between; align-items: baseline; }
.hud .count { font-size: 44px; line-height: 1; }
.count.big { font-size: 110px; }
.pad { width: min(60vw, 34dvh); font-size: 34px; }

/* pop */
.bl { position: absolute; left: 0; top: 0; border-radius: 50% 50% 47% 47% / 55% 55% 45% 45%; pointer-events: none; will-change: transform;
  background: radial-gradient(circle at 32% 28%, #ffffffd0, transparent 24%), var(--tc); box-shadow: inset -8px -10px 16px #0003; }
.bl::after { content: ""; position: absolute; left: 50%; bottom: -10px; width: 2px; height: 22px; background: #ffffff70; }
.bl.gold { background: radial-gradient(circle at 32% 28%, #fff, transparent 26%), #ffd84d; box-shadow: 0 0 24px #ffd84d, inset -6px -8px 12px #0003; }
.spark { position: fixed; width: 12px; height: 12px; border-radius: 50%; pointer-events: none; z-index: 6; }
.float.oops { color: #ff5c5c; text-shadow: 0 0 12px #000; font-size: 26px; }
.float.steal { color: #ff5c5c; text-shadow: 0 0 12px #000; font-size: 22px; }

/* rhythm */
.target, .ring { position: absolute; left: 50%; top: 56%; width: 150px; height: 150px; border-radius: 50%; transform: translate(-50%,-50%); pointer-events: none; }
.target { background: radial-gradient(circle at 35% 30%, #fff, var(--tc) 55%, var(--tcd)); box-shadow: 0 0 40px var(--tc); }
.ring { border: 6px solid #fff; box-shadow: 0 0 18px var(--tc); will-change: transform, opacity; }
.judge { position: absolute; left: 50%; top: 32%; transform: translate(-50%,-50%); font-size: 40px; font-weight: 900; opacity: 0; pointer-events: none; white-space: nowrap; }
.judge.perfect { color: #ffd84d; text-shadow: 0 0 20px #ffd84d; }
.judge.good { color: #fff; }
.judge.miss { color: #ff5c5c; }
.combo { position: absolute; left: 50%; top: 77%; transform: translateX(-50%); font-size: 22px; font-weight: 800; color: var(--tc); pointer-events: none; }
.rhint { position: absolute; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom)); pointer-events: none; }

/* power-ups */
.banner { position: fixed; left: 12px; right: 12px; top: 110px; z-index: 4; padding: 12px; border-radius: 16px; font-size: 18px; font-weight: 800;
  pointer-events: none; opacity: 0; transform: translateY(-20px); transition: opacity 0.2s, transform 0.25s cubic-bezier(.2,1.6,.5,1); }
.banner.on { opacity: 1; transform: none; }
.banner.bad { background: #ff3355; animation: throb 0.5s infinite alternate; }
.banner.good { background: #ffd84d; color: #14101f; }
@keyframes throb { to { transform: scale(1.04); } }
.power { position: fixed; right: 14px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 5; display: none; border: 0; border-radius: 22px; padding: 10px 18px;
  font: inherit; font-size: 20px; font-weight: 900; color: #14101f; background: #ffd84d; box-shadow: 0 8px 0 #b88a00, 0 0 40px #ffd84d;
  animation: wobble 0.6s infinite alternate ease-in-out; }
.power.on { display: block; }
.power span { font-size: 26px; }
.power small { display: block; font-size: 11px; font-weight: 700; opacity: 0.7; }
@keyframes wobble { from { transform: rotate(-4deg) scale(1); } to { transform: rotate(4deg) scale(1.08); } }
.dark { position: fixed; inset: 0; z-index: 4; background: #000; display: flex; align-items: center; justify-content: center; font-size: 80px;
  pointer-events: none; opacity: 0; transition: opacity 0.12s; }
.dark.on { opacity: 1; }
.dark span { opacity: 0.25; }
.puzzle { position: fixed; left: 14px; right: 14px; top: 22%; z-index: 7; padding: 18px; border-radius: 26px; background: #fff; color: #14101f;
  display: none; flex-direction: column; gap: 10px; align-items: center; box-shadow: 0 0 0 6px #ffd84d, 0 20px 60px #000c; }
.puzzle.on { display: flex; animation: slam 0.3s cubic-bezier(.2,1.8,.5,1); }
.puzzle .pk { font-size: 15px; font-weight: 900; letter-spacing: 0.05em; color: #b88a00; }
.puzzle .pq { font-size: 26px; font-weight: 900; }
.puzzle .opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.puzzle .opts.n4 { grid-template-columns: repeat(2, 1fr); }
.puzzle button { font: inherit; font-size: 40px; font-weight: 900; padding: 14px 0; border: 0; border-radius: 18px; background: #f0ecf8; color: #14101f; }
.puzzle button.picked { background: #ffd84d; transform: scale(0.94); }
.puzzle .pbar { width: 100%; height: 8px; border-radius: 99px; background: #eee; overflow: hidden; }
.puzzle .pbar div { height: 100%; background: #ff3355; }
.puzzle .pres { font-size: 34px; font-weight: 900; padding: 20px; }
@keyframes slam { from { transform: scale(1.4); opacity: 0; } }
.bob { animation: bob 1.2s infinite ease-in-out; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-6deg); } }

/* wrong bet on the reveal: the bet colour sits on the other colour, so give it a dark backing */
.wrong { display: inline-block; background: #14101f; padding: 8px 20px; border-radius: 99px; }

/* mini board: the TV's letters on the phone */
.mini { display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.mini.top { position: fixed; z-index: 2; top: max(14px, env(safe-area-inset-top)); left: 50%; translate: -50% 0; scale: 1.35; transform-origin: top center; }
.mini .ml { display: flex; gap: 3px; }
.mini i { width: 6px; }
.mini b { width: 18px; height: 22px; border-radius: 5px; background: #ffffff1c; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900; color: #14101f; }
.mini b.lit { background: #fff; }
.mini b.boy { background: #3da5ff; color: #fff; }
.mini b.girl { background: #ff5fa8; color: #fff; }
.mini b.tie { background: #ffd84d; }
.mini b.mys { width: 66px; color: #fff; background: #0006; border: 1.5px dashed #ffffff80; letter-spacing: 2px; }
.mini b.mys.boy, .mini b.mys.girl { border: 2px solid #fff; }
.mini b.mys.hb { animation: mhb 0.7s infinite; }
@keyframes mhb { 0%, 100% { scale: 1; } 15% { scale: 1.15; } 30% { scale: 1; } 45% { scale: 1.08; } }
.hudrow { align-items: center; }
.mini b.boy, .mini b.girl { box-shadow: 0 0 0 1.5px #fff; }
.mini b.mys.boy { background: #3da5ff; } .mini b.mys.girl { background: #ff5fa8; }
/* drumroll: tap to send balloons */
.bl.fly { position: fixed; z-index: 5; }
.cheerb { position: static; width: 120px; height: 144px; margin: 6px 0 18px; }
#field .huge#cd { font-size: 96px; }
