* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #05070f; overflow: hidden;
  font-family: system-ui, sans-serif; color: #fff; user-select: none; }

/* 9:16 스테이지, 화면 안에 레터박스로 맞춤 */
#stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#game {
  aspect-ratio: 9 / 16; height: 100%; max-width: 100%;
  background: #0a0e1a; touch-action: none; display: block;
}

:root {
  --accent: #4fd0ff; --accent2: #2a6cf0;
  --panel: rgba(28, 40, 68, 0.72); --panel2: rgba(20, 28, 50, 0.6);
  --hair: rgba(120, 180, 255, 0.22);
}

#hud {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none;
  padding: 5px 14px; border-radius: 999px; white-space: nowrap;
  background: rgba(6, 12, 26, 0.5); border: 1px solid var(--hair);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35); letter-spacing: 0.3px;
}

#mute {
  position: absolute; top: 6px; right: 8px; z-index: 5;
  background: rgba(6, 12, 26, 0.5); border: 1px solid var(--hair); border-radius: 10px;
  font-size: 17px; padding: 5px 9px; cursor: pointer; line-height: 1;
}
#bombBtn {
  position: absolute; bottom: 18px; right: 16px; z-index: 6; display: none;
  background: rgba(240,140,40,0.28); border: 2px solid #f93; border-radius: 50%;
  width: 62px; height: 62px; font-size: 26px; cursor: pointer; line-height: 1;
  color: #fff; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
#bombBtn.on { display: block; }
#bombBtn:disabled { opacity: 0.35; border-color: #777; }
#bombN { position: absolute; right: 6px; bottom: 4px; font-size: 13px; font-weight: 700; }

#banner {
  position: absolute; top: 38%; left: 0; right: 0; text-align: center;
  font-size: 30px; font-weight: 800; letter-spacing: 2px; color: #fff;
  text-shadow: 0 2px 12px #06b6ff, 0 0 4px #000; pointer-events: none;
  opacity: 0;
}
#banner.show { animation: bannerpop 2s ease forwards; }
@keyframes bannerpop {
  0% { opacity: 0; transform: scale(1.4); }
  15% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}

#overlay {
  position: absolute; inset: 0; display: none; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: 11px;
  text-align: center; padding: 5vh 18px 6vh; overflow-y: auto; overflow-x: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(79,208,255,0.16), transparent 60%),
    radial-gradient(100% 60% at 50% 110%, rgba(120,60,220,0.18), transparent 60%),
    rgba(4, 8, 18, 0.9);
}
#overlay > * { flex: 0 0 auto; }
#overlay h1 {
  font-size: clamp(24px, 8.5vw, 34px); letter-spacing: 2px; font-weight: 800; margin-top: 6px;
  max-width: 100%; line-height: 1.1;
  background: linear-gradient(180deg, #fff, #bcd8ff); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(79,208,255,0.35));
}
#overlay h1 .nova {
  margin-left: 7px; -webkit-text-fill-color: var(--accent);
  text-shadow: 0 0 16px var(--accent); letter-spacing: 2px;
}
#overlay p { opacity: 0.82; font-size: 14.5px; line-height: 1.5; }
#overlay button {
  font-size: 16px; padding: 12px 22px; border: 1px solid var(--hair); border-radius: 12px;
  background: linear-gradient(180deg, rgba(52,68,108,0.7), rgba(30,42,72,0.7));
  color: #eef4ff; cursor: pointer; min-width: 200px; font-weight: 600;
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
#overlay button:hover { filter: brightness(1.12); }
#overlay button:active { transform: scale(0.96); }
#overlay button.primary {
  background: linear-gradient(180deg, #5fd6ff, var(--accent2)); border: 0; color: #061024;
  font-weight: 800; letter-spacing: 0.5px; box-shadow: 0 6px 18px rgba(42,108,240,0.45);
}
#overlay button.card {
  background: linear-gradient(135deg, #2b3a66, #1a2444); border: 1px solid #4a6cf0;
  min-width: 240px; padding: 14px 18px; font-weight: 600; text-align: left;
}
#overlay button:disabled { opacity: 0.4; cursor: default; filter: none; }
#overlay .btnrow { display: flex; gap: 9px; width: 300px; max-width: 90vw; }
#overlay .btnrow button { min-width: 0; flex: 1; padding: 11px 8px; font-size: 14px; }
#overlay .shoprow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; width: 300px; max-width: 90vw; font-size: 14.5px;
  padding: 9px 14px; border-radius: 12px;
  background: var(--panel2); border: 1px solid var(--hair);
}
#overlay .shoprow > span:first-child { text-align: left; }
#overlay .shoprow button { min-width: 84px; padding: 8px 12px; font-size: 13.5px; }

#overlay .stages { display: flex; flex-direction: column; gap: 6px; }
#overlay .stagerow { display: flex; gap: 6px; justify-content: center; }
#overlay .stage {
  min-width: 60px; padding: 6px 4px; font-size: 13px; line-height: 1.2;
  background: #223; border-radius: 8px;
}
#overlay .stage.done { background: #274; }
#overlay .stage.open { background: #2a6cf0; font-weight: 700; }
#overlay .stage.lock { background: #222; opacity: 0.45; }
#overlay .stage small { font-size: 11px; }

#overlay .legend { display: flex; flex-direction: column; gap: 6px; width: 320px; max-width: 92vw; }
#overlay .legendrow {
  display: flex; align-items: center; gap: 10px; font-size: 13px; text-align: left;
  padding: 7px 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--hair);
}
#overlay .legendrow b { min-width: 60px; }
#overlay .legendrow .ldesc { opacity: 0.72; font-size: 12px; }
#overlay .orb {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px;
  display: flex; align-items: center; justify-content: center;
  color: #061024; font-weight: 800; font-size: 12px;
  box-shadow: 0 0 10px rgba(255,255,255,0.25) inset, 0 1px 4px rgba(0,0,0,0.4);
}
#overlay .shiprow {
  display: flex; align-items: center; gap: 11px; width: 300px; max-width: 92vw;
  padding: 9px 11px; border-radius: 13px; text-align: left;
  background: var(--panel); border: 1px solid var(--hair);
}
#overlay .shiprow.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 16px rgba(79,208,255,0.25); }
#overlay .shiprow .shipinfo { display: flex; flex-direction: column; flex: 1; gap: 1px; }
#overlay .shiprow .shipinfo b { font-size: 15px; }
#overlay .shiprow .shipstat { opacity: 0.6; font-size: 11px; }
#overlay .shiprow .shipimg { width: 50px; height: 50px; object-fit: contain; flex: 0 0 50px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); }
#overlay .shiprow button { min-width: 74px; padding: 8px 10px; }
#overlay .privacy-text { max-width: 320px; font-size: 12.5px; line-height: 1.55; opacity: 0.82; text-align: left; }
#overlay .privacy-text p { margin-bottom: 8px; }
