:root {
  --bg: #f7f9fc;
  --bg-accent: #eef3fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --surface-soft: rgba(255, 255, 255, 0.72);
  --text: #243041;
  --muted: #6b7280;
  --heading: #17212f;
  --border: #dfe6ef;
  --border-strong: #98a8bf;
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.07);
  --shadow-soft: 0 6px 18px rgba(17, 24, 39, 0.05);
  --shadow-hover: 0 18px 38px rgba(17, 24, 39, 0.1);
  --accent: #4f46e5;
  --accent-2: #44b454;
  --accent-soft: #eef2ff;
  --success-bg: #eff9f0;
  --success-border: #44b454;
  --info-bg: #f3f7ff;
  --info-border: #7aa7ff;
  --danger: #d9534f;
  --danger-bg: #ffe8e8;
  --warning-bg: #ffe9b0;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #ffffff 0%, var(--bg-accent) 24%, var(--bg) 66%);
  line-height: 1.55;
}



/* ===== Puzzle Nagivation ===== */

.puzzle-subnav {
  max-width: 1100px;
  margin: 0 auto 20px;
  padding: 14px 24px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.puzzle-subnav a {
  text-decoration: none;
  color: #374151;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.puzzle-subnav a:hover {
  color: #4338ca;
  background: #eef2ff;
  border-color: #c7d2fe;
}

.puzzle-subnav a.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}











.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 30px 20px 68px;
}

/* ===== Shared page polish ===== */

.back-link {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.98rem;
}

.back-link:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* ===== Generic hero styles for game pages ===== */

.hero,
.page > h1,
.page > .subtitle,
.page > .intro {
  text-align: left;
}

.hero {
  padding: 14px 0 26px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #7c8798;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page > h1,
.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3.2vw, 3rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--heading);
}

.page > .subtitle,
.subtitle {
  margin: 12px 0 0;
  max-width: 760px;
  font-size: 1.03rem;
  color: var(--muted);
  line-height: 1.65;
}

.intro {
  margin: 18px 0 0;
  max-width: 820px;
  font-size: 0.98rem;
  color: #556070;
  line-height: 1.72;
}

.hero-actions {
  margin-top: 20px;
}

.hero-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 13px 20px;
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.2);
}

/* ===== Sophisticated landing page intro ===== */

.games-page {
  padding-top: 34px;
}

.games-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
  gap: 30px;
  align-items: stretch;
  margin-bottom: 38px;
}

.games-intro-copy {
  padding: 8px 6px 4px 0;
}

.games-kicker {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7c8798;
}

.games-intro-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 2.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--heading);
  font-weight: 800;
  max-width: 760px;
}

.games-lead {
  margin: 0 0 12px;
  max-width: 720px;
  font-size: 1.08rem;
  line-height: 1.66;
  color: #5e6878;
}

.games-support {
  margin: 0;
  max-width: 760px;
  font-size: 0.98rem;
  line-height: 1.72;
  color: #6f7b8c;
}

.games-feature-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
  align-self: start;
}

.feature-label {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7b8798;
}

.games-feature-card h2 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--heading);
}

.games-feature-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.66;
}

.feature-link {
  display: inline-block;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.feature-link:hover {
  text-decoration: underline;
}

/* ===== Section headings ===== */

.games-section {
  margin-top: 6px;
}

.section-head {
  margin-bottom: 18px;
  padding: 0 2px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.2;
  color: var(--heading);
}

.section-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.refined-head h3 {
  font-size: 1.35rem;
}

/* ===== Game cards ===== */

.menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.game-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #cfd9e8;
}

.game-card.disabled {
  opacity: 0.7;
  cursor: default;
  pointer-events: none;
}

.icon-wrap {
  flex-shrink: 0;
}

.icon {
  width: 58px;
  height: 58px;
  min-width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  border-radius: 16px;
  background: linear-gradient(180deg, #eef4ff, #e9f4ed);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.95);
}

.game-text h2,
.game-text h3 {
  margin: 0 0 7px;
  font-size: 1.26rem;
  line-height: 1.22;
  color: var(--heading);
}

.game-text p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.58;
}

.play-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--accent);
}

/* ===== Shared puzzle page shells ===== */

.legend-card,
.mode-section,
.game-section,
.word-search-sidebar,
.maze-card,
.sudoku-card,
.fallen-board,
.word-search-grid,
.math-puzzle-shell,
.game-shell {
  box-shadow: var(--shadow-soft);
}

.legend-card,
.word-search-sidebar,
.maze-card,
.sudoku-card,
.fallen-board,
.word-search-grid,
.math-puzzle-shell,
.game-shell {
  background: var(--surface);
  border: 1px solid var(--border);
}

.legend-card,
.mode-section,
.game-section {
  margin-bottom: 28px;
}

.legend-card {
  max-width: 950px;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  text-align: center;
  line-height: 1.7;
}

.mode-section {
  text-align: center;
}

.mode-section h2 {
  margin: 0 0 18px;
  font-size: 1.5rem;
}

.mode-tabs {
  display: inline-flex;
  gap: 10px;
  background: #edf4eb;
  padding: 8px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.mode-tab {
  border: none;
  background: transparent;
  color: #4d4d4d;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab.active {
  background: var(--accent-2);
  color: #fff;
  box-shadow: 0 8px 20px rgba(68, 180, 84, 0.2);
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.mode-description {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1rem;
}

.custom-form {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.phrase-input,
.word-input,
.maze-select {
  border: 1px solid #cfd7e3;
  border-radius: var(--radius-sm);
  font-family: inherit;
}

.phrase-input {
  width: 320px;
  max-width: 100%;
  height: 50px;
  padding: 0 16px;
  font-size: 1rem;
  outline: none;
}

.phrase-input:focus,
.word-input:focus,
.maze-select:focus,
.letter-box:focus,
.cryptogram-input:focus,
.fallen-slot.active,
.sudoku-cell:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.primary-btn,
.secondary-btn {
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.primary-btn {
  border: none;
  background: var(--accent);
  color: #fff;
}

.secondary-btn {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--border);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-heading h3 {
  margin: 0;
  font-size: 1.3rem;
}


/* ===== Word search page ===== */

.word-search-layout {
  display: grid;
  grid-template-columns: minmax(320px, 540px) minmax(250px, 1fr);
  gap: 24px;
  align-items: start;
}

.word-search-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(30px, 48px));
  gap: 8px;
  border-radius: var(--radius-md);
  padding: 16px;
  user-select: none;
}

.word-cell {
  border: 1px solid #d1d9e5;
  background: #f6f9ff;
  color: var(--text);
  border-radius: 8px;
  min-height: 42px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.word-cell.selected {
  background: var(--warning-bg);
  border-color: #f0b936;
}

.word-cell.found {
  background: var(--accent-2);
  border-color: #389b45;
  color: #fff;
}

.word-search-sidebar {
  border-radius: var(--radius-md);
  padding: 18px;
}

.word-search-sidebar h2 {
  margin-top: 0;
}

.word-input-panel {
  margin-bottom: 14px;
  display: grid;
  gap: 8px;
}

.word-input-label {
  font-size: 0.92rem;
  color: #555;
  font-weight: 700;
}

.word-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  resize: vertical;
}

.word-list {
  margin: 0 0 18px;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.word-list li {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.word-list li.found {
  color: var(--accent-2);
  text-decoration: line-through;
}

/* ===== Maze page ===== */

.maze-controls {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}

.maze-controls label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #444;
  text-align: left;
}

.maze-select {
  min-width: 180px;
  height: 48px;
  padding: 0 14px;
  font-size: 1rem;
  background: #fff;
}

.maze-card {
  max-width: 860px;
  margin: 0 auto;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
}

.maze-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.maze-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  height: 40px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.start-badge {
  background: #e8f8ea;
  color: #2d9c42;
  border: 1px solid #b9e6c0;
}

.finish-badge {
  background: #fff1f0;
  color: var(--danger);
  border: 1px solid #f0c2bf;
}

#mazeCanvas {
  width: 100%;
  max-width: 700px;
  height: auto;
  display: block;
  margin: 0 auto;
  background: #fcfdff;
  border: 2px solid #cfd7e3;
  border-radius: 18px;
}

.maze-help-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

/* ===== Cryptogram page ===== */

.cryptogram-hint {
  margin-bottom: 20px;
  font-weight: 700;
  color: #4a5a77;
}

.cryptogram-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.cryptogram-cell {
  width: 58px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-soft);
}

.cryptogram-cipher {
  font-size: 0.95rem;
  font-weight: 800;
  color: #5a6682;
}

.cryptogram-input {
  width: 40px;
  height: 40px;
  border: 2px solid #cfd7e3;
  border-radius: 10px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cryptogram-space {
  width: 22px;
}

.cryptogram-board.solved .cryptogram-cell {
  border-color: var(--success-border);
  background: var(--success-bg);
}

/* ===== Sudoku page ===== */

.sudoku-controls {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.sudoku-controls label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #444;
}

.sudoku-card {
  max-width: 700px;
  margin: 0 auto;
  border-radius: 20px;
  padding: 22px;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(34px, 58px));
  justify-content: center;
  border: 3px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.sudoku-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #cdd7e4;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.sudoku-cell.fixed {
  background: #edf2f8;
  color: #2c3f5b;
}

.sudoku-cell.invalid {
  background: var(--danger-bg);
  color: #8d1f1f;
}

.sudoku-cell.box-right {
  border-right: 3px solid var(--border-strong);
}

.sudoku-cell.box-bottom {
  border-bottom: 3px solid var(--border-strong);
}

/* ===== Fallen phrase page ===== */

.fallen-hint {
  margin-bottom: 16px;
  font-weight: 700;
  color: #4a5a77;
}

.fallen-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.fallen-column {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-soft);
}

.fallen-column-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #5a6682;
  text-align: center;
  margin-bottom: 8px;
}

.fallen-stack {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.fallen-letter {
  width: 34px;
  height: 34px;
  border: 1px solid #b8c5d8;
  border-radius: 8px;
  background: #f7faff;
  font-weight: 800;
  cursor: pointer;
}

.fallen-letter:hover {
  background: #eaf4ff;
}

.fallen-empty {
  color: #98a6bc;
  font-weight: 700;
}

.fallen-subheading {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.fallen-board {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}

.fallen-slot {
  width: 38px;
  height: 44px;
  border: 2px solid #cfd7e3;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
}

.fallen-space {
  width: 20px;
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
  .games-intro {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .word-search-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .page {
    padding: 24px 16px 48px;
  }

  .games-page {
    padding-top: 24px;
  }

  .games-intro-copy h1,
  .page > h1,
  .hero h1 {
    font-size: 2.1rem;
  }

  .games-lead,
  .subtitle {
    font-size: 0.98rem;
  }

  .games-support,
  .intro {
    font-size: 0.96rem;
  }

  .menu {
    grid-template-columns: 1fr;
  }

  .game-card {
    padding: 18px;
  }

  .icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    font-size: 1.6rem;
  }

  .puzzle-card {
    width: 130px;
    min-height: 138px;
  }

  .math-problem {
    font-size: 1.6rem;
  }

  .letter-box {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
  }

  .section-heading {
    justify-content: center;
    text-align: center;
  }

  .maze-card,
  .sudoku-card {
    padding: 16px;
  }

  .maze-select {
    min-width: 150px;
  }

  .sudoku-board {
    grid-template-columns: repeat(9, minmax(28px, 1fr));
  }
}

/* ===== PRINT PDF ===== */

.print-actions {
  margin-top: 1rem;
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.5in;
  }

  body {
    background: #fff;
    color: #000;
    margin: 0;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .page.printable-page {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .hero {
    margin-bottom: 0.25in;
  }

  .hero h1 {
    font-size: 22pt;
    margin-bottom: 0.1in;
  }

  .subtitle {
    font-size: 11pt;
    margin-bottom: 0.2in;
  }

  .print-layout {
    display: grid;
    grid-template-columns: 1fr 2.2in;
    gap: 0.35in;
    align-items: start;
  }

  .print-grid-wrap,
  .print-sidebar {
    break-inside: avoid;
  }

  .word-search-grid {
    width: 100%;
  }

  .word-search-sidebar h2 {
    margin-top: 0;
    font-size: 14pt;
  }

  .word-list {
    padding-left: 1.1rem;
    margin: 0;
  }

  .word-list li {
    font-size: 11pt;
    margin-bottom: 0.08in;
  }
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.5in;
  }

  body * {
    visibility: hidden;
  }

  .print-area,
  .print-area * {
    visibility: visible;
  }

  .print-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }

  body {
    margin: 0;
    background: white;
  }

  .print-layout {
    display: grid;
    grid-template-columns: 1fr 2.2in;
    gap: 0.35in;
    align-items: start;
  }

  .word-list {
    margin: 0;
    padding-left: 1rem;
  }
}


/* Mobile Sudoku Fix */
@media (max-width: 700px) {
  .hero {
    display: none;
  }

  .page {
    padding: 18px 16px 40px;
  }

  .puzzle-subnav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px 16px;
  }

  .puzzle-subnav a {
    width: 100%;
    text-align: center;
    font-size: 16px;
    padding: 12px 10px;
  }

  .sudoku-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: end;
    margin-top: 18px;
  }

  .sudoku-controls label {
    grid-column: 1 / -1;
    font-size: 16px;
    font-weight: 700;
  }

  .sudoku-controls select {
    width: 100%;
    margin-top: 8px;
  }

  #newSudokuBtn,
  #checkSudokuBtn {
    width: 100%;
  }

  #solveSudokuBtn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .share-capture-area {
    display: flex;
    justify-content: center;
    margin-top: 24px;
  }

  .sudoku-card {
    width: min(92vw, 380px);
    padding: 20px;
  }

  .sudoku-board {
    width: min(78vw, 320px);
    height: min(78vw, 320px);
    margin: 0 auto;
  }

  .share-wrap {
    padding-bottom: 90px;
  }

  .share-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
}


/* Mobile Maze Fix */
@media (max-width: 700px) {
  .hero {
    display: none;
  }

  .page {
    padding: 18px 16px 40px;
  }

  .legend-card {
    margin: 16px auto;
    width: 100%;
    max-width: 420px;
    text-align: center;
  }

  .maze-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  .maze-controls label,
  .maze-controls select,
  .maze-controls button {
    width: 100%;
  }

  .share-capture-area {
    display: flex;
    justify-content: center;
    margin-top: 24px;
  }

  .maze-card {
    width: min(94vw, 430px);
    padding: 18px;
  }

  #mazeCanvas {
    width: 100%;
    max-width: 360px;
    height: auto;
    display: block;
    margin: 0 auto;
  }

  .maze-legend {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }

  .maze-help-text {
    font-size: 15px;
    text-align: center;
    line-height: 1.4;
  }

  .share-wrap {
    padding-bottom: 90px;
  }

  .share-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
}




/* Mobile Crossmath Fix */
@media (max-width: 700px) {
  .hero {
    display: none;
  }

  .math-puzzle-page {
    padding: 18px 14px 40px;
  }

  .share-capture-area {
    display: flex;
    justify-content: center;
    margin-top: 18px;
  }

  .math-puzzle-shell {
    width: min(94vw, 430px);
    padding: 18px;
  }

  .game-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .puzzle-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }

  .action-row button {
    width: 100%;
  }

  .game-instructions {
    text-align: center;
    font-size: 15px;
    line-height: 1.45;
  }

  .board-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 6px 0;
  }

  .crossmath-grid {
    max-width: 100%;
    transform-origin: top center;
  }

  .bank-card {
    width: 100%;
    margin-top: 18px;
  }

  .number-bank {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .number-bank button,
  .number-bank .number-tile {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .result-message {
    text-align: center;
  }

  .share-wrap {
    padding-bottom: 90px;
  }

  .share-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
}


/* Mobile Cryptogram Fix */
@media (max-width: 700px) {
  .hero {
    display: none;
  }

  .page {
    padding: 18px 14px 40px;
  }

  .mode-section {
    width: 100%;
    max-width: 430px;
    margin: 16px auto;
    padding: 18px;
  }

  .mode-section h2 {
    text-align: center;
    font-size: 22px;
  }

  .mode-tabs,
  .custom-form,
  .section-heading,
  .action-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-tab,
  .custom-form input,
  .custom-form button,
  .section-heading button,
  .action-row button {
    width: 100%;
  }

  .share-capture-area {
    display: flex;
    justify-content: center;
    margin-top: 20px;
  }

  .cryptogram-card {
    width: min(94vw, 430px);
    padding: 18px;
  }

  .cryptogram-board {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .cryptogram-hint,
  .mode-description,
  .result-message {
    text-align: center;
  }

  .share-wrap {
    padding-bottom: 90px;
  }

  .share-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
}


/* Mobile Fallen Phrase Fix */
@media (max-width: 700px) {
  .hero {
    display: none;
  }

  .page {
    padding: 18px 14px 40px;
  }

  .mode-section {
    width: 100%;
    max-width: 430px;
    margin: 16px auto;
    padding: 18px;
  }

  .mode-section h2,
  .mode-description,
  .fallen-hint,
  .fallen-subheading,
  .result-message {
    text-align: center;
  }

  .mode-tabs,
  .custom-form,
  .section-heading,
  .action-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mode-tab,
  .custom-form input,
  .custom-form button,
  .section-heading button,
  .action-row button {
    width: 100%;
  }

  .share-capture-area {
    display: flex;
    justify-content: center;
    margin-top: 20px;
  }

  .fallen-phrase-card {
    width: min(94vw, 430px);
    padding: 18px;
  }

  .fallen-columns,
  .fallen-board {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .share-wrap {
    padding-bottom: 90px;
  }

  .share-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }
}

/* =========================================================
   Puzzle Games landing page — matched to Peppy Thinkers home
   ========================================================= */
.puzzle-landing-body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #172033;
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 191, 77, 0.22), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(103, 87, 245, 0.14), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #f4f8ff 45%, #fff9f1 100%);
  min-height: 100vh;
}

.puzzle-landing-body .container {
  width: min(1120px, calc(100% - 44px));
  max-width: none;
}

.puzzle-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(223, 231, 242, 0.9);
  padding: 0;
}

.puzzle-header-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.puzzle-brand,
.puzzle-landing-body .brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: fit-content;
}

.puzzle-landing-body .brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 900;
  background: linear-gradient(135deg, #4078ff, #6757f5);
  box-shadow: 0 12px 22px rgba(64, 120, 255, 0.22);
}

.puzzle-landing-body .logo {
  display: block;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #172033;
}

.puzzle-landing-body .tagline {
  display: block;
  margin-top: 7px;
  color: #718096;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.puzzle-landing-body .site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.puzzle-landing-body .site-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: #435067;
  font-size: 0.87rem;
  font-weight: 800;
  border: 1px solid transparent;
  text-decoration: none;
}

.puzzle-landing-body .site-nav a:hover,
.puzzle-landing-body .site-nav a.active {
  color: #fff;
  background: #6757f5;
}

.puzzle-landing-body .menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid #dfe7f2;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-size: 1.2rem;
}

.puzzle-hero {
  padding: 62px 0 28px;
}

.puzzle-hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 44px;
}

.puzzle-landing-body .eyebrow {
  display: inline-flex;
  width: fit-content;
  color: #6757f5;
  background: rgba(103, 87, 245, 0.08);
  border: 1px solid rgba(103, 87, 245, 0.12);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.puzzle-hero-copy h1 {
  max-width: 720px;
  margin: 18px 0 18px;
  font-size: clamp(2.05rem, 4.2vw, 3.65rem);
  line-height: 1.04;
  letter-spacing: -0.07em;
  color: #172033;
}

.puzzle-hero-lede {
  max-width: 610px;
  color: #5f6b7c;
  font-size: 1.08rem;
  line-height: 1.65;
  margin: 0;
}

.puzzle-hero-buttons,
.puzzle-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.puzzle-hero-buttons {
  margin-top: 26px;
}

.puzzle-landing-body .btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 18px;
  border: 0;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.puzzle-landing-body .btn:hover {
  transform: translateY(-2px);
}

.puzzle-landing-body .btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #6757f5, #4078ff);
  box-shadow: 0 16px 28px rgba(64, 120, 255, 0.22);
}

.puzzle-landing-body .btn-secondary {
  color: #6757f5;
  background: #fff;
  border: 1px solid rgba(103, 87, 245, 0.18);
  box-shadow: 0 10px 25px rgba(34, 50, 84, 0.08);
}

.puzzle-stats {
  margin-top: 20px;
}

.puzzle-stats span {
  padding: 9px 12px;
  border: 1px solid #dfe7f2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #41506a;
  font-size: 0.9rem;
  font-weight: 800;
}

.puzzle-hero-panel {
  padding: 20px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 45px rgba(34, 50, 84, 0.11);
}

.puzzle-landing-body .panel-top {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.puzzle-landing-body .dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.puzzle-landing-body .dot-red { background: #ff708f; }
.puzzle-landing-body .dot-yellow { background: #ffcf5a; }
.puzzle-landing-body .dot-green { background: #72d98c; }

.puzzle-spotlight-card,
.puzzle-landing-body .spotlight-card {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, #eef5ff, #fff7ea);
  border: 1px solid rgba(34, 50, 84, 0.08);
}

.puzzle-landing-body .spotlight-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 1.85rem;
  box-shadow: 0 10px 25px rgba(34, 50, 84, 0.08);
}

.puzzle-landing-body .spotlight-label {
  color: #5f6b7c;
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.puzzle-landing-body .spotlight-card h2 {
  margin-top: 3px;
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #172033;
}

.puzzle-preview-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 26px;
  background: linear-gradient(135deg, #f0f6ff, #fff7ea);
  border: 1px solid rgba(34, 50, 84, 0.08);
}

.puzzle-preview-board span {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(34, 50, 84, 0.07);
  font-size: 2rem;
  font-weight: 900;
  color: #6757f5;
}

.puzzle-subnav-card {
  width: min(1120px, calc(100% - 44px));
  max-width: none;
  margin: 4px auto 36px;
  padding: 14px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 24px;
  box-shadow: 0 10px 25px rgba(34, 50, 84, 0.08);
}

.puzzle-subnav-card a {
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dfe7f2;
  color: #435067;
  font-weight: 900;
}

.puzzle-subnav-card a:hover {
  color: #fff;
  background: #6757f5;
  border-color: #6757f5;
  text-decoration: none;
}

.puzzle-section {
  padding: 52px 0 72px;
  background: rgba(255, 255, 255, 0.48);
  border-top: 1px solid rgba(223, 231, 242, 0.85);
  border-bottom: 1px solid rgba(223, 231, 242, 0.85);
}

.puzzle-section-heading {
  text-align: center;
  max-width: 700px;
}

.puzzle-section-heading h2 {
  margin: 14px 0 8px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.06em;
  color: #172033;
}

.puzzle-section-heading p {
  color: #5f6b7c;
}

.puzzle-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 28px;
}

.puzzle-card-grid .puzzle-card {
  min-height: 255px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 25px rgba(34, 50, 84, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
  color: #172033;
}

.puzzle-card-grid .puzzle-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(34, 50, 84, 0.12);
}

.puzzle-card-grid .activity-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 1.85rem;
  box-shadow: 0 9px 18px rgba(34, 50, 84, 0.08);
}

.puzzle-card-grid .puzzle-card h3 {
  margin: 18px 0 8px;
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: #172033;
}

.puzzle-card-grid .puzzle-card p {
  color: #536176;
  font-size: 0.95rem;
  margin: 0;
}

.puzzle-card-grid .card-link-text {
  margin-top: auto;
  padding-top: 18px;
  color: #6757f5;
  font-size: 0.94rem;
  font-weight: 900;
}

.puzzle-landing-body .card-blue { background: linear-gradient(135deg, #deecff, #f7fbff); }
.puzzle-landing-body .card-purple { background: linear-gradient(135deg, #eee8ff, #fbf9ff); }
.puzzle-landing-body .card-green { background: linear-gradient(135deg, #e4f9ee, #f8fff9); }
.puzzle-landing-body .card-yellow { background: linear-gradient(135deg, #fff1cb, #fffaf0); }
.puzzle-landing-body .card-pink { background: linear-gradient(135deg, #ffe1ee, #fff8fb); }

.puzzle-site-footer {
  padding: 32px 0;
  border-top: 1px solid #dfe7f2;
  background: rgba(255, 255, 255, 0.62);
}

.puzzle-landing-body .footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.puzzle-landing-body .site-footer h3 {
  font-size: 1rem;
  font-weight: 900;
  margin: 0;
}

.puzzle-landing-body .site-footer p {
  color: #5f6b7c;
  font-size: 0.9rem;
  margin-top: 4px;
}

.puzzle-landing-body .footer-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.puzzle-landing-body .footer-nav a {
  color: #435067;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.puzzle-landing-body .footer-nav a:hover {
  color: #6757f5;
}

@media (max-width: 980px) {
  .puzzle-hero-grid {
    grid-template-columns: 1fr;
  }

  .puzzle-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  .puzzle-landing-body .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .puzzle-landing-body .site-nav {
    position: absolute;
    left: 22px;
    right: 22px;
    top: 76px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border: 1px solid #dfe7f2;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 45px rgba(34, 50, 84, 0.11);
  }

  .puzzle-landing-body .site-nav.open {
    display: flex;
  }

  .puzzle-landing-body .site-nav a {
    text-align: center;
  }
}

@media (max-width: 680px) {
  .puzzle-landing-body .container,
  .puzzle-subnav-card {
    width: min(100% - 28px, 1120px);
  }

  .puzzle-header-inner {
    min-height: 74px;
  }

  .puzzle-landing-body .brand-badge {
    width: 40px;
    height: 40px;
  }

  .puzzle-landing-body .logo {
    font-size: 1.28rem;
  }

  .puzzle-landing-body .tagline {
    font-size: 0.58rem;
  }

  .puzzle-hero {
    padding-top: 42px;
  }

  .puzzle-hero-copy h1 {
    font-size: clamp(2.35rem, 13vw, 3.75rem);
  }

  .puzzle-hero-buttons,
  .puzzle-stats {
    flex-direction: column;
  }

  .puzzle-landing-body .btn,
  .puzzle-stats span {
    width: 100%;
  }

  .puzzle-preview-board,
  .puzzle-card-grid {
    grid-template-columns: 1fr;
  }

  .puzzle-preview-board span {
    min-height: 64px;
  }

  .puzzle-subnav-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .puzzle-subnav-card a {
    width: 100%;
    text-align: center;
  }

  .puzzle-card-grid .puzzle-card {
    min-height: auto;
  }

  .puzzle-landing-body .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Brain Play landing color tweaks */
.brain-hero .puzzle-hero-panel::before {
  background: rgba(255, 221, 118, 0.45);
}

.brain-hero .puzzle-hero-panel::after {
  background: rgba(138, 111, 255, 0.16);
}

.brain-play-landing-body .puzzle-preview-board span:nth-child(1) { background: #e4f0ff; }
.brain-play-landing-body .puzzle-preview-board span:nth-child(2) { background: #fff2c7; }
.brain-play-landing-body .puzzle-preview-board span:nth-child(3) { background: #e8fff2; }
.brain-play-landing-body .puzzle-preview-board span:nth-child(4) { background: #eee7ff; }
.brain-play-landing-body .puzzle-preview-board span:nth-child(5) { background: #ffe3ee; }
.brain-play-landing-body .puzzle-preview-board span:nth-child(6) { background: #e4f0ff; }
