:root {
  color-scheme: dark;
  --bg: #09031b;
  --panel: #13082e;
  --panel-deep: #080319;
  --cyan: #50f4ff;
  --pink: #ff4fd8;
  --yellow: #ffe66d;
  --purple: #834dff;
  --text: #fff9ef;
  --muted: #aaa0c8;
  --ink: #080315;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(131, 77, 255, 0.27), transparent 34rem),
    radial-gradient(circle at 9% 43%, rgba(255, 79, 216, 0.11), transparent 26rem),
    radial-gradient(circle at 91% 68%, rgba(80, 244, 255, 0.09), transparent 27rem),
    var(--bg);
  font-family: "Courier New", ui-monospace, monospace;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  opacity: 0.7;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(80, 244, 255, 0.65) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 230, 109, 0.7) 0 1px, transparent 1.5px);
  background-position: 12px 18px, 82px 115px, 158px 54px;
  background-size: 173px 173px, 241px 241px, 307px 307px;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  content: "";
  opacity: 0.15;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(0, 0, 0, 0.34) 4px);
}

button,
kbd {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(850px, 100%);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 36px);
  display: grid;
  grid-template-rows: 20vh 80vh;
  grid-template-rows: 20dvh 80dvh;
}

.page-shell,
.page-shell * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.arcade-header {
  position: relative;
  display: flex;
  height: 20vh;
  height: 20dvh;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-align: center;
}

.arcade-header::before,
.arcade-header::after {
  position: absolute;
  top: 50%;
  width: clamp(36px, 9vw, 84px);
  height: 4px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--cyan));
  box-shadow: 0 0 14px var(--cyan);
}

.arcade-header::before {
  right: calc(50% + min(36vw, 310px));
}

.arcade-header::after {
  left: calc(50% + min(36vw, 310px));
  background: linear-gradient(90deg, var(--pink), transparent);
  box-shadow: 0 0 14px var(--pink);
}

h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--yellow);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(42px, min(9.5vw, 9dvh), 90px);
  font-weight: 900;
  letter-spacing: 0.025em;
  line-height: 0.8;
  text-align: center;
  text-transform: uppercase;
  transform: skew(-4deg);
  -webkit-text-stroke: 1px #fff2b0;
  text-shadow:
    2px 2px 0 #ff8b36,
    5px 5px 0 #e528a8,
    8px 8px 0 #652bd6,
    0 0 24px rgba(255, 79, 216, 0.6);
}

h1 span {
  display: block;
}

h1 span:last-child {
  margin-top: 0.2em;
  color: var(--cyan);
  font-size: 0.72em;
  letter-spacing: 0.055em;
  -webkit-text-stroke-color: #c5fbff;
  text-shadow:
    2px 2px 0 #2189d8,
    5px 5px 0 #6131c8,
    8px 8px 0 #351178,
    0 0 26px rgba(80, 244, 255, 0.62);
}

.hero {
  width: 100%;
  height: 80vh;
  height: 80dvh;
  min-height: 0;
  padding: 7px 0 8px;
}

.game-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  max-width: 640px;
  height: 100%;
  margin: 0 auto;
  min-height: 0;
}

.play-stage {
  display: flex;
  width: 100%;
  min-height: 0;
  align-items: center;
  justify-content: center;
}

.move-zone {
  display: none;
}

.game-card {
  position: relative;
  width: min(640px, max(230px, calc((80dvh - 250px) * 9 / 11 + 36px)), calc(100vw - 32px));
  min-height: 0;
  margin: auto;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 16%),
    linear-gradient(160deg, #2b1262 0%, #11072d 42%, #070215 100%);
  border: 3px solid #7e46d9;
  border-radius: 28px 28px 16px 16px;
  box-shadow:
    0 0 0 5px #090218,
    0 0 0 7px rgba(80, 244, 255, 0.58),
    0 0 28px rgba(80, 244, 255, 0.32),
    0 0 65px rgba(255, 79, 216, 0.2),
    0 32px 80px rgba(0, 0, 0, 0.65),
    inset 0 2px rgba(255, 255, 255, 0.2);
}

.game-card::before {
  position: absolute;
  inset: 7px;
  z-index: 5;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(255, 230, 109, 0.25);
  border-radius: 20px 20px 10px 10px;
}

.game-card::after {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 6;
  width: 94px;
  height: 5px;
  pointer-events: none;
  content: "";
  background: var(--pink);
  border-radius: 999px;
  box-shadow: 0 0 14px var(--pink);
  transform: translateX(-50%);
}

.game-status {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  min-height: 82px;
  margin: 0 3px 14px;
  padding: 16px 10px 6px;
  background: rgba(5, 1, 20, 0.6);
  border: 1px solid rgba(80, 244, 255, 0.22);
  border-radius: 12px;
  box-shadow: inset 0 0 20px rgba(80, 244, 255, 0.05);
}

.game-status > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-left: 21px;
  border-left: 1px solid rgba(255, 79, 216, 0.35);
}

.game-status > div:first-child {
  padding-left: 8px;
  border-left: 0;
}

.game-status span {
  margin-bottom: 6px;
  color: var(--pink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-shadow: 0 0 9px rgba(255, 79, 216, 0.85);
}

.game-status strong {
  color: var(--yellow);
  font-size: clamp(18px, 4vw, 24px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(255, 230, 109, 0.65);
}

.game-status .health {
  color: var(--cyan);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 11px var(--cyan);
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 9 / 11;
  background: #070218;
  border: 4px solid #05000e;
  border-radius: 50% / 3%;
  box-shadow:
    0 0 0 2px rgba(80, 244, 255, 0.35),
    inset 0 0 36px rgba(80, 244, 255, 0.12),
    0 0 22px rgba(80, 244, 255, 0.18);
}

.canvas-wrap::before {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  content: "";
  opacity: 0.24;
  background: repeating-linear-gradient(to bottom, transparent 0 4px, rgba(0, 0, 0, 0.5) 5px);
}

.canvas-wrap::after {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  content: "";
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.42) 100%);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  touch-action: none;
  user-select: none;
}

.canvas-wrap.is-firing {
  box-shadow:
    0 0 0 2px rgba(255, 79, 216, 0.62),
    inset 0 0 46px rgba(255, 79, 216, 0.17),
    0 0 25px rgba(255, 79, 216, 0.32);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  visibility: hidden;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  opacity: 0;
  background: rgba(7, 2, 24, 0.84);
  transition: opacity 160ms ease, visibility 160ms ease;
}

.screen.is-visible {
  visibility: visible;
  opacity: 1;
}

.screen-icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin-bottom: 29px;
  place-items: center;
  color: var(--ink);
  background: var(--cyan);
  clip-path: polygon(50% 0, 100% 100%, 50% 80%, 0 100%);
  font-size: 22px;
  text-shadow: none;
  filter: drop-shadow(0 0 15px rgba(80, 244, 255, 0.85));
}

.screen-kicker {
  margin: 0 0 14px;
  color: var(--pink);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-shadow: 0 0 10px var(--pink);
}

.screen h2 {
  margin: 0;
  color: var(--yellow);
  font-size: clamp(26px, 5vw, 42px);
  letter-spacing: 0.025em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #9f258d, 0 0 16px rgba(255, 230, 109, 0.48);
}

.screen p:not(.screen-kicker) {
  max-width: 310px;
  margin: 17px 0 0;
  color: #d0c7e7;
  font-size: 13px;
  line-height: 1.6;
}

.primary-button,
.secondary-button {
  min-width: 200px;
  margin-top: 30px;
  padding: 15px 25px;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid #fff2a9;
  border-radius: 3px;
  box-shadow: 0 6px 0 #d63d9f, 0 10px 0 #4a1d91, 0 0 22px rgba(255, 230, 109, 0.42);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease, filter 100ms ease;
}

.secondary-button {
  color: #fff;
  background: var(--purple);
  border-color: #bca2ff;
  box-shadow: 0 6px 0 #3a137c, 0 0 22px rgba(131, 77, 255, 0.5);
}

.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.13);
  transform: translateY(-2px);
}

.primary-button:active,
.secondary-button:active {
  box-shadow: 0 2px 0 #d63d9f, 0 0 15px rgba(255, 230, 109, 0.35);
  transform: translateY(4px);
}

button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

.final-score {
  margin-top: 7px;
  color: var(--cyan);
  font-size: 46px;
  letter-spacing: 0.05em;
  text-shadow: 0 0 14px var(--cyan);
}

.controls-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 34px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 11px 18px 9px;
  background: rgba(12, 4, 34, 0.78);
  border: 2px solid rgba(131, 77, 255, 0.56);
  border-radius: 7px;
  box-shadow: inset 0 0 16px rgba(131, 77, 255, 0.09), 0 0 18px rgba(131, 77, 255, 0.15);
}

.mobile-controls-hint {
  display: none;
}

.controls-hint > div {
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.keys {
  display: flex;
  gap: 5px;
}

kbd {
  display: grid;
  min-width: 34px;
  height: 31px;
  padding: 0 8px;
  place-items: center;
  color: var(--yellow);
  background: #11072d;
  border: 2px solid var(--pink);
  border-bottom-width: 4px;
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(255, 79, 216, 0.25);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.privacy-note {
  margin: 6px 0 0;
  color: #77708f;
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
}

.privacy-note span {
  margin-right: 7px;
  color: var(--cyan);
  font-size: 8px;
  text-shadow: 0 0 8px var(--cyan);
}

@media (hover: none), (pointer: coarse), (max-width: 620px) {
  .play-stage {
    --move-zone-width: clamp(30px, 9vw, 42px);

    display: grid;
    width: calc(100% + 20px);
    margin-inline: -10px;
    grid-template-columns: var(--move-zone-width) minmax(0, 1fr) var(--move-zone-width);
    gap: 4px;
  }

  .move-zone {
    position: relative;
    display: grid;
    min-width: 0;
    height: 100%;
    min-height: 150px;
    padding: 0;
    place-items: center;
    color: var(--cyan);
    background: transparent;
    border: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: none;
  }

  .move-zone-right {
    color: var(--pink);
  }

  .move-zone::before {
    position: absolute;
    top: 13%;
    bottom: 13%;
    width: 1px;
    content: "";
    opacity: 0.34;
    background: linear-gradient(transparent, currentColor 24%, currentColor 76%, transparent);
    box-shadow: 0 0 10px currentColor;
  }

  .move-zone-left::before {
    right: 2px;
  }

  .move-zone-right::before {
    left: 2px;
  }

  .move-zone::after {
    position: absolute;
    width: 28px;
    height: 74px;
    content: "";
    opacity: 0;
    border: 1px solid currentColor;
    border-radius: 999px;
    transform: scale(0.55);
  }

  .move-zone-symbol {
    position: relative;
    z-index: 1;
    display: grid;
    width: 27px;
    height: 54px;
    place-items: center;
    color: currentColor;
    background: rgba(7, 2, 24, 0.72);
    border: 1px solid currentColor;
    border-radius: 999px;
    box-shadow: 0 0 10px currentColor;
    font-size: 12px;
    animation: move-zone-breathe 1.8s ease-in-out infinite;
    transition: color 120ms ease, background 120ms ease, transform 120ms ease;
  }

  .move-zone.is-pressed::after {
    animation: move-zone-ripple 340ms ease-out;
  }

  .move-zone-left.is-active .move-zone-symbol {
    color: #fff;
    background: rgba(80, 244, 255, 0.22);
    animation: none;
    transform: translateX(-4px) scale(1.08);
  }

  .move-zone-right.is-active .move-zone-symbol {
    color: #fff;
    background: rgba(255, 79, 216, 0.22);
    animation: none;
    transform: translateX(4px) scale(1.08);
  }

  .desktop-controls-hint {
    display: none;
  }

  .mobile-controls-hint {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 7px;
    margin-top: 8px;
    padding: 7px;
    color: var(--muted);
    background: rgba(12, 4, 34, 0.78);
    border: 2px solid rgba(131, 77, 255, 0.56);
    border-radius: 7px;
    box-shadow: inset 0 0 16px rgba(131, 77, 255, 0.09), 0 0 18px rgba(131, 77, 255, 0.15);
  }

  .mobile-controls-hint > div {
    display: flex;
    gap: 7px;
    min-width: 0;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.055em;
    line-height: 1.35;
    text-align: center;
    text-transform: uppercase;
  }

  .mobile-controls-hint b {
    color: var(--yellow);
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .touch-symbol {
    display: grid;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    place-items: center;
    color: var(--cyan);
    border: 1px solid currentColor;
    box-shadow: 0 0 8px rgba(80, 244, 255, 0.3);
    font-size: 10px;
  }

  .touch-symbol-fire {
    color: var(--pink);
    box-shadow: 0 0 8px rgba(255, 79, 216, 0.35);
  }

  .game-card {
    width: min(
      640px,
      max(210px, calc((80dvh - 190px) * 9 / 11 + 22px)),
      calc(100vw - var(--move-zone-width) - var(--move-zone-width) - 8px)
    );
    margin: auto 0;
  }
}

@media (max-width: 620px) {
  .page-shell {
    padding: 0 10px;
  }

  .arcade-header {
    padding: 0;
  }

  .arcade-header::before,
  .arcade-header::after {
    display: none;
  }

  h1 {
    font-size: clamp(38px, min(15.5vw, 8.5dvh), 72px);
    text-shadow: 2px 2px 0 #ff8b36, 4px 4px 0 #e528a8, 6px 6px 0 #652bd6;
  }

  h1 span:last-child {
    text-shadow: 2px 2px 0 #2189d8, 4px 4px 0 #6131c8, 6px 6px 0 #351178;
  }

  .game-card {
    padding: 11px;
    border-width: 2px;
    border-radius: 19px 19px 11px 11px;
  }

  .game-status {
    min-height: 68px;
    margin-bottom: 9px;
    padding: 12px 6px 4px;
  }

  .game-status > div {
    padding-left: 10px;
  }

  .game-status > div:first-child {
    padding-left: 4px;
  }

  .game-status span {
    font-size: 8px;
    letter-spacing: 0.13em;
  }

  .game-status strong {
    font-size: clamp(15px, 4.7vw, 20px);
  }

  .game-status .health {
    font-size: 11px;
  }

  .canvas-wrap {
    border-width: 3px;
  }

  .controls-hint {
    gap: 15px 20px;
    margin-top: 8px;
    padding: 8px 10px 6px;
  }

  .mobile-controls-hint {
    margin-top: 7px;
  }

  .controls-hint > div {
    gap: 8px;
    font-size: 9px;
  }

  kbd {
    min-width: 29px;
    height: 28px;
    padding: 0 6px;
    font-size: 9px;
  }

  .privacy-note {
    margin-top: 4px;
    font-size: 8px;
  }
}

@media (max-height: 700px) {
  .privacy-note {
    display: none;
  }

  .controls-hint {
    margin-top: 6px;
    padding-top: 7px;
    padding-bottom: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes move-zone-breathe {
  0%,
  100% {
    opacity: 0.58;
    transform: scale(0.94);
  }

  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes move-zone-ripple {
  0% {
    opacity: 0.7;
    transform: scale(0.55);
  }

  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}
