* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; touch-action: manipulation; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--grass-hi), var(--grass) 55%, var(--grass-deep));
  color: var(--cream); font-family: var(--f-ui); overflow-x: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#app { min-height: 100%; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2 { font-family: var(--f-display); font-weight: 800; margin: 0; line-height: 1.05; }

/* placeholder discs until the art lands */
.av { display: inline-grid; place-items: center; flex: none; }
.av.ph { border-radius: 50%; background: var(--c); color: var(--ink); font-family: var(--f-display); font-weight: 800; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12); }
.av.big { width: 92px; height: 92px; font-size: 34px; }
.av.mid { width: 72px; height: 72px; font-size: 26px; }
.av.sm { width: 34px; height: 34px; font-size: 14px; }
img.av { object-fit: contain; }
.logo { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; padding: 6px 8px; height: 46px; width: 100%; }
.logo img { max-height: 34px; max-width: 100%; object-fit: contain; }

/* ---- join */
.join { padding: 18px 16px 110px; max-width: 560px; margin: 0 auto; }
.brand { text-align: center; padding: 6px 0 14px; }
.brand h1 { font-size: 40px; color: var(--straw); text-shadow: 0 3px 0 var(--grass-deep); }
.brand p { margin: 2px 0 0; font-weight: 600; opacity: .9; }
.nick { display: block; background: var(--cream); color: var(--ink); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); }
.nick span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.nick input { width: 100%; border: 0; outline: 0; background: none; font: 600 20px var(--f-ui); color: var(--ink); padding: 4px 0; -webkit-user-select: text; user-select: text; }
.join h2 { font-size: 26px; margin: 20px 0 10px; text-align: center; }
.cast { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card { background: var(--cream); color: var(--ink); border-radius: 18px; padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: var(--shadow); border: 4px solid transparent; transition: transform .1s; }
.card .av.big { width: 68px; height: 68px; font-size: 24px; }
.card .nm { font-family: var(--f-display); font-weight: 800; font-size: 18px; line-height: 1; }
.card.on { border-color: var(--straw); transform: translateY(-3px); background: #fffdf4; }
.go { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .25)); display: flex; justify-content: center; }
.big { font-family: var(--f-display); font-weight: 800; font-size: 28px; background: var(--straw); color: var(--ink); border-radius: 18px; padding: 12px 0; width: 100%; max-width: 520px; box-shadow: 0 6px 0 var(--straw-deep); }
.big:disabled { opacity: .45; box-shadow: none; }

/* ---- wait, half, final */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 24px 16px; }
.screen h2 { font-size: 40px; }
.screen p { margin: 0; font-size: 18px; font-weight: 600; }
.mecard { background: var(--cream); color: var(--ink); border-radius: 24px; padding: 16px 26px 14px; border: 8px solid var(--team); display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: var(--shadow); }
.mecard .av.big { width: 120px; height: 120px; font-size: 44px; }
.mecard .who { font-family: var(--f-display); font-weight: 800; font-size: 26px; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score.big { font-family: var(--f-display); font-weight: 800; font-size: 76px; line-height: 1; background: var(--cream); color: var(--ink); border-radius: 22px; padding: 6px 26px; display: flex; gap: 14px; box-shadow: var(--shadow); width: auto; max-width: none; }
.final .kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 14px; }
.final .yay { color: var(--straw); font-family: var(--f-display); font-weight: 800; font-size: 24px; }
.top { background: rgba(0, 0, 0, .18); border-radius: 18px; padding: 12px 22px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.top small { font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.top b { font-family: var(--f-display); font-size: 24px; }

/* ---- controller */
.play { position: fixed; inset: 0; display: flex; flex-direction: column; border: 6px solid var(--team); touch-action: none; overscroll-behavior: none; }
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--team); color: #fff; }
.bar .me { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.bar .nick { font-family: var(--f-display); font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sc { font-family: var(--f-display); font-weight: 800; font-size: 24px; background: var(--cream); border-radius: 10px; padding: 0 10px; color: var(--ink); }
.bar .sc i { font-style: normal; }
.bar .clock { font-family: var(--f-display); font-weight: 800; font-size: 22px; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
#where { background: rgba(255, 255, 255, .22); border-radius: 12px; padding: 8px 10px; font-weight: 800; font-size: 14px; white-space: nowrap; }
#where.on { background: var(--straw); color: var(--ink); }
.pad { flex: 1; display: grid; grid-template-columns: 1fr 1fr; touch-action: none; }
.zone { position: relative; touch-action: none; overflow: hidden; }
#stick { background: rgba(0, 0, 0, .1); border-right: 2px dashed rgba(255, 255, 255, .25); }
#stick .hint { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font-family: var(--f-display); font-weight: 800; font-size: 20px; opacity: .55; pointer-events: none; }
#stick.held .hint { opacity: 0; }
.base { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .12); opacity: .5; pointer-events: none; }
#stick.held .base { opacity: 1; }
.knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: var(--cream); box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
#kick { display: grid; place-items: center; }
.kickbtn { width: min(40vw, 46vh, 220px); aspect-ratio: 1; border-radius: 50%; background: var(--straw); color: var(--ink); display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: clamp(30px, 9vw, 52px); box-shadow: 0 10px 0 var(--straw-deep), 0 0 0 8px rgba(255, 255, 255, .25); pointer-events: none; }
.kickbtn.hit { animation: hit .16s ease-out; }
@keyframes hit { 0% { transform: translateY(8px) scale(.94); box-shadow: 0 2px 0 var(--straw-deep), 0 0 0 14px rgba(255, 255, 255, .45); } 100% { transform: none; } }
.ov { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; pointer-events: none; opacity: 0; transition: opacity .2s; }
.ov.on { opacity: 1; }
.ov b { display: inline-block; font-family: var(--f-display); font-weight: 800; font-size: 46px; background: var(--cream); color: var(--ink); padding: 4px 26px; border-radius: 20px; box-shadow: var(--shadow); }
.ov.mine b { background: var(--straw); font-size: 56px; animation: pop .5s ease-out infinite alternate; }
@keyframes pop { to { transform: scale(1.08) rotate(-2deg); } }

.toasts { position: fixed; left: 12px; right: 12px; bottom: 90px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; z-index: 20; }
.toast { background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 12px; font-weight: 600; }
.conn { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); background: var(--barn); color: #fff; padding: 6px 12px; border-radius: 10px; font-weight: 700; font-size: 14px; display: none; z-index: 30; }
.conn.on { display: block; }

@media (max-width: 360px) {
  .bar .nick { font-size: 16px; }
  #where { font-size: 12px; padding: 6px 8px; }
}

/* character art: sized by height, width follows the sprite */
img.av { width: auto; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .18)); }
img.av.big { height: 96px; }
.card img.av.big { height: 86px; }
.mecard img.av.big { height: 160px; }
img.av.mid { height: 96px; }
img.av.sm { height: 40px; margin: -4px 0; filter: none; }
.card .logo { height: 50px; }
.card .logo img { max-height: 38px; }

/* snack pop-up: over the controller, never blocking a touch */
#snack { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; z-index: 15; display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--cream); color: var(--ink); border-radius: 26px; padding: 16px 30px 14px; box-shadow: 0 10px 0 rgba(0, 0, 0, .2); transition: transform .18s cubic-bezier(.2, 1.6, .4, 1), opacity .15s; }
#snack.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#snack .sn { height: 130px; }
#snack b { font-family: var(--f-display); font-weight: 800; font-size: 40px; line-height: 1; }
#snack .logo { width: auto; height: 54px; }
#snack .logo img { max-height: 40px; }

/* the gate you attack */
.bar .dir { font-family: var(--f-display); font-weight: 800; font-size: 34px; line-height: 1; background: #fff; color: var(--team); border-radius: 10px; padding: 0 8px 2px; }
.merow { display: flex; align-items: center; gap: 12px; }
.dirbig { font-family: var(--f-display); font-weight: 800; font-size: 84px; line-height: 1; text-shadow: 0 4px 0 rgba(0, 0, 0, .2); }

/* Superkop loaded: an orange button with a ring that empties */
.kickbtn { position: relative; text-align: center; line-height: .95; }
.kickbtn.super { background: #ff6a2b; color: #fff; box-shadow: 0 10px 0 #b8380f, 0 0 0 8px rgba(255, 140, 60, .45); font-size: clamp(24px, 7vw, 42px); animation: superpulse .5s ease-in-out infinite alternate; }
.kickbtn.super::after { content: ''; position: absolute; inset: -16px; border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px)); }
@keyframes superpulse { to { transform: scale(1.05); } }

/* Turbo on: the stick glows, with a bar that runs down */
.fxlbl { display: none; position: absolute; left: 50%; top: 14px; transform: translateX(-50%); font-family: var(--f-display); font-weight: 800; font-size: 26px; color: var(--ink); background: #ffe14d; border-radius: 12px; padding: 2px 14px 6px; overflow: hidden; pointer-events: none; }
.fxlbl::after { content: ''; position: absolute; left: 0; bottom: 0; height: 5px; width: calc(var(--p, 0) * 100%); background: #ff8a1f; }
#stick.turbo .fxlbl { display: block; }
#stick.turbo .base { opacity: 1; border-color: #ffe14d; box-shadow: 0 0 26px #ffe14d; }
