/* Mic Drop Melee -- every size is a golden-ratio step from one base unit (--u, set by JS). */
:root {
  --u: 15px;
  --phi: 1.618;
  --s-2: calc(var(--u) * .382);
  --s-1: calc(var(--u) * .618);
  --s0: var(--u);
  --s1: calc(var(--u) * 1.618);
  --s2: calc(var(--u) * 2.618);
  --s3: calc(var(--u) * 4.236);
  --s4: calc(var(--u) * 6.854);
  --stroke: calc(var(--u) * .236);

  --ink: #140b22;
  --paper: #fff4d6;
  --sun: #ffd21f;
  --hot: #ff3e8a;
  --teal: #19d3c5;
  --fire: #2fe38a;
  --p1: #ffd21f;
  --p2: #ff3e8a;
  --disp: 'Bangers', Impact, 'Arial Narrow Bold', sans-serif;
  --body: 'Fredoka', 'Trebuchet MS', 'Segoe UI Rounded', sans-serif;
}
:root:not([data-theme="light"]) { color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper); font-family: var(--body); font-weight: 500; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
canvas#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: var(--stroke) solid var(--teal); outline-offset: 2px; }

/* ---------- fixed mini buttons ---------- */
#sg-fs-btn, .sg-mini {
  position: fixed; top: 8px; right: 8px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 6px;
  background: rgba(0,0,0,.45); color: #fff; z-index: 9999;
}
#sg-fs-btn:hover, .sg-mini:hover { background: rgba(0,0,0,.7); }
#sg-mute-btn { right: 42px; }
#sg-pause-btn { right: 76px; }

/* ---------- HUD ---------- */
#hud { position: fixed; left: 0; right: 0; top: 0; padding: var(--s-1) var(--s1) 0; padding-right: 116px; pointer-events: none; z-index: 10; }
.hud-top { display: flex; gap: var(--s1); align-items: baseline; font-family: var(--disp); letter-spacing: .06em; font-size: var(--s0); text-shadow: 0 2px 0 var(--ink); min-height: 26px; }
.hud-top > * { white-space: nowrap; }
.hud-round { color: var(--sun); font-size: var(--s1); }
.hud-score b { color: #fff; font-size: var(--s1); font-weight: 400; }
.hud-mics { margin-left: auto; color: var(--hot); letter-spacing: .2em; }
.crowd { display: flex; align-items: center; gap: var(--s-1); margin-top: var(--s-2); margin-right: -100px; padding-right: var(--s1); }
.crowd .nm { font-family: var(--disp); font-size: var(--s0); letter-spacing: .05em; min-width: 0; max-width: 22%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 var(--ink); }
.crowd .nm.r { text-align: right; }
.crowd .bar { position: relative; flex: 1; height: var(--s1); border: var(--stroke) solid var(--ink); border-radius: 999px; background: var(--p2); box-shadow: 0 var(--s-2) 0 rgba(0,0,0,.5); overflow: hidden; }
.crowd .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: var(--p1); transition: width .25s cubic-bezier(.2,.8,.2,1); }
.crowd .bar em { position: absolute; left: 50%; top: -20%; bottom: -20%; width: var(--s-2); margin-left: calc(var(--s-2) / -2); background: #fff; box-shadow: 0 0 var(--s-1) #fff; transition: left .25s cubic-bezier(.2,.8,.2,1); }
.hud-combo { font-family: var(--disp); color: var(--fire); font-size: var(--s1); letter-spacing: .08em; text-shadow: 0 2px 0 var(--ink); height: var(--s2); margin-top: var(--s-2); }
.hud-combo.pop { animation: pop .3s ease-out; }

/* ---------- banner ---------- */
#banner { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; z-index: 20; font-family: var(--disp); font-size: var(--s3); letter-spacing: .05em; color: var(--sun); -webkit-text-stroke: var(--stroke) var(--ink); paint-order: stroke fill; text-shadow: 0 var(--s-1) 0 var(--ink); opacity: 0; transform: scale(.6); }
#banner.show { animation: bannerPop calc(var(--dur, 900ms)) cubic-bezier(.2,1.4,.4,1) forwards; }
#banner.perfect { color: var(--fire); } #banner.bad { color: var(--hot); } #banner.legend { color: #fff; text-shadow: 0 0 var(--s1) var(--sun), 0 var(--s-1) 0 var(--ink); } #banner.big { font-size: var(--s4); }
@keyframes bannerPop {
  0% { opacity: 0; transform: scale(.5) rotate(-4deg); }
  22% { opacity: 1; transform: scale(1.12) rotate(1deg); }
  38% { transform: scale(1) rotate(0); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.08) translateY(-8px); }
}
@keyframes pop { 0% { transform: scale(1.4); } 100% { transform: scale(1); } }

/* ---------- lyric panel ---------- */
#lyric { pointer-events: none; position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, calc(var(--u) * 52)); padding: var(--s0) var(--s1) calc(var(--s1) + env(safe-area-inset-bottom)); z-index: 10; }
#lyric::before { content: ''; position: absolute; left: -50vw; right: -50vw; top: calc(var(--s2) * -1); bottom: 0; z-index: -1; background: linear-gradient(to bottom, rgba(13,7,24,0), rgba(13,7,24,.82) 38%); }
.card, #yuck { pointer-events: auto; }
#lyric .who { display: inline-block; font-family: var(--disp); letter-spacing: .08em; font-size: var(--s0); padding: var(--s-2) var(--s0); background: var(--p1); color: var(--ink); border: var(--stroke) solid var(--ink); border-radius: var(--s-1); transform: rotate(-2deg); box-shadow: var(--s-2) var(--s-2) 0 var(--ink); margin-bottom: var(--s-1); }
#lyric .who.opp { background: var(--p2); color: #fff; transform: rotate(2deg); }
#lyric p { margin: 0; font-size: var(--s1); line-height: 1.2; text-shadow: 0 2px 0 var(--ink), 0 0 var(--s0) var(--ink); font-weight: 700; }
#lyric p.la { color: #fff; } #lyric p.lb { color: var(--paper); min-height: 1.3em; }
#lyric p.la.opp { color: var(--hot); font-family: var(--disp); font-weight: 400; letter-spacing: .03em; font-size: var(--s2); line-height: 1.05; }
.blank { display: inline-block; min-width: 3.6em; text-align: center; border-bottom: calc(var(--stroke) * 1.3) solid var(--sun); margin: 0 .15em; color: var(--sun); animation: blink 1s steps(2) infinite; }
.blank.filled { animation: none; border-bottom-color: transparent; font-family: var(--disp); letter-spacing: .04em; font-weight: 400; font-size: 1.15em; padding: 0 .2em; }
.blank.t-fire { color: var(--fire); } .blank.t-mid { color: var(--sun); } .blank.t-dud { color: var(--hot); }
@keyframes blink { 50% { opacity: .35; } }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-1); margin-top: var(--s0); }
.card { position: relative; min-height: var(--s3); padding: var(--s-1) var(--s-2); border: var(--stroke) solid var(--ink); border-radius: var(--s0); background: var(--paper); color: var(--ink); font-family: var(--disp); font-size: var(--s1); letter-spacing: .04em; text-transform: uppercase; line-height: 1; box-shadow: 0 var(--s-1) 0 var(--ink); transition: transform .08s, box-shadow .08s, opacity .2s, background .2s; overflow-wrap: anywhere; display: flex; align-items: center; justify-content: center; text-align: center; touch-action: manipulation; }
.card kbd { position: absolute; top: 2px; left: 6px; font: 700 var(--s-1)/1 var(--body); opacity: .4; }
.card:active, .card.picked { transform: translateY(var(--s-2)); box-shadow: 0 var(--s-2) 0 var(--ink); }
.card.picked { background: var(--sun); }
.card.best { background: var(--fire); }
.card.picked.dud { background: var(--hot); color: #fff; }
.card.dim { opacity: .35; }
.card.gone { visibility: hidden; }
.cards.lock .card { pointer-events: none; }
.cards.hush { opacity: 0; pointer-events: none; }
.cards.hush .card { pointer-events: none; }
.cards.blur .card { filter: blur(var(--s-2)); animation: jitter .18s linear infinite; }
@keyframes jitter { 0% { transform: translate(0,0); } 25% { transform: translate(2px,-2px); } 50% { transform: translate(-2px,1px); } 75% { transform: translate(1px,2px); } }
#yuck { position: absolute; right: var(--s1); top: calc(var(--s0) * -.4); font-family: var(--disp); font-size: var(--s0); letter-spacing: .06em; padding: var(--s-2) var(--s0); border: var(--stroke) solid var(--ink); border-radius: 999px; background: #8be35c; color: var(--ink); box-shadow: 0 var(--s-2) 0 var(--ink); transform: rotate(3deg); }
#yuck:disabled { opacity: .35; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: var(--s1); z-index: 30; background: rgba(13,7,24,.55); overflow-y: auto; }
.screen.on { display: flex; }
#screen-title { background: radial-gradient(ellipse at center, rgba(13,7,24,.25), rgba(13,7,24,.78)); }
#screen-title.demo { background: none; pointer-events: auto; }
#screen-title.demo .panel { display: none; }
.demo-tag { display: none; position: absolute; top: calc(var(--u) * 7.2); left: 0; right: 0; text-align: center; font-family: var(--disp); font-size: var(--s2); letter-spacing: .08em; color: var(--sun); -webkit-text-stroke: var(--stroke) var(--ink); paint-order: stroke fill; animation: blink 1s steps(2) infinite; }
#screen-title.demo .demo-tag { display: block; }

.panel { width: min(100%, calc(var(--u) * 30)); max-height: 100%; overflow-y: auto; padding: var(--s1) var(--s1) var(--s2); text-align: center; background: var(--paper); color: var(--ink); border: var(--stroke) solid var(--ink); border-radius: var(--s1); box-shadow: var(--s-1) var(--s-1) 0 var(--ink), var(--s0) var(--s0) 0 var(--hot); }
.panel.wide { width: min(100%, calc(var(--u) * 52)); }
.panel h2 { font-family: var(--disp); font-weight: 400; font-size: var(--s2); letter-spacing: .05em; margin: 0 0 var(--s0); color: var(--ink); }
.title-panel { background: transparent; border: 0; box-shadow: none; color: var(--paper); overflow: visible; }
.logo { margin: 0; font-family: var(--disp); font-weight: 400; line-height: .86; display: flex; flex-direction: column; align-items: center; transform: rotate(-3deg); }
.logo span { font-size: min(var(--s4), 30vw); color: var(--sun); -webkit-text-stroke: var(--stroke) var(--ink); paint-order: stroke fill; text-shadow: 0 var(--s-1) 0 var(--ink), var(--s-1) var(--s0) 0 var(--hot); letter-spacing: .03em; }
.logo .l2 { color: var(--hot); font-size: min(calc(var(--s4) * 1.5), 36vw); text-shadow: 0 var(--s-1) 0 var(--ink), var(--s-1) var(--s0) 0 var(--sun); animation: wob 2.4s ease-in-out infinite; }
@keyframes wob { 50% { transform: rotate(2deg) scale(1.03); } }
.tag { font-size: var(--s1); margin: var(--s1) 0 var(--s1); font-weight: 700; text-shadow: 0 2px 0 var(--ink); }
.btns { display: flex; flex-direction: column; gap: var(--s-1); align-items: center; }
.big, .sm { font-family: var(--disp); letter-spacing: .06em; border: var(--stroke) solid var(--ink); border-radius: 999px; background: var(--sun); color: var(--ink); box-shadow: 0 var(--s-1) 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.big { font-size: var(--s2); padding: var(--s-1) var(--s2); min-width: calc(var(--u) * 12); max-width: 100%; }
#btnFight { font-size: var(--s1); white-space: normal; line-height: 1.05; }
.sm { font-size: var(--s1); padding: var(--s-2) var(--s1); background: var(--paper); min-width: calc(var(--u) * 10); }
.big:active, .sm:active { transform: translateY(var(--s-2)); box-shadow: 0 var(--s-2) 0 var(--ink); }
.big:disabled { opacity: .5; filter: grayscale(.6); cursor: default; }
.hint { font-size: var(--s0); opacity: .85; margin: var(--s0) 0 0; }
.title-panel .hint { text-shadow: 0 2px 0 var(--ink); }
.panel .hint { color: #4a3a64; }
.panel.title-panel .hint { color: var(--paper); }
.tag { max-width: 22em; }
.quote { font-size: var(--s1); font-weight: 700; margin: 0 0 var(--s0); font-style: italic; }
.how { text-align: left; font-size: var(--s0); line-height: 1.35; padding-left: var(--s2); margin: 0 0 var(--s0); font-weight: 700; }
.how li { margin-bottom: var(--s-1); } .how b { color: var(--hot); }
.stats { list-style: none; padding: 0; margin: 0 0 var(--s1); font-size: var(--s0); font-weight: 700; }
.stats li { display: flex; justify-content: space-between; gap: var(--s0); padding: var(--s-2) 0; border-bottom: 2px dashed rgba(20,11,34,.25); }
.stats li.tot { font-family: var(--disp); font-size: var(--s1); border-bottom: 0; letter-spacing: .05em; }
.final { font-family: var(--disp); font-size: var(--s1); letter-spacing: .06em; margin: 0 0 var(--s0); } .final b { color: var(--hot); font-size: var(--s2); font-weight: 400; }
#initialsBox { margin-bottom: var(--s1); }
#initialsBox label { display: block; font-size: var(--s0); font-weight: 700; margin-bottom: var(--s-1); }
#initials { width: 5em; text-align: center; text-transform: uppercase; font-family: var(--disp); font-size: var(--s2); letter-spacing: .2em; padding: var(--s-2); border: var(--stroke) solid var(--ink); border-radius: var(--s0); background: #fff; color: var(--ink); }
.boards { list-style: none; counter-reset: b; padding: 0; margin: 0 0 var(--s1); text-align: left; font-size: var(--s0); font-weight: 700; }
.boards li { counter-increment: b; display: flex; gap: var(--s0); padding: var(--s-2) var(--s-1); border-bottom: 2px dashed rgba(20,11,34,.2); }
.boards li::before { content: counter(b) "."; width: 2em; font-family: var(--disp); color: var(--hot); }
.boards li .n { font-family: var(--disp); letter-spacing: .12em; flex: 0 0 4em; }
.boards li .c { flex: 1; opacity: .7; } .boards li .s { font-family: var(--disp); letter-spacing: .05em; }
.boards li.me { background: var(--sun); border-radius: var(--s-1); }

.roster { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s0); margin-bottom: var(--s0); }
@media (min-aspect-ratio: 5/4) { .roster { grid-template-columns: repeat(4, 1fr); } }
.fighter { padding: var(--s-1); border: var(--stroke) solid var(--ink); border-radius: var(--s0); background: #fff; box-shadow: 0 var(--s-1) 0 var(--ink); text-align: center; color: var(--ink); transition: transform .12s, background .12s; }
.fighter canvas { width: 100%; aspect-ratio: 4 / 5; display: block; border-radius: var(--s-1); background: var(--bg, #eee); }
.fighter .nm { font-family: var(--disp); font-size: var(--s1); letter-spacing: .05em; margin-top: var(--s-1); }
.fighter .pk { font-size: calc(var(--u) * .8); font-weight: 700; opacity: .75; line-height: 1.2; min-height: 2.4em; }
.fighter.sel { background: var(--sun); transform: translateY(calc(var(--s-1) * -1)) rotate(-1.5deg); }
.perk { min-height: 2.6em; font-size: var(--s0); font-weight: 700; margin: 0 0 var(--s0); color: #4a3a64; }

@media (prefers-reduced-motion: reduce) {
  .logo .l2, .blank, .demo-tag { animation: none; }
}
