:root { --ink: #1b2433; --acc: #ffb703; --pink: #ff5c7a; --cyan: #3fd0f0; --green: #6dff9a; --panel: rgba(255,255,255,.94); --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fdcff; color: var(--ink); font-family: var(--kp-font, system-ui, 'Apple SD Gothic Neo', sans-serif); user-select: none; -webkit-user-select: none; touch-action: none; font-synthesis: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
svg { fill: currentColor; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.ic-btn { position: absolute; left: 12px; top: calc(12px + var(--safe-t)); width: 46px; height: 46px; border-radius: 16px; background: var(--panel); box-shadow: 0 4px 0 rgba(27,36,51,.18), 0 8px 18px rgba(27,36,51,.18); display: grid; place-items: center; }
.ic-btn svg { width: 22px; height: 22px; }
.ic-btn.r2 { left: 66px; }
.ic-btn:active { transform: translateY(2px); }
#chip { position: absolute; left: 50%; top: calc(12px + var(--safe-t)); transform: translateX(-50%); min-width: 96px; height: 46px; padding: 0 14px; border-radius: 16px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 6px 16px rgba(27,36,51,.3); pointer-events: none; }
#chip b { font-size: 24px; font-weight: 700; }
#stars { display: flex; gap: 3px; }
#stars i { width: 16px; height: 16px; background: #5b6679; -webkit-mask: var(--star) center/contain no-repeat; mask: var(--star) center/contain no-repeat; transition: background .25s, transform .25s; }
#stars i.on { background: var(--acc); transform: scale(1.15); }
:root { --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2 3 6.500 7 .9-5.200 4.800 1.400 7L12 17.700 5.800 21.200l1.400-7L2 9.400l7-.9z'/%3E%3C/svg%3E"); }
.pill { height: 36px; padding: 0 12px; border-radius: 14px; background: var(--panel); display: inline-flex; align-items: center; gap: 7px; box-shadow: 0 3px 0 rgba(27,36,51,.15), 0 6px 14px rgba(27,36,51,.15); pointer-events: none; }
.pill svg { width: 18px; height: 18px; flex: none; }
.pill b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
#bonePill { position: absolute; right: 12px; top: calc(16px + var(--safe-t)); }
#bonePill svg { color: #e0a000; }
#row2 { position: absolute; left: 0; right: 0; top: calc(66px + var(--safe-t)); display: flex; justify-content: center; gap: 10px; }
#timePill svg { color: #3b6ef0; }
#hitPill svg { color: var(--pink); }
#hitPill.bump { animation: bump .32s ease-out; }
@keyframes bump { 0% { transform: scale(1.4) rotate(-6deg); background: #ffd6de; } 100% { transform: scale(1); } }
#dist { position: absolute; display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 6px; border-radius: 999px; background: rgba(27,36,51,.78); color: #fff; transform: translate(-50%, -100%); pointer-events: none; }
#dist svg { width: 16px; height: 16px; color: var(--acc); }
#dist b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
#touch { position: absolute; left: 0; right: 0; bottom: 0; height: 52%; touch-action: none; }
#wheel { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); width: 132px; height: 132px; transform: translateX(-50%); pointer-events: none; opacity: .92; filter: drop-shadow(0 6px 10px rgba(27,36,51,.35)); }
#wheel svg { width: 100%; height: 100%; }
#wheelG { transform-origin: 50px 50px; }
#gear { position: absolute; left: 14px; bottom: calc(46px + var(--safe-b)); width: 78px; height: 96px; border-radius: 26px; background: var(--ink); box-shadow: 0 5px 0 #070b12, 0 10px 18px rgba(27,36,51,.35); display: flex; flex-direction: column; align-items: center; justify-content: space-around; padding: 8px 0; color: #5b6679; font-weight: 700; font-size: 30px; line-height: 1; }
#gear span { width: 48px; height: 36px; border-radius: 12px; display: grid; place-items: center; transition: background .15s, color .15s; }
#gear.d #gearD { background: var(--green); color: var(--ink); }
#gear.r #gearR { background: var(--pink); color: #fff; }
#gear:active { transform: translateY(2px); }
#pedal { position: absolute; right: 14px; bottom: calc(40px + var(--safe-b)); width: 116px; height: 116px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe27a, var(--acc) 62%, #e08a00); box-shadow: 0 7px 0 #b86f00, 0 14px 22px rgba(27,36,51,.35); display: grid; place-items: center; color: var(--ink); touch-action: none; }
#pedal svg { width: 52px; height: 52px; }
#pedal.r { background: radial-gradient(circle at 35% 30%, #ff9fb0, var(--pink) 62%, #d6304f); box-shadow: 0 7px 0 #a5203a, 0 14px 22px rgba(27,36,51,.35); color: #fff; }
#pedal.r svg { transform: rotate(180deg); }
#pedal.on { transform: translateY(5px); box-shadow: 0 2px 0 #b86f00, 0 6px 12px rgba(27,36,51,.35); }
#pedal.r.on { box-shadow: 0 2px 0 #a5203a, 0 6px 12px rgba(27,36,51,.35); }
#hand { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); width: 64px; height: 64px; margin-left: -32px; pointer-events: none; animation: handDrag 1.5s ease-in-out infinite; }
#hand svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
@keyframes handDrag { 0%,100% { transform: translateX(-46px); } 50% { transform: translateX(46px); } }
#pops { position: fixed; left: 0; right: 0; top: 24%; display: grid; justify-items: center; pointer-events: none; gap: 6px; }
.pop { font-size: 52px; font-weight: 700; color: #fff; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; letter-spacing: 1px; animation: popIn 1.5s ease-out forwards; text-shadow: 0 6px 0 rgba(27,36,51,.35); }
.pop.perfect { font-size: 64px; color: var(--acc); }
.pop.sub { font-size: 30px; -webkit-text-stroke: 5px var(--ink); animation-delay: .1s; }
.pop.red { color: #ff7a8e; font-size: 38px; }
@keyframes popIn { 0% { transform: scale(.3); opacity: 0; } 14% { transform: scale(1.18); opacity: 1; } 24% { transform: scale(1); } 78% { opacity: 1; } 100% { transform: translateY(-26px) scale(1); opacity: 0; } }
#flash { position: fixed; inset: 0; pointer-events: none; background: #fff; opacity: 0; }
#flash.go { animation: flash .35s ease-out; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }
#flash.red { background: #ff3b57; }
#flash.red.go { animation: flashR .3s ease-out; }
@keyframes flashR { 0% { opacity: .28; } 100% { opacity: 0; } }
/* 시트(스테이지 선택·차고·해금) */
.sheet { position: fixed; inset: 0; background: linear-gradient(180deg, rgba(159,220,255,.96), rgba(255,236,190,.97)); display: flex; flex-direction: column; align-items: center; padding: calc(16px + var(--safe-t)) 16px calc(18px + var(--safe-b)); z-index: 30; overflow: auto; touch-action: pan-y; }
.sheet .top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet .back { width: 46px; height: 46px; border-radius: 16px; background: var(--panel); display: grid; place-items: center; box-shadow: 0 4px 0 rgba(27,36,51,.18); }
.sheet .back svg { width: 22px; height: 22px; }
.sheet .ttl { font-size: 32px; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; width: 100%; max-width: 420px; margin-top: 18px; }
.tile { aspect-ratio: 1; border-radius: 16px; background: var(--panel); box-shadow: 0 4px 0 rgba(27,36,51,.18); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 22px; font-weight: 700; }
.tile.lock { opacity: .55; }
.tile .s { display: flex; gap: 1px; }
.tile .s i { width: 12px; height: 12px; background: #c3cad6; -webkit-mask: var(--star) center/contain no-repeat; mask: var(--star) center/contain no-repeat; }
.tile .s i.on { background: var(--acc); }
.tile svg { width: 22px; height: 22px; }
.tile:active { transform: translateY(2px); }
.total { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; }
.total svg { width: 22px; height: 22px; color: var(--acc); }
#garage .stage3d { flex: 1; width: 100%; min-height: 220px; position: relative; }
#garage .nm { font-size: 34px; font-weight: 700; text-align: center; }
#garage .need { display: inline-flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--ink); color: #fff; }
#garage .need svg { width: 18px; height: 18px; color: var(--acc); }
.arrow { position: absolute; top: 50%; width: 54px; height: 54px; margin-top: -27px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; box-shadow: 0 4px 0 rgba(27,36,51,.18); }
.arrow.l { left: 0; } .arrow.r { right: 0; }
.arrow svg { width: 26px; height: 26px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 3px 0 rgba(27,36,51,.25); position: relative; }
.sw.sel { border-color: var(--ink); transform: scale(1.12); }
.sw .c { position: absolute; right: -6px; bottom: -8px; font-size: 13px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 8px; padding: 0 5px; }
.hatb { width: 46px; height: 46px; border-radius: 14px; background: var(--panel); display: grid; place-items: center; box-shadow: 0 3px 0 rgba(27,36,51,.2); position: relative; border: 3px solid transparent; }
.hatb.sel { border-color: var(--ink); }
.hatb svg { width: 28px; height: 28px; }
.hatb .c { position: absolute; right: -5px; bottom: -8px; font-size: 13px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 8px; padding: 0 5px; }
.big { margin-top: 14px; min-width: 150px; height: 60px; padding: 0 28px; border-radius: 22px; background: linear-gradient(180deg, #ffd45a, var(--acc)); box-shadow: 0 6px 0 #b86f00, 0 12px 20px rgba(27,36,51,.25); font-size: 26px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.big svg { width: 26px; height: 26px; }
.big:active { transform: translateY(3px); box-shadow: 0 3px 0 #b86f00; }
.big[disabled] { filter: grayscale(.8); opacity: .6; }
#unlock { background: radial-gradient(circle at 50% 35%, rgba(255,240,170,.97), rgba(255,160,60,.97)); justify-content: flex-end; touch-action: none; }
#unlock .new { position: absolute; top: 14%; left: 0; right: 0; text-align: center; font-size: 64px; font-weight: 700; color: #fff; -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; animation: popIn2 .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes popIn2 { 0% { transform: scale(.2) rotate(-8deg); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
#unlock .nm { position: absolute; top: 25%; left: 0; right: 0; text-align: center; font-size: 40px; font-weight: 700; color: var(--ink); animation: popIn2 .6s .15s cubic-bezier(.2,1.6,.4,1) both; }
.cf { position: fixed; top: -20px; width: 10px; height: 16px; z-index: 40; pointer-events: none; animation: cfall 2.4s ease-in forwards; }
@keyframes cfall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(720deg); opacity: .9; } }
#loadMsg { position: fixed; inset: 0; background: #9fdcff; display: grid; place-items: center; z-index: 99; }
.spin { width: 46px; height: 46px; border-radius: 50%; border: 6px solid #fff; border-top-color: var(--acc); animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
#nogl { position: fixed; inset: 0; display: grid; place-items: center; font-size: 40px; font-weight: 700; background: #fff; z-index: 100; }
@media (max-width: 380px) { #pedal { width: 104px; height: 104px; } #gear { width: 70px; } }
.cx { display: inline-flex; align-items: center; gap: 6px; font-size: 24px; font-weight: 700; color: #ff7a1a; }
.cx svg { width: 24px; height: 24px; }

#touch { top: 110px; height: auto; bottom: 0; }
.hl { position: absolute; border-radius: 50%; display: grid; place-items: center; pointer-events: none; transform: translate(-50%, -50%); border: 5px solid #fff; box-shadow: 0 4px 14px rgba(27,36,51,.35); opacity: .88; transition: transform .1s, opacity .1s; }
.hl.f { background: rgba(109,255,154,.55); color: #0d5c2c; }
.hl.r { background: rgba(255,92,122,.55); color: #fff; }
.hl svg { width: 46%; height: 46%; }
.hl.on { opacity: 1; transform: translate(-50%, -50%) scale(1.14); background: var(--acc); color: var(--ink); }
.hl.r.on { background: var(--pink); color: #fff; }
.hl.dim { opacity: .35; }
#hand { bottom: auto; margin-left: 0; margin-top: 0; animation: tapHint 1.4s ease-in-out infinite; }
@keyframes tapHint { 0%,100% { transform: translate(-50%, -30%); } 50% { transform: translate(-50%, -8%); } }
.hl.f { background: rgba(109,255,154,.28); } .hl.r { background: rgba(255,92,122,.28); } .hl.on { background: rgba(255,183,3,.7); } .hl.r.on { background: rgba(255,92,122,.75); }
