/* ==========================================================================
   FazeRP.eu - wspolny system wygladu strony (site.css)
   Jeden arkusz dla wszystkich podstron: tokeny, uklad, naglowek, stopka
   i komponenty (przyciski, karty, formularze, tabele, akordeony, dokumenty).
   Kolory i fonty jak w interfejsach w grze (NUI kit): #2cc0e9, Clash + Sora.

   Wydajnosc: fonty z wlasnego serwera (woff2), ikony ze sprite'a
   /assets/icons.svg, animacje tylko na transform/opacity, rozmycie tylko
   w naglowku, ograniczenie animacji przy prefers-reduced-motion.
   Strona-specyficzne style trzymamy w /css/pages/*.css.
   ========================================================================== */

/* ---------- Fonty ---------- */
@font-face {
    font-family: 'Sora';
    src: url('/assets/fonts/sora-latin.woff2') format('woff2');
    font-weight: 100 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Sora';
    src: url('/assets/fonts/sora-latin-ext.woff2') format('woff2');
    font-weight: 100 800;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Clash Grotesk';
    src: url('/assets/fonts/clash-grotesk.woff2') format('woff2');
    font-weight: 200 700;
    font-display: swap;
}

/* ---------- Tokeny ---------- */
:root {
    color-scheme: dark;

    --accent: #2cc0e9;
    --accent-rgb: 44, 192, 233;
    --accent-hi: #8ae6ff;
    --accent-lo: #0b8db4;
    --blue: #5b9dff;
    --blue-rgb: 91, 157, 255;
    --teal: #3fe0c0;
    --teal-rgb: 63, 224, 192;

    --grad: linear-gradient(105deg, #6aa8ff 0%, #2cc0e9 48%, #3fe0c0 100%);
    --grad-btn: linear-gradient(135deg, #46d3f6 0%, #1ba6d8 100%);

    --bg: #05080d;
    --bg-2: #080d15;
    --panel: #0a111a;
    --panel-2: #0d1621;
    --surface: rgba(255, 255, 255, 0.028);
    --surface-2: rgba(255, 255, 255, 0.05);
    --surface-3: rgba(255, 255, 255, 0.085);
    --line: rgba(150, 214, 240, 0.085);
    --line-2: rgba(150, 214, 240, 0.15);
    --line-3: rgba(150, 214, 240, 0.26);

    --text: #eef6fb;
    --text-2: rgba(222, 236, 246, 0.72);
    --text-3: rgba(200, 220, 235, 0.56); /* ~4.8:1 na --bg (0.48 dawalo ~3.8:1, ponizej WCAG AA dla malego tekstu) */

    --ok: #34d399;
    --ok-rgb: 52, 211, 153;
    --warn: #fbbf24;
    --warn-rgb: 251, 191, 36;
    --bad: #fb7185;
    --bad-rgb: 251, 113, 133;
    --gold: #f5c451;
    --gold-rgb: 245, 196, 81;
    --purple: #a78bfa;
    --purple-rgb: 167, 139, 250;
    --discord: #5865f2;

    --r-xs: 8px;
    --r-sm: 10px;
    --r: 14px;
    --r-lg: 18px;
    --r-xl: 24px;

    --font: 'Sora', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-display: 'Clash Grotesk', 'Sora', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, 'Courier New', monospace;

    --ease: cubic-bezier(.22, 1, .36, 1);
    --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 50px -24px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--line);

    --header-h: 72px;
    --container: 1200px;
    --gutter: clamp(16px, 4vw, 32px);
}

/* Warianty kolorow komponentow: badge, card-icon, callout, chip itp. */
.tone-accent { --c-rgb: var(--accent-rgb); }
.tone-ok { --c-rgb: var(--ok-rgb); }
.tone-warn { --c-rgb: var(--warn-rgb); }
.tone-bad { --c-rgb: var(--bad-rgb); }
.tone-gold { --c-rgb: var(--gold-rgb); }
.tone-purple { --c-rgb: var(--purple-rgb); }
.tone-blue { --c-rgb: var(--blue-rgb); }
.tone-teal { --c-rgb: var(--teal-rgb); }
.tone-muted { --c-rgb: 160, 180, 196; }

/* ---------- Reset / baza ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 20px);
    scrollbar-color: rgba(150, 214, 240, 0.2) transparent;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    /* bez wlasnego tla: kolor daje html, a .site-bg (z-index -1) musi byc widoczne */
    color: var(--text);
    font: 400 15px/1.65 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

main {
    flex: 1 0 auto;
}

img,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--text);
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

hr {
    height: 1px;
    border: 0;
    margin: 0;
    background: linear-gradient(90deg, transparent, var(--line-2), transparent);
}

table {
    border-collapse: collapse;
}

[hidden] {
    display: none !important;
}

::selection {
    background: rgba(var(--accent-rgb), 0.35);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(150, 214, 240, 0.16);
    border: 3px solid transparent;
    border-radius: 99px;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(150, 214, 240, 0.3);
}

/* Ikona ze sprite'a: <svg class="i"><use href="/assets/icons.svg#i-nazwa"/></svg> */
.i {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    display: inline-block;
    vertical-align: -0.18em;
}

/* ---------- Tlo strony ---------- */
.site-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    contain: strict;
    background:
        radial-gradient(56rem 36rem at 10% -10%, rgba(var(--accent-rgb), 0.11), transparent 62%),
        radial-gradient(48rem 34rem at 96% 6%, rgba(var(--blue-rgb), 0.08), transparent 60%),
        radial-gradient(60rem 40rem at 50% 115%, rgba(var(--teal-rgb), 0.05), transparent 60%),
        var(--bg);
}

.site-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(150, 214, 240, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(150, 214, 240, 0.035) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 25%, transparent 75%);
    mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 25%, transparent 75%);
}

/* ---------- Dostepnosc ---------- */
.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: var(--r-sm);
    background: var(--accent);
    color: #03141c;
    font-weight: 600;
    transform: translateY(-160%);
    transition: transform .2s var(--ease);
}

.skip-link:focus {
    transform: none;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Uklad ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.container-wide {
    max-width: 1360px;
}

.container-narrow {
    max-width: 880px;
}

.section {
    padding-block: clamp(56px, 8vw, 112px);
}

.section-sm {
    padding-block: clamp(36px, 5vw, 64px);
}

.section-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: clamp(28px, 4vw, 44px);
}

.section-head.center {
    align-items: center;
    text-align: center;
}

.section-head.center .lead {
    margin-inline: auto;
}

.section-head.split {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: var(--gap, 20px);
}

.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 260px)), 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 960px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: minmax(0, 1fr);
    }
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--gap, 16px);
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap, 12px);
}

.spacer {
    flex: 1;
}

.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 36px; }
.mb-2 { margin-bottom: 16px; }
.w-full { width: 100%; }

@media (max-width: 640px) {
    .hide-sm { display: none !important; }
}

@media (min-width: 641px) {
    .show-sm { display: none !important; }
}

/* ---------- Typografia ---------- */
.display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1;
}

.h1 {
    font-size: clamp(40px, 6.2vw, 76px);
    letter-spacing: -0.025em;
    line-height: 1.02;
}

.h2 {
    font-size: clamp(28px, 3.6vw, 44px);
    letter-spacing: -0.02em;
    line-height: 1.08;
}

.h3 {
    font-size: clamp(20px, 2vw, 24px);
}

.h4 {
    font-size: 18px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 12px currentColor;
}

.lead {
    font-size: clamp(15px, 1.35vw, 18px);
    line-height: 1.7;
    color: var(--text-2);
    max-width: 62ch;
}

.text-grad {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.accent { color: var(--accent); }
.small { font-size: 13px; }

code,
.code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    padding: 0.12em 0.45em;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--accent-hi);
    word-break: break-word;
}

.kbd {
    display: inline-flex;
    align-items: center;
    min-width: 1.9em;
    justify-content: center;
    padding: 0.1em 0.5em;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
    font-family: var(--font-mono);
    font-size: 0.82em;
    color: var(--text);
}

/* Dluzszy tekst (regulaminy, opisy) */
.prose {
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.75;
}

.prose > * + * {
    margin-top: 1em;
}

.prose h2,
.prose h3,
.prose h4 {
    margin-top: 1.8em;
}

.prose a,
.link {
    color: var(--accent-hi);
    text-decoration: underline;
    text-decoration-color: rgba(var(--accent-rgb), 0.4);
    text-underline-offset: 3px;
    transition: text-decoration-color .2s, color .2s;
}

.prose a:hover,
.link:hover {
    color: #fff;
    text-decoration-color: var(--accent);
}

.prose ul,
.prose ol {
    padding-left: 1.3em;
    margin-bottom: 0;
}

.prose li + li {
    margin-top: 0.35em;
}

.prose li::marker {
    color: var(--accent);
}

.prose strong,
.prose b {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Naglowek ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--header-h);
    border-bottom: 1px solid transparent;
    transition: background-color .3s, border-color .3s;
}

.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(5, 8, 13, 0.72);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    opacity: 0;
    transition: opacity .3s;
}

.site-header.is-scrolled,
.site-header.nav-open {
    border-bottom-color: var(--line);
}

.site-header.is-scrolled::before,
.site-header.nav-open::before {
    opacity: 1;
}

.header-inner {
    height: 100%;
    max-width: 1360px;
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    flex: none;
    border-radius: 8px;
}

.brand img {
    height: 34px;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-inline: auto;
}

/* Tylko bezposrednie linki menu (.nav > a) - przycisk "Polacz z serwerem"
   w .nav-mobile-extra zostaje zwyklym .btn-primary (ciemny tekst, gradient). */
.nav > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-2);
    transition: color .2s, background-color .2s, box-shadow .2s;
}

.nav > a .i {
    width: 14px;
    height: 14px;
    opacity: .55;
}

.nav > a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav > a[aria-current="page"] {
    color: var(--text);
    background: rgba(var(--accent-rgb), 0.12);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.28);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}

/* Status serwera na zywo */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    transition: border-color .2s, background-color .2s, color .2s;
}

.status-pill:hover {
    border-color: var(--line-3);
    color: var(--text);
}

.status-pill b {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.status-dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-3);
    flex: none;
}

[data-state="loading"] .status-dot {
    animation: pulse-dim 1.2s ease-in-out infinite;
}

[data-state="online"] .status-dot {
    background: var(--ok);
    box-shadow: 0 0 0 0 rgba(var(--ok-rgb), 0.55);
    animation: ping 2.4s ease-out infinite;
}

[data-state="offline"] .status-dot {
    background: var(--bad);
}

@keyframes ping {
    0% { box-shadow: 0 0 0 0 rgba(var(--ok-rgb), 0.55); }
    70%, 100% { box-shadow: 0 0 0 7px rgba(var(--ok-rgb), 0); }
}

@keyframes pulse-dim {
    50% { opacity: .35; }
}

/* Awatar + menu uzytkownika */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    transition: border-color .2s, background-color .2s;
}

.user-btn:hover,
.user-btn[aria-expanded="true"] {
    border-color: rgba(var(--accent-rgb), 0.45);
    background: var(--surface-3);
}

.user-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--panel-2);
}

.user-btn .i {
    width: 14px;
    height: 14px;
    color: var(--text-3);
    transition: transform .25s var(--ease);
}

.user-btn[aria-expanded="true"] .i {
    transform: rotate(180deg);
}

.dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 70;
    min-width: 230px;
    padding: 8px;
    border-radius: var(--r);
    background: rgba(10, 17, 26, 0.98);
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top right;
    transition: opacity .2s, transform .2s var(--ease), visibility .2s;
}

.dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.dropdown-head {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.dropdown-head small {
    display: block;
    font-size: 12px;
    color: var(--text-3);
}

.dropdown-head strong {
    font-weight: 600;
    font-size: 14px;
    word-break: break-all;
}

.dropdown a,
.dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 14px;
    color: var(--text-2);
    text-align: left;
    transition: background-color .15s, color .15s;
}

.dropdown a:hover,
.dropdown button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.dropdown .is-danger:hover {
    color: var(--bad);
    background: rgba(var(--bad-rgb), 0.08);
}

/* Hamburger (mobile) */
.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    place-items: center;
    flex: none;
}

.nav-toggle span {
    position: relative;
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: background-color .2s;
}

.nav-toggle span::before,
.nav-toggle span::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform .3s var(--ease);
}

.nav-toggle span::before { transform: translateY(-6px); }
.nav-toggle span::after { transform: translateY(6px); }

.nav-toggle[aria-expanded="true"] span {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] span::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: rotate(-45deg); }

.nav-mobile-extra {
    display: none;
}

@media (max-width: 1240px) {
    .status-pill .status-label {
        display: none;
    }

    /* 1101-1240px: wezsze linki, zeby menu + akcje (np. "128" i "Zaloguj sie")
       nie wychodzily poza margines naglowka */
    .nav > a {
        padding: 0 12px;
    }
}

/* Po zwinieciu menu (641-1100px) w naglowku znow jest miejsce na opis statusu -
   zamiast samej kropki pokazujemy "Serwer offline" / "N graczy online" */
@media (min-width: 641px) and (max-width: 1100px) {
    .status-pill .status-label {
        display: inline;
    }
}

/* Menu zwija sie do hamburgera ponizej 1100px - szerzej 6 linkow + akcje
   (status, Polacz, konto) mieszcza sie w jednej linii. */
@media (max-width: 1100px) {
    .nav-toggle {
        display: grid;
    }

    .header-actions {
        margin-left: auto;
    }

    .nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        margin: 0;
        padding: 12px var(--gutter) 22px;
        background: rgba(5, 8, 13, 0.97);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
        max-height: calc(100vh - var(--header-h));
        max-height: calc(100dvh - var(--header-h));
        overflow-y: auto;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .25s, transform .25s var(--ease), visibility .25s;
    }

    .nav.is-open {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .nav > a {
        height: 48px;
        padding: 0 16px;
        border-radius: 12px;
        font-size: 15px;
    }

    .nav-mobile-extra {
        display: flex;
        gap: 10px;
        margin-top: 10px;
        padding-top: 14px;
        border-top: 1px solid var(--line);
    }

    .nav-mobile-extra .btn {
        flex: 1;
    }

    .header-actions .btn-connect {
        display: none;
    }
}

@media (max-width: 480px) {
    .brand img {
        height: 28px;
    }

    .header-inner {
        gap: 10px;
    }

    .status-pill {
        padding: 0 11px;
    }

    .user-btn {
        padding-right: 3px;
    }

    .user-btn .i {
        display: none;
    }

    .header-actions .btn-login .btn-label {
        display: none;
    }

    .header-actions .btn-login {
        width: 42px;
        padding: 0;
    }
}

/* ---------- Przyciski ---------- */
.btn {
    --btn-h: 44px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--btn-h);
    padding: 0 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
    transition: transform .2s var(--ease), background-color .2s, border-color .2s, box-shadow .25s, color .2s, filter .2s;
}

.btn .i {
    width: 18px;
    height: 18px;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--grad-btn);
    color: #021219;
    box-shadow: 0 10px 28px -10px rgba(var(--accent-rgb), 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px -10px rgba(var(--accent-rgb), 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    filter: brightness(1.05);
}

.btn-ghost {
    background: var(--surface-2);
    border-color: var(--line-2);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--surface-3);
    border-color: var(--line-3);
}

.btn-outline {
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--accent-hi);
    background: rgba(var(--accent-rgb), 0.05);
}

.btn-outline:hover {
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.1);
    color: #fff;
}

.btn-discord {
    background: var(--discord);
    color: #fff;
    box-shadow: 0 10px 28px -12px rgba(88, 101, 242, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-discord:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.btn-success {
    background: rgba(var(--ok-rgb), 0.14);
    border-color: rgba(var(--ok-rgb), 0.35);
    color: var(--ok);
}

.btn-success:hover {
    background: rgba(var(--ok-rgb), 0.22);
    border-color: rgba(var(--ok-rgb), 0.55);
}

.btn-danger {
    background: rgba(var(--bad-rgb), 0.12);
    border-color: rgba(var(--bad-rgb), 0.32);
    color: var(--bad);
}

.btn-danger:hover {
    background: rgba(var(--bad-rgb), 0.2);
    border-color: rgba(var(--bad-rgb), 0.55);
}

.btn-text {
    padding: 0 6px;
    height: auto;
    color: var(--accent-hi);
}

.btn-text:hover {
    color: #fff;
}

.btn-sm {
    --btn-h: 36px;
    padding: 0 14px;
    font-size: 13px;
    border-radius: 10px;
}

.btn-sm .i {
    width: 16px;
    height: 16px;
}

.btn-lg {
    --btn-h: 52px;
    padding: 0 26px;
    font-size: 15px;
    border-radius: 14px;
}

.btn-icon {
    width: var(--btn-h);
    padding: 0;
}

.btn-block {
    width: 100%;
}

.btn[disabled],
.btn.is-disabled,
.btn[aria-disabled="true"] {
    opacity: .45;
    pointer-events: none;
    box-shadow: none;
}

.btn.is-loading {
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: spin .7s linear infinite;
}

.btn-primary.is-loading::after {
    border-color: rgba(2, 18, 25, 0.3);
    border-top-color: #021219;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Chip / badge ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
}

.chip .i {
    width: 14px;
    height: 14px;
    color: rgb(var(--c-rgb, var(--accent-rgb)));
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.5;
    white-space: nowrap;
    background: rgba(var(--c-rgb, var(--accent-rgb)), 0.12);
    color: rgb(var(--c-rgb, var(--accent-rgb)));
    border: 1px solid rgba(var(--c-rgb, var(--accent-rgb)), 0.24);
}

.badge .i {
    width: 12px;
    height: 12px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgb(var(--c-rgb, var(--accent-rgb)));
    box-shadow: 0 0 10px rgba(var(--c-rgb, var(--accent-rgb)), 0.6);
    flex: none;
}

/* ---------- Karty ---------- */
.card {
    position: relative;
    padding: var(--pad, 24px);
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.036), rgba(255, 255, 255, 0.014));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.card-solid {
    background: var(--panel);
}

.card-sm {
    --pad: 18px;
    border-radius: var(--r);
}

.card-link {
    display: block;
    isolation: isolate;
    overflow: hidden;
    transition: transform .3s var(--ease), border-color .3s, background-color .3s;
}

.card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(28rem 14rem at 100% 0%, rgba(var(--c-rgb, var(--accent-rgb)), 0.12), transparent 70%);
    opacity: 0;
    transition: opacity .3s;
}

.card-link:hover {
    transform: translateY(-3px);
    border-color: rgba(var(--c-rgb, var(--accent-rgb)), 0.38);
}

.card-link:hover::after {
    opacity: 1;
}

.card-link .card-arrow {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 18px;
    height: 18px;
    color: var(--text-3);
    transition: transform .3s var(--ease), color .3s;
}

.card-link:hover .card-arrow {
    transform: translate(3px, -3px);
    color: rgb(var(--c-rgb, var(--accent-rgb)));
}

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    flex: none;
    background: rgba(var(--c-rgb, var(--accent-rgb)), 0.11);
    border: 1px solid rgba(var(--c-rgb, var(--accent-rgb)), 0.24);
    color: rgb(var(--c-rgb, var(--accent-rgb)));
}

.card-icon .i {
    width: 22px;
    height: 22px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.005em;
    line-height: 1.25;
}

.card-text {
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.6;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card.is-locked {
    opacity: .62;
}

/* Kafelek statystyki */
.stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 22px;
    border-radius: var(--r-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    text-align: left;
}

.stat-value {
    font-family: var(--font-display);
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 600;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
}

.stat-label .i {
    width: 14px;
    height: 14px;
}

/* ---------- Strona: naglowek podstrony ---------- */
.page-hero {
    position: relative;
    padding-block: clamp(48px, 7vw, 96px) clamp(28px, 4vw, 52px);
    text-align: center;
}

.page-hero .eyebrow {
    margin-bottom: 18px;
}

/* Link powrotu zawsze w osobnej linii nad eyebrow/badge */
.page-hero .back-link {
    display: flex;
    width: fit-content;
}

.page-hero:not(.left) .back-link {
    margin-inline: auto;
}

.page-hero.left > .eyebrow,
.page-hero.left > .badge {
    display: flex;
    width: fit-content;
}

.page-hero .lead {
    margin: 18px auto 0;
}

.page-hero .cluster {
    justify-content: center;
    margin-top: 26px;
}

.page-hero.left {
    text-align: left;
}

.page-hero.left .lead {
    margin-left: 0;
}

.page-hero.left .cluster {
    justify-content: flex-start;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    transition: color .2s, gap .2s var(--ease);
}

.back-link:hover {
    color: var(--accent-hi);
    gap: 9px;
}

/* ---------- Formularze ---------- */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.form-grid .span-2 {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.label .req {
    color: var(--accent);
}

.label .opt {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-3);
}

.hint {
    font-size: 12.5px;
    color: var(--text-3);
    line-height: 1.5;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(2, 6, 11, 0.55);
    border: 1px solid var(--line-2);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.4;
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}

.textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-3);
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: var(--line-3);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.65);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.14);
    background: rgba(2, 6, 11, 0.8);
}

.input[readonly],
.input:disabled,
.select:disabled,
.textarea:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393b4c8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.select option,
.select optgroup {
    background: var(--panel);
    color: var(--text);
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea,
.input.is-invalid,
.textarea.is-invalid,
.select.is-invalid {
    border-color: rgba(var(--bad-rgb), 0.65);
    box-shadow: 0 0 0 4px rgba(var(--bad-rgb), 0.1);
}

.field-error {
    font-size: 12.5px;
    color: var(--bad);
}

.counter {
    align-self: flex-end;
    font-size: 12px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
    width: 17px;
    height: 17px;
    flex: none;
    margin: 2px 0 0;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-2);
}

/* Karta-wybor (radio/checkbox wygladajacy jak kafelek) */
.choice-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    gap: 10px;
}

.choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    font-size: 14px;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .2s, background-color .2s, color .2s;
}

.choice:hover {
    border-color: var(--line-3);
    color: var(--text);
}

.choice:has(input:checked) {
    border-color: rgba(var(--accent-rgb), 0.6);
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--text);
}

.choice:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Wyszukiwarka */
.search {
    position: relative;
    display: block;
}

.search .i {
    position: absolute;
    left: 15px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--text-3);
    pointer-events: none;
}

.search .input {
    padding-left: 44px;
}

/* ---------- Tabele ---------- */
.table-wrap {
    position: relative;
    overflow: auto;
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    font-size: 14px;
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 13px 16px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line-2);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    color: var(--text-2);
}

.table td strong {
    color: var(--text);
    font-weight: 600;
}

.table tbody tr {
    transition: background-color .15s;
}

.table tbody tr:hover {
    background: rgba(var(--accent-rgb), 0.04);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table .shrink {
    width: 1%;
    white-space: nowrap;
}

/* ---------- Akordeon (details/summary) ---------- */
.acc {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.acc-item {
    border-radius: var(--r);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color .25s, background-color .25s;
}

.acc-item:hover {
    border-color: var(--line-2);
}

.acc-item[open] {
    border-color: rgba(var(--accent-rgb), 0.3);
    background: rgba(var(--accent-rgb), 0.035);
}

.acc-item > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 20px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border-radius: var(--r);
}

.acc-item > summary::-webkit-details-marker {
    display: none;
}

.acc-item > summary::after {
    content: "";
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238ae6ff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 12px no-repeat;
    transition: transform .3s var(--ease), background-color .25s;
}

.acc-item[open] > summary::after {
    transform: rotate(45deg);
    background-color: rgba(var(--accent-rgb), 0.16);
}

.acc-body {
    padding: 0 20px 18px;
    color: var(--text-2);
    font-size: 14.5px;
    line-height: 1.7;
}

.acc-body a {
    color: var(--accent-hi);
    text-decoration: underline;
    text-decoration-color: rgba(var(--accent-rgb), 0.4);
    text-underline-offset: 3px;
}

@supports (interpolate-size: allow-keywords) {
    .acc-item {
        interpolate-size: allow-keywords;
    }

    .acc-item::details-content {
        height: 0;
        overflow: clip;
        transition: height .35s var(--ease), content-visibility .35s allow-discrete;
    }

    .acc-item[open]::details-content {
        height: auto;
    }
}

/* ---------- Zakladki ---------- */
.tabs {
    display: inline-flex;
    gap: 4px;
    max-width: 100%;
    padding: 4px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    transition: color .2s, background-color .2s, box-shadow .2s;
}

.tab .i {
    width: 16px;
    height: 16px;
}

.tab:hover {
    color: var(--text);
}

.tab[aria-selected="true"],
.tab.is-active {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line-2);
}

.tab .count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 99px;
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-hi);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

/* ---------- Komunikaty ---------- */
.callout {
    --c-rgb: var(--accent-rgb);
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--r);
    background: rgba(var(--c-rgb), 0.07);
    border: 1px solid rgba(var(--c-rgb), 0.24);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.callout > .i {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: rgb(var(--c-rgb));
}

.callout.tone-ok { --c-rgb: var(--ok-rgb); }
.callout.tone-warn { --c-rgb: var(--warn-rgb); }
.callout.tone-bad { --c-rgb: var(--bad-rgb); }
.callout.tone-purple { --c-rgb: var(--purple-rgb); }
.callout.tone-gold { --c-rgb: var(--gold-rgb); }

.callout strong {
    font-weight: 600;
}

.callout p + p {
    margin-top: 4px;
}

/* Pusty stan */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-3);
    border: 1px dashed var(--line-2);
    border-radius: var(--r-lg);
}

.empty > .i {
    width: 34px;
    height: 34px;
    color: var(--text-3);
}

.empty strong {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
}

/* Szkielet ladowania */
.skeleton {
    border-radius: 8px;
    background: linear-gradient(90deg, var(--surface) 0%, var(--surface-3) 50%, var(--surface) 100%) 0 0 / 200% 100%;
    animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}

/* Dymek podpowiedzi: <span data-tip="Tekst"> */
[data-tip] {
    position: relative;
}

[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 80;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(10, 17, 26, 0.98);
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow-lg);
    font: 500 12px/1.3 var(--font);
    letter-spacing: normal;
    text-transform: none;
    color: var(--text);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity .15s, transform .15s var(--ease);
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Awatar */
.avatar {
    width: var(--size, 40px);
    height: var(--size, 40px);
    border-radius: 50%;
    object-fit: cover;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    flex: none;
}

/* ---------- Modal (<dialog class="modal">) ---------- */
.modal {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    padding: 0;
    border-radius: var(--r-xl);
    background: var(--panel);
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    overflow: auto;
}

.modal-lg {
    width: min(860px, calc(100vw - 32px));
}

.modal::backdrop {
    background: rgba(2, 4, 8, 0.72);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal[open] {
    animation: modal-in .3s var(--ease);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

.modal-head h2,
.modal-head h3 {
    font-size: 19px;
}

.modal-body {
    padding: 22px 24px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.15);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--text-2);
    background: var(--surface-2);
    transition: color .2s, background-color .2s;
}

.modal-close:hover {
    color: var(--text);
    background: var(--surface-3);
}

/* ---------- Toast ---------- */
.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
    transition: bottom .3s var(--ease);
}

/* gdy widoczny jest przycisk "do gory", toasty wyswietlaja sie nad nim */
.to-top.show ~ .toast-stack {
    bottom: 76px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(380px, calc(100vw - 40px));
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(10, 17, 26, 0.97);
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    color: var(--text);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .3s var(--ease), transform .3s var(--ease);
}

.toast.show {
    opacity: 1;
    transform: none;
}

.toast .i {
    width: 18px;
    height: 18px;
    color: var(--ok);
}

.toast.is-error .i {
    color: var(--bad);
}

.toast.is-info .i {
    color: var(--accent);
}

@media (max-width: 640px) {
    .toast-stack {
        left: 16px;
        right: 16px;
        bottom: 16px;
        align-items: stretch;
    }

    .toast {
        max-width: none;
    }
}

/* ---------- Dokumenty (regulaminy, listy) ---------- */
.doc-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: clamp(24px, 4vw, 48px);
    align-items: start;
    padding-bottom: clamp(48px, 7vw, 96px);
}

.doc-toc {
    position: sticky;
    top: calc(var(--header-h) + 20px);
    max-height: calc(100vh - var(--header-h) - 40px);
    overflow-y: auto;
    padding: 16px;
    border-radius: var(--r-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    scrollbar-width: thin;
}

.doc-toc-title {
    display: block;
    padding: 2px 10px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-3);
}

.doc-toc nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.doc-toc a {
    display: flex;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--text-2);
    transition: color .2s, background-color .2s;
}

.doc-toc a .n {
    min-width: 1.5em;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.doc-toc a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.doc-toc a.is-active {
    color: var(--accent-hi);
    background: rgba(var(--accent-rgb), 0.1);
}

.doc-toc a.is-active .n {
    color: var(--accent);
}

.doc-article {
    min-width: 0;
}

.doc-card {
    padding: clamp(20px, 3.4vw, 40px);
    border-radius: var(--r-xl);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--line);
}

.doc-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.doc-tools .search {
    flex: 1 1 260px;
}

.doc-section {
    padding-block: 4px 34px;
}

.doc-section + .doc-section {
    padding-top: 34px;
    border-top: 1px solid var(--line);
}

.doc-section:last-child {
    padding-bottom: 0;
}

.doc-section-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 18px;
    font-size: clamp(21px, 2.3vw, 27px);
}

.doc-section-title .sec-num {
    font-size: 0.78em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.doc-section-lead {
    margin: -6px 0 18px;
    color: var(--text-2);
    font-size: 14.5px;
}

.rules {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.rule {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 11px 14px;
    border-radius: 12px;
    transition: background-color .2s, box-shadow .2s;
}

.rule:hover {
    background: var(--surface);
}

.rule:target {
    background: rgba(var(--accent-rgb), 0.08);
    box-shadow: inset 3px 0 0 var(--accent);
}

.rule-num {
    height: fit-content;
    min-width: 50px;
    padding: 2px 8px;
    border-radius: 7px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    text-align: center;
    color: var(--accent-hi);
    white-space: nowrap;
    transition: background-color .2s, color .2s;
}

a.rule-num:hover {
    background: rgba(var(--accent-rgb), 0.18);
    color: #fff;
}

.rule-body {
    color: var(--text-2);
    font-size: 14.5px;
    line-height: 1.7;
    min-width: 0;
}

.rule-body > * + * {
    margin-top: 8px;
}

.rule-body strong,
.rule-body b {
    color: var(--text);
    font-weight: 600;
}

.rule-body a {
    color: var(--accent-hi);
    text-decoration: underline;
    text-decoration-color: rgba(var(--accent-rgb), 0.4);
    text-underline-offset: 3px;
}

.rule-body ul,
.rule-body ol {
    margin: 8px 0 0;
    padding-left: 1.2em;
}

.rule-body li + li {
    margin-top: 4px;
}

.rule-body li::marker {
    color: var(--accent);
}

.rule.is-hidden,
.doc-section.is-hidden {
    display: none;
}

mark,
.hl {
    padding: 0 2px;
    border-radius: 3px;
    background: rgba(var(--accent-rgb), 0.28);
    color: #fff;
}

.tag-green { color: var(--ok); font-weight: 600; }
.tag-red { color: var(--bad); font-weight: 600; }
.tag-gold { color: var(--gold); font-weight: 600; }

@media (max-width: 1024px) {
    .doc-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-toc {
        top: var(--header-h);
        z-index: 20;
        max-height: none;
        margin-inline: calc(var(--gutter) * -1);
        padding: 10px var(--gutter);
        border-radius: 0;
        border-width: 1px 0;
        background: rgba(5, 8, 13, 0.92);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .doc-toc::-webkit-scrollbar {
        display: none;
    }

    .doc-toc-title {
        display: none;
    }

    .doc-toc nav {
        flex-direction: row;
        gap: 6px;
        width: max-content;
    }

    .doc-toc a {
        padding: 6px 12px;
        border-radius: 999px;
        border: 1px solid var(--line);
        white-space: nowrap;
        font-size: 13px;
    }
}

@media (max-width: 640px) {
    .rule {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        padding: 10px 4px;
    }

    .rule-num {
        justify-self: start;
    }
}

/* ---------- Stopka ---------- */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(5, 8, 13, 0), rgba(2, 4, 7, 0.6));
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
    gap: 40px;
    padding-block: 56px 40px;
}

.footer-brand img {
    height: 32px;
    width: auto;
}

.footer-brand p {
    max-width: 36ch;
    margin-top: 16px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text-3);
}

.footer-col h2 {
    margin-bottom: 14px;
    font-family: var(--font);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-3);
}

.footer-col a {
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 5px 0;
    font-size: 14px;
    color: var(--text-2);
    transition: color .2s;
}

.footer-col a:hover {
    color: var(--accent-hi);
}

.footer-col a .i {
    width: 13px;
    height: 13px;
    opacity: .5;
}

.socials {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.social {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    transition: color .2s, border-color .2s, background-color .2s, transform .2s var(--ease);
}

.social .i {
    width: 19px;
    height: 19px;
}

.social:hover {
    color: var(--accent-hi);
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.08);
    transform: translateY(-2px);
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    padding-block: 20px 26px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--text-3);
}

.footer-bottom a:hover {
    color: var(--text);
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px 20px;
        padding-top: 44px;
    }
}

/* ---------- Drobne elementy globalne ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    height: 2px;
    background: var(--grad);
    transform: scaleX(0);
    transform-origin: 0 50%;
    pointer-events: none;
}

.to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(10, 17, 26, 0.9);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .3s, transform .3s var(--ease), visibility .3s, color .2s, border-color .2s;
}

.to-top.show {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.to-top:hover {
    color: var(--accent-hi);
    border-color: rgba(var(--accent-rgb), 0.45);
}

.to-top .i {
    width: 20px;
    height: 20px;
}

/* Animacje wejscia: [data-reveal]; klasa .js ustawiana inline w <head>.
   Awaryjnie tresc pokazuje sie sama po 2.5 s, gdyby site.js sie nie zaladowal
   (gdy site.js ruszy, dodaje .reveal-ready i wylacza ten fallback). */
.js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    animation: reveal-fallback 0s 2.5s forwards;
}

.js.reveal-ready [data-reveal]:not(.is-visible) {
    animation: none;
}

.js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
    animation: none;
}

/* Przejscie tylko na czas wejscia - po nim (.reveal-done) element wraca
   do wlasnych przejsc, np. plynnego podniesienia karty przy najechaniu. */
.js [data-reveal].is-visible:not(.reveal-done) {
    transition: opacity .7s var(--ease), transform .7s var(--ease);
    transition-delay: var(--delay, 0s);
}

@keyframes reveal-fallback {
    to { opacity: 1; transform: none; }
}

@media print {
    .js [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .js [data-reveal] {
        opacity: 1;
        transform: none;
    }
}

/* Komunikat z security.js w stylu strony */
.fz-guard-msg {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(10, 17, 26, 0.97);
    border: 1px solid rgba(var(--bad-rgb), 0.35);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    font: 500 13px/1.4 var(--font);
}
