/* 공 피하기 대결: 어두운 남색 화면 + 밝은 하얀 공 (게임 자체 모양, 키트 창은 kit.css) */
:root { --p1: #4da3ff; --p2: #ff5a6a; --ink: #eef2ff; --sub: #aab4e0; --card: rgba(18, 26, 68, .88); --line: rgba(150, 170, 255, .22); --gold: #ffd84d; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; background: #070c24; color: var(--ink); word-break: keep-all; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
.hidden { display: none !important; }
#cv { position: fixed; inset: 0; display: block; touch-action: none; }
button { font: inherit; color: inherit; }

/* 위 막대 (처음 화면) */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; }
.top h1 { margin: 0; font-size: 16px; font-weight: 900; color: var(--ink); opacity: .9; white-space: nowrap; }
body.playing .top { display: none; }

/* 처음 화면 */
.screen { position: fixed; inset: 0; z-index: 3; }
#home { overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: calc(64px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.hero { text-align: center; margin: 8px 0 14px; }
.title-word { margin: 0; font-size: clamp(34px, 10vw, 54px); font-weight: 900; letter-spacing: -1.5px; line-height: 1.1; color: #fff; text-shadow: 0 0 18px rgba(140, 180, 255, .55), 0 3px 0 #1d2a6b; }
.title-sub { margin: 8px 0 0; color: var(--sub); font-weight: 700; font-size: 15px; }
.best { margin: 8px 0 0; min-height: 20px; color: var(--gold); font-weight: 800; font-size: 14px; }
.panel { width: 100%; max-width: 440px; margin-top: auto; display: grid; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); }
.big { min-height: 64px; border: 0; border-radius: 18px; padding: 12px 16px; font-size: 20px; font-weight: 900; cursor: pointer; display: grid; gap: 2px; }
.big small { font-size: 13px; font-weight: 700; opacity: .85; }
.big.primary { color: #0b1030; background: linear-gradient(135deg, #ffffff, #cfe2ff); box-shadow: 0 6px 0 #6f86c9; }
.big.primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #6f86c9; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode { min-height: 92px; border-radius: 16px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .06); cursor: pointer; display: grid; place-items: center; gap: 2px; padding: 10px 6px; text-align: center; }
.mode:active { transform: scale(.97); }
.mode .mi { font-size: 26px; line-height: 1; }
.mode b { font-size: 16px; }
.mode small { font-size: 12px; color: var(--sub); }
.m-cpu { box-shadow: inset 0 -3px 0 rgba(77, 163, 255, .5); }
.m-duo { box-shadow: inset 0 -3px 0 rgba(255, 90, 106, .5); }
.howto { border-radius: 14px; background: rgba(255, 255, 255, .05); padding: 0 12px; }
.howto summary { min-height: 44px; display: flex; align-items: center; gap: 6px; font-weight: 800; cursor: pointer; list-style: none; color: var(--sub); }
.howto summary::before { content: '❓'; }
.howto summary::-webkit-details-marker { display: none; }
.howto ul { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; color: #d6dcf7; }
.howto b { color: #fff; }
.credit { margin: 4px 0 12px; font-size: 13px; color: var(--gold); font-weight: 800; }
.gear { margin: 0; min-height: 18px; text-align: center; font-size: 13px; color: var(--sub); }
.gear b { color: var(--ink); }

/* 판 화면 */
#play { pointer-events: none; }
#play > * { pointer-events: auto; }
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 10px 6px; }
.round { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .08); font-size: 18px; cursor: pointer; display: grid; place-items: center; }
.times { flex: 1; display: flex; gap: 8px; justify-content: center; min-width: 0; }
.tbox { flex: 1; max-width: 200px; min-width: 0; border-radius: 14px; padding: 4px 10px; background: rgba(255, 255, 255, .06); border: 2px solid; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.tbox small { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbox b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tbox b::after { content: '초'; font-size: 12px; margin-left: 2px; }
.tbox.p1 { border-color: var(--p1); color: #bfe0ff; }
.tbox.p2 { border-color: var(--p2); color: #ffc9cf; }
.tbox.out { opacity: .5; }
.tbox.score b::after { content: '점'; }
body[data-mode="solo"] .tbox.p2 { border-color: var(--gold); color: #fff1b8; }
.banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: clamp(40px, 14vw, 80px); font-weight: 900; color: #fff; text-shadow: 0 0 24px rgba(140, 180, 255, .8); pointer-events: none !important; white-space: nowrap; }
.banner.small { font-size: clamp(22px, 7vw, 36px); color: var(--gold); text-shadow: 0 0 16px rgba(255, 216, 77, .6); }
.banner.pop { animation: pop .5s ease-out; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.pops { position: absolute; inset: 0; pointer-events: none !important; }

/* 휴대폰 단추 */
.ctrl { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px max(10px, env(safe-area-inset-bottom)); touch-action: none; user-select: none; -webkit-user-select: none; }
.pad { display: flex; gap: 10px; }
.pb { width: 72px; height: 64px; border-radius: 18px; border: 2px solid; background: rgba(255, 255, 255, .07); font-size: 24px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pad.p1 .pb { border-color: var(--p1); color: #bfe0ff; }
.pad.p2 .pb { border-color: var(--p2); color: #ffc9cf; }
.pb.on { background: rgba(255, 255, 255, .28); transform: scale(.95); }
/* 혼자·컴퓨터 대결: 1P 단추를 양쪽 끝으로 (◀ 왼쪽 아래, ▶ 오른쪽 아래) */
body[data-mode="solo"] .pad.p2, body[data-mode="cpu"] .pad.p2 { display: none; }
body[data-mode="solo"] .pad.p1, body[data-mode="cpu"] .pad.p1 { width: 100%; justify-content: space-between; }
body[data-mode="solo"] .pb, body[data-mode="cpu"] .pb { width: 96px; }
.keys { position: absolute; left: 0; right: 0; bottom: 6px; margin: 0; text-align: center; font-size: 13px; color: var(--sub); pointer-events: none !important; }
body.touch .keys { display: none; }
body:not(.touch) .ctrl { display: none; }
@media (max-width: 380px) { .pb { width: 62px; height: 60px; } .pad { gap: 8px; } .tbox { padding: 4px 8px; } .tbox b { font-size: 19px; } }

/* 결과·고르기 창 (키트 창 안) */
.res-who { font-size: 30px; font-weight: 900; text-align: center; margin: 4px 0; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.res-grid.g3 { grid-template-columns: 1fr 1fr 1fr; }
.kit-root .kit-actions .kit-btn { white-space: nowrap; }
.res-grid > div { border-radius: 14px; padding: 10px; text-align: center; border: 2px solid #e6e9f6; display: grid; gap: 2px; }
.res-grid b { font-size: 24px; }
.res-grid small { color: #7a809c; font-weight: 700; }
.res-grid .r1 { border-color: #9cc9ff; } .res-grid .r2 { border-color: #ffb0b8; }
.res-grid .win { background: #fff8d6; }
.res-new { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 99px; background: #ffd84d; color: #5a4200; font-weight: 900; font-size: 13px; }
.diff { display: grid; gap: 8px; margin-top: 10px; }
.diff button { min-height: 56px; border-radius: 14px; border: 1.5px solid #e3e0fb; background: #fff; font-weight: 900; font-size: 17px; cursor: pointer; color: #2f3550; }
.diff button small { display: block; font-size: 12px; font-weight: 700; color: #7a809c; }
.ad-slot:empty { display: none; }
