@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,600;0,800;1,900&family=DM+Mono:wght@400;500&display=swap");

:root {
  color-scheme: dark;
  font-family: "DM Mono", monospace;
  --ink: #f4f2eb;
  --muted: #969aa4;
  --acid: #d9ff43;
  --orange: #ff5b32;
  --panel: #1b1f28;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 20%, #252c3b 0, transparent 34%),
    linear-gradient(140deg, #171a21, #0e1015 64%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
}

button {
  font: inherit;
}

.game-shell {
  width: min(1040px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: auto;
  padding: 28px clamp(18px, 4vw, 52px) 20px;
}

.hud {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: -30px;
}

.eyebrow,
.status-label {
  margin: 0 0 7px;
  color: var(--acid);
  font-size: 11px;
  letter-spacing: 0.24em;
}

h1,
h2 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-style: italic;
  font-weight: 900;
  line-height: 0.76;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(48px, 8vw, 82px);
}

.hud-stats {
  display: flex;
  align-items: flex-end;
  gap: clamp(18px, 4vw, 34px);
}

.score-card {
  display: grid;
  justify-items: end;
  padding: 10px 0;
}

.score-card span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.22em;
}

.score-card strong {
  color: var(--acid);
  font: italic 900 clamp(42px, 8vw, 76px) / 0.9 "Barlow Condensed", sans-serif;
}

.game-wrap {
  position: relative;
  width: min(540px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #3c414c;
  border-radius: 4px;
  background: #22262e;
  box-shadow: 0 28px 80px #0008;
}

canvas {
  display: block;
  width: 100%;
  height: clamp(420px, 68dvh, 700px);
  touch-action: none;
}

.start-screen,
.game-over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  background: linear-gradient(#0d1118a6, #0d1118e8);
  backdrop-filter: blur(3px);
}

.start-screen h2,
.game-over h2 {
  margin-bottom: 25px;
  font-size: clamp(54px, 12vw, 80px);
}

.start-screen > p:not(.status-label),
.final-copy {
  margin: 0 0 28px;
  color: #c8c9cc;
  font-size: 12px;
}

kbd {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  margin: 0 2px;
  place-items: center;
  border: 1px solid #7a7e87;
  border-radius: 3px;
  background: #282d36;
  box-shadow: 0 2px 0 #090b0f;
}

.start-screen button,
.game-over button {
  min-width: 220px;
  padding: 16px 22px;
  border: 0;
  background: var(--acid);
  color: #11140b;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}

.start-screen .install-button {
  margin-bottom: 12px;
  border: 1px solid #d9ff43;
  background: #11151d;
  color: var(--acid);
}

.start-screen button:hover,
.game-over button:hover {
  filter: brightness(1.12);
}

.start-screen button span,
.game-over button span {
  float: right;
  font-size: 18px;
}

.game-over .status-label {
  color: var(--orange);
}

.final-copy strong {
  margin-left: 8px;
  color: var(--acid);
  font-size: 24px;
}

.hidden {
  display: none;
}

.touch-controls {
  position: absolute;
  inset: auto 14px 15px;
  display: none;
  justify-content: space-between;
  pointer-events: none;
}

.touch-controls button {
  width: 62px;
  height: 62px;
  border: 1px solid #ffffff55;
  border-radius: 50%;
  background: #10131bb8;
  color: white;
  font-size: 25px;
  pointer-events: auto;
  touch-action: manipulation;
}

footer {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(540px, 100%);
  margin: 14px auto 0;
  color: #6e737e;
  font-size: 9px;
  letter-spacing: 0.16em;
}

.rule {
  height: 1px;
  flex: 1;
  background: #343842;
}

@media (pointer: coarse), (max-width: 700px) {
  .game-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 100dvh;
    height: 100dvh;
    padding: 16px 12px 10px;
    overflow: hidden;
  }

  .hud {
    flex: 0 0 auto;
    margin-bottom: 8px;
  }

  h1 {
    font-size: clamp(34px, 11vw, 44px);
    line-height: 0.82;
  }

  .hud-stats {
    gap: 14px;
  }

  .score-card {
    padding: 4px 0;
  }

  .score-card span {
    font-size: 8px;
  }

  .score-card strong {
    font-size: clamp(34px, 12vw, 48px);
  }

  .game-wrap {
    flex: 1 1 auto;
    min-height: 0;
  }

  canvas {
    height: 100%;
  }

  .touch-controls {
    display: flex;
    inset: auto 12px 12px;
  }

  .touch-controls button {
    width: clamp(56px, 16vw, 68px);
    height: clamp(56px, 16vw, 68px);
  }

  footer {
    flex: 0 0 auto;
    margin-top: 10px;
  }
}
