/* =========================================================
   Canvas Perf Demo — Dark Neon / Retro Dot Theme
   ========================================================= */
:root{
  --cyan:#46d7ff;
  --gold:#ffd24a;
  --red:#e8413f;
  --purple:#b15bff;
  --green:#3aff7a;
  --bg:#05060c;
  --mono:'SF Mono','JetBrains Mono','Cascadia Code','Roboto Mono',Consolas,Menlo,monospace;
}

*{ box-sizing:border-box; }

html,body{
  margin:0; height:100%;
  background:var(--bg);
  overflow:hidden;
  font-family:var(--mono);
  color:#cfe6ff;
  -webkit-user-select:none; user-select:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:none;
}

/* ---------- Stage ---------- */
#game-wrap{ position:fixed; inset:0; }

#game{
  position:absolute; inset:0;
  display:block; width:100%; height:100%;
  image-rendering:pixelated;
  image-rendering:crisp-edges;          /* Firefox */
  touch-action:none;
  cursor:crosshair;
  background:#070912;
}

/* CRT: 스캔라인 + 비네팅 + 미세 플리커 (CSS 단, 매 프레임 재그림 없음) */
#crt{
  position:absolute; inset:0; z-index:5; pointer-events:none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px,
      rgba(0,0,0,0.22) 3px, rgba(0,0,0,0) 4px),
    radial-gradient(ellipse at center,
      rgba(0,0,0,0) 55%, rgba(0,0,0,0.6) 100%);
  mix-blend-mode:multiply;
}
#crt::after{
  content:''; position:absolute; inset:0;
  background:rgba(70,215,255,0.035);
  animation:flick 5.5s infinite ease-in-out;
}
@keyframes flick{ 0%,100%{opacity:.55} 48%{opacity:.7} 50%{opacity:.95} 52%{opacity:.65} }

/* ---------- Profiler ---------- */
#profiler{
  position:absolute; z-index:10;
  top:calc(env(safe-area-inset-top,0px) + 10px);
  left:calc(env(safe-area-inset-left,0px) + 10px);
  min-width:168px;
  padding:8px 10px;
  font-size:11px; line-height:1.6; letter-spacing:.5px;
  background:rgba(8,12,22,.74);
  border:1px solid rgba(70,215,255,.35);
  border-radius:4px;
  box-shadow:0 0 14px rgba(70,215,255,.10) inset, 0 2px 10px rgba(0,0,0,.5);
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
}
#profiler .pf-title{
  font-size:10px; color:var(--gold); letter-spacing:2px;
  margin-bottom:5px; padding-bottom:4px;
  border-bottom:1px solid rgba(70,215,255,.22);
}
.pf-row{ display:flex; justify-content:space-between; gap:14px; }
.pf-row span{ color:#6f88a8; }
.pf-row b{ color:#eaf4ff; font-weight:700; font-variant-numeric:tabular-nums; }
.pf-sub{ font-size:9px; color:#5f7796; letter-spacing:.3px; }

/* ---------- Overlays ---------- */
.overlay{
  position:absolute; inset:0; z-index:20;
  display:flex; align-items:center; justify-content:center;
  text-align:center; padding:24px;
  background:radial-gradient(ellipse at center, rgba(5,8,16,.72), rgba(2,3,7,.93));
  backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px);
  animation:ovIn .25s ease-out;
}
.overlay.hidden{ display:none; }
@keyframes ovIn{ from{opacity:0} to{opacity:1} }

.ov-inner{ max-width:580px; }

.logo{
  margin:0; font-weight:800;
  font-size:clamp(36px,9vw,76px); letter-spacing:6px;
  color:var(--cyan);
  text-shadow:0 0 8px rgba(70,215,255,.7), 0 0 26px rgba(70,215,255,.4);
}
.logo span{
  color:var(--gold);
  text-shadow:0 0 8px rgba(255,210,74,.7), 0 0 24px rgba(255,210,74,.4);
}
.logo.dead{ color:var(--red);
  text-shadow:0 0 8px rgba(232,65,63,.7), 0 0 26px rgba(232,65,63,.4); }
.logo.dead span{ color:#fff;
  text-shadow:0 0 8px rgba(255,255,255,.6), 0 0 24px rgba(232,65,63,.4); }

.tag{ color:var(--gold); letter-spacing:4px; font-size:12px; margin:8px 0 20px; }
.desc{ color:#9fb6d4; font-size:13px; line-height:1.75; margin:0 0 28px; }

.btn{
  font-family:var(--mono);
  font-size:18px; font-weight:800; letter-spacing:8px;
  color:#06121a;
  background:linear-gradient(180deg,#8feaff,var(--cyan));
  border:none; border-radius:4px;
  padding:14px 46px; cursor:pointer; text-transform:uppercase;
  box-shadow:0 0 18px rgba(70,215,255,.6), 0 4px 0 #1b6f93;
  transition:transform .08s ease, box-shadow .08s ease;
}
.btn:hover{ transform:translateY(-1px);
  box-shadow:0 0 28px rgba(70,215,255,.9), 0 5px 0 #1b6f93; }
.btn:active{ transform:translateY(2px);
  box-shadow:0 0 12px rgba(70,215,255,.5), 0 2px 0 #1b6f93; }

.hint{ color:#5f7796; font-size:11px; letter-spacing:2px; margin-top:24px; }

.stats{
  display:grid; grid-template-columns:repeat(2,1fr); gap:10px;
  max-width:380px; margin:22px auto;
}
.stats div{
  display:flex; flex-direction:column; gap:4px;
  border:1px solid rgba(70,215,255,.18); border-radius:4px;
  padding:10px 12px; background:rgba(10,16,28,.5);
}
.stats span{ font-size:10px; color:#6f88a8; letter-spacing:2px; }
.stats b{ font-size:22px; color:var(--cyan); font-variant-numeric:tabular-nums; }

/* ---------- Mobile / small screens ---------- */
@media (max-width:560px){
  #profiler{ font-size:10px; min-width:140px; padding:6px 8px; }
  .desc{ font-size:12px; }
  .stats b{ font-size:18px; }
}
@media (max-height:420px) and (orientation:landscape){
  .logo{ font-size:34px; }
  .tag,.desc,.hint{ display:none; }
}
