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

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

html, body {
  height: 100%;
  background: radial-gradient(120% 80% at 50% 0%, #1a1030 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;
}

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;
}

/* on-screen pad — only on touch devices */
.pad { display: none; }
@media (pointer: coarse) {
  .pad {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(6, 1fr);
    grid-template-areas:
      "hold ccw  left soft right cw"
      "hard hard hard hard hard hard";
    background: linear-gradient(0deg, rgba(11,7,18,.96), rgba(11,7,18,0));
  }
  .hint { display: none; }
}
.pad .key {
  font-family: inherit; font-size: 22px; color: var(--ink);
  background: rgba(52,245,197,.08);
  border: 1px solid rgba(52,245,197,.32);
  border-radius: 10px; padding: 14px 0;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pad .key:active { background: rgba(52,245,197,.28); }
.pad .key[data-act="hold"]  { grid-area: hold;  color: var(--neon3); }
.pad .key[data-act="ccw"]   { grid-area: ccw; }
.pad .key[data-act="left"]  { grid-area: left; }
.pad .key[data-act="soft"]  { grid-area: soft; }
.pad .key[data-act="right"] { grid-area: right; }
.pad .key[data-act="cw"]    { grid-area: cw; }
.pad .key.big { grid-area: hard; color: var(--neon2); border-color: rgba(255,93,143,.4); background: rgba(255,93,143,.1); }

.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;
}
