:root {
  --ink: #111111;
  --paper: #f3efe4;
  --white: #fffdf6;
  --accent: #ffd84a;
  --accent-soft: #68c9f5;
  --display: "Avenir Next Condensed", "Arial Narrow", "Arial Black", sans-serif;
  --body: "Avenir Next", "Trebuchet MS", sans-serif;
  --mono: "Courier New", monospace;
  --side-copy: "PLAY / LOSE / AGAIN";
  --stage-label: "YNOT ARCADE";
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  color: var(--ink);
  font-family: var(--body);
  background: var(--paper);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 64px;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: clamp(78px, 12vw, 176px);
  border-left: 4px solid var(--ink);
  background: var(--accent-soft);
  pointer-events: none;
}

body::after {
  content: var(--side-copy);
  position: fixed;
  right: clamp(20px, 4vw, 58px);
  bottom: 44px;
  z-index: 0;
  width: 1em;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1.5;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  width: min(100%, 1460px);
  margin: 0 auto;
  padding: clamp(52px, 6vw, 92px) clamp(28px, 7vw, 112px) clamp(72px, 8vw, 120px)
    clamp(20px, 4vw, 60px);
  display: grid;
  grid-template-columns: minmax(260px, 350px) minmax(0, 1fr);
  gap: clamp(38px, 6vw, 88px);
  align-items: start;
}

.hero-panel {
  position: sticky;
  top: 112px;
  padding: clamp(24px, 3vw, 38px);
  border: 4px solid var(--ink);
  background: var(--accent);
  box-shadow: 12px 12px 0 var(--ink);
}

.game-stamp {
  width: fit-content;
  margin-bottom: 32px;
  display: inline-flex;
  align-items: stretch;
  border: 3px solid var(--ink);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.game-stamp span,
.game-stamp strong {
  padding: 8px 9px 6px;
}

.game-stamp strong {
  border-left: 3px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
}

.hero-panel h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(4rem, 7vw, 6.8rem);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.72;
  text-transform: uppercase;
}

.hero-panel h1 span {
  display: block;
}

.subtitle {
  margin: 34px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 1.5vw, 1.35rem);
  line-height: 1.48;
}

.game-callout {
  margin: 32px -12px -12px 12px;
  padding: 16px 18px;
  border: 3px solid var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.45;
  text-transform: uppercase;
  background: var(--ink);
  transform: rotate(1.5deg);
}

.game-stage {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 4px solid var(--ink);
  background: var(--white);
  box-shadow: 14px 14px 0 var(--ink);
}

.game-stage::before {
  content: var(--stage-label);
  position: absolute;
  top: -22px;
  right: 24px;
  z-index: 2;
  padding: 8px 10px 6px;
  border: 3px solid var(--ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  background: var(--accent);
  transform: rotate(2deg);
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(92px, 0.42fr) minmax(190px, 1fr) minmax(92px, 0.42fr);
  margin-bottom: 14px;
  border: 3px solid var(--ink);
}

.stat-card,
.marquee {
  min-height: 70px;
  display: grid;
  place-content: center;
  text-align: center;
}

.stat-card {
  padding: 9px 14px;
  background: var(--accent-soft);
}

.stat-card:first-child {
  border-right: 3px solid var(--ink);
}

.stat-card:last-child {
  border-left: 3px solid var(--ink);
}

.stat-card span {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 0.9;
}

.marquee {
  padding: 12px 18px;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.35;
  text-transform: uppercase;
  background: var(--ink);
}

.screen-frame {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--ink);
  background: var(--ink);
  box-shadow: 7px 7px 0 var(--accent-soft);
}

#game {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: manipulation;
}

.control-bar {
  margin-top: 21px;
  display: grid;
  grid-template-columns: auto repeat(4, minmax(0, 1fr));
  border: 3px solid var(--ink);
  background: var(--paper);
}

.controls-label {
  min-height: 56px;
  padding: 10px 14px;
  display: grid;
  place-items: center;
  border-right: 3px solid var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  background: var(--ink);
}

.control-chip {
  min-width: 0;
  min-height: 56px;
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border-right: 3px solid var(--ink);
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.control-chip:last-child {
  border-right: 0;
}

kbd {
  min-width: 48px;
  padding: 6px 7px 4px;
  border: 2px solid var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  background: var(--ink);
  box-shadow: 3px 3px 0 var(--accent-soft);
}

@media (max-width: 1120px) {
  body::before {
    width: 72px;
  }

  body::after {
    display: none;
  }

  .page {
    width: min(100%, 920px);
    grid-template-columns: 1fr;
    padding-right: 94px;
  }

  .hero-panel {
    position: relative;
    top: auto;
    max-width: 760px;
  }

  .hero-panel h1 span {
    display: inline;
  }

  .hero-panel h1 span + span::before {
    content: " ";
  }

  .control-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .controls-label {
    grid-column: 1 / -1;
    min-height: 38px;
    border-right: 0;
    border-bottom: 3px solid var(--ink);
  }
}

@media (max-width: 680px) {
  body::before {
    display: none;
  }

  .page {
    padding: 40px 14px 72px;
  }

  .hero-panel {
    padding: 22px;
    box-shadow: 8px 8px 0 var(--ink);
  }

  .game-stamp {
    margin-bottom: 24px;
  }

  .hero-panel h1 {
    font-size: clamp(3.7rem, 19vw, 6rem);
  }

  .hero-panel h1 span {
    display: block;
  }

  .hero-panel h1 span + span::before {
    content: none;
  }

  .subtitle {
    margin-top: 26px;
  }

  .game-stage {
    padding: 9px;
    box-shadow: 8px 8px 0 var(--ink);
  }

  .game-stage::before {
    right: 10px;
  }

  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }

  .marquee {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 3px solid var(--ink);
  }

  .stat-card:last-child {
    border-left: 0;
  }

  .screen-frame {
    box-shadow: 5px 5px 0 var(--accent-soft);
  }

  .control-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
  }

  .controls-label {
    grid-column: 1 / -1;
  }

  .control-chip {
    border-bottom: 3px solid var(--ink);
  }

  .control-chip:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .control-chip:nth-child(odd) {
    border-right: 0;
  }
}

@media (max-width: 420px) {
  .control-chip {
    gap: 6px;
    padding-inline: 6px;
    font-size: 0.68rem;
  }

  kbd {
    min-width: 42px;
    font-size: 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-stamp,
  .game-callout,
  .game-stage::before {
    transform: none;
  }
}
