:root { --bs: var(--kit-btn-scale, 1); --ink: #2f3550; --muted: #7a809c; --accent: #ff7a3d; --hud: #3d2a1a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font-family: "Pretendard Variable", "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; background: #f7d3a1; color: var(--ink); word-break: keep-all; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
body.dark { --hud: #f1efff; }
.hidden { display: none !important; }

#stage { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 10px) 14px 8px; pointer-events: none; }
.top > * { pointer-events: auto; }
#accountSlot { margin-left: auto; }
body.playing .top { display: none; }
.top h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.screen { position: fixed; inset: 0; z-index: 10; }
#home { display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 64px) 16px calc(env(safe-area-inset-bottom) + 14px); pointer-events: none; }
#home > * { pointer-events: auto; }
.hero { text-align: center; pointer-events: none !important; }
.title-word { margin: 6px auto 4px; font-size: 44px; font-weight: 900; line-height: 1.1; letter-spacing: -1.5px; color: #ff6a2b; text-shadow: 3px 0 0 #fff, -3px 0 0 #fff, 0 3px 0 #fff, 0 -3px 0 #fff, 2px 2px 0 #fff, -2px 2px 0 #fff, 2px -2px 0 #fff, -2px -2px 0 #fff, 0 8px 22px rgba(160, 70, 20, .3); animation: bob 2.4s ease-in-out infinite; }
.title-sub { margin: 0 auto 10px; font-size: 15px; font-weight: 800; color: #7a4a22; text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
body.dark .title-word { color: #ffb36b; text-shadow: 0 6px 22px rgba(0, 0, 0, .45); }
body.dark .title-sub { color: #e2dcff; text-shadow: none; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.best { margin: 0 auto; display: inline-block; padding: 6px 14px; border-radius: 99px; background: rgba(255, 255, 255, .88); font-weight: 800; font-size: 14px; color: #c2541a; box-shadow: 0 4px 14px rgba(90, 60, 30, .12); }
.best:empty { display: none; }
.spacer { flex: 1; min-height: 20px; pointer-events: none !important; }
.panel { width: 100%; max-width: 440px; margin: 0 auto; padding: 14px; border-radius: 24px; background: rgba(255, 255, 255, .93); border: 1px solid #f1e4d6; box-shadow: 0 14px 40px rgba(110, 60, 20, .18); display: grid; gap: 8px; max-height: 62vh; overflow-y: auto; }
.big { padding: calc(13px * var(--bs)) 12px; border-radius: calc(16px * var(--bs)); border: 0; font: inherit; font-weight: 900; font-size: calc(16px * var(--bs)); cursor: pointer; transition: transform .1s; line-height: 1.3; }
.big:active { transform: scale(.97); }
.big small { display: block; font-size: 12.5px; font-weight: 700; opacity: .92; }
.big.primary { color: #fff; background: linear-gradient(135deg, #ffa24d, #ff5a3c); box-shadow: 0 8px 20px rgba(255, 100, 50, .32); font-size: calc(20px * var(--bs)); padding: calc(15px * var(--bs)) 12px; }
.big.daily { color: #fff; background: linear-gradient(135deg, #8b7cf6, #4dabf7); box-shadow: 0 8px 20px rgba(100, 120, 240, .28); }
.howto { border-radius: 16px; background: #fff8f1; border: 1px solid #f3e4d4; padding: 8px 12px; }
.howto summary { cursor: pointer; font-weight: 900; font-size: 14px; color: #7a4a22; padding: 2px 0; }
.howto ul { margin: 6px 0 2px; padding-left: 18px; font-size: 13.5px; line-height: 1.6; color: #5c4a3c; }
.howto li { margin: 2px 0; }
.gear { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.gear b { color: #7a4a22; }

/* 게임 화면 */
#play { pointer-events: none; }
#play button { pointer-events: auto; }
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 12px 4px; }
.round { width: calc(42px * var(--bs)); height: calc(42px * var(--bs)); flex: none; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: #7a4a22; font-size: calc(17px * var(--bs)); font-weight: 900; box-shadow: 0 4px 12px rgba(80, 40, 10, .18); cursor: pointer; display: grid; place-items: center; padding: 0; font-family: inherit; }
.round:active { transform: scale(.94); }
.hud-mid { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 8px; border-radius: 22px; background: rgba(255, 255, 255, .88); box-shadow: 0 6px 18px rgba(80, 40, 10, .16); }
body.dark .hud-mid { background: rgba(20, 24, 60, .72); }
.time { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: conic-gradient(#ff7a3d calc(var(--t, 1) * 360deg), #f1e4d6 0); position: relative; flex: none; }
.time::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
body.dark .time::before { background: #1d2250; }
.time b, .time small { position: relative; line-height: 1; }
.time b { font-size: 22px; font-weight: 900; color: var(--hud); font-variant-numeric: tabular-nums; margin-top: 6px; }
.time small { font-size: 10px; font-weight: 800; color: var(--muted); margin-top: -10px; }
.time.low { background: conic-gradient(#ff3d5a calc(var(--t, 1) * 360deg), #ffd9de 0); animation: tick 1s ease-in-out infinite; }
.time.low b { color: #e8243f; }
.time.plus { animation: plus .5s ease-out; }
@keyframes tick { 50% { transform: scale(1.08); } }
@keyframes plus { 40% { transform: scale(1.25); filter: drop-shadow(0 0 8px #ffd43b); } }
.score { text-align: left; color: var(--hud); min-width: 76px; }
.score b { display: block; font-size: 32px; font-weight: 900; line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.score b.bump { animation: bump .25s ease-out; }
.score small { display: block; margin-top: 3px; font-size: 12px; font-weight: 800; opacity: .75; white-space: nowrap; }
@keyframes bump { 40% { transform: scale(1.16); } }

/* 연속 골 표시 */
.streak { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 14px); text-align: center; height: 30px; pointer-events: none; }
.streak span { display: inline-block; padding: 4px 14px; border-radius: 99px; font-weight: 900; font-size: 15px; color: #fff; background: linear-gradient(90deg, #ffa24d, #ff5a3c); box-shadow: 0 4px 14px rgba(255, 90, 60, .35); }
.streak span.fire { background: linear-gradient(90deg, #ff3d5a, #ff8a00, #ffd43b); animation: fire .6s ease-in-out infinite alternate; }
@keyframes fire { to { transform: scale(1.06); box-shadow: 0 4px 22px rgba(255, 120, 0, .7); } }

.pops { position: absolute; left: 0; right: 0; top: 0; height: 0; text-align: center; }
.pop { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-weight: 900; font-size: 32px; color: #ff5a1f; text-shadow: 3px 0 0 #fff, 2.6px 1.5px 0 #fff, 1.5px 2.6px 0 #fff, 0 3px 0 #fff, -1.5px 2.6px 0 #fff, -2.6px 1.5px 0 #fff, -3px 0 0 #fff, -2.6px -1.5px 0 #fff, -1.5px -2.6px 0 #fff, 0 -3px 0 #fff, 1.5px -2.6px 0 #fff, 2.6px -1.5px 0 #fff, 0 5px 14px rgba(120, 60, 20, .3); animation: pop 1.1s ease-out forwards; pointer-events: none; }
.pop.small { font-size: 20px; color: #8b5cf6; }
.pop.gold { color: #f08c00; }
.pop.big2 { font-size: 40px; color: #ff6b00; }
.pop.fire { font-size: 38px; color: #ff3d2e; }
.pop.miss { font-size: 19px; color: #6b6f88; }
.pop.lv { font-size: 22px; color: #2b8cff; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 12px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -46px) scale(1); } }

/* 첫 던지기 안내 */
.hint { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); display: grid; justify-items: center; gap: 2px; padding: 10px 18px; border-radius: 18px; background: rgba(255, 255, 255, .9); box-shadow: 0 8px 22px rgba(80, 40, 10, .18); pointer-events: none; white-space: nowrap; }
.hint b { font-size: 16px; color: #7a3a12; }
.hint small { font-size: 12px; font-weight: 700; color: var(--muted); }
.hint .hand { font-size: 28px; line-height: 1; animation: flick 1.3s ease-in-out infinite; }
@keyframes flick { 0% { transform: translateY(16px); opacity: 0; } 25% { opacity: 1; } 70% { transform: translateY(-22px); opacity: 1; } 100% { transform: translateY(-26px); opacity: 0; } }

/* 결과 창 */
.res-big { text-align: center; margin: 4px 0 6px; }
.res-big b { display: block; font-size: 48px; font-weight: 900; letter-spacing: -1px; color: #ff5a1f; line-height: 1.1; }
.res-big small { display: block; color: var(--muted); font-weight: 700; font-size: 13.5px; margin-top: 4px; }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0 4px; }
.res-grid div { background: #fff6ee; border-radius: 12px; padding: 7px 4px; text-align: center; }
.res-grid b { display: block; font-size: 18px; font-weight: 900; color: #7a3a12; }
.res-grid small { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.res-new { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 99px; background: linear-gradient(90deg, #ffd43b, #ff8a3d); color: #fff; font-weight: 900; font-size: 14px; }
.res-actions .kit-btn { min-height: 48px; }
.ad-slot { margin: 10px 0 0; min-height: 0; }

@media (prefers-reduced-motion: reduce) { .title-word, .pop, .score b.bump, .time.low, .streak span.fire, .hint .hand { animation: none; } }
@media (max-height: 640px) { .title-word { font-size: 34px; margin-top: 2px; } .title-sub { display: none; } #home { padding-top: calc(env(safe-area-inset-top) + 54px); } .score b { font-size: 26px; } .time { width: 46px; height: 46px; } }
