:root {
  --bg: #e4e2d3;
  --panel: #f1efe4;
  --panel-2: #d6d3bd;
  --ink: #23271b;
  --muted: #676b55;
  --line: #b5b394;
  --accent: #4b5a2a;
  --accent-ink: #f3f1e4;
  --ok: #3d6b2a;
  --bad: #a3321f;
  --steel: #6f7d8c;
  --fuel: #c08a1e;
  --ammo: #8a6d3b;
  --grass: #a4a57a;
  --grass-2: #9a9b70;
  --mine: #e0b100;
  --enemy: #b8402c;
  --barb: #5a5f4c;
  --ally: #2f6fb0;
  --bar-dark: #262a1c;
  --bar-mid: #3a4128;
  --bar-text: #e3e3cf;
  --bar-dim: #aeb092;
  --gold: #d9c46a;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --head: "Impact", "Arial Narrow", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); min-height: 100vh; }
.hidden { display: none !important; }
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.3em; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
button { font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 6px 12px; border-radius: 4px; }
button:hover:not(:disabled) { filter: brightness(1.1); }
button:disabled { background: var(--panel-2); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }
button.small { padding: 2px 8px; font-size: 13px; }
input, select { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fffdf7; color: var(--ink); }
input[type=number] { width: 80px; }

/* Logowanie */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: repeating-linear-gradient(135deg, #3a4128 0 22px, #353b24 22px 44px); }
.auth-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); border-top: 6px solid var(--accent); }
.auth-logo { margin: 0; font: 48px var(--head); letter-spacing: 8px; color: var(--accent); line-height: 1.1; }
.tagline { margin: 4px 0 20px; color: var(--muted); }
.auth-card label { display: grid; gap: 4px; margin-bottom: 12px; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.auth-tabs button { flex: 1; background: transparent; border: none; border-radius: 0; color: var(--muted); padding: 8px 4px; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.auth-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: bold; }
.auth-notice { padding: 10px 12px; border: 1px solid var(--ok); background: #e3ecd0; color: var(--ok); border-radius: 4px; margin-bottom: 14px; }
.auth-notice.err { border-color: var(--bad); background: #f5dcd5; color: var(--bad); }
.auth-form .hint { font-size: 13px; margin: 8px 0 0; }
.auth-form .resend { margin: 0; }
.account-form { display: grid; gap: 10px; max-width: 360px; }
.account-form label { display: grid; gap: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Górny pasek */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 10px 16px; background: var(--bar-dark); color: var(--bar-text); }
.brand { font: 26px var(--head); letter-spacing: 4px; color: var(--gold); }
.village-pick select { background: var(--bar-mid); color: var(--bar-text); border-color: #59603f; }
.village-pick .muted { color: var(--bar-dim); margin-left: 6px; }
.resources { display: flex; gap: 16px; flex-wrap: wrap; flex: 1; }
.res { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.res .dot { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.res.full .val { color: #ff9b7a; }
.res small { color: var(--bar-dim); }
.me { display: flex; gap: 10px; align-items: center; }
.me .link { color: var(--gold); }

.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 16px; background: var(--bar-mid); }
.tabs button { background: transparent; border: none; border-radius: 0; color: var(--bar-text); padding: 10px 12px; text-transform: uppercase; font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
.tabs button.active { background: var(--bg); color: var(--ink); }
.badge { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 12px; margin-left: 4px; }

main { padding: 16px; max-width: 1100px; margin: 0 auto; }
h2 { margin: 4px 0 12px; font: 26px var(--head); letter-spacing: 1.5px; text-transform: uppercase; font-weight: normal; }
h2 .muted { font: 16px var(--font); text-transform: none; letter-spacing: 0; }
h3 { margin: 18px 0 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--panel-2); font-weight: normal; color: var(--muted); font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cost { display: flex; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; font-size: 14px; }
.cost span.lack { color: var(--bad); }
.desc { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.queue li { margin: 4px 0; }
.timer { font-variant-numeric: tabular-nums; font-weight: bold; }
.bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; background: var(--ok); }

/* Mapa */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; }
@media (max-width: 760px) { .map-wrap { grid-template-columns: 1fr; } }
.map-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); aspect-ratio: 1; width: 100%; max-width: 640px; }
.tile { background: var(--grass); border: none; border-radius: 0; padding: 0; color: transparent; position: relative; min-width: 0; display: grid; place-items: center; }
.tile:nth-child(odd) { background: var(--grass-2); }
.tile .ic { position: absolute; inset: 14%; width: 72%; height: 72%; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .35)); }
.tile.v:hover { filter: brightness(1.12); }
.tile.sel { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 1; }
.tile.out { background: #4e533c; }
.map-nav { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; }
.legend .ic { width: 16px; height: 16px; }

.report-row { cursor: pointer; }
.report-row.unread td:first-child { font-weight: bold; }
.won { color: var(--ok); }
.lost { color: var(--bad); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bar-dark); color: var(--bar-text); padding: 10px 18px; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.3); max-width: 90vw; }
.toast.err { background: var(--bad); color: #fff; }

.cls { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 0 5px; border-radius: 3px; margin-right: 4px; color: #fff; }
.cls-inf { background: #5b6b35; }
.cls-armor { background: #6a5a3a; }
.cls-air { background: #3e5a78; }

/* ───── Ikony ───── */
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
.ic .cut { fill: #000; fill-opacity: .35; }
.ic-res { width: 20px; height: 20px; }
.ic-row { width: 22px; height: 22px; margin-right: 4px; color: var(--accent); vertical-align: middle; }
.ic-th { width: 26px; height: 26px; color: var(--accent); }
.brand .ic { color: var(--gold); width: 24px; height: 24px; vertical-align: -3px; }
.auth-logo .ic { width: 40px; height: 40px; vertical-align: -4px; }
.tabs button .ic { margin-right: 6px; width: 17px; height: 17px; vertical-align: -3px; }
.tabs button.active .ic { color: var(--accent); }
button .ic { vertical-align: -3px; }
.cost .ic { width: 15px; height: 15px; margin-right: 3px; vertical-align: -3px; }
.cost > span[title="Personel"] .ic { color: var(--muted); }
.res .ic-res { color: var(--bar-text); }
.timer + .ic, td.num > .ic { color: var(--muted); }
.with-tile { display: flex; gap: 10px; align-items: center; }
.tile-ic { width: 46px; height: 46px; border-radius: 6px; display: grid; place-items: center; background: var(--panel-2); color: var(--accent); flex-shrink: 0; border: 1px solid var(--line); }
.tile-ic .ic { width: 34px; height: 34px; }
.tile-ic.cls-bg-inf { background: #dfe3c8; color: #4a5a24; }
.tile-ic.cls-bg-armor { background: #e6dcc5; color: #5d4b2c; }
.tile-ic.cls-bg-air { background: #d5dfe8; color: #2f4a66; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; }
.stats .ic { color: var(--ink); opacity: .75; margin-right: 2px; }
.unit-list { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }
.unit-list .ic { width: 20px; height: 20px; color: var(--accent); margin-right: 2px; }
tr.dim td { opacity: .5; }
.queue .ic { color: var(--accent); width: 20px; height: 20px; }
td.bad .ic, .won .ic, .lost .ic { width: 16px; height: 16px; }
.medal .ic { width: 16px; height: 16px; margin-right: 4px; }
.medal.m1 { color: #c9a227; } .medal.m2 { color: #9aa3ab; } .medal.m3 { color: #a8693a; }
.tile.mine, .legend .mine .ic, .map-title.mine .ic { color: var(--mine); }
.tile.enemy, .legend .enemy .ic, .map-title.enemy .ic { color: var(--enemy); }
.tile.barb, .legend .barb .ic, .map-title.barb .ic { color: var(--barb); }

/* ───── Przejmowanie baz ───── */
.loyalty { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.loyalty .ic { color: var(--accent); margin-right: 4px; }
.loyalty .bar { margin: 6px 0 4px; height: 10px; }
.howto { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.howto .ic-row { width: 40px; height: 40px; flex-shrink: 0; }
.loyalty-report { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.loyalty-report.conquered { background: #e3ecd0; border-color: var(--ok); color: var(--ok); }
.loyalty-report.conquered .ic-row { color: var(--ok); }

/* ───── Drużyny ───── */
.tile.ally, .legend .ally .ic, .map-title.ally .ic { color: var(--ally); }
.tag { display: inline-block; font: 600 11px/1.6 var(--font); letter-spacing: .5px; padding: 0 5px; border-radius: 3px; background: #545b46; color: #fff; vertical-align: 1px; }
.tag.big { font-size: 18px; padding: 0 8px; vertical-align: 3px; background: var(--ally); }
button.danger { background: var(--bad); border-color: var(--bad); }
.admin-ic { color: #c9a227 !important; }
.desc .ic { vertical-align: -3px; color: var(--ally); }

/* ───── Wsparcie ───── */
button.ally-btn { background: var(--ally); border-color: var(--ally); }
button.ally-btn:disabled, button.danger:disabled { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.ally-text, .ally-text .ic { color: var(--ally); }
.note { display: flex; gap: 8px; align-items: center; border-color: var(--ally); background: #e1e9f2; }
.note .ic-row { color: var(--ally); }
td .unit-list { margin-top: 4px; }

button.secondary:disabled, button.link:disabled { opacity: .4; background: transparent; }

/* ───── Przewijana mapa ───── */
main:has(.map-wrap2) { max-width: 1400px; }
.map-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.map-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.map-tools .zoom-btns button { width: 30px; font-weight: bold; }
.map-jump { display: flex; align-items: center; gap: 4px; }
.map-jump input { width: 64px; padding: 3px 6px; }
.map-wrap2 { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 14px; margin-top: 8px; }
@media (max-width: 820px) { .map-wrap2 { grid-template-columns: 1fr; } .map-side { display: grid; grid-template-columns: 200px 1fr; gap: 10px; } }
.map-view { position: relative; height: min(72vh, 640px); min-height: 360px; overflow: hidden; border: 2px solid #3a4128; border-radius: 6px;
  background: #4e533c repeating-linear-gradient(45deg, transparent 0 10px, rgba(0,0,0,.07) 10px 20px);
  cursor: grab; touch-action: none; user-select: none; outline: none; }
.map-view:focus-visible { border-color: var(--ally); }
.map-view.grabbing { cursor: grabbing; }
.map-layer { position: absolute; left: 0; top: 0; will-change: transform;
  background-color: #a3a672;
  background-image: linear-gradient(rgba(0,0,0,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.07) 1px, transparent 1px),
    radial-gradient(circle at 30% 40%, rgba(255,255,255,.05), transparent 60%); }
.map-layer .cell { position: absolute; display: grid; place-items: center; pointer-events: none; }
.map-layer .cell .spr { width: 100%; height: 100%; display: block; overflow: visible; }
.map-layer .mv .spr { filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.map-layer .cell.sel { outline: 2px solid #fff; outline-offset: -2px; box-shadow: inset 0 0 0 4px rgba(0,0,0,.25); background: rgba(255,255,255,.12); }
.map-layer .cell.cur::after { content: ""; position: absolute; inset: 6% 18%; border: 2px dashed var(--mine); border-radius: 50%; animation: curpulse 2s ease-in-out infinite; }
@keyframes curpulse { 50% { opacity: .35; } }
.ruler { position: absolute; background: rgba(38, 42, 28, .82); color: #e3e3cf; font: 11px var(--font); overflow: hidden; pointer-events: none; z-index: 2; }
.ruler-x { left: 22px; right: 0; top: 0; height: 18px; }
.ruler-y { top: 18px; bottom: 0; left: 0; width: 22px; }
.ruler > div { position: absolute; left: 0; top: 0; will-change: transform; }
.ruler-x span, .ruler-y span { position: absolute; display: grid; place-items: center; }
.ruler-x span { top: 0; height: 18px; margin-left: -22px; }
.ruler-y span { left: 0; width: 22px; margin-top: -18px; }
.ruler-corner { position: absolute; left: 0; top: 0; width: 22px; height: 18px; background: #262a1c; z-index: 3; }
.map-tip { position: absolute; z-index: 4; background: rgba(28, 31, 21, .94); color: #eeeedd; padding: 6px 9px; border-radius: 5px; font-size: 12px;
  line-height: 1.45; pointer-events: none; max-width: 260px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.map-tip .muted { color: #b9bb9c; }
.map-hint { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: #f0f0e0; background: rgba(0,0,0,.35); padding: 2px 7px; border-radius: 4px; pointer-events: none; z-index: 2; }
.map-side canvas { width: 200px; height: 200px; border: 2px solid #3a4128; border-radius: 4px; cursor: crosshair; touch-action: none; image-rendering: pixelated; display: block; }
.map-side .legend { margin: 6px 0 10px; }
.map-side .panel { margin: 0; }
.info-sprite { width: 128px; height: 96px; margin: -4px auto 0; background: #a3a672; border-radius: 6px; border: 1px solid var(--line); }
.info-sprite .spr { width: 100%; height: 100%; }

/* ───── Premium ───── */
.pp-chip { background: rgba(217, 196, 106, .15); border: 1px solid rgba(217, 196, 106, .45); color: var(--gold); padding: 2px 9px; border-radius: 12px; cursor: pointer; }
.pp-chip .ic-res { color: var(--gold) !important; }
.pp-chip.on { background: rgba(217, 196, 106, .3); }
.boost-chip { background: rgba(110, 190, 110, .15); border: 1px solid rgba(110, 190, 110, .5); color: #7fd07f; padding: 2px 9px; border-radius: 12px; cursor: pointer; }
.boost-chip .ic-res { color: #7fd07f !important; }
.tabs .tab-premium { color: var(--gold); }
.tabs .tab-premium.active { color: #7a5d00; }
button.pp-btn { background: #c9a227; border-color: #a8851a; color: #2b2100; }
button.pp-btn .ic { color: #2b2100; }
.pp-big { font: 44px var(--head); color: #a8851a; display: flex; align-items: center; gap: 10px; }
.pp-big .ic { width: 46px; height: 46px; color: #c9a227; }
.pp-big small { font-size: 18px; color: var(--muted); }
.perks { margin: 6px 0 12px; padding-left: 18px; }
.pp-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 6px; }
.pp-pack { position: relative; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; margin: 0; }
.pp-pack.best { border: 2px solid #c9a227; }
.pp-ribbon { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: #c9a227; color: #2b2100; font-size: 11px; padding: 1px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .5px; }
.pp-name { font-weight: 600; }
.pp-amount { font: 24px var(--head); color: #8a6c00; display: flex; align-items: center; gap: 6px; }
.pp-amount .ic { color: #c9a227; width: 24px; height: 24px; }
.pp-price { font-size: 20px; font-weight: 600; }
.pay-banner { display: flex; gap: 8px; align-items: center; }
.ok-banner { background: #e3ecd0; border-color: var(--ok); color: var(--ok); }
.err-banner { background: #f3dcd6; border-color: var(--bad); color: var(--bad); }

/* Wiadomości */
.msg-tabs { gap: 4px; }
.msg-form { display: grid; gap: 10px; }
.msg-form label { display: grid; gap: 4px; }
.msg-form .row label { display: flex; gap: 6px; align-items: center; }
.msg-form textarea { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: #fffdf7; color: var(--ink); resize: vertical; width: 100%; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.tag-all { background: var(--accent); color: var(--accent-ink); }
.tag-admin { background: var(--bad); color: #fff; }
button.small-ic { padding: 0 2px; vertical-align: middle; }
button.small-ic .ic { width: 16px; height: 16px; }
.report-row.unread td:nth-child(2) { font-weight: bold; }

/* Portal i światy */
.portal-nav { display: flex; gap: 2px; flex: 1; }
.portal-nav button { background: transparent; border: none; color: var(--bar-text); text-transform: uppercase; letter-spacing: 1px; font-size: 13px; padding: 8px 12px; border-radius: 0; }
.portal-nav button.active { background: var(--panel); color: var(--ink); }
#pview { max-width: 1100px; margin: 0 auto; padding: 16px; }
#portal .me { color: var(--bar-text); }
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.world-card { display: flex; flex-direction: column; gap: 8px; margin: 0; border-top: 5px solid var(--accent); }
.world-card h3 { margin: 0; }
.world-card.upcoming { border-top-color: var(--gold); }
.world-card.ended { border-top-color: var(--line); opacity: .8; }
.world-card.joined { box-shadow: 0 0 0 2px var(--accent) inset; }
.world-host { font-size: 13px; font-weight: normal; }
.world-status { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; padding: 2px 8px; border-radius: 10px; background: var(--panel-2); }
.world-status.open { background: #e3ecd0; color: var(--ok); }
.world-status.upcoming { background: #f3e7bf; color: #7a5d00; }
.world-facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.world-facts .ic { width: 15px; height: 15px; vertical-align: -2px; }
.world-action { margin-top: auto; }
.world-countdown { font-size: 15px; }
.join-wrap { max-width: 520px; margin: 30px auto; }
.world-chip { background: var(--bar-mid); color: var(--gold); border: 1px solid #59603f; font-size: 13px; padding: 4px 10px; }
.world-chip .ic { width: 15px; height: 15px; vertical-align: -2px; }
.auth-world { margin: 2px 0 0; font-weight: bold; color: var(--accent); letter-spacing: 2px; text-transform: uppercase; }
@media (max-width: 640px) { .portal-nav { order: 3; flex-basis: 100%; overflow-x: auto; } }

/* Panel administracji */
.admin-main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.admin-badge { font: bold 11px var(--font); letter-spacing: 2px; background: var(--bad); color: #fff; padding: 2px 6px; border-radius: 3px; vertical-align: middle; }
.dlg-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dlg { width: min(440px, 100%); display: grid; gap: 10px; margin: 0; }
.dlg label { display: grid; gap: 4px; }
.dlg textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fffdf7; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.msg-form label.tr-row { display: flex; align-items: center; gap: 8px; }

/* Zwiad */
.intel p { margin: 6px 0; }
.intel-b { display: inline-flex; align-items: center; gap: 3px; margin-right: 10px; white-space: nowrap; }
.intel-b .ic { width: 16px; height: 16px; }

/* Regulamin, polityka prywatności, zgody */
label.check { display: flex; gap: .5em; align-items: flex-start; font-size: .9em; line-height: 1.4; }
label.check input { width: auto; margin-top: .2em; flex: none; }
.pp-consent { margin: .5em 0 1em; }
.legal-page { background: var(--bg, #e3e1d3); }
.legal-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5em; padding: .8em 1.2em; background: #23281c; }
.legal-head a { color: #e0c46c; text-decoration: none; }
.legal-logo { font-size: 1.3em; letter-spacing: .15em; }
.legal { max-width: 820px; margin: 0 auto; padding: 1.5em 1em 3em; line-height: 1.6; }
.legal h1 { margin-bottom: .2em; }
.legal h2 { font-size: 1.1em; margin-top: 1.6em; }
.legal li { margin: .3em 0; }
.legal mark { background: #f4d35e; padding: 0 .2em; }
label.check a, .legal a { color: inherit; }
/* pułapka na boty – poza ekranem (nie display:none, bo część botów to sprawdza) */
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
#turnstile-box { margin: .3em 0 .6em; min-height: 65px; }
/* Zgłoszenia */
.bug-btn { white-space: nowrap; }
.bug-form label { display: block; margin: .4em 0; }
.bug-form select, .bug-form textarea { width: 100%; box-sizing: border-box; }
.bug-item.unread { border-left: 4px solid #c9a227; }
.bug-head { gap: .8em; flex-wrap: wrap; align-items: baseline; }
.bug-text { white-space: pre-wrap; word-break: break-word; margin: .4em 0; }
.bug-reply { background: rgba(201,162,39,.12); padding: .5em .7em; border-radius: 4px; white-space: pre-wrap; margin: .3em 0 0; }
.admin-tabs { gap: .5em; margin: 1em 0 0; }
.bug-item label { display: block; }
.bug-item textarea { width: 100%; box-sizing: border-box; }
/* Stopka z regulaminem: zawsze przy dolnej krawędzi ekranu (portal i gra), w karcie logowania – na dole karty */
#game:not(.hidden), #portal:not(.hidden) { display: flex; flex-direction: column; min-height: 100vh; }
#game > main, #portal > main { width: 100%; flex: 1 0 auto; }
.site-foot, .auth-legal { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.site-foot { padding: 14px 16px; border-top: 1px solid var(--line); color: var(--muted); }
.auth-legal { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
.site-foot a, .auth-legal a { color: var(--muted); text-decoration: none; }
.site-foot a:hover, .auth-legal a:hover { color: var(--accent); text-decoration: underline; }
.cancel-mv { white-space: nowrap; }

/* ───── Strona startowa portalu (niezalogowani na warfront.pl) ───── */
.landing-only { display: none; }
.auth.landing { display: block; padding: 0; background: var(--bg); }
.auth.landing .landing-only { display: block; }
.landing-hero { display: contents; }
.auth.landing .landing-hero { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; align-items: center;
  min-height: min(100vh, 760px); padding: 48px max(16px, calc((100vw - 1100px) / 2));
  background: linear-gradient(180deg, rgba(20,23,14,.25), rgba(20,23,14,.55)), repeating-linear-gradient(135deg, #3a4128 0 22px, #353b24 22px 44px); }
.landing-intro { color: var(--bar-text); }
.landing-intro h1 { margin: 0 0 14px; font: 46px/1.08 var(--head); letter-spacing: 1px; text-transform: uppercase; color: #f3eed6; }
.landing-lead { font-size: 18px; line-height: 1.55; margin: 0 0 18px; color: #dcdcc4; max-width: 560px; }
.landing-points { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.landing-points li { padding-left: 26px; position: relative; color: var(--bar-text); }
.landing-points li::before { content: "★"; position: absolute; left: 0; color: var(--gold); }
.landing-points b { color: #fff6cf; }
.landing-countdown:empty { display: none; }
.landing-countdown { display: inline-block; background: rgba(0,0,0,.28); border: 1px solid rgba(217,196,106,.45); border-radius: 6px; padding: 10px 14px; margin: 0 0 20px; color: var(--bar-text); }
.landing-countdown .cd-big { font: 26px var(--head); letter-spacing: 1px; color: var(--gold); display: block; margin-top: 2px; }
.landing-countdown .cd-line + .cd-line { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.12); }
.landing-cta-row { gap: 12px; }
.cta { font-size: 17px; padding: 11px 26px; background: var(--gold); color: #262a1c; border: none; font-weight: bold; border-radius: 6px; }
.cta:hover { filter: brightness(1.08); }
.cta-ghost { font-size: 16px; padding: 10px 20px; background: transparent; color: var(--bar-text); border: 1px solid rgba(227,227,207,.5); border-radius: 6px; }
.cta-ghost:hover { border-color: var(--gold); color: var(--gold); }
.auth.landing .auth-card { justify-self: end; }
.landing-more { max-width: 1100px; margin: 0 auto; padding: 8px 16px 0; }
.landing-sec { padding: 40px 0 8px; }
.landing-sec > h2 { text-align: center; margin-bottom: 22px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.feature [data-icon] .ic { width: 34px; height: 34px; color: var(--accent); }
.feature h3 { margin: 8px 0 6px; }
.feature p { margin: 0; color: var(--muted); line-height: 1.5; }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.shots figure { margin: 0; }
.shots img { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.18); cursor: zoom-in; }
.shots figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; text-align: center; }
.steps { max-width: 720px; margin: 0 auto; padding-left: 22px; display: grid; gap: 10px; font-size: 16px; line-height: 1.5; }
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 8px; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: bold; }
.faq details p { margin: 10px 0 2px; color: var(--muted); line-height: 1.5; }
.landing-final { text-align: center; padding-bottom: 40px; }
.landing-final p { color: var(--muted); margin: 0 0 16px; }
.landing-final .cta { box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.landing-foot { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 18px 16px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.landing-foot a { color: var(--muted); text-decoration: none; }
.landing-foot a:hover { color: var(--accent); text-decoration: underline; }
.lightbox { position: fixed; inset: 0; background: rgba(10,12,6,.88); display: grid; place-items: center; z-index: 50; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
@media (max-width: 900px) {
  .auth.landing .landing-hero { grid-template-columns: 1fr; gap: 28px; min-height: 0; padding: 28px 16px; }
  .auth.landing .auth-card { justify-self: stretch; width: 100%; max-width: 420px; margin: 0 auto; }
  .landing-intro h1 { font-size: 32px; }
  .landing-lead { font-size: 16px; }
  .shots { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
}
.muted-light { color: var(--bar-dim); font-size: 13px; }
.landing-countdown .ic { color: var(--gold); }

/* ochrona początkowa */
.prot-banner { border-left: 3px solid #4fa3e0; }
.prot-note { color: #6db8ef; }
.cell .prot-badge { position: absolute; right: 1px; top: 1px; width: 14px; height: 14px; border-radius: 50%;
  background: rgba(20, 60, 100, .85); display: grid; place-items: center; pointer-events: none; }
.cell .prot-badge svg { width: 10px; height: 10px; color: #9fd3ff; }

/* link do aplikacji na Androida (pokazywany, gdy na serwerze jest download/warfront.apk) */
.android-app { display: inline-block; margin-top: 14px; color: var(--gold); font-weight: bold; }
.android-app.hidden { display: none; }

/* zaproś znajomego */
.invite-panel { border-left: 3px solid var(--ally); }
.invite-row input { flex: 1; min-width: 200px; }
.invite-list { margin-top: 8px; }

/* rynek */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.ex-card { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--panel); }
.ex-head { font-size: 16px; margin-bottom: 4px; }
.ex-rate { margin-bottom: 4px; }
.ex-row { margin-top: 6px; align-items: center; gap: 6px; }
.ex-panel { border-left: 3px solid var(--gold); }

/* panel admina: e-mail do graczy */
.mail-kind .check, #f-mail fieldset .check { align-items: flex-start; }
#f-mail fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 0 0 10px; }
#f-mail legend { font-weight: bold; padding: 0 4px; }
#f-mail { max-width: 760px; }
#f-mail textarea { width: 100%; font: inherit; }

/* ── Bonus nocny ── */
.night-note { color: #4a5aa8; }
.night-note .ic { vertical-align: -3px; }

/* ── Codzienna nagroda ── */
.daily.daily-ready { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(217, 196, 106, .35); }
.daily-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.daily-day { border: 1px solid var(--line); border-radius: 6px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; font-size: 13px; background: var(--panel); }
.daily-day span { font-size: 11px; }
.daily-day.got { opacity: .55; background: var(--panel-2); }
.daily-day.today { border: 2px solid var(--gold); background: #fbf6dc; }
.daily-day .pp-c { color: var(--accent); }
.daily-day .pp-c .ic { width: 13px; height: 13px; vertical-align: -2px; }
@media (max-width: 640px) {
  .daily-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Ranking i odznaczenia (baretki) ── */
.rk-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rk-head h2 { margin: 0; }
.rk-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.rk-tab { background: none; color: var(--ink); border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 7px 14px; font-weight: 600; }
.rk-tab:last-child { border-right: 0; }
.rk-tab small { color: var(--muted); font-weight: 400; margin-left: 2px; }
.rk-tab.on { background: var(--accent); color: var(--accent-ink); }
.rk-tab.on small { color: var(--bar-dim); }
.rk-tab:focus-visible, .sortable button:focus-visible, .rk-me-rack:focus-visible, tr[data-act]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.rk-me { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; background: var(--bar-mid); color: var(--bar-text); border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; }
.rk-me-pos { display: flex; align-items: baseline; gap: 6px; }
.rk-me-pos b { font-family: var(--head); font-size: 40px; line-height: 1; color: var(--gold); letter-spacing: .02em; }
.rk-me-pos span { color: var(--bar-dim); font-size: 13px; }
.rk-me-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.rk-me-stats div, .pcard-stats div { display: flex; flex-direction: column; }
.rk-me-stats span { font-size: 12px; color: var(--bar-dim); }
.rk-me-stats b { font-size: 18px; }
.rk-me-rack { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; max-width: 240px; background: none; border: 0; padding: 4px; cursor: pointer; color: var(--bar-dim); text-decoration: underline dotted; }

.rk-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.rk-tools input { max-width: 320px; flex: 1; }
.rk-table table { width: 100%; }
.rk-table tr[data-act] { cursor: pointer; }
.rk-table tr[data-act]:hover td { background: rgba(75, 90, 42, .07); }
.rk-table tr.rk-mine td { background: #f3e9b8; }
.rk-table td.on { font-weight: 700; }
.rk-rank { font-family: var(--head); font-size: 17px; width: 44px; }
.rk-table tr.top1 .rk-rank { color: #b8962e; } .rk-table tr.top2 .rk-rank { color: #7f888f; } .rk-table tr.top3 .rk-rank { color: #9a5f33; }
.rk-name { display: flex; gap: 6px; align-items: center; }
.rk-rack { display: flex; gap: 2px; margin-top: 3px; min-height: 0; }
.sortable button { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
th.sortable.on button { text-decoration: none; color: var(--accent); }

/* baretka: pięć pasów w kolorach odznaczenia, gwiazdki w kolorze stopnia */
.ribbon { --metal: #a8693a; position: relative; display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 18px; border-radius: 2px;
  background: linear-gradient(90deg, var(--a) 0 18%, var(--b) 18% 36%, var(--c) 36% 64%, var(--b) 64% 82%, var(--a) 82%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), inset 0 6px 6px -5px rgba(255, 255, 255, .35); flex: none; }
.ribbon i { font-style: normal; font-size: 10px; letter-spacing: -1px; color: var(--metal); text-shadow: 0 0 1px #000, 0 0 2px #000; line-height: 1; }
.ribbon.t1 { --metal: #d08a52; } .ribbon.t2 { --metal: #e4e8ec; } .ribbon.t3 { --metal: #f2cf4a; } .ribbon.t4 { --metal: #9ff0ea; } .ribbon.t5 { --metal: #bfe0ff; }
.ribbon.t5 { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), 0 0 0 2px #8db8f0; }
.ribbon.locked { filter: grayscale(1); opacity: .3; }
.ribbon.mini { width: 26px; height: 9px; border-radius: 1px; }
.ribbon.mini i { display: none; }
.ribbon.big { width: 92px; height: 28px; }
.ribbon.big i { font-size: 15px; }

.bdg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (min-width: 1000px) { .bdg-grid { grid-template-columns: repeat(7, 1fr); } }
.bdg-hint { font-size: 12px; color: var(--muted); line-height: 1.2; min-height: 2.4em; }
.bdg { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 10px 12px; }
.bdg .ribbon { margin-bottom: 4px; }
.bdg > b { min-height: 2.5em; display: flex; align-items: center; line-height: 1.2; }
.bdg.locked b { color: var(--muted); }
.bdg small { color: var(--muted); font-size: 12px; }
.bdg-tier { font-size: 12px; font-weight: 600; color: var(--muted); }
.bdg-tier.t1 { color: #9a5f33; } .bdg-tier.t2 { color: #6f7880; } .bdg-tier.t3 { color: #a88516; } .bdg-tier.t4 { color: #2f8a86; } .bdg-tier.t5 { color: #3a6fc0; }
.bdg-bar { width: 100%; height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bdg-bar > div { height: 100%; background: var(--ok); }

#pcard-wrap { position: fixed; inset: 0; background: rgba(20, 22, 14, .5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pcard { position: relative; width: min(420px, 100%); max-height: 90vh; overflow-y: auto; margin: 0; padding: 20px; }
.pcard h3 { margin: 0 30px 2px 0; }
.pcard > p.muted { margin: 0 0 14px; }
.pcard-x { position: absolute; right: 14px; top: 12px; font-size: 18px; }
.pcard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.pcard-stats div { display: flex; flex-direction: column; background: var(--bg); border-radius: 6px; padding: 8px 10px; }
.pcard-stats b { font-size: 20px; }
.pcard-stats span { font-size: 12px; color: var(--muted); }
.pcard-badges { display: grid; gap: 6px; margin-bottom: 14px; }
.pcard-badges div { display: flex; align-items: center; gap: 10px; }

@media (max-width: 640px) {
  .rk-me { grid-template-columns: auto 1fr; gap: 10px 14px; }
  .rk-me-rack { grid-column: 1 / -1; justify-content: start; max-width: none; }
  .rk-me-rack .ribbon { width: 38px; height: 13px; } .rk-me-rack .ribbon i { font-size: 8px; }
  .rk-table .c-bases { display: none; }
  .rk-table th, .rk-table td { padding-left: 5px; padding-right: 5px; }
  .rk-table th { font-size: 12px; white-space: nowrap; }
  .rk-me-stats { gap: 14px; }
  .rk-tabs { width: 100%; } .rk-tab { flex: 1; padding: 7px 6px; }
  .bdg-grid { grid-template-columns: repeat(2, 1fr); }
}
