/* ==========================================================================
   GRALNIA — warstwa strukturalna
   Ten plik nie zawiera ANI JEDNEGO koloru na sztywno. Wszystkie barwy,
   gradienty, promienie i cienie przychodzą ze skórki (assets/css/themes/*.css),
   dzięki czemu zmiana stylu całego portalu to podmiana jednego <link>.
   ========================================================================== */

/* Zasoby niezależne od skórki: ziarno i maska korony damki. */
:root {
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23f)' opacity='.07'/%3E%3C/svg%3E");
  --crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 8l4.2 3.2L12 4l4.8 7.2L21 8l-1.7 10H4.7L3 8zm2.4 12h13.2v2H5.4v-2z'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--tx-1);
  background: var(--page-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ziarno na całej stronie — psuje płaskość gradientów. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--noise-opacity, .5);
  background-image: var(--noise);
}

#app { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* --------------------------------------------------------------- pasek górny */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px clamp(12px, 3vw, 28px);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -.02em;
  flex: 0 0 auto;
}

/* Logo w pasku górnym. Na komputerze celowo duże — ma być widać markę,
   a nie domyślać się jej z ikonki wielkości znaczka pocztowego. */
.brand__logo {
  height: clamp(34px, 4vw, 54px);
  width: auto;
  display: block;
  filter: var(--logo-shadow);
}

.brand__mark {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--accent-grad);
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255,255,255,.45);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 17px;
}
.brand__name b { color: var(--accent); font-weight: 600; }

.topbar__spacer { flex: 1 1 auto; }

/* --------------------------------------------------------------- przyciski */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--tx-1);
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255,255,255,.06);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { background: var(--bg-3); transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0); box-shadow: var(--sh-1); }
.btn:focus-visible { outline: none; box-shadow: var(--glow); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.btn--primary {
  border-color: transparent;
  background: var(--accent-grad);
  color: var(--on-accent);
  font-weight: 650;
}
.btn--primary:hover { background: var(--accent-grad-hover); }

.btn--ghost { background: transparent; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--danger { border-color: var(--warn); color: var(--warn); background: transparent; }

/* --------------------------------------------------------------- panele */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--chip-bg);
  color: var(--tx-2);
  border: 1px solid var(--chip-bd);
}
.chip--live { color: var(--on-ok); background: var(--ok); border-color: transparent; }
.chip--soon { color: var(--tx-3); }
.chip--warn { color: var(--on-accent); background: var(--warn); border-color: transparent; }

/* Licznik graczy w pasku górnym — zielona kropka gaśnie, gdy nie ma łączności. */
.chip--online { cursor: pointer; font-weight: 600; }
.chip--online:hover { background: var(--bg-3); }
.chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tx-3);
  flex: 0 0 auto;
}
.chip--online[data-state="gotowe"] .chip__dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent);
}
.chip--online[data-state="zerwane"] .chip__dot { background: var(--warn); }
.chip__sub { color: var(--tx-3); font-weight: 500; }
.chip__sub::before { content: "·"; margin-right: 6px; }

/* --------------------------------------------------------------- układ */
.wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 40px) clamp(12px, 3vw, 28px) 80px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .35s cubic-bezier(.2,.7,.3,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --------------------------------------------------------------- formularze */
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--tx-3); }
.field input, .field select {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-0);
  color: var(--tx-1);
  font: inherit;
  font-size: 14px;
  width: 100%;
}
.field input:focus, .field select:focus { outline: none; box-shadow: var(--glow); border-color: var(--accent); }

.form-error {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  margin-bottom: 12px;
}
.form-ok {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 13px;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------- okno modalne */
.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  animation: rise .2s ease-out both;
}
.modal {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--panel-bg);
  border: 1px solid var(--line);
  box-shadow: var(--sh-3);
}
.modal h2 { font-size: 21px; margin-bottom: 4px; }
.modal p.sub { color: var(--tx-3); font-size: 13.5px; margin: 0 0 18px; line-height: 1.5; }
.modal__foot { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.modal__foot .grow { flex: 1; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0;
  background: transparent;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--tx-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--tx-1); border-bottom-color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------- wybór skórki */
.skins { display: inline-flex; gap: 6px; align-items: center; }
.skin-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: var(--sh-1);
  transition: transform .14s ease;
}
.skin-dot:hover { transform: scale(1.12); }
.skin-dot[aria-pressed="true"] { border-color: var(--accent); }
.skin-dot--klub    { background: linear-gradient(135deg, #1d7a5c 50%, #f2b33d 50%); }
.skin-dot--salon   { background: linear-gradient(135deg, #f4efe6 50%, #2f6b52 50%); }
.skin-dot--arkada  { background: linear-gradient(135deg, #22d3ee 50%, #f472b6 50%); }

/* --------------------------------------------------------------- tabela (admin) */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  padding: 9px 12px;
  color: var(--tx-3);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--bg-2); }
.table__scroll { overflow-x: auto; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--panel-bg);
  border: 1px solid var(--line);
}
.stat__n { font-family: var(--font-display); font-size: 28px; color: var(--accent); line-height: 1.1; }
.stat__l { color: var(--tx-3); font-size: 12.5px; margin-top: 3px; }
