:root {
  --paper: #fdf6e3;
  --ink: #1f1b24;
  --brand: #1d5fae;
  --sky: #86cdf6;
  --green: #2f9e44;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 18px;
  padding: 0 max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
}
.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 4px 8px;
}
.hero .logo { width: 104px; height: auto; flex: none; }
.hero h1 {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 54px;
  line-height: 1;
  margin: 0;
  color: var(--brand);
  -webkit-text-stroke: 2px var(--ink);
}
.tagline { margin: 6px 0 0; font-size: 21px; font-weight: 700; }
.tagline span, .en { opacity: 0.55; font-weight: 700; }
.langs { margin-left: auto; display: flex; gap: 6px; flex: none; }
.langs button {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.langs button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.langs button:focus-visible { outline: 4px solid #ffb703; outline-offset: 2px; }
.shelf { max-width: 1180px; margin: 0 auto; }
.category h2 {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 30px;
  margin: 26px 4px 12px;
}
.category h2 .en { font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 22px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 6px 0 rgba(31, 27, 36, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); box-shadow: 0 10px 0 rgba(31, 27, 36, 0.18); }
.card:focus-visible { outline: 4px solid #ffb703; outline-offset: 3px; }
/* a card with on/off options (games.json "options"): the frame moves to the box, the checkboxes sit under the link */
.card-box {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(31, 27, 36, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card-box:hover, .card-box:focus-within { transform: translateY(-4px); box-shadow: 0 10px 0 rgba(31, 27, 36, 0.18); }
.card-box > .card { flex: 1; border: 0; border-radius: 0; box-shadow: none; }
.card-box > .card:hover, .card-box > .card:focus-visible { transform: none; box-shadow: none; }
.card-box > .card:focus-visible { outline-offset: -6px; }
.opts { border-top: 3px dashed var(--ink); background: #fffaf0; padding: 10px 18px 12px; display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 17px; font-weight: 700; line-height: 1.25; }
.opt input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--green); cursor: pointer; }
.opt small { display: block; font-size: 14px; font-weight: 400; opacity: 0.75; }
.cover { position: relative; aspect-ratio: 16 / 9; background: var(--sky); border-bottom: 4px solid var(--ink); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* ⤴ share (catalog.js shareButton): on the cover's top right, lifting with its card */
.card-wrap { position: relative; display: flex; }
.card-wrap > .card { flex: 1; }
.card-wrap:hover > .card, .card-wrap:focus-within > .card { transform: translateY(-4px); box-shadow: 0 10px 0 rgba(31, 27, 36, 0.18); }
.card-box { position: relative; }
.share {
  position: absolute; top: 12px; right: 12px; z-index: 1; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; padding: 0; cursor: pointer; color: var(--ink); background: #fffaf0;
  border: 3px solid var(--ink); box-shadow: 0 3px 0 rgba(31, 27, 36, 0.25); transition: transform 0.12s ease;
}
.share svg { width: 24px; height: 24px; }
.share:hover, .share:focus-visible { background: #ffd25a; }
.share:focus-visible { outline: 4px solid #ffb703; outline-offset: 2px; }
.card-wrap:hover .share, .card-wrap:focus-within .share { transform: translateY(-4px); }
.share:active { transform: translateY(-2px) scale(0.94) !important; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; padding: 12px 20px;
  border-radius: 99px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.play {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: #fff;
  background: var(--green);
  border: 4px solid var(--ink);
  padding-left: 4px;
}
/* in French, a game without French: the language it plays in (catalog.js card), on the cover's bottom left (clear of
   titles painted at the top) */
.lang-mark {
  position: absolute; bottom: 14px; left: 14px; padding: 3px 10px; border-radius: 99px;
  font: 700 16px/1.2 "Fredoka", system-ui, sans-serif; color: var(--ink); background: #fffaf0;
  border: 3px solid var(--ink);
}
.body { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px 18px; flex: 1; }
.body h3 { font-family: "Fredoka", system-ui, sans-serif; font-size: 28px; margin: 0; }
.body h3 .en { font-size: 18px; }
.blurb { margin: 0; font-size: 18px; line-height: 1.35; }
.blurb.en { font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.badge {
  font-size: 14px;
  font-weight: 700;
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #eef7ff;
}
.badge.plays { background: #fff3c4; }
.btn {
  align-self: flex-start;
  margin-top: auto;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  background: var(--green);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 8px 28px;
}
/* the Topach banner (catalog.js topachBanner: only once Topach is in the stores) */
.topach {
  display: flex; align-items: center; gap: 18px; margin: 18px 0 8px; padding: 16px 20px;
  background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink);
}
.topach img { width: 96px; height: 96px; border-radius: 22px; flex: none; }
.topach h2 { font-family: "Fredoka", system-ui, sans-serif; font-size: 28px; margin: 0; }
.topach p { margin: 4px 0 10px; font-weight: 700; opacity: 0.75; }
.topach-stores { display: flex; flex-wrap: wrap; gap: 10px; }
.topach-stores .btn { margin: 0; text-decoration: none; background: var(--ink); font-size: 19px; }
@media (max-width: 560px) { .topach { align-items: flex-start; } .topach img { width: 64px; height: 64px; } .topach h2 { font-size: 22px; } }
.foot { max-width: 1180px; margin: 32px auto 0; font-size: 15px; opacity: 0.6; text-align: center; }
.error { font-size: 20px; font-weight: 700; }
@media (max-width: 560px) {
  .hero { gap: 12px; padding-top: 14px; }
  .hero .logo { width: 72px; }
  .hero h1 { font-size: 38px; -webkit-text-stroke-width: 1.5px; }
  .tagline { font-size: 17px; }
  .hero { flex-wrap: wrap; }
  .langs { margin-left: 0; width: 100%; }
  .langs button { font-size: 16px; padding: 5px 12px; }
  .grid { grid-template-columns: 1fr; }
  .category h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
