/* 🪐 행성 수호대 화면 모양 — 우주라서 기본은 어두운 화면, 메뉴 글씨는 밝고 크게 */
:root { --bs: var(--kit-btn-scale, 1); --ink: #f2f4ff; --muted: #b9bfe6; --accent: #ffcf4a; --blue: #3aa0ff; --panel: rgba(18, 24, 66, .86); --line: rgba(255, 255, 255, .16); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1440; color: var(--ink); }
body { font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; word-break: keep-all;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.hidden { display: none !important; }
button { font-family: inherit; }

#stage { position: fixed; inset: 0; }
#cv { display: block; width: 100%; height: 100%; touch-action: none; }
body.playing #cv { cursor: crosshair; }

.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; }
.top h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#accountSlot { margin-left: auto; }
#accountSlot .kc-shop { display: none; } /* 이 게임은 상점이 없어요 */
body.playing .top { display: none; }

/* ---------- 메뉴 ---------- */
.screen { position: fixed; inset: 0; z-index: 10; }
#home { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 68px) 16px calc(env(safe-area-inset-bottom) + 18px); background: radial-gradient(ellipse at 50% 40%, rgba(11, 20, 64, .2), rgba(5, 8, 30, .75)); }
.hero { text-align: center; }
.title-word { margin: 0; font-size: clamp(30px, 8.5vw, 46px); font-weight: 900; letter-spacing: -.01em; text-shadow: 0 4px 0 #1d2a6b, 0 10px 30px rgba(58, 160, 255, .5); }
.title-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; font-weight: 700; }
.panel { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .4); }
.pick { margin: 0 0 10px; font-weight: 800; color: var(--muted); text-align: center; font-size: 15px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 104px; padding: 12px 6px; border: 0; border-radius: 18px; cursor: pointer; color: #fff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35); transition: transform .08s; }
.mode:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.mode b { font-size: calc(21px * var(--bs)); font-weight: 900; }
.mode small { font-size: 12.5px; font-weight: 700; opacity: .92; line-height: 1.3; text-align: center; }
.mode i { font-style: normal; font-size: 12px; font-weight: 800; background: rgba(0, 0, 0, .25); border-radius: 99px; padding: 2px 8px; margin-top: 2px; min-height: 18px; }
.mode i:empty { display: none; }
.mode.m1 { background: linear-gradient(160deg, #ffb13b, #ff6b3d); }
.mode.m3 { background: linear-gradient(160deg, #ff6b8b, #c13fd1); }
.mode.m5 { background: linear-gradient(160deg, #4f8bff, #6a3cff); }
.row { display: flex; gap: 8px; margin-top: 12px; }
.row button { flex: 1; min-height: 48px; border-radius: 14px; font-size: calc(16px * var(--bs)); font-weight: 800; cursor: pointer; }
.ghost { background: rgba(255, 255, 255, .1); color: var(--ink); border: 1.5px solid var(--line); }
.row .round { flex: none; width: 52px; }
.howto { margin-top: 12px; background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 4px 12px; }
.howto summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; gap: 6px; color: var(--accent); }
.howto ul { margin: 4px 0 10px; padding-left: 18px; line-height: 1.6; font-size: 14.5px; color: #e4e7ff; }
.howto b { color: #fff; }
.me { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 13.5px; font-weight: 700; min-height: 1em; }

/* ---------- 판 화면 HUD ---------- */
#play { pointer-events: none; z-index: 12; }
#play button { pointer-events: auto; }
.hud { position: absolute; top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 8px) 10px 6px; display: flex; flex-direction: column; gap: 6px; align-items: center;
  background: linear-gradient(rgba(5, 8, 30, .78), rgba(5, 8, 30, 0)); }
.hud-row { width: min(640px, 100%); display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.hud-row.small { justify-content: center; flex-wrap: wrap; gap: 6px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .12); color: #fff; font-size: 17px; cursor: pointer; flex: none; }
.hearts { font-size: 21px; letter-spacing: 1px; white-space: nowrap; }
.hearts .off { opacity: .22; filter: grayscale(1); }
.time { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 72px; text-align: center; }
.time.low { color: #ff6b6b; animation: pgPulse .5s infinite alternate; }
.chip { background: rgba(255, 255, 255, .13); border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px; font-size: 14.5px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.score b { font-size: 16px; color: var(--accent); margin-right: 2px; }
.chip.combo:empty { display: none; }
.chip.combo { background: rgba(255, 150, 60, .3); color: #ffd99a; }
.boss { width: min(520px, 100%); background: rgba(40, 6, 30, .72); border: 1.5px solid rgba(255, 80, 120, .6); border-radius: 14px; padding: 6px 10px; }
.bname { font-weight: 900; font-size: 14px; text-align: center; margin-bottom: 4px; }
.bar { position: relative; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; margin-top: 4px; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.bar.hp i { background: linear-gradient(90deg, #ff4d6d, #ff9a6d); }
.bar.tm { height: 14px; }
.bar.tm i { background: linear-gradient(90deg, #ffd84a, #ffae3a); }
.bar.tm span { position: absolute; inset: 0; font-size: 11px; font-weight: 900; line-height: 14px; text-align: center; color: #2a1030; }
.boss.hurry .bar.tm i { background: #ff4d5a; animation: pgPulse .35s infinite alternate; }
.boss.hurry .bar.tm span { color: #fff; }
.fxline { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 0; }
.fxline span { background: rgba(80, 200, 255, .22); border: 1px solid rgba(120, 220, 255, .5); border-radius: 99px; padding: 2px 10px; font-size: 13px; font-weight: 800; }

.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; padding: 14px 26px; border-radius: 22px; background: rgba(5, 8, 30, .6);
  animation: pgIn .3s ease-out; max-width: calc(100% - 32px); }
.banner b { display: block; font-size: clamp(26px, 7.5vw, 44px); font-weight: 900; text-shadow: 0 4px 0 rgba(0, 0, 0, .4); white-space: nowrap; }
.banner small { display: block; margin-top: 6px; font-size: 15px; font-weight: 800; color: var(--muted); }
.dead { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; width: max-content; max-width: calc(100% - 32px); padding: 18px 26px; border-radius: 24px; background: rgba(20, 20, 26, .78); border: 1.5px solid rgba(255, 255, 255, .2); }
.dead b { display: block; font-size: 64px; font-weight: 900; line-height: 1; }
.dead b::before { content: "💀 "; font-size: 46px; }
.dead small { display: block; margin-top: 8px; font-size: 15px; font-weight: 800; color: #d7d9ea; }
.tip { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px); transform: translateX(-50%); background: rgba(255, 255, 255, .95); color: #1d2a6b; text-align: center;
  font-weight: 900; font-size: 16px; line-height: 1.45; padding: 10px 18px; border-radius: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); width: max-content; max-width: calc(100% - 32px); }
@keyframes pgPulse { to { opacity: .55; } }
@keyframes pgIn { from { opacity: 0; transform: translate(-50%, -40%) scale(.9); } }

/* ---------- 결과·랭킹 창 (키트 창 안) ---------- */
.res-big { text-align: center; margin: 4px 0 8px; }
.res-big b { display: block; font-size: 40px; font-weight: 900; color: #6a3cff; line-height: 1.1; }
.res-big small { color: #7a809c; font-weight: 800; }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.res-grid div { background: #f4f2ff; border-radius: 12px; padding: 8px 4px; text-align: center; }
.res-grid small { display: block; font-size: 12px; color: #7a809c; font-weight: 700; }
.res-grid b { font-size: 18px; color: #2f3550; }
.res-note { text-align: center; font-weight: 800; color: #2f3550; margin: 6px 0; font-size: 14.5px; }
.res-note.good { color: #13795b; }
.res-note.warn { color: #b45309; }
.res-actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
.res-actions .kit-btn { width: 100%; margin: 0; white-space: nowrap; }
.rk-tabs { display: flex; gap: 6px; margin: 0 0 8px; overflow-x: auto; }
.rk-tabs button { flex: 1; min-height: 44px; border: 1.5px solid #ece8f4; background: #faf9fd; border-radius: 999px; font-weight: 800; font-size: 14px; color: #6b6f88; cursor: pointer; white-space: nowrap; padding: 0 10px; }
.rk-tabs button.on { background: #6a3cff; border-color: #6a3cff; color: #fff; }
.rk-note { margin: 0 0 6px; font-size: 12px; color: #8a8ea6; }
.rk-list { list-style: none; margin: 0; padding: 0; max-height: min(52vh, 440px); overflow-y: auto; }
.rk-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; font-size: 15px; color: #2f3550; }
.rk-list li:nth-child(odd) { background: #faf9fd; }
.rk-list li.me { background: #fff3c4; box-shadow: inset 0 0 0 2px #ffbf47; }
.rk-n { width: 32px; text-align: center; font-weight: 900; color: #8a8ea6; flex: none; }
.rk-id { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rk-v { font-weight: 900; white-space: nowrap; text-align: right; }
.rk-v small { display: block; font-size: 11.5px; color: #8a8ea6; font-weight: 700; }
.rk-me { margin: 8px 0 0; font-size: 14px; font-weight: 800; color: #2f3550; text-align: center; }
.rk-msg { padding: 24px 8px; text-align: center; color: #8a8ea6; font-size: 14px; line-height: 1.6; }

/* ---------- 첫 화면(타이틀) 배경 ---------- */
#title { --lt-a: #3aa0ff; --lt-b: #8b5cff; --lt-ink: #2a2f55; --lt-muted: #4e557f; --lt-brand: #5b6cff; --lt-sh: #3d3fb4; --lt-glow: rgba(90, 110, 255, .45); --lt-bgc: #0e1a4d;
  --lt-fade: radial-gradient(ellipse at 50% 46%, rgba(255, 255, 255, .97) 0, rgba(236, 240, 255, .86) 30%, rgba(210, 220, 255, 0) 66%); }
#title .pg-sky { position: absolute; inset: 0; opacity: .9; background-size: 180px 160px;
  background-image: radial-gradient(circle at 20px 30px, #fff 1.2px, transparent 2px), radial-gradient(circle at 120px 80px, #cfe0ff 1px, transparent 2px), radial-gradient(circle at 70px 140px, #fff 1.5px, transparent 2.4px), radial-gradient(circle at 160px 20px, #ffe9a8 1.2px, transparent 2px); }
#title .lt-o { filter: drop-shadow(0 6px 10px rgba(10, 8, 40, .45)); }
#title .pg-e { font-size: 44px; }
#title .lt-pill { color: #2f3a7a; }
#title .s1 { top: 8%; left: 8%; --r: -12deg; font-size: 56px; }
#title .s2 { top: 16%; right: 11%; --r: 14deg; }
#title .s3 { top: 33%; left: 7%; --r: -8deg; }
#title .s4 { top: 31%; right: 7%; font-size: 48px; }
#title .s5 { bottom: 15%; left: 8%; --r: -14deg; font-size: 50px; }
#title .s6 { bottom: 17%; right: 9%; --r: 12deg; }
#title .s7 { bottom: 6%; left: 40%; --r: 8deg; font-size: 38px; }
#title .s8 { top: 5%; left: 45%; font-size: 34px; }
@media (max-width: 600px) { #title .pg-e { font-size: 34px; } #title .s1 { font-size: 42px; } #title .s5 { font-size: 38px; } #title .s3 { top: 40%; left: 4%; } #title .s4 { top: 40%; right: 4%; } }
html.lt-on .top { display: none; }

@media (max-width: 380px) { .mode b { font-size: 18px; } .hearts { font-size: 18px; } .time { font-size: 22px; min-width: 60px; } .chip { font-size: 13px; padding: 3px 8px; } }
