@font-face { font-family: "PGM Body"; font-weight: 400; font-display: swap; src: url("../fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype"); }
@font-face { font-family: "PGM Body"; font-weight: 700; font-display: swap; src: url("../fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype"); }
@font-face { font-family: "PGM Bold"; font-weight: 400; font-display: swap; src: url("../fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype"); }
@font-face { font-family: "PGM Display"; font-weight: 400; font-display: swap; src: url("../fonts/LilitaOne-Regular.ttf") format("truetype"); }

:root {
  --bg: #fffaf2;
  --card: #ffffff;
  --soft: #f6efe2;
  --ink: #1b1b1f;
  --muted: #5e6470;
  --line: #e8dfcf;
  --brand: #b9531f;
  --brand-ink: #ffffff;
  --brand-2: #0b7375;
  --link: #0b6e70;
  --focus: #1f6fb2;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 8px 24px rgba(40, 30, 10, .08);
  --radius: 16px;
  --display: "PGM Display", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "PGM Body", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a; --card: #1e2026; --soft: #26282f; --ink: #f2efe8; --muted: #b3b6bd; --line: #33363e;
    --brand: #f07a45; --brand-ink: #1b1b1f; --brand-2: #3cc1c3; --link: #6fd6d8; --focus: #8cc4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0 0 .45em; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
h2 { font-size: clamp(1.45rem, 3.8vw, 2rem); margin-top: 1.5em; }
h3 { font-size: 1.2rem; margin-top: 1.2em; }
p { margin: 0 0 1em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; background: var(--card); padding: 8px 12px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-head { background: var(--card); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; min-height: 62px; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-size: 1.25rem; }
.brand svg { width: 34px; height: 34px; flex: none; }
.site-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand); text-decoration: underline; }
@media (max-width: 560px) { .site-nav { margin-left: 0; width: 100%; gap: 2px 14px; font-size: .95rem; } }
.site-foot { margin-top: 64px; border-top: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .92rem; }
.site-foot .wrap { padding-top: 24px; padding-bottom: 32px; display: grid; gap: 12px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-foot a { color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 999px; border: 2px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: 700 1rem/1.2 var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: transparent; color: var(--brand); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .92rem; }
.btn.big { min-height: 58px; padding: 14px 30px; font-size: 1.12rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 4px; color: var(--link); font: inherit; text-decoration: underline; cursor: pointer; }
label { font-weight: 700; display: block; margin-bottom: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: .92rem; }
input[type="text"], input[type="number"], select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: 1rem/1.4 var(--body); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.notice { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: .95rem; }

.hero { padding: 34px 0 10px; }
.hero .wrap { display: grid; gap: 26px; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.05fr .95fr; } }
.hero .lead { font-size: 1.2rem; max-width: 34em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 8px; }
.hero-art { position: relative; min-height: 300px; }
.hero-art svg { position: absolute; width: 58%; height: auto; border-radius: 6px; box-shadow: 0 10px 30px rgba(40, 30, 10, .22); background: #fff; }
.hero-art svg:nth-child(1) { left: 0; top: 18px; transform: rotate(-5deg); }
.hero-art svg:nth-child(2) { right: 0; top: 0; transform: rotate(4deg); }
@media (max-width: 899px) { .hero-art { min-height: 260px; } }
.game-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.game-card { display: grid; gap: 8px; text-decoration: none; color: var(--ink); align-content: start; }
.game-card .thumb { background: var(--soft); border-radius: 12px; padding: 10px; display: grid; place-items: center; }
.game-card .thumb svg { width: 100%; height: auto; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.game-card h3 { margin: 6px 0 0; }
.game-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.tag-list a { display: inline-block; padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; }
.tag-list a:hover { border-color: var(--brand); color: var(--brand); }
.steps { display: grid; gap: 16px; padding: 0; list-style: none; counter-reset: s; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: s; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand-2); color: var(--bg); font: 1.2rem var(--display); margin-bottom: 8px; }
.faq dt { font-weight: 700; margin-top: 1em; }
.faq dd { margin: .3em 0 0; }
.article { padding-top: 26px; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.split { display: grid; gap: 24px; }
@media (min-width: 880px) { .split { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; } .split aside { position: sticky; top: 14px; } }
table.list { width: 100%; border-collapse: collapse; font-size: .97rem; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-family: var(--display); font-weight: 400; font-size: 1.05rem; }
table.list td:first-child { color: var(--muted); width: 2.5em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.chip-static { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--soft); font-weight: 700; font-size: .9rem; }
.thumbs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.thumbs svg, .thumbs .pg { width: 100%; height: auto; box-shadow: 0 2px 10px rgba(0, 0, 0, .16); border-radius: 3px; background: #fff; display: block; }

/* Editor */
.app { padding-top: 22px; }
.editor { display: grid; gap: 22px; }
@media (min-width: 1000px) { .editor { grid-template-columns: 430px minmax(0, 1fr); align-items: start; } .editor .previewcol { position: sticky; top: 12px; } }
.picker { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.picker label { margin: 0; position: relative; }
.picker input { position: absolute; opacity: 0; inset: 0; }
.picker span { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; height: 100%; }
.picker b { font-family: var(--display); font-weight: 400; font-size: 1.08rem; }
.picker small { color: var(--muted); font-weight: 400; line-height: 1.3; }
.picker input:checked + span { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.picker input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.pairs { display: grid; gap: 6px; }
.pair { display: grid; grid-template-columns: 1.6em 1fr 1fr 40px; gap: 6px; align-items: center; }
.pair .n { color: var(--muted); font-size: .85rem; text-align: right; }
.pair input { min-height: 40px; padding: 7px 10px; }
.pair-head { display: grid; grid-template-columns: 1.6em 1fr 1fr 40px; gap: 6px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 1.05rem; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
details.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--card); margin-bottom: 12px; }
details.panel > summary { cursor: pointer; padding: 13px 16px; font: 1.12rem var(--display); list-style: none; display: flex; justify-content: space-between; }
details.panel > summary::after { content: "+"; }
details.panel[open] > summary::after { content: "−"; }
details.panel > div { padding: 0 16px 16px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { margin: 0; position: relative; }
.swatches input { position: absolute; opacity: 0; inset: 0; }
.swatches span { display: block; width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches input:checked + span { box-shadow: 0 0 0 3px var(--ink); }
.swatches input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.preview { background: var(--soft); border-radius: var(--radius); padding: 14px; }
.preview .pages { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: 72vh; overflow: auto; padding: 4px; }
.preview .pages button { padding: 0; border: 0; background: none; cursor: zoom-in; }
.preview .pages svg { width: 100%; height: auto; display: block; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); border-radius: 3px; }
.preview .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.error { color: #c0392b; font-weight: 700; }
.zoom { position: fixed; inset: 0; z-index: 40; background: rgba(10, 10, 14, .82); display: grid; place-items: center; padding: 16px; }
.zoom svg { max-height: 92vh; width: auto; max-width: 96vw; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.zoom .close { position: absolute; top: 12px; right: 12px; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px); }
.shop-slot { border: 2px dashed var(--brand-2); border-radius: 12px; padding: 12px 14px; }

/* Play on screen */
.play { padding-top: 20px; }
.caller { text-align: center; }
.caller .clue { font: clamp(1.8rem, 6vw, 3.4rem)/1.2 var(--display); margin: 26px auto; max-width: 18em; min-height: 3.6em; display: grid; place-items: center; }
.caller .answer { font-size: 1.4rem; font-weight: 700; color: var(--brand-2); min-height: 1.6em; }
.called { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 18px; }
.called span { background: var(--soft); border-radius: 999px; padding: 4px 10px; font-size: .9rem; }
.memory { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.mcard { aspect-ratio: 5 / 6; border-radius: 12px; border: 2px solid var(--line); background: var(--brand-2); color: var(--bg); font: 1.6rem var(--display); cursor: pointer; display: grid; place-items: center; padding: 6px; }
.mcard.up { background: var(--card); color: var(--ink); font: 700 .95rem/1.25 var(--body); cursor: default; }
.mcard.found { background: color-mix(in srgb, var(--brand-2) 18%, var(--card)); border-color: var(--brand-2); color: var(--ink); font: 700 .95rem/1.25 var(--body); }
.mcard.bot { border-color: var(--brand); }
.scores { display: flex; gap: 14px; justify-content: center; font-weight: 700; margin: 10px 0 16px; flex-wrap: wrap; }
/* Phones: stack each clue above its answer so both are readable while editing. */
@media (max-width: 560px) {
  .pair-head { display: none; }
  .pair { grid-template-columns: 1.4em 1fr 40px; grid-template-rows: auto auto; row-gap: 4px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .pair .n { grid-row: 1 / span 2; align-self: start; padding-top: 10px; }
  .pair input:nth-of-type(1) { grid-column: 2; grid-row: 1; }
  .pair input:nth-of-type(2) { grid-column: 2; grid-row: 2; font-weight: 700; }
  .pair .icon-btn { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
}
