:root {
  color-scheme: light;
  --bg: #f5f1e7;
  --surface: #fffdf6;
  --raised: #f0e3ce;
  --ink: #2c2720;
  --muted: #625444;
  --line: #cdc3ad;
  --accent: #8a3826;
  --button: #8a3826;
  --button-ink: #fff;
  --focus: #8a3826;
  --display: Georgia, serif;
  --body: "DM Sans", "Segoe UI", sans-serif;
  --radius: 8px;
  --shell: 1240px;
}
[data-edition="play"] {
  color-scheme: dark;
  --bg: #131022;
  --surface: #201a36;
  --raised: #2f2451;
  --ink: #fff6ff;
  --muted: #c5b8d8;
  --line: #504268;
  --accent: #e6beff;
  --button: #e3b6ff;
  --button-ink: #211133;
  --focus: #f0c1ff;
  --display: "Barlow Condensed", "Segoe UI", sans-serif;
  --body: Inter, "Segoe UI", sans-serif;
  --radius: 14px;
}
[data-edition="happy"] {
  --bg: #fff9ed;
  --surface: #fffdf7;
  --raised: #ffe9c1;
  --ink: #402c35;
  --muted: #664e59;
  --line: #e6cdac;
  --accent: #9a3650;
  --button: #a63753;
  --button-ink: #fff;
  --focus: #a63753;
  --display: "Nunito", "Trebuchet MS", sans-serif;
  --body: "Nunito", "Segoe UI", sans-serif;
  --radius: 24px;
  --shell: 1130px;
}
[data-edition="fun"] {
  --bg: #eef4e9;
  --surface: #f9fcf5;
  --raised: #e0ecd8;
  --ink: #162d21;
  --muted: #415d4a;
  --line: #aabda9;
  --accent: #255e3c;
  --button: #245c3a;
  --button-ink: #fff;
  --focus: #245c3a;
  --display: "Space Grotesk", "Segoe UI", sans-serif;
  --body: "Instrument Sans", "Segoe UI", sans-serif;
  --radius: 12px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.5 var(--body);
}
main { flex: 1; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.07; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.2rem, 5vw, 3.85rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); letter-spacing: -.025em; }
a { color: inherit; }
button { color: inherit; font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.skip-link { position: absolute; left: 1rem; top: 1rem; z-index: 4; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); background: var(--surface); padding: .65rem 1rem; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; min-height: 76px; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand img { width: clamp(128px, 16vw, 172px); height: auto; }
.desktop-nav, .dialog-nav, .footer-row nav { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.desktop-nav a, .dialog-nav a { font-weight: 700; text-decoration: none; padding: .5rem .7rem; border-radius: 100px; }
.desktop-nav a:hover, .dialog-nav a:hover,
.desktop-nav [aria-current], .dialog-nav [aria-current] { color: var(--accent); background: var(--raised); }
.category-trigger {
  display: none;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .52rem .8rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-weight: 750;
  background: var(--surface);
}
.category-trigger span { width: 1rem; height: .72rem; border-block: 2px solid currentColor; position: relative; }
.category-trigger span::after { position: absolute; content: ""; top: calc(50% - 1px); inset-inline: 0; border-top: 2px solid currentColor; }
dialog {
  width: min(calc(100% - 32px), 410px);
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: max(12px, var(--radius));
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 65px rgb(15 12 21 / 23%);
}
dialog::backdrop { background: rgb(13 13 23 / 58%); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.dialog-heading button { width: 44px; height: 44px; border: 0; border-radius: 50%; font-size: 1.55rem; background: var(--raised); }
.dialog-nav { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.dialog-nav a { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .65rem 1.6rem; padding-block: 1.4rem; color: var(--muted); font-size: .93rem; }
.footer-row nav { column-gap: 1.25rem; }
.footer-row a { text-underline-offset: .2em; }
.footer-row a:hover { color: var(--accent); }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .68rem 1.25rem;
  min-height: 46px;
  color: var(--button-ink);
  background: var(--button);
  border-radius: var(--radius);
  font-weight: 750;
  text-decoration: none;
}
.primary-button:hover { filter: brightness(.9); }
.page-main { padding-block: clamp(1.6rem, 5vw, 4.4rem); }
.prose { max-width: 840px; margin-inline: auto; padding: clamp(1rem, 5vw, 3.4rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-wrap: anywhere; }
.prose h1 { margin-bottom: 1rem; }
.prose h2 { margin-top: 2rem; }
.prose p, .prose table, .prose .primary-button { margin-top: .8rem; }
.prose .updated { color: var(--muted); }
.prose li + li { margin-top: .4rem; }
.prose a:not(.primary-button), .back-link a, .game-help a { color: var(--accent); text-underline-offset: .2em; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem; vertical-align: top; text-align: left; }
.prose th { background: var(--raised); }
[data-edition="play"] .header-row { min-height: 70px; }
[data-edition="play"] .site-header { border-bottom: 2px solid var(--line); }
[data-edition="happy"] .site-header { background: #fff1d6; }
[data-edition="happy"] .header-row { min-height: 78px; }
[data-edition="fun"] .site-header { border-bottom: 2px solid var(--line); }
[data-edition="fun"] .desktop-nav a { border-radius: 7px; }
@media (max-width: 849px) {
  .desktop-nav { display: none; }
  .category-trigger { display: inline-flex; }
  .header-row, [data-edition] .header-row { min-height: 63px; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 28px); }
  .footer-row { align-items: flex-start; flex-direction: column; }
  .footer-row nav { column-gap: .85rem; }
  .prose ul { padding-left: 1.2rem; }
}
