@import url('https://fonts.googleapis.com/css2?family=Black+Ops+One&family=Space+Mono:wght@400;700&display=swap');

:root {
  color-scheme: dark;
  --ink: #f5f1d5;
  --hot: #ff365a;
  --cyan: #37f2db;
  --yellow: #ffd85c;
  --void: #050711;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #02030a;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  font-family: "Space Mono", monospace;
  color: var(--ink);
}

button {
  font: inherit;
}

#game-shell {
  position: relative;
  width: min(100vw, 520px);
  height: 100dvh;
  min-height: 420px;
  overflow: hidden;
  isolation: isolate;
  background: var(--void);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.22;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(0, 0, 0, 0.75) 4px
  );
  mix-blend-mode: multiply;
}

#game-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 21;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.85), inset 0 0 12px rgba(55, 242, 219, 0.12);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
}

#hud {
  position: absolute;
  z-index: 5;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: start;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 2px 2px 0 #000;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

#hud.is-visible {
  opacity: 1;
  transform: none;
}

.hud-block {
  display: flex;
  flex-direction: column;
  font-size: clamp(15px, 4vw, 21px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.hud-center {
  text-align: center;
  align-items: center;
  color: var(--yellow);
}

.hud-right {
  align-items: flex-end;
}

.hud-label {
  margin-bottom: 4px;
  color: var(--cyan);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.icon-button {
  position: absolute;
  z-index: 31;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 2px solid rgba(245, 241, 213, 0.5);
  border-radius: 0;
  color: var(--ink);
  background: rgba(5, 7, 17, 0.72);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.icon-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}

.screen {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  visibility: hidden;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: max(56px, calc(env(safe-area-inset-top) + 30px)) 24px max(32px, calc(env(safe-area-inset-bottom) + 22px));
  opacity: 0;
  background: linear-gradient(to bottom, rgba(5, 7, 17, 0.28), rgba(5, 7, 17, 0.62));
  transition: opacity 180ms ease, visibility 180ms;
}

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

.title-lockup {
  text-align: center;
  animation: float-title 2.4s steps(4, end) infinite;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 7px;
  color: #080b18;
  background: var(--cyan);
  font-size: clamp(9px, 2.7vw, 12px);
  font-weight: 700;
  letter-spacing: 0.22em;
}

.eyebrow.danger {
  background: var(--hot);
}

h1,
h2 {
  margin: 0;
  font-family: "Black Ops One", Impact, sans-serif;
  font-weight: 400;
  line-height: 0.78;
  text-align: center;
  text-shadow: 5px 5px 0 #17182d, 8px 8px 0 rgba(0, 0, 0, 0.65);
}

h1 {
  font-size: clamp(58px, 17vw, 92px);
  transform: skewY(-3deg);
}

h1 span {
  display: block;
}

h1 span:first-child {
  color: var(--ink);
}

h1 span:last-child {
  color: var(--hot);
}

.tagline {
  margin: 19px 0 0;
  color: var(--yellow);
  font-size: clamp(11px, 3vw, 14px);
  font-weight: 700;
  letter-spacing: 0.2em;
}

.how-to {
  padding: 13px 20px 15px;
  border: 2px solid rgba(55, 242, 219, 0.4);
  text-align: center;
  background: rgba(5, 7, 17, 0.68);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}

.how-to p {
  margin: 3px 0 0;
  font-size: 11px;
}

.how-to p:last-child {
  opacity: 0.65;
}

.gesture {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 32px;
  color: var(--cyan);
}

.finger {
  display: inline-block;
  color: var(--ink);
  font-size: 21px;
  animation: swipe 1.35s steps(8, end) infinite;
}

.arrow {
  font-size: 31px;
  line-height: 1;
}

.arcade-button {
  min-width: min(78vw, 320px);
  min-height: 58px;
  padding: 12px 20px;
  border: 3px solid #070914;
  outline: 3px solid var(--ink);
  color: #090b17;
  background: var(--yellow);
  box-shadow: 7px 7px 0 var(--hot);
  font-size: clamp(15px, 4vw, 19px);
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  animation: button-pulse 1.2s steps(2, end) infinite;
}

.arcade-button:active {
  transform: translate(5px, 5px);
  box-shadow: 2px 2px 0 var(--hot);
}

.arcade-button:focus-visible,
.icon-button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
}

.fine-print {
  margin: 0;
  font-size: 8px;
  letter-spacing: 0.15em;
  opacity: 0.45;
}

#game-over {
  justify-content: center;
  background: rgba(5, 7, 17, 0.74);
}

.game-over-card {
  width: min(100%, 380px);
  padding: 28px 22px 34px;
  border: 3px solid var(--ink);
  text-align: center;
  background: rgba(8, 11, 24, 0.93);
  box-shadow: 10px 10px 0 var(--hot);
}

h2 {
  margin: 8px 0 28px;
  color: var(--hot);
  font-size: clamp(45px, 13vw, 70px);
  line-height: 0.95;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
}

.result-grid div:first-child {
  border-right: 1px solid rgba(245, 241, 213, 0.25);
}

.result-grid span,
.result-grid strong {
  display: block;
}

.result-grid span {
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.result-grid strong {
  font-size: clamp(22px, 7vw, 34px);
}

.rank {
  margin: 0 0 28px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 700;
}

#rotate-hint {
  display: none;
  position: absolute;
  z-index: 50;
  inset: 0;
  place-items: center;
  padding: 30px;
  color: var(--yellow);
  background: #050711;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
}

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

@keyframes swipe {
  0%, 100% { transform: translateX(-21px); }
  50% { transform: translateX(21px); }
}

@keyframes float-title {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@keyframes button-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

@media (orientation: landscape) and (max-height: 520px) {
  #rotate-hint {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
