:root {
  --ink: #fff7ff;
  --night: #0b0820;
  --panel: rgba(18, 12, 48, 0.72);
  --line: rgba(255, 255, 255, 0.16);
  --rose: #ff3d8b;
  --aqua: #1fd2ff;
  --lime: #a4f53a;
  --amber: #ffb31f;
  --me: #ff3d8b;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  font-family: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--night); }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; touch-action: none; }
#flash { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; background: radial-gradient(circle, rgba(255,255,255,0) 40%, rgba(255,255,255,.55)); transition: opacity .25s ease-out; }
#flash.hit { background: radial-gradient(circle, rgba(255,40,80,0) 35%, rgba(255,40,80,.6)); }
#flash.on { opacity: 1; transition: none; }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-touch-callout: none; }

.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud button, .stick-zone { pointer-events: auto; }

.top { position: absolute; top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.chip { display: flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); min-height: 40px; }
.chip b { font-size: 21px; font-weight: 900; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.chip small { font-size: 12px; font-weight: 800; opacity: .75; }
.swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--me); box-shadow: 0 0 0 3px rgba(255,255,255,.22) inset; }
.clock { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.clock b { font-size: 24px; font-weight: 900; padding: 4px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.clock b.hurry { color: #ffd84a; animation: pulse .5s ease-in-out infinite alternate; }
#event-tag { font-size: 11px; font-weight: 900; letter-spacing: .08em; padding: 3px 9px; border-radius: 99px; background: #ff4f6d; }
#event-tag:empty { display: none; }
#event-tag.eclipse { background: #6e4dff; }
#event-tag.comet { background: linear-gradient(90deg, #ff6ad5, #ffd84a, #4dffd2, #6aa8ff); color: #1a1040; }
#event-tag.nova { background: #ff3b2f; animation: pulse .35s ease-in-out infinite alternate; }
.round-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; z-index: 6; position: relative; pointer-events: auto; }
.mute-global { position: fixed; top: calc(8px + var(--safe-t)); right: calc(8px + var(--safe-r)); z-index: 30; }
.mute-spacer { width: 44px; height: 44px; flex: none; }
.round-btn[aria-pressed='false'] { border-color: var(--rose); color: var(--rose); }
.round-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round-btn .cross { display: none; }
.round-btn[aria-pressed='false'] .cross { display: block; }
.round-btn[aria-pressed='false'] .waves { display: none; }

.share { position: absolute; top: calc(58px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(46vw, 260px); height: 8px; border-radius: 9px; overflow: hidden; display: flex; background: rgba(255,255,255,.14); }
.share i { display: block; height: 100%; width: 0; transition: width .4s ease; }
.share i:nth-child(1) { background: var(--rose); }
.share i:nth-child(2) { background: var(--aqua); }
.share i:nth-child(3) { background: var(--lime); }
.share i:nth-child(4) { background: var(--amber); }

.board { position: absolute; top: calc(104px + var(--safe-t)); left: calc(8px + var(--safe-l)); margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.board li { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 3px 9px 3px 5px; border-radius: 99px; background: rgba(18,12,48,.55); min-width: 118px; }
.board li.me { background: rgba(255,255,255,.2); }
.board li i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.board li span { flex: 1; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li b { font-variant-numeric: tabular-nums; }

#radar { position: absolute; top: calc(58px + var(--safe-t)); right: calc(8px + var(--safe-r)); width: 100px; height: 100px; border-radius: 50%; background: rgba(18,12,48,.55); border: 1px solid var(--line); }
.wait-note { position: absolute; top: 38%; left: 50%; transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 12px; background: var(--panel); font-size: 13px; font-weight: 800; text-align: center; white-space: nowrap; }

.callout { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); margin: 0; font-size: clamp(18px, 5.4vw, 30px); font-weight: 900; text-align: center; letter-spacing: .02em; width: 92%; text-shadow: 0 3px 0 rgba(20,10,50,.65); opacity: 0; transition: opacity .25s, transform .25s; }
.callout.show { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
.banner { position: absolute; top: 19%; left: 50%; transform: translateX(-50%); width: min(88vw, 460px); padding: 12px 18px; border-radius: 18px; text-align: center; background: linear-gradient(135deg, rgba(255,61,139,.9), rgba(110,77,255,.9)); box-shadow: 0 10px 40px rgba(0,0,0,.35); animation: drop .5s cubic-bezier(.2,1.6,.4,1); }
.banner b { display: block; font-size: clamp(20px, 6vw, 30px); font-weight: 900; letter-spacing: .06em; }
.banner span { display: block; font-size: 13px; font-weight: 700; opacity: .92; margin-top: 2px; }
.banner.eclipse { background: linear-gradient(135deg, rgba(40,20,90,.95), rgba(110,77,255,.9)); }
.banner.nova { background: linear-gradient(135deg, rgba(255,59,47,.95), rgba(255,179,31,.92)); }
.banner.comet { background: linear-gradient(135deg, rgba(255,106,213,.92), rgba(77,200,255,.92)); }
.count { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); font-size: clamp(60px, 22vw, 130px); font-weight: 900; text-shadow: 0 6px 0 rgba(20,10,50,.6); }
.count:empty { display: none; }
.count.pop { animation: countpop .5s cubic-bezier(.2,1.8,.4,1); }

.progress { position: absolute; top: calc(72px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; font-weight: 900; }
.dust { width: 60px; height: 7px; border-radius: 9px; background: rgba(255,255,255,.18); overflow: hidden; }
.dust i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe27a, #ff9de2); transition: width .2s; }
.combo { min-width: 28px; text-align: center; color: #ffe27a; }
.combo.bump { animation: bump .35s ease-out; }

.picks { position: absolute; left: 50%; bottom: calc(196px + var(--safe-b)); transform: translateX(-50%); width: min(94vw, 420px); text-align: center; animation: drop .4s cubic-bezier(.2,1.6,.4,1); z-index: 7; }
.picks p { margin: 0 0 6px; font-size: 14px; font-weight: 900; letter-spacing: .05em; color: #ffe27a; text-shadow: 0 2px 0 rgba(20,10,50,.7); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { min-height: 76px; padding: 9px 8px; border-radius: 16px; border: 2px solid rgba(255,255,255,.55); background: linear-gradient(160deg, rgba(110,77,255,.95), rgba(255,61,139,.9)); display: grid; justify-items: center; gap: 2px; z-index: 7; position: relative; }
.card:active { transform: scale(.96); }
.card .ico { font-size: 22px; line-height: 1; }
.card b { font-size: 14px; font-weight: 900; }
.card small { font-size: 11px; font-weight: 700; opacity: .9; line-height: 1.2; }

.stick-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 62%; touch-action: none; z-index: 6; }
.stick { position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.3); left: calc(92px + var(--safe-l)); top: calc(100% - 112px - var(--safe-b)); opacity: .55; transition: opacity .15s; pointer-events: none; }
.stick.active { opacity: 1; transition: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 4px 14px rgba(0,0,0,.3); }

.actions { position: absolute; right: calc(12px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); width: 190px; height: 190px; }
.act { position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); display: grid; place-items: center; align-content: center; gap: 1px; z-index: 6; box-shadow: 0 6px 0 rgba(10,5,30,.45); }
.act:active, .act.pressed { transform: translateY(3px) scale(.95); box-shadow: 0 2px 0 rgba(10,5,30,.45); }
.act svg { width: 26px; height: 26px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.act em { font-style: normal; font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.jump { right: 0; bottom: 0; width: 88px; height: 88px; background: linear-gradient(160deg, #ffd84a, #ff9a2a); color: #3a1d00; }
.dash { right: 98px; bottom: 6px; width: 70px; height: 70px; background: linear-gradient(160deg, #3be1ff, #4b6bff); }
.dash svg { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.dash.cool { filter: saturate(.3) brightness(.7); }
.super { right: 8px; bottom: 98px; width: 72px; height: 72px; background: rgba(40,24,90,.85); overflow: hidden; }
.super .ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--me) calc(var(--p, 0) * 1%), rgba(255,255,255,.08) 0); opacity: .9; }
.super svg, .super em { position: relative; }
.super.ready { animation: glow .7s ease-in-out infinite alternate; border-color: #fff; }
.super.ready .ring { background: var(--me); }

.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: radial-gradient(circle at 50% 30%, rgba(40,20,100,.35), rgba(8,5,25,.82)); overflow-y: auto; }
.sheet { width: min(100%, 440px); text-align: center; padding: 22px 20px; border-radius: 26px; background: rgba(18,12,48,.82); border: 1px solid var(--line); box-shadow: 0 20px 70px rgba(0,0,0,.5); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 900; letter-spacing: .18em; color: #ffd84a; }
h1 { margin: 6px 0 4px; font-size: clamp(44px, 15vw, 68px); line-height: .92; font-weight: 900; letter-spacing: .02em; }
h1 span { color: #fff; }
h1 em { font-style: normal; display: block; background: linear-gradient(90deg, var(--rose), var(--amber), var(--lime), var(--aqua)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { margin: 6px 0 12px; font-size: clamp(24px, 7vw, 34px); font-weight: 900; }
.pitch { margin: 8px 0 10px; font-size: 14px; line-height: 1.45; font-weight: 600; opacity: .92; }
.howto { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; text-align: left; }
.howto li { font-size: 12px; font-weight: 700; line-height: 1.3; padding: 7px 9px; border-radius: 12px; background: rgba(255,255,255,.07); }
.howto li b { display: block; font-size: 13px; color: #ffe27a; }
.keys { margin: 0 0 12px; font-size: 11px; opacity: .65; font-weight: 700; }
.keys-touch { display: none; }
@media (pointer: coarse) {
  .keys-desktop { display: none; }
  .keys-touch { display: block; }
}
body[data-device="desktop"] .stick-zone,
body[data-device="desktop"] .actions,
body[data-device="desktop"] .keys-touch { display: none !important; }
body[data-device="desktop"] .keys-desktop { display: block !important; }
body[data-device="touch"] .keys-desktop { display: none !important; }
body[data-device="touch"] .keys-touch { display: block !important; }
.primary { width: 100%; min-height: 54px; border: 0; border-radius: 18px; font-size: 20px; font-weight: 900; letter-spacing: .08em; color: #2a0b30; background: linear-gradient(90deg, #ffd84a, #ff7ab6); box-shadow: 0 6px 0 #9c2a66; position: relative; z-index: 21; }
.primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #9c2a66; }
.primary:disabled { filter: grayscale(.6) brightness(.8); }
form { display: grid; gap: 8px; text-align: left; }
form label { font-size: 12px; font-weight: 800; opacity: .8; }
input { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: #fff; min-height: 48px; }
.status { min-height: 1.2em; margin: 10px 0 0; font-size: 13px; font-weight: 700; opacity: .85; }
.credit { margin: 10px 0 0; font-size: 11px; font-weight: 800; letter-spacing: .06em; opacity: .55; }
.credit span { color: #ff7ab6; }

.ranking { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.ranking li { display: grid; grid-template-columns: 34px 14px 1fr auto; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 14px; background: rgba(255,255,255,.07); font-weight: 800; text-align: left; }
.ranking li.me { background: rgba(255,255,255,.18); outline: 2px solid rgba(255,255,255,.4); }
.ranking li .pos { font-size: 15px; color: #ffe27a; }
.ranking li i { width: 14px; height: 14px; border-radius: 50%; }
.ranking li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking li small { display: block; font-size: 11px; opacity: .65; font-weight: 700; }
.ranking li b { font-size: 18px; font-variant-numeric: tabular-nums; }
.medals { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 8px; }
.medals span { font-size: 12px; font-weight: 900; padding: 6px 10px; border-radius: 99px; background: linear-gradient(90deg, #ffd84a, #ff9de2); color: #2a0b30; animation: drop .5s cubic-bezier(.2,1.6,.4,1) backwards; }

.swatch.c0, .board .c0, .ranking .c0 { background: var(--rose); }
.swatch.c1, .board .c1, .ranking .c1 { background: var(--aqua); }
.swatch.c2, .board .c2, .ranking .c2 { background: var(--lime); }
.swatch.c3, .board .c3, .ranking .c3 { background: var(--amber); }
.hud.c0 { --me: var(--rose); }
.hud.c1 { --me: var(--aqua); }
.hud.c2 { --me: var(--lime); }
.hud.c3 { --me: var(--amber); }

@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -16px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.medals span { animation-name: medal; }
@keyframes medal { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes countpop { from { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes bump { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }
@keyframes glow { from { box-shadow: 0 6px 0 rgba(10,5,30,.45), 0 0 0 0 var(--me); } to { box-shadow: 0 6px 0 rgba(10,5,30,.45), 0 0 22px 6px var(--me); } }

@media (orientation: landscape) and (max-height: 520px) {
  .board { display: none; }
  .progress { top: calc(56px + var(--safe-t)); }
  .share { top: calc(48px + var(--safe-t)); }
  .stick-zone { height: 80%; }
  .actions { transform: scale(.9); transform-origin: bottom right; }
  .picks { bottom: calc(10px + var(--safe-b)); width: min(60vw, 420px); }
  .callout { top: 26%; }
  .sheet { padding: 14px 18px; }
  h1 { font-size: 40px; }
  .howto { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .board li { min-width: 100px; font-size: 11px; }
  #radar { width: 84px; height: 84px; }
  .actions { transform: scale(.92); transform-origin: bottom right; }
}
@media (prefers-reduced-motion: reduce) {
  .banner, .picks, .count.pop, .medals span, .super.ready, .clock b.hurry, #event-tag.nova { animation: none; }
}
