/* Wspólny wygląd wszystkich gier. Motywy: sepia (jak czytnik Kindle – domyślny), e-ink, noc, jasny. */
:root, :root[data-theme="sepia"] {
  --paper: #f4ecd8; --grid: #e2d5b6; --ink: #4a3b2c; --muted: #8a7760; --line: #e0d2b0;
  --p1: #3d5f8f; --p2: #a8473d; --card: #fbf5e6; --good: #4f7f4a; --ball: #fbf5e6;
  --p1-dark: #2d4870; --good-dark: #3b6237; --veil: rgba(74, 59, 44, .4); --on: #fbf5e6;
}
:root[data-theme="noc"] {
  --paper: #1b1a17; --grid: #2c2a25; --ink: #cfc6b4; --muted: #8c8472; --line: #34312b;
  --p1: #6f8fc4; --p2: #c56a5f; --card: #25231f; --good: #7ea46f; --ball: #25231f;
  --p1-dark: #4d6a99; --good-dark: #5c7d50; --veil: rgba(0, 0, 0, .55); --on: #1b1a17;
}
/* e-ink: tylko szarości, bez animacji i płynnych przejść – jak ekran czytnika */
:root[data-theme="eink"] {
  --paper: #ecebe6; --grid: #d6d5cf; --ink: #222220; --muted: #6b6a66; --line: #c9c8c2;
  --p1: #222220; --p2: #6b6a66; --card: #f5f4f0; --good: #222220; --ball: #f5f4f0;
  --p1-dark: #000000; --good-dark: #000000; --veil: rgba(34, 34, 32, .35); --on: #f5f4f0;
}
:root[data-theme="eink"] *, :root[data-theme="eink"] *::before, :root[data-theme="eink"] *::after { animation: none !important; transition: none !important; }
:root[data-theme="eink"] .btn:active { transform: none; }
:root[data-theme="jasny"] {
  --paper: #f7f5ef; --grid: #d9dde6; --ink: #1d2433; --muted: #69758a; --line: #e2e6ee;
  --p1: #2f5bea; --p2: #e0393e; --card: #ffffff; --good: #20a35a; --ball: #ffffff;
  --p1-dark: #1f43b8; --good-dark: #17803f; --veil: rgba(29, 36, 51, .45); --on: #ffffff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); transition: background .3s, color .3s; font-family: Nunito, system-ui, sans-serif; overscroll-behavior: none; }
button { font: inherit; cursor: pointer; }
.screen { display: none; height: 100dvh; flex-direction: column; max-width: 560px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); }
.screen.on { display: flex; }

#menu { justify-content: center; gap: 14px; }
h1 { font-size: 44px; font-weight: 900; margin: 0; text-align: center; letter-spacing: -0.5px; }
.sub { text-align: center; color: var(--muted); font-weight: 700; margin: -6px 0 10px; }
.btn { display: block; width: 100%; border: 0; border-radius: 16px; padding: 16px; font-size: 18px; font-weight: 900; color: var(--on); background: var(--p1); box-shadow: 0 4px 0 var(--p1-dark); text-transform: uppercase; letter-spacing: 0.4px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--p1-dark); }
.btn.alt { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.green { background: var(--good); box-shadow: 0 4px 0 var(--good-dark); }
.join { display: flex; gap: 10px; }
.join input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 16px; padding: 14px; font: inherit; font-size: 20px; font-weight: 900; text-transform: uppercase; letter-spacing: 3px; text-align: center; background: var(--card); color: var(--ink); }
.join .btn { width: auto; padding: 14px 18px; }
details { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; font-weight: 700; color: var(--muted); }
summary { font-weight: 900; color: var(--ink); cursor: pointer; }
details li { margin: 6px 0; line-height: 1.35; }

.top { display: flex; align-items: center; gap: 8px; }
.home { border: 0; background: none; font-size: 26px; color: var(--muted); padding: 4px 6px; line-height: 1; }
.score { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; font-weight: 900; font-size: 17px; }
.who { display: flex; align-items: center; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.off { opacity: .45; }
.num { font-size: 26px; min-width: 22px; text-align: center; }
.status { text-align: center; padding: 10px 14px; border-radius: 14px; font-weight: 900; font-size: 18px; color: var(--on); transition: background .2s; }
.theme { border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; font-size: 18px; padding: 4px 8px; line-height: 1.2; }
#menu .theme { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 16px; font-size: 15px; font-weight: 800; }
#menu { position: relative; }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%) translateY(-20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 14px; font-weight: 800; opacity: 0; transition: .25s; pointer-events: none; white-space: nowrap; z-index: 5; }
.toast.on { opacity: 1; transform: translateX(-50%); }

.veil { position: fixed; inset: 0; background: var(--veil); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 4; }
.veil.on { display: flex; }
.card { background: var(--card); border-radius: 24px; padding: 22px 20px; width: 100%; max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 28px; font-weight: 900; }
.card p { margin: 0; color: var(--muted); font-weight: 700; line-height: 1.35; }
.code { font-size: 38px; font-weight: 900; letter-spacing: 6px; color: var(--p1); }
.big { font-size: 56px; line-height: 1; }
.back { align-self: flex-start; position: absolute; top: max(12px, env(safe-area-inset-top)); left: 16px; color: var(--muted); font-weight: 900; text-decoration: none; font-size: 16px; padding: 6px 4px; }
