/* The homepage (index.html) */
/* ── Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --transition: .25s cubic-bezier(.4, 0, .2, 1);
  --transition-bounce: .45s cubic-bezier(.34, 1.56, .64, 1);
  --theme-primary: hsl(260, 80%, 60%);
  --focus-ring: hsl(260 80% 72%);   /* the keyboard ring (common.css), as light as the one around a game card */
  --theme-primary-glow: hsla(260, 80%, 60%, .25);
  --text-main: hsl(0, 0%, 94%);
  --text-muted: hsl(0, 0%, 65%);
  --radius-sm: 10px;
}

body {
  font-family: var(--font-body);
  background: hsl(225 22% 8%);
  color: hsl(0 0% 92%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── BG ──────────────────────────────────────── */
/* Static: an animated filter on a layer the size of the screen repaints it on every frame */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, hsl(260 70% 20% / .5) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, hsl(175 70% 15% / .4) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 60% 40%, hsl(340 60% 18% / .3) 0%, transparent 60%),
    hsl(225 22% 8%);
}

/* Floating orbs: a soft disc drawn as a gradient, not blurred with a filter, so moving one only costs the compositor.
   The padding is the room the blur used to spread into; the gradient runs over it. */
.orb {
  position: fixed;
  box-sizing: content-box;
  padding: 120px;
  margin: -120px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--c) 35%, transparent);
  opacity: .12;
  animation: float-orb var(--dur, 12s) ease-in-out infinite alternate;
  will-change: transform;
  z-index: 0;
  pointer-events: none;
}
.orb-1 { width: 500px; height: 500px; --c: hsl(260 80% 60%); top: -150px; left: -100px; --dur: 14s; }
.orb-2 { width: 400px; height: 400px; --c: hsl(175 80% 50%); bottom: -100px; right: -100px; --dur: 10s; }
.orb-3 { width: 300px; height: 300px; --c: hsl(340 80% 60%); top: 40%; left: 40%; --dur: 16s; }
@keyframes float-orb {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, -40px) scale(1.1); }
}

/* ── Layout ─────────────────────────────────── */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 20px 60px;
  min-height: calc(100vh - var(--hs));   /* a short list (Today) can still be scrolled until the header is a bar */
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Header: the big hero at the top, a slim bar once scrolled ─────────
   --p runs from 0 (top of the page) to 1 (scrolled one hero height); setupHeader() sets it.
   Everything in the header is positioned from it, so icon, title and streak glide from the
   centred hero to the bar. The header is fixed and the spacer keeps the room of the hero.
   They move with translate and scale, not with top, left, width or font-size, so a scroll frame needs no layout of them
   (except the top of the title, for Firefox; see there);
   measureHeader() gives the sizes that takes in pixels: --cx (half the width of the header), --tw (the width of the
   big title) and --ts (the size of the title in the bar, as a share of the big one). */
body {
  --pad: 20px;             /* side space of the page */
  --hs: 56px;              /* height of the bar */
  --fs-big: clamp(2.1rem, 6vw, 3.6rem);
  --hb: calc(130px + var(--fs-big) * 1.3 + 58px);   /* height of the hero, with a streak */
  --bar-gap: 12px;         /* between the parts of the bar (fitBar() in js/home.js reads these three) */
  --bar-icon: 46px;        /* the icon of 36px and the space before the title */
  --bar-buttons: 88px;     /* the two buttons of 38px and the space between them */
  --rc: calc(var(--pad) + var(--bar-buttons) + var(--bar-gap));   /* space for the two buttons at the right of the bar, and a gap */
}
body.no-streak { --hb: calc(130px + var(--fs-big) * 1.3 + 12px); }
.header-spacer { height: var(--hb); }
.site-header {
  --p: 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  height: calc(var(--hb) - (var(--hb) - var(--hs)) * var(--p));
}
/* The bar behind it fades in: a fixed blur under a changing opacity, instead of a blur radius that changes every frame */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: hsl(225 22% 8% / .9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid hsl(0 0% 100% / .08);
  opacity: var(--p);
  pointer-events: none;
}
.header-inner { position: relative; max-width: 1280px; height: 100%; margin: 0 auto; }
.brand-icon {
  --s: calc(1 - .625 * var(--p));   /* 96px to 36px */
  position: absolute;
  top: 0;
  left: 0;
  width: 96px;
  height: 96px;
  transform-origin: 0 0;
  translate: calc(var(--cx, min(50vw, 640px)) - (var(--cx, min(50vw, 640px)) - var(--pad)) * var(--p) - 48px * var(--s) * (1 - var(--p))) calc(22px - 12px * var(--p));
  scale: var(--s);
}
/* The glow pulses with opacity and the icon with scale: both are left to the compositor */
.brand-icon::before {
  content: '';
  position: absolute;
  inset: -25%;
  border-radius: 50%;
  background: radial-gradient(closest-side, hsl(260 80% 60% / .5), transparent);
  animation: glow-pulse 3s ease-in-out infinite;
  pointer-events: none;
}
.brand-icon img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 20px hsl(260 80% 60% / .6));
  animation: icon-pulse 3s ease-in-out infinite;
}
.site-header.is-compact .brand-icon::before { animation: none; opacity: 0; }
.site-header.is-compact .brand-icon img { animation: none; }
@keyframes icon-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.1); }
}
@keyframes glow-pulse {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50%       { opacity: 1; transform: scale(1.1); }
}
.brand-title {
  --s: calc(1 - (1 - var(--ts, .4)) * var(--p));   /* the big size to 1.2rem */
  position: absolute;
  /* Down with top, not with translate: Firefox paints no gradient text (background-clip: text) on an element
     translated this far down */
  top: calc(130px - 115px * var(--p));
  left: 0;
  margin: 0 0 -.25em;
  padding-bottom: .25em;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: var(--fs-big);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.5px;
  transform-origin: 0 0;
  translate: calc(var(--cx, min(50vw, 640px)) - (var(--cx, min(50vw, 640px)) - var(--pad) - 46px) * var(--p) - var(--tw, 0px) * var(--s) / 2 * (1 - var(--p))) 0;
  scale: var(--s);
  background: linear-gradient(135deg, #fff 20%, hsl(260 80% 75%) 55%, hsl(175 80% 60%) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-streak {
  position: absolute;
  white-space: nowrap;
  font-size: .92rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 18px;
  background: hsl(25 90% 50% / .15);
  color: hsl(30 95% 70%);
  border: 1px solid hsl(25 90% 55% / .35);
  top: 0;
  left: 0;
  translate: calc(var(--cx, min(50vw, 640px)) + (var(--cx, min(50vw, 640px)) - var(--rc)) * var(--p)) calc((130px + var(--fs-big) * 1.3 + 12px) * (1 - var(--p)) + 13px * var(--p));
  transform: translateX(calc(-50% - 50% * var(--p)));
}
.hero-streak.done {
  background: hsl(145 65% 15% / .85);
  color: hsl(145 65% 75%);
  border-color: hsl(145 65% 45% / .4);
}
/* No streak running but one to win back (the overall streak): violet, with the days that come back */
.hero-streak.restore {
  background: var(--restore-bg);
  color: var(--restore-fg);
  border: 1px dashed var(--restore-border);
}
.hero-streak .restore-plus { margin-left: 6px; padding: 0 7px; }
.hero-streak .st-short { display: none; }
.site-header.is-compact .hero-streak .st-long { display: none; }
.site-header.is-compact .hero-streak .st-short { display: inline; }
/* What the bar has room for is decided by fitBar(), in this order: the icon, the title, the streak as a number,
   the two buttons (both or none), the streak written out in place of the number. A part that does not fit fades out. */
.site-header.is-compact.bar-long .hero-streak .st-long { display: inline; }
.site-header.is-compact.bar-long .hero-streak .st-short { display: none; }
.site-header.bar-no-pill .hero-streak { opacity: calc(1 - var(--p) * 1.7); }
.site-header.bar-no-buttons { --rc: var(--pad); }
.site-header.bar-no-buttons .icon-btn { opacity: calc(1 - var(--p) * 1.7); }
.site-header.is-compact.bar-no-buttons .icon-btn { pointer-events: none; }
/* translate, as their hover uses transform; and no transition on it or on opacity, those follow the scroll */
.site-header .icon-btn { top: 20px; translate: 0 calc(-11px * var(--p)); transition-property: background, color, border-color, transform; }
.site-header .home-help-btn     { right: var(--pad); }
.site-header .home-settings-btn { right: calc(var(--pad) + 50px); }

/* ── Doors: three ways into the page, one row high ─────────── */
.doors-wrap { position: relative; }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* The message under the doors: over the list, the doors stay in reach */
.door-intro {
  position: absolute;
  z-index: 30;
  top: calc(100% + 12px);
  left: 0;
  width: min(100%, 460px);
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: hsl(228 28% 14%);
  border: 1px solid hsl(260 80% 70% / .45);
  box-shadow: 0 18px 50px hsl(0 0% 0% / .55), 0 0 0 1px hsl(0 0% 0% / .3);
  animation: intro-in .35s cubic-bezier(.34, 1.56, .64, 1);
}
.door-intro[hidden] { display: none; }
.door-intro:focus { outline: none; }   /* it takes the focus when it opens; its buttons show where the keyboard is */
@keyframes intro-in { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
.door-intro .arrow {
  position: absolute;
  top: -8px;
  left: calc(var(--ax, 50%) - 8px);
  width: 14px;
  height: 14px;
  background: hsl(228 28% 14%);
  border-left: 1px solid hsl(260 80% 70% / .45);
  border-top: 1px solid hsl(260 80% 70% / .45);
  transform: rotate(45deg);
}
.door-intro h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: #fff; padding-right: 36px; }
.door-intro .why { margin: 6px 0 12px; font-size: .92rem; line-height: 1.45; color: hsl(0 0% 80%); }
.door-intro .why [hidden] { display: none; }
.door-intro ul { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.door-intro li { display: flex; gap: 10px; font-size: .86rem; line-height: 1.4; color: hsl(0 0% 66%); }
.door-intro li b { flex: 0 0 82px; font-family: var(--font-display); color: #fff; }
.intro-x {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: hsl(0 0% 65%);
  background: hsl(0 0% 100% / .06); border: 1px solid hsl(0 0% 100% / .1);
}
.intro-x:hover { color: #fff; background: hsl(0 0% 100% / .12); }
.intro-x svg { width: 16px; height: 16px; }
.intro-ok {
  cursor: pointer; padding: 8px 20px; border-radius: 999px; font: 700 .9rem var(--font-display);
  color: hsl(225 30% 8%); background: hsl(260 80% 76%); border: none;
}
.intro-ok:hover { background: hsl(260 85% 82%); }
@media (max-width: 480px) { .door-intro { padding: 16px 16px 14px; } .door-intro li b { flex-basis: 74px; } }
.door {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: hsl(0 0% 100% / .04);
  border: 1px solid hsl(0 0% 100% / .08);
  color: hsl(0 0% 70%);
  font: 700 1rem var(--font-display);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.door svg { width: 18px; height: 18px; flex-shrink: 0; color: hsl(var(--h) 80% 72%); }
.door-day { font-family: var(--font-display); font-weight: 700; font-size: 10.5px; }
.door-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.door-count { font: 600 .75rem var(--font-body); color: hsl(0 0% 50%); white-space: nowrap; }
.door:hover { background: hsl(0 0% 100% / .08); color: #fff; }
.door[aria-selected="true"] {
  color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 50% / .24), hsl(var(--h) 70% 50% / .06));
  border-color: hsl(var(--h) 70% 65% / .5);
}
.door[aria-selected="true"] .door-count { color: hsl(var(--h) 80% 75%); }

/* ── Game list: one line per game ────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px 16px;
}

.game-card {
  position: relative;
  background: hsl(0 0% 100% / .04);
  border: 1px solid hsl(0 0% 100% / .08);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  min-height: 50px;
  transition: transform var(--transition-bounce), box-shadow var(--transition), border-color var(--transition);
}
/* The link fills the row; its ::after stretches over the whole card, so the space around the heart opens the game
   too. The heart is a button next to the link, not in it (no button inside a link). */
.card-link {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  outline: none;
}
.card-link::after { content: ''; position: absolute; inset: 0; z-index: 2; }
.card-link:focus-visible { outline: none; }   /* the ring goes around the whole card */
:where(html.kbd-focus) .game-card:has(.card-link:focus-visible) { outline: 2px solid hsl(260 80% 72%); outline-offset: 2px; }
.game-card:hover {
  transform: translateY(-2px);
}
.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--card-glow);
  opacity: .3;
  transition: opacity var(--transition);
  pointer-events: none;
}
.game-card:hover::before { opacity: .8; }

.card-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Game icons are inline SVG, drawn in the card colour */
.card-emoji {
  color: var(--card-color);
  line-height: 0;
  filter: drop-shadow(0 3px 8px var(--card-shadow));
  flex-shrink: 0;
  transition: transform var(--transition-bounce);
}
.card-emoji svg { display: block; width: 1.85rem; height: 1.85rem; }
.game-card:hover .card-emoji {
  transform: scale(1.08);
}

.card-text { flex: 1; min-width: 0; }
.card-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
}
/* One line under the title on what the puzzle is about. fitTaglines() puts the longest of its
   three texts in it that fits; the ellipsis is only a safety net. */
/* Narrow phones (320 to 359): a row with a long title, a three digit streak and a heart needs the room */
@media (max-width: 359px) {
  .card-body { padding: 9px 10px; }
  .card-top { gap: 10px; }
  .card-emoji svg { width: 1.7rem; height: 1.7rem; }
  .card-title { font-size: 1.05rem; }
  .card-badges { margin-left: 4px; }
  .card-streak { padding: 0 6px; }
  .card-streak.check-only { padding: 0; }
  .card-fav-btn, .card-dev-mark { width: 28px; height: 28px; margin: 0 6px 0 2px; }
  .card-fav-btn::after { inset: -8px; }
}
.card-tagline {
  margin-top: 2px;
  font-size: .78rem;
  line-height: 1.25;
  color: hsl(0 0% 64%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Only the search reads these: the other names, the rule and the tags of a game */
.card-subtitle, .card-desc, .card-footer { display: none; }

/* ── Badges: in progress + streak/completed ──── */
.card-badges {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  pointer-events: none;
}
/* Orange: streak not yet extended today. Green: daily played, streak extended. */
.card-streak {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  box-sizing: border-box;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
  animation: badge-fade-in .3s cubic-bezier(.34, 1.56, .64, 1);
  background: hsl(25 90% 50% / .15);
  color: hsl(30 95% 70%);
  border: 1px solid hsl(25 90% 55% / .35);
}
.card-streak.done {
  background: hsl(145 65% 15% / .85);
  border-color: hsl(145 65% 45% / .4);
  color: hsl(145 65% 75%);
}
/* Blue: the streak lives on a streak save; playing today continues it */
.card-streak.saved {
  background: hsl(210 80% 45% / .2);
  border-color: hsl(210 85% 62% / .5);
  color: hsl(205 95% 78%);
}
.card-streak.check-only { padding: 0; width: 24px; }
/* Violet: a lost streak to win back (js/stats.js: restoreInfo). By a running streak "+64" in its badge; before
   the new streak starts a dashed badge of its own. In the Streaks to restore group of Today (.restore-card) the
   card shows them in its own way instead: the days in a row under the title and a large "+64", without the heart. */
.card-streak .restore-plus { margin-left: 4px; padding: 0 5px; line-height: 1.3; }
.card-streak.restore-lost {
  background: var(--restore-bg);
  color: var(--restore-fg);
  border: 1px dashed var(--restore-border);
}
.card-restore, .card-restore-big { display: none; }
.game-card.restore-card { border-color: hsl(278 80% 65% / .45); background: linear-gradient(180deg, hsl(275 45% 20% / .5), hsl(275 35% 14% / .35)); }
.game-card.restore-card .card-tagline,
.game-card.restore-card .card-fav-btn,
.game-card.restore-card .card-streak .restore-plus,
.game-card.restore-card .card-streak.restore-lost,
.game-card.restore-card .card-ago { display: none; }
.game-card.restore-card .card-restore {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--restore-fg);
  white-space: nowrap;
}
.game-card.restore-card .card-badges { margin-right: 12px; }
.game-card.restore-card .card-restore-big {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: hsl(280 95% 88%);
  background: hsl(275 70% 50% / .25);
  border: 1.5px dashed hsl(278 85% 70% / .8);
}
/* The overall streak as a card of its own in that group: the flame, no game behind it (it opens streaks.html) */
.game-card.restore-overall { --card-color: hsl(30 95% 60%); --card-glow: none; --card-shadow: hsl(25 90% 50% / .4); }
/* The flame is tall and narrow where a game icon fills its square: taller than the box, so it looks as large,
   in the same column width (the titles line up) and without making the card higher */
.restore-overall .card-emoji .ico { width: 1.85rem; height: 2.35rem; margin: -.25rem 0; vertical-align: top; }
/* Grey: how long ago a game in Played before was played */
.card-ago {
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
  color: hsl(0 0% 62%);
  background: hsl(0 0% 100% / .05);
  border: 1px solid hsl(0 0% 100% / .1);
}
@keyframes badge-fade-in {
  from { opacity: 0; transform: translateY(4px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.game-card.completed {
  border-color: hsl(145 65% 45% / .25);
}
.game-card.completed:hover {
  border-color: hsl(145 65% 45% / .4);
  box-shadow: 0 8px 24px hsl(145 70% 20% / .2);
}
.game-card.in-progress {
  border-color: hsl(45 75% 50% / .25);
}
.game-card.in-progress:hover {
  border-color: hsl(45 75% 50% / .4);
  box-shadow: 0 8px 24px hsl(45 75% 25% / .2);
}

.inprogress-badge {
  width: 24px;
  height: 24px;
  margin-left: -29px; /* its width and the gap of .card-badges */
  border-radius: 50%;
  background: hsl(45 65% 15% / .97); /* nearly opaque: the tagline may run underneath */
  border: 1px solid hsl(45 65% 45% / .4);
  color: hsl(45 65% 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badge-fade-in .3s cubic-bezier(.34, 1.56, .64, 1);
}

/* ── Favorite heart at the end of a row ──────── */
.card-fav-btn {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: 0 9px 0 6px;
  border-radius: 50%;
  background: none;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(0 0% 45%);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card-fav-btn::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; }
:where(html.kbd-focus) .card-fav-btn:focus-visible { outline: 2px solid hsl(340 95% 70%); outline-offset: 1px; }
.card-fav-btn:hover {
  color: hsl(340 95% 65%);
  background: hsl(340 95% 65% / .1);
  border-color: hsl(340 95% 65% / .3);
  transform: scale(1.15);
}
.card-fav-btn:active {
  transform: scale(0.9);
}
.card-fav-btn.active {
  color: hsl(340 95% 65%);
  filter: drop-shadow(0 0 6px hsl(340 95% 65% / .3));
}
.card-fav-btn svg {
  width: 16px;
  height: 16px;
  transition: fill 0.2s;
}
.card-fav-btn.active svg {
  fill: currentColor;
  animation: heartBeat 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dev-only-card {
  opacity: .85;
}
/* A game in development has no heart: a flask in its place, not a button (the row still opens the game) */
.card-dev-mark {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: 0 9px 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(40 100% 60%);
  font-size: 16px;
  pointer-events: none;
}
@keyframes heartBeat {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ── Section header, filters and the lists of the doors ──────── */
.section-label {
  font-family: var(--font-display);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: hsl(0 0% 40%);
  text-align: center;
}
.section-label::before, .section-label::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 1px;
  background: hsl(0 0% 30%);
  vertical-align: middle;
  margin: 0 10px;
}
.game-card.filtered-out {
  display: none !important;
}
.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: hsl(0 0% 50%);
  font-size: .95rem;
  display: none;
  grid-column: 1 / -1;
}
.search-no-results.visible {
  display: block;
}

/* All games: the search bar, then the filters on status and on category */
.filters { display: flex; flex-direction: column; gap: 12px; }
.filters[hidden] { display: none; }
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  background: hsl(0 0% 100% / .05);
  border: 1px solid hsl(0 0% 100% / .1);
  transition: border-color var(--transition);
}
.searchbar:focus-within { border-color: hsl(260 80% 65% / .6); }
.searchbar > svg { width: 18px; height: 18px; flex-shrink: 0; color: hsl(260 80% 65%); }
.searchbar input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font: 500 .95rem var(--font-body);
}
.searchbar input::placeholder { color: hsl(0 0% 40%); }
.section-search-clear {
  background: none;
  border: none;
  color: hsl(0 0% 50%);
  cursor: pointer;
  padding: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
  flex-shrink: 0;
}
.section-search-clear:hover { color: hsl(0 0% 80%); }
.section-search-clear.visible { display: flex; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-row { display: flex; flex-direction: column; gap: 6px; }
.filter-label { font: 700 .68rem var(--font-display); letter-spacing: 1.6px; text-transform: uppercase; color: hsl(0 0% 45%); }
.chip .curve i { width: 6px; height: 6px; }
.chip .cico { display: inline-flex; width: 14px; height: 14px; color: hsl(0 0% 58%); }
.chip .cico svg { width: 100%; height: 100%; }
.chip .cico.favorites { color: hsl(340 95% 65%); }
.chip .cico.new { color: hsl(260 80% 75%); }
.chip .cico.busy { color: hsl(45 90% 65%); }
.chip .cico.streak { color: hsl(30 95% 66%); }
.chip .cico.todo { color: hsl(205 90% 72%); }
@media (min-width: 700px) {
  .filter-row { flex-direction: row; align-items: center; gap: 14px; }
  .filter-label { flex: 0 0 76px; }
  .filter-row .chips { flex: 1; min-width: 0; }
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  font: 600 .84rem var(--font-body);
  color: hsl(0 0% 70%);
  background: hsl(0 0% 100% / .04);
  border: 1px solid hsl(0 0% 100% / .1);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.chip .n { font-size: .72rem; color: hsl(0 0% 48%); }
.chip:hover { color: #fff; background: hsl(0 0% 100% / .08); }
.chip[aria-pressed="true"] { color: #fff; background: hsl(260 80% 60% / .25); border-color: hsl(260 80% 70% / .5); }
.chip[aria-pressed="true"] .n { color: hsl(260 80% 80%); }

/* Learn: the three headings in the list, with their dots */
.list-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}
.list-heading:first-child { margin-top: 0; }
.list-heading { flex-wrap: wrap; }
.list-heading .hico { display: inline-flex; width: 18px; height: 18px; color: hsl(0 0% 62%); }
.list-heading .hico svg { width: 100%; height: 100%; }
.list-heading .hico.favorites { color: hsl(340 95% 65%); }
.list-heading .hico.start { color: hsl(145 65% 60%); width: 16px; height: 16px; }

/* Start here: tall, narrow tiles. A row to scroll sideways on a phone (one or two columns of games),
   six next to each other where the list has three columns. */
.start-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--pad);
  margin: 0 calc(var(--pad) * -1);
  padding: 6px var(--pad) 10px;
  scrollbar-width: none;
}
.start-row::-webkit-scrollbar { display: none; }
.start-tile {
  flex: 0 0 max(var(--tile-w, 152px), var(--need, 0px));   /* set by sizeStartRow(): the shared width, or what the title needs */
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 14px 14px;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  background: var(--card-glow), hsl(0 0% 100% / .04);
  border: 1px solid hsl(0 0% 100% / .08);
  transition: transform var(--transition-bounce), border-color var(--transition), box-shadow var(--transition);
}
.start-tile:hover { transform: translateY(-3px); }
.start-tile .st-ico { color: var(--card-color); line-height: 0; filter: drop-shadow(0 3px 8px var(--card-shadow)); }
.start-tile .st-ico svg { width: 2.7rem; height: 2.7rem; display: block; }
.start-tile .st-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.15; color: #fff; white-space: nowrap; }
.start-tile .st-text {
  font-size: .8rem;
  line-height: 1.4;
  color: hsl(0 0% 66%);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.start-tile .curve { margin-top: auto; padding-top: 2px; }   /* at the bottom of every tile, whatever the length of the text */
@media (min-width: 972px) {
  /* six next to each other, as wide as each other; a tile whose title needs more is wider and the others give way */
  .start-row { overflow: visible; margin: 0; padding: 0; }
  .start-tile { flex: 1 1 0; min-width: var(--need, 0px); }
}
.list-heading .hico.streaks { color: hsl(30 95% 66%); }
.list-heading .hico.saveable { color: hsl(205 95% 72%); }
.list-heading .hico.never { color: hsl(260 80% 75%); }
.list-heading .hico.dev { color: hsl(40 100% 60%); }
.list-heading .hico.testing1, .list-heading .hico.testing2, .list-heading .hico.testing3 { color: hsl(190 90% 60%); }
.list-heading .count { font: 500 .8rem var(--font-body); color: hsl(0 0% 50%); }
.curve { display: inline-flex; gap: 3px; align-items: center; }
.curve i { width: 7px; height: 7px; border-radius: 50%; background: hsl(0 0% 100% / .15); }
.curve.l1 i:nth-child(-n+1), .curve.l2 i:nth-child(-n+2), .curve.l3 i { background: var(--curve, hsl(145 65% 60%)); }
.curve.l2 { --curve: hsl(45 85% 62%); }
.curve.l3 { --curve: hsl(25 95% 62%); }

/* Today: how many of the games of a group were played, a small bar at the end of its heading */
/* The count and the progress bar of a heading stand at the right edge, in every number of columns (Learn and Today) */
.list-heading .pg { display: inline-flex; align-items: center; gap: 8px; --pg: hsl(0 0% 62%); }
.list-heading .pg, .list-heading .count { margin-left: auto; }
.list-heading .pg.favorites { --pg: hsl(340 95% 65%); }
.list-heading .pg.streaks { --pg: hsl(30 95% 66%); }
.list-heading .pg.restore { --pg: var(--restore-dot); }
.list-heading .hico.restore { color: var(--restore-fg); }
.list-heading .pg.full { --pg: hsl(145 65% 60%); }
.list-heading .pg i { display: block; width: 64px; height: 4px; border-radius: 2px; background: hsl(0 0% 100% / .09); overflow: hidden; }
.list-heading .pg b { display: block; height: 100%; border-radius: 2px; background: var(--pg); transition: width .4s ease; }
.list-heading .pg-n { font: 600 .8rem var(--font-body); color: hsl(0 0% 56%); white-space: nowrap; }
.list-heading .pg.full .pg-n { color: var(--pg); }
@media (max-width: 400px) { .list-heading .pg i { width: 40px; } }
@media (max-width: 600px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
}

/* ── Footer ─────────────────────────────────── */
.page-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: hsl(0 0% 62%);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 419px) {
  /* Sized by their text, so a long word like "Voortgang" still fits in 320 pixels */
  .doors { display: flex; }
  .door { flex: 1 1 auto; padding: 0 6px; gap: 6px; font-size: .86rem; }
  .door svg { width: 16px; height: 16px; }
}
@media (max-width: 480px) {
  body { --pad: 14px; }
  .page-wrapper { padding: 8px 14px 48px; gap: 20px; }
  .doors { gap: 8px; }
  .door-count { display: none; }
  .games-grid { grid-template-columns: 1fr; }
}

/* Read by a screen reader only: how many games the filters show */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Reduced motion: no floating, pulsing, bouncing or fading in. The header still follows the scroll, which is
   the user's own movement. */
/* ── The popup about streaks to win back (js/restore-popup.js) ── */
.rp { display: flex; flex-direction: column; gap: 14px; }
.rp-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.rp-ring {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  color: var(--restore-fg);
  background: radial-gradient(circle, hsl(278 80% 55% / .35), hsl(278 80% 40% / .12));
  border: 1.5px dashed var(--restore-border);
}
.rp-title { margin: 0; font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; color: #fff; text-wrap: balance; }
.rp-lede { margin: 0; color: var(--text-muted, hsl(0 0% 70%)); font-size: .92rem; line-height: 1.45; max-width: 36ch; }
.rp-list, .rp-groups { display: flex; flex-direction: column; gap: 6px; }
.rp-row, .rp-group {
  border-radius: 14px;
  background: linear-gradient(180deg, hsl(275 45% 20% / .55), hsl(275 35% 14% / .4));
  border: 1px solid hsl(278 80% 65% / .4);
}
.rp-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 12px; }
.rp-ico { width: 36px; height: 36px; display: grid; place-items: center; line-height: 0; }
.rp-ico svg { width: 32px; height: 32px; }
.rp-ico .ico { width: 30px; height: 30px; }
.rp-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rp-main b { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: #fff; }
.rp-req { display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 600; color: var(--restore-fg); white-space: nowrap; }
.rp-due { font-size: .74rem; color: var(--text-muted, hsl(0 0% 65%)); white-space: nowrap; }
.rp-plus, .rp-cplus {
  display: inline-flex; align-items: center; font-family: var(--font-display); font-weight: 700;
  color: hsl(280 95% 88%); background: hsl(275 70% 50% / .25); border: 1.5px dashed hsl(278 85% 70% / .8);
}
.rp-plus { height: 30px; padding: 0 12px; border-radius: 15px; font-size: 1.02rem; }
.rp-group { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.rp-ghead { display: flex; justify-content: space-between; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 6px; border-radius: 15px;
  background: hsl(0 0% 100% / .06); border: 1px solid hsl(0 0% 100% / .1);
  font-size: .85rem; font-weight: 600; color: #fff; white-space: nowrap; max-width: 100%;
}
.rp-cico { width: 20px; height: 20px; display: grid; place-items: center; line-height: 0; }
.rp-cico svg { width: 18px; height: 18px; }
.rp-cname { overflow: hidden; text-overflow: ellipsis; }
.rp-cplus { height: 22px; padding: 0 7px; border-radius: 11px; border-width: 1px; font-size: .85rem; }
.rp-how { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; line-height: 1.45; color: var(--text-muted, hsl(0 0% 70%)); }
.rp-how b { color: #fff; font-weight: 600; }
.rp-one { margin: 0; font-size: .85rem; line-height: 1.45; color: var(--text-muted, hsl(0 0% 70%)); text-align: center; }
.rp-more { align-self: center; font-size: .85rem; font-weight: 600; color: var(--restore-fg); text-decoration: none; margin-top: -4px; }
.rp-more:hover, .rp-more:focus-visible { text-decoration: underline; }
/* The button stays in view while the list scrolls under it, on the background of the modal */
.rp-btns {
  display: flex; gap: 10px;
  position: sticky; bottom: -1px; z-index: 2;
  margin-top: -6px; padding: 14px 0 4px;
  background: linear-gradient(to bottom, hsl(225 20% 12% / 0), hsl(225 20% 12%) 14px);
}
.rp-btns button { flex: 1; height: 46px; border-radius: 12px; font: 700 .98rem var(--font-display); cursor: pointer; }
.rp-ok { background: hsl(278 75% 58%); color: #fff; border: 0; box-shadow: 0 6px 20px hsl(278 80% 50% / .35); }
.rp-ok:hover { filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  .orb, .brand-icon::before, .brand-icon img, .card-streak, .inprogress-badge, .door-intro, .card-fav-btn.active svg { animation: none !important; }
  .game-card, .start-tile, .card-emoji, .card-fav-btn, .door, .chip, .list-heading .pg b { transition: none !important; }
  .game-card:hover, .start-tile:hover, .game-card:hover .card-emoji, .card-fav-btn:hover, .card-fav-btn:active { transform: none !important; }
}
