* {
    box-sizing: border-box;
}

:root {
    --bg: #0f172a;
    --card: #1e293b;
    --card-2: rgba(15, 23, 42, 0.65);
    --stroke: rgba(255, 255, 255, 0.08);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --blue: #2563eb;
    --blue-soft: #93c5fd;
    --slate: #334155;
    --green: #15803d;
    --danger: #b91c1c;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.stats-shell {
    min-height: 100vh;
}

.stats-header {
    padding: 20px 20px 0;
}

.stats-header__inner {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.stats-brand {
    font-size: 22px;
    font-weight: 700;
}

.stats-user {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.stats-header__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-main {
    padding: 20px;
}

.wrap {
    max-width: 1100px;
    margin: 0 auto;
}

.page-title {
    margin: 0 0 18px;
    font-size: 28px;
}

.card {
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.muted {
    color: var(--muted);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filters .field {
    width: calc(25% - 9px);
    min-width: 180px;
}

.field label {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
    color: var(--blue-soft);
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid var(--slate);
    background: var(--bg);
    color: var(--text);
    padding: 0 10px;
}

textarea {
    min-height: 110px;
    padding: 10px;
    resize: vertical;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 10px;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-secondary {
    background: var(--slate);
    color: #fff;
}

.btn-success {
    background: var(--green);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-disabled {
    background: #475569;
    color: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.75;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--blue-soft);
}

.empty {
    padding: 20px;
    text-align: center;
    color: var(--muted);
}

.meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.meta-item {
    width: calc(50% - 7px);
    background: var(--card-2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px;
}

.meta-item.meta-item-full {
    width: 100%;
}

.meta-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--blue-soft);
    margin-bottom: 6px;
}

.meta-value {
    font-size: 16px;
    font-weight: 600;
}

.players {
    display: block;
}

.player {
    background: var(--card-2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.player:last-child {
    margin-bottom: 0;
}

.player-name {
    font-weight: 700;
    margin-bottom: 4px;
}

.player-short {
    font-size: 14px;
    color: var(--muted);
}

.two-cols {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.two-cols > div:first-child {
    width: 55%;
}

.two-cols > div:last-child {
    width: 45%;
}

.section-title {
    margin: 0 0 16px;
    font-size: 20px;
}

.top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

@media (max-width: 900px) {
    .filters .field {
        width: calc(50% - 6px);
    }

    .meta-item {
        width: 100%;
    }

    .two-cols {
        display: block;
    }

    .two-cols > div:first-child,
    .two-cols > div:last-child {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .stats-header,
    .stats-main {
        padding: 14px;
    }

    .page-title {
        font-size: 24px;
    }

    .filters .field {
        width: 100%;
        min-width: 0;
    }

    th,
    td {
        font-size: 12px;
        padding: 9px 8px;
    }
}

/* LOGIN */
body:has(form[action="process_login.php"]) {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.22), transparent 34%),
        var(--bg);
}

body:has(form[action="process_login.php"]) h2 {
    max-width: 420px;
    width: 100%;
    margin: 0 0 18px;
    font-size: 26px;
    text-align: center;
    color: var(--text);
}

body:has(form[action="process_login.php"]) form {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: 18px;
    padding: 26px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

body:has(form[action="process_login.php"]) form div {
    margin-bottom: 16px;
}

body:has(form[action="process_login.php"]) label {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--blue-soft);
}

body:has(form[action="process_login.php"]) input {
    min-height: 46px;
    font-size: 15px;
}

body:has(form[action="process_login.php"]) br {
    display: none;
}

body:has(form[action="process_login.php"]) button {
    width: 100%;
    min-height: 46px;
    margin-top: 6px;
    border: 0;
    border-radius: 12px;
    background: var(--blue);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

body:has(form[action="process_login.php"]) button:hover {
    filter: brightness(1.08);
}

body:has(form[action="process_login.php"]) p {
    width: 100%;
    max-width: 420px;
    margin: 14px 0 0;
    padding: 12px;
    border-radius: 12px;
    background: rgba(185, 28, 28, 0.15);
    border: 1px solid rgba(185, 28, 28, 0.35);
    color: #fecaca !important;
    text-align: center;
    font-size: 13px;
}
.page-heading {
    margin-bottom: 18px;
}

.page-heading .page-title {
    margin-bottom: 4px;
}

.page-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.table-wrap tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

.btn-sm {
    min-height: 34px;
    padding: 6px 12px;
}

.filters-inline {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.filters-inline .field {
    margin: 0;
}

.filters-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    height: 40px;
    margin-top: 18px;
}

.filters-actions .btn {
    margin: 0;
    height: 40px;
}

@media (max-width: 900px) {
    .filters-actions {
        width: 100%;
        margin-top: 0;
    }

    .filters-actions .btn {
        flex: 1;
    }
}