:root{
    --bg-main:#eef4fb;
    --bg-panel:#ffffff;
    --bg-panel-soft:#f8fbff;
    --bg-card:#ffffff;
    --bg-card-strong:#eef5ff;
    --bg-quiet:#f3f7fd;
    --text-main:#13233b;
    --text-soft:#274261;
    --text-muted:#64748b;
    --border:#d8e4f2;
    --border-strong:#c7d6ea;
    --primary:#2563eb;
    --primary-hover:#1d4ed8;
    --primary-soft:rgba(37,99,235,.12);
    --success:#dcfce7;
    --success-text:#166534;
    --danger:#ef4444;
    --warning:#f59e0b;
    --radius-sm:14px;
    --radius-md:20px;
    --radius-lg:28px;
    --shadow-soft:0 10px 24px rgba(15,23,42,.08);
    --shadow-card:0 18px 40px rgba(15,23,42,.1);
    --font-main:"Segoe UI",Arial,sans-serif;
}

*{
    box-sizing:border-box;
}

html{
    min-height:100%;
    background:var(--bg-main);
}

body{
    margin:0;
    min-height:100vh;
    font-family:var(--font-main);
    color:var(--text-main);
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.08), transparent 26%),
        linear-gradient(180deg, #f8fbff 0 116px, #eef4fb 116px 100%);
}

.site-header,
.ui-page{
    position:relative;
}

.site-header{
    position:sticky;
    top:0;
    z-index:100;
    min-height:96px;
    padding:16px 24px;
    display:grid;
    grid-template-columns:1fr auto 1fr;
    align-items:center;
    gap:18px;
    background:rgba(255,255,255,.94);
    backdrop-filter:blur(10px);
    border-bottom:1px solid rgba(199,214,234,.9);
    box-shadow:0 6px 24px rgba(15,23,42,.06);
}

.site-header__left,
.site-header__right{
    display:flex;
    align-items:center;
    gap:12px;
}

.site-header__right{
    justify-content:flex-end;
}

.site-header__logo{
    height:52px;
    padding:6px 10px;
    border-radius:16px;
    background:#ffffff;
    border:1px solid #dbe7f5;
    box-shadow:0 6px 14px rgba(15,23,42,.06);
    object-fit:contain;
}

.site-header__center{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.site-header__link{
    text-decoration:none;
    color:var(--text-soft);
    font-weight:700;
    font-size:14px;
    letter-spacing:.01em;
    padding:10px 16px;
    border-radius:999px;
    background:#f8fbff;
    border:1px solid #dbe7f5;
    transition:background .2s ease, color .2s ease, border-color .2s ease;
}

.site-header__link:hover,
.site-header__link:focus-visible{
    background:#e8f1ff;
    color:var(--primary);
    border-color:#b9d2fb;
    outline:none;
}

.site-header__title{
    font-size:24px;
    font-weight:800;
    color:var(--text-main);
    text-align:center;
    letter-spacing:.01em;
}

.ui-page{
    max-width:1380px;
    margin:0 auto;
    padding:28px 22px 40px;
}

.ui-page__head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    margin-bottom:22px;
}

.ui-page__title{
    margin:0;
    font-size:34px;
    line-height:1.06;
    letter-spacing:-.02em;
    color:var(--text-main);
}

.ui-text--muted{
    color:var(--text-muted);
}

.ui-grid{
    display:grid;
    gap:18px;
}

.ui-grid--2{
    grid-template-columns:repeat(auto-fit,minmax(360px,1fr));
}

.ui-grid--3{
    grid-template-columns:repeat(auto-fit,minmax(300px,1fr));
}

.ui-card{
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    padding:20px;
    box-shadow:var(--shadow-card);
}

.ui-card h3,
.ui-card h4{
    margin:0 0 12px;
    color:var(--text-main);
}

.ui-btn{
    border:none;
    border-radius:12px;
    padding:12px 18px;
    font-size:14px;
    font-weight:700;
    cursor:pointer;
    text-decoration:none;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    transition:filter .18s ease, background .18s ease, border-color .18s ease;
}

.ui-btn:hover,
.ui-btn:focus-visible{
    filter:brightness(.98);
    outline:none;
}

.ui-btn--primary{
    background:var(--primary);
    color:#ffffff;
}

.ui-btn--primary:hover,
.ui-btn--primary:focus-visible{
    background:var(--primary-hover);
}

.ui-btn--success{
    background:var(--success);
    color:var(--success-text);
    border:1px solid #bbf7d0;
}

.ui-btn--danger{
    background:#fff1f2;
    color:#b91c1c;
    border:1px solid #fecdd3;
}

.ui-btn--light,
.ui-btn--outline{
    background:#ffffff;
    color:var(--text-main);
    border:1px solid var(--border-strong);
}

.ui-btn--light:hover,
.ui-btn--outline:hover,
.ui-btn--light:focus-visible,
.ui-btn--outline:focus-visible{
    background:#f8fbff;
}

.ui-field{
    width:100%;
    border:1px solid var(--border-strong);
    border-radius:12px;
    font-size:14px;
    padding:12px 14px;
    background:#ffffff;
    color:var(--text-main);
}

.ui-field::placeholder{
    color:#94a3b8;
}

.ui-field:focus{
    outline:none;
    border-color:#93c5fd;
    box-shadow:0 0 0 4px rgba(37,99,235,.14);
}

.ui-table{
    width:100%;
    border-collapse:separate;
    border-spacing:0 8px;
}

.ui-table thead th{
    background:transparent;
    border:none;
    color:var(--text-muted);
    font-size:12px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.08em;
    padding:0 10px 6px;
}

.ui-table tbody tr{
    background:#f8fbff;
}

.ui-table th,
.ui-table td{
    padding:10px;
    text-align:left;
}

.ui-table tbody td{
    border-top:1px solid #e2ebf5;
    border-bottom:1px solid #e2ebf5;
}

.ui-table tbody td:first-child{
    border-left:1px solid #e2ebf5;
    border-top-left-radius:14px;
    border-bottom-left-radius:14px;
}

.ui-table tbody td:last-child{
    border-right:1px solid #e2ebf5;
    border-top-right-radius:14px;
    border-bottom-right-radius:14px;
}

.ui-badge{
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    font-size:12px;
    font-weight:800;
    padding:6px 12px;
}

.ui-badge--live{
    background:#dbeafe;
    color:#1d4ed8;
}

.ui-badge--finished{
    background:#e2e8f0;
    color:#475569;
}

.ui-badge--success{
    background:var(--success);
    color:var(--success-text);
}

.ui-badge--queue{
    background:#eff6ff;
    color:#1e40af;
}

.ui-divider{
    margin:18px 0;
    border:none;
    border-top:1px solid #e2ebf5;
}

.court-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:10px 0;
}

.tournament__players{
    max-height:430px;
    overflow:auto;
}

.tournament__finished-list{
    max-height:430px;
    overflow:auto;
    display:flex;
    flex-direction:column;
    gap:12px;
}

.tournament__finished-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding:14px;
    border-radius:16px;
    border:1px solid #dbe7f5;
    background:#f8fbff;
}

.tournament__match-duration{
    font-weight:800;
    margin:10px 0;
}

.court-row__actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    justify-content:flex-end;
}

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

::-webkit-scrollbar-thumb{
    background:#c9d7e8;
    border-radius:999px;
}

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

@media (max-width: 900px){
    .site-header{
        min-height:84px;
        padding:12px 14px;
        grid-template-columns:auto 1fr;
    }

    .site-header__right{
        display:none;
    }

    .site-header__logo{
        height:44px;
    }

    .site-header__center{
        justify-content:flex-end;
        gap:8px;
    }

    .ui-page{
        padding:18px 12px 34px;
    }

    .ui-page__title{
        font-size:26px;
    }

    .ui-btn{
        width:100%;
    }
}

@media (max-width: 700px){
    .site-header{
        gap:10px;
    }

    .site-header__left{
        grid-column:1 / -1;
    }

    .site-header__center{
        grid-column:1 / -1;
        justify-content:flex-start;
        padding-bottom:2px;
    }

    .ui-page__head{
        flex-direction:column;
        align-items:flex-start;
    }

    .ui-card{
        padding:16px;
    }

    .court-row,
    .tournament__finished-row{
        flex-direction:column;
        align-items:flex-start;
    }

    .ui-table{
        display:block;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
    }
}
