:root {
  --navy-950: #030627;
  --navy-900: #060c45;
  --navy-800: #0a1670;
  --navy-700: #0c2aa2;
  --line: rgba(174, 186, 255, 0.16);
  --text: #f4f6ff;
  --muted: #aeb6e8;
  --blue: #22a6ff;
  --sun: #ffb524;
  --leaf: #34d27b;
  --grape: #a24bff;
  --radius-lg: 28px;
  --radius-md: 18px;
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: radial-gradient(1200px 700px at 80% -10%, rgba(12, 42, 162, 0.55), transparent 60%), var(--navy-950);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--sun);
  text-underline-offset: 3px;
}

a:hover {
  color: #ffd27a;
}

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: min(1120px, 100% - 40px);
  margin-inline: auto;
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
}

.menu-toggle {
  display: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(174, 186, 255, 0.06);
  cursor: pointer;
  place-content: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 180ms ease, opacity 180ms ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 720px) {
  .js .menu-toggle {
    display: grid;
  }

  .js .site-nav {
    display: none;
    position: absolute;
    top: calc(100% - 6px);
    left: 0;
    right: 0;
    z-index: 20;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--navy-900);
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
    font-size: 17px;
  }

  .js .site-nav.open {
    display: flex;
  }

  .js .site-nav a {
    padding: 13px 16px;
    border-radius: 14px;
    color: var(--text);
  }

  .js .site-nav a:hover,
  .js .site-nav a[aria-current="page"] {
    background: rgba(34, 166, 255, 0.14);
  }

  .site-header:not(:has(.menu-toggle)) .site-nav,
  html:not(.js) .site-nav {
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
}

.brand img {
  width: 44px;
  height: 44px;
}

.brand:hover {
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 22px;
  font-weight: 700;
  font-size: 15px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 56px;
  padding: 48px 0 88px;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 66px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  max-width: 13ch;
}

.hero .lede {
  color: var(--muted);
  font-size: 19px;
  max-width: 44ch;
  margin: 0 0 32px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px 12px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--navy-900);
  font-weight: 800;
  text-decoration: none;
}

.store-badge[aria-disabled="true"] {
  background: rgba(244, 246, 255, 0.1);
  color: var(--text);
  border: 1px solid var(--line);
  cursor: default;
}

.store-badge svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.store-badge small {
  display: block;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.store-badge span {
  line-height: 1.2;
}

.play-card {
  background: linear-gradient(180deg, var(--navy-700), var(--navy-900) 70%);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 30px 80px -20px rgba(12, 42, 162, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.play-card h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  margin: 0;
}

.play-card .hint {
  color: var(--muted);
  margin: 4px 0 18px;
  font-size: 15px;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 22px;
  background: rgba(3, 6, 39, 0.55);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.board.solved {
  box-shadow: 0 0 0 3px var(--leaf), 0 0 40px rgba(52, 210, 123, 0.45);
}

.cell {
  position: relative;
  border-radius: 14px;
  background: rgba(174, 186, 255, 0.08);
  display: grid;
  place-items: center;
  transition: background-color 120ms ease;
}

.cell.on {
  background: rgba(34, 166, 255, 0.22);
}

.checkpoint {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--navy-900);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(18px, 3.4vw, 26px);
  position: relative;
  z-index: 3;
}

.checkpoint.next {
  box-shadow: 0 0 0 4px var(--sun);
}

.checkpoint.done {
  background: var(--sun);
}

.board svg {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  z-index: 2;
  pointer-events: none;
}

.board polyline {
  fill: none;
  stroke: url(#trail-gradient);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board .head {
  fill: var(--text);
}

.play-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  min-height: 44px;
  font-weight: 700;
}

.play-status button {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
}

.play-status button:hover {
  border-color: var(--muted);
}

.section {
  padding: 72px 0;
  border-top: 1px solid var(--line);
}

.section h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.1;
  margin: 0 0 12px;
}

.section > .wrap > p {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 36px;
}

.games {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

.game {
  border-radius: var(--radius-lg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game.trail {
  background: linear-gradient(135deg, rgba(34, 166, 255, 0.22), rgba(162, 75, 255, 0.18));
  border: 1px solid rgba(34, 166, 255, 0.35);
}

.game.soon {
  border: 1px dashed var(--line);
  color: var(--muted);
  justify-content: center;
}

.game h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 28px;
  margin: 0;
  color: var(--text);
}

.game p {
  margin: 0;
}

.game ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.game li + li {
  margin-top: 4px;
}

.pieces {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.pieces i {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: block;
}

.rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules li {
  border-left: 4px solid var(--rule-color, var(--blue));
  padding-left: 18px;
}

.rules strong {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  margin-bottom: 4px;
}

.rules span {
  color: var(--muted);
}

.faq > * {
  max-width: 760px;
}

.section > .faq > p {
  margin: 0 0 24px;
}

.faq h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  margin: 28px 0 6px;
}

.faq h2 + h3 {
  margin-top: 24px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 48px;
  color: var(--muted);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

.doc {
  max-width: 720px;
  padding: 32px 0 80px;
}

.doc h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.1;
  margin: 0 0 8px;
}

.doc .updated {
  color: var(--muted);
  margin: 0 0 36px;
}

.doc h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  margin: 40px 0 10px;
}

.doc p,
.doc li {
  color: #d6dbf7;
}

.doc ul,
.doc ol {
  padding-left: 22px;
}

.doc li + li {
  margin-top: 6px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 15px;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.doc th {
  color: var(--text);
  font-weight: 800;
}

.doc td {
  color: #d6dbf7;
}

.callout {
  border-radius: var(--radius-md);
  background: rgba(12, 42, 162, 0.35);
  border: 1px solid rgba(34, 166, 255, 0.3);
  padding: 20px 22px;
  margin: 24px 0;
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 8px;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 24px 0 64px;
  }

  .games,
  .rules {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .play-card {
    padding: 20px;
  }

  .doc table,
  .doc thead,
  .doc tbody,
  .doc tr,
  .doc th,
  .doc td {
    display: block;
  }

  .doc thead {
    display: none;
  }

  .doc td {
    border-bottom: 0;
    padding: 4px 0;
  }

  .doc tr {
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
  }

  .doc td:first-child {
    color: var(--text);
    font-weight: 800;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
