:root {
  --ink: #151713;
  --paper: #e9e5d8;
  --panel: #d8d3c3;
  --acid: #d8ff3e;
  --orange: #f05d3a;
  --muted: #6b6d63;
  --line: rgba(21, 23, 19, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Courier New", Courier, monospace;
  line-height: 1.55;
}

button, a { color: inherit; }
button { font: inherit; }

.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;
}

.site-header,
main,
footer {
  width: min(1240px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-icon { display: grid; grid-template-columns: repeat(2, 7px); gap: 2px; transform: rotate(45deg); }
.brand-icon i { display: block; width: 7px; height: 7px; background: var(--ink); }
.header-meta { display: flex; align-items: center; gap: 9px; }
.status-dot { width: 7px; height: 7px; background: #5ebc49; border-radius: 50%; box-shadow: 0 0 0 4px rgba(94, 188, 73, 0.13); }

.intro {
  min-height: 430px;
  padding: 80px 0 60px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  align-items: end;
  gap: 60px;
}

.kicker { margin: 0 0 22px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.kicker::before { content: ""; display: inline-block; width: 28px; height: 2px; margin: 0 10px 3px 0; background: var(--orange); }

h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Arial, Helvetica, sans-serif; line-height: 0.86; letter-spacing: -0.07em; }
h1 { margin: 0; font-size: clamp(5rem, 14vw, 11.5rem); font-weight: 900; text-transform: uppercase; }
h1 em { color: transparent; -webkit-text-stroke: 2px var(--ink); font-style: normal; }
.lede { max-width: 34ch; margin: 0 0 12px; color: var(--muted); font-family: Arial, Helvetica, sans-serif; font-size: 1.12rem; }

.game-shell { margin-bottom: 120px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); box-shadow: 12px 12px 0 var(--orange); }

.scorebar {
  min-height: 96px;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(233, 229, 216, 0.25);
}

.score-item { min-width: 150px; padding: 18px 25px; display: flex; flex-direction: column; border-right: 1px solid rgba(233, 229, 216, 0.25); }
.score-item span { color: #999c90; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; }
.score-item strong { color: var(--acid); font-size: 2rem; font-weight: 400; line-height: 1.2; }

.sound-button { margin-left: auto; padding: 0 28px; color: var(--paper); background: transparent; border: 0; cursor: pointer; font-size: 0.72rem; text-transform: uppercase; }
.sound-button:hover { color: var(--acid); }
.sound-waves { color: var(--acid); margin-right: 8px; letter-spacing: -0.2em; }

.game-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(250px, 1fr); }
.board-wrap { position: relative; min-width: 0; aspect-ratio: 1; background: #20231d; overflow: hidden; }
#game-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

.board-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(21, 23, 19, 0.68);
  backdrop-filter: blur(3px);
  transition: opacity 180ms ease;
}

.board-overlay.hidden { opacity: 0; pointer-events: none; }
.overlay-label { margin-bottom: 14px; color: var(--acid); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; }
.overlay-title { margin-bottom: 28px; font-family: Arial, Helvetica, sans-serif; font-size: clamp(3.2rem, 9vw, 7.3rem); font-weight: 900; line-height: 0.78; letter-spacing: -0.08em; text-transform: uppercase; }

.start-button { min-width: 220px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; color: var(--ink); background: var(--acid); border: 0; cursor: pointer; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.start-button:hover { background: var(--paper); }
kbd { min-width: 28px; padding: 4px 7px; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 2px; font-family: inherit; font-size: 0.68rem; text-align: center; }

.game-aside { border-left: 1px solid rgba(233, 229, 216, 0.25); }
.aside-block { padding: 32px 28px; border-bottom: 1px solid rgba(233, 229, 216, 0.25); }
.aside-number { margin-bottom: 30px; color: var(--orange); font-size: 0.7rem; }
.aside-block h3 { margin-bottom: 12px; font-family: Arial, Helvetica, sans-serif; font-size: 1.35rem; text-transform: uppercase; }
.aside-block > p:not(.aside-number) { color: #9c9e94; font-size: 0.76rem; }
.aside-block.compact { display: flex; align-items: center; justify-content: space-between; color: #9c9e94; font-size: 0.68rem; text-transform: uppercase; }
.aside-block.compact strong { color: var(--acid); font-weight: 400; }

.key-grid { width: 100px; margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.key-grid kbd { aspect-ratio: 1; display: grid; place-items: center; color: var(--paper); }

.mobile-controls { display: none; }

.about {
  padding: 0 0 120px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 70px;
  border-bottom: 1px solid var(--line);
}
.about h2 { max-width: 720px; margin-bottom: 30px; font-size: clamp(3.2rem, 7vw, 6.6rem); }
.about div p { max-width: 650px; color: var(--muted); font-family: Arial, Helvetica, sans-serif; font-size: 1.1rem; }

footer { min-height: 110px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; }

.error-page { min-height: 100vh; display: grid; place-items: center; background: var(--ink); color: var(--paper); }
.error-page main { padding: 64px 0; }
.error-page h1 { margin-bottom: 32px; color: var(--paper); font-size: clamp(4rem, 12vw, 10rem); }
.error-page h1 em { -webkit-text-stroke-color: var(--paper); }
.error-page .return-link { display: inline-block; padding: 14px 18px; color: var(--ink); background: var(--acid); font-weight: 700; text-decoration: none; text-transform: uppercase; }

@media (max-width: 860px) {
  .site-header, main, footer { width: min(100% - 28px, 1240px); }
  .intro { min-height: 380px; grid-template-columns: 1fr; gap: 38px; }
  .game-layout { display: block; }
  .game-aside { display: none; }
  .score-item { min-width: 108px; padding-inline: 16px; }
  .sound-button { padding-inline: 16px; }
  .game-shell { box-shadow: 7px 7px 0 var(--orange); }
  .mobile-controls { padding: 18px; display: grid; grid-template-columns: repeat(3, 58px); justify-content: center; gap: 7px; border-top: 1px solid rgba(233, 229, 216, 0.25); }
  .mobile-controls button { width: 58px; height: 48px; color: var(--paper); background: transparent; border: 1px solid rgba(233, 229, 216, 0.45); border-radius: 0; touch-action: manipulation; }
  .mobile-controls button:active { color: var(--ink); background: var(--acid); }
  .about { grid-template-columns: 1fr; gap: 25px; }
}

@media (max-width: 520px) {
  .site-header { min-height: 68px; }
  .header-meta { font-size: 0; }
  .intro { min-height: 330px; padding-top: 60px; }
  h1 { font-size: clamp(4.2rem, 24vw, 7rem); }
  .scorebar { min-height: 78px; }
  .score-item { min-width: 87px; padding: 14px 12px; }
  .score-item strong { font-size: 1.5rem; }
  .sound-button { font-size: 0; }
  .sound-waves { font-size: 0.72rem; }
  .overlay-title { font-size: 3.4rem; }
  .start-button { min-width: 190px; }
  footer span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .board-overlay { transition: none; }
}
