/* ================= TOKENY ================= */
:root {
  --bg: #f3ead7;
  --bg2: #ebdfc4;
  --card: #fffaf0;
  --ink: #2f2216;
  --muted: #6e5a45;
  --line: #d9c7a3;
  --accent: #8b2e2e;
  --accent-ink: #fff;
  --gold: #b8862b;
  --green: #4f7d2a;
  --blue: #2f6fd2;
  --stage: #3d5a2a;
  --shadow: 0 2px 0 rgba(90, 60, 30, .08), 0 8px 24px rgba(90, 60, 30, .10);
  --radius: 14px;
  --head: #5b2a1c;
  --head-ink: #f7ecd6;
  --rule-bg: #e7f1dc; --rule-ink: #2f5a17;
  --faq-bg: #dde9f8; --faq-ink: #1f4f97;
  --interp-bg: #fbecc9; --interp-ink: #7a5310;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17120d; --bg2: #1f1811; --card: #261d15; --ink: #efe3cc; --muted: #b9a68b; --line: #3e3124;
    --accent: #c4534a; --gold: #d9a948; --green: #8fbf5a; --blue: #6fa0ef; --stage: #22331a;
    --shadow: 0 2px 0 rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --head: #2a1710; --head-ink: #f2e6cf;
    --rule-bg: #24361a; --rule-ink: #b7dd94; --faq-bg: #1b2a44; --faq-ink: #a9c6f5; --interp-bg: #3d2f12; --interp-ink: #f0cf86;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17120d; --bg2: #1f1811; --card: #261d15; --ink: #efe3cc; --muted: #b9a68b; --line: #3e3124;
  --accent: #c4534a; --gold: #d9a948; --green: #8fbf5a; --blue: #6fa0ef; --stage: #22331a;
  --shadow: 0 2px 0 rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --head: #2a1710; --head-ink: #f2e6cf;
  --rule-bg: #24361a; --rule-ink: #b7dd94; --faq-bg: #1b2a44; --faq-ink: #a9c6f5; --interp-bg: #3d2f12; --interp-ink: #f0cf86;
  color-scheme: dark;
}

/* ================= BAZA ================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.55 "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-image: radial-gradient(circle at 20% 0%, rgba(184,134,43,.10), transparent 40%), radial-gradient(circle at 100% 30%, rgba(139,46,46,.07), transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: Cinzel, Georgia, serif; line-height: 1.2; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
a { color: var(--accent); }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
b, strong { font-weight: 700; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: 8px; z-index: 100; }
.skip:focus { left: 8px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ================= NAGŁÓWEK ================= */
.top { position: sticky; top: 0; z-index: 30; background: var(--head); color: var(--head-ink); box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: #8fbf5a; position: relative; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
.brand-mark::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px; background: #d9a066; border-bottom-left-radius: 50% 100%; border-bottom-right-radius: 50% 100%; border-bottom: 2px solid #7a5634; }
.brand-mark::after { content: ""; position: absolute; width: 12px; height: 14px; left: 12px; top: 16px; background: #d23b2f; border-radius: 6px 6px 2px 2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-family: Cinzel, serif; font-size: 1.15rem; letter-spacing: .04em; }
.brand-text small { opacity: .8; font-size: .78rem; }
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--head-ink); text-decoration: none; padding: 8px 12px; border-radius: 999px; white-space: nowrap; font-weight: 600; opacity: .85; }
.tabs a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.tabs a.on { background: var(--head-ink); color: var(--head); opacity: 1; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.btn-mech { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: var(--head-ink); padding: 7px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.btn-mech:hover { background: rgba(255,255,255,.2); }
.count { background: var(--gold); color: #1d140c; border-radius: 999px; padding: 0 7px; font-size: .8rem; margin-left: 4px; }
.icon-btn { background: transparent; border: 1px solid currentColor; border-radius: 999px; width: 36px; height: 36px; cursor: pointer; opacity: .85; flex: none; }
.icon-btn:hover { opacity: 1; }
@media (max-width: 860px) {
  .tabs { order: 3; flex-basis: 100%; }
  .top-actions { margin-left: auto; }
}

/* ================= UKŁAD ================= */
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.view { animation: fadeUp .35s ease both; }
.view-head { margin-bottom: 18px; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 70ch; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.foot { max-width: 1200px; margin: 0 auto; padding: 16px 16px 40px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; transition: transform .12s, background .2s; }
.btn:hover { transform: translateY(-1px); background: var(--bg2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.small { padding: 6px 10px; font-size: .9rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .92rem; font-weight: 600; transition: background .2s, color .2s; }
.chip:hover { background: var(--bg2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.static { cursor: default; }
.chip .dot-c { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }

/* ================= START ================= */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: center; margin-bottom: 28px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--gold); }
.hero-anim .anim { box-shadow: var(--shadow); }
.hero-tag { display: block; background: rgba(0,0,0,.35); color: #ffe08a; padding: 6px 14px; font-family: Cinzel, serif; font-weight: 700; text-decoration: none; font-size: .95rem; }
.hero-tag:hover { text-decoration: underline; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.search-wrap { position: relative; max-width: 560px; }
.search-wrap input, .filter-row input, textarea, .field input, .calc-form input, .calc-form select {
  width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
textarea { resize: vertical; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 20; max-height: 360px; overflow: auto; display: none; }
.search-results.open { display: block; }
.search-results a { display: block; padding: 10px 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a:focus { background: var(--bg2); }
.search-results small { color: var(--muted); display: block; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 860px) { .quick { grid-template-columns: 1fr 1fr; } }
@media (min-width: 861px) { .quick { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 480px) { .quick { grid-template-columns: 1fr; } }
.qcard { display: flex; flex-direction: column; gap: 4px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.qcard:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(90,60,30,.18); }
.qcard b { font-family: Cinzel, serif; font-size: 1.05rem; }
.qcard span:last-child { color: var(--muted); font-size: .93rem; }
.qi { font-size: 1.8rem; }

/* ================= ANIMACJA (odtwarzacz) ================= */
.anim { background: var(--stage); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.anim-stage { padding: 10px; background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.08), transparent 70%); }
.anim-svg { display: block; width: 100%; height: auto; max-height: 360px; overflow: visible; }
.anim-caption { background: rgba(0,0,0,.28); color: #f7ecd6; padding: 10px 14px; min-height: 3.4em; font-size: .97rem; }
.anim-caption b { color: #ffe08a; }
.step-no { display: inline-block; background: rgba(255,255,255,.15); border-radius: 999px; padding: 0 8px; font-size: .8rem; margin-right: 6px; font-weight: 700; }
.anim-controls { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: rgba(0,0,0,.4); flex-wrap: wrap; }
.ab { width: 38px; height: 34px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.ab:hover { background: rgba(255,255,255,.2); }
.ab-play { width: 52px; background: #ffd34d; color: #2a1a08; border-color: #ffd34d; font-weight: 700; }
.ab-play:hover { background: #ffe07a; }
.anim-dots { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; }
.dot { width: 11px; height: 11px; border-radius: 50%; border: 0; background: rgba(255,255,255,.3); cursor: pointer; padding: 0; }
.dot.on { background: #ffd34d; transform: scale(1.25); }

.node { transition: transform .75s cubic-bezier(.45,.05,.3,1), opacity .4s; }
.node.leave { opacity: 0; transition: opacity .4s; }
.node.leave .inner { transform: scale(.6); transition: transform .4s; transform-box: fill-box; transform-origin: center; }
.enter-tile .inner { animation: tileDrop .6s cubic-bezier(.2,.9,.3,1.2) both; }
.enter-slide { transition: transform .8s cubic-bezier(.2,.8,.3,1.1); }
.enter-slide .inner { animation: tileGlow 1.4s ease both; }
.enter-pop .inner { animation: pop .55s cubic-bezier(.2,.9,.3,1.4) both; }
.node-meeple.enter-pop .inner { animation: meepleDrop .6s cubic-bezier(.3,.9,.4,1.3) both; }
.dragon-rot { transition: transform .5s ease; }
.node-tile > .inner { transition: transform .55s ease; }
.dragon-arrow { animation: pulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.hl-rect { animation: hl 1.6s ease-in-out infinite; }
.ghost-rect { animation: ghost 1.4s ease-in-out infinite; }
.ghost-text { fill: #fff; font: 700 15px "Source Sans 3", sans-serif; }
.arrow-path { animation: dash 1s linear infinite; }
.scene-label { fill: #fff; font: 700 22px Cinzel, serif; paint-order: stroke; stroke: #1d140c; stroke-width: 5px; }
.scene-label.small { font: 700 13px "Source Sans 3", sans-serif; stroke-width: 4px; }
.q-text { font: 700 18px sans-serif; fill: #b8862b; }
.tile-label { font: 700 9px sans-serif; fill: #1d140c; }
.pts-inner { animation: ptsUp 2.4s ease-out both; }
.pts-text { font: 800 18px "Source Sans 3", sans-serif; fill: #fff; }
.pts-text.dark { fill: #1d140c; }
.sparkle { animation: pulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

@keyframes tileDrop { from { transform: translateY(-40px) scale(1.15); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tileGlow { 0% { filter: drop-shadow(0 0 0 #ffd34d); } 40% { filter: drop-shadow(0 0 10px #ffd34d); } 100% { filter: none; } }
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes meepleDrop { 0% { transform: translateY(-50px); opacity: 0; } 60% { transform: translateY(3px); opacity: 1; } 100% { transform: none; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes hl { 0%,100% { stroke-opacity: 1; fill-opacity: .18; } 50% { stroke-opacity: .45; fill-opacity: .05; } }
@keyframes ghost { 0%,100% { stroke-opacity: 1; } 50% { stroke-opacity: .35; } }
@keyframes dash { to { stroke-dashoffset: -32; } }
@keyframes ptsUp { 0% { transform: translateY(10px) scale(.4); opacity: 0; } 15% { transform: translateY(0) scale(1.15); opacity: 1; } 30% { transform: scale(1); } 80% { opacity: 1; transform: translateY(-26px); } 100% { opacity: 0; transform: translateY(-40px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .pts-inner { animation: none !important; }
}

/* ================= ZASADY ================= */
.rules { display: grid; gap: 18px; margin-top: 16px; }
.rule { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); scroll-margin-top: 90px; }
.rule.no-anim { grid-template-columns: 1fr; }
@media (max-width: 860px) { .rule { grid-template-columns: 1fr; } }
.anim-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ex-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-tabs .chip { padding: 4px 11px; font-size: .86rem; }
.ex-desc { font-size: .95rem; color: var(--muted); min-height: 1.5em; }
.ex-desc b { color: var(--ink); }
.rule-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rule-icon { font-size: 1.6rem; }
.rule ul { padding-left: 1.2em; margin: .4em 0 0; }
.rule li { margin-bottom: .35em; }
.rule-lead { font-weight: 600; }
.tile-gallery { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.tile-gallery figure { margin: 0; text-align: center; width: 110px; font-size: .82rem; color: var(--muted); }
.tile-gallery svg { width: 90px; height: 90px; border-radius: 6px; box-shadow: var(--shadow); }

/* ================= SPORNE ================= */
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.conf { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.conf-rule { background: var(--rule-bg); color: var(--rule-ink); }
.conf-faq { background: var(--faq-bg); color: var(--faq-ink); }
.conf-interp { background: var(--interp-bg); color: var(--interp-ink); }
.filter-row { max-width: 560px; margin-bottom: 12px; }
.sc-list { display: grid; gap: 12px; }
.sc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); scroll-margin-top: 90px; }
.sc > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.sc > summary::-webkit-details-marker { display: none; }
.sc-q { font-weight: 700; font-size: 1.04rem; }
.sc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sc-ico { font-size: 1.3rem; line-height: 1.3; }
.sc-chev { transition: transform .25s; color: var(--muted); font-size: 1.2rem; }
.sc[open] .sc-chev { transform: rotate(180deg); }
.sc-body { padding: 0 18px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; animation: fadeUp .3s ease both; }
.sc-body.no-anim { grid-template-columns: 1fr; }
@media (max-width: 860px) { .sc-body { grid-template-columns: 1fr; } }
.verdict { background: var(--bg2); border-left: 5px solid var(--green); padding: 10px 14px; border-radius: 8px; font-weight: 700; margin-bottom: 10px; }
.src { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.also { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .9rem; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ================= ASYSTENT ================= */
.wizard-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .wizard-layout { grid-template-columns: 1fr; } .phases { display: flex; overflow-x: auto; } }
.phases { list-style: none; margin: 0; padding: 0; position: sticky; top: 90px; }
.phases li { padding: 10px 14px; border-left: 4px solid var(--line); color: var(--muted); font-weight: 600; transition: all .3s; white-space: nowrap; }
.phases li.done { color: var(--ink); border-color: var(--green); }
.phases li.now { color: var(--accent); border-color: var(--accent); background: var(--card); }
.wizard { display: grid; gap: 14px; }
.wstep { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); animation: fadeUp .35s ease both; }
.wstep.past { opacity: .72; }
.wstep.past .opts { display: none; }
.wphase { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; }
.wq { font-size: 1.12rem; font-weight: 700; margin: 4px 0 10px; }
.winfo { margin: 6px 0 10px; }
.winfo ol { padding-left: 1.3em; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.answer { display: inline-block; margin-top: 4px; background: var(--bg2); padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: .92rem; }
.wanim { margin: 10px 0; }
table.mini { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: .95rem; }
table.mini th, table.mini td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--muted); font-weight: 600; }

/* ================= ZDJĘCIE ================= */
.photo-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .photo-layout { grid-template-columns: 1fr; } }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border: 2.5px dashed var(--line); border-radius: var(--radius); padding: 40px 16px; cursor: pointer; transition: background .2s, border-color .2s; }
.drop:hover, .drop.over { background: var(--bg2); border-color: var(--gold); }
.drop-icon { font-size: 2.6rem; }
.photo-stage { position: relative; margin-top: 10px; border-radius: 10px; overflow: hidden; cursor: crosshair; user-select: none; touch-action: manipulation; }
.photo-stage img { display: block; width: 100%; height: auto; }
.pin { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; cursor: pointer; animation: pop .35s ease both; }
.marker-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.markers { display: flex; gap: 6px; flex-wrap: wrap; }
.mk { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: .8rem; }
.mk.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.ai-settings { margin: 10px 0; font-size: .92rem; }
.ai-settings summary { cursor: pointer; color: var(--muted); }
.field { display: block; margin-top: 8px; }
.field input { margin-top: 4px; }
.ai-result { margin-top: 8px; }
.ai-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; animation: fadeUp .3s ease both; }
.ai-box h3, .ai-box h4 { font-family: Cinzel, serif; margin: .6em 0 .3em; }
.ai-box ul, .ai-box ol { padding-left: 1.2em; }
.ai-box.err { border-color: var(--accent); }
.typing::after { content: "▍"; animation: pulse 1s infinite; display: inline-block; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= KALKULATOR ================= */
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.calc-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; }
@media (max-width: 700px) { .calc-body { grid-template-columns: 1fr; } }
.calc-form { display: grid; gap: 12px; }
.calc-form label { display: grid; gap: 4px; font-weight: 600; }
.calc-form .check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.calc-form .check input { width: 22px; height: 22px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { text-align: center; width: 80px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 1.2rem; font-weight: 700; }
.calc-out { text-align: center; background: var(--bg2); border-radius: var(--radius); padding: 24px; }
.calc-num { font-family: Cinzel, serif; font-size: 4rem; font-weight: 700; color: var(--accent); line-height: 1; }
.calc-num.bump { animation: pop .4s ease; }
.calc-formula { margin-top: 10px; color: var(--muted); }

/* ================= PANEL MECHANIK ================= */
.drawer-back, .modal-back { position: fixed; inset: 0; background: rgba(10, 6, 2, .5); z-index: 40; animation: fadeUp .2s ease; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: var(--card); z-index: 50; padding: 18px; overflow-y: auto; box-shadow: -10px 0 30px rgba(0,0,0,.3); animation: slideIn .28s ease; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.presets { display: flex; gap: 8px; margin: 6px 0 14px; }
.mgroup { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.mgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mgroup-head b { font-family: Cinzel, serif; }
.mitem { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0 8px 8px; border-top: 1px dashed var(--line); }
.mitem:first-of-type { margin-top: 8px; }
.mitem small { display: block; color: var(--muted); }
.mitem.disabled { opacity: .45; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }

.modal { position: fixed; z-index: 50; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(760px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: pop .25s ease; }
.modal-close { position: absolute; right: 12px; top: 12px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; z-index: 60; animation: fadeUp .3s ease; font-weight: 600; }

/* ================= WIRTUALNA PLANSZA ================= */
.b-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.b-tog { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; }
.b-zoom { display: inline-flex; gap: 4px; margin-left: auto; }
.b-layout { display: grid; grid-template-columns: 1fr 340px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .b-layout { grid-template-columns: 1fr; } }
.b-stage { background: #3d5a2a; background-image: radial-gradient(circle at 50% 40%, rgba(255,255,255,.08), transparent 70%); border-radius: var(--radius); border: 1px solid var(--line); height: min(72vh, 680px); min-height: 360px; overflow: hidden; touch-action: none; position: relative; }
.b-svg { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; }
.b-svg:active { cursor: grabbing; }
.b-panel { display: grid; gap: 10px; }
@media (min-width: 901px) { .b-panel { max-height: min(72vh, 680px); overflow-y: auto; padding-right: 4px; } }
.b-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); animation: fadeUp .25s ease both; }
.b-card h3 { font-size: 1rem; margin-bottom: 6px; }
.b-card p { margin: 0 0 6px; }
.b-players { display: grid; gap: 4px; }
.b-pl { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.b-pl.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.b-pl .b-sc { font-family: Cinzel, serif; font-weight: 700; font-size: 1.2rem; }
.b-pl .b-sup { grid-column: 2 / 4; font-size: .8rem; color: var(--muted); }
.b-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.4); vertical-align: middle; margin-right: 4px; }
.b-deck { text-align: right; }
.b-turn { font-size: 1.05rem; margin-bottom: 8px; }
.b-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; max-height: 330px; overflow-y: auto; }
.b-cat { position: relative; border: 2px solid transparent; background: none; padding: 2px; border-radius: 8px; cursor: pointer; }
.b-cat:hover { border-color: var(--gold); }
.b-cat svg { width: 100%; height: auto; border-radius: 4px; display: block; }
.b-cat-n { position: absolute; right: 2px; bottom: 2px; background: rgba(0,0,0,.7); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: 0 4px; }
.b-drawn { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.b-drawn svg { width: 64px; height: 64px; border-radius: 6px; box-shadow: var(--shadow); flex: none; }
.b-hint { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; color: var(--ink); font: inherit; }
.b-hint:hover { border-color: var(--gold); }
.b-hint-no { flex: none; width: 24px; height: 24px; border-radius: 50%; background: #ffd34d; color: #2a1a08; display: grid; place-items: center; font-weight: 800; }
.b-log { list-style: none; margin: 0; padding: 0; font-size: .88rem; max-height: 200px; overflow-y: auto; }
.b-log li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.b-warn { color: var(--accent); font-weight: 700; }
.b-plrow { display: grid; grid-template-columns: 1fr 120px; gap: 6px; margin-bottom: 6px; }
.b-plrow input, .b-plrow select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-width: 0; }
.b-mode { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; padding: 8px 12px; display: grid; gap: 6px; font-size: .93rem; }
/* elementy SVG planszy */
.b-new > .b-wrap { animation: tileDrop .5s cubic-bezier(.2,.9,.3,1.2) both; }
.b-spot rect { fill: rgba(255,211,77,.18); stroke: #ffd34d; stroke-width: 3; stroke-dasharray: 8 6; animation: ghost 1.4s ease-in-out infinite; cursor: pointer; }
.b-spot text { fill: #ffd34d; font: 700 34px sans-serif; pointer-events: none; }
.b-spot:hover rect { fill: rgba(255,211,77,.35); }
.b-hintno circle { fill: #ffd34d; stroke: #2a1a08; stroke-width: 2; cursor: pointer; }
.b-hintno text { font: 800 15px sans-serif; fill: #2a1a08; pointer-events: none; }
.b-pending { cursor: pointer; opacity: .93; }
.b-pend-frame { fill: none; stroke: #ffd34d; stroke-width: 4; }
.b-opt { cursor: pointer; }
.b-opt-c { stroke: #fff; stroke-width: 2.5; animation: pulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.b-opt-t { font: 800 13px sans-serif; fill: #fff; pointer-events: none; }
.b-opt-t.dark { fill: #2a1a08; }
.b-recall { cursor: pointer; filter: drop-shadow(0 0 6px #ffd34d); }
.b-hl { fill: rgba(255,211,77,.22); stroke: #ffd34d; stroke-width: 4; pointer-events: none; animation: hl 1.6s ease-in-out infinite; }
.b-openhl { fill: none; stroke: #ff8a80; stroke-width: 3; stroke-dasharray: 6 5; pointer-events: none; }
.b-chance rect { fill: rgba(0,0,0,.28); stroke: rgba(255,255,255,.5); stroke-width: 2; pointer-events: none; }
.b-chance text { fill: #fff; font: 700 17px sans-serif; pointer-events: none; }
.b-chance text.small { font-size: 12px; font-weight: 600; }
.b-chance.dead rect { fill: rgba(192,57,43,.35); stroke: #ff8a80; }

.b-name { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: left; }
.b-name span { opacity: .45; font-size: .85em; }
.b-name:hover span { opacity: 1; }
.b-name-in { font: inherit; font-weight: 700; color: var(--ink); background: var(--bg2); border: 1px solid var(--gold); border-radius: 6px; padding: 2px 6px; width: 100%; min-width: 0; }
.b-start-row { display: flex; gap: 12px; align-items: center; }
.b-start-prev svg { width: 72px; height: 72px; border-radius: 6px; box-shadow: var(--shadow); display: block; }
.b-start-more { margin-top: 6px; }
.b-start-more summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.b-start-more .b-catalog { margin-top: 8px; max-height: 240px; }
.b-cat.sel { border-color: var(--accent); background: var(--bg2); }

/* plansza – smok, portal, analiza */
.b-lairpick rect { fill: rgba(255,138,128,.25); stroke: #ff8a80; stroke-width: 4; animation: ghost 1.2s ease-in-out infinite; cursor: pointer; }
.b-ddir { cursor: pointer; }
.b-ddir circle { fill: #ffd34d; stroke: #6b1d14; stroke-width: 2.5; animation: pulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.b-ddir.on circle { fill: #ff8a80; }
.b-ddir text { font: 800 20px sans-serif; fill: #2a1a08; pointer-events: none; }
.b-dpath { fill: rgba(192,57,43,.30); stroke: #ff8a80; stroke-width: 3; stroke-dasharray: 7 5; pointer-events: none; }
.b-opt.portal .b-opt-c { stroke: #b388ff; stroke-width: 3; }
.b-val { display: inline-block; font-size: .78rem; font-weight: 800; padding: 0 7px; border-radius: 999px; margin-left: 4px; }
.b-val.pos { background: var(--rule-bg); color: var(--rule-ink); }
.b-val.neg { background: var(--interp-bg); color: var(--interp-ink); }
.b-evrow { display: grid; grid-template-columns: auto 90px 1fr auto; gap: 6px; align-items: center; font-size: .9rem; margin-bottom: 3px; }
.b-evbar { height: 9px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.b-evbar i { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.b-alist { margin: 4px 0 0; padding-left: 1.1em; font-size: .88rem; }
.b-alist li { margin-bottom: 3px; }
.b-cat-f { position: absolute; left: 2px; top: 2px; font-size: .7rem; background: rgba(0,0,0,.6); border-radius: 6px; padding: 0 3px; }

.b-best { fill: rgba(179,136,255,.18); stroke: #b388ff; stroke-width: 4; pointer-events: none; animation: hl 1.4s ease-in-out infinite; }
.b-mbest { cursor: pointer; }
.b-mbest circle { fill: #ffd34d; stroke: #2a1a08; stroke-width: 2; }
.b-mbest text { font: 800 17px sans-serif; fill: #2a1a08; pointer-events: none; }

.b-opt.portal { opacity: .45; }
.b-opt.portal:hover { opacity: 1; }
.b-goto { display: inline-block; font-size: .8rem; font-weight: 700; padding: 0 8px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); margin-left: 4px; cursor: pointer; }
.b-goto:hover { border-color: var(--gold); }

/* panel planszy – bez poziomego przewijania */
.b-layout > * { min-width: 0; }
.b-panel { overflow-x: hidden; }
.b-card { min-width: 0; overflow-wrap: anywhere; }
.b-log { overflow-x: hidden; }
.b-pl .b-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-card table.mini { table-layout: fixed; font-size: .85rem; }
.b-final { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; background: var(--bg2); }
.b-final.win { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.b-final-head { display: flex; align-items: center; gap: 6px; }
.b-final-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-final-pos { font-size: 1.1rem; width: 1.6em; }
.b-final-sc { font-family: Cinzel, serif; font-weight: 700; font-size: 1.35rem; }
.b-final-parts { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .82rem; color: var(--muted); margin-top: 4px; }
.b-final-parts b { color: var(--ink); }

/* ================= INSTALACJA / OFFLINE ================= */
.install-card { margin-bottom: 18px; }
.install-head { display: flex; gap: 14px; align-items: center; }
.install-head img { border-radius: 12px; box-shadow: var(--shadow); flex: none; }
.install-head h2 { margin-bottom: 4px; }
.install-head p { margin: 0; }
.install-how { margin-top: 8px; font-size: .95rem; }
.install-how p { margin-bottom: 6px; }
.btn-install { background: var(--gold); color: #1d140c; border-color: var(--gold); }
.btn-install:hover { background: #e2b85a; }
.offline-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--rule-bg); color: var(--rule-ink); }
body.is-offline .top { box-shadow: inset 0 -3px 0 var(--gold), 0 2px 12px rgba(0,0,0,.25); }
@media (display-mode: standalone) { .install-card { display: none; } }
