:root {
  color-scheme: dark;
  --case: #22252b;
  --case-light: #343943;
  --screen: #9bbc0f;
  --screen-dark: #306230;
  --ink: #0f380f;
  --accent: #f6c15a;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Courier New", monospace;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(246, 193, 90, 0.25), transparent 32rem),
    linear-gradient(135deg, #17191f, #08090c 70%);
}

button {
  font: inherit;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.phone {
  width: min(100%, 28rem);
  padding: 1.25rem;
  border-radius: 2.25rem;
  background: linear-gradient(145deg, var(--case-light), var(--case));
  box-shadow: 0 1.5rem 4rem var(--shadow), inset 0 0.25rem 0 rgba(255, 255, 255, 0.08);
}

.speaker {
  width: 7rem;
  height: 0.55rem;
  margin: 0 auto 1rem;
  border-radius: 999px;
  background: #111318;
  box-shadow: inset 0 0.12rem 0.25rem #000;
}

.screen {
  position: relative;
  overflow: hidden;
  min-height: 31rem;
  border: 0.75rem solid #15171c;
  border-radius: 1rem;
  background: var(--screen);
  box-shadow: inset 0 0 2.25rem rgba(15, 56, 15, 0.3);
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.14;
  background: repeating-linear-gradient(0deg, transparent 0 0.22rem, var(--ink) 0.25rem 0.32rem);
}

.panel {
  display: none;
  position: relative;
  z-index: 2;
  min-height: 31rem;
  padding: 1.25rem;
}

.panel-active {
  display: flex;
  flex-direction: column;
}

#menu,
.overlay {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}

.eyebrow,
.hint,
.control-hint,
.hud span,
.result-grid span,
.score-card span {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0.18rem 0.18rem rgba(15, 56, 15, 0.18);
}

h1 {
  font-size: clamp(3rem, 14vw, 5rem);
}

h2 {
  font-size: clamp(2rem, 9vw, 3rem);
}

.hint {
  max-width: 18rem;
  line-height: 1.5;
}

.score-card,
.result-grid > div,
.hud > div {
  border: 0.18rem solid var(--ink);
  background: rgba(15, 56, 15, 0.08);
  box-shadow: 0.25rem 0.25rem 0 rgba(15, 56, 15, 0.2);
}

.score-card {
  display: grid;
  gap: 0.3rem;
  min-width: 12rem;
  padding: 0.8rem;
}

.score-card strong,
.result-grid strong,
.hud strong {
  display: block;
  font-size: 1.6rem;
}

.primary-button {
  margin-top: 0.5rem;
  padding: 0.9rem 2rem;
  border: 0.18rem solid var(--ink);
  color: var(--screen);
  text-transform: uppercase;
  font-weight: 900;
  background: var(--ink);
  box-shadow: 0.3rem 0.3rem 0 rgba(15, 56, 15, 0.25);
}

.primary-button:active,
.dpad:active {
  transform: translate(0.12rem, 0.12rem);
  box-shadow: none;
}

#game {
  gap: 0.75rem;
}

.hud,
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
}

.hud > div,
.result-grid > div {
  padding: 0.6rem;
  text-align: center;
}

#board {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  border: 0.22rem solid var(--ink);
  background: var(--screen);
  image-rendering: pixelated;
}

.control-hint {
  text-align: center;
  line-height: 1.4;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(155, 188, 15, 0.94);
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 4rem);
  grid-template-rows: repeat(3, 4rem);
  justify-content: center;
  margin-top: 1rem;
}

.dpad {
  border: 0;
  border-radius: 0.7rem;
  color: #101217;
  font-size: 1.35rem;
  font-weight: 900;
  background: var(--accent);
  box-shadow: 0 0.35rem 0 #9d6b24;
}

.up { grid-column: 2; grid-row: 1; }
.left { grid-column: 1; grid-row: 2; }
.right { grid-column: 3; grid-row: 2; }
.down { grid-column: 2; grid-row: 3; }

@media (min-width: 760px) {
  .phone {
    width: 31rem;
  }

  .screen,
  .panel {
    min-height: 34rem;
  }
}

@media (max-width: 430px) {
  .shell {
    padding: 0.5rem;
  }

  .phone {
    padding: 0.8rem;
    border-radius: 1.5rem;
  }

  .screen {
    min-height: 28rem;
    border-width: 0.55rem;
  }

  .panel {
    min-height: 28rem;
    padding: 0.85rem;
  }

  .controls {
    grid-template-columns: repeat(3, 3.4rem);
    grid-template-rows: repeat(3, 3.4rem);
  }
}
