:root {
  --me: #2f9bff;
  --ink: #0f1a2b;
  --paper: #fffdf6;
  --good: #7dff9a;
  --bad: #ff4d6d;
  --mid: #ffd23f;
  --shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 18px rgba(0, 20, 60, .35);
  --display: 'Bungee', 'Arial Black', system-ui, sans-serif;
  --body: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #6f9fd8; color: var(--paper); font-family: var(--body); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
button { font: inherit; cursor: pointer; }
kbd { font-family: var(--body); font-weight: 700; font-size: .78em; padding: .05em .45em; border-radius: .35em; background: rgba(255, 255, 255, .18); }

#boot { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; background: linear-gradient(#1d4f96, #7fb2e8); }
#boot h1 { font-family: var(--display); font-size: clamp(40px, 9vw, 96px); margin: 0; letter-spacing: .02em; }

#cloudfx { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(245, 248, 255, .55), rgba(235, 242, 252, .95)); }
#flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: screen; }
#goggles { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.gsplat { position: absolute; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25)) saturate(1.1); animation: gdrip 7s linear forwards; }
.gsplat.wipe { transition: transform .4s ease-in, opacity .4s; transform: translateX(-120vw) skewX(-20deg) !important; opacity: 0 !important; }
@keyframes gdrip { from { translate: 0 0; } to { translate: 0 40px; } }

/* ================= HUD ================= */
#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: var(--shadow); }
.big { font-family: var(--display); font-size: clamp(26px, 3.4vw, 42px); line-height: 1; letter-spacing: .02em; }
.small { font-size: 14px; opacity: .85; margin-top: 4px; font-weight: 500; }
small { font-size: .5em; margin-left: .2em; opacity: .8; }

#altBox { position: absolute; left: max(18px, env(safe-area-inset-left)); top: 18px; display: flex; gap: 12px; align-items: stretch; }
#altBar { position: relative; width: 6px; height: 120px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; }
#altBar i { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: var(--paper); transform-origin: bottom; }
#altBar em { position: absolute; left: -2px; right: -2px; height: 2px; bottom: calc(1150 / 4000 * 100%); background: var(--mid); }
#altBar.low i { background: var(--bad); animation: blink .4s steps(2) infinite; }

#scoreBox { position: absolute; right: max(18px, env(safe-area-inset-right)); top: 18px; text-align: right; }
#combo { font-family: var(--display); color: var(--mid); font-size: 18px; min-height: 22px; margin-top: 4px; }
#feed { margin-top: 10px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
#feed div { transition: opacity .8s; }
#feed div.old { opacity: 0; }

#suitBox { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
#suitBox label { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; opacity: .75; }
#suit { display: flex; gap: 6px; }
#suit i { width: 16px; height: 16px; border-radius: 50%; background: var(--me); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85) inset; transition: transform .2s; }
#suit i.hit { transform: scale(1.2); box-shadow: none; }

#ammoBox { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: 20px; text-align: right; }
#pods { font-size: 13px; letter-spacing: .25em; opacity: .85; margin-top: 4px; color: var(--me); }
#powers { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-bottom: 8px; font-family: var(--display); font-size: 14px; }
#powers span { color: var(--c); }
#powers span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: middle; box-shadow: 0 0 10px var(--c); }

#xhair { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; }
#xhair svg { width: 100%; height: 100%; overflow: visible; }
#xhair .dot { fill: var(--paper); }
#xhair .tick { stroke: var(--paper); stroke-width: 3; stroke-linecap: round; fill: none; }
#xhair.hot .dot { fill: var(--bad); }
#xhair.hot .tick { stroke: var(--bad); }
#xhair svg { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)); }
#hitm { position: absolute; inset: 8px; opacity: 0; }
#hitm::before, #hitm::after { content: ''; position: absolute; left: 50%; top: 50%; width: 42px; height: 4px; margin: -2px 0 0 -21px; background: var(--paper); border-radius: 2px; transform: rotate(45deg); box-shadow: 0 0 6px rgba(0, 0, 0, .5); }
#hitm::after { transform: rotate(-45deg); }
#hitm.on { animation: hitm .25s ease-out; }
#hitm.on.head::before, #hitm.on.head::after { background: var(--mid); }
@keyframes hitm { from { opacity: 1; transform: scale(1.3); } to { opacity: 0; transform: scale(.9); } }
#reloadRing { position: absolute; inset: -6px; border-radius: 50%; opacity: 0; --p: 0;
  background: conic-gradient(var(--paper) calc(var(--p) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 36px, #000 37px, #000 39px, transparent 40px);
  mask: radial-gradient(circle, transparent 36px, #000 37px, #000 39px, transparent 40px); }

#warn { position: absolute; left: 50%; top: calc(50% - 96px); transform: translateX(-50%); text-align: center; font-family: var(--display); color: var(--bad); animation: blink .35s steps(2) infinite; white-space: nowrap; }
#warn b { font-size: 20px; font-weight: 400; display: block; }
#warn span { font-size: 14px; color: var(--paper); }

#dmg { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; opacity: 0; }
#dmg::before { content: ''; position: absolute; left: 50%; top: 0; width: 90px; height: 16px; margin-left: -45px; border-radius: 50% 50% 0 0 / 100% 100% 0 0; background: radial-gradient(ellipse at 50% 100%, var(--bad), transparent 70%); }
#dmg.on { animation: dmg 1s ease-out; }
@keyframes dmg { from { opacity: 1; } to { opacity: 0; } }

#pops { position: absolute; left: calc(50% + 60px); top: calc(50% - 20px); display: flex; flex-direction: column; gap: 2px; }
.pop { font-family: var(--display); animation: pop 1.8s ease-out forwards; white-space: nowrap; }
.pop b { font-weight: 400; color: var(--mid); font-size: 20px; margin-right: 8px; }
.pop span { font-size: 14px; }
.pop.big b { font-size: 28px; color: var(--good); }
@keyframes pop { 0% { opacity: 0; transform: translateX(-10px) scale(.8); } 10% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-24px); } }

#call { position: absolute; left: 0; right: 0; top: 22%; text-align: center; font-family: var(--display); font-size: clamp(28px, 5vw, 60px); opacity: 0; letter-spacing: .02em; padding: 0 16px; }
#call.show { animation: call .5s cubic-bezier(.2, 1.6, .4, 1) forwards; }
#call.good { color: var(--good); }
#call.bad { color: var(--bad); }
#call.mid { color: var(--mid); }
@keyframes call { from { opacity: 0; transform: scale(1.8) rotate(-3deg); } to { opacity: 1; transform: none; } }

#pullCall { position: absolute; left: 0; right: 0; bottom: 22%; text-align: center; font-family: var(--display); font-size: clamp(36px, 6vw, 72px); color: var(--mid); animation: blink .6s steps(2) infinite; }
#pullCall.urgent { color: var(--bad); animation-duration: .25s; }
#pullCall kbd { font-size: .4em; vertical-align: middle; }

#dzArrow { position: absolute; left: 0; top: 0; }
#dzArrow i { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #ff6a1a; box-shadow: 0 0 0 4px rgba(255, 255, 255, .85), 0 0 20px #ff6a1a; animation: pulse 1s ease-in-out infinite; }
#dzArrow span { position: absolute; left: 20px; top: -9px; font-family: var(--display); font-size: 16px; white-space: nowrap; }
@keyframes pulse { 50% { transform: scale(1.25); } }

#hint { position: absolute; left: 0; right: 0; bottom: 64px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 14px; opacity: 0; transition: opacity .8s; padding: 0 20px; }
#hint.show { opacity: 1; }

#tags { position: absolute; inset: 0; }
.tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; margin-top: -46px; transition: opacity .2s; white-space: nowrap; }
.tag b { font-size: 13px; font-weight: 700; color: var(--c); translate: -50% 0; }
.tag i { font-style: normal; font-size: 9px; letter-spacing: .2em; color: var(--c); translate: -50% 0; }
.tag.out b { text-decoration: line-through; opacity: .7; }
.tag.off { margin-top: 0; }
.tag.off::before { content: ''; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.tag.off b, .tag.off i { display: none; }

@keyframes blink { 50% { opacity: .35; } }

/* ================= screens ================= */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto;
  background: radial-gradient(ellipse at 50% 42%, rgba(10, 30, 70, .12), rgba(10, 25, 60, .55)); text-shadow: var(--shadow); }
.logo { font-family: var(--display); font-weight: 400; margin: 0; font-size: clamp(56px, 13vw, 168px); line-height: .9; letter-spacing: .01em; display: flex; flex-wrap: wrap; justify-content: center; }
.logo span:first-child { color: var(--paper); }
.logo span:last-child { color: var(--me); position: relative; text-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 30px color-mix(in srgb, var(--me) 60%, transparent); }
.logo span:last-child::after { content: ''; position: absolute; left: 12%; top: 88%; width: 9%; height: .45em; border-radius: 0 0 1em 1em; background: var(--me); box-shadow: 1.1em .05em 0 -.05em var(--me), 2.6em -.1em 0 .02em var(--me); }
.lede { margin: 18px auto 0; font-size: clamp(15px, 1.8vw, 20px); max-width: 640px; line-height: 1.45; opacity: .95; }
.pick { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pick label { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; opacity: .8; }
#swatches { display: flex; gap: 12px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); transition: transform .15s; }
.sw.on { transform: scale(1.3); box-shadow: 0 0 0 3px var(--paper), 0 0 18px var(--c); }
.go { margin-top: 30px; border: 0; border-radius: 999px; padding: 16px 56px; font-family: var(--display); font-size: 26px; color: var(--ink); background: var(--paper); box-shadow: 0 5px 0 color-mix(in srgb, var(--me) 70%, #000), 0 0 30px color-mix(in srgb, var(--me) 50%, transparent); transition: transform .12s; }
.go:hover { transform: translateY(-2px) rotate(-1deg); }
.go:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--me) 70%, #000); }
.best { margin: 14px 0 0; font-size: 14px; opacity: .85; min-height: 1em; }
.how { margin-top: 26px; max-width: 700px; font-size: 14px; line-height: 1.55; opacity: .92; }
.how p { margin: 6px 0; }
.link { margin-top: 16px; background: none; border: 0; color: var(--paper); opacity: .8; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; text-shadow: var(--shadow); }
.link:hover { opacity: 1; }

#pause h2, #results h2 { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 9vw, 96px); margin: 0; }
#results h2.bad { color: var(--bad); }
#resSub { margin: 10px 0 0; font-size: 17px; max-width: 560px; }
.scoreLine { display: flex; align-items: center; gap: 22px; margin-top: 26px; }
#resGrade { font-family: var(--display); font-size: 96px; line-height: 1; color: var(--me); }
.scoreLine b { display: block; font-family: var(--display); font-weight: 400; font-size: 44px; text-align: left; }
.scoreLine small { display: block; text-align: left; font-size: 14px; margin: 4px 0 0; }
#resRows { margin-top: 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 250px)); gap: 8px 36px; text-align: left; }
#resRows div { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
#resRows span { opacity: .8; }
#resRows small { font-size: 12px; font-weight: 400; opacity: .75; }
.row { display: flex; gap: 22px; align-items: center; justify-content: center; flex-wrap: wrap; }
.row .link { margin-top: 30px; }

/* ================= touch ================= */
#touch { position: fixed; inset: 0; pointer-events: none; }
#touch > * { pointer-events: auto; touch-action: none; }
#tLook { position: absolute; right: 0; top: 0; width: 60%; height: 100%; }
#tStick { position: absolute; left: calc(28px + env(safe-area-inset-left)); bottom: calc(90px + env(safe-area-inset-bottom)); width: 132px; height: 132px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
#tStick i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.tb { position: absolute; border: 0; border-radius: 50%; width: 64px; height: 64px; background: rgba(255, 255, 255, .2); color: var(--paper); font-family: var(--display); font-size: 12px; text-shadow: var(--shadow); }
.tb.on { background: rgba(255, 255, 255, .45); }
.tb.big { width: 96px; height: 96px; font-size: 16px; right: calc(26px + env(safe-area-inset-right)); bottom: calc(96px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--me) 55%, transparent); }
#tDive { right: calc(136px + env(safe-area-inset-right)); bottom: calc(60px + env(safe-area-inset-bottom)); }
#tFlare { right: calc(136px + env(safe-area-inset-right)); bottom: calc(136px + env(safe-area-inset-bottom)); }
#tPull { right: calc(40px + env(safe-area-inset-right)); bottom: calc(210px + env(safe-area-inset-bottom)); background: rgba(255, 210, 63, .4); }
.tb.sm { width: 48px; height: 48px; font-size: 10px; }
#tReload { right: calc(210px + env(safe-area-inset-right)); bottom: calc(40px + env(safe-area-inset-bottom)); }
#tWipe { left: calc(40px + env(safe-area-inset-left)); bottom: calc(240px + env(safe-area-inset-bottom)); }

@media (max-width: 640px) {
  #resRows { grid-template-columns: minmax(0, 1fr); }
  .how { font-size: 13px; }
  #hint { display: none; }
  #pops { left: calc(50% + 40px); }
}
