:root {
  --ink: #15171c;
  --ink-soft: #2d3038;
  --paper: #fffdf7;
  --cream: #f6f0e4;
  --line: #dfd7c8;
  --muted: #626877;
  --lime: #b8ff46;
  --mint: #45e6c8;
  --blue: #26b8ff;
  --coral: #ff7043;
  --gold: #ffb13b;
  --violet: #9a7cff;
  --shadow: 0 8px 0 var(--ink);
  --soft-shadow: 0 18px 45px rgba(21, 23, 28, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(184, 255, 70, 0.24), transparent 28rem),
    radial-gradient(circle at 96% 12%, rgba(38, 184, 255, 0.18), transparent 24rem),
    linear-gradient(180deg, #fffdf7 0%, #f4eddf 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 60px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px 0 18px;
  background: rgba(255, 253, 247, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 2px solid rgba(21, 23, 28, 0.09);
}

.topbar > * {
  min-width: 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
}

.brand-word {
  font-size: 25px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-word span {
  color: #168f79;
}

.search-wrap {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  width: min(520px, 100%);
  justify-self: center;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 5px 0 var(--ink);
}

.search-icon {
  font-weight: 950;
  color: var(--coral);
}

.search-wrap input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
}

.topnav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.topnav a,
.tab,
.primary-btn,
.secondary-btn,
.icon-btn {
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 9px 15px;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--ink);
}

.topnav a:hover,
.secondary-btn:hover,
.tab:hover,
.icon-btn:hover {
  transform: translateY(1px);
  box-shadow: 0 3px 0 var(--ink);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(390px, 1.05fr);
  gap: 34px;
  align-items: center;
  padding: 50px 0 28px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: #168f79;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(46px, 7vw, 88px);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 21px;
  line-height: 1.08;
}

.hero-lede,
.section-head p {
  max-width: 620px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.48;
  font-weight: 650;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.primary-btn {
  background: var(--lime);
}

.secondary-btn {
  background: var(--paper);
}

.daily-console {
  border: 3px solid var(--ink);
  border-radius: 30px;
  background: #fff8e8;
  padding: 18px;
  box-shadow: 0 18px 0 var(--ink);
  transform: rotate(1deg);
}

.console-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.console-top strong {
  display: block;
  font-size: 22px;
  line-height: 1.05;
}

.mini-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.streak-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: 9px 13px;
  font-weight: 950;
}

.daily-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.daily-card,
.game-card,
.category-shelves article {
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 6px 0 var(--ink);
}

.daily-card {
  min-height: 152px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}

.daily-card:nth-child(1) {
  background: #efffd1;
}

.daily-card:nth-child(2) {
  background: #dff8ff;
}

.daily-card:nth-child(3) {
  background: #fff0d7;
}

.daily-card:nth-child(4) {
  background: #ffe8de;
}

.game-glyph {
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--paper);
  font-weight: 950;
}

.daily-card strong,
.game-card strong {
  display: block;
  margin-top: 12px;
  font-size: 20px;
  line-height: 1.05;
}

.daily-card span,
.game-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.32;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 50px;
}

.quick-stats div {
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--ink);
  color: var(--paper);
  padding: 16px;
}

.quick-stats strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.quick-stats span {
  display: block;
  margin-top: 6px;
  color: #d9ded9;
  font-weight: 700;
}

.section-head {
  margin: 64px 0 18px;
}

.wall-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab.active {
  background: var(--lime);
}

.game-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.game-card {
  position: relative;
  min-height: 226px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.game-card::after {
  content: "";
  position: absolute;
  right: -38px;
  top: -42px;
  width: 128px;
  height: 128px;
  border: 18px solid rgba(21, 23, 28, 0.08);
  border-radius: 42px;
  transform: rotate(21deg);
}

.game-card[data-tone="lime"] {
  background: #efffd1;
}

.game-card[data-tone="blue"] {
  background: #dff8ff;
}

.game-card[data-tone="gold"] {
  background: #fff0d7;
}

.game-card[data-tone="coral"] {
  background: #ffe8de;
}

.game-card[data-tone="mint"] {
  background: #e8fff7;
}

.game-card[data-tone="violet"] {
  background: #f1edff;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  border: 1.5px solid rgba(21, 23, 28, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  padding: 5px 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

.play-card-btn {
  align-self: flex-start;
  min-height: 40px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: 9px 14px;
  font-weight: 950;
}

.play-stage {
  display: none;
  margin-top: 28px;
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.play-stage.active {
  display: block;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 20px;
  border-bottom: 2px solid var(--ink);
  background: #fff8e8;
}

.stage-head h2 {
  font-size: clamp(28px, 4vw, 44px);
}

.stage-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.stage-body {
  min-height: 420px;
  padding: 20px;
}

.empty-stage {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.seo-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr);
  gap: 20px;
  padding: 20px;
  border-top: 2px solid var(--ink);
  background: #f8f2e7;
}

.seo-panel h3 {
  margin-bottom: 8px;
}

.seo-panel p,
.seo-panel li {
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.seo-panel ul {
  margin: 0;
  padding-left: 18px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(260px, 0.42fr);
  gap: 18px;
  align-items: stretch;
}

.game-board,
.game-side {
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: #fff8e8;
  padding: 16px;
}

.game-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  line-height: 1;
}

.message {
  min-height: 44px;
  border: 2px solid rgba(21, 23, 28, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px 12px;
  color: var(--ink-soft);
  font-weight: 750;
}

.small-btn,
.answer-btn,
.keyboard button {
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  padding: 10px 12px;
  font-weight: 950;
  box-shadow: 0 3px 0 var(--ink);
}

.small-btn.primary {
  background: var(--lime);
}

.word-grid {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 8px;
  width: min(100%, 390px);
  margin: 0 auto 16px;
}

.word-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.word-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--paper);
  font-size: clamp(22px, 6vw, 34px);
  font-weight: 950;
  text-transform: uppercase;
}

.word-cell.correct {
  background: var(--lime);
}

.word-cell.present {
  background: var(--gold);
}

.word-cell.miss {
  background: #d9d5cb;
}

.guess-form,
.typing-form {
  display: flex;
  gap: 8px;
}

.guess-form input,
.typing-form input {
  min-width: 0;
  flex: 1;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  padding: 12px 14px;
  font-weight: 900;
}

.tile-2048 {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 2px solid rgba(21, 23, 28, 0.15);
  background: #eee5d5;
  color: var(--ink);
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 950;
}

.grid-2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--ink);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.link-tile {
  min-height: 76px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
  padding: 8px;
  font-weight: 950;
  box-shadow: 0 3px 0 var(--ink);
}

.link-tile.selected {
  background: var(--lime);
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.link-tile.solved {
  background: var(--mint);
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.math-question {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--lime);
  font-size: clamp(44px, 10vw, 92px);
  font-weight: 950;
}

.typing-prompt {
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--paper);
  padding: 18px;
  font-size: clamp(22px, 4vw, 36px);
  line-height: 1.28;
  font-weight: 850;
}

.typing-prompt .done {
  color: #168f79;
}

.typing-prompt .current {
  background: var(--gold);
  border-radius: 6px;
}

.runner-wrap {
  display: grid;
  gap: 12px;
}

#runner-canvas {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  display: block;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--ink);
}

.runner-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.memory-grid,
.pattern-grid,
.quiz-options,
.wordfind-grid,
.sudoku-grid {
  display: grid;
  gap: 10px;
}

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

.memory-card {
  min-height: 82px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px;
  font-size: clamp(14px, 2vw, 20px);
  font-weight: 950;
  box-shadow: 0 4px 0 rgba(21, 23, 28, 0.45);
}

.memory-card.open {
  background: var(--lime);
  color: var(--ink);
}

.quiz-card {
  min-height: 320px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  padding: 18px;
}

.quiz-card h3 {
  margin-bottom: 18px;
  font-size: clamp(26px, 4vw, 42px);
}

.quiz-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reaction-pad {
  position: relative;
  min-height: 360px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(21, 23, 28, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(21, 23, 28, 0.08) 1px, transparent 1px),
    #fff8e8;
  background-size: 34px 34px;
  overflow: hidden;
}

.reaction-target {
  position: absolute;
  left: 44%;
  top: 44%;
  width: 78px;
  height: 78px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--coral);
  color: var(--paper);
  font-weight: 950;
  box-shadow: 0 6px 0 var(--ink);
}

.pattern-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 420px;
  margin: 0 auto;
}

.pattern-btn {
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 6px 0 var(--ink);
}

.pattern-btn.lime {
  background: var(--lime);
}

.pattern-btn.blue {
  background: var(--blue);
}

.pattern-btn.coral {
  background: var(--coral);
}

.pattern-btn.gold {
  background: var(--gold);
}

.pattern-btn.flash {
  filter: brightness(1.22);
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--ink);
}

.scramble-word {
  display: grid;
  place-items: center;
  min-height: 170px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--lime);
  font-size: clamp(36px, 8vw, 78px);
  font-weight: 950;
  letter-spacing: 0.08em;
}

.wordfind-grid {
  grid-template-columns: repeat(9, minmax(0, 1fr));
  max-width: 520px;
  margin: 0 auto 16px;
  padding: 10px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--ink);
}

.wordfind-grid span {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--paper);
  font-weight: 950;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-list span {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  padding: 8px 10px;
  font-weight: 900;
}

.word-list span.found {
  background: var(--lime);
  text-decoration: line-through;
}

.sudoku-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 420px;
  margin: 0 auto;
  padding: 10px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--ink);
}

.sudoku-cell {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  font-size: clamp(30px, 8vw, 56px);
  font-weight: 950;
}

.sudoku-cell.given {
  background: var(--lime);
}

.category-shelves {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.category-shelves article {
  min-height: 180px;
  padding: 18px;
}

.category-shelves span {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--lime);
  font-weight: 950;
}

.category-shelves p {
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.trust-band {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(320px, 1fr);
  gap: 24px;
  margin-top: 52px;
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: var(--ink);
  color: var(--paper);
  padding: 24px;
}

.trust-band .eyebrow {
  color: var(--lime);
}

.trust-band ul {
  margin: 0;
  padding-left: 20px;
  color: #e5e8df;
  font-size: 18px;
  line-height: 1.8;
  font-weight: 750;
}

.seo-game-page .topbar {
  grid-template-columns: auto auto;
  justify-content: space-between;
}

.seo-play-box {
  border: 3px solid var(--ink);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.seo-play-box iframe {
  display: block;
  width: 100%;
  min-height: 760px;
  border: 0;
}

.static-seo-panel {
  margin-top: 22px;
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}

.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: fall 980ms linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(105vh) rotate(420deg);
    opacity: 0.3;
  }
}

@media (max-width: 980px) {
  .topbar,
  .hero-grid,
  .game-layout,
  .seo-panel,
  .trust-band {
    grid-template-columns: 1fr;
  }

  .search-wrap {
    justify-self: stretch;
  }

  .topnav {
    justify-content: flex-start;
  }

  .daily-console {
    transform: none;
  }

  .game-cards,
  .category-shelves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(342px, calc(100% - 32px));
    max-width: 342px;
    margin: 0 auto 0 12px;
    padding-top: 12px;
  }

  .topbar {
    position: static;
    gap: 14px;
  }

  .search-wrap {
    width: 100%;
  }

  .brand-word {
    font-size: 22px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .hero-grid {
    padding-top: 30px;
  }

  h1 {
    font-size: 34px;
    line-height: 1;
  }

  .hero-lede,
  .section-head p {
    font-size: 17px;
  }

  .daily-console {
    padding: 14px;
    box-shadow: 0 8px 0 var(--ink);
  }

  .search-wrap,
  .daily-console,
  .game-card,
  .category-shelves article,
  .play-stage,
  .trust-band,
  .seo-play-box,
  .static-seo-panel {
    max-width: 100%;
  }

  .console-top {
    flex-wrap: wrap;
  }

  .daily-grid,
  .quick-stats,
  .game-cards,
  .category-shelves,
  .links-grid,
  .memory-grid,
  .quiz-options {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .guess-form,
  .typing-form {
    flex-direction: column;
  }

  .hero-actions button,
  .guess-form button,
  .typing-form button,
  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .stage-head {
    flex-direction: column;
  }

  .metric-row,
  .answers {
    grid-template-columns: 1fr;
  }
}
