/* ---- Games: the launcher and the player ------------------------------------------- */
.games { flex: 1; overflow-y: auto; }
.games-inner { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 48px; }
@media (max-width: 760px) { .games-inner { padding: 18px 16px 32px; } }

/* Colour per category, from the theme's hue tokens. */
.hue-orange { --g: var(--hue-orange); --g-bg: var(--hue-orange-bg); }
.hue-purple { --g: var(--hue-purple); --g-bg: var(--hue-purple-bg); }
.hue-green { --g: var(--hue-green); --g-bg: var(--hue-green-bg); }
.hue-blue { --g: var(--hue-blue); --g-bg: var(--hue-blue-bg); }
.hue-teal { --g: var(--hue-teal); --g-bg: var(--hue-teal-bg); }
.hue-pink { --g: var(--hue-pink); --g-bg: var(--hue-pink-bg); }

.games-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 26px 26px 24px; border-radius: var(--r-xl); border: 1px solid var(--border);
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(90% 120% at 0% 100%, color-mix(in srgb, #cc7a3a 18%, transparent), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}
.games-hero h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.games-hero p { margin: 6px 0 0; color: var(--text-2); font-size: 14.5px; }
@media (max-width: 520px) { .games-hero { padding: 20px 18px; } .games-hero h1 { font-size: 25px; } .games-hero .btn { width: 100%; justify-content: center; } }

.games-bar { display: flex; gap: 10px; margin: 18px 0 10px; }
.games-search { max-width: 460px; position: relative; }
.games-clear, .games-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.games-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.games-cats::-webkit-scrollbar { display: none; }
.games-cats .chip { flex-shrink: 0; }

.games-section { margin-top: 22px; }
.games-h2 { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; font-size: 14px; font-weight: 650; color: var(--text-2); letter-spacing: .01em; }

/* Recently played: a row you can scroll sideways. */
.games-recent { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.recent-tile {
  flex: 0 0 104px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px 10px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform .16s var(--ease-out), border-color .15s ease, box-shadow .2s ease;
}
.recent-tile:hover { border-color: var(--g); box-shadow: var(--shadow); }
.recent-tile:active { transform: scale(.97); }
.recent-emoji { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; background: var(--g-bg); }
.recent-name { font-size: 12px; font-weight: 550; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The grid of cards. */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
@media (max-width: 520px) { .games-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.game-card {
  position: relative; border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .2s var(--ease-out), box-shadow .2s ease, border-color .15s ease;
}
@media (hover: hover) {
  .game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--g) 45%, var(--border)); }
  .game-card:hover .game-emoji { transform: scale(1.08) rotate(-4deg); }
}
.game-open { display: flex; flex-direction: column; width: 100%; padding: 0; border: none; background: none; color: inherit; text-align: left; }
.game-open:active { transform: scale(.99); }
.game-open:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--r-xl); }
.game-art {
  height: 108px; display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .55), transparent 55%),
    linear-gradient(140deg, var(--g-bg), color-mix(in srgb, var(--g) 28%, var(--g-bg)));
}
[data-tone="dark"] .game-art { background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .08), transparent 55%), linear-gradient(140deg, color-mix(in srgb, var(--g) 16%, var(--surface)), color-mix(in srgb, var(--g) 38%, var(--surface))); }
.game-emoji { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .18)); transition: transform .25s var(--ease-out); }
.game-text { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px 13px; min-width: 0; }
.game-title { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; padding-right: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-blurb { font-size: 12.5px; line-height: 1.45; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.game-meta { margin-top: 4px; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--g); }
@media (max-width: 520px) {
  .game-art { height: 84px; }
  .game-emoji { font-size: 38px; }
  .game-blurb { display: none; }
  .game-text { padding: 9px 11px 11px; }
}
.game-fav {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, .7); color: #6b7280; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .15s ease, transform .16s var(--ease-out), color .15s ease;
}
[data-tone="dark"] .game-fav { background: rgba(0, 0, 0, .35); color: #d1d5db; }
.game-card:hover .game-fav, .game-fav:focus-visible, .game-fav.on { opacity: 1; }
@media (hover: none) { .game-fav { opacity: 1; } }
.game-fav:active { transform: scale(.9); }
.game-fav.on, .game-fav-head.on { color: #f5a524; }
.game-fav.on svg, .game-fav-head.on svg { fill: currentColor; }

.games-credits { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); }
.games-credits ul { margin: 10px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 18px; font-size: 13px; }

/* ---- The player --------------------------------------------------------------------- */
.games-play { flex-direction: column; min-height: 0; }
.play-head { gap: 8px; min-height: 56px; padding: 8px 12px; }
.play-emoji { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; background: var(--g-bg); flex-shrink: 0; }
.play-title { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.play-stage { position: relative; flex: 1; min-height: 0; background: #000; }
.play-stage:fullscreen { width: 100vw; height: 100vh; }
.play-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.play-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: var(--bg); z-index: 1; }
.play-loading-emoji { font-size: 54px; animation: pulse 1.4s var(--ease) infinite; }
@media (prefers-reduced-motion: reduce) { .play-loading-emoji { animation: none; } .game-emoji, .game-card { transition: none; } }
/* The seasonal snow stays off a game while you play it. */
body:has(.games-play) .snow { display: none; }

/* ---- Pictures on the cards ---------------------------------------------------------- */
.game-art.has-shot { position: relative; display: block; overflow: hidden; background: var(--surface-2); }
.game-art.has-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; transition: transform .35s var(--ease-out); }
@media (hover: hover) { .game-card:hover .game-art.has-shot img { transform: scale(1.05); } }
.game-badge {
  position: absolute; left: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 19px; line-height: 1; background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .22); border: 1px solid var(--border);
}
@media (max-width: 520px) { .game-badge { width: 28px; height: 28px; font-size: 16px; left: 8px; bottom: 8px; border-radius: 8px; } }
.game-art { height: 128px; }
@media (max-width: 520px) { .game-art { height: 92px; } }
/* Recently played: a small picture instead of the emoji square. */
.recent-tile { flex-basis: 132px; padding: 0 0 9px; overflow: hidden; gap: 7px; }
.recent-shot { width: 100%; height: 76px; border-radius: 0; }
.recent-shot .game-badge { width: 24px; height: 24px; font-size: 13px; left: 6px; bottom: 6px; border-radius: 7px; }
.recent-shot .game-emoji { font-size: 30px; }
.recent-name { padding: 0 8px; }

/* A game shown straight from another site: where it comes from, and the way out if it won't show. */
.play-note { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.play-note.slow { color: var(--text); background: color-mix(in srgb, var(--warning) 14%, var(--surface)); }

/* ---- NettleWeb's catalogue: source, type and sort, placeholders, Show more ---------- */
.hue-sky { --g: var(--hue-sky); --g-bg: var(--hue-sky-bg); }
.hue-slate { --g: var(--hue-slate); --g-bg: var(--hue-slate-bg); }
.games-bar { flex-wrap: wrap; align-items: center; }
.games-select { width: auto; min-width: 118px; height: 38px; }
.games-source button { white-space: nowrap; }
@media (max-width: 760px) { .games-source { order: 3; width: 100%; } .games-source button { flex: 1; } }
.games-nw-note { margin-top: 14px; align-items: center; }
.game-skel { pointer-events: none; }
.game-skel .game-art { display: block; }
.skel-line { display: block; height: 12px; border-radius: 6px; margin: 4px 0; width: 80%; }
.skel-line.short { width: 45%; }
.games-more { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.games-more-note { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 14px; }
.games-more-note .spinner { width: 14px; height: 14px; }
@media (max-width: 760px) {
  .games-search { flex: 1 1 100%; max-width: none; }
  .games-select { flex: 1 1 0; min-width: 0; }
}

/* One small link instead of the old credits section. */
.games-foot { display: flex; justify-content: center; padding: 26px 0 8px; }
.games-licences { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
