:root { --gold: #ffb627; --red: #c0182a; --ink: #f4ead8; --bg: #120a0e; --epic: #a970ff; --leg: #ffb627; --common: #9aa0a6; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; overflow: hidden; touch-action: none; }
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(0,0,0,.55) 100%); }
#flash { position: absolute; inset: 0; pointer-events: none; background: #fff; opacity: 0; mix-blend-mode: screen; }
.hidden { display: none !important; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.screen.show { display: flex; }
.screen.dim { background: rgba(10, 5, 8, .72); backdrop-filter: blur(3px); }
.logo { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1; }
.logo .studio { font-size: 12px; letter-spacing: .4em; text-transform: uppercase; color: #d9c7a8; opacity: .85; margin-bottom: 8px; }
.logo b { font-family: Impact, "Arial Black", sans-serif; font-weight: 900; font-size: clamp(34px, 8vw, 84px); letter-spacing: .04em; text-transform: uppercase;
  background: linear-gradient(180deg, #fff3cf 0%, #ffcf5a 40%, #c0182a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #2a0508) drop-shadow(0 0 18px rgba(255,140,40,.45)); }
.logo i { font-style: normal; font-size: clamp(12px, 2vw, 16px); letter-spacing: .3em; text-transform: uppercase; color: #ffd98a; margin-top: 8px; }
.bar { width: min(60vw, 420px); height: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .2s; }
#bootNote, .note { font-size: 13px; opacity: .8; text-align: center; max-width: 60ch; }
.menu { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.row { display: flex; gap: 10px; }
.btn { appearance: none; border: 1px solid rgba(255,214,140,.35); background: rgba(30,14,18,.78); color: var(--ink); padding: 11px 20px; border-radius: 10px; font-size: 15px; font-weight: 700; letter-spacing: .04em; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.btn small { font-weight: 400; font-size: 11px; opacity: .75; }
.btn.primary { background: linear-gradient(180deg, #d42a2a, #7a0d16); border-color: #ffb627; box-shadow: 0 0 18px rgba(255,120,40,.35); min-width: 220px; font-size: 18px; }
.btn.ghost { background: transparent; }
.panel { background: rgba(24,12,16,.94); border: 1px solid rgba(255,214,140,.3); border-radius: 14px; padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 280px; max-width: 92vw; max-height: 88vh; overflow: auto; }
.panel.wide { width: min(860px, 92vw); }
.panel h2 { margin: 0 0 4px; font-family: Impact, "Arial Black", sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #ffd98a; }
.small { font-size: 12.5px; line-height: 1.45; opacity: .92; }
.seg { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.35); border-radius: 10px; padding: 4px; }
.seg span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; padding: 0 8px; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--ink); padding: 7px 12px; border-radius: 7px; font-weight: 700; font-size: 13px; cursor: pointer; }
.seg button.on { background: linear-gradient(180deg, #ffcf5a, #c47a12); color: #1a0a06; }

/* select */
#select { justify-content: space-between; align-items: stretch; gap: 8px; background: linear-gradient(90deg, rgba(10,4,8,.85) 0%, rgba(10,4,8,.45) 45%, rgba(10,4,8,.0) 62%), linear-gradient(180deg, rgba(10,4,8,.6) 0%, rgba(10,4,8,0) 32%); }
.sel-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.sel-head h2 { margin: 0; font-family: Impact, "Arial Black", sans-serif; letter-spacing: .05em; text-transform: uppercase; font-size: clamp(20px, 3.4vw, 32px); color: #ffd98a; text-shadow: 0 2px 0 #2a0508; }
.hint { font-size: 12px; opacity: .75; letter-spacing: .12em; text-transform: uppercase; }
.sel-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; align-items: flex-start; }
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; max-width: 1100px; }
.card { position: relative; border-radius: 10px; padding: 9px 10px 8px; background: linear-gradient(160deg, rgba(40,18,22,.92), rgba(16,8,10,.92)); border: 2px solid rgba(255,255,255,.08); cursor: pointer; overflow: hidden; min-height: 52px; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--c1), var(--c2)); }
.card b { display: block; font-size: clamp(13px, 1.7vw, 17px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .02em; padding-left: 4px; }
.card em { display: block; font-style: normal; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .7; padding-left: 4px; }
.card .rar { display: inline-block; margin: 0 0 3px 4px; font-size: 8.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 2px 6px; border-radius: 99px; color: #1a0a06; }
.card .rar.Legendary { background: linear-gradient(180deg, #ffe08a, var(--leg)); box-shadow: 0 0 10px rgba(255,182,39,.6); }
.card .rar.Epic { background: linear-gradient(180deg, #d4b8ff, var(--epic)); }
.card .rar.Common { background: var(--common); }
.card.on { border-color: #ffd98a; box-shadow: 0 0 0 2px rgba(255,217,138,.25), 0 0 22px rgba(255,150,40,.35); }
.card.p2 { border-color: #7fb8ff; }
.card .tag2 { position: absolute; right: 6px; bottom: 5px; font-size: 10px; font-weight: 800; color: #7fb8ff; }
.info { width: min(48vw, 520px); flex: 0 1 auto; min-height: 0; overflow: auto; font-size: 12.5px; line-height: 1.4; background: rgba(12,6,8,.6); border-radius: 12px; padding: 12px 14px; border: 1px solid rgba(255,214,140,.18); }
.info h3 { margin: 0; font-size: clamp(18px, 2.6vw, 26px); font-family: Impact, "Arial Black", sans-serif; letter-spacing: .04em; }
.info .meta { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .75; margin: 2px 0 6px; }
.info ul { padding-left: 16px; margin: 6px 0 0; columns: 2 220px; column-gap: 16px; } .info li { margin: 2px 0; }
.sel-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.sel-foot .seg { margin-right: auto; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
.bars { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); display: flex; align-items: flex-start; gap: 10px; }
.side { flex: 1; }
.name { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; letter-spacing: .05em; text-transform: uppercase; text-shadow: 0 1px 2px #000; }
.s1 .name { justify-content: flex-end; }
.name em { font-style: normal; font-size: 9px; padding: 1px 6px; border-radius: 99px; color: #1a0a06; background: var(--leg); letter-spacing: .1em; }
.name em.Epic { background: var(--epic); }
.pips i { display: inline-block; width: 11px; height: 11px; margin: 0 2px; border-radius: 50%; border: 2px solid #ffd98a; background: transparent; }
.pips i.won { background: radial-gradient(#fff6c8, #ffb627); box-shadow: 0 0 8px #ffb627; }
.hp { position: relative; height: 16px; margin-top: 3px; background: rgba(0,0,0,.6); border: 2px solid rgba(255,230,180,.8); border-radius: 3px; overflow: hidden; transform: skewX(-14deg); }
.s1 .hp { transform: skewX(14deg); }
.hp i { position: absolute; top: 0; bottom: 0; right: 0; width: 100%; }
.s1 .hp i { left: 0; right: auto; }
.hp .lag { background: #fff3c4; transition: width .5s .25s; }
.hp .cur { background: linear-gradient(180deg, #ffe26b, #e0a10f 55%, #b26a00); }
.hp.low .cur { background: linear-gradient(180deg, #ff6b4a, #c0182a); }
.tags { margin-top: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; color: #fff; text-shadow: 0 0 6px #000; min-height: 14px; }
.s1 .tags { text-align: right; }
.timer { font-family: Impact, "Arial Black", sans-serif; font-size: 34px; color: #fff3c4; text-shadow: 0 2px 0 #4a0a10, 0 0 14px rgba(255,140,40,.6); min-width: 56px; text-align: center; margin-top: -2px; }
.meters { position: absolute; bottom: calc(42vh + 6px); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); display: flex; justify-content: space-between; }
body.nopad .meters { bottom: max(14px, env(safe-area-inset-bottom)); }
.meter { position: relative; width: 26vw; max-width: 240px; height: 9px; background: rgba(0,0,0,.6); border: 1px solid rgba(160,200,255,.6); border-radius: 5px; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #3b6bff, #9fd2ff); }
.m1 i { left: auto; right: 0; }
.meter.full i { background: linear-gradient(90deg, #ffcf5a, #fff7d6, #ffcf5a); box-shadow: 0 0 10px #ffcf5a; animation: pulse .6s infinite alternate; }
.meter span { position: absolute; top: -15px; font-size: 10px; letter-spacing: .2em; font-weight: 800; color: #bcd6ff; }
.m1 span { right: 0; }
@keyframes pulse { from { filter: brightness(1) } to { filter: brightness(1.5) } }
#announce { position: absolute; left: 0; right: 0; top: 28%; text-align: center; font-family: Impact, "Arial Black", sans-serif; font-size: clamp(38px, 9vw, 96px); letter-spacing: .05em; text-transform: uppercase; color: #fff3cf; -webkit-text-stroke: 2px #4a0a10; text-shadow: 0 4px 0 #2a0508, 0 0 30px rgba(255,120,40,.7); opacity: 0; transform: scale(1.4); transition: opacity .15s, transform .25s; }
#announce.on { opacity: 1; transform: scale(1); }
#announce.gold { color: #ffd76a; }
#sub { position: absolute; left: 10%; right: 10%; top: calc(28% + clamp(46px, 10vw, 110px)); text-align: center; font-size: clamp(13px, 2vw, 18px); color: #fff; text-shadow: 0 1px 3px #000, 0 0 12px rgba(0,0,0,.8); opacity: 0; transition: opacity .3s; }
#sub.on { opacity: 1; }
.combo { position: absolute; top: 22%; font-family: Impact, "Arial Black", sans-serif; font-size: clamp(18px, 3.4vw, 34px); color: #ffe08a; -webkit-text-stroke: 1px #4a0a10; text-shadow: 0 2px 0 #2a0508; opacity: 0; transition: opacity .2s; }
.combo.on { opacity: 1; } .c0 { left: 4%; } .c1 { right: 4%; text-align: right; }
.combo small { display: block; font-family: "Trebuchet MS", sans-serif; font-size: .45em; letter-spacing: .1em; color: #fff; -webkit-text-stroke: 0; }
.hud-btn { position: absolute; top: max(48px, calc(env(safe-area-inset-top) + 40px)); left: 50%; transform: translateX(-50%); pointer-events: auto; width: 34px; height: 26px; border-radius: 7px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.45); color: #fff; font-weight: 800; font-size: 11px; }

/* touch pad: bottom band */
#pad { position: absolute; left: 0; right: 0; bottom: 0; height: 42vh; pointer-events: none; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
.stick { position: relative; width: min(34vh, 190px); height: min(34vh, 190px); pointer-events: auto; touch-action: none; }
.stick .base { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.08), rgba(255,255,255,.02)); border: 2px solid rgba(255,230,180,.28); }
.stick .knob { position: absolute; left: 50%; top: 50%; width: 38%; height: 38%; margin: -19% 0 0 -19%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255,240,210,.55), rgba(140,60,40,.45)); border: 2px solid rgba(255,230,180,.6); }
.stick .arrows { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; line-height: 4.2; opacity: .45; pointer-events: none; }
.buttons { display: grid; grid-template-columns: repeat(4, min(9.5vh, 58px)); grid-template-rows: repeat(3, min(9.5vh, 58px)); gap: 7px; pointer-events: auto; grid-template-areas: "s1 s2 sup sup" "hp hk thr blk" "lp lk thr blk"; }
.buttons button { appearance: none; border-radius: 50%; border: 2px solid rgba(255,230,180,.55); background: radial-gradient(circle at 40% 30%, rgba(90,40,40,.75), rgba(25,10,12,.8)); color: #fff; font-weight: 900; font-size: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; padding: 0; line-height: 1; }
.buttons button small { font-size: 7.5px; font-weight: 600; opacity: .75; letter-spacing: .02em; margin-top: 2px; }
.buttons button.down { transform: scale(.92); background: radial-gradient(circle at 40% 30%, rgba(255,190,90,.85), rgba(160,50,20,.9)); }
.buttons [data-b=HP] { grid-area: hp } .buttons [data-b=HK] { grid-area: hk } .buttons [data-b=LP] { grid-area: lp } .buttons [data-b=LK] { grid-area: lk }
.buttons .sp { grid-area: s1; border-radius: 12px; font-size: 13px; background: radial-gradient(circle at 40% 30%, rgba(120,40,120,.8), rgba(30,8,30,.85)); }
.buttons #bS2 { grid-area: s2 }
.buttons .ut { grid-area: thr; border-radius: 14px; font-size: 11px; }
.buttons .blk { grid-area: blk; border-radius: 14px; font-size: 11px; background: radial-gradient(circle at 40% 30%, rgba(40,70,140,.8), rgba(8,14,40,.85)); }
.buttons .sup { grid-area: sup; border-radius: 14px; font-size: 12px; opacity: .45; }
.buttons .sup.ready { opacity: 1; border-color: #ffd76a; box-shadow: 0 0 14px #ffb627; animation: pulse .5s infinite alternate; }
.buttons .judge { grid-area: sup; border-radius: 14px; font-size: 10px; background: linear-gradient(180deg, #ffe08a, #c47a12); color: #2a0a06; box-shadow: 0 0 22px #ffb627; animation: pulse .4s infinite alternate; }

#rotate { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; background: rgba(10,5,8,.94); z-index: 50; }
#rotate b { font-size: 64px; display: block; color: var(--gold); }
@media (orientation: portrait) { body:not(.portrait-ok) #rotate.armed { display: flex; } }
body.portrait-ok #pad { height: 34vh; }
@media (orientation: portrait) { body.portrait-ok .meters { bottom: calc(34vh + 6px); } .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 92vw; } .sel-body { flex-direction: column; } .info { width: 92vw; } }
