:root {
  --pink: #ff3fb7;
  --green: #4dff77;
  --white: #f5fff9;
  --crt: #202126;
  --case: #6c6c70;
  --black: #050509;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 63, 183, 0.18), transparent 26rem),
    radial-gradient(circle at 50% 85%, rgba(77, 255, 119, 0.11), transparent 30rem),
    #050509;
  color: var(--green);
  font-family: "Courier New", Courier, monospace;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  touch-action: manipulation;
}

.crt-shell {
  width: min(100%, 1060px);
  display: grid;
  gap: 10px;
  justify-items: center;
}

.canvas-frame {
  position: relative;
  width: min(100%, calc((100vh - 58px) * 4 / 3));
  aspect-ratio: 4 / 3;
  padding: clamp(10px, 1.7vw, 18px);
  background:
    linear-gradient(135deg, #8a8a8e, #3b3c42 54%, #15161b),
    var(--case);
  border: 6px solid #111217;
  border-radius: 8px;
  box-shadow:
    0 0 0 5px #34353a,
    0 20px 60px rgba(0, 0, 0, 0.66),
    inset 0 0 18px rgba(255, 255, 255, 0.2);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  border: 4px solid #08090c;
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
}

.scanlines,
.vignette {
  position: absolute;
  inset: clamp(14px, 1.7vw, 22px);
  pointer-events: none;
  border-radius: 4px;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0,
    rgba(255, 255, 255, 0.05) 1px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  mix-blend-mode: soft-light;
}

.vignette {
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.78),
    inset 0 0 8px rgba(77, 255, 119, 0.26);
}

.hint {
  margin: 0;
  max-width: 960px;
  color: #b8ffc8;
  font-size: clamp(11px, 1.6vw, 14px);
  text-align: center;
  text-shadow: 0 0 7px rgba(77, 255, 119, 0.7);
}

.mobile-controls {
  display: none;
  width: min(100%, 520px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.level2-active .mobile-controls {
  display: grid;
}

body.level2-active .canvas-frame {
  width: min(100%, calc((100vh - 158px) * 4 / 3));
}

.lane-button {
  min-height: 68px;
  border: 5px solid var(--pink);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #363740 0 10px, transparent 10px),
    #15161b;
  color: var(--white);
  box-shadow:
    inset -5px -5px 0 #06070a,
    inset 5px 5px 0 #4c4d57,
    0 0 14px rgba(255, 63, 183, 0.28);
  font: 700 34px/1 "Courier New", Courier, monospace;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.lane-button:active {
  border-color: var(--green);
  color: var(--green);
  transform: translateY(2px);
}

@media (max-width: 640px) {
  body {
    padding: 8px;
  }

  .canvas-frame {
    padding: 8px;
    border-width: 4px;
  }

  body.level2-active .canvas-frame {
    width: min(100%, calc((100vh - 132px) * 4 / 3));
  }

  .mobile-controls {
    gap: 10px;
  }

  .lane-button {
    min-height: 58px;
    font-size: 30px;
  }

  .hint {
    display: none;
  }
}
