:root {
  --cover: #1a4b78;
  --cover-ink: #e8f0f7;
  --sheet: #f3ecdc;
  --ink: #1c2430;
  --muted: #5d6772;
  --line: #c9d7e6;
  --card: #fffdf8;
  --paper: #f3ecdc;
  --red: #d64550;
  --pen: #1a4b78;
  --shadow: 0 18px 40px rgba(8, 24, 42, 0.28);
  --hand: "Kalam", "Segoe Print", cursive;
  --head: "Rubik", "Segoe UI", sans-serif;
  --sans: "Lato", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--cover);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.14), transparent 26%),
    radial-gradient(circle at 0% 100%, rgba(0, 0, 0, 0.22), transparent 46%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.08rem;
  line-height: 1.5;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--sheet);
  color: var(--ink);
  padding: 0.5rem 0.8rem;
  z-index: 5;
}

.skip:focus { top: 1rem; }

.site-header,
.site-footer,
.wrap {
  width: min(760px, calc(100% - 1.4rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.15rem 0.75rem;
  color: var(--cover-ink);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.85rem;
  letter-spacing: 0;
  color: white;
}

.logo-mark {
  width: 1.9rem;
  height: 1.9rem;
  display: block;
  flex: none;
}

.nav {
  display: flex;
  gap: 1rem;
}

.nav a {
  text-decoration: none;
  color: rgba(232, 240, 247, 0.76);
  font-size: 1rem;
}

.nav a[hreflang] {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.nav a[aria-current="page"],
.nav a:hover { color: white; }

.wrap {
  position: relative;
  background: var(--sheet);
  padding: 1.5rem 1.35rem 2.3rem 1.7rem;
  box-shadow: var(--shadow);
}

.wrap::before {
  content: "";
  position: absolute;
  left: 0.72rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red);
}

.hero h1,
.game-page h1,
.prose h1 {
  font-family: var(--head);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0 0 0.45rem;
}

.hero h1 {
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  max-width: 11ch;
  transform: rotate(-1.1deg);
  transform-origin: left center;
}

.lede {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.12rem;
  margin: 0.8rem 0 1.2rem 0.35rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.card-link {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  grid-template-areas:
    "num title"
    "num desc"
    "num time";
  column-gap: 0.55rem;
  row-gap: 0.15rem;
  align-items: start;
  align-content: start;
  padding: 0.9rem 0.95rem 0.85rem;
  background: var(--card);
  border: 2px solid var(--pen);
  border-radius: 0.7rem;
  box-shadow: none;
  text-decoration: none;
  min-height: 8.5rem;
}

.card-link .num {
  grid-area: num;
  align-self: center;
  margin: 0;
  font-family: var(--hand);
  font-size: 1.85rem;
  line-height: 1;
}

.card-link:nth-child(1) .num { color: #d64550; }
.card-link:nth-child(2) .num { color: #1d6bba; }
.card-link:nth-child(3) .num { color: #2f8f4e; }
.card-link:nth-child(4) .num { color: #7a4ea3; }
.card-link:nth-child(5) .num { color: #d5721a; }
.card-link:nth-child(6) .num { color: #0e7c86; }
.card-link:nth-child(7) .num { color: #9a3e6a; }
.card-link:nth-child(8) .num { color: #b86a12; }
.card-link:nth-child(9) .num { color: #3e6b58; }
.card-link:nth-child(10) .num { color: #5a4a8a; }
.card-link:nth-child(11) .num { color: #b03a2e; }

.card-link h2 {
  grid-area: title;
  font-family: var(--head);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  line-height: 1.1;
}

.card-link p { margin: 0; color: var(--muted); }

.card-link p:not(.num):not(.meta) { grid-area: desc; }

.card-link .meta {
  grid-area: time;
  margin-top: 0.15rem;
  padding: 0;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
}

.card-link:hover { background: rgba(255, 226, 92, 0.55); }
.card-link:nth-child(2):hover { background: rgba(255, 176, 196, 0.45); }
.card-link:nth-child(3):hover { background: rgba(176, 224, 176, 0.5); }
.card-link:nth-child(4):hover { background: rgba(198, 186, 232, 0.5); }
.card-link:nth-child(5):hover { background: rgba(255, 196, 140, 0.5); }
.card-link:nth-child(6):hover { background: rgba(170, 220, 220, 0.55); }
.card-link:nth-child(7):hover { background: rgba(244, 190, 210, 0.55); }
.card-link:nth-child(8):hover { background: rgba(240, 193, 77, 0.55); }
.card-link:nth-child(9):hover { background: rgba(150, 200, 170, 0.55); }
.card-link:nth-child(10):hover { background: rgba(198, 186, 232, 0.55); }
.card-link:nth-child(11):hover { background: rgba(240, 160, 150, 0.55); }

.crumb {
  margin: 0 0 0.7rem 0.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.crumb a { color: var(--pen); }

.game-page h1 { font-size: clamp(2.6rem, 7vw, 4.2rem); }

.stage {
  background: var(--card);
  border: 2px solid var(--pen);
  padding: 0.9rem;
  margin: 0.4rem 0 1.4rem;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.2rem;
  margin-bottom: 0.85rem;
}

.hud p { margin: 0; color: var(--muted); }

.hud strong {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hud .btn { margin-left: auto; }

.btn,
.pad-btn,
.mini,
.arrow,
.card {
  font: inherit;
  cursor: pointer;
}

.btn,
.mini {
  border: 2px solid var(--pen);
  background: var(--pen);
  color: white;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
}

.btn.secondary,
.mini.secondary {
  background: transparent;
  color: var(--pen);
}

.btn:hover,
.mini:hover { filter: brightness(1.12); }

.btn:focus-visible,
.mini:focus-visible,
.pad-btn:focus-visible,
.arrow:focus-visible,
.card:focus-visible,
.nav a:focus-visible,
.card-link:focus-visible,
.logo:focus-visible,
.sudoku button:focus-visible,
.sudoku-pad button:focus-visible,
.mine button:focus-visible {
  outline: 3px solid #ffe15a;
  outline-offset: 3px;
}

.status {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.pads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  max-width: 440px;
}

.pad-btn {
  aspect-ratio: 1.45;
  border: 3px solid var(--ink);
  border-radius: 1.1rem;
  color: #1c1712;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-weight: 700;
}

.pad-btn span { font-size: 1.6rem; line-height: 1; }

.pad-btn small { font-weight: 700; font-size: 0.85rem; }

.pad-btn.is-lit {
  transform: translateY(1px) scale(0.985);
  filter: brightness(1.18);
}

.pad-red { background: #e15a49; }
.pad-blue { background: #6ea2e4; }
.pad-yellow { background: #f0c14d; }
.pad-green { background: #7dbe86; }

.pairs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  max-width: 440px;
}

.card {
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--pen);
  border-radius: 0.45rem;
  background: transparent;
  perspective: 600px;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.28s ease;
}

.card.is-up .card-inner,
.card.is-matched .card-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  border-radius: 0.3rem;
}

.face-back {
  background: var(--pen);
  color: white;
  font-family: var(--hand);
  font-size: 1.3rem;
}

.face-front { background: var(--card); transform: rotateY(180deg); }

.card.is-matched { opacity: 0.55; }

.shape { width: 42%; height: 42%; }

.track {
  position: relative;
  height: 4.2rem;
  background: #efe4d4;
  border: 2px solid var(--pen);
  border-radius: 999px;
  overflow: hidden;
  max-width: 560px;
}

.zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #9dceab;
}

.marker {
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 0.55rem;
  margin-left: -0.27rem;
  background: var(--ink);
  border-radius: 2px;
}

.lives { letter-spacing: 0.12em; color: var(--red); }

.snake-wrap { max-width: 420px; }

.snake-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #241c16;
  border-radius: 0.4rem;
}

.ark-wrap {
  max-width: 320px;
  margin-inline: auto;
  touch-action: none;
}

.ark-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #241c16;
  border-radius: 0.4rem;
}

.ark-pad {
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  gap: 0.4rem;
  align-items: center;
  max-width: 320px;
  margin: 0.8rem auto 0;
}

.ark-pad .drop { width: 100%; }

.arrows {
  display: grid;
  grid-template-columns: repeat(3, 3rem);
  grid-template-areas: ". up ." "left down right";
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.8rem;
}

.arrow {
  width: 3rem;
  height: 3rem;
  border: 2px solid var(--pen);
  border-radius: 50%;
  background: var(--card);
  color: var(--pen);
}

.arrow[data-dir="up"] { grid-area: up; }
.arrow[data-dir="left"] { grid-area: left; }
.arrow[data-dir="down"] { grid-area: down; }
.arrow[data-dir="right"] { grid-area: right; }

.board-2048 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  width: min(100%, 20rem);
  margin-inline: auto;
  padding: 0.45rem;
  background: #c4b49a;
  border-radius: 0.45rem;
  user-select: none;
  touch-action: none;
}

.board-2048 .tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 0.3rem;
  background: rgba(255, 253, 248, 0.35);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1;
}

.board-2048 .tile[data-v="2"] { background: #efe6d4; }
.board-2048 .tile[data-v="4"] { background: #f3d7a1; }
.board-2048 .tile[data-v="8"] { background: #f0c14d; }
.board-2048 .tile[data-v="16"] { background: #e8a04a; }
.board-2048 .tile[data-v="32"] { background: #e07a3d; color: #fff; }
.board-2048 .tile[data-v="64"] { background: #e15a49; color: #fff; }
.board-2048 .tile[data-v="128"] { background: #d64550; color: #fff; font-size: 1.25rem; }
.board-2048 .tile[data-v="256"] { background: #7dbe86; font-size: 1.25rem; }
.board-2048 .tile[data-v="512"] { background: #2f8f4e; color: #fff; font-size: 1.25rem; }
.board-2048 .tile[data-v="1024"] { background: #1d6bba; color: #fff; font-size: 1rem; }
.board-2048 .tile[data-v="2048"] { background: #1a4b78; color: #fff; font-size: 1rem; }
.board-2048 .tile[data-v="4096"],
.board-2048 .tile[data-v="8192"] { background: #7a4ea3; color: #fff; font-size: 0.95rem; }

.board-2048 .tile.is-born { animation: tile-pop 0.14s ease-out; }

@keyframes tile-pop {
  from { transform: scale(0.55); }
  to { transform: scale(1); }
}

.mine {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  width: min(100%, 22.5rem);
  margin-inline: auto;
  border: 2px solid var(--pen);
  background: #c4b49a;
  user-select: none;
  touch-action: manipulation;
}

.mine button {
  aspect-ratio: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(28, 36, 48, 0.28);
  background: #e7dcc6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  color: var(--ink);
  font: 700 clamp(0.75rem, 2.8vw, 1rem)/1 var(--sans);
  cursor: pointer;
}

.mine button.is-open {
  background: #fffdf8;
  box-shadow: none;
}

.mine button.is-on {
  outline: 2px solid var(--pen);
  outline-offset: -3px;
  z-index: 1;
}

.mine button.is-mine { color: var(--ink); }
.mine button.is-bad { color: var(--red); }
.mine button.is-hit { background: #d64550; color: #fff; }

.mine button[data-n="1"] { color: #1d6bba; }
.mine button[data-n="2"] { color: #2f8f4e; }
.mine button[data-n="3"] { color: #d64550; }
.mine button[data-n="4"] { color: #7a4ea3; }
.mine button[data-n="5"] { color: #d5721a; }
.mine button[data-n="6"] { color: #0e7c86; }
.mine button[data-n="7"] { color: #1c2430; }
.mine button[data-n="8"] { color: #5d6772; }

.mine-tools {
  display: flex;
  justify-content: center;
  margin-top: 0.8rem;
}

.mine-tools .is-on {
  background: #ffe15a;
  color: var(--ink);
}

.hang-wrap {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  margin-bottom: 0.85rem;
}

.hang {
  width: min(100%, 9.5rem);
  height: auto;
}

.hang [data-part] {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.hang [data-part].is-on { opacity: 1; }

.hang-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.4rem;
}

.hang-word span {
  min-width: 1.35rem;
  font-family: var(--hand);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  text-align: center;
}

.hang-word span.is-open { color: var(--pen); }

.hang-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  max-width: 26rem;
  margin-inline: auto;
}

.hang-keys button {
  min-width: 2.15rem;
  min-height: 2.15rem;
  padding: 0 0.35rem;
  border: 2px solid var(--pen);
  border-radius: 0.4rem;
  background: #fff;
  color: var(--ink);
  font: 700 0.95rem/1 var(--sans);
  cursor: pointer;
}

.hang-keys button.is-good {
  background: rgba(125, 190, 134, 0.55);
  border-color: #2f8f4e;
}

.hang-keys button.is-bad {
  background: rgba(214, 69, 80, 0.18);
  border-color: var(--red);
  color: var(--muted);
}

.hang-keys button:disabled {
  cursor: default;
  opacity: 0.72;
}

.hang-keys button:focus-visible {
  outline: 3px solid #ffe15a;
  outline-offset: 2px;
}

.tetris-wrap { max-width: 280px; margin-inline: auto; }

.tetris-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #241c16;
  border-radius: 0.4rem;
}

.tetris-pad {
  display: grid;
  grid-template-columns: repeat(3, 3rem);
  grid-template-areas:
    "left rotate right"
    "drop drop down";
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.8rem;
}

.tetris-pad .arrow[data-act="left"] { grid-area: left; }
.tetris-pad .arrow[data-act="rotate"] { grid-area: rotate; }
.tetris-pad .arrow[data-act="right"] { grid-area: right; }
.tetris-pad .arrow[data-act="down"] { grid-area: down; }
.tetris-pad .drop { grid-area: drop; }

.sudoku {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  width: min(100%, 22.5rem);
  margin-inline: auto;
  border: 2px solid var(--pen);
  background: #fff;
  user-select: none;
}

.sudoku button {
  aspect-ratio: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(28, 36, 48, 0.22);
  background: transparent;
  color: #1d6bba;
  font: 700 clamp(0.95rem, 3.4vw, 1.2rem)/1 var(--sans);
  cursor: pointer;
}

.sudoku button.is-given {
  color: var(--ink);
  font-family: var(--hand);
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  cursor: default;
}

.sudoku button.is-peer { background: rgba(26, 75, 120, 0.07); }
.sudoku button.is-same { background: rgba(110, 162, 228, 0.28); }

.sudoku button.is-on {
  background: rgba(255, 225, 90, 0.78);
  outline: 2px solid var(--pen);
  outline-offset: -3px;
  z-index: 1;
}

.sudoku button.is-bad { color: var(--red); }

.sudoku button:nth-child(9n+3),
.sudoku button:nth-child(9n+6) { border-right: 2px solid var(--pen); }

.sudoku button:nth-child(n+19):nth-child(-n+27),
.sudoku button:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--pen); }

.sudoku-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  width: min(100%, 22.5rem);
  margin: 0.8rem auto 0;
}

.sudoku-pad button {
  min-height: 2.6rem;
  border: 2px solid var(--pen);
  border-radius: 0.45rem;
  background: #fff;
  color: var(--ink);
  font: 700 1.1rem/1 var(--sans);
  cursor: pointer;
}

.sudoku-pad button[data-n="0"] {
  background: transparent;
  font-size: 0.95rem;
}

.letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.letters b {
  min-width: 2.2rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--pen);
  border-radius: 0.4rem;
  background: #fff;
  font-family: var(--hand);
  font-size: 1.45rem;
  font-weight: 700;
}

.guess {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 520px;
}

.guess input {
  flex: 1 1 12rem;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 2px solid var(--pen);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}

.play .lede {
  max-width: none;
  margin-left: 0;
  margin-top: 0;
}

.how, .more, .prose { max-width: 40rem; }

.play .how { max-width: none; }

.how h2, .more h2, .prose h2 {
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.7rem;
  margin: 1.6rem 0 0.35rem;
}

.more ul { padding: 0; margin: 0; list-style: none; }

.more li { border-top: 1px solid var(--line); }

.more a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  text-decoration: none;
}

.more a:hover { background: rgba(255, 226, 92, 0.55); }

.ad-slot { margin: 2.2rem 0 0; }

.ad-label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-footer {
  border: 0;
  padding: 0.9rem 0.15rem 1.6rem;
  color: rgba(232, 240, 247, 0.78);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.site-footer a { color: white; }

@media (min-width: 800px) {
  body:has(.game-page) .site-header,
  body:has(.game-page) .site-footer,
  .wrap.game-page {
    width: min(1040px, calc(100% - 2rem));
  }

  .play {
    display: grid;
    grid-template-columns: minmax(0, 28.5rem) minmax(16rem, 1fr);
    column-gap: 1.75rem;
    align-items: start;
  }

  .play .stage { margin-bottom: 0; }

  .play .how h2 { margin-top: 1rem; }
}

@media (min-width: 680px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .logo { font-size: 1.5rem; gap: 0.45rem; }
  .nav { gap: 0.7rem; }
  .hud .btn { margin-left: 0; }
  .pairs { gap: 0.4rem; }
  .hero h1 { transform: none; }
}
