/* Układ: narzędzie „wybierz talię + rywala” na górze, pod nim sekcje referencyjne do przewijania na telefonie przy stole. */
:root {
  --bg: #edf2ee;
  --surface: #ffffff;
  --surface-2: #f5f8f5;
  --ink: #13211c;
  --muted: #586a62;
  --line: #d3ddd7;
  --accent: #0d7656;
  --accent-ink: #ffffff;
  --gold: #a9771d;
  --good: #1f8a4c;
  --warn: #b7791f;
  --bad: #c0392b;
  --t-G: #3f9a3a; --t-R: #d4532b; --t-L: #c99a06; --t-P: #a2479e; --t-F: #a2603a;
  --t-D: #3c4a5a; --t-N: #6d5bb8; --t-C: #8a8f86; --t-W: #2d7dc8; --t-M: #7d8a94;
  --display: "Saira Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1512; --surface: #13201b; --surface-2: #182922; --ink: #e2ebe6; --muted: #94a69e;
    --line: #26392f; --accent: #3cc795; --accent-ink: #062018; --gold: #e3b456;
    --good: #4cc27c; --warn: #e2a64a; --bad: #ef6b5b;
    --t-G: #6cc565; --t-R: #f07a52; --t-L: #f0c53a; --t-P: #d27ccd; --t-F: #d08b62;
    --t-D: #8fa1b5; --t-N: #a796f0; --t-C: #b5bab1; --t-W: #64aaf0; --t-M: #a9b6bf;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1512; --surface: #13201b; --surface-2: #182922; --ink: #e2ebe6; --muted: #94a69e;
  --line: #26392f; --accent: #3cc795; --accent-ink: #062018; --gold: #e3b456;
  --good: #4cc27c; --warn: #e2a64a; --bad: #ef6b5b;
  --t-G: #6cc565; --t-R: #f07a52; --t-L: #f0c53a; --t-P: #d27ccd; --t-F: #d08b62;
  --t-D: #8fa1b5; --t-N: #a796f0; --t-C: #b5bab1; --t-W: #64aaf0; --t-M: #a9b6bf;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55;
  margin: 0;
}
.wrap {
  max-width: 1080px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; text-wrap: balance; margin: 0; letter-spacing: 0.01em; }
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); text-transform: uppercase; }
h2 { font-size: 1.9rem; text-transform: uppercase; }
h3 { font-size: 1.3rem; }
p { margin: 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* nagłówek */
header.top { padding-block: 28px 18px; display: grid; gap: 10px; }
header.top .sub { color: var(--muted); max-width: 62ch; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 600; }

nav.jump {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
nav.jump .wrap { display: flex; gap: 4px; overflow-x: auto; padding-block: 8px; scrollbar-width: none; }
nav.jump a {
  flex: 0 0 auto; text-decoration: none; color: var(--muted); font-size: 0.86rem; padding: 6px 10px; border-radius: 999px; white-space: nowrap;
}
nav.jump a:hover { color: var(--ink); background: var(--surface); }

section { padding-block: 34px 8px; display: grid; gap: 16px; }
section > header { display: grid; gap: 6px; }
section > header p { color: var(--muted); max-width: 70ch; }

/* wybór talii */
.picker { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .picker { grid-template-columns: 1fr; } }
.pick { display: grid; gap: 8px; min-width: 0; }
.decks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 420px) { .decks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.deckbtn {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 9px 8px 8px; text-align: left; cursor: pointer; display: grid; gap: 4px; min-width: 0;
}
.deckbtn .nm { font-family: var(--display); font-size: 1.15rem; font-weight: 700; line-height: 1; }
.deckbtn .tg { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deckbtn:hover { border-color: var(--muted); }
.deckbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.deckbtn[aria-pressed="true"] .tg { color: var(--accent-ink); opacity: 0.8; }
.dots { display: flex; gap: 3px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }

/* wynik pojedynku */
.duel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.duel-head { display: grid; grid-template-columns: auto 1fr; gap: 18px; padding: 18px; align-items: center; border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { .duel-head { grid-template-columns: 1fr; } }
.gauge { display: grid; gap: 2px; justify-items: start; }
.gauge .big { font-family: var(--display); font-size: 4.2rem; line-height: 0.9; font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; color: #fff; }
.v-good { background: var(--good); } .v-mid { background: var(--warn); } .v-bad { background: var(--bad); }
:root[data-theme="dark"] .verdict, :root:not([data-theme="light"]) .verdict { color: #fff; }
.headline { display: grid; gap: 8px; min-width: 0; }
.headline .vs { font-family: var(--display); font-size: 1.6rem; font-weight: 700; }
.kv { display: flex; flex-wrap: wrap; gap: 8px; }
.kv .chip b { font-family: var(--mono); font-weight: 600; }
.duel-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0; }
@media (max-width: 820px) { .duel-body { grid-template-columns: 1fr; } }
.duel-body > div { padding: 18px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.duel-body > div + div { border-left: 1px solid var(--line); }
@media (max-width: 820px) { .duel-body > div + div { border-left: 0; border-top: 1px solid var(--line); } }
ol.plan { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
ol.plan li::marker { font-family: var(--mono); color: var(--accent); font-weight: 600; }
.scen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .scen { grid-template-columns: 1fr; } }
.scen > div { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border-left: 4px solid var(--good); display: grid; gap: 4px; }
.scen > div.l { border-left-color: var(--bad); }
.scen .eyebrow { color: var(--ink); }

/* tabela stylów 3x3 */
.st { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.st th, .st td { padding: 6px 6px; text-align: center; border: 1px solid var(--line); }
.st th { font-weight: 600; color: var(--muted); font-size: 0.75rem; }
.st td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.st td.best { outline: 2px solid var(--ink); outline-offset: -2px; font-weight: 700; }

/* paski */
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(0, 9.5em) 1fr 3.2em; align-items: center; gap: 8px; font-size: 0.85rem; }
.bar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .trk { height: 9px; background: var(--surface-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.bar .fil { height: 100%; background: var(--accent); }
.bar .fil.opp { background: var(--bad); }
.bar .v { font-family: var(--mono); font-size: 0.8rem; text-align: right; font-variant-numeric: tabular-nums; }

/* karta talii */
.deckcard { display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.dc-top { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 820px) { .dc-top { grid-template-columns: 1fr; } }
.dc-top > div, .decklist { display: grid; gap: 12px; align-content: start; min-width: 0; }
.note { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); display: grid; gap: 3px; font-size: 0.92rem; }
.note.pull { border-left: 4px solid var(--good); }
.note.avoid { border-left: 4px solid var(--bad); }
.note.danger { border-left: 4px solid var(--warn); }
.list { columns: 2; column-gap: 16px; font-size: 0.86rem; margin: 0; padding: 0; list-style: none; }
.list li { display: flex; justify-content: space-between; gap: 6px; break-inside: avoid; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.list li .q { font-family: var(--mono); color: var(--muted); }
.list li.as .n::after { content: " *"; color: var(--gold); }
@media (max-width: 420px) { .list { columns: 1; } }

/* rozpoznawanie */
.recog { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 860px) { .recog { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .recog { grid-template-columns: 1fr; } }
.rc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; align-content: start; }
.rc .tell { font-size: 0.88rem; color: var(--muted); }
.rc .pk { display: flex; flex-wrap: wrap; gap: 4px; }
.finder { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.finder .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.tog { font: inherit; font-size: 0.82rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; }
.tog[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.finder .out { font-weight: 600; }

/* macierz */
.scroll { overflow-x: auto; }
table.mx { border-collapse: separate; border-spacing: 3px; font-size: 0.85rem; }
table.mx th { font-weight: 600; color: var(--muted); font-size: 0.75rem; padding: 4px 6px; text-align: left; white-space: nowrap; }
table.mx td { min-width: 58px; height: 44px; text-align: center; font-family: var(--mono); font-variant-numeric: tabular-nums; border-radius: 6px; cursor: pointer; color: #10201a; font-weight: 600; }
table.mx td.self { outline: 1px dashed var(--muted); outline-offset: -3px; }
table.mx.small td { min-width: 44px; height: 32px; font-size: 0.78rem; cursor: default; }
.legend { display: flex; gap: 10px; align-items: center; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.legend .sw { width: 120px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #e98a7e, #f2e3a7, #8fd3a4); }

/* karty z boosterów */
.bgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .bgrid { grid-template-columns: 1fr; } }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; min-width: 0; }
.drow { display: grid; grid-template-columns: minmax(0, 1fr) 140px 3.6em; gap: 8px; align-items: center; font-size: 0.84rem; }
.drow .axis { position: relative; height: 12px; background: var(--surface-2); border-radius: 3px; }
.drow .axis::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.drow .d { position: absolute; top: 1px; bottom: 1px; border-radius: 2px; }
.drow .d.pos { background: var(--good); left: 50%; }
.drow .d.neg { background: var(--bad); right: 50%; }
.drow .v { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.cat { font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-left: 4px; }
.cat.ex { color: var(--gold); }

/* logi */
.logpick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.log { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; max-height: 520px; overflow: auto; white-space: pre-wrap; }
.log .t { color: var(--accent); font-weight: 600; display: block; margin-top: 6px; }
.log .a { color: var(--ink); font-weight: 600; }
.log .k { color: var(--bad); }
.log .s { color: var(--muted); }

/* metodologia */
.method { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .method { grid-template-columns: 1fr; } }
.method .note { background: var(--surface); border: 1px solid var(--line); }
ul.tight { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: 0.9rem; }
footer { padding-block: 30px 40px; color: var(--muted); font-size: 0.8rem; }

@media (prefers-reduced-motion: no-preference) {
  .duel, .deckcard { transition: opacity .2s; }
}

/* karty – grafika z linkiem do oryginału, gdy grafika niedostępna: kafelek w kolorze typu */
.cards { display: flex; flex-wrap: wrap; gap: 8px; }
.cards.deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.card { position: relative; display: block; width: 92px; aspect-ratio: 63 / 88; max-width: 100%; border-radius: 6px; overflow: hidden;
  text-decoration: none; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); flex: 0 0 auto; }
.cards.deck .card { width: 100%; }
.card.sm { width: 64px; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 1; }
.card .cf { display: grid; align-content: space-between; height: 100%; padding: 7px 6px; gap: 4px;
  background: linear-gradient(170deg, color-mix(in srgb, var(--tc) 28%, var(--surface)) 0%, var(--surface) 70%); border-top: 4px solid var(--tc); }
.card .cf b { font-family: var(--display); font-size: 0.95rem; line-height: 1.05; word-break: break-word; }
.card.sm .cf b { font-size: 0.74rem; }
.card .cf i { font-style: normal; font-size: 0.66rem; color: var(--muted); line-height: 1.2; }
.card.sm .cf i { display: none; }
.card .cnt { z-index: 2; position: absolute; right: 4px; bottom: 4px; font-family: var(--mono); font-size: 0.74rem; font-weight: 600;
  background: var(--ink); color: var(--bg); padding: 1px 5px; border-radius: 4px; }
.card .as { z-index: 2; position: absolute; left: 4px; top: 2px; color: var(--gold); font-weight: 700; }
a.card:hover { border-color: var(--accent); transform: translateY(-1px); }
a.cl { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 2px; }
.drow .cards { margin-top: 4px; }

/* strategia */
.strat { display: grid; grid-template-columns: 1.35fr 1fr; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .strat { grid-template-columns: 1fr; } }
.strat > div { padding: 18px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.strat-data { background: var(--surface-2); border-left: 1px solid var(--line); }
@media (max-width: 860px) { .strat-data { border-left: 0; border-top: 1px solid var(--line); } }
.focus { display: grid; gap: 6px; }
.focus > div { padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); font-weight: 500; }
.sgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .sgrid { grid-template-columns: 1fr; } }
.sbox { padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); display: grid; gap: 6px; align-content: start; }
.sbox.warn { border-left: 4px solid var(--bad); }
.turns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 640px) { .turns { grid-template-columns: 1fr; } }
.turn { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); display: grid; gap: 4px; font-size: 0.9rem; }
.turn b { font-family: var(--display); font-size: 1.05rem; color: var(--accent); }
.lab { font-size: 0.82rem; font-weight: 600; margin-top: 4px; }
.strat-data .bar { grid-template-columns: minmax(0, 12em) 1fr 3em; }
.fine { font-size: 0.76rem; color: var(--muted); }
