@import url("https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=Gowun+Dodum&display=swap");

:root {
  color-scheme: dark;
  --ink: #07030b;
  --panel: #12091a;
  --pink: #ff2b9b;
  --hot-pink: #ff78c8;
  --gold: #ffd84f;
  --cyan: #4fe7ff;
  --white: #fff8fd;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -20%, #7a185d 0, transparent 40%),
    radial-gradient(circle at 10% 70%, #17225c 0, transparent 32%),
    linear-gradient(135deg, #050208, #15071c 48%, #050208);
  color: var(--white);
  font-family: "Gowun Dodum", system-ui, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(90deg, rgba(255, 43, 155, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 43, 155, 0.035) 1px, transparent 1px);
  background-size: 38px 38px;
  content: "";
  transform: perspective(480px) rotateX(62deg) scale(1.65) translateY(27%);
  transform-origin: bottom;
}

button {
  color: inherit;
  font: inherit;
}

.stage {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 18px 24px 30px;
}

.marquee {
  display: flex;
  width: min(520px, 76vw);
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto -9px;
  padding: 8px 28px 13px;
  border: 3px solid var(--gold);
  border-radius: 50% 50% 12px 12px / 22px 22px 12px 12px;
  background: linear-gradient(180deg, #cf1a80, #7b0d55);
  box-shadow: 0 0 22px #ff2b9b99, inset 0 0 14px #ffdb7088;
  text-align: center;
  transform: perspective(200px) rotateX(-4deg);
}

.marquee div {
  display: grid;
  line-height: 1;
}

.marquee strong {
  font-family: "Black Han Sans", Impact, sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  letter-spacing: 0.13em;
  text-shadow: 3px 3px 0 #2c0621;
}

.marquee small {
  margin-top: 3px;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(0.55rem, 1.5vw, 0.78rem);
  letter-spacing: 0.28em;
}

.marquee > span {
  color: var(--gold);
  font-size: 1.35rem;
  animation: sparkle 1.1s steps(2) infinite;
}

.game-frame {
  position: relative;
  overflow: hidden;
  border: 4px solid #ffe88e;
  border-radius: 14px;
  background: #050208;
  box-shadow:
    0 0 0 5px #6e1053,
    0 0 42px #ff2b9b66,
    0 25px 60px #000b;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  outline: none;
  image-rendering: pixelated;
  touch-action: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.13) 0,
    rgba(0, 0, 0, 0.13) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: multiply;
}

.icon-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 2px solid #fff6;
  border-radius: 50%;
  background: #09030dbb;
  color: var(--hot-pink);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
  outline: none;
}

.creator-button {
  right: auto;
  left: 14px;
  border-color: #4fe7ff55;
  color: var(--cyan);
  opacity: 0.18;
  transition: opacity 160ms ease, border-color 160ms ease, color 160ms ease;
}

.creator-button:hover,
.creator-button:focus-visible {
  opacity: 1;
}

[hidden] {
  display: none !important;
}

.help {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin: 18px auto 0;
  color: #eacbe2;
  font-size: 0.82rem;
}

kbd {
  padding: 2px 6px;
  border: 1px solid #8c6c86;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #211426;
  color: white;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.touch-controls {
  display: none;
  align-items: end;
  justify-content: space-between;
  margin-top: 18px;
  user-select: none;
}

.touch-controls button {
  border: 2px solid #ff93d099;
  background: linear-gradient(#36112d, #1c0918);
  box-shadow: inset 0 0 14px #ff2b9b22;
  color: white;
  touch-action: none;
}

.touch-controls button:active,
.touch-controls button.is-down {
  background: var(--pink);
  color: #16030f;
  transform: translateY(2px);
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(2, 50px);
  gap: 4px;
}

.dpad button {
  border-radius: 9px;
}

.dpad button:nth-child(1) {
  grid-column: 2;
}

.dpad button:nth-child(2) {
  grid-column: 1;
}

.dpad button:nth-child(3) {
  grid-column: 2;
}

.dpad button:nth-child(4) {
  grid-column: 3;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions button {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  font-family: "Black Han Sans", Impact, sans-serif;
  font-size: 1.35rem;
}

.actions .primary {
  border-color: var(--gold);
  color: var(--gold);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@keyframes sparkle {
  50% {
    filter: brightness(1.8);
    transform: scale(1.25) rotate(12deg);
  }
}

@media (hover: none), (pointer: coarse) {
  .touch-controls {
    display: flex;
  }

  .help {
    display: none;
  }
}

@media (max-width: 720px) {
  .stage {
    padding: 10px 8px 22px;
  }

  .marquee {
    min-height: 55px;
    padding: 5px 22px 10px;
  }

  .game-frame {
    border-width: 2px;
    border-radius: 8px;
    box-shadow: 0 0 0 3px #6e1053, 0 0 22px #ff2b9b55;
  }

  .icon-button {
    top: 7px;
    right: 7px;
    width: 32px;
    height: 32px;
  }

  .creator-button {
    right: auto;
    left: 7px;
  }
}

@media (max-height: 760px) and (orientation: landscape) and (pointer: coarse) {
  .marquee,
  .help {
    display: none;
  }

  .stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 142px;
    gap: 12px;
    width: min(100%, 1120px);
    padding: 6px;
  }

  .touch-controls {
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    margin: 0;
  }

  .dpad {
    grid-template-columns: repeat(3, 42px);
    grid-template-rows: repeat(2, 40px);
  }

  .actions button {
    width: 54px;
    height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee > span {
    animation: none;
  }
}
