:root {
  --ink: #07131d;
  --cream: #f7e6c2;
  --cyan: #2fd6ee;
  --gold: #ffc62e;
  --pink: #ff5c7a;
  --panel: rgba(255, 255, 255, 0.95);
  --shadow: 0 10px 30px rgba(7, 19, 29, 0.25);
  --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);
}
* { 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; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* 아이콘 */
i { display: inline-block; flex: none; font-style: normal; }
.i-play { width: 0; height: 0; border-left: 22px solid currentColor; border-top: 14px solid transparent; border-bottom: 14px solid transparent; margin-left: 4px; }
.i-pause { width: 16px; height: 18px; border-left: 5px solid currentColor; border-right: 5px solid currentColor; }
.i-sound { width: 24px; height: 22px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z'/%3E%3C/svg%3E") center/contain no-repeat; }
.btn-sound.off .i-sound { opacity: .35; }
.i-out { width: 12px; height: 12px; border-top: 2.5px solid currentColor; border-right: 2.5px solid currentColor; margin-left: 4px; }
.i-again { width: 22px; height: 22px; border: 4px solid currentColor; border-top-color: transparent; border-radius: 50%; }
.i-share { width: 20px; height: 20px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 16a3 3 0 0 0-2.4 1.2l-6.7-3.4a3 3 0 0 0 0-1.6l6.7-3.4A3 3 0 1 0 15 7l-6.7 3.4a3 3 0 1 0 0 3.2L15 17a3 3 0 1 0 3-1z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 16a3 3 0 0 0-2.4 1.2l-6.7-3.4a3 3 0 0 0 0-1.6l6.7-3.4A3 3 0 1 0 15 7l-6.7 3.4a3 3 0 1 0 0 3.2L15 17a3 3 0 1 0 3-1z'/%3E%3C/svg%3E") center/contain no-repeat; }
.i-home { width: 22px; height: 20px; background: currentColor; clip-path: polygon(50% 0, 100% 45%, 86% 45%, 86% 100%, 14% 100%, 14% 45%, 0 45%); }
.i-crown { width: 20px; height: 16px; background: var(--gold); clip-path: polygon(0 100%, 0 20%, 25% 55%, 50% 0, 75% 55%, 100% 20%, 100% 100%); }
.i-grid { width: 20px; height: 20px; background: radial-gradient(circle, currentColor 0 3.5px, transparent 4px) 0 0 / 10px 10px; }
.i-flag { width: 18px; height: 20px; background: linear-gradient(90deg, #07131d 0 3px, transparent 3px), conic-gradient(from 90deg at 50% 50%, #fff 0 25%, #07131d 0 50%, #fff 0 75%, #07131d 0) 3px 0 / 8px 8px no-repeat; background-size: auto, 15px 12px; }
.i-star { width: 22px; height: 22px; background: linear-gradient(180deg, #fff1b0, #ffc62e); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.i-star.off { background: #d6dbe6; }
.i-star.big { width: 58px; height: 58px; }

/* 버튼 */
.big-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 240px; height: 66px; padding: 0 26px; border-radius: 999px; font-size: 26px; font-weight: 700; color: #fff; background: linear-gradient(180deg, #ffb13b, #ff7a1a); box-shadow: 0 7px 0 #c4520a, 0 14px 28px rgba(196, 82, 10, .35); text-shadow: 0 2px 0 rgba(0,0,0,.18); transition: transform .08s; animation: pulse 1.6s ease-in-out infinite; white-space: nowrap; }
.big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #c4520a; }
.big-btn .mi { font-size: 28px; }
.big-btn .cnt { font-size: 18px; padding: 2px 10px; border-radius: 999px; background: rgba(7,19,29,.25); }
.mid-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; min-width: 50px; padding: 0 16px; border-radius: 16px; font-size: 18px; font-weight: 700; background: #fff; box-shadow: 0 5px 0 rgba(7,19,29,.18), 0 8px 18px rgba(7,19,29,.12); white-space: nowrap; }
.mid-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(7,19,29,.18); }
.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(7,19,29,.18); touch-action: manipulation; }
.mode-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 150px; height: 84px; border-radius: 22px; background: #fff; box-shadow: 0 6px 0 rgba(7,19,29,.2), 0 10px 22px rgba(7,19,29,.18); font-weight: 700; font-size: 16px; }
.mode-btn .mi { font-size: 26px; line-height: 1; font-weight: 700; }
.mode-btn b { font-size: 14px; color: #ff7a1a; display: flex; align-items: center; gap: 4px; }
.mode-btn b .i-crown { width: 14px; height: 11px; }
.mode-btn:active { transform: translateY(3px); }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* 화면 */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; z-index: 10; }
.screen.dim { background: rgba(7, 19, 29, .5); 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(70px + var(--safe-t)) 16px calc(20px + var(--safe-b)); pointer-events: none; background: linear-gradient(180deg, rgba(7,19,29,.0) 50%, rgba(7,19,29,.35)); }
#menu > * { pointer-events: auto; }
.logo-wrap { display: flex; flex-direction: column; align-items: center; animation: drop .7s cubic-bezier(.2,1.6,.4,1) both; pointer-events: none !important; }
.logo-img { width: min(80vw, 440px); height: auto; filter: drop-shadow(0 10px 20px rgba(7,19,29,.35)); }
.logo-img + .logo { display: none; }
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: .82; font-weight: 700; font-style: italic; }
.logo span { font-size: clamp(64px, 18vw, 120px); color: var(--cream); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 6px 0 var(--cyan), 7px 9px 0 var(--ink); }
@keyframes drop { from { transform: translateY(-60px) scale(.8); opacity: 0; } }
.menu-bottom { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.row.small { gap: 10px; }
.studio { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--cream); font-weight: 700; font-size: 13px; letter-spacing: 1px; box-shadow: 0 4px 12px rgba(7,19,29,.3); white-space: nowrap; }
.hub-link { position: absolute !important; left: calc(14px + var(--safe-l)); top: calc(14px + var(--safe-t)); z-index: 20; }
.chal-m { margin-top: 8px; display: flex; gap: 8px; align-items: center; padding: 6px 14px; border-radius: 999px; background: #fff; font-size: 18px; box-shadow: 0 4px 0 rgba(7,19,29,.15); animation: pulse 1.4s infinite; }

/* 선택 화면 (토너먼트·미션) */
.sel { background: rgba(7,19,29,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); }
.sel-top { width: min(100%, 720px); display: flex; align-items: center; gap: 12px; color: #fff; font-size: 24px; margin-bottom: 10px; flex: none; }
.sel-top b { flex: 1; text-align: center; padding-right: 50px; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.sel-grid { width: min(100%, 720px); flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 4px 4px 20px; align-content: start; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; border-radius: 20px; background: #fff; box-shadow: 0 5px 0 rgba(7,19,29,.2); }
.tile img { width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff3d6, #ffd8a8); object-fit: cover; }
.tile b { font-size: 16px; }
.tile small { font-size: 11px; opacity: .55; font-weight: 600; text-align: center; }
.tile.lock img { filter: grayscale(1) brightness(.6); }
.tile.lock { opacity: .7; }
.tile .lk { position: absolute; top: 40px; font-size: 28px; }
.tile .crown { position: absolute; top: 2px; right: 8px; font-size: 22px; }
.tile .boss { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 700; color: #fff; background: var(--pink); padding: 2px 6px; border-radius: 8px; }
.tile.next { box-shadow: 0 0 0 4px var(--gold), 0 5px 0 rgba(7,19,29,.2); animation: pulse 1.4s infinite; }
.tile.done { background: linear-gradient(180deg, #fff, #fff4d1); }
.sel-grid.mis { grid-template-columns: repeat(4, 1fr); }
.mtile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 18px; background: #fff; box-shadow: 0 4px 0 rgba(7,19,29,.2); min-height: 118px; }
.mtile em { position: absolute; top: 4px; left: 8px; font-style: normal; font-weight: 700; font-size: 13px; opacity: .5; }
.mtile .faces { display: flex; margin-top: 6px; }
.mtile .faces img { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff3d6, #ffd8a8); margin: 0 -6px; border: 2px solid #fff; }
.mtile .gl { display: flex; align-items: center; gap: 2px; font-size: 18px; line-height: 1; }
.mtile .gl b { font-size: 14px; }
.mtile .gl .md { font-size: 14px; }
.mtile .mst { display: flex; gap: 1px; }
.mtile .mst .i-star { width: 16px; height: 16px; }
.mtile.lock { opacity: .55; }
.mtile.lock .faces img { filter: grayscale(1); }
.mtile .lk { position: absolute; top: 18px; font-size: 24px; }
.mtile.next { box-shadow: 0 0 0 4px var(--gold), 0 4px 0 rgba(7,19,29,.2); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { position: absolute; }
#touchzone { inset: 0; pointer-events: auto; z-index: 1; touch-action: none; }
#btnPause { left: calc(12px + var(--safe-l)); top: calc(10px + var(--safe-t)); pointer-events: auto; z-index: 20; }
#btnMenuHud { left: calc(70px + var(--safe-l)); top: calc(10px + var(--safe-t)); pointer-events: auto; z-index: 20; }
#btnPause::before, #btnMenuHud::before { content: ''; position: absolute; inset: -8px -4px; }
#bars { left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); top: calc(68px + var(--safe-t)); display: flex; align-items: center; gap: 8px; }
.bar { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.bar img { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(7,19,29,.35); background: #ffe8c4; flex: none; object-fit: cover; }
.bar.op img { background: radial-gradient(circle at 50% 40%, #fff3d6, #ffd8a8); }
.bw { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bar.op .bw { align-items: stretch; }
.hp { position: relative; height: 16px; border-radius: 8px; background: rgba(7,19,29,.55); box-shadow: inset 0 0 0 2px rgba(255,255,255,.75); overflow: hidden; }
.hp i { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) * var(--p, 1)); border-radius: 6px; background: linear-gradient(180deg, #9be15d, #2bc46a); transition: width .18s; }
.bar.op .hp i { left: auto; right: 2px; background: linear-gradient(180deg, #ff9a7a, #ff4f5e); }
#hpK[style*="--p: 0.2"] i, #hpK[style*="--p: 0.1"] i, #hpK[style*="--p: 0.0"] i { background: linear-gradient(180deg, #ffd23f, #ff7a1a); }
.st { position: relative; height: 7px; border-radius: 4px; background: rgba(7,19,29,.45); width: 70%; overflow: hidden; }
.st i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(100% * var(--p, 1)); background: #ffe14d; border-radius: 4px; }
#opName { color: #fff; font-family: 'Jua', 'Fredoka', sans-serif; font-size: 15px; text-align: right; text-shadow: 0 2px 0 rgba(7,19,29,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mid { flex: none; display: flex; flex-direction: column; align-items: center; padding: 4px 10px; border-radius: 14px; background: rgba(7,19,29,.55); color: #fff; min-width: 64px; }
#mid b { font-size: 15px; color: var(--gold); line-height: 1.1; }
#timer { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
#timer.low { color: #ff7a7a; animation: pulse .5s infinite; }
#subline { left: 50%; top: calc(124px + var(--safe-t)); transform: translateX(-50%); display: flex; gap: 8px; align-items: center; }
#scoreH { position: static !important; font-size: 26px; font-weight: 700; color: #ffe14d; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; font-variant-numeric: tabular-nums; }
#hearts { position: static !important; display: flex; gap: 3px; }
.hrt { width: 20px; height: 18px; background: #ff4d6d; clip-path: path('M10 18 L2 9.5 A4.6 4.6 0 0 1 10 3.3 A4.6 4.6 0 0 1 18 9.5 Z'); }
.hrt.off { background: rgba(255,255,255,.35); }
#goal { position: static !important; display: flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.92); font-size: 20px; box-shadow: 0 3px 0 rgba(7,19,29,.2); }
#goal b { font-size: 18px; font-variant-numeric: tabular-nums; }
#goal .md { font-size: 16px; }
#combo { left: calc(14px + var(--safe-l)); top: 42%; opacity: 0; transform-origin: left center; }
#combo b { font-size: 54px; font-weight: 700; color: #ffe14d; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 rgba(7,19,29,.3); font-style: italic; }
#combo.show { animation: combo 1.1s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes combo { 0% { opacity: 0; transform: scale(.4) rotate(-10deg); } 15% { opacity: 1; transform: scale(1.2) rotate(2deg); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
#special { right: calc(16px + var(--safe-r)); bottom: calc(22px + var(--safe-b)); width: 78px; height: 78px; border-radius: 50%; background: rgba(7,19,29,.5); display: grid; place-items: center; }
#special svg, #mash svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
#special circle, #mash circle { fill: none; stroke: #ffe14d; stroke-width: 8; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: calc(276.5 * (1 - var(--p, 0))); transition: stroke-dashoffset .2s; }
#special span { font-size: 34px; filter: grayscale(.6) opacity(.75); }
#special.full { background: radial-gradient(circle, rgba(255,225,77,.6), rgba(255,122,26,.55)); animation: pulse .6s infinite; box-shadow: 0 0 24px rgba(255,210,60,.8); }
#special.full span { filter: none; }
#mash { left: 50%; top: 58%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; animation: pulse .35s infinite; }
#mash span { font-size: 54px; }

#speed { position: fixed; inset: -10%; z-index: 4; pointer-events: none; opacity: 0; background: repeating-conic-gradient(from 0deg at 50% 45%, rgba(255,255,255,.0) 0deg 4deg, rgba(255,255,255,.55) 4.5deg 5deg, rgba(255,255,255,0) 5.5deg 9deg); -webkit-mask: radial-gradient(circle at 50% 45%, transparent 0 28%, #000 60%); mask: radial-gradient(circle at 50% 45%, transparent 0 28%, #000 60%); }
#speed.on { animation: speed .35s ease-out; }
#speed.big { animation-duration: .8s; }
@keyframes speed { 0% { opacity: 0; transform: scale(1.15); } 20% { opacity: 1; } 100% { opacity: 0; transform: scale(1) rotate(3deg); } }
#hurt { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; box-shadow: inset 0 0 120px 40px rgba(255, 30, 60, .7); }
#hurt.on { animation: hurt .45s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }
#banner { position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; opacity: 0; display: flex; flex-direction: column; align-items: center; line-height: .95; white-space: nowrap; }
#banner b { font-size: 84px; font-weight: 700; font-style: italic; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 rgba(7,19,29,.35), 0 0 30px rgba(255,200,60,.6); }
#banner small { font-size: 34px; font-weight: 700; color: #ffe14d; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
#banner.show { animation: banner 1.6s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2) rotate(-6deg); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(.95); } }
#count { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; display: flex; align-items: center; gap: 10px; }
#count b { font-size: 96px; font-weight: 700; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
#count .owl-ic { font-size: 54px; }
#count.beat { animation: beat .35s ease-out; }
@keyframes beat { 0% { transform: translate(-50%, -50%) scale(1.5); } 100% { transform: translate(-50%, -50%) scale(1); } }
#pops { position: fixed; left: 50%; top: 22%; width: 0; height: 0; z-index: 6; pointer-events: none; }
.pop { position: absolute; transform: translate(-50%, 0); font-size: 30px; font-weight: 700; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; white-space: nowrap; animation: popUp .9s ease-out forwards; }
@keyframes popUp { 0% { transform: translate(-50%, 10px) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -10px) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -70px) scale(1); opacity: 0; } }

/* VS */
#vs { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; pointer-events: none; background: linear-gradient(115deg, rgba(47,214,238,.75) 0 49.6%, rgba(255,255,255,.95) 49.6% 50.4%, rgba(255,92,122,.75) 50.4%); }
#vs.show .vs-in { animation: vsIn .5s cubic-bezier(.2,1.5,.4,1) both; }
#vs.out { animation: fadeOut .3s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes vsIn { from { transform: scale(.6); opacity: 0; } }
.vs-in { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vs-stage { padding: 6px 18px; border-radius: 999px; background: var(--ink); color: var(--cream); font-family: 'Jua', 'Fredoka', sans-serif; font-size: 20px; }
.vs-row { display: flex; align-items: center; gap: 14px; }
.vs-p { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vs-p img { width: 120px; height: 120px; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 8px 20px rgba(7,19,29,.35); background: radial-gradient(circle at 50% 40%, #fff3d6, #ffd8a8); object-fit: cover; }
.vs-p.me { animation: vsL .5s cubic-bezier(.2,1.5,.4,1) both; }
.vs-p.op { animation: vsR .5s .1s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes vsL { from { transform: translateX(-60vw); } }
@keyframes vsR { from { transform: translateX(60vw); } }
.vs-p b { font-family: 'Jua', 'Fredoka', sans-serif; font-size: 26px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.vs-x { font-size: 54px; font-weight: 700; font-style: italic; color: #ffe14d; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.vs-sub { display: flex; gap: 10px; align-items: center; }
#vsLv { font-size: 30px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
#vsGoal { display: flex; align-items: center; gap: 4px; padding: 6px 16px; border-radius: 999px; background: #fff; font-size: 28px; box-shadow: 0 4px 0 rgba(7,19,29,.2); }
#vsGoal b { font-size: 24px; }

/* 결과 */
#over { justify-content: center; padding: calc(10px + var(--safe-t)) 16px calc(10px + var(--safe-b)); overflow-y: auto; touch-action: pan-y; }
.panel { width: min(100%, 400px); max-height: 100%; overflow-y: auto; background: var(--panel); border-radius: 28px; padding: 18px 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: var(--shadow); animation: pop .45s cubic-bezier(.2,1.5,.4,1) both; touch-action: pan-y; margin-top: auto; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.res-top { display: flex; align-items: center; gap: 12px; }
#resFace { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff3d6, #ffd8a8); }
#resT .win { font-size: 46px; font-weight: 700; font-style: italic; color: #2bc46a; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
#resT .lose { font-size: 46px; font-weight: 700; font-style: italic; color: #8d99a6; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
#resT .stars { display: flex; gap: 4px; }
#resT .stars .i-star:not(.off) { animation: starIn .5s cubic-bezier(.2,1.6,.4,1) both; }
#resT .stars .i-star:nth-child(2) { animation-delay: .2s; } #resT .stars .i-star:nth-child(3) { animation-delay: .4s; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.big-num { font-size: 56px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.badge { padding: 4px 14px; border-radius: 999px; background: linear-gradient(90deg, #ff5c7a, #ffb13b); color: #fff; font-weight: 700; letter-spacing: 2px; animation: pulse 1s infinite; }
.rank { padding: 6px 18px; border-radius: 999px; color: #fff; font-family: 'Jua', 'Fredoka', sans-serif; font-size: 20px; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.mini { display: flex; gap: 20px; font-size: 22px; }
.mini span { display: flex; align-items: center; gap: 4px; }
.mini em { font-style: normal; }
.chal-o { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.chal-o em { font-style: normal; font-weight: 700; padding: 2px 10px; border-radius: 8px; color: #fff; }
.chal-o em.win { background: #2bc46a; } .chal-o em.lose { background: #8d99a6; }
.over-card { width: 100%; max-width: 190px; border-radius: 16px; box-shadow: 0 6px 18px rgba(7,19,29,.25); cursor: pointer; }
#over .row { gap: 8px; flex-wrap: nowrap; }
#over .row .mid-btn { height: 48px; min-width: 48px; padding: 0 12px; font-size: 17px; }
.big-btn.nx { min-width: 200px; height: 58px; font-size: 24px; background: linear-gradient(180deg, #4fd2ff, #1f8cf0); box-shadow: 0 6px 0 #135ea8, 0 12px 24px rgba(19,94,168,.35); }
#moreGames { width: 100%; }

#toast { position: fixed; left: 50%; bottom: calc(30px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; padding: 10px 18px; border-radius: 16px; background: #fff; font-weight: 700; z-index: 40; pointer-events: none; transition: .3s; box-shadow: 0 6px 20px rgba(7,19,29,.25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#nogl { display: none; }
body.nogl #nogl { display: grid; position: fixed; inset: 0; place-items: center; font-size: 24px; color: #fff; }
body.loading #btnPlay { opacity: .7; }
body.playing .hof-btn { display: none !important; }

/* 더 작은 세로 화면 */
@media (max-height: 700px) and (orientation: portrait) {
  .logo-img { width: min(70vw, 360px); }
  .big-btn { height: 58px; font-size: 22px; }
  .mode-btn { height: 74px; }
  .menu-bottom { gap: 12px; }
}
@media (max-width: 370px) { .mode-btn { width: 132px; } .big-btn { min-width: 0; padding: 0 18px; } .sel-grid.mis { grid-template-columns: repeat(3, 1fr); } }

/* 가로 화면 (높이 낮음) */
@media (orientation: landscape) and (max-height: 560px) {
  #menu { flex-direction: row; justify-content: space-around; align-items: center; padding: calc(10px + var(--safe-t)) calc(20px + var(--safe-r)) calc(10px + var(--safe-b)) calc(76px + var(--safe-l)); background: linear-gradient(90deg, rgba(7,19,29,0) 40%, rgba(7,19,29,.3)); }
  .logo-img { width: min(40vw, 46vh * 1.8, 340px); }
  .menu-bottom { width: auto; gap: 10px; }
  .row.modes { flex-wrap: nowrap; }
  .row.small .mid-btn { height: 44px; min-width: 44px; }
  .big-btn { height: 56px; font-size: 22px; min-width: 0; }
  .mode-btn { height: 70px; width: 140px; }
  .sel-grid { grid-template-columns: repeat(5, 1fr); }
  .sel-grid.mis { grid-template-columns: repeat(6, 1fr); }
  .tile img { width: 64px; height: 64px; }
  .tile .lk { top: 28px; }
  #bars { left: calc(126px + var(--safe-l)); top: calc(10px + var(--safe-t)); }
  .bar img { width: 40px; height: 40px; }
  #subline { top: calc(64px + var(--safe-t)); }
  #combo { top: 36%; }
  #combo b { font-size: 44px; }
  #banner { top: 38%; }
  #banner b { font-size: 64px; }
  #count { top: 34%; }
  #count b { font-size: 72px; }
  #special { width: 70px; height: 70px; }
  .vs-p img { width: 96px; height: 96px; }
  .panel { flex-direction: row; flex-wrap: wrap; justify-content: center; width: min(100%, 720px); gap: 8px 14px; padding: 12px 16px; margin-top: 0; }
  .panel > .row, .panel > #moreGames, .panel > #hofForm { flex-basis: 100%; }
  .over-card { max-width: 110px; }
  .big-num { font-size: 44px; }
  #resT .win, #resT .lose { font-size: 36px; }
  .i-star.big { width: 44px; height: 44px; }
}

/* 예고 방향 아이콘 */
#dirHint { position: fixed; z-index: 6; transform: translate(-50%, -50%); pointer-events: none; }
#dirHint b { display: grid; place-items: center; min-width: 58px; height: 58px; padding: 0 8px; border-radius: 18px; background: rgba(255,255,255,.95); box-shadow: 0 0 0 4px #ffd63f, 0 6px 16px rgba(7,19,29,.35); font-size: 42px; font-weight: 700; line-height: 1; color: var(--ink); animation: hintIn .25s cubic-bezier(.2,1.6,.4,1); }
#dirHint.big b { min-width: 96px; height: 96px; font-size: 76px; border-radius: 28px; box-shadow: 0 0 0 6px #ffd63f, 0 0 30px rgba(255,214,63,.8), 0 8px 20px rgba(7,19,29,.35); }
#dirHint .h-L { animation: hintIn .25s, nudgeL .7s .25s ease-in-out infinite; }
#dirHint .h-R { animation: hintIn .25s, nudgeR .7s .25s ease-in-out infinite; }
#dirHint .h-D { animation: hintIn .25s, nudgeD .7s .25s ease-in-out infinite; }
#dirHint .h-G { animation: hintIn .25s, pulse .6s .25s ease-in-out infinite; }
#dirHint.nope b { animation: nope .35s; background: #ffd0d6; }
@keyframes hintIn { from { transform: scale(.3); opacity: 0; } }
@keyframes nudgeL { 50% { transform: translateX(-12px); } }
@keyframes nudgeR { 50% { transform: translateX(12px); } }
@keyframes nudgeD { 50% { transform: translateY(10px); } }
@keyframes nope { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* 조작 그림 카드 */
#howto { z-index: 50; }
.howto-card { width: min(92vw, 360px); padding: 18px 18px 12px; border-radius: 28px; background: var(--panel); box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; animation: pop .45s cubic-bezier(.2,1.5,.4,1) both; }
.hw { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 20px; background: #f2f4f8; }
.hw .g { position: relative; width: 84px; height: 64px; display: grid; place-items: center; }
.hw .g b { font-size: 40px; font-weight: 700; color: #ff7a1a; line-height: 1; }
.hw .g .fing { position: absolute; font-size: 34px; bottom: -6px; left: 50%; margin-left: -14px; }
.hw .g-lr .fing { animation: fLR 1.4s ease-in-out infinite; }
.hw .g-d .fing { animation: fD 1.2s ease-in-out infinite; }
.hw .g-u .fing { animation: fU 1.2s ease-in-out infinite; }
.hw .g-t .fing { animation: kcTapH 1s ease-in-out infinite; }
.hw .g b.ring { width: 40px; height: 40px; border-radius: 50%; border: 6px solid #ffd63f; box-shadow: 0 0 0 3px rgba(7,19,29,.2); }
.hw em { font-style: normal; font-weight: 700; font-size: 22px; opacity: .35; line-height: 1; }
.hw .r { font-size: 40px; line-height: 1.1; }
.hw-ok { grid-column: 1 / -1; text-align: center; font-size: 30px; animation: pulse 1s infinite; }
@keyframes fLR { 0%, 100% { transform: translateX(-22px); } 50% { transform: translateX(22px); } }
@keyframes fD { 0% { transform: translateY(-14px); } 70%, 100% { transform: translateY(8px); opacity: .3; } }
@keyframes fU { 0% { transform: translateY(8px); } 70%, 100% { transform: translateY(-18px); opacity: .3; } }
@keyframes kcTapH { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(8px) scale(.9); } }
@media (orientation: landscape) and (max-height: 560px) { .howto-card { grid-template-columns: repeat(4, 1fr); width: min(92vw, 640px); } .hw .r { font-size: 34px; } }
