:root {
  color-scheme: light;
  --ink: #17241f;
  --muted: #58645f;
  --paper: #fffaf0;
  --paper-bright: #fffdf8;
  --lcd: #d3dca5;
  --lcd-deep: #c5cf91;
  --teal: #149b9b;
  --teal-dark: #087777;
  --coral: #ff684e;
  --line: rgba(23, 36, 31, 0.13);
  --shadow: 0 24px 70px rgba(39, 62, 52, 0.14);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 8%, rgba(255, 104, 78, 0.1), transparent 27rem),
    linear-gradient(145deg, var(--paper), #eff8ef);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

a {
  color: var(--teal-dark);
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: -0.045em;
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 2.7vw, 36px);
}

nav a {
  position: relative;
  padding: 8px 0;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

nav a::after {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 2px;
  background: var(--teal);
  content: "";
  transform: scaleX(0);
  transition: transform 150ms ease;
}

nav a:hover::after,
nav a:focus-visible::after,
nav a.active::after {
  transform: scaleX(1);
}

.game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, 474px);
  gap: clamp(42px, 7vw, 104px);
  align-items: center;
  min-height: calc(100svh - 120px);
  padding: 38px 0 46px;
}

.game-intro {
  align-self: center;
}

.game-intro h1 {
  max-width: 660px;
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(3.1rem, 6vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
  white-space: nowrap;
}

.lede {
  max-width: 510px;
  margin: 28px 0 0;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.7;
}

.intro-actions {
  display: flex;
  gap: 12px;
  margin-top: 34px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-width: 150px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  background: var(--teal);
  box-shadow: 0 12px 24px rgba(20, 155, 155, 0.22);
  color: white;
}

.secondary-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(39, 62, 52, 0.07);
}

.primary-button svg,
.secondary-button svg {
  width: 19px;
  height: 19px;
  overflow: visible;
}

.primary-button svg {
  fill: currentColor;
}

.secondary-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(0);
}

.keyboard-copy {
  display: grid;
  gap: 11px;
  margin: 26px 0 0;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.69rem;
  font-weight: 700;
  line-height: 1.8;
  text-transform: uppercase;
}

.keyboard-copy span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

kbd {
  display: inline-flex;
  min-width: 25px;
  height: 25px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid rgba(23, 36, 31, 0.34);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 0 rgba(23, 36, 31, 0.12);
  color: var(--ink);
  font: inherit;
}

.game-console {
  width: min(100%, 474px);
  justify-self: center;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.console-brand {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.console-brand strong {
  font-size: clamp(1.04rem, 2vw, 1.28rem);
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.console-brand span {
  color: #586044;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.console-scores {
  display: flex;
  gap: 7px;
  align-items: center;
}

.score-box,
.icon-button {
  width: 54px;
  height: 48px;
  border: 1px solid rgba(23, 36, 31, 0.08);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 6px 15px rgba(39, 62, 52, 0.1);
}

.score-box {
  display: grid;
  place-content: center;
  text-align: center;
}

.score-box span {
  color: var(--muted);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
}

.score-box strong {
  margin-top: 3px;
  font-size: 1.03rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.icon-button {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 19px rgba(39, 62, 52, 0.14);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.icon-button .play-icon {
  fill: currentColor;
  stroke: none;
}

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 24;
  overflow: hidden;
  border: 4px solid #c7d195;
  border-radius: 29px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), transparent 33%),
    linear-gradient(165deg, var(--lcd), var(--lcd-deep));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.42),
    inset 0 -18px 40px rgba(73, 86, 39, 0.07),
    var(--shadow);
}

.board::before {
  position: absolute;
  z-index: 2;
  inset: 7px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 21px;
  content: "";
  pointer-events: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

#gameCanvas:focus-visible {
  box-shadow: inset 0 0 0 4px rgba(8, 119, 119, 0.7);
}

.status-panel {
  position: absolute;
  z-index: 3;
  right: 12%;
  bottom: 6%;
  left: 12%;
  display: grid;
  justify-items: center;
  padding: 16px 18px 14px;
  border: 1px solid rgba(23, 36, 31, 0.08);
  border-radius: 17px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 13px 28px rgba(39, 62, 52, 0.18);
  text-align: center;
  backdrop-filter: blur(8px);
}

.status-panel[hidden] {
  display: none;
}

.status-panel strong {
  font-size: 1.22rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(0.56rem, 1.4vw, 0.7rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.status-panel button {
  margin-top: 11px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.board-hint {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px 0;
  color: #59634d;
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-hint strong {
  color: var(--teal-dark);
}

.touch-controls {
  display: none;
}

.browser-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(52px, 8vw, 90px) 0;
  border-top: 1px solid var(--line);
}

.browser-note h2 {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(2rem, 4vw, 3.8rem);
  letter-spacing: -0.055em;
}

.browser-note p {
  max-width: 660px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.browser-note img {
  width: clamp(86px, 12vw, 144px);
  border-radius: 25%;
  box-shadow: 0 16px 36px rgba(23, 36, 31, 0.17);
}

.content {
  padding: 52px 0 90px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.content h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.content-card {
  max-width: 820px;
  margin-top: 36px;
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 36px rgba(39, 62, 52, 0.06);
  backdrop-filter: blur(16px);
}

.content-card h2 {
  margin-top: 2.2rem;
  font-size: 1.3rem;
}

.content-card h2:first-child {
  margin-top: 0;
}

.content-card p,
.content-card li {
  color: var(--muted);
  line-height: 1.7;
}

.button {
  display: inline-flex;
  align-items: center;
  margin-top: 24px;
  padding: 13px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  text-decoration: none;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 28px, 540px);
  }

  header {
    min-height: 66px;
  }

  nav {
    gap: 13px;
  }

  nav a {
    font-size: 0.72rem;
  }

  nav a:last-child {
    display: none;
  }

  .game-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 40px 0 58px;
  }

  .game-intro {
    text-align: center;
  }

  .game-intro h1 {
    font-size: clamp(3rem, 14vw, 4.6rem);
    white-space: normal;
  }

  .lede {
    margin-right: auto;
    margin-left: auto;
  }

  .intro-actions {
    flex-direction: row;
    justify-content: center;
  }

  .keyboard-copy {
    display: none;
  }

  .game-console {
    width: min(100%, 430px);
  }

  .touch-controls {
    display: grid;
    width: 188px;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(2, 52px);
    gap: 6px;
    justify-content: center;
    margin: 18px auto 0;
  }

  .touch-controls button {
    display: grid;
    place-items: center;
    border: 1px solid rgba(23, 36, 31, 0.13);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 5px 12px rgba(39, 62, 52, 0.1);
    color: var(--ink);
  }

  .touch-controls button[data-direction="up"] {
    grid-column: 2;
  }

  .touch-controls button[data-direction="left"] {
    grid-column: 1;
    grid-row: 2;
  }

  .touch-controls button[data-direction="down"] {
    grid-column: 2;
    grid-row: 2;
  }

  .touch-controls button[data-direction="right"] {
    grid-column: 3;
    grid-row: 2;
  }

  .touch-controls svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
  }

  .browser-note {
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .brand {
    font-size: 1rem;
  }

  nav {
    gap: 10px;
  }

  .game-intro h1 {
    font-size: clamp(2.75rem, 15vw, 4rem);
  }

  .intro-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-button,
  .secondary-button {
    min-width: 0;
    padding: 0 14px;
  }

  .console-brand {
    display: none;
  }

  .console-header {
    justify-content: center;
  }

  .score-box,
  .icon-button {
    width: 59px;
  }

  .browser-note img {
    display: none;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
