: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; }
.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;
}
.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;
}
.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; }
}
