/* style.css —— 像素风全局样式 */
:root {
  --bg: #05010f;
  --p1: #ff2e88;
  --p2: #00e5ff;
  --accent: #ffd23f;
  --ink: #e8e8f0;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  overflow: hidden;
}

body {
  /* 微弱网格底纹 */
  background-image:
    radial-gradient(circle at 50% 0%, #1a0533 0%, transparent 60%),
    linear-gradient(var(--bg), var(--bg));
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px;
}

.canvas-wrap {
  position: relative;
  /* 16:9 等比缩放，适配窗口 */
  width: min(96vw, calc(92vh * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
  border: 3px solid #2a0a45;
  box-shadow:
    0 0 0 2px #000,
    0 0 24px rgba(255, 46, 136, 0.35),
    0 0 48px rgba(0, 229, 255, 0.2),
    inset 0 0 0 2px #000;
  border-radius: 2px;
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* CRT 扫描线叠加（CSS 层，不影响 canvas 像素） */
.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 4px
  );
  mix-blend-mode: multiply;
  z-index: 2;
}

/* 暗角 */
.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.55) 100%
  );
  z-index: 3;
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05010f;
  color: var(--accent);
  font-size: clamp(8px, 1.6vw, 14px);
  letter-spacing: 2px;
  z-index: 4;
  animation: blink 0.8s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0.3; }
}

.footer {
  font-size: clamp(7px, 1.1vw, 11px);
  color: #7a7a96;
  text-align: center;
  line-height: 1.8;
  letter-spacing: 1px;
}

.footer .k {
  color: var(--accent);
  padding: 1px 4px;
  border: 1px solid #3a2050;
  border-radius: 2px;
  background: #120420;
}
