:root {
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --accent-dark: #1d4ed8;
  --bg: #faf8f6;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #666;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --header-pad: 72px;
  --footer-pad: 88px;
  --logo-top: 12px;
  --logo-height: 56px;
  --logo-band: calc(var(--logo-top) + var(--logo-height) + 8px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Per-category colours (icons + card/detail accents) */
.app-shell[data-icon="kids"],
.game-card[data-icon="kids"] {
  --theme: #e85d04;
  --theme-light: #fff0e6;
  --theme-dark: #c2410c;
  --theme-shadow: rgba(232, 93, 4, 0.22);
}
.app-shell[data-icon="speed"],
.game-card[data-icon="speed"] {
  --theme: #2563eb;
  --theme-light: #eff6ff;
  --theme-dark: #1d4ed8;
  --theme-shadow: rgba(37, 99, 235, 0.22);
}
.app-shell[data-icon="party"],
.game-card[data-icon="party"] {
  --theme: #a855f7;
  --theme-light: #f3e8ff;
  --theme-dark: #7e22ce;
  --theme-shadow: rgba(168, 85, 247, 0.22);
}
.app-shell[data-icon="fishing"],
.game-card[data-icon="fishing"] {
  --theme: #0d9488;
  --theme-light: #ccfbf1;
  --theme-dark: #0f766e;
  --theme-shadow: rgba(13, 148, 136, 0.22);
}
.app-shell[data-icon="memory"],
.game-card[data-icon="memory"] {
  --theme: #4f46e5;
  --theme-light: #eef2ff;
  --theme-dark: #4338ca;
  --theme-shadow: rgba(79, 70, 229, 0.22);
}
.app-shell[data-icon="matching"],
.game-card[data-icon="matching"] {
  --theme: #e11d48;
  --theme-light: #ffe4e6;
  --theme-dark: #be123c;
  --theme-shadow: rgba(225, 29, 72, 0.22);
}
.app-shell[data-icon="shedding"],
.game-card[data-icon="shedding"] {
  --theme: #d97706;
  --theme-light: #fff7ed;
  --theme-dark: #b45309;
  --theme-shadow: rgba(217, 119, 6, 0.22);
}
.app-shell[data-icon="trick"],
.game-card[data-icon="trick"] {
  --theme: #7c3aed;
  --theme-light: #ede9fe;
  --theme-dark: #6d28d9;
  --theme-shadow: rgba(124, 58, 237, 0.22);
}
.app-shell[data-icon="solitaire"],
.game-card[data-icon="solitaire"] {
  --theme: #16a34a;
  --theme-light: #dcfce7;
  --theme-dark: #15803d;
  --theme-shadow: rgba(22, 163, 74, 0.22);
}
.app-shell[data-icon="indian"],
.game-card[data-icon="indian"] {
  --theme: #ca8a04;
  --theme-light: #fef9c3;
  --theme-dark: #a16207;
  --theme-shadow: rgba(202, 138, 4, 0.22);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-top: var(--header-pad);
  padding-bottom: var(--footer-pad);
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
}
.skip-link:focus { left: 8px; top: 8px; z-index: 10001; background: #fff; padding: 8px; }
.brand-pg {
  position: fixed; top: 12px; left: 12px; z-index: 1000;
  width: 100px; height: auto; max-height: 56px;
  object-fit: contain; object-position: left center;
}
.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 24px;
}
.hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0 20px;
}
.hero-copy { flex: 1; min-width: 0; }
.hero h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(120deg, #e85d04 0%, #2563eb 35%, #7c3aed 65%, #16a34a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { margin: 0; color: var(--muted); font-size: 1rem; }
.hero-photo {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-photo-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.filter-banner {
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.filter-banner-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
}
.moment-card {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card);
}
.moment-card-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
}
.moment-card figcaption {
  margin: 0;
  padding: 12px 14px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent-dark);
  text-align: center;
}
.loading-state,
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px 40px;
  color: var(--muted);
}
.loading-photo,
.empty-photo {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  object-fit: cover;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow);
}
.empty-state p,
.loading-state p { margin: 0; }
.filters {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(var(--bg) 85%, transparent);
  padding: 6px 0 10px;
  margin-bottom: 6px;
}
@media (max-width: 959px) {
  .filters {
    top: var(--logo-band);
    z-index: 900;
    background: var(--bg);
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-bottom: 8px;
    padding: 8px 16px 10px calc(12px + 100px + 12px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  }
}
.filter-group { margin-bottom: 6px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group label {
  display: block;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 5px;
}
.filters .chip {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: var(--card);
  font-size: .75rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
@media (max-width: 639px) {
  .filters .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .filters .chip {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 3px 8px;
    font-size: .6875rem;
  }
}
.chip {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: var(--card);
  font-size: .875rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
.game-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  text-decoration: none;
  color: inherit;
  min-height: 140px;
  transition: transform .15s, box-shadow .15s;
}
.game-card:hover, .game-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--theme-shadow, rgba(37, 99, 235, 0.15));
  outline: none;
}
.game-card[data-icon] h2 {
  color: var(--theme);
}
.game-card .icon-wrap {
  width: 48px; height: 48px; margin-bottom: 10px;
}
.game-card .icon-wrap img { width: 48px; height: 48px; }
.game-card h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}
.game-card p {
  margin: 0;
  font-size: .8125rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-header { margin-bottom: 20px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 16px;
  min-height: 44px;
}
.back-link:hover { text-decoration: underline; }
.detail-hero { text-align: center; margin-bottom: 24px; }
.detail-hero .icon-wrap img { width: 64px; height: 64px; }
.detail-hero h1 { margin: 12px 0 8px; font-size: 1.5rem; }
.meta-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.pill {
  font-size: .75rem;
  padding: 4px 10px;
  background: var(--theme-light, var(--accent-light));
  color: var(--theme-dark, var(--accent-dark));
  border-radius: 999px;
}
.app-shell[data-icon] > .detail-header .back-link {
  color: var(--theme);
}
.app-shell[data-icon] > .section h2 {
  color: var(--theme);
}
.section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.section h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--accent);
}
.section p, .section ol { margin: 0; font-size: .9375rem; }
.section ol { padding-left: 1.25rem; }
.section li { margin-bottom: 6px; }
.faq details {
  border-bottom: 1px solid #eee;
  padding: 10px 0;
}
.faq details:last-child { border-bottom: none; }
.faq summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq p { margin: 8px 0 0; color: var(--muted); font-size: .875rem; }
.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}
.video-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}
.subscribe {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
  padding: 0;
  background: transparent;
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden;
}
.subscribe-visual {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.subscribe-photo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}
.subscribe-content {
  padding: 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.subscribe h2 { margin: 0 0 12px; font-size: 1.125rem; }
.channel-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.channel-toggle button {
  flex: 1;
  min-height: 44px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: .875rem;
}
.channel-toggle button.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}
.subscribe input {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 12px;
}
.btn-primary {
  width: 100%;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.form-msg {
  margin-top: 12px;
  font-size: .875rem;
  min-height: 1.25em;
}
.form-msg.success { color: #0d6b2d; }
.form-msg.error { color: var(--accent); }
.wa-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: .875rem;
}
.loading-state {
  text-align: center;
  padding: 48px 16px;
}
.error-banner {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}
.error-banner { color: var(--accent); }
/* ——— Tablet ——— */
@media (min-width: 640px) {
  .app-shell { padding: 0 24px 32px; }
  .grid { gap: 16px; }
  .game-card { min-height: 150px; }
}

/* ——— Desktop: use full width ——— */
@media (min-width: 960px) {
  :root {
    --header-pad: 80px;
    --footer-pad: 96px;
  }

  .app-shell {
    max-width: 1320px;
    padding: 0 40px 48px;
  }

  .brand-pg { width: 120px; max-height: 64px; top: 20px; left: 24px; }

  .hero {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 400px);
    gap: 28px;
    align-items: center;
    padding: 16px 0 8px;
    padding-left: 88px;
  }
  .hero h1 { font-size: 2.25rem; }
  .hero p { font-size: 1.125rem; max-width: 52rem; }
  .hero-photo-img { max-height: 280px; }
  .filter-banner-img { max-height: 260px; }
  .moment-card-img { max-height: 280px; }

  /* Browse: sidebar filters + wide game grid */
  .app-shell:has(> .grid#game-grid) {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr auto;
    column-gap: 28px;
    row-gap: 20px;
    align-items: start;
  }

  .app-shell:has(> .grid#game-grid) > .hero {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .app-shell:has(> .grid#game-grid) > .filters {
    grid-column: 1;
    grid-row: 2 / 4;
    position: sticky;
    top: 88px;
    align-self: start;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 10px;
    margin-bottom: 0;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }

  .app-shell:has(> .grid#game-grid) > .filters::before {
    content: "Find a game";
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
  }

  .app-shell:has(> .grid#game-grid) > .filter-banner {
    grid-column: 2;
    grid-row: 2;
    margin-bottom: 0;
  }

  .app-shell:has(> .grid#game-grid) > .grid {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .app-shell:has(> .grid#game-grid):has(> .filter-banner) > .grid {
    grid-row: 3;
  }

  .app-shell:has(> .grid#game-grid) > .subscribe {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 8px;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
  }

  .app-shell:has(> .grid#game-grid) > .subscribe .subscribe-visual {
    flex: 0 0 38%;
    max-width: 440px;
    border-radius: var(--radius) 0 0 var(--radius);
  }

  .app-shell:has(> .grid#game-grid) > .subscribe .subscribe-photo {
    max-height: none;
    height: 100%;
    min-height: 220px;
    aspect-ratio: auto;
  }

  .app-shell:has(> .grid#game-grid) > .subscribe .subscribe-content {
    flex: 1;
    padding: 28px 36px;
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  .app-shell:has(> .grid#game-grid) > .subscribe h2 {
    font-size: 1.35rem;
    margin: 0 0 12px;
    max-width: none;
  }

  .app-shell:has(> .grid#game-grid) > .subscribe form {
    max-width: 440px;
    margin: 0;
  }

  .app-shell:has(> .grid#game-grid) .filter-group {
    margin-bottom: 8px;
  }
  .app-shell:has(> .grid#game-grid) .filter-group label {
    font-size: .6875rem;
    margin-bottom: 3px;
  }
  .app-shell:has(> .grid#game-grid) .chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .app-shell:has(> .grid#game-grid) .filters .chip {
    min-height: 30px;
    padding: 4px 6px;
    font-size: 0.6875rem;
    border-radius: 6px;
    text-align: center;
  }

  /* Game cards: larger vertical tiles on desktop */
  .app-shell:has(> .grid#game-grid) .game-card {
    flex-direction: column;
    align-items: stretch;
    min-height: 200px;
    padding: 22px 20px;
    gap: 0;
  }
  .app-shell:has(> .grid#game-grid) .game-card .icon-wrap {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
  }
  .app-shell:has(> .grid#game-grid) .game-card .icon-wrap img {
    width: 64px;
    height: 64px;
  }
  .app-shell:has(> .grid#game-grid) .game-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .app-shell:has(> .grid#game-grid) .game-card p {
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--muted);
    -webkit-line-clamp: 3;
  }

  /* Detail: two columns — rules left, video + subscribe right */
  .app-shell:has(> .detail-hero) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
    column-gap: 36px;
    row-gap: 16px;
    align-items: start;
  }

  .app-shell:has(> .detail-hero) > .detail-header,
  .app-shell:has(> .detail-hero) > .detail-hero {
    grid-column: 1 / -1;
  }

  .app-shell:has(> .detail-hero) > .section:has(.video-wrap),
  .app-shell:has(> .detail-hero) > .section.section-media {
    grid-column: 2;
    grid-row: 3 / span 6;
    position: sticky;
    top: 88px;
    align-self: start;
  }

  .app-shell:has(> .detail-hero) > .detail-hero {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 8px 20px;
    text-align: left;
    align-items: center;
    padding: 20px 24px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 8px;
  }

  .app-shell:has(> .detail-hero) > .detail-hero .icon-wrap {
    grid-row: 1 / 3;
    grid-column: 1;
  }
  .app-shell:has(> .detail-hero) > .detail-hero .icon-wrap img {
    width: 80px;
    height: 80px;
  }
  .app-shell:has(> .detail-hero) > .detail-hero h1 {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    font-size: 2rem;
    text-align: left;
  }
  .app-shell:has(> .detail-hero) > .detail-hero .meta-pills {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-start;
  }

  .app-shell:has(> .detail-hero) > .section {
    grid-column: 1;
  }

  .app-shell:has(> .detail-hero) > .subscribe {
    grid-column: 2;
    margin-top: 0;
  }

  .section { padding: 20px 24px; }
  .section h2 { font-size: 1.125rem; }
  .section p, .section ol { font-size: 1rem; }
}

@media (min-width: 1200px) {
  .app-shell:has(> .grid#game-grid) > .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
  }
  .app-shell:has(> .grid#game-grid) .game-card {
    min-height: 210px;
    padding: 24px 22px;
  }
}

@media (min-width: 1440px) {
  .app-shell { max-width: 1440px; }
  .app-shell:has(> .grid#game-grid) > .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
  .app-shell:has(> .grid#game-grid) .game-card {
    min-height: 220px;
  }
  .app-shell:has(> .grid#game-grid) .game-card h2 {
    font-size: 1.3125rem;
  }
}

.game-card-body { flex: 1; min-width: 0; }
.game-card-meta {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
}
@media (min-width: 960px) {
  .app-shell:has(> .grid#game-grid) .game-card-meta {
    font-size: 0.875rem;
    line-height: 1.5;
  }
  .app-shell:has(> .grid#game-grid) .game-card p.game-card-meta {
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Fixed subscribe — bottom right */
.subscribe-dock {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.subscribe-dock > * {
  pointer-events: auto;
}
.subscribe-dock-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.subscribe-dock-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.4);
}
.subscribe-dock-panel {
  display: none;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  padding: 18px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
}
.subscribe-dock-panel.subscribe-content {
  padding: 18px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}
.subscribe-dock-panel input {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 12px;
}
.subscribe-dock.is-open .subscribe-dock-panel {
  display: block;
}
.subscribe-dock-panel h2 {
  margin: 0 0 12px;
  font-size: 1.125rem;
  color: var(--accent);
}
.subscribe-dock.is-open .subscribe-dock-fab {
  background: var(--accent-dark);
}
body {
  padding-bottom: calc(var(--footer-pad) + 8px);
}
@media (min-width: 960px) {
  .subscribe-dock {
    bottom: max(28px, env(safe-area-inset-bottom, 0px));
    right: max(28px, env(safe-area-inset-right, 0px));
  }
}
