:root {
  --bg: #0a0a12;
  --fg: #e6e8ff;
  --accent: #58e1ff;
  --accent2: #ff5db1;
  --good: #5dff9b;
  --warn: #ffd15d;
  --bad: #ff5d6c;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* 모바일: 텍스트 선택/하이라이트/스크롤 바운스 차단 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

#game {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  touch-action: none;   /* 스크롤/핀치줌/더블탭줌 차단 */
  cursor: crosshair;
  /* 도트 스프라이트 확대 시 픽셀 또렷하게 유지 */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ===== CRT 스캔라인 + 비네팅 오버레이 ===== */
.crt {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.22) 0px,
      rgba(0, 0, 0, 0.22) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(120% 120% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.45));
  mix-blend-mode: multiply;
}

/* ===== 프로파일러 패널 (좌상단 모서리) ===== */
.profiler {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  z-index: 10;
  margin: 0;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.2px;
  color: var(--good);
  background: rgba(8, 8, 18, 0.72);
  border: 2px solid currentColor;
  border-radius: 2px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: pre;
  tab-size: 2;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}
.profiler.warn { color: var(--warn); }
.profiler.bad  { color: var(--bad); }

/* ===== 오버레이(시작 / 게임오버) ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 120% at 50% 40%, rgba(20, 16, 40, 0.55), rgba(6, 6, 14, 0.92));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.overlay.hidden { display: none; }

.panel {
  width: min(440px, 92vw);
  text-align: center;
  padding: 32px 28px;
  border-radius: 4px;
  background: rgba(14, 14, 28, 0.82);
  border: 2px solid rgba(88, 225, 255, 0.45);
  box-shadow: 0 0 0 2px #06121a, 8px 8px 0 rgba(0, 0, 0, 0.55), inset 0 0 40px rgba(88, 225, 255, 0.05);
}

.panel h1 {
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(2px 2px 0 rgba(6, 18, 26, 0.9));
}
.panel h1 span { color: var(--fg); -webkit-text-fill-color: var(--fg); opacity: 0.5; }

#subtitle {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.6;
}

.stats {
  margin: 22px 0 4px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.9;
  text-align: left;
  display: inline-block;
}
.stats b { color: var(--accent); font-weight: 600; }

#actionBtn {
  margin-top: 24px;
  padding: 14px 40px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #06121a;
  background: linear-gradient(180deg, #7af0ff, var(--accent));
  border: 2px solid #06121a;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 5px 5px 0 rgba(6, 18, 26, 0.8);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  touch-action: manipulation;
}
#actionBtn:hover { box-shadow: 6px 6px 0 rgba(6, 18, 26, 0.85); }
#actionBtn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 rgba(6, 18, 26, 0.8); }

.hint {
  margin-top: 18px;
  font-size: 12px;
  opacity: 0.5;
  line-height: 1.6;
}
