* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg0: #0b0712;
  --neon: #34f5c5;
  --neon2: #ff5d8f;
  --neon3: #ffd23f;
  --ink: #eaf6ff;
  --sub: #8a7fb0;
}

html, body {
  height: 100%;
  background: radial-gradient(120% 80% at 50% 0%, #241a3a 0%, var(--bg0) 70%);
  color: var(--ink);
  font-family: "DungGeunMo", "Galmuri11", ui-monospace, "Apple SD Gothic Neo", monospace;
  -webkit-font-smoothing: none;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(11,7,18,.92), rgba(11,7,18,0));
  font-size: 13px; letter-spacing: .5px;
}
.topbar .back { color: var(--neon); text-decoration: none; opacity: .9; }
.topbar .back:hover { opacity: 1; text-shadow: 0 0 8px var(--neon); }
.topbar .brand { color: var(--ink); opacity: .8; font-size: 12px; }
.topbar .hs { color: var(--neon3); font-size: 12px; }

#stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}

canvas#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  background: #0b0712;
  box-shadow: 0 0 0 2px rgba(52,245,197,.25), 0 24px 60px rgba(0,0,0,.6),
              0 0 80px rgba(52,245,197,.10);
  border-radius: 6px;
  touch-action: none;
}

/* 모바일 D패드 */
#pad {
  position: fixed; right: 16px; bottom: 28px; z-index: 25;
  display: none;
  width: 156px; height: 156px;
}
.pb {
  position: absolute; width: 52px; height: 52px;
  background: rgba(52,245,197,.10);
  border: 2px solid rgba(52,245,197,.45);
  color: var(--neon); font-size: 18px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.pb:active { background: rgba(52,245,197,.28); box-shadow: 0 0 14px rgba(52,245,197,.5); }
.pb.up    { left: 52px; top: 0; }
.pb.left  { left: 0;    top: 52px; }
.pb.right { left: 104px;top: 52px; }
.pb.down  { left: 52px; top: 104px; }

.hint {
  position: fixed; bottom: 14px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: var(--sub); z-index: 20; pointer-events: none;
  text-shadow: 0 1px 2px #000; transition: opacity 1s;
  padding: 0 12px;
}

@media (max-width: 760px), (pointer: coarse) {
  #pad { display: block; }
}
@media (max-width: 640px) {
  .topbar .brand { display: none; }
}
