/* ═══════════ WK Game Suite · paper and ink ═══════════ */

:root {
  --paper: #f3eee2; --paper2: #e9e2d2; --ink: #1b1915; --muted: #6b655a;
  --venn: #2f8f4e; --summit: #d9482b; --sticker: #f2c230;
  --font-px: 'Pixelify Sans', 'Courier New', monospace;
  --font-num: 'Silkscreen', 'Courier New', monospace;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #1a1916; --paper2: #24221e; --ink: #efe9dc; --muted: #a59f92; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

.sheet { max-width: 760px; margin: 0 auto; padding: 18px 16px 40px; }

/* ── Masthead ── */
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 2px solid var(--ink); background: var(--paper); font-family: var(--font-px); font-size: 15px; white-space: nowrap; }
.pill b { font-family: var(--font-num); font-size: 14px; font-weight: 400; }
.pill .wkb { font-size: 16px; }
.pill.acct:hover, .pill.acct:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.title { margin: 26px 0 0; font-family: var(--font-px); font-weight: 700; font-size: clamp(40px, 11vw, 84px); line-height: .95; letter-spacing: 1px; }
.title span { display: inline-block; }
.title.stamp span { animation: stamp .24s steps(2) both; animation-delay: calc(var(--i) * 55ms); }
@keyframes stamp {
  0% { opacity: 0; transform: translateY(-40%) scale(1.25, .75); }
  50% { opacity: 1; transform: translateY(6%) scale(1.12, .82); }
  100% { opacity: 1; transform: none; }
}
.reset { margin: 10px 0 0; font-family: var(--font-px); font-size: 17px; color: var(--muted); }
.reset b { font-family: var(--font-num); font-weight: 400; color: var(--ink); }

/* ── Game cards ── */
.games { display: grid; gap: 18px; margin-top: 28px; }
.game { position: relative; display: grid; grid-template-columns: 200px 1fr; border: 3px solid var(--ink); background: var(--paper); text-decoration: none; color: var(--ink);
  transition: transform .08s steps(2), box-shadow .08s steps(2); }
.game:hover, .game:focus-visible { transform: translate(-4px, -4px); box-shadow: 8px 8px 0 var(--ink); outline: none; }
.game:active { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.block { position: relative; display: grid; place-items: center; background: var(--block); border-right: 3px solid var(--ink); min-height: 150px; }
.block canvas { width: 160px; height: 110px; border: 3px solid var(--ink); background: var(--ink); }
.sticker { position: absolute; top: -12px; left: -12px; padding: 4px 8px; background: var(--sticker); color: #1b1915; border: 3px solid var(--ink); font-family: var(--font-num); font-size: 13px; transform: rotate(-8deg); }
.info { padding: 16px 18px; display: grid; align-content: center; gap: 4px; }
.info h2 { margin: 0; font-family: var(--font-px); font-weight: 700; font-size: 34px; line-height: 1; }
.pitch { margin: 0; font-size: 17px; font-weight: 700; }
.facts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 2px solid var(--ink); font-size: 14px; font-weight: 800; }
.fact b { font-family: var(--font-num); font-weight: 400; font-size: 13px; }
.fact.today.played { background: var(--block); color: #fff; border-color: var(--ink); }
@media (max-width: 560px) {
  .game { grid-template-columns: 1fr; }
  .block { border-right: 0; border-bottom: 3px solid var(--ink); min-height: 132px; }
  .block canvas { width: 144px; height: 99px; }
  .info { padding: 14px; }
  .info h2 { font-size: 30px; }
}

/* ── Similar games (other people's) ── */
.similar { margin-top: 40px; }
.similar h2 { margin: 0; font-family: var(--font-px); font-weight: 700; font-size: 26px; }
.similar .sub { margin-top: 4px; }
.others { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.other { display: grid; gap: 3px; height: 100%; padding: 12px 14px; border: 2px solid var(--ink); text-decoration: none; color: var(--ink); background: var(--paper);
  transition: transform .08s steps(2), box-shadow .08s steps(2); }
.other:hover, .other:focus-visible { transform: translate(-3px, -3px); box-shadow: 5px 5px 0 var(--ink); outline: none; }
.oname { font-family: var(--font-px); font-weight: 700; font-size: 20px; }
.oname i { font-style: normal; font-size: 15px; color: var(--muted); }
.opitch { font-size: 14px; font-weight: 700; }
.oby { font-size: 12px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Share + footer ── */
.sharebar { margin-top: 22px; display: flex; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border: 3px solid var(--ink); background: var(--ink); color: var(--paper);
  font-family: var(--font-px); font-size: 18px; text-decoration: none; white-space: nowrap; }
.btn:hover, .btn:focus-visible { background: var(--paper); color: var(--ink); outline: none; }
.btn.alt { background: var(--paper); color: var(--ink); }
.btn.alt:hover { background: var(--ink); color: var(--paper); }
.btn.sm { height: 40px; font-size: 16px; padding: 0 12px; }
.btn:disabled { opacity: .6; cursor: wait; }
.foot { margin-top: 36px; display: flex; gap: 16px; justify-content: center; font-size: 14px; color: var(--muted); }

/* ── Account modal (shared markup from account.js) ── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--paper) 70%, transparent); }
.modal-card { position: relative; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 22px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.modal-card h2 { margin: 0 0 10px; font-family: var(--font-px); font-size: 28px; }
.modal-card .x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 2px solid var(--ink); background: var(--paper); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.sub { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; font-weight: 700; }
.note { padding: 10px 12px; border: 2px solid var(--ink); font-weight: 700; }
.note.bad { background: color-mix(in srgb, var(--summit) 18%, var(--paper)); }
.note.warn { background: color-mix(in srgb, var(--sticker) 28%, var(--paper)); }
.msg:empty { display: none; } .msg { margin-top: 10px; }
.authform { display: grid; gap: 8px; }
.authform h4 { margin: 10px 0 0; font-family: var(--font-px); font-size: 18px; }
.authform .sub:empty { display: none; }
.pin { width: 100%; height: 44px; padding: 0 10px; border: 2px solid var(--ink); background: var(--paper2); font-weight: 700; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.or::before, .or::after { content: ''; flex: 1; height: 2px; background: var(--ink); opacity: .3; }

#toast { position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .15s steps(2), transform .15s steps(2);
  background: var(--ink); color: var(--paper); padding: 10px 16px; font-weight: 800; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* the pixel-dissolve wipe when opening a game */
#wipe { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 100; pointer-events: none; display: none; }
#wipe.on { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
