* { box-sizing: border-box; }

body.safe-games-body {
  --game-accent: #0b5fa8;
  --game-accent-2: #0f766e;
  --game-bg:
    radial-gradient(circle at 16% 16%, rgba(56, 189, 248, 0.22), transparent 0 18%),
    radial-gradient(circle at 82% 14%, rgba(236, 72, 153, 0.18), transparent 0 17%),
    linear-gradient(135deg, #060816 0%, #0f172a 50%, #0b1120 100%);
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #08111f;
  color: #e5eefb;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

body.safe-games-body::before,
body.safe-games-body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.safe-games-body::before {
  background: var(--game-bg);
  z-index: -2;
}

body.safe-games-body::after {
  background: linear-gradient(180deg, rgba(6, 10, 22, 0.2), rgba(6, 10, 22, 0.64));
  z-index: -1;
}

body.safe-games-body[data-game="ticTacToe"] {
  --game-bg: radial-gradient(circle at 14% 14%, rgba(37, 99, 235, 0.26), transparent 0 18%), radial-gradient(circle at 84% 20%, rgba(236, 72, 153, 0.22), transparent 0 18%), linear-gradient(135deg, #07132a 0%, #111827 50%, #1f2937 100%);
}

body.safe-games-body[data-game="connectFour"] {
  --game-bg: radial-gradient(circle at 14% 14%, rgba(245, 158, 11, 0.28), transparent 0 18%), radial-gradient(circle at 84% 20%, rgba(37, 99, 235, 0.24), transparent 0 18%), linear-gradient(135deg, #09111f 0%, #1e3a8a 55%, #172554 100%);
}

body.safe-games-body[data-game="rockPaperScissors"] {
  --game-bg: radial-gradient(circle at 12% 18%, rgba(16, 185, 129, 0.26), transparent 0 18%), radial-gradient(circle at 82% 12%, rgba(139, 92, 246, 0.22), transparent 0 18%), linear-gradient(135deg, #06111d 0%, #111827 50%, #0f172a 100%);
}

body.safe-games-body[data-game="checkers"] {
  --game-bg: radial-gradient(circle at 14% 16%, rgba(239, 68, 68, 0.24), transparent 0 18%), radial-gradient(circle at 82% 16%, rgba(59, 130, 246, 0.24), transparent 0 18%), linear-gradient(135deg, #190c10 0%, #1f2937 50%, #0f172a 100%);
}

body.safe-games-body[data-game="hangman"] {
  --game-bg: radial-gradient(circle at 12% 18%, rgba(20, 184, 166, 0.24), transparent 0 18%), radial-gradient(circle at 86% 14%, rgba(245, 158, 11, 0.22), transparent 0 18%), linear-gradient(135deg, #06111d 0%, #0f172a 50%, #1f2937 100%);
}

body.safe-games-body[data-game="snake"] {
  --game-bg: radial-gradient(circle at 14% 14%, rgba(34, 197, 94, 0.28), transparent 0 18%), radial-gradient(circle at 84% 20%, rgba(22, 163, 74, 0.22), transparent 0 18%), linear-gradient(135deg, #06140c 0%, #0f172a 55%, #052e16 100%);
}

body.safe-games-body[data-game="tile2048"] {
  --game-bg: radial-gradient(circle at 14% 14%, rgba(250, 204, 21, 0.24), transparent 0 18%), radial-gradient(circle at 84% 20%, rgba(251, 146, 60, 0.22), transparent 0 18%), linear-gradient(135deg, #17110b 0%, #1f2937 50%, #431407 100%);
}

body.safe-games-body[data-game="battleships"] {
  --game-bg: radial-gradient(circle at 14% 14%, rgba(56, 189, 248, 0.26), transparent 0 18%), radial-gradient(circle at 84% 20%, rgba(96, 165, 250, 0.22), transparent 0 18%), linear-gradient(135deg, #04111f 0%, #0f172a 50%, #172554 100%);
}

body.safe-games-body[data-game="dotsBoxes"] {
  --game-bg: radial-gradient(circle at 14% 14%, rgba(244, 114, 182, 0.24), transparent 0 18%), radial-gradient(circle at 84% 20%, rgba(59, 130, 246, 0.22), transparent 0 18%), linear-gradient(135deg, #0b1020 0%, #1f2937 50%, #1e1b4b 100%);
}

a { color: inherit; }

.games-header {
  background: linear-gradient(135deg, rgba(4, 8, 20, 0.92), rgba(15, 23, 42, 0.86));
  color: #fff;
  padding: 0.95rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.35);
  border-bottom: 1px solid rgba(96, 165, 250, 0.18);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.games-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.15rem;
}

.header-links {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.games-link-btn,
.primary-btn,
.secondary-btn {
  text-decoration: none;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.games-link-btn,
.primary-btn {
  background: linear-gradient(135deg, #67e8f9, #2563eb);
  color: #04111f;
  border: 1px solid rgba(147, 231, 255, 0.65);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
}

.games-link-btn.alt,
.secondary-btn {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.96));
  color: #f8fbff;
  border: 1px solid rgba(125, 211, 252, 0.45);
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.3);
}

.primary-btn:hover,
.secondary-btn:hover,
.games-link-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.games-hub-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.hub-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  margin-bottom: 1rem;
}

.hub-banner-copy p {
  max-width: 720px;
}

.hub-banner-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.games-eyebrow {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--game-accent);
}

.games-hero h1,
.game-shell h1 {
  margin: 0 0 0.55rem;
  color: #0f172a;
  font-size: clamp(2rem, 4vw, 3rem);
}

.games-hero p,
.game-shell p {
  margin: 0;
  color: #475569;
}

.games-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.games-pill-row,
.badge-row,
.menu-chip-row,
.action-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.badge-row {
  margin-top: 0.8rem;
}

.games-pill,
.game-badge,
.menu-chip {
  background: #fff;
  border: 1px solid #dbe7f2;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--game-accent);
}

.save-panel,
.game-shell,
.games-section,
.category-block {
  background: #fff;
  border: 1px solid #dbe7f2;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.07);
  margin-bottom: 1rem;
}

.save-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.save-panel h2,
.section-heading h2 {
  margin: 0 0 0.2rem;
  color: #0f172a;
  font-size: 1.2rem;
}

.save-panel p,
.section-heading p {
  margin: 0;
  color: #475569;
}

.save-subtext {
  margin-top: 0.3rem !important;
  color: #64748b !important;
  font-size: 0.9rem;
}

.games-section {
  padding: 1rem;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.section-note {
  font-size: 0.9rem;
  color: var(--game-accent) !important;
  font-weight: 700;
}

.favourite-row,
.menu-scroll-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scroll-snap-type: x proximity;
}

.favourite-row::-webkit-scrollbar,
.menu-scroll-row::-webkit-scrollbar {
  height: 10px;
}

.favourite-row::-webkit-scrollbar-thumb,
.menu-scroll-row::-webkit-scrollbar-thumb {
  background: #c8d8ea;
  border-radius: 999px;
}

.empty-favourite,
.favourite-shortcut {
  min-width: min(280px, 82vw);
  scroll-snap-align: start;
}

.empty-favourite {
  border: 1px dashed #bfd4e8;
  background: #f8fbff;
  border-radius: 14px;
  padding: 0.95rem 1rem;
  color: #47627b;
}

.favourite-shortcut {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  background: linear-gradient(135deg, #fff8e1, #fff);
  border: 1px solid #f5d78e;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.14);
}

.favourite-shortcut-title {
  font-weight: 800;
  color: #8a5a00;
}

.favourite-shortcut-meta {
  color: #475569;
  font-size: 0.88rem;
}

.category-block {
  padding: 0.9rem;
}

.category-header {
  margin-bottom: 0.8rem;
}

.category-header h3 {
  margin: 0 0 0.2rem;
  color: #0f172a;
  font-size: 1.05rem;
}

.category-header p {
  margin: 0;
  color: #5b7086;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.menu-card {
  position: relative;
  flex: 0 0 min(320px, 86vw);
  min-width: min(320px, 86vw);
  background: #fff;
  border: 1px solid #dbe7f2;
  border-radius: 16px;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
  scroll-snap-align: start;
}

.menu-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}

.menu-card.is-favourite {
  border-color: #f5b942;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.16);
}

.menu-card-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  height: 100%;
}

.favourite-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(15, 23, 42, 0.58);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.favourite-btn.active {
  background: #f59e0b;
  color: #fff;
  border-color: #f8d48a;
}

.menu-art {
  min-height: 148px;
  border-radius: 16px;
  display: flex;
  align-items: flex-end;
  padding: 0.85rem;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.03em;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 12px 24px rgba(2, 6, 23, 0.16);
}

.menu-art::before {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  width: 3.8rem;
  height: 3.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 10px 24px rgba(15, 23, 42, 0.18);
  font-size: 2rem;
  z-index: 1;
}

.menu-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.72));
}

.menu-art span {
  position: relative;
  z-index: 1;
  font-size: 0.98rem;
  text-shadow: 0 2px 8px rgba(15, 23, 42, 0.42);
}

.art-colour {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.34), transparent 0 14%), linear-gradient(135deg, #2563eb, #7c3aed 52%, #ec4899);
}
.art-colour::before { content: '🔷'; }

.art-pair {
  background-image: radial-gradient(circle at 18% 18%, rgba(255,255,255,0.28), transparent 0 14%), linear-gradient(135deg, #22c55e, #10b981 45%, #db2777);
}
.art-pair::before { content: '🪴'; }

.art-spark {
  background-image: radial-gradient(circle at 20% 22%, rgba(255,255,255,0.3), transparent 0 12%), linear-gradient(135deg, #f59e0b, #f97316 45%, #2563eb);
}
.art-spark::before { content: '⚡'; }

.art-star {
  background-image: radial-gradient(circle at 50% 20%, rgba(255,255,255,0.32), transparent 0 12%), linear-gradient(135deg, #0f172a, #4338ca 48%, #f59e0b);
}
.art-star::before { content: '⭐'; }

.art-number {
  background-image: radial-gradient(circle at 18% 20%, rgba(255,255,255,0.26), transparent 0 14%), linear-gradient(135deg, #059669, #0ea5e9 45%, #2563eb);
}
.art-number::before { content: '123'; font-size: 1.35rem; font-weight: 900; }

.art-word {
  background-image: radial-gradient(circle at 18% 18%, rgba(255,255,255,0.28), transparent 0 14%), linear-gradient(135deg, #0f766e, #4338ca 55%, #8b5cf6);
}
.art-word::before { content: 'ABC'; font-size: 1.25rem; font-weight: 900; }

.art-colouring {
  background-image: radial-gradient(circle at 18% 18%, rgba(255,255,255,0.32), transparent 0 14%), linear-gradient(135deg, #ec4899, #8b5cf6 45%, #06b6d4);
}
.art-colouring::before { content: '🎨'; }

.art-river {
  background-image: radial-gradient(circle at 18% 18%, rgba(255,255,255,0.28), transparent 0 14%), linear-gradient(135deg, #0284c7, #2563eb 40%, #16a34a);
}
.art-river::before { content: '🦆'; }

.art-maze {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.24), transparent 0 14%), linear-gradient(135deg, #14b8a6, #0f172a 44%, #4f46e5);
}
.art-maze::before { content: '🧩'; }

.art-tic {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.24), transparent 0 14%), linear-gradient(135deg, #2563eb, #0f172a 48%, #ec4899);
}
.art-tic::before { content: 'XO'; font-size: 1.2rem; font-weight: 900; }

.art-connect {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.24), transparent 0 14%), linear-gradient(135deg, #f59e0b, #2563eb 48%, #1d4ed8);
}
.art-connect::before { content: '●●'; font-size: 1.15rem; letter-spacing: 0.08rem; }

.art-rps {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.24), transparent 0 14%), linear-gradient(135deg, #10b981, #0f172a 48%, #8b5cf6);
}
.art-rps::before { content: '✊'; }

.art-checkers {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.24), transparent 0 14%), linear-gradient(135deg, #ef4444, #0f172a 48%, #2563eb);
}
.art-checkers::before { content: '♟'; }

.art-hangman {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.24), transparent 0 14%), linear-gradient(135deg, #14b8a6, #0f172a 48%, #f59e0b);
}
.art-hangman::before { content: 'A_Z'; font-size: 1rem; font-weight: 900; }

.art-snake {
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.24), transparent 0 14%), linear-gradient(135deg, #22c55e, #0f172a 48%, #16a34a);
}
.art-snake::before { content: '🐍'; }

.menu-card-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.menu-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0f2fe, #dcfce7);
  color: var(--game-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.menu-card h2 {
  margin: 0 0 0.2rem;
  color: #0f172a;
  font-size: 1.05rem;
}

.menu-card p {
  margin: 0;
  color: #475569;
}

.menu-progress {
  border-radius: 10px;
  background: #f8fbff;
  border: 1px solid #dbe7f2;
  padding: 0.7rem 0.8rem;
  font-size: 0.88rem;
}

.menu-open {
  color: var(--game-accent);
  font-weight: 800;
  font-size: 0.88rem;
}

.game-shell {
  position: relative;
  overflow: hidden;
}

.game-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 0 36%),
    radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.12), transparent 0 32%);
}

.game-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.06), transparent 24%, transparent 76%, rgba(255,255,255,0.04)),
    radial-gradient(circle at 82% 12%, rgba(103,232,249,0.1), transparent 0 18%);
  opacity: 0.8;
}

.game-shell > * {
  position: relative;
  z-index: 1;
}

body.safe-games-body[data-game] .game-shell {
  background: linear-gradient(180deg, rgba(9, 14, 30, 0.92), rgba(12, 18, 36, 0.86));
  border: 1px solid rgba(96, 165, 250, 0.16);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.24);
}

body.safe-games-body[data-game] .game-shell h1,
body.safe-games-body[data-game] .game-shell h2,
body.safe-games-body[data-game] .game-shell h3,
body.safe-games-body[data-game] .clue-box h3,
body.safe-games-body[data-game] .game-control-field span {
  color: #f8fbff;
}

body.safe-games-body[data-game] .game-shell p,
body.safe-games-body[data-game] .clue-box p,
body.safe-games-body[data-game] .games-footer {
  color: #cbd5e1;
}

body.safe-games-body[data-game] .games-eyebrow {
  color: #67e8f9;
}

body.safe-games-body[data-game] .game-badge,
body.safe-games-body[data-game] .games-pill {
  background: rgba(15, 23, 42, 0.76);
  border-color: rgba(125, 211, 252, 0.18);
  color: #e0f2fe;
}

body.safe-games-body[data-game] .game-select {
  background: rgba(15, 23, 42, 0.88);
  color: #f8fbff;
  border-color: rgba(125, 211, 252, 0.24);
}

.classic-side-panel .action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.classic-side-panel .action-row .primary-btn,
.classic-side-panel .action-row .secondary-btn {
  width: 100%;
}

body[data-games-menu="true"] .hub-banner,
body[data-games-menu="true"] .games-section,
body[data-games-menu="true"] .category-block,
body[data-games-menu="true"] .save-panel {
  background: linear-gradient(180deg, rgba(9, 14, 30, 0.9), rgba(12, 18, 36, 0.82));
  border: 1px solid rgba(96, 165, 250, 0.16);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.24);
}

body[data-games-menu="true"] .save-panel {
  margin-top: 1rem;
}

body[data-games-menu="true"] .games-eyebrow,
body[data-games-menu="true"] .section-note {
  color: #67e8f9 !important;
}

body[data-games-menu="true"] h1,
body[data-games-menu="true"] h2,
body[data-games-menu="true"] h3,
body[data-games-menu="true"] .menu-card h2,
body[data-games-menu="true"] .save-panel h2 {
  color: #f8fbff;
}

body[data-games-menu="true"] p,
body[data-games-menu="true"] .category-header p,
body[data-games-menu="true"] .save-panel p,
body[data-games-menu="true"] .menu-card p,
body[data-games-menu="true"] .menu-progress,
body[data-games-menu="true"] .empty-favourite {
  color: #cbd5e1;
}

body[data-games-menu="true"] .games-pill,
body[data-games-menu="true"] .menu-chip {
  background: rgba(15, 23, 42, 0.76);
  border-color: rgba(125, 211, 252, 0.18);
  color: #e0f2fe;
}

body[data-games-menu="true"] .menu-card {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(10, 15, 30, 0.96));
  border-color: rgba(96, 165, 250, 0.15);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.26);
}

body[data-games-menu="true"] .menu-progress,
body[data-games-menu="true"] .empty-favourite {
  background: rgba(15, 23, 42, 0.66);
  border-color: rgba(125, 211, 252, 0.14);
}

body[data-games-menu="true"] .menu-open {
  color: #7dd3fc;
}

body[data-games-menu="true"] .favourite-shortcut {
  background: linear-gradient(135deg, rgba(253, 224, 71, 0.16), rgba(30, 41, 59, 0.86));
  border-color: rgba(250, 204, 21, 0.24);
}

body[data-games-menu="true"] {
  --game-accent: #60a5fa;
  --game-accent-2: #a78bfa;
  --game-bg:
    radial-gradient(circle at 12% 16%, rgba(34, 211, 238, 0.24), transparent 0 17%),
    radial-gradient(circle at 86% 14%, rgba(168, 85, 247, 0.2), transparent 0 18%),
    linear-gradient(135deg, #040816 0%, #0b1225 45%, #111827 100%);
}

body[data-game="colourTrail"] {
  --game-accent: #2563eb;
  --game-accent-2: #7c3aed;
  --game-bg:
    radial-gradient(circle at 15% 18%, rgba(96, 165, 250, 0.34), transparent 0 18%),
    radial-gradient(circle at 80% 18%, rgba(236, 72, 153, 0.22), transparent 0 16%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 50%, #7c3aed 100%);
}

body[data-game="steadySpark"] {
  --game-accent: #d97706;
  --game-accent-2: #2563eb;
  --game-bg:
    radial-gradient(circle at 18% 16%, rgba(251, 191, 36, 0.28), transparent 0 16%),
    radial-gradient(circle at 86% 20%, rgba(59, 130, 246, 0.24), transparent 0 18%),
    linear-gradient(135deg, #1f2937 0%, #ea580c 45%, #2563eb 100%);
}

body[data-game="numberPath"] {
  --game-accent: #059669;
  --game-accent-2: #2563eb;
  --game-bg:
    radial-gradient(circle at 16% 16%, rgba(52, 211, 153, 0.28), transparent 0 16%),
    radial-gradient(circle at 84% 18%, rgba(59, 130, 246, 0.2), transparent 0 18%),
    linear-gradient(135deg, #052e2b 0%, #059669 44%, #2563eb 100%);
}

body[data-game="pairGarden"] {
  --game-accent: #db2777;
  --game-accent-2: #16a34a;
  --game-bg:
    radial-gradient(circle at 16% 18%, rgba(244, 114, 182, 0.28), transparent 0 16%),
    radial-gradient(circle at 84% 20%, rgba(74, 222, 128, 0.2), transparent 0 18%),
    linear-gradient(135deg, #3f0d2a 0%, #db2777 48%, #16a34a 100%);
}

body[data-game="starCount"] {
  --game-accent: #f59e0b;
  --game-accent-2: #7c3aed;
  --game-bg:
    radial-gradient(circle at 18% 16%, rgba(250, 204, 21, 0.24), transparent 0 15%),
    radial-gradient(circle at 82% 18%, rgba(196, 181, 253, 0.2), transparent 0 17%),
    linear-gradient(135deg, #020617 0%, #312e81 48%, #f59e0b 100%);
}

body[data-game="wordGarden"] {
  --game-accent: #0f766e;
  --game-accent-2: #4338ca;
  --game-bg:
    radial-gradient(circle at 14% 18%, rgba(45, 212, 191, 0.22), transparent 0 16%),
    radial-gradient(circle at 82% 18%, rgba(129, 140, 248, 0.2), transparent 0 18%),
    linear-gradient(135deg, #052e2b 0%, #0f766e 45%, #4338ca 100%);
}

body[data-game="colourStudio"] {
  --game-accent: #db2777;
  --game-accent-2: #0ea5e9;
  --game-bg:
    radial-gradient(circle at 15% 18%, rgba(244, 114, 182, 0.25), transparent 0 15%),
    radial-gradient(circle at 80% 16%, rgba(34, 211, 238, 0.22), transparent 0 18%),
    linear-gradient(135deg, #3b0764 0%, #ec4899 46%, #06b6d4 100%);
}

body[data-game="mazeEscape"] {
  --game-accent: #14b8a6;
  --game-accent-2: #4f46e5;
  --game-bg:
    radial-gradient(circle at 15% 16%, rgba(45, 212, 191, 0.24), transparent 0 15%),
    radial-gradient(circle at 82% 18%, rgba(129, 140, 248, 0.22), transparent 0 18%),
    linear-gradient(135deg, #0f172a 0%, #134e4a 40%, #4f46e5 100%);
}

body[data-game="riverRescue"] {
  --game-accent: #0284c7;
  --game-accent-2: #16a34a;
  --game-bg:
    radial-gradient(circle at 14% 18%, rgba(125, 211, 252, 0.24), transparent 0 16%),
    radial-gradient(circle at 84% 16%, rgba(74, 222, 128, 0.18), transparent 0 18%),
    linear-gradient(135deg, #082f49 0%, #0284c7 40%, #14532d 100%);
}

body[data-game="colourTrail"] .game-shell {
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(238,246,255,0.93));
}

body[data-game="steadySpark"] .game-shell {
  background: linear-gradient(135deg, rgba(255,253,240,0.96), rgba(238,248,255,0.93));
}

body[data-game="numberPath"] .game-shell {
  background: linear-gradient(135deg, rgba(248,255,251,0.96), rgba(238,246,255,0.93));
}

body[data-game="pairGarden"] .game-shell {
  background: linear-gradient(135deg, rgba(255,250,245,0.96), rgba(241,255,247,0.93));
}

body[data-game="starCount"] .game-shell {
  background: linear-gradient(135deg, rgba(255,248,251,0.96), rgba(244,247,255,0.93));
}

body[data-game="wordGarden"] .game-shell {
  background: linear-gradient(135deg, rgba(248,255,247,0.96), rgba(245,247,255,0.93));
}

body[data-game="colourStudio"] .game-shell {
  background: linear-gradient(135deg, rgba(255,250,252,0.97), rgba(240,250,255,0.94));
}

body[data-game="mazeEscape"] .game-shell {
  background: linear-gradient(135deg, rgba(240,255,252,0.96), rgba(243,245,255,0.93));
}

body[data-game="riverRescue"] .game-shell {
  background: linear-gradient(135deg, rgba(242,251,255,0.96), rgba(248,255,246,0.93));
}

.save-banner,
.status-box,
.clue-box,
.wide-display {
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  padding: 0.85rem 0.9rem;
  background: rgba(8, 13, 25, 0.72);
  box-shadow: 0 12px 26px rgba(2, 6, 23, 0.18);
  backdrop-filter: blur(14px);
}

.save-banner {
  color: #bfdbfe;
  border-color: rgba(103, 232, 249, 0.22);
}

.save-banner strong {
  color: #f8fbff;
}

.status-box {
  color: #f8fbff;
  min-height: 58px;
  font-weight: 600;
  line-height: 1.5;
  border-left: 3px solid var(--game-accent);
  background: linear-gradient(135deg, rgba(14, 23, 42, 0.84), rgba(20, 32, 58, 0.78));
}

.wide-display {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #f8fbff;
  word-break: break-word;
}

.clue-box {
  color: #cbd5e1;
  font-size: 0.92rem;
}

.game-board-grid,
.colour-grid {
  display: grid;
  gap: 0.6rem;
}

.game-board-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.colour-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.game-tile,
.trail-btn {
  min-height: 74px;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.game-tile:hover,
.trail-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.game-tile.active-tile {
  background: linear-gradient(135deg, #facc15, #fb923c);
  border-color: #f59e0b;
  color: #7c2d12;
}

.game-tile.correct-tile {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.trail-btn {
  color: #fff;
  border: none;
}

.trail-btn.lit {
  box-shadow: 0 0 0 4px rgba(255,255,255,0.8), 0 0 0 8px rgba(11, 95, 168, 0.28);
}

.trail-blue { background: #2563eb; }
.trail-green { background: #16a34a; }
.trail-orange { background: #ea580c; }
.trail-purple { background: #7c3aed; }

.colouring-shell,
.maze-shell,
.river-shell {
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.22);
}

.colouring-hero-panel,
.maze-hero-panel,
.river-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.85fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.colouring-hero-art,
.maze-hero-art,
.river-hero-art {
  min-height: 150px;
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  align-items: flex-end;
  color: #fff;
  font-weight: 800;
}

.colouring-hero-art {
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,0.28), transparent 0 14%),
    linear-gradient(135deg, #ec4899, #8b5cf6 48%, #06b6d4);
}

.maze-hero-art {
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,0.22), transparent 0 14%),
    linear-gradient(135deg, #14b8a6, #0f172a 44%, #4f46e5);
}

.river-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.85fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.river-hero-art {
  min-height: 150px;
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  align-items: flex-end;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,0.24), transparent 0 14%),
    linear-gradient(135deg, #0284c7, #2563eb 44%, #16a34a);
  color: #fff;
  font-weight: 800;
}

.level-selector {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.4rem;
  margin: 0.75rem 0 1rem;
}

.colouring-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  overflow: visible;
}

.level-chip {
  min-width: 74px;
  border-radius: 12px;
  border: 1px solid #cfe0ef;
  background: #fff;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-weight: 800;
  cursor: pointer;
}

.level-chip span {
  font-size: 0.74rem;
  color: #5b7086;
}

.level-chip.current {
  border-color: var(--game-accent);
  box-shadow: 0 10px 22px rgba(2, 132, 199, 0.16);
}

.level-chip.completed {
  background: linear-gradient(135deg, #fff8df, #ffffff);
}

.level-chip.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.colouring-layout,
.maze-layout,
.river-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.colouring-canvas-wrap,
.maze-board-wrap,
.river-board-wrap {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(189, 219, 244, 0.8);
  border-radius: 16px;
  padding: 0.9rem;
  backdrop-filter: blur(10px);
}

.river-board-wrap {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(189, 219, 244, 0.8);
  border-radius: 16px;
  padding: 0.9rem;
  backdrop-filter: blur(10px);
}

.colouring-side-panel h3,
.maze-side-panel h3,
.river-side-panel h3 {
  margin: 0 0 0.55rem;
  color: #0f172a;
}

.maze-controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.river-tip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.river-tip-list span {
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.1);
  color: var(--game-accent);
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.colouring-picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0 0.35rem;
  color: #334155;
}

.colouring-picker-bar strong {
  display: block;
  color: #0f172a;
  font-size: 1rem;
}

.colouring-picker-bar p {
  margin-top: 0.15rem;
}

.colour-sheet-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(247,250,255,0.95));
  border: 1px solid #dbe7f2;
  border-radius: 16px;
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.colour-sheet-card.active {
  border-color: var(--game-accent);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12), 0 16px 28px rgba(15, 23, 42, 0.12);
  transform: translateY(-2px);
}

.colour-sheet-card.completed {
  background: linear-gradient(135deg, #fff8df, #ffffff);
}

.colour-sheet-thumb {
  border-radius: 12px;
  border: 1px solid #dbe7f2;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  overflow: hidden;
}

.colour-sheet-thumb svg {
  display: block;
  width: 100%;
  height: auto;
}

.colour-sheet-card-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
}

.colour-sheet-card-copy strong {
  color: #0f172a;
}

.colour-sheet-card-copy span {
  color: #64748b;
  font-size: 0.82rem;
}

.colouring-sheet-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
  color: #334155;
}

.colouring-sheet-meta strong {
  font-size: 1.05rem;
  color: #0f172a;
}

.colouring-sheet-meta span {
  font-size: 0.92rem;
}

.colouring-canvas {
  --colour-zoom: 1;
  margin-top: 0.85rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,250,252,0.96));
  border: 1px solid #dbe7f2;
  border-radius: 16px;
  padding: 0.85rem;
}

.colouring-zoom-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.colour-tool-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.colour-tool-row .secondary-btn.active {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  border-color: transparent;
}

.sticker-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.sticker-choice {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #dbe7f2;
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.sticker-choice.active {
  border-color: var(--game-accent);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12);
}

.classic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 320px);
  gap: 1rem;
  align-items: start;
  margin-top: 0.9rem;
}

.classic-layout > div:first-child {
  border-radius: 18px;
  border: 1px solid rgba(125, 211, 252, 0.16);
  background: linear-gradient(180deg, rgba(5, 10, 20, 0.42), rgba(11, 19, 34, 0.28));
  padding: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.classic-side-panel {
  display: grid;
  gap: 0.8rem;
  position: sticky;
  top: 5.6rem;
  border-radius: 18px;
  border: 1px solid rgba(125, 211, 252, 0.16);
  background: linear-gradient(180deg, rgba(9, 14, 30, 0.82), rgba(12, 18, 36, 0.72));
  padding: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 24px rgba(2, 6, 23, 0.16);
}

.game-control-field {
  display: grid;
  gap: 0.3rem;
}

.game-control-field span {
  font-weight: 800;
  color: #0f172a;
}

.game-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 0.7rem 0.8rem;
  font: inherit;
  background: #fff;
  color: #0f172a;
}

.ttt-board,
.connect-board,
.battle-board,
.dots-board,
.tile2048-board,
.snake-board {
  user-select: none;
}

.ttt-cell,
.connect-drop-btn,
.rps-choice-btn,
.hangman-keyboard button,
.battle-cell,
.dots-line,
.tile2048-cell {
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
  touch-action: manipulation;
}

.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.games-link-btn:focus-visible,
.game-select:focus-visible,
.ttt-cell:focus-visible,
.connect-drop-btn:focus-visible,
.rps-choice-btn:focus-visible,
.hangman-keyboard button:focus-visible,
.battle-cell:focus-visible,
.dots-line:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 2px;
}

.ttt-cell:hover:not(:disabled),
.connect-drop-btn:hover:not(:disabled),
.rps-choice-btn:hover:not(:disabled),
.hangman-keyboard button:hover:not(:disabled),
.battle-cell:hover:not(:disabled),
.dots-line:hover:not(:disabled),
.tile2048-cell:hover:not([data-value="0"]) {
  transform: translateY(-2px);
  filter: brightness(1.02);
}

.ttt-cell:disabled,
.connect-drop-btn:disabled,
.hangman-keyboard button:disabled,
.battle-cell:disabled,
.dots-line:disabled {
  cursor: not-allowed;
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.ttt-cell {
  min-height: 92px;
  border-radius: 18px;
  border: 1px solid #dbe7f2;
  background: linear-gradient(135deg, #ffffff, #eef4ff);
  color: #2563eb;
  font-size: 2.1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.ttt-cell.o {
  color: #db2777;
}

.ttt-cell.win {
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.42), 0 14px 28px rgba(250, 204, 21, 0.18);
  transform: translateY(-1px) scale(1.03);
}

.connect-drop-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.connect-drop-btn {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: linear-gradient(135deg, #f8fbff, #e0edff);
  color: #2563eb;
  font-weight: 900;
  cursor: pointer;
}

.connect-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding: 0.55rem;
  border-radius: 22px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8 60%, #1e3a8a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 14px 28px rgba(37, 99, 235, 0.2);
}

.connect-slot {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(8, 15, 37, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.connect-disc {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.16), inset 0 -8px 12px rgba(15,23,42,0.14);
}

.connect-disc.disc-win {
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.88), inset 0 2px 6px rgba(255,255,255,0.16), inset 0 -8px 12px rgba(15,23,42,0.14);
  transform: scale(1.07);
}

.disc-empty {
  background: rgba(255,255,255,0.92);
}

.disc-red {
  background: linear-gradient(135deg, #f87171, #dc2626);
}

.disc-yellow {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
}

.rps-stage {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.85rem;
}

.rps-round-view {
  min-height: 92px;
  border-radius: 18px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
  color: #0f172a;
  font-weight: 800;
  font-size: 1.02rem;
  border: 1px solid rgba(125, 211, 252, 0.18);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.rps-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.rps-choice-btn {
  min-height: 92px;
  border-radius: 18px;
  border: 1px solid #dbe7f2;
  background: linear-gradient(135deg, #ffffff, #eef4ff);
  color: #0f172a;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.rps-choice-btn strong {
  display: block;
  font-size: 1.85rem;
  margin-bottom: 0.25rem;
}

.ttt-board[data-theme="neon"] .ttt-cell,
.rps-choice-grid[data-theme="neon"] .rps-choice-btn,
.rps-stage[data-theme="neon"] .rps-round-view {
  background: linear-gradient(135deg, #0f172a, #111827);
  color: #67e8f9;
  border-color: rgba(103,232,249,0.35);
}

.ttt-board[data-theme="sunset"] .ttt-cell,
.rps-choice-grid[data-theme="sunset"] .rps-choice-btn,
.rps-stage[data-theme="sunset"] .rps-round-view {
  background: linear-gradient(135deg, #fff7ed, #ffe4e6);
  color: #9a3412;
  border-color: rgba(251,146,60,0.28);
}

.connect-board[data-theme="neon"] {
  background: linear-gradient(135deg, #0f172a, #1d4ed8 60%, #7c3aed);
}

.connect-board[data-theme="sunset"] {
  background: linear-gradient(135deg, #f97316, #fb7185 60%, #f59e0b);
}

.checkers-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0;
  margin-top: 0.85rem;
  border-radius: 22px;
  overflow: hidden;
  border: 10px solid #7c4a21;
  box-shadow: 0 18px 36px rgba(15,23,42,0.12);
}

.checkers-board[data-theme="neon"] {
  border-color: #0f172a;
}

.checkers-board[data-theme="sunset"] {
  border-color: #c2410c;
}

.checkers-square {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.checkers-square.light {
  background: #f8fafc;
}

.checkers-square.dark {
  background: #93c5fd;
}

.checkers-board[data-theme="neon"] .checkers-square.light {
  background: #0f172a;
}

.checkers-board[data-theme="neon"] .checkers-square.dark {
  background: #1d4ed8;
}

.checkers-board[data-theme="sunset"] .checkers-square.light {
  background: #ffedd5;
}

.checkers-board[data-theme="sunset"] .checkers-square.dark {
  background: #fb923c;
}

.checkers-square.selected {
  box-shadow: inset 0 0 0 4px rgba(250,204,21,0.65);
}

.checkers-square.selected .checkers-piece {
  transform: scale(1.08);
}

.checkers-square.move-target {
  box-shadow: inset 0 0 0 4px rgba(34,197,94,0.65);
}

.checkers-piece {
  width: 74%;
  height: 74%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.24), inset 0 -8px 12px rgba(15,23,42,0.18), 0 8px 18px rgba(15,23,42,0.14);
}

.checkers-piece.red {
  background: linear-gradient(135deg, #f87171, #dc2626);
}

.checkers-piece.blue {
  background: linear-gradient(135deg, #60a5fa, #1d4ed8);
}

.checkers-piece.king::after {
  content: '★';
  font-size: 1rem;
}

.hangman-word {
  min-height: 72px;
  margin-top: 0.85rem;
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
  color: #0f172a;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.22rem;
  text-align: center;
}

.hangman-keyboard {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.hangman-keyboard button {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #dbe7f2;
  background: linear-gradient(135deg, #ffffff, #eef4ff);
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}

.hangman-keyboard button:disabled {
  opacity: 0.56;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #64748b;
}

.snake-board {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 0.2rem;
  margin-top: 0.85rem;
  padding: 0.45rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.12), 0 14px 28px rgba(2, 6, 23, 0.24);
}

.snake-board[data-theme="neon"] {
  background: linear-gradient(135deg, #020617, #312e81);
}

.snake-board[data-theme="sunset"] {
  background: linear-gradient(135deg, #9a3412, #7c2d12);
}

.snake-cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
}

.snake-cell.head {
  background: linear-gradient(135deg, #86efac, #22c55e);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.28), 0 0 10px rgba(34,197,94,0.42);
}

.snake-cell.body {
  background: linear-gradient(135deg, #4ade80, #16a34a);
}

.snake-cell.food {
  background: linear-gradient(135deg, #facc15, #f97316);
}

.tile2048-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding: 0.55rem;
  border-radius: 20px;
  background: linear-gradient(135deg, #8b5e34, #6b4423);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 18px 36px rgba(15,23,42,0.12);
  touch-action: none;
}

.tile2048-board[data-theme="neon"] {
  background: linear-gradient(135deg, #0f172a, #312e81);
}

.tile2048-board[data-theme="sunset"] {
  background: linear-gradient(135deg, #c2410c, #fb7185);
}

.tile2048-cell {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 900;
  background: rgba(255,255,255,0.26);
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.tile2048-cell[data-value="0"] { background: rgba(255,255,255,0.14); color: transparent; }
.tile2048-cell[data-value="2"] { background: #f8fafc; color: #334155; }
.tile2048-cell[data-value="4"] { background: #fef3c7; color: #92400e; }
.tile2048-cell[data-value="8"] { background: #fdba74; color: #7c2d12; }
.tile2048-cell[data-value="16"] { background: #fb923c; color: #fff7ed; }
.tile2048-cell[data-value="32"] { background: #f97316; color: #fff7ed; }
.tile2048-cell[data-value="64"] { background: #ef4444; color: #fff; }
.tile2048-cell[data-value="128"] { background: #facc15; color: #713f12; font-size: 1.2rem; }
.tile2048-cell[data-value="256"] { background: #eab308; color: #713f12; font-size: 1.2rem; }
.tile2048-cell[data-value="512"] { background: #84cc16; color: #1f2937; font-size: 1.15rem; }
.tile2048-cell[data-value="1024"] { background: #38bdf8; color: #082f49; font-size: 1rem; }
.tile2048-cell[data-value="2048"] { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #78350f; font-size: 1rem; }

.battle-grid-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.85rem;
}

.battle-grid-wrap > div {
  border-radius: 16px;
  border: 1px solid rgba(125, 211, 252, 0.14);
  background: linear-gradient(180deg, rgba(7, 12, 24, 0.32), rgba(11, 19, 34, 0.18));
  padding: 0.7rem;
}

.battle-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding: 0.55rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #0f4c81, #1d4ed8 65%, #172554);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 18px 36px rgba(15,23,42,0.12);
}

.battle-board[data-theme="neon"] {
  background: linear-gradient(135deg, #0f172a, #312e81 65%, #06b6d4);
}

.battle-board[data-theme="sunset"] {
  background: linear-gradient(135deg, #7c2d12, #ea580c 65%, #fb7185);
}

.battle-cell {
  aspect-ratio: 1 / 1;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(147, 197, 253, 0.32);
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(219,234,254,0.92));
  color: #0f172a;
  font-weight: 900;
  cursor: pointer;
}

.battle-cell.ship {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
}

.battle-cell.hit {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.5);
}

.battle-cell.miss {
  background: linear-gradient(135deg, #dbeafe, #93c5fd);
  color: #0f172a;
}

.dots-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.18rem;
  margin-top: 0.85rem;
  padding: 0.55rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #eef2ff, #e0f2fe);
  box-shadow: 0 18px 36px rgba(15,23,42,0.1);
}

.dots-board[data-theme="neon"] {
  background: linear-gradient(135deg, #0f172a, #312e81);
}

.dots-board[data-theme="sunset"] {
  background: linear-gradient(135deg, #fff7ed, #ffe4e6);
}

.dots-dot,
.dots-line,
.dots-box {
  border: none;
}

.dots-dot {
  aspect-ratio: 1 / 1;
  min-height: 12px;
  border-radius: 999px;
  background: #0f172a;
}

.dots-line.horizontal {
  min-width: 40px;
  min-height: 12px;
  align-self: center;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.36);
}

.dots-line.vertical {
  width: 12px;
  min-height: 40px;
  justify-self: center;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.36);
}

.dots-line.active {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18);
}

.dots-box {
  aspect-ratio: 1 / 1;
  min-height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,0.58);
  color: #0f172a;
  font-weight: 900;
}

.dots-box.player-a {
  background: linear-gradient(135deg, #bfdbfe, #93c5fd);
  color: #1d4ed8;
}

.dots-box.player-b {
  background: linear-gradient(135deg, #fecdd3, #fda4af);
  color: #be123c;
}

.zoom-readout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(219, 39, 119, 0.08);
  color: var(--game-accent);
  font-weight: 800;
  padding: 0.5rem 0.75rem;
}

.colouring-viewport {
  overflow: auto;
  max-height: 72vh;
  padding: 0.35rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  border: 1px solid #dbe7f2;
}

.colouring-stage {
  min-width: max-content;
  display: flex;
  justify-content: center;
  padding: 0.5rem 0.2rem 1rem;
}

.colouring-stage-inner {
  position: relative;
  width: 320px;
  height: 220px;
  transform: scale(var(--colour-zoom));
  transform-origin: top center;
  transition: transform 0.12s ease;
}

.colouring-svg,
.colouring-brush-layer,
.colouring-sticker-layer {
  position: absolute;
  inset: 0;
  width: 320px;
  height: 220px;
}

.colouring-svg {
  display: block;
}

.colouring-brush-layer {
  pointer-events: none;
}

.colouring-sticker-layer {
  pointer-events: none;
}

.placed-sticker {
  position: absolute;
  font-size: 1.15rem;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.25));
}

.paint-region {
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
  touch-action: none;
}

.paint-region:hover,
.paint-region:focus {
  filter: brightness(0.95) saturate(1.06);
}

.colour-palette {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.colour-swatch {
  min-height: 50px;
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  padding: 0.25rem;
  font-weight: 800;
  color: #fff;
}

.colour-swatch span {
  font-size: 0.68rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.36);
  padding: 0.12rem 0.4rem;
}

.colour-swatch.active {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.16), 0 12px 22px rgba(15, 23, 42, 0.12);
}

.maze-board,
.river-board {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.maze-board {
  user-select: none;
  touch-action: none;
}

.maze-tile,
.river-tile {
  min-height: 58px;
  border-radius: 12px;
  border: 2px solid #d5e4ef;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.maze-tile {
  background: rgba(255, 255, 255, 0.92);
}

.maze-tile.wall {
  background: linear-gradient(135deg, #1f2937, #0f172a);
  border-color: #111827;
  cursor: default;
}

.maze-tile.floor {
  background: linear-gradient(135deg, #f8fffd, #eefcf8);
}

.maze-tile.player {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  color: #fff;
  border-color: #2563eb;
}

.maze-tile.exit {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #7c4a03;
  border-color: #f59e0b;
}

.maze-tile.key {
  background: linear-gradient(135deg, #c4b5fd, #7c3aed);
  color: #fff;
  border-color: #7c3aed;
}

.maze-tile.star {
  background: linear-gradient(135deg, #fef3c7, #facc15);
  color: #7c4a03;
  border-color: #f59e0b;
}

.maze-tile.can-move {
  border-color: var(--game-accent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85);
}

.river-board-stage {
  position: relative;
  margin-top: 0.85rem;
  padding: 0.55rem;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(255,255,255,0.16), transparent 0 18%),
    radial-gradient(circle at 78% 78%, rgba(250,204,21,0.09), transparent 0 16%),
    linear-gradient(135deg, #8b5e34, #6f4526 55%, #5a371c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 18px 30px rgba(15,23,42,0.14), 0 18px 36px rgba(15,23,42,0.12);
}

.river-board-stage::before {
  content: '';
  position: absolute;
  inset: 0.5rem;
  border-radius: 22px;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 14%, rgba(255,255,255,0.07), transparent 0 12%),
    radial-gradient(circle at 78% 24%, rgba(187,247,208,0.08), transparent 0 10%),
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(15,23,42,0.08));
  z-index: 0;
}

.river-dirt-canvas,
.river-flow-canvas {
  position: absolute;
  inset: 0.55rem;
  width: calc(100% - 1.1rem);
  height: calc(100% - 1.1rem);
}

.river-dirt-canvas {
  z-index: 2;
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
}

.river-flow-canvas {
  z-index: 3;
  pointer-events: none;
}

.river-board {
  display: block;
  touch-action: none;
  user-select: none;
  gap: 0;
  padding: 0.18rem;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background: transparent;
}

.river-freeform-scene {
  position: relative;
  height: 440px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 10%, rgba(255,255,255,0.36), transparent 0 11%),
    linear-gradient(180deg, #b6ecff 0 62px, #71d4ff 62px 70px, #7fbf68 70px 78px, #8f5b34 78px 100%);
}

.river-freeform-scene::before {
  content: '';
  position: absolute;
  inset: 78px 0 0;
  background:
    radial-gradient(circle at 14% 18%, rgba(255,244,214,0.08), transparent 0 10%),
    radial-gradient(circle at 70% 30%, rgba(255,255,255,0.04), transparent 0 10%),
    linear-gradient(180deg, rgba(84, 49, 22, 0.18), rgba(58, 33, 15, 0.22));
}

.river-scene-label {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(15,23,42,0.12);
}

.river-scene-object,
.river-rock {
  position: absolute;
  z-index: 1;
}

.river-scene-object {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  font-size: 2rem;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.22));
}

.river-scene-object.done {
  opacity: 0.45;
  transform: scale(0.94);
}

.river-source-pipe {
  font-size: 2.2rem;
}

.river-goal-flower {
  font-size: 2.2rem;
}

.river-rock {
  border-radius: 46% 54% 49% 51% / 55% 44% 56% 45%;
  background: linear-gradient(135deg, #8da0b4, #5b6d80 62%, #465667);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.16), inset 0 -10px 12px rgba(15,23,42,0.16), 0 8px 16px rgba(15,23,42,0.14);
}

.river-board.dragging {
  box-shadow: inset 0 0 0 2px rgba(125, 211, 252, 0.55), 0 0 0 3px rgba(125, 211, 252, 0.16);
}

.river-board.boost-flash {
  filter: saturate(1.16) brightness(1.03);
}

.river-tile {
  min-height: 56px;
  border-radius: 0;
  border: none;
  font-size: 1.06rem;
  font-weight: 800;
  cursor: crosshair;
  transition: transform 0.08s ease, filter 0.12s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
}

.river-tile:hover {
  transform: none;
}

.river-tile::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -8px 12px rgba(15,23,42,0.12);
  transition: filter 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  z-index: 0;
}

.river-tile.terrain-1::before {
  border-radius: 10px 8px 9px 7px;
}

.river-tile.terrain-2::before {
  border-radius: 7px 10px 8px 9px;
}

.river-tile.terrain-3::before {
  border-radius: 9px 7px 10px 8px;
}

.river-tile.terrain-4::before {
  border-radius: 8px 9px 7px 10px;
}

.river-tile .river-icon {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.22));
}

.river-tile.dirt::before {
  background:
    radial-gradient(circle at 30% 28%, rgba(255,243,212,0.2), transparent 0 12%),
    linear-gradient(135deg, #c98b54, #8d5932);
}

.river-tile.dug::before {
  background:
    radial-gradient(circle at 30% 24%, rgba(255,250,229,0.45), transparent 0 16%),
    linear-gradient(135deg, #f6dda0, #e2b562);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -10px 12px rgba(146, 64, 14, 0.14);
}

.river-tile.sand::before {
  background: linear-gradient(135deg, #f7e7ba, #efcb7d);
}

.river-tile.dug.sand::before {
  background: linear-gradient(135deg, #fcebbc, #efcf7e);
}

.river-tile.booster::before {
  background: linear-gradient(135deg, #dcf8ff, #a5def7);
}

.river-tile.dug.booster::before {
  background: linear-gradient(135deg, #dcfbff, #bbeeff);
}

.river-tile.spring::before {
  box-shadow: inset 0 0 0 1px rgba(103, 232, 249, 0.42), inset 0 -8px 12px rgba(37,99,235,0.1);
}

.river-tile.duck::before {
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.35), inset 0 -8px 12px rgba(234,179,8,0.08);
}

.river-tile.gate::before {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  box-shadow: inset 0 0 0 1px rgba(71, 85, 105, 0.25), inset 0 -10px 12px rgba(15,23,42,0.12);
}

.river-tile.rock::before {
  background: linear-gradient(135deg, #a5b4c7, #66768a);
}

.river-tile.source::before {
  background: linear-gradient(135deg, #7dd3fc, #2563eb);
}

.river-tile.goal::before {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
}

.river-tile.water::before {
  background: linear-gradient(135deg, rgba(147, 225, 255, 0.46), rgba(37, 99, 235, 0.38));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24), 0 0 18px rgba(56, 189, 248, 0.18);
  animation: riverPulse 0.85s ease-in-out infinite alternate;
}

.river-tile.water.booster::before,
.river-tile.boosted-water::before {
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.54), rgba(59, 130, 246, 0.38), rgba(124, 58, 237, 0.34));
  animation: riverRush 0.5s ease-in-out infinite alternate;
}

.river-tile.sun-mark {
  position: relative;
}

.river-tile.sun-mark::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 0 14px rgba(250, 204, 21, 0.42);
  opacity: 0.6;
  pointer-events: none;
}

@keyframes riverPulse {
  from {
    transform: scale(1);
    filter: saturate(1);
  }
  to {
    transform: scale(1.03);
    filter: saturate(1.15);
  }
}

@keyframes riverRush {
  from {
    transform: scale(1);
    filter: brightness(1);
  }
  to {
    transform: scale(1.04);
    filter: brightness(1.14);
  }
}

.games-footer {
  text-align: center;
  color: rgba(241, 245, 249, 0.92);
  font-size: 0.88rem;
  padding: 1rem 1rem 2rem;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.45);
}

@media (max-width: 900px) {
  .hub-banner,
  .menu-grid,
  .colouring-hero-panel,
  .colouring-layout,
  .river-hero-panel,
  .river-layout,
  .classic-layout {
    grid-template-columns: 1fr;
  }

  .classic-side-panel {
    position: static;
  }

  .classic-layout > div:first-child {
    padding: 0.75rem;
  }
}

@media (max-width: 640px) {
  .games-header {
    padding: 0.85rem;
  }

  .header-links,
  .action-row,
  .section-heading,
  .maze-controls-grid,
  .colouring-zoom-tools {
    width: 100%;
  }

  .ttt-board {
    gap: 0.45rem;
  }

  .ttt-cell {
    min-height: 78px;
    font-size: 1.75rem;
  }

  .connect-board,
  .battle-board,
  .dots-board {
    overflow-x: auto;
  }

  .connect-drop-btn,
  .hangman-keyboard button,
  .battle-cell {
    min-height: 46px;
  }

  .battle-grid-wrap {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .rps-choice-grid {
    grid-template-columns: 1fr;
  }

  .hangman-keyboard {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  body.safe-games-body[data-game="snake"] .maze-controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .snake-board {
    gap: 0.12rem;
  }

  .tile2048-cell {
    font-size: 1.12rem;
  }

  .dots-line.horizontal {
    min-width: 30px;
  }

  .dots-line.vertical {
    min-height: 30px;
  }

  .games-link-btn,
  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .save-panel {
    align-items: stretch;
  }

  .games-section,
  .category-block,
  .game-shell {
    padding: 0.9rem;
  }

  .menu-card {
    flex-basis: min(300px, 88vw);
    min-width: min(300px, 88vw);
  }

  .game-board-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-tile,
  .trail-btn {
    min-height: 66px;
  }
}
