:root {
  --bg: #0a0e17;
  --bg2: #0f1522;
  --panel: #151c2c;
  --panel2: #1b2436;
  --border: #2a3448;
  --text: #e6e9f0;
  --muted: #8b95a8;
  --gold: #c8aa6e;
  --gold2: #f0d79a;
  --blue: #3b82f6;
  --red: #ef4444;
  --teal: #0ac8b9;
  --green: #22c55e;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #1a2340 0%, var(--bg) 60%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--gold2); }
img { display: block; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 700; letter-spacing: 0.2px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.gold { color: var(--gold2); }
.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

.container { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 440px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.brand { font-weight: 800; color: var(--gold); letter-spacing: 0.5px; text-decoration: none; font-size: 17px; }
.brand span { color: var(--muted); font-weight: 500; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card.tight { padding: 12px; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input, textarea.input, select.input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font: inherit; outline: none;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.15); }
textarea.input { min-height: 70px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: filter .12s, transform .05s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn-primary { background: linear-gradient(180deg, #d9bf86, #b8934f); color: #1a1508; border-color: #b8934f; }
.btn-danger { background: #3a1a1e; border-color: #6b2a31; color: #ffb4b4; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 9px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 17px; }
.btn-block { width: 100%; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
}
.badge.gold { color: var(--gold2); border-color: var(--gold); }
.badge.green { color: #9ef0b4; border-color: #2c7a45; }
.badge.blue { color: #a9c6ff; border-color: #2b4c8f; }
.badge.red { color: #ffb4b4; border-color: #8f2b2b; }

.error { color: #ffb4b4; font-size: 14px; margin-top: 8px; min-height: 1.2em; }
.notice { padding: 10px 12px; border-radius: 8px; background: #2a2416; border: 1px solid #5a4a1e; color: var(--gold2); }
.notice.info { background: #16233a; border-color: #2b4c8f; color: #cfe0ff; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: #3a1a1e; border: 1px solid #8f2b2b; color: #ffd0d0; padding: 10px 16px; border-radius: 10px;
  font-size: 14px; z-index: 1000; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.ok { background: #14301f; border-color: #2c7a45; color: #c8f5d5; }

/* ---------- poczekalnia ---------- */
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 720px) { .slots { grid-template-columns: repeat(2, 1fr); } }
.slot {
  min-height: 62px; border-radius: 10px; border: 1px dashed var(--border); padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px; background: var(--bg2);
}
.slot.filled { border-style: solid; border-color: #3a4a6a; background: var(--panel2); }
.slot.me { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(200,170,110,.3); }
.slot .nick { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.slot .empty { color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; }
.dot.off { background: #55607a; }
.crown { color: var(--gold2); font-size: 13px; }

/* ---------- drużyny ---------- */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .teams { grid-template-columns: 1fr; } }
.team { border-radius: var(--radius); border: 1px solid var(--border); padding: 12px; background: var(--panel); min-width: 0; }
.team.t1 { border-top: 3px solid var(--blue); }
.team.t2 { border-top: 3px solid var(--red); }
.team h2 { display: flex; justify-content: space-between; align-items: center; }
.team.t1 h2 { color: #a9c6ff; }
.team.t2 h2 { color: #ffb4b4; }

.pcard {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer;
}
.pcard.me { border-color: var(--gold); }
.pcard .portrait { width: 52px; height: 52px; border-radius: 8px; border: 1px solid var(--border); flex: none; background: #000; }
.pcard .portrait.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 20px; }
.pcard .body { flex: 1; min-width: 0; }
.pcard .details { cursor: default; }
.pcard .head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pcard .head .nick { font-weight: 700; }
.pcard .champ { color: var(--gold2); font-weight: 600; }
.pcard .bname { color: var(--muted); font-size: 13px; }
.icons { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.icons img, .icons .ph { width: 30px; height: 30px; border-radius: 5px; border: 1px solid var(--border); background: #000; }
.icons .ph { background: var(--panel2); }
.icons img.rune { border-radius: 50%; background: #0b0f18; }
.icons img.tree { width: 22px; height: 22px; border: none; background: transparent; margin-left: -2px; }
.icons .sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.icons img.boots, .icons .ph.boots { border-color: #6b5a2e; }
.icons img.supp, .icons .ph.supp { border-color: #2c7a45; }
.icons img.upgraded { border-color: var(--gold); box-shadow: 0 0 6px rgba(200,170,110,.55); }

/* ---------- przełącznik języka nazw ---------- */
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.lang button { border: none; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; padding: 3px 9px; cursor: pointer; }
.lang button.on { background: var(--panel2); color: var(--gold2); }
.lang button:hover { color: var(--text); }

/* ---------- role ---------- */
.role {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 4px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--panel2); border: 1px solid var(--border); color: var(--gold2); white-space: nowrap;
}
.role img { width: 16px; height: 16px; }
.role.big { font-size: 15px; padding: 4px 12px 4px 6px; }
.role.big img { width: 24px; height: 24px; }
.pcard .actions { display: flex; gap: 4px; flex-direction: column; }
.pcard .details { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }

/* ---------- pełny build ---------- */
.build-full { display: grid; grid-template-columns: 96px 1fr; gap: 14px; }
@media (max-width: 600px) { .build-full { grid-template-columns: 1fr; } }
.build-full.compact { grid-template-columns: 1fr; }
.build-full.compact .runes-box { grid-template-columns: 1fr; }
.build-full.compact .items img, .build-full.compact .items .ph { width: 36px; height: 36px; }
.build-full.compact .items .it { width: 36px; }
.build-full .portrait { width: 96px; height: 96px; border-radius: 12px; border: 2px solid var(--gold); background: #000; }
.build-full .items { display: flex; gap: 6px; flex-wrap: wrap; }
.build-full .items .it { width: 46px; text-align: center; }
.build-full .items img { width: 46px; height: 46px; border-radius: 7px; border: 1px solid var(--border); background: #000; }
.build-full .items .ph { width: 46px; height: 46px; border-radius: 7px; border: 1px dashed var(--border); }
.build-full .items .it.boots img { border-color: #6b5a2e; }
.build-full .items .it.supp img { border-color: #2c7a45; box-shadow: 0 0 8px rgba(44,122,69,.5); }
.build-full .items .it.boots img.upgraded { border-color: var(--gold); box-shadow: 0 0 8px rgba(200,170,110,.55); }
.build-full .items .it .cap { font-size: 10px; color: var(--muted); margin-top: 2px; }
.build-full .items .it .cap.gold { color: var(--gold2); }
.runes-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 600px) { .runes-box { grid-template-columns: 1fr; } }
.rune-col { background: var(--panel2); border-radius: 10px; padding: 8px 10px; }
.rune-col .tree { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--gold2); margin-bottom: 6px; }
.rune-col .tree img { width: 22px; height: 22px; }
.rune-line { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.rune-line img { width: 28px; height: 28px; border-radius: 50%; background: #0b0f18; }
.rune-line.key img { width: 38px; height: 38px; }
.rune-line .n { font-size: 14px; }
.rune-line .d { font-size: 12px; color: var(--muted); }
.spells { display: flex; gap: 6px; align-items: center; }
.spells img { width: 36px; height: 36px; border-radius: 7px; border: 1px solid var(--border); }
.notes { white-space: pre-wrap; background: var(--panel2); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-top: 8px; }

.host-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab { padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; text-decoration: none; }
.tab.active { color: var(--gold2); border-bottom-color: var(--gold); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
table.tbl code { background: var(--bg2); padding: 2px 6px; border-radius: 5px; font-size: 14px; color: var(--gold2); }
.tbl-wrap { overflow-x: auto; }

.build-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.bcard { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.bcard.off { opacity: .55; }
.bcard .top { display: flex; gap: 10px; align-items: center; }
.bcard .top img { width: 48px; height: 48px; border-radius: 8px; border: 1px solid var(--border); }
.bcard .foot { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--muted); }
.switch input { width: 16px; height: 16px; accent-color: var(--gold); }

/* ---------- edytor buildu ---------- */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .editor-grid { grid-template-columns: 1fr; } }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; max-height: 340px; overflow-y: auto; padding: 4px; }
.icon-grid .ic { cursor: pointer; text-align: center; border-radius: 8px; padding: 3px; border: 2px solid transparent; }
.icon-grid .ic:hover { background: var(--panel2); }
.icon-grid .ic.sel { border-color: var(--gold); background: var(--panel2); }
.icon-grid .ic img { width: 48px; height: 48px; margin: 0 auto; border-radius: 7px; background: #000; }
.icon-grid .ic .nm { font-size: 10px; color: var(--muted); line-height: 1.15; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.icon-grid .ic.sel .nm { color: var(--gold2); }

.item-slots { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.item-slot {
  width: 64px; height: 64px; border-radius: 10px; border: 2px dashed var(--border); background: var(--bg2);
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; color: var(--muted); font-size: 20px;
}
.item-slot img { width: 58px; height: 58px; border-radius: 8px; }
.item-slot.active { border-color: var(--gold); border-style: solid; }
.item-slot .x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; border: 1px solid #000; }
.item-slot .tag { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); font-size: 9px; line-height: 14px; background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; color: var(--muted); white-space: nowrap; }
.item-slot.adc .tag { color: var(--gold2); border-color: var(--gold); }
.item-slot.boots { border-color: #6b5a2e; margin-left: 6px; }
.item-slot.supp { border-color: #2c7a45; }
.item-slot.supp .tag { color: #9ef0b4; border-color: #2c7a45; }

.tree-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tree-pick .tp { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg2); cursor: pointer; font-size: 13px; }
.tree-pick .tp img { width: 24px; height: 24px; }
.tree-pick .tp.sel { border-color: var(--gold); color: var(--gold2); }
.tree-pick .tp.dis { opacity: .35; cursor: not-allowed; }
.rune-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.rune-row:last-child { border-bottom: none; }
.rune-row .lbl { width: 80px; font-size: 12px; color: var(--muted); flex: none; }
.rune-row .opts { display: flex; gap: 6px; flex-wrap: wrap; }
.rune-opt { width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: #0b0f18; padding: 2px; opacity: .55; }
.rune-opt.key { width: 54px; height: 54px; }
.rune-opt img { width: 100%; height: 100%; border-radius: 50%; }
.rune-opt:hover { opacity: .9; }
.rune-opt.sel { border-color: var(--gold); opacity: 1; box-shadow: 0 0 10px rgba(200,170,110,.35); }
.rune-opt.shard { border-radius: 8px; width: 40px; height: 40px; background: #1b2436; }
.rune-opt.shard img { border-radius: 6px; }
.rune-row .chosen { font-size: 13px; color: var(--gold2); min-width: 0; }

.spell-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.spell-pick .sp { width: 52px; height: 52px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; opacity: .55; }
.spell-pick .sp img { width: 100%; height: 100%; border-radius: 7px; }
.spell-pick .sp.sel { border-color: var(--gold); opacity: 1; }

.preview { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview .portrait { width: 56px; height: 56px; border-radius: 9px; border: 2px solid var(--gold); background: #000; }
.preview .portrait.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }

.savebar {
  position: sticky; bottom: 0; background: rgba(10,14,23,.92); backdrop-filter: blur(6px);
  border-top: 1px solid var(--border); padding: 10px 0; margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; font-size: 13px; color: var(--muted); }
.filters label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.filters select { padding: 4px 6px; border-radius: 6px; background: var(--bg2); color: var(--text); border: 1px solid var(--border); }
