:root {
  --ink: #2b1d38; --cyan: #2fd6ee; --gold: #ffc62e; --pink: #ff5c7a; --orange: #ff7a1a;
  --panel: rgba(255, 255, 255, .95); --shadow: 0 10px 30px rgba(43, 29, 56, .3);
  --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);
  --ctlH: 0px; --S: 96px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1a3a; color: var(--ink); font-family: 'Fredoka', 'Jua', system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; -webkit-touch-callout: none; }
#gl, #c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#c { pointer-events: none; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; background: none; padding: 0; touch-action: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* 버튼 */
.big-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 250px; height: 66px; padding: 0 26px; border-radius: 999px; font-size: 26px; font-weight: 700; color: #fff; background: linear-gradient(180deg, #ffa43c, #ff6a1a); box-shadow: 0 7px 0 #c4520a, 0 14px 24px rgba(0, 0, 0, .25); text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #c4520a; }
.big-btn .mi { font-size: 28px; }
.big-btn .cnt:empty, .mode-btn b:empty { display: none; }
.big-btn .cnt { font-size: 18px; padding: 2px 10px; border-radius: 999px; background: rgba(43, 29, 56, .25); }
.big-btn.go { position: absolute; bottom: calc(18px + var(--safe-b)); left: 50%; transform: translateX(-50%); min-width: 190px; }
.big-btn.go:active { transform: translate(-50%, 5px); }
.mid-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; min-width: 52px; padding: 0 16px; border-radius: 16px; font-size: 22px; font-weight: 700; background: #fff; box-shadow: 0 5px 0 rgba(43, 29, 56, .2); }
.mid-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 29, 56, .2); }
.mid-btn.on { background: #c8ffd0; box-shadow: 0 5px 0 #4fb665; }
.ic-btn { position: relative; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: rgba(255, 255, 255, .92); box-shadow: 0 4px 0 rgba(43, 29, 56, .2); font-size: 22px; font-weight: 700; }
.mode-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: min(30vw, 122px); height: 84px; border-radius: 22px; background: #fff; box-shadow: 0 6px 0 rgba(43, 29, 56, .2); font-size: 16px; font-weight: 700; }
.mode-btn .mi { font-size: 26px; line-height: 1; }
.mode-btn b { font-size: 13px; color: var(--orange); }
.mode-btn:active { transform: translateY(3px); }

/* 화면 */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; z-index: 10; }
.screen.dim { background: rgba(43, 29, 56, .55); justify-content: center; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.row.col { flex-direction: column; gap: 18px; }
#menu { justify-content: space-between; padding: calc(64px + var(--safe-t)) 16px calc(16px + var(--safe-b)); pointer-events: none; background: linear-gradient(180deg, rgba(43, 29, 56, .25), rgba(43, 29, 56, 0) 30%, rgba(43, 29, 56, .55)); }
#menu > * { pointer-events: auto; }
.hub-link { position: absolute; top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l)); }
.logo-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: .9; font-family: 'Jua', 'Fredoka', sans-serif; font-weight: 400; text-align: center; }
.logo span { display: block; color: #fff; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); letter-spacing: 1px; }
.logo span:first-child { font-size: clamp(54px, 15vmin, 96px); color: #ffe14a; }
.logo span:last-child { font-size: clamp(40px, 11.5vmin, 78px); color: #ff7a3c; margin-top: 2px; }
.faces { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; max-width: 92vw; }
.faces img { width: clamp(34px, 9vmin, 54px); height: auto; filter: drop-shadow(0 3px 0 rgba(43, 29, 56, .5)); }
.menu-bottom { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%; }
.studio { font-size: 12px; color: #fff; opacity: .75; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }

/* 선택 */
#sel { background: linear-gradient(180deg, #ffb35c, #ff7ab0); justify-content: flex-start; padding: calc(10px + var(--safe-t)) 12px 90px; }
.sel-top { width: 100%; display: flex; align-items: center; gap: 12px; font-family: 'Jua', sans-serif; font-size: 26px; color: #fff; text-shadow: 0 3px 0 var(--ink); }
.sel-main { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 0; }
.sel-big { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; }
.sel-big img { width: min(22vh, 40vw); height: auto; filter: drop-shadow(0 6px 0 rgba(43, 29, 56, .35)); }
.sel-big b { font-family: 'Jua', sans-serif; font-size: 30px; font-weight: 400; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#selStats { display: flex; gap: 10px; background: rgba(255, 255, 255, .92); border-radius: 16px; padding: 6px 12px; color: var(--ink); font-weight: 700; font-size: 15px; }
#selStats span { display: flex; align-items: center; gap: 4px; }
#selStats i { display: inline-block; width: 44px; height: 9px; border-radius: 5px; background: #e3e0ec; position: relative; overflow: hidden; }
#selStats i::after { content: ''; position: absolute; inset: 0; width: var(--v); background: linear-gradient(90deg, #ffb13c, #ff5c3c); border-radius: 5px; }
#selMoves { font-size: 28px; letter-spacing: 6px; filter: drop-shadow(0 2px 0 rgba(43, 29, 56, .4)); }
.sel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 320px); }
.sel-big b small { display: block; font-size: 15px; -webkit-text-stroke: 3px var(--ink); opacity: .95; }
.sel-grid button { position: relative; aspect-ratio: 1; border-radius: 18px; background: #fff; box-shadow: 0 5px 0 rgba(43, 29, 56, .25); display: grid; place-items: center; overflow: hidden; }
.sel-grid button img { width: 88%; }
.sel-grid button.on { background: #fff6b8; outline: 4px solid var(--ink); box-shadow: 0 0 0 4px #ffd23a, 0 5px 0 rgba(43, 29, 56, .25); transform: translateY(-3px); }
.sel-grid button.lock img { filter: grayscale(1) brightness(.4); }
.sel-grid button .lk { position: absolute; font-size: 28px; }
.sel-grid button .tag { position: absolute; top: 2px; right: 4px; font-size: 12px; }
@media (orientation: landscape) { .sel-main { flex-direction: row; justify-content: center; align-items: center; gap: 28px; } .sel-big img { width: min(34vh, 24vw); } .sel-grid { width: min(48vw, 300px); } }

/* VS 소개 */
#vs { background: linear-gradient(135deg, #ff7a3c 0 50%, #3c8cff 50% 100%); justify-content: center; }
.vs-in { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.vs-stage { font-family: 'Jua', sans-serif; font-size: 26px; color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.vs-row { display: flex; align-items: center; gap: 4vw; }
.vs-p { display: flex; flex-direction: column; align-items: center; gap: 2px; animation: vsIn .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.vs-p.op { animation-name: vsInR; }
.vs-p img { width: min(34vw, 30vh); filter: drop-shadow(0 6px 0 rgba(43, 29, 56, .35)); }
.vs-p b { font-family: 'Jua', sans-serif; font-size: 28px; font-weight: 400; color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.vs-x { font-family: 'Jua', sans-serif; font-size: 52px; color: #ffe14a; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; animation: pulse .5s ease-in-out infinite; }
.vs-dots { display: flex; gap: 8px; font-size: 20px; }
.vs-dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .5); border: 3px solid var(--ink); display: inline-block; }
.vs-dots i.done { background: #ffd23a; } .vs-dots i.cur { background: #fff; transform: scale(1.4); }
@keyframes vsIn { from { transform: translateX(-60vw); } }
@keyframes vsInR { from { transform: translateX(60vw); } }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* 결과 */
#over { background: rgba(43, 29, 56, .5); justify-content: center; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); overflow-y: auto; }
.panel { margin: auto; width: min(94vw, 400px); background: var(--panel); border-radius: 28px; padding: 18px 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: var(--shadow); max-height: 96vh; overflow-y: auto; touch-action: pan-y; }
.res-top { display: flex; align-items: center; gap: 12px; }
.res-top img { width: 84px; }
#resT { font-family: 'Jua', sans-serif; font-size: 44px; color: var(--orange); -webkit-text-stroke: 1px var(--ink); }
.stars { display: flex; gap: 6px; font-size: 44px; filter: drop-shadow(0 3px 0 rgba(43, 29, 56, .3)); }
.stars .off { filter: grayscale(1) brightness(1.5); opacity: .4; }
.stars span { animation: starIn .5s cubic-bezier(.2, 1.5, .4, 1) both; } .stars span:nth-child(2) { animation-delay: .15s; } .stars span:nth-child(3) { animation-delay: .3s; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.big-num { font-family: 'Jua', sans-serif; font-size: 52px; color: var(--ink); }
.badge { background: var(--pink); color: #fff; font-weight: 700; padding: 3px 12px; border-radius: 99px; animation: pulse .6s infinite; }
.mini { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.mini span { background: #eef0f8; border-radius: 12px; padding: 4px 10px; font-weight: 700; font-size: 17px; display: flex; gap: 4px; align-items: center; }
.over-card { width: 100%; border-radius: 14px; }
.big-btn.nx { min-width: 220px; height: 60px; }
#more { width: 100%; }
.more-games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.more-games a { display: block; border-radius: 10px; overflow: hidden; font-size: 10px; text-align: center; background: #eef0f8; }
.more-games img { width: 100%; display: block; }

/* 일시정지 */
#pause { z-index: 30; }

/* 플레이 중 버튼 */
#hudBtns { position: fixed; z-index: 8; top: calc(96px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
#hudBtns .ic-btn { width: 42px; height: 42px; font-size: 18px; opacity: .85; }
#banner { position: fixed; left: 0; right: 0; top: 30%; z-index: 9; text-align: center; pointer-events: none; font-family: 'Jua', sans-serif; font-size: clamp(54px, 17vmin, 110px); color: #ffe14a; -webkit-text-stroke: 9px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); opacity: 0; line-height: 1; }
#banner small { display: block; font-size: .44em; color: #fff; }
#banner.pop { animation: banner 1.2s cubic-bezier(.2, 1.4, .4, 1) both; }
#banner.ko { color: #ff5c5c; font-size: clamp(70px, 24vmin, 150px); animation-duration: 1.8s; }
@keyframes banner { 0% { opacity: 0; transform: scale(2.4) rotate(-6deg); } 18% { opacity: 1; transform: scale(1) rotate(-2deg); } 80% { opacity: 1; transform: scale(1.03) rotate(-2deg); } 100% { opacity: 0; transform: scale(.9) translateY(-20px); } }
#toast { position: fixed; left: 50%; bottom: 20%; transform: translateX(-50%); z-index: 50; padding: 8px 16px; border-radius: 99px; background: rgba(43, 29, 56, .85); color: #fff; font-weight: 700; opacity: 0; transition: opacity .3s; pointer-events: none; }
#toast.on { opacity: 1; }

/* 조작: 가상 스틱(왼쪽) + 큰 버튼 3개(오른쪽) */
#ctl { position: fixed; inset: 0; z-index: 7; pointer-events: none; }
body.port #ctl::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: var(--ctlH); background: linear-gradient(180deg, #3a2650, #2a1a3a); border-top: 4px solid #ffb13c; }
.pad { position: absolute; inset: 0; }
.zone { position: absolute; pointer-events: auto; touch-action: none; }
.stk { position: absolute; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .14); pointer-events: none; opacity: .45; transition: opacity .15s; }
.stk.on { opacity: 1; }
.stk i { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #ffd9a0 60%, #ff9a3c); box-shadow: 0 4px 0 rgba(43, 29, 56, .35); }
.stk b { position: absolute; font-size: 20px; color: #fff; opacity: .8; text-shadow: 0 1px 2px #000; }
.stk b:nth-child(1) { left: 50%; top: -2px; transform: translateX(-50%); } .stk b:nth-child(2) { left: 50%; bottom: -2px; transform: translateX(-50%); }
.fb { position: absolute; pointer-events: auto; width: var(--S); height: var(--S); border-radius: 50%; display: grid; place-items: center; font-size: calc(var(--S) * .46); border: 5px solid var(--ink); box-shadow: 0 7px 0 rgba(43, 29, 56, .55); touch-action: none; transition: transform .05s; line-height: 1; }
.fb.on, .fb:active { transform: translateY(5px) scale(.96); box-shadow: 0 2px 0 rgba(43, 29, 56, .55); filter: brightness(1.15); }
.fb.A { background: radial-gradient(circle at 35% 30%, #fff6b0, #ffd23a 55%, #f0a800); }
.fb.B { background: radial-gradient(circle at 35% 30%, #ffc9a0, #ff7a3c 55%, #d84a10); }
.fb.S { background: radial-gradient(circle at 35% 30%, #d8f8ff, #2fd6ee 55%, #1a9ab8); opacity: .5; filter: grayscale(.5); }
.fb.S.ready { opacity: 1; filter: none; animation: ready .55s ease-in-out infinite; box-shadow: 0 0 0 6px rgba(255, 230, 80, .8), 0 7px 0 rgba(43, 29, 56, .55); }
@keyframes ready { 50% { transform: scale(1.1); } }
.fb small { position: absolute; bottom: 4px; font-size: calc(var(--S) * .2); font-weight: 700; color: var(--ink); }

/* 가로: 왼쪽 반 스틱, 오른쪽 아래 삼각 배치 */
body.land .pad.p0 .zone { left: 0; top: 22%; width: 48%; bottom: 0; }
body.land .pad.p0 .stk { left: calc(10vw + 40px); top: calc(100% - 22vh); }
body.land .pad.p0 .A { right: calc(var(--S) * 1.2 + 3vw + var(--safe-r)); bottom: calc(3vh + var(--safe-b)); }
body.land .pad.p0 .B { right: calc(3vw + var(--safe-r)); bottom: calc(3vh + var(--S) * .45 + var(--safe-b)); }
body.land .pad.p0 .S { right: calc(var(--S) * .6 + 3vw + var(--safe-r)); bottom: calc(3vh + var(--S) * 1.35 + var(--safe-b)); }
/* 세로: 아래 조작판 */
body.port .pad.p0 .zone { left: 0; width: 50%; bottom: 0; height: var(--ctlH); }
body.port .pad.p0 .stk { left: 25%; top: calc(100% - var(--ctlH) / 2); }
body.port .pad.p0 .A { right: calc(var(--S) * 1.1 + 4vw); bottom: calc(var(--ctlH) * .08 + var(--safe-b)); }
body.port .pad.p0 .B { right: 3vw; bottom: calc(var(--ctlH) * .22 + var(--safe-b)); }
body.port .pad.p0 .S { right: calc(var(--S) * .62 + 3.5vw); bottom: calc(var(--ctlH) * .08 + var(--S) * 1.15 + var(--safe-b)); }
/* 대전(2P): 각자 반쪽 */
body.vsm.land .pad.p0 .zone { width: 24%; top: 25%; } body.vsm.land .pad.p0 .stk { left: 12%; top: 78%; }
body.vsm.land .pad.p1 .zone { right: 0; width: 24%; top: 25%; bottom: 0; left: auto; } body.vsm.land .pad.p1 .stk { left: 88%; top: 78%; }
body.vsm.land { --S: 64px; }
body.vsm.land .pad.p0 .A { left: 22%; right: auto; bottom: 3vh; } body.vsm.land .pad.p0 .B { left: calc(22% + var(--S) + 8px); right: auto; bottom: 3vh; } body.vsm.land .pad.p0 .S { left: calc(22% + (var(--S) + 8px) * 2); right: auto; bottom: 3vh; }
body.vsm.land .pad.p1 .A { right: 22%; left: auto; bottom: 3vh; } body.vsm.land .pad.p1 .B { right: calc(22% + var(--S) + 8px); left: auto; bottom: 3vh; } body.vsm.land .pad.p1 .S { right: calc(22% + (var(--S) + 8px) * 2); left: auto; bottom: 3vh; }
body.vsm.port { --S: 58px; }
body.vsm.port .pad.p0 .zone { left: 0; width: 50%; bottom: calc(var(--S) + 22px + var(--safe-b)); height: calc(var(--ctlH) - var(--S) - 22px - var(--safe-b)); }
body.vsm.port .pad.p1 .zone { left: 50%; width: 50%; bottom: calc(var(--S) + 22px + var(--safe-b)); height: calc(var(--ctlH) - var(--S) - 22px - var(--safe-b)); }
body.vsm.port .pad.p0 .stk { left: 25%; top: calc(100% - var(--ctlH) + (var(--ctlH) - var(--S) - 22px) / 2); } body.vsm.port .pad.p1 .stk { left: 75%; top: calc(100% - var(--ctlH) + (var(--ctlH) - var(--S) - 22px) / 2); }
body.vsm.port .stk { transform: scale(.8); }
body.vsm.port .pad.p0 .A { left: 2%; right: auto; bottom: calc(10px + var(--safe-b)); } body.vsm.port .pad.p0 .B { left: 18%; right: auto; bottom: calc(10px + var(--safe-b)); } body.vsm.port .pad.p0 .S { left: 34%; right: auto; bottom: calc(10px + var(--safe-b)); }
body.vsm.port .pad.p1 .A { left: 52%; right: auto; bottom: calc(10px + var(--safe-b)); } body.vsm.port .pad.p1 .B { left: 68%; right: auto; bottom: calc(10px + var(--safe-b)); } body.vsm.port .pad.p1 .S { left: 84%; right: auto; bottom: calc(10px + var(--safe-b)); }
body.vsm.port .pad.p0 .fb.S, body.vsm.port .pad.p1 .fb.S { transform: none; }
body:not(.vsm) .pad.p1 { display: none; }
body.prac #btnDummy { display: grid; }

#banner.fight { font-size: clamp(110px, 40vmin, 300px); letter-spacing: -2px; animation: fightBig 1.3s cubic-bezier(.2,1.6,.4,1) both; color: #ff5c3c; -webkit-text-stroke: 14px var(--ink); }
@keyframes fightBig { 0% { opacity: 0; transform: scale(5) rotate(-12deg); } 14% { opacity: 1; transform: scale(1) rotate(-4deg); } 22% { transform: scale(1.12) rotate(3deg); } 30% { transform: scale(1) rotate(-2deg); } 80% { opacity: 1; transform: scale(1.04) rotate(-2deg); } 100% { opacity: 0; transform: scale(3) rotate(8deg); } }

#menu .hof-inline:has(.hof-wait), #menu .hof-inline:has(.hof-empty) { display: none !important; }
