/* ──────────────────────────────────────────────
   Canvas Survivor — style.css
   다크 네온 + CRT 레트로 테마. 모바일 노치/safe-area 대응.
   ────────────────────────────────────────────── */

:root {
  --bg-0: #07070d;
  --bg-1: #0a0a14;
  --bg-2: #12121f;
  --ink:  #e7ecff;
  --ink-dim: #8a90a8;
  --cyan: #46d7ff;
  --gold: #ffd24a;
  --red:  #ff4d5a;
  --violet: #b15bff;
  --grid: rgba(70, 215, 255, 0.06);
  --ui-bg: rgba(10, 12, 22, 0.78);
  --ui-brd: rgba(70, 215, 255, 0.25);
  --font: "Press Start 2P", "IBM Plex Mono", ui-monospace, SFMono-Regular,
          Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: none;
  font-smooth: never;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 모바일 세이프 에어리어 */
body {
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

#wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 50% 45%, #12122a 0%, var(--bg-0) 70%),
    var(--bg-0);
}

/* 도트 그리드 배경 (CSS 레이어) */
#wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
  background-position: -1px -1px;
  opacity: 0.55;
  pointer-events: none;
}

/* CRT 스캔라인 */
#wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.22) 0px,
    rgba(0,0,0,0.22) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  pointer-events: none;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
}

/* ───────────── 프로파일러 ───────────── */
#profiler {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  padding: 8px 10px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-brd);
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: var(--ink);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  min-width: 170px;
  pointer-events: none;
  z-index: 5;
  font-family: var(--font);
}
#profiler > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
#profiler .lbl {
  color: var(--ink-dim);
  text-transform: uppercase;
}
#profiler .val {
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
#p-fps.good   { color: #6bff8a; }
#p-fps.mid    { color: #ffd24a; }
#p-fps.bad    { color: #ff6b6b; }

/* ───────────── 오버레이 ───────────── */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(600px 400px at 50% 50%, rgba(20,22,50,0.55), rgba(5,5,12,0.92));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 10;
  padding: 24px;
}
.overlay .panel {
  max-width: 440px;
  width: 100%;
  text-align: center;
  padding: 28px 26px;
  border: 1px solid var(--ui-brd);
  border-radius: 6px;
  background: rgba(8, 10, 20, 0.92);
  box-shadow: 0 0 40px rgba(70, 215, 255, 0.12);
}
.overlay h1 {
  font-size: clamp(22px, 6vw, 38px);
  margin: 0 0 12px;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-shadow:
    0 0 8px rgba(70, 215, 255, 0.6),
    0 0 22px rgba(70, 215, 255, 0.35);
  line-height: 1.2;
}
.overlay .sub {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.overlay .desc {
  font-size: 11px;
  line-height: 1.85;
  color: var(--ink-dim);
  margin: 0 auto 22px;
}
.stats {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  font-size: 11px;
  text-align: left;
  color: var(--ink-dim);
}
.stats li { display: contents; }
.stats li span:last-child {
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.btn {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.15em;
  padding: 14px 28px;
  border-radius: 4px;
  border: 1px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 80ms ease, background 120ms ease, color 120ms ease;
}
.btn:hover, .btn:focus-visible {
  background: var(--cyan);
  color: var(--bg-1);
  outline: none;
  box-shadow: 0 0 18px rgba(70, 215, 255, 0.55);
}
.btn:active { transform: translateY(1px); }

[hidden] { display: none !important; }
