/* 밤하늘 별빛 테마. 글자 없음, 큰 터치. 1024×768 고정. */
:root {
  --sky-top: #050823;
  --sky-mid: #0b1240;
  --sky-low: #182055;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-edge: rgba(255, 255, 255, 0.22);
  --gold: #ffd76a;
  --gold-deep: #f0a800;
  --ink: #141a3a;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-user-select: none; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--sky-top); touch-action: none; }
body { font-family: var(--font); color: #fff; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { display: block; }

#app { position: relative; width: 1024px; height: 768px; margin: 0 auto; overflow: hidden; }

/* ---------- 하늘 ---------- */
.sky { position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 78% 8%, rgba(255, 220, 140, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 12% 95%, rgba(120, 70, 190, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 55% 60%, rgba(40, 90, 200, 0.18) 0%, transparent 65%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%); }
.stars { position: absolute; left: 0; top: 0; width: 1px; height: 1px; border-radius: 50%; background: #fff; pointer-events: none; }
.stars.small { opacity: 0.75; animation: twinkle 4s ease-in-out infinite; }
.stars.big { width: 2px; height: 2px; animation: twinkle 3s ease-in-out infinite reverse; }
@keyframes twinkle { 50% { opacity: 0.35; } }
.shooting { position: absolute; left: 70%; top: 6%; width: 160px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0)); opacity: 0; pointer-events: none;
  animation: shoot 11s linear infinite; }
.shooting.s2 { left: 30%; top: 40%; animation-duration: 17s; animation-delay: 6s; }
@keyframes shoot {
  0% { opacity: 0; transform: translate(0, 0) rotate(-28deg); }
  2% { opacity: 1; }
  9% { opacity: 0; transform: translate(-460px, 245px) rotate(-28deg); }
  100% { opacity: 0; transform: translate(-460px, 245px) rotate(-28deg); }
}

/* ---------- 트랙 ---------- */
#track { position: absolute; inset: 0; width: 1024px; height: 768px; pointer-events: none; }
#track .road { fill: none; stroke: rgba(255, 255, 255, 0.10); stroke-width: 46; stroke-linecap: round; stroke-linejoin: round; }
#track .road-line { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 3; stroke-dasharray: 10 16; stroke-linecap: round; }
#track .cell { fill: rgba(255, 255, 255, 0.12); stroke: rgba(255, 255, 255, 0.35); stroke-width: 2.5; transition: fill 0.4s, stroke 0.4s; }
#track .cell.passed { fill: rgba(255, 215, 106, 0.55); stroke: #ffd76a; }
#track .cell.here { fill: rgba(255, 215, 106, 0.9); stroke: #fff; }
#track .cell.milestone { stroke: rgba(255, 255, 255, 0.6); }
#track .cell-glow { fill: none; stroke: #ffd76a; stroke-width: 10; opacity: 0; transition: opacity 0.4s; }
#track .cell-glow.here { opacity: 0.35; }

#board { position: absolute; inset: 0; pointer-events: none; }
.piece { position: absolute; width: 0; height: 0; transition: left 0.24s ease-in-out, top 0.24s ease-in-out; }
.piece > .spin { position: absolute; left: 0; top: 0; transition: transform 0.24s ease-in-out; }
.piece > .spin > .body { position: absolute; }
#rocket .body { width: 64px; height: 96px; margin-left: -32px; margin-top: -56px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45)); }
#rocket.hop .body { animation: hop 0.24s ease-out; }
@keyframes hop { 50% { transform: translateY(-14px) scale(1.08); } }
#rocket .flame { transform-origin: 50px 112px; animation: flame 0.18s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scaleY(0.75) scaleX(0.9); } to { transform: scaleY(1.15) scaleX(1.05); } }
#alien .body { width: 62px; height: 68px; margin-left: -31px; margin-top: -40px; filter: drop-shadow(0 0 14px rgba(120, 255, 150, 0.45)); transition: transform 0.4s; }
#alien.caught .body { transform: scale(1.5); }
.wobble { transform-origin: 50px 60px; animation: wobble 1.6s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-5deg) translateY(0); } 50% { transform: rotate(5deg) translateY(-4px); } }
.glow-dot { animation: pulse-dot 1s ease-in-out infinite alternate; }
@keyframes pulse-dot { from { opacity: 0.5; } to { opacity: 1; } }

.landmark { position: absolute; pointer-events: none; }
#moon-mark { width: 210px; height: 210px; animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); } }
#earth-mark { width: 72px; height: 72px; filter: drop-shadow(0 0 16px rgba(80, 170, 255, 0.55)); }

/* ---------- 아래 패널 ---------- */
#panel { position: absolute; left: 0; top: 520px; width: 1024px; height: 248px; }
#avatars { position: absolute; left: 70px; top: 44px; display: flex; gap: 34px; align-items: center; }
.avatar { position: relative; width: 118px; height: 118px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 66px; line-height: 1; background: var(--glass); border: 3px solid var(--glass-edge);
  opacity: 0.45; transition: transform 0.35s, opacity 0.35s, box-shadow 0.35s; }
.avatar::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 5px solid var(--gold); opacity: 0; transition: opacity 0.35s; }
.avatar.current { opacity: 1; transform: scale(1.2); box-shadow: 0 0 44px rgba(255, 215, 106, 0.55), inset 0 0 20px rgba(255, 215, 106, 0.25); }
.avatar.current::after { opacity: 1; animation: ring 1.6s ease-in-out infinite; }
@keyframes ring { 50% { transform: scale(1.06); opacity: 0.55; } }

#dice { position: absolute; left: 600px; top: 10px; width: 230px; height: 230px; border-radius: 52px;
  background: linear-gradient(160deg, #ffffff 0%, #e9edf8 60%, #c9d0e6 100%);
  box-shadow: 0 18px 0 #8e97b8, 0 26px 40px rgba(0, 0, 0, 0.45), inset 0 -8px 0 rgba(0, 0, 0, 0.06);
  display: flex; align-items: center; justify-content: center; transition: opacity 0.3s, transform 0.12s; }
#dice.ready { animation: dice-pulse 1.5s ease-in-out infinite; }
#dice.ready:active { transform: translateY(12px); box-shadow: 0 6px 0 #8e97b8, 0 10px 20px rgba(0, 0, 0, 0.4); animation: none; }
#dice.shown { pointer-events: none; }
#dice.idle { opacity: 0.35; pointer-events: none; }
#dice.tumble { animation: tumble 0.7s ease-out; pointer-events: none; }
@keyframes dice-pulse { 50% { transform: scale(1.04); box-shadow: 0 18px 0 #8e97b8, 0 26px 60px rgba(255, 215, 106, 0.45), inset 0 -8px 0 rgba(0, 0, 0, 0.06); } }
@keyframes tumble { 0% { transform: rotate(0) scale(1); } 25% { transform: rotate(-14deg) scale(1.08); } 50% { transform: rotate(12deg) scale(1.1); } 75% { transform: rotate(-6deg) scale(1.04); } 100% { transform: rotate(0) scale(1); } }
#dice .icon { width: 150px; height: 150px; }
.pips { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 10px; }
.pips i { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a5280, var(--ink)); box-shadow: inset 0 -3px 4px rgba(0, 0, 0, 0.4); }
#dice.pop .pips { animation: pop 0.35s ease-out; }

/* ---------- 오버레이 공통 ---------- */
#overlay { position: absolute; inset: 0; z-index: 10; }
#overlay[hidden] { display: none; }
#overlay .sky { position: absolute; inset: 0; }
#overlay .stars { opacity: 0.6; }
#overlay.dim .sky { background: rgba(5, 8, 35, 0.965); }
#overlay.danger .sky { background:
    radial-gradient(ellipse 70% 70% at 50% 50%, rgba(80, 10, 30, 0.55) 0%, rgba(30, 4, 20, 0.97) 100%); }
.center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 44px; }
.row { display: flex; gap: 72px; }
.btn { position: relative; display: flex; align-items: center; justify-content: center; border-radius: 44px;
  background: linear-gradient(160deg, #ffe58a 0%, #ffcf3f 55%, #f0a800 100%); color: var(--ink);
  box-shadow: 0 14px 0 #b27d00, 0 22px 40px rgba(0, 0, 0, 0.45); transition: transform 0.1s, box-shadow 0.1s; }
.btn:active { transform: translateY(10px); box-shadow: 0 4px 0 #b27d00, 0 8px 20px rgba(0, 0, 0, 0.4); }
.btn.people { width: 300px; height: 200px; }
.btn.people svg { width: 190px; height: 140px; }
.btn.round { width: 220px; height: 220px; border-radius: 50%; }
.btn.round svg { width: 130px; height: 130px; }
.hero-rocket { width: 180px; height: 270px; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.5)); animation: float 3s ease-in-out infinite; }
.hero-moon { width: 300px; height: 300px; }
@keyframes float { 50% { transform: translateY(-16px); } }
.shake { animation: shake 0.6s ease-in-out infinite; }
@keyframes shake { 25% { transform: rotate(-7deg) scale(1.04); } 75% { transform: rotate(7deg) scale(1.04); } }
.pop { animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { 0% { transform: scale(0.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
#app.quake { animation: quake 0.5s; }
@keyframes quake { 10%, 50%, 90% { transform: translate(-8px, 4px); } 30%, 70% { transform: translate(8px, -4px); } }

/* ---------- 시작 ---------- */
.setup-art { position: relative; width: 560px; height: 300px; }
.setup-art .hero-moon { position: absolute; right: 0; top: 0; }
.setup-art .hero-rocket { position: absolute; left: 90px; top: 20px; }
.setup-art .hero-rocket svg { transform: rotate(28deg); }

/* ---------- 미션 ---------- */
#hint { position: absolute; left: 0; top: 0; width: 1024px; height: 150px; padding-right: 330px; display: flex; align-items: center; justify-content: center; gap: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04)); border-bottom: 2px solid var(--glass-edge); }
#hint .hint-star { width: 92px; height: 92px; filter: drop-shadow(0 0 14px rgba(255, 198, 43, 0.75)); }
#hint .hint-planet { width: 112px; height: 112px; padding: 10px; border-radius: 50%; background: var(--glass); border: 4px solid var(--gold);
  box-shadow: 0 0 30px rgba(255, 215, 106, 0.4); }
#hint .hint-num { font-size: 78px; font-weight: 800; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 255, 255, 0.35); }
#hint .arrow { width: 44px; height: 44px; opacity: 0.55; }
#strikes { position: absolute; right: 28px; top: 31px; display: flex; gap: 14px; }
.strike { width: 88px; height: 88px; border-radius: 50%; background: var(--glass); border: 3px solid var(--glass-edge); display: flex; align-items: center; justify-content: center; }
.strike svg { width: 64px; height: 64px; }
.strike.on { border-color: #ff6b6b; background: rgba(255, 77, 77, 0.2); }
.strike.on svg { animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }

#arena { position: absolute; left: 0; top: 150px; width: 1024px; height: 618px; }
.item { position: absolute; width: 150px; height: 150px; margin-left: -75px; margin-top: -75px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06) 70%);
  border: 3px solid var(--glass-edge); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4), inset 0 0 24px rgba(255, 255, 255, 0.08);
  transition: opacity 0.3s, transform 0.25s; animation: item-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) backwards; }
.item:active { transform: scale(0.92); }
.item.done { opacity: 0.18; transform: scale(0.7); pointer-events: none; }
.item.wrong { animation: wrong 0.45s; border-color: #ff6b6b; box-shadow: 0 0 40px rgba(255, 77, 77, 0.7); }
@keyframes wrong { 20% { transform: translateX(-16px); } 40% { transform: translateX(14px); } 60% { transform: translateX(-10px); } 80% { transform: translateX(8px); } }
@keyframes item-in { 0% { transform: scale(0.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.item.star .star-svg { width: 118px; height: 118px; filter: drop-shadow(0 0 12px var(--c)); }
.item.planet svg { width: 118px; height: 118px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4)); }
.item.number { font-size: 92px; font-weight: 800; color: #fff; text-shadow: 0 5px 0 rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 255, 255, 0.45); }
.spin-slow { transform-origin: 50px 50px; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#outcome { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5, 8, 35, 0.55); z-index: 5; }
#outcome svg { width: 300px; height: 300px; filter: drop-shadow(0 0 60px rgba(255, 255, 255, 0.35)); }

/* ---------- 승리 ---------- */
.won-art { position: relative; width: 420px; height: 340px; }
.won-art .hero-moon { position: absolute; left: 60px; top: 30px; }
.won-art .hero-rocket { position: absolute; left: 150px; top: -60px; width: 130px; height: 195px; animation: none; }
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.spark { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 10px var(--c); animation: spark 1.4s ease-out forwards; animation-delay: var(--delay); opacity: 0; }
@keyframes spark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } }
.confetti { position: absolute; width: 14px; height: 22px; border-radius: 4px; background: var(--c); top: -30px; animation: fall 2.6s linear infinite; animation-delay: var(--delay); }
@keyframes fall { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(820px) rotate(540deg); } }
