* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #05030f;
  --cyan: #36f0ff;
  --pink: #ff3ca6;
  --violet: #9b5cff;
  --lime: #b6ff3c;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: #eaf2ff;
  font-family: 'Trebuchet MS', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 48px; z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: rgba(8, 6, 22, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(120, 90, 255, .22);
}
.topbar .back { color: #9fb4ff; text-decoration: none; font-size: 14px; font-weight: 600; }
.topbar .back:hover { color: #fff; }
.topbar .brand { font-weight: 800; letter-spacing: .5px; font-size: 16px;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.topbar .hs { margin-left: auto; font-size: 13px; color: #8ea2c8; font-weight: 600; }
.topbar .hs b { color: var(--lime); font-size: 15px; }

#stage {
  position: fixed; top: 48px; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}
#game { display: block; width: 100%; height: 100%; touch-action: none; }

/* 오버레이 공통 */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 38%, rgba(20,12,48,.62), rgba(3,2,10,.9));
  backdrop-filter: blur(4px);
  padding: 20px;
}
.overlay.hidden { display: none; }
.panel {
  width: min(440px, 92vw);
  background: linear-gradient(160deg, rgba(28,20,60,.95), rgba(10,7,26,.97));
  border: 1px solid rgba(130,100,255,.34);
  border-radius: 20px;
  padding: 30px 26px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,.6), 0 0 60px rgba(120,70,255,.16) inset;
}
.panel.wide { width: min(700px, 95vw); }
.panel h1 {
  font-size: 34px; letter-spacing: 1px; margin-bottom: 12px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 0 28px rgba(120,90,255,.4);
}
.panel h2 { font-size: 22px; margin-bottom: 18px; color: #fff; }
.panel h2 span { color: var(--cyan); }
.panel .sub { color: #aeb9da; font-size: 14px; line-height: 1.7; margin-bottom: 22px; }
.panel .ctrl { color: #7d88ac; font-size: 12px; line-height: 1.7; margin-top: 18px; }
.panel .ctrl b { color: #b9c6ef; }

.btn {
  appearance: none; border: none; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 17px; letter-spacing: .5px;
  color: #07101a; padding: 14px 38px; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), #7af0ff);
  box-shadow: 0 8px 26px rgba(54,240,255,.34);
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(54,240,255,.5); }
.btn:active { transform: translateY(0); }

.stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin: 18px 0;
}
.stats > div {
  background: rgba(120,90,255,.1); border: 1px solid rgba(130,100,255,.22);
  border-radius: 12px; padding: 12px 8px;
}
.stats span { display: block; font-size: 11px; color: #8a96bd; letter-spacing: 1px; }
.stats b { font-size: 22px; color: #fff; }
.best { color: var(--lime); font-weight: 700; font-size: 14px; margin-bottom: 18px; min-height: 18px; }

/* 업그레이드 카드 */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 540px) { .cards { grid-template-columns: 1fr; } }
.upg {
  cursor: pointer; text-align: left;
  background: linear-gradient(165deg, rgba(40,28,80,.9), rgba(14,10,32,.95));
  border: 1px solid rgba(140,110,255,.3); border-radius: 14px;
  padding: 16px 14px; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.upg:hover { transform: translateY(-4px); border-color: var(--cyan); box-shadow: 0 12px 30px rgba(54,240,255,.22); }
.upg .ico { font-size: 30px; display: block; margin-bottom: 8px; }
.upg .name { font-weight: 800; font-size: 15px; color: #fff; margin-bottom: 4px; }
.upg .name .lv { font-size: 11px; color: var(--lime); font-weight: 700; margin-left: 4px; }
.upg .new { font-size: 10px; color: #07101a; background: var(--lime); border-radius: 5px; padding: 1px 5px; margin-left: 4px; vertical-align: 2px; font-weight: 800; }
.upg .dsc { font-size: 12px; color: #aab6d8; line-height: 1.55; }

.hint {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  text-align: center; font-size: 11.5px; color: #6f7aa0;
  padding: 7px 14px; background: rgba(5,4,14,.7);
  pointer-events: none;
}
@media (max-width: 600px) { .hint { display: none; } }
