:root {
  --bg: #000;
  --card: rgba(13, 15, 22, 0.92);
  --card-border: #1d2231;
  --text: #e7e9f0;
  --muted: #8a90a3;
  --accent: #4d8dff;
  --accent-2: #e5484d;
  --green: #2fbf71;
  --red: #e5484d;
  --none: #262b38;
  --orange: #f59e0b;
  --radius: 12px;
  --gutter: 10vw;          /* zawartość na 80% szerokości: po 10% wolnego z lewej i prawej */
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); }

body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: inherit; }
main { flex: 1; }

/* ------------------------------------------------------------ grafika + menu */

.hero {
  --hero-h: min(56.25vw, 82vh);   /* wysokość grafiki na stronie głównej */
  position: relative;
  height: var(--hero-h);
  min-height: 300px;
  background: #000 url("bg-1280.webp") center 35% / cover no-repeat;
}
@media (min-width: 1400px), (min-resolution: 1.5dppx) {
  .hero { background-image: url("bg-2560.webp"); }
}
.hero.small { height: min(28vw, 42vh); min-height: 220px; }

/* ostatnie 5% grafiki przechodzi w czerń */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 95%, #000 100%);
  pointer-events: none;
}

/* menu w pierwszych 10% grafiki */
.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  /* zawsze 10% wysokości grafiki ze strony głównej – menu w tym samym miejscu na każdej podstronie */
  height: max(calc(var(--hero-h) * 0.1), 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}

.brand { text-decoration: none; }
.brand b { font-size: 22px; letter-spacing: 0.5px; }
.brand b span { color: var(--accent); }

nav.menu { display: flex; gap: 4px; }
nav.menu a {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  color: #cfd3df;
  font-weight: 600;
}
nav.menu a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
nav.menu a[aria-current="page"] { background: rgba(77, 141, 255, 0.18); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  nav.menu a { padding: 6px 9px; }
}

/* ------------------------------------------------------------ sekcje */

.section { padding: 8px var(--gutter) 40px; width: 100%; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 18px; flex-wrap: wrap; }
.section-head h1 { margin: 0; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.15; }
.summary { margin: 6px 0 0; color: #c3c8d6; }
.updated { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ góra strony: tytuł + TeamSpeak (50/50) */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  margin: 8px 0 24px;
}
.intro-text { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.intro-text h1 { margin: 0; font-size: clamp(28px, 3vw, 44px); line-height: 1.1; }
.intro-text .summary { margin: 0; font-size: 16px; }
.intro-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
}
.stat b { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
@media (max-width: 1100px) { .intro { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------ kafelki */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 1399px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.tile {
  --mode: var(--accent);
  --mode-rgb: 77, 141, 255;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  height: 100%;
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(var(--mode-rgb), 0.16), transparent 60%),
    linear-gradient(180deg, #10131c, #0a0c12);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s, border-color 0.15s;
}
.tile::before {           /* kolorowy pasek trybu u góry */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--mode), transparent);
}
.tile:hover { transform: translateY(-2px); border-color: rgba(var(--mode-rgb), 0.35); }
.tile.mode-randomskills { --mode: #9b59ff; --mode-rgb: 155, 89, 255; }
.tile.mode-arena { --mode: #e5484d; --mode-rgb: 229, 72, 77; }
.tile.mode-prophunt { --mode: #2fbf71; --mode-rgb: 47, 191, 113; }
.tile.mode-teamspeak { --mode: #4d8dff; --mode-rgb: 77, 141, 255; }
.tile.offline { filter: grayscale(0.7); opacity: 0.75; }
/* serwer z hasłem: pomarańczowa ramka */
.tile.locked { border-color: rgba(245, 158, 11, 0.5); }

.tile-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.game-icon { width: 44px; height: 44px; border-radius: 10px; flex: none; object-fit: contain; }
.tile-title { min-width: 0; flex: 1; }
.tile-title h3 { margin: 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sub { display: flex; gap: 6px 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 2px; }
.sub .mode { color: var(--mode); font-weight: 700; }
.sub .lock { color: var(--orange); font-weight: 600; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; flex: none; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.status.on { color: #7fe0aa; }
.status.on::before { background: var(--green); box-shadow: 0 0 10px var(--green); }
.status.off { color: #ff9a9d; }

.slots { display: flex; flex-direction: column; gap: 8px; }
.slots-count { display: flex; align-items: baseline; gap: 6px; }
.slots-count b { font-size: 40px; line-height: 1; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.slots-count span { font-size: 20px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.slots-count small { color: var(--muted); font-size: 13px; }
.fill { height: 8px; background: rgba(255, 255, 255, 0.06); border-radius: 4px; overflow: hidden; }
.fill span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--mode), rgba(var(--mode-rgb), 0.6)); }

.players { display: flex; flex-wrap: wrap; gap: 6px; }
.players span {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1px 8px;
  border-radius: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.players .more { color: var(--muted); }

/* pasek uptime: 1 segment = 5 min */
.uptime-box { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.uptime { display: flex; gap: 2px; height: 10px; }
.uptime i { flex: 1; border-radius: 2px; background: rgba(255, 255, 255, 0.07); }
.uptime i.up { background: var(--green); }
.uptime i.down { background: var(--red); }
.uptime-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.addr { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: #c3c8d6; margin-right: auto; overflow-wrap: anywhere; }
.btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3b7bf0; }
.btn:focus-visible, nav.menu a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* serwery z hasłem w zwiniętej sekcji */
.maint { margin-top: 28px; border-top: 1px solid #161a25; padding-top: 16px; }
.maint summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #cfd3df;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  margin-bottom: 16px;
}
.maint summary::-webkit-details-marker { display: none; }
.maint summary::before { content: "▸"; color: var(--orange); transition: transform 0.15s; }
.maint[open] summary::before { transform: rotate(90deg); }
.maint summary small { color: var(--muted); font-weight: 600; }

.skeleton { color: var(--muted); padding: 24px; text-align: center; }

/* ------------------------------------------------------------ tabele (ranking, bany) */

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.search {
  background: #11141d;
  border: 1px solid #262c3d;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  width: min(320px, 100%);
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 200px; overflow-wrap: anywhere; }
thead th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--card-border); }
tbody tr + tr td { border-top: 1px solid #161a25; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.place { font-weight: 700; color: var(--muted); }
tr.top1 td.place { color: #ffd166; }
tr.top2 td.place { color: #cfd6e4; }
tr.top3 td.place { color: #e0a073; }
td.elo { font-weight: 700; color: #fff; }
.player { display: inline-flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 6px; flex: none; background: #1a1f2c; }
.player-link { text-decoration: none; font-weight: 600; }
.player-link:hover { text-decoration: underline; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.badge.active { background: rgba(229, 72, 77, 0.2); color: #ff9a9d; }
.badge.unbanned { background: rgba(47, 191, 113, 0.18); color: #7fe0aa; }
.badge.expired { background: #22283a; color: var(--muted); }
.empty-row td { text-align: center; color: var(--muted); padding: 32px; }

/* ------------------------------------------------------------ stopka */

footer {
  border-top: 1px solid #12151e;
  color: var(--muted);
  text-align: center;
  padding: 18px var(--gutter);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: #1a1f2c;
  border: 1px solid #2c3346;
  padding: 10px 16px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
