/* 2042ed Play Kit · shared look for every Play minigame
   Load it first, then the game's own <style> for game-specific things.
   Tokens: games may add their own (e.g. --wall) under :root and :root[data-theme="dark"].
   The kit always sets data-theme on <html> (site choice, else system), so games never
   need a prefers-color-scheme media query. */

:root{
  --bg:#f6f1e7;--ink:#1d1d1b;--card:#fffaf0;--line:#d8ccb4;--teal:#007c77;--on-teal:#fff;
  --danger:#c0392b;--danger-edge:#7d241b;--ok:#1f9d55;
  --d0:#1f9d55;--d1:#e0a800;--d2:#d63b2f;--d3:#1d1d1b;
  --radius:12px;--font:system-ui,-apple-system,"Segoe UI",sans-serif;
  color-scheme:light;
}
:root[data-theme="dark"]{
  --bg:#1b1a18;--ink:#f1ece2;--card:#26241f;--line:#4a463c;--teal:#1fa39d;
  --d3:#f1ece2;
  color-scheme:dark;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font);display:flex;flex-direction:column;align-items:center;min-height:100vh;min-height:100dvh}

/* buttons */
button{font:inherit;font-weight:600;font-size:1rem;padding:10px 16px;min-height:44px;border-radius:999px;border:0;background:var(--teal);color:var(--on-teal);cursor:pointer;touch-action:manipulation}
button:focus-visible,a:focus-visible{outline:3px solid var(--teal);outline-offset:2px}
button.ghost{background:transparent;color:var(--ink);border:2px solid currentColor}
button.pk-reset{background:var(--danger);color:#fff;font-size:1.1rem;padding:10px 22px;box-shadow:0 3px 0 var(--danger-edge)}
button.pk-round{width:44px;height:44px;padding:0;border-radius:50%;font-size:1.25rem;font-weight:800;background:transparent;color:var(--ink);border:2px solid currentColor}
button.pk-help-btn{background:var(--ink);color:var(--bg);border:0;font-size:1.4rem}

/* header */
.pk-header{width:100%;max-width:1200px;display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;padding:12px 16px}
.pk-brand{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.pk-brand h1{margin:0;font-size:clamp(1.3rem,3vw,2rem)}
.pk-crumb{color:inherit;opacity:.5;text-decoration:none;font-weight:800;letter-spacing:.03em;margin-right:.3em}
.pk-crumb:hover{opacity:1;text-decoration:underline}
.pk-logo{display:inline-flex;background:var(--teal);padding:6px 12px;border-radius:var(--radius)}
.pk-logo img{height:34px;width:auto;display:block}
.pk-logo{cursor:pointer;transition:transform .15s}
.pk-logo:hover{transform:scale(1.04)}
.pk-btns{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
@media (max-width:560px){.pk-logo img{height:26px}.pk-header{padding:10px 12px}}

/* level buttons, coloured by difficulty band (green, yellow, red, black) */
.pk-levels{width:100%;display:flex;flex-wrap:wrap;gap:6px}
.pk-levels button{padding:6px 0;width:44px;border-radius:10px;--dc:var(--d0);border:2px solid var(--dc);background:color-mix(in srgb,var(--dc) 15%,transparent);color:inherit}
.pk-levels button.lvd1{--dc:var(--d1)}
.pk-levels button.lvd2{--dc:var(--d2)}
.pk-levels button.lvd3{--dc:var(--d3);background:color-mix(in srgb,var(--dc) 28%,transparent)}
.pk-levels button.on{background:var(--dc);color:var(--bg);box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--dc)}
.pk-levels button.lvd0.on,.pk-levels button.lvd2.on{color:#fff}
.pk-levels button.lvd1.on{color:#1d1d1b}
.pk-levels button.done::after{content:"✓";font-size:.7em;margin-left:2px}

/* overlays: help + confirm */
.pk-ov{position:fixed;inset:0;background:rgba(0,0,0,.6);display:flex;align-items:center;justify-content:center;z-index:50;padding:16px}
.pk-ov[hidden]{display:none}
.pk-card{background:var(--bg);color:var(--ink);border-radius:18px;padding:20px 22px;max-width:560px;width:100%;max-height:88vh;overflow:auto;box-shadow:0 10px 40px rgba(0,0,0,.4);text-align:left}
.pk-card h2{margin:0 0 .6rem;font-size:1.4rem}
.pk-card h3{margin:1rem 0 .4rem;font-size:1.05rem}
.pk-card p,.pk-card li{line-height:1.45}
.pk-keys{display:grid;grid-template-columns:auto 1fr;gap:6px 12px;align-items:center}
kbd{display:inline-block;min-width:30px;text-align:center;padding:3px 8px;border-radius:7px;border:2px solid currentColor;border-bottom-width:4px;font-family:inherit;font-weight:700;font-size:.95rem}
.pk-actions{display:flex;gap:10px;justify-content:flex-end;align-items:center;flex-wrap:wrap;margin-top:14px}
.pk-actions .pk-info{margin-right:auto;font-weight:600;color:inherit}
.pk-confirm .pk-card{text-align:center;max-width:420px}
.pk-confirm .pk-actions{justify-content:center}
.pk-confirm button{min-width:110px;font-size:1.2rem}

/* end-of-level popup (Play.end) */
.pk-end .pk-card{text-align:center;max-width:460px}
.pk-end h2{font-size:1.7rem}
.pk-end .pk-win h2{color:var(--ok)}
.pk-end .pk-lose h2{color:var(--danger)}
.pk-end-text{margin:.4rem 0 .8rem}
.pk-stats{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:10px 0}
.pk-stats div{background:var(--card);border:2px solid var(--line);border-radius:12px;padding:6px 12px;min-width:90px}
.pk-stats dt{font-size:.8rem;opacity:.7}
.pk-stats dd{margin:0;font-size:1.4rem;font-weight:800;font-variant-numeric:tabular-nums}
.pk-medals{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin:10px 0}
.pk-medal{display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 10px;border-radius:12px;border:2px dashed var(--line);opacity:.45;min-width:96px;font-size:.85rem}
.pk-medal b{font-size:1.8rem}
.pk-medal.got{opacity:1;border-style:solid;border-color:var(--ok);background:color-mix(in srgb,var(--ok) 12%,transparent)}
.pk-end .pk-actions{justify-content:center}

/* game menu (click on the logo) */
.pk-menu .pk-card{text-align:center;max-width:380px}
.pk-menu-main{display:flex;flex-direction:column;gap:10px;margin:14px 0}
.pk-menu-main button,.pk-menu-exit{font-size:1.15rem;min-height:50px}
.pk-menu-exit{display:flex;align-items:center;justify-content:center;border-radius:999px;border:2px solid var(--danger);color:var(--danger);font-weight:700;text-decoration:none}
.pk-menu-exit:hover{background:var(--danger);color:#fff}
.pk-menu-links{display:flex;gap:14px;justify-content:center;flex-wrap:wrap;margin:6px 0 12px}
.pk-menu-link{color:var(--teal);font-weight:700}
.pk-menu-opts{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;border-top:2px solid var(--line);padding-top:12px}
.pk-menu-opts button{font-size:.95rem}

/* small helpers games can use */
.pk-msg{font-weight:700;min-height:1.4em}
.pk-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* No prefers-reduced-motion rule on purpose (Stefano): idle animations are slow and always run. */
