/* ── Krój nagłówków ─────────────────────────────────────── */
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/fraunces-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/fraunces-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces'; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url(../fonts/fraunces-latin-wght-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces'; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url(../fonts/fraunces-latin-ext-wght-italic.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Paleta ─────────────────────────────────────────────── */
:root {
  --paper: #f6f1e7;
  --paper-2: #efe8da;
  --surface: #fffdf8;
  --ink: #1b2a3a;
  --muted: #6c7480;
  --line: #e4dccb;
  --line-strong: #d3c8b2;
  --primary: #1e4d6b;
  --primary-hover: #163b53;
  --on-primary: #fffdf8;
  --accent: #e07a3f;
  --ok: #2f8a57;
  --ok-soft: #e4f2e8;
  --bad: #c8463a;
  --bad-soft: #f9e6e1;

  /* kolory trybów */
  --cat-map: #2a7f8f;
  --cat-capital: #5a5cc4;
  --cat-flag: #c8553d;
  --cat-trivia: #c98a1c;
  --cat-mix: #8a4d9c;

  /* mapa */
  --map-bg: #ece5d6;
  --ocean: #d3e6ee;
  --ocean-deep: #b4d0dd;
  --sphere-rim: #9fbccb;
  --grat: rgba(255, 255, 255, 0.7);
  --map-border: #fffdf8;
  --c0: #f1dca6;
  --c1: #e9c2a2;
  --c2: #c9dbab;
  --c3: #e8cdd3;
  --c4: #cfd2e8;
  --land-out: #e6e1d6;
  --hover: #f6b860;
  --dot: #fffdf8;

  --r: 16px;
  --shadow-sm: 0 1px 2px rgba(60, 45, 20, 0.06);
  --shadow: 0 1px 2px rgba(60, 45, 20, 0.05), 0 8px 24px -6px rgba(60, 45, 20, 0.12);
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1720;
    --paper-2: #131d28;
    --surface: #17222e;
    --ink: #e9eef2;
    --muted: #93a1b0;
    --line: #243241;
    --line-strong: #314356;
    --primary: #7cc4dc;
    --primary-hover: #9ad3e6;
    --on-primary: #0c1a24;
    --accent: #f0934f;
    --ok: #4fca85;
    --ok-soft: #15301f;
    --bad: #f0705f;
    --bad-soft: #3a1d1a;

    --cat-map: #4fb3c4;
    --cat-capital: #9496f0;
    --cat-flag: #ec7e63;
    --cat-trivia: #e7b04a;
    --cat-mix: #c487d6;

    --map-bg: #0c131a;
    --ocean: #18324a;
    --ocean-deep: #10243a;
    --sphere-rim: #2b4a63;
    --grat: rgba(255, 255, 255, 0.05);
    --map-border: #0f1a24;
    --c0: #5d5c40;
    --c1: #644d42;
    --c2: #475c4a;
    --c3: #5c4658;
    --c4: #464f6c;
    --land-out: #232c34;
    --hover: #c08a35;
    --dot: #7c90a0;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -8px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* ── Podstawy ───────────────────────────────────────────── */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--ui);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
.muted { color: var(--muted); }
h1, h2, .q-prompt, .brand-name { font-family: var(--display); font-optical-sizing: auto; }
.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -0.2em; }
button svg, .icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* kolor akcentu bieżącego trybu */
[data-cat='map'] { --cat: var(--cat-map); }
[data-cat='capital'] { --cat: var(--cat-capital); }
[data-cat='flag'] { --cat: var(--cat-flag); }
[data-cat='trivia'] { --cat: var(--cat-trivia); }
[data-cat='mix'] { --cat: var(--cat-mix); }

/* ── Przyciski ──────────────────────────────────────────── */
.btn {
  font: inherit; font-weight: 650; letter-spacing: 0.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid transparent; border-radius: 12px;
  padding: 11px 20px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn svg { width: 18px; height: 18px; transition: transform 0.15s; }
.btn:hover svg { transform: translateX(2px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:disabled { opacity: 0.5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface); }
.btn.big { font-size: 1.1rem; padding: 15px 30px; border-radius: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--line-strong); background: var(--paper-2); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ── Pasek górny ────────────────────────────────────────── */
.top {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 3vw, 36px);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; fill: none; stroke: var(--primary); stroke-width: 1.7; }
.brand-name { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.01em; }

.hud { display: none; flex: 1; align-items: center; gap: 14px; min-width: 0; }
body[data-screen='game'] .hud { display: flex; }
body[data-screen='game'] .top { border-bottom: 1px solid var(--line); background: var(--surface); padding-block: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden;
  padding: 6px 12px; border-radius: 99px; font-size: 0.9rem; font-weight: 600;
  background: color-mix(in srgb, var(--cat) 12%, transparent); color: var(--ink);
}
.pill .ico { color: var(--cat); }
.pill-sep { color: var(--muted); }
.hud-progress { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 80px; color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { flex: 1; height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--cat, var(--primary)); border-radius: 99px; transition: width 0.45s cubic-bezier(.2,.8,.2,1); }
.streak { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.streak .ico { width: 18px; height: 18px; fill: color-mix(in srgb, var(--accent) 25%, transparent); }
.g-score { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.g-score b { font-family: var(--display); font-size: 1.35rem; font-weight: 700; }
.g-score small { color: var(--muted); }

/* ── Strona startowa ────────────────────────────────────── */
.home { width: min(1120px, 100%); margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px) 48px; flex: 1; }

.hero { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 24px; padding: 20px 0 36px; }
.eyebrow { margin: 0 0 10px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.02; margin: 0 0 18px; font-weight: 650; letter-spacing: -0.025em; }
.hero h1 em { font-style: italic; font-weight: 500; color: var(--primary); }
.lead { margin: 0 0 26px; color: var(--muted); font-size: 1.12rem; max-width: 46ch; }
.hero-stats { list-style: none; display: flex; gap: 32px; margin: 0; padding: 0; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats b { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.hero-stats span { color: var(--muted); font-size: 0.88rem; }
.hero-globe { position: relative; display: grid; place-items: center; }
.hero-globe::before {
  content: ''; position: absolute; width: 92%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--ocean-deep) 55%, transparent), transparent 68%);
  filter: blur(18px); transform: translateY(6%);
}
#globe { position: relative; width: min(100%, 430px); aspect-ratio: 1; cursor: grab; touch-action: none; }
#globe:active { cursor: grabbing; }

.setup {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 32px);
}
.step h2 { font-size: 1.2rem; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-family: var(--ui); font-size: 0.8rem; font-weight: 700;
  background: var(--ink); color: var(--surface);
}
.setup-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px 36px; margin-top: 30px; }

.modes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.mode {
  position: relative; font: inherit; text-align: left; cursor: pointer; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, background 0.15s;
}
.mode:hover { border-color: color-mix(in srgb, var(--cat) 50%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.mode-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; margin-bottom: 8px;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 13%, transparent);
}
.mode-icon .ico { width: 23px; height: 23px; }
.mode-title { font-weight: 700; font-size: 1rem; }
.mode-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.35; }
.mode-check {
  position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--cat); color: #fff; opacity: 0; transform: scale(0.6);
  transition: opacity 0.15s, transform 0.15s;
}
.mode-check .ico { width: 14px; height: 14px; stroke-width: 2.6; }
.mode.active { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 7%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 16%, transparent); }
.mode.active .mode-check { opacity: 1; transform: none; }
.mode.active .mode-icon { background: var(--cat); color: #fff; }
@media (prefers-color-scheme: dark) { .mode-check, .mode.active .mode-icon { color: #10181f; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 0.95rem; cursor: pointer; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 99px; padding: 8px 16px;
  transition: border-color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--surface); font-weight: 600; }

.setup-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  margin-top: 30px; padding-top: 24px; border-top: 1px dashed var(--line-strong);
}
.setup-meta { display: flex; flex-direction: column; gap: 10px; }
.best { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.best .ico { color: var(--cat-trivia); width: 20px; height: 20px; }
.toggle { display: inline-flex; gap: 10px; align-items: center; color: var(--muted); font-size: 0.92rem; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 36px; height: 21px; border-radius: 99px; background: var(--line-strong); transition: background 0.15s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); transition: transform 0.15s; box-shadow: var(--shadow-sm); }
.toggle input:checked + .switch { background: var(--ok); }
.toggle input:checked + .switch::after { transform: translateX(15px); }
.toggle input:focus-visible + .switch { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ── Gra ────────────────────────────────────────────────── */
.game {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 16px;
  padding: 16px clamp(12px, 2vw, 24px);
}
body.mode-click .game { grid-template-columns: minmax(280px, 330px) 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow: auto; position: relative;
}
.card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--cat); border-radius: var(--r) var(--r) 0 0; }
.q-label { color: var(--cat); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; }
.q-prompt { font-size: clamp(1.9rem, 3.2vw, 2.6rem); font-weight: 650; line-height: 1.08; letter-spacing: -0.02em; margin-top: -8px; overflow-wrap: anywhere; }
.q-prompt.small { font-size: clamp(1.3rem, 2vw, 1.55rem); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.q-flag-wrap { display: grid; place-items: center; padding: 18px; background: var(--paper); border-radius: 12px; }
.q-flag { width: 100%; max-width: 280px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 10px 24px -8px rgba(40, 30, 10, 0.35); }

.options { display: grid; gap: 9px; }
.opt {
  font: inherit; font-size: 1rem; text-align: left; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.12s, background 0.12s, transform 0.12s, box-shadow 0.12s;
}
.opt:hover:not(:disabled) { border-color: var(--cat); transform: translateX(2px); box-shadow: var(--shadow-sm); }
.opt:disabled { cursor: default; }
.opt .key {
  flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  background: var(--paper); border: 1px solid var(--line); font-size: 0.8rem; font-weight: 700; color: var(--muted);
}
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.correct .key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .key { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt:disabled:not(.correct):not(.wrong) { opacity: 0.5; }
.opt.correct, .opt.wrong { animation: pop 0.25s ease-out; }

.options.flags { grid-template-columns: 1fr 1fr; }
.options.flags .opt { flex-direction: column; align-items: stretch; padding: 8px; gap: 6px; position: relative; }
.options.flags .key { position: absolute; top: 13px; left: 13px; background: var(--surface); }
.options.flags img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }
.flag-name { font-size: 0.85rem; font-weight: 600; text-align: center; min-height: 1.3em; }

/* wpisywanie nazwy */
.type-box { display: flex; flex-direction: column; gap: 10px; }
.type-row { display: flex; gap: 8px; }
#q-input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; color: var(--ink);
  padding: 12px 14px; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
#q-input::placeholder { color: var(--muted); opacity: 0.8; }
#q-input:focus { outline: none; border-color: var(--cat); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 18%, transparent); }
.type-box.ok #q-input { border-color: var(--ok); background: var(--ok-soft); color: var(--ink); }
.type-box.bad #q-input { border-color: var(--bad); background: var(--bad-soft); color: var(--ink); }
#q-input:disabled { opacity: 1; -webkit-text-fill-color: var(--ink); }
.type-box .btn:disabled { opacity: 0.45; cursor: default; }
.type-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 1.6em; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 0.88rem; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); cursor: pointer; }
.link-btn:hover { text-decoration-color: var(--cat); }
.hint-word { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 1.05rem; font-weight: 700; letter-spacing: 0.28em; color: var(--cat); white-space: pre-wrap; }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.hint { margin: 0; color: var(--muted); font-size: 0.9rem; padding: 12px 14px; background: var(--paper); border-radius: 10px; }

.feedback { border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; animation: pop 0.22s ease-out; border: 1px solid transparent; }
.feedback.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.feedback.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.verdict .ico { width: 22px; height: 22px; padding: 3px; border-radius: 50%; color: #fff; stroke-width: 2.8; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.ok .verdict .ico { background: var(--ok); }
.feedback.bad .verdict .ico { background: var(--bad); }
.feedback.bad .verdict { color: var(--ink); font-weight: 500; }
.pts { margin-left: auto; font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 1.1rem; }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }

.fact { display: flex; gap: 12px; align-items: flex-start; font-size: 0.95rem; }
.fact-flag { width: 56px; flex: none; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1); margin-top: 3px; }
.fact-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--cat-trivia); background: color-mix(in srgb, var(--cat-trivia) 15%, transparent); }
.fact-icon .ico { width: 20px; height: 20px; }
.note { margin-top: 4px; font-size: 0.87rem; color: var(--muted); }
.list { display: grid; gap: 5px; font-size: 0.93rem; }
.list img { width: 22px; vertical-align: -3px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1); margin-right: 4px; }

.card-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; padding-top: 4px; }

/* ── Mapa ───────────────────────────────────────────────── */
.map-wrap {
  position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line);
  box-shadow: var(--shadow); min-height: 360px; background: var(--map-bg);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1px);
  background-size: 14px 14px;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }
#map .bg { fill: transparent; }
#map .sphere { fill: var(--ocean); stroke: var(--sphere-rim); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
#map .graticule { fill: none; stroke: var(--grat); stroke-width: 0.7; vector-effect: non-scaling-stroke; }
#map .countries path { stroke: var(--map-border); stroke-width: 0.7; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill 0.15s; }
#map .countries path[data-c='0'] { fill: var(--c0); }
#map .countries path[data-c='1'] { fill: var(--c1); }
#map .countries path[data-c='2'] { fill: var(--c2); }
#map .countries path[data-c='3'] { fill: var(--c3); }
#map .countries path[data-c='4'] { fill: var(--c4); }
#map .countries path.out, #map .countries path.nostate { fill: var(--land-out); }
#map .dots circle { fill: var(--dot); stroke: var(--ink); stroke-opacity: 0.55; stroke-width: 1; vector-effect: non-scaling-stroke; }
#map .dots circle.out { display: none; }
#map.clickable .countries path:not(.out):not(.nostate), #map.clickable .dots circle { cursor: pointer; }
#map.clickable .countries path:not(.out):not(.nostate):hover, #map.clickable .dots circle:hover { fill: var(--hover); }
#map .target { fill: var(--accent) !important; stroke: #fff; stroke-width: 1.4; animation: pulse 1.3s ease-in-out infinite; }
#map .correct { fill: var(--ok) !important; stroke: #fff; stroke-width: 1.4; animation: none; }
#map .wrong { fill: var(--bad) !important; stroke: #fff; stroke-width: 1.4; }
#map .dots circle.target, #map .dots circle.correct, #map .dots circle.wrong { display: inline; stroke-width: 2.5; stroke-opacity: 1; }
@keyframes pulse { 50% { fill-opacity: 0.45; } }

.zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.zoom .icon-btn { box-shadow: var(--shadow-sm); }

/* ── Podsumowanie ───────────────────────────────────────── */
.summary { width: min(920px, 100%); margin: 0 auto; padding: 24px clamp(16px, 3vw, 32px) 48px; flex: 1; }
.result {
  display: flex; gap: clamp(24px, 5vw, 48px); align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 40px);
}
.result h1 { margin: 0 0 6px; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; font-weight: 650; letter-spacing: -0.02em; }
.result-text { flex: 1; min-width: 260px; }
.ring {
  --p: 0;
  width: 168px; height: 168px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--cat, var(--primary)) calc(var(--p) * 1%), var(--paper-2) 0);
  display: grid; place-content: center; text-align: center; position: relative;
}
.ring::before { content: ''; position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-family: var(--display); font-size: 2.6rem; font-weight: 650; line-height: 1; }
.ring small { position: relative; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.record { display: inline-flex; align-items: center; gap: 6px; color: var(--cat-trivia); font-weight: 700; margin: 2px 0 0; font-size: 1.05rem; }
.record .ico { width: 20px; height: 20px; }
.stats { display: flex; gap: 32px; margin: 20px 0 24px; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats span { color: var(--muted); font-size: 0.85rem; }
.stats b { font-family: var(--display); font-size: 1.8rem; font-weight: 600; line-height: 1.15; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.mistakes-wrap h2 { margin: 40px 0 14px; font-size: 1.5rem; font-weight: 600; }
.mistakes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.mistake { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.mistake > img { width: 48px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1); flex: none; }
.m-q { font-size: 0.86rem; color: var(--muted); line-height: 1.35; }
.m-a { margin-top: 2px; }
.m-a s { color: var(--bad); text-decoration-thickness: 1.5px; }

.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 18px; }
.foot a { color: inherit; }
body[data-screen='game'] .foot { display: none; }

/* ── Duże ekrany: gra w wysokości okna ─────────────────── */
@media (min-width: 900px) {
  body[data-screen='game'] { height: 100vh; overflow: hidden; }
}

/* ── Średnie ekrany ─────────────────────────────────────── */
@media (max-width: 1060px) and (min-width: 981px) {
  .mode { padding: 14px 12px; }
  .mode-desc { font-size: 0.8rem; }
}
@media (max-width: 980px) {
  .modes { grid-template-columns: repeat(2, 1fr); }
  .setup-row { grid-template-columns: 1fr; }
}

/* ── Telefon / wąskie okna ──────────────────────────────── */
@media (max-width: 899px) {
  .hero { grid-template-columns: 1fr; padding-top: 4px; gap: 0; }
  .hero-globe { order: -1; margin: 0 auto -8px; width: min(78vw, 320px); }
  .hero-text { text-align: center; }
  .lead { margin-inline: auto; }
  .hero-stats { justify-content: center; }

  .top { flex-wrap: wrap; row-gap: 8px; }
  body[data-screen='game'] .top { padding: 8px 12px; }
  body[data-screen='game'] .brand-name { display: none; }
  .hud { gap: 10px; }
  .pill { padding: 5px 10px; font-size: 0.82rem; }
  .pill .pill-sep, .pill .muted { display: none; }

  .game { grid-template-columns: 1fr !important; display: flex; flex-direction: column; padding: 10px; gap: 10px; }
  .card { padding: 18px 16px 16px; gap: 12px; }
  .map-wrap { min-height: 0; flex: none; height: 46vh; }
  body.mode-click .map-wrap { height: 58vh; }
  body.mode-show .map-wrap { height: 40vh; order: -1; }
  body:not(.mode-click):not(.mode-show) .map-wrap { height: 30vh; }
  .q-flag-wrap { padding: 12px; }
  .q-flag { max-width: 220px; }
  .hint { display: none; }
}

@media (max-width: 600px) {
  .modes { gap: 8px; }
  .mode { padding: 12px; }
  .mode-icon { width: 36px; height: 36px; margin-bottom: 4px; }
  .mode-desc { font-size: 0.8rem; }
  .setup { border-radius: 18px; }
  .setup-foot .btn { width: 100%; }
  .hud-progress .bar { display: none; }
  .mistakes { grid-template-columns: 1fr; }
  .result { justify-content: center; text-align: center; }
  .stats, .row { justify-content: center; }
}

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