* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #000; color: #fff; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
#app { position: relative; width: 100vw; height: 100dvh; background: #000; }
canvas#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#hud { position: absolute; inset: 0; pointer-events: none; }
#pauseBtn {
  position: absolute; top: 14px; left: 14px; pointer-events: auto;
  background: transparent; color: #fff; border: 2px solid #fff; border-radius: 10px;
  font-size: 17px; font-weight: 700; padding: 8px 16px; cursor: pointer;
}
#scoreBox { position: absolute; top: 10px; right: 16px; text-align: right; }
#scoreBox .label { font-size: 13px; color: #aaa; }
#scoreBox #score { font-family: "DejaVu Sans Mono", monospace; font-size: 30px; font-weight: 700; letter-spacing: 1px; }

#touchUI { position: absolute; left: 0; right: 0; bottom: 10px; display: none; justify-content: center; pointer-events: none; }
#spaceBtn {
  pointer-events: auto; background: #111; color: #fff; border: 2px solid #fff; border-radius: 999px;
  font-size: 16px; font-weight: 700; padding: 12px 34px; touch-action: none;
}
#spaceBtn.on { background: #fff; color: #000; }
@media (pointer: coarse) { #touchUI { display: flex; } }

#overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.72); z-index: 5;
}
#overlay.hidden { display: none; }
.panel {
  background: #0a0a0a; border: 2px solid #fff; border-radius: 16px;
  padding: 28px 34px; max-width: min(92vw, 520px); text-align: center;
}
.panel.hidden { display: none; }
.panel h1 { font-size: 34px; letter-spacing: 6px; margin-bottom: 8px; }
.panel .sub { color: #ccc; margin-bottom: 14px; }
.panel .how { text-align: left; line-height: 1.8; font-size: 15px; margin: 0 auto 18px; max-width: 420px; }
.panel .note { color: #999; font-size: 13px; margin-top: 12px; }
.panel button {
  background: #fff; color: #000; border: none; border-radius: 999px;
  font-size: 18px; font-weight: 700; padding: 12px 38px; cursor: pointer; margin: 4px;
}
.panel button:hover { background: #ddd; }
#rankBig { font-size: 72px; font-weight: 900; line-height: 1.1; }
#resultTable { margin: 10px auto 6px; border-collapse: collapse; font-size: 16px; }
#resultTable th { text-align: right; color: #aaa; font-weight: 400; padding: 3px 12px 3px 0; }
#resultTable td { text-align: left; font-family: "DejaVu Sans Mono", monospace; }
.ranking { margin-top: 14px; font-size: 14px; color: #ccc; }
.ranking h3 { font-size: 14px; color: #fff; margin-bottom: 6px; letter-spacing: 2px; }
.ranking table { margin: 0 auto; border-collapse: collapse; }
.ranking td { padding: 2px 10px; font-family: "DejaVu Sans Mono", monospace; }
.ranking td.nm { font-family: inherit; }
