/* Landing page. Builds on shell.css (themes, tokens). */
body { overflow-x: hidden; }

/* ---------- sticky header ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-in { max-width: 1100px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--on-gold);
  background: linear-gradient(145deg, #ffd15a, var(--gold) 55%, #e89b0b);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 14px rgba(207, 148, 16, 0.35);
  font-family: var(--font-head);
}
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: 1.12rem; letter-spacing: 0; }
.nav .theme-toggle { position: static; }

/* ---------- hero ---------- */
.hero { padding: clamp(40px, 8vw, 84px) 20px clamp(26px, 4vw, 40px); }
.hero-in { max-width: 1100px; margin: 0 auto; }
.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.greet { font-family: var(--font-head); margin: 0 0 6px; font-size: clamp(1.15rem, 2.6vw, 1.5rem); font-weight: 600; letter-spacing: 0; color: var(--ink); }
.greet span { margin-right: 4px; }
.greet small { font-size: 0.78em; font-weight: 650; color: var(--muted); margin-left: 2px; }
.hero h1 { margin: 0; font-size: clamp(2.5rem, 7.4vw, 4.4rem); font-weight: 650; line-height: 1.05; letter-spacing: -0.01em; }
.grad { background: linear-gradient(95deg, var(--ink) 0%, var(--ink) 14%, #f5a623 48%, #e5484d 74%, #8a5ce0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 18px 0 0; max-width: 36em; color: var(--muted); font-size: clamp(1.05rem, 2.3vw, 1.25rem); line-height: 1.55; }

.controls {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.tabs { display: inline-flex; gap: 2px; padding: 4px; background: color-mix(in srgb, var(--surface) 76%, transparent); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.tab {
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 9px 20px;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s, background 0.15s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--on-gold); background: linear-gradient(180deg, #ffc93c, var(--gold)); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 2px 8px rgba(207, 148, 16, 0.35); }
.tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.tools { display: flex; align-items: center; gap: 16px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
#search { width: min(200px, 42vw); font: inherit; color: var(--ink); background: transparent; border: 0; outline: 0; padding: 10px 0; }
#search::placeholder { color: var(--muted); }
.link-btn { font: inherit; font-weight: 700; color: var(--blue); background: none; border: 0; padding: 6px 2px; cursor: pointer; }
:root[data-theme="dark"] .link-btn { color: var(--focus); }
.link-btn:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- grid and cards ---------- */
:root {
  --card-top: #ffffff;
  --card-bottom: #eef1fb;
  --card-rim: rgba(22, 26, 43, 0.14);
}
:root[data-theme="dark"] {
  --card-top: #34407a;
  --card-bottom: #212a58;
  --card-rim: rgba(160, 178, 255, 0.28);
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 8px 20px 10px; }
.count { margin: 0 0 14px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }
.grid > li { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.card {
  --a: #888;
  --b: #bbb;
  --rx: 0deg;
  --ry: 0deg;
  --ty: 0px;
  --mx: 50%;
  --my: 0%;
  --edge: color-mix(in srgb, var(--a) 38%, #060a18);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  /* a solid, lighter slab that clearly sits above the background */
  background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
  border: 1px solid var(--card-rim);
  border-radius: 22px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 7px 0 var(--edge),
    0 22px 34px -6px rgba(3, 6, 20, 0.55),
    0 0 0 0 transparent;
  transform: perspective(900px) translateY(var(--ty)) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease, border-color 0.25s ease;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.22), transparent 55%);
  transition: opacity 0.3s ease;
}
.card:hover, .card:focus-visible {
  --ty: -10px;
  border-color: color-mix(in srgb, var(--a) 70%, var(--card-rim));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 11px 0 var(--edge),
    0 34px 46px -8px rgba(3, 6, 20, 0.65),
    0 0 46px -6px color-mix(in srgb, var(--a) 55%, transparent);
}
.card:hover::after, .card:focus-visible::after { opacity: 1; }
.card.tilting { transition: transform 0.08s linear, box-shadow 0.35s ease, border-color 0.25s ease; }
.card:active { --ty: -3px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 4px 0 var(--edge), 0 12px 20px -6px rgba(3, 6, 20, 0.5); }
.card:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.grid > li { perspective: 1200px; }

.art {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 100% at 12% 0%, color-mix(in srgb, var(--a) 90%, #fff), transparent 62%),
    radial-gradient(110% 120% at 100% 100%, var(--b), transparent 60%),
    color-mix(in srgb, var(--a) 45%, var(--surface));
}
.art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.12)); pointer-events: none; }
.icon-tile {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 24px;
  font-size: 2.4rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card:hover .icon-tile { transform: scale(1.08) rotate(-3deg); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform 0.5s ease; }
.card:hover .art img { transform: scale(1.07); }
.art img, .icon-tile { transform: translateZ(0); }
.flag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 11px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--on-gold);
  background: linear-gradient(180deg, #ffd15a, var(--gold));
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 18px 20px 20px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.body h2 { margin: 0; font-size: 1.15rem; font-weight: 750; letter-spacing: -0.01em; }
.go {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: transform 0.25s ease, background 0.2s, color 0.2s;
}
.card:hover .go { transform: translateX(3px); background: var(--gold); color: var(--on-gold); border-color: transparent; }
.body p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 0.93rem; flex: 1; }
.meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.aud { padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); color: color-mix(in srgb, var(--gold-deep) 80%, var(--ink)); }
.card[data-aud="kids"] .aud { background: color-mix(in srgb, var(--green) 16%, var(--surface)); color: color-mix(in srgb, var(--green) 75%, var(--ink)); }
.card[data-aud="adults"] .aud { background: color-mix(in srgb, var(--blue) 16%, var(--surface)); color: color-mix(in srgb, var(--blue) 75%, var(--ink)); }

/* the featured game gets a wide card on large screens */
@media (min-width: 780px) {
  .grid > li.featured { grid-column: span 2; }
  .card.featured { flex-direction: row; }
  .card.featured .art { flex: 1.25; aspect-ratio: auto; min-height: 270px; }
  .card.featured .body { flex: 1; justify-content: center; padding: 30px; }
  .card.featured .body h2 { font-size: 1.9rem; letter-spacing: -0.02em; }
  .card.featured .body p { flex: 0; font-size: 1.02rem; }
}

.empty { text-align: center; color: var(--muted); padding: 36px 0; }
.foot { text-align: center; color: var(--muted); font-size: 0.88rem; padding: 48px 16px calc(40px + env(safe-area-inset-bottom)); }
.foot strong { color: var(--ink); }
/* "Save all games for offline" (assets/save-offline.js) */
.offline { display: grid; justify-items: center; gap: 10px; max-width: 560px; margin: 18px auto 26px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.offline[hidden] { display: none; }
.offline p { margin: 0; line-height: 1.5; }
.offline .tick { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.offline .tick input { width: 18px; height: 18px; accent-color: var(--gold); }
.offline #saveNote:empty { display: none; }

@media (max-width: 560px) {
  .controls { flex-direction: column; align-items: stretch; }
  .tabs { justify-content: space-between; }
  .tab { flex: 1; padding: 9px 6px; }
  .tools { justify-content: space-between; }
  .search { flex: 1; }
  #search { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card:hover { --rx: 0deg !important; --ry: 0deg !important; }
}

/* light theme: a gentle slab and soft shadow instead of the heavy dark edge used in dark mode */
:root:not([data-theme="dark"]) .card {
  --edge: color-mix(in srgb, var(--a) 40%, #c4cae3);
  box-shadow: 0 1px 0 #fff inset, 0 6px 0 var(--edge), 0 18px 28px -10px rgba(40, 52, 110, 0.28);
}
:root:not([data-theme="dark"]) .card:hover { box-shadow: 0 1px 0 #fff inset, 0 10px 0 var(--edge), 0 26px 36px -10px rgba(40, 52, 110, 0.34); }
:root:not([data-theme="dark"]) .card:active { box-shadow: 0 1px 0 #fff inset, 0 3px 0 var(--edge), 0 10px 18px -8px rgba(40, 52, 110, 0.3); }

/* games that can be played with a friend over the internet */
.flag.online { left: auto; right: 12px; color: #fff; background: linear-gradient(180deg, #2fc486, #12906a); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.25) inset; }

/* New badge */
.flag.fresh { color: #fff; background: linear-gradient(180deg, #8b7cff, #5b45e0); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.25) inset; }

/* filter chips: online / new / category */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.fchip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 0.86rem; font-weight: 700; color: var(--muted); padding: 7px 13px; border-radius: 999px; cursor: pointer; background: color-mix(in srgb, var(--surface) 76%, transparent); border: 1px solid var(--line); }
.fchip span { font-size: 0.74rem; font-weight: 800; opacity: 0.7; }
.fchip:hover { color: var(--ink); }
.fchip[aria-pressed="true"] { color: var(--on-gold); background: linear-gradient(180deg, #ffc93c, var(--gold)); border-color: transparent; }
.fchip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 640px) { .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 6px; scrollbar-width: none; } .fchip { flex: none; } }

/* resume an online game */
.resume { display: grid; gap: 8px; margin: 0 0 16px; }
.resume[hidden] { display: none; }
.resume-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; border-radius: 16px; background: color-mix(in srgb, var(--green, #1f9d6b) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green, #1f9d6b) 45%, var(--line)); box-shadow: var(--shadow); }
.resume-row span { flex: 1 1 220px; font-size: 0.95rem; }
.resume-go { font-weight: 800; text-decoration: none; color: #fff; background: linear-gradient(180deg, #2fc486, #12906a); padding: 8px 16px; border-radius: 999px; }
.resume-go:hover { filter: brightness(1.08); }
.resume-go:focus-visible, .resume-drop:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.resume-drop { font: inherit; font-weight: 700; font-size: 0.85rem; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 6px 8px; }
.resume-drop:hover { color: var(--ink); }

/* favorites */
.grid > li { position: relative; }
.grid > li.group { grid-column: 1 / -1; list-style: none; font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; margin: 10px 0 -2px; color: var(--ink); }
.fav-btn { position: absolute; z-index: 3; top: 46px; right: 12px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; cursor: pointer; color: #fff; background: rgba(15, 18, 30, 0.55); border: 1.5px solid rgba(255, 255, 255, 0.6); backdrop-filter: none; transition: transform 0.12s, background 0.12s, color 0.12s; }
.fav-btn:hover { transform: scale(1.1); background: rgba(15, 18, 30, 0.75); }
.fav-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.fav-btn svg { fill: none; }
.fav-btn[aria-pressed="true"] { color: #2b1f00; background: linear-gradient(180deg, #ffd15a, var(--gold)); border-color: #fff; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
html[data-saver="on"] .fav-btn { transition: none; }

/* keep the headline on one line on a phone */
@media (max-width: 480px) { .hero h1 { font-size: clamp(1.6rem, 8.2vw, 2.4rem); letter-spacing: -0.03em; } }

/* the home page sky (assets/sky.js): behind everything, never in the way of taps */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* the plain list of every game in the footer (written by tools/seo.mjs) */
.allgames { max-width: 1100px; margin: 0 auto 14px; text-align: left; }
.allgames summary { font-weight: 800; cursor: pointer; }
.allgames h2 { margin: 14px 0 6px; font-size: 0.95rem; }
.allgames ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 14px; }
.allgames a { display: inline-block; padding: 5px 0; color: var(--muted); text-decoration: none; font-size: 0.9rem; } /* tall enough to tap */
.allgames a:hover, .allgames a:focus-visible { color: var(--ink); text-decoration: underline; }

/* while the cards are being dealt (portal.js) */
.grid.dealing > li { position: relative; animation: none; }
.grid.dealing .card { box-shadow: 0 2px 0 rgba(255, 255, 255, 0.08), 0 6px 14px rgba(0, 0, 0, 0.45); } /* gives each card in the deck a visible edge */
/* a game that is both featured and new shows both badges, one under the other */
.flag:not(.fresh):not(.online) ~ .flag.fresh { top: 44px; }
