:root {
    --primary: #336e78;
    --primary-dark: #2980b9;
    --accent: #3498db;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

.top-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 10px 12px;
    background-color: var(--primary);
    color: white;
    padding: 10px 24px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 200;
}

.top-bar__row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.top-bar__row--brand {
    flex: 1 1 auto;
    min-width: 0;
}

.top-bar__row--nav,
.top-bar__row--live {
    flex: 0 1 auto;
    margin-left: auto;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.top-bar__row--club {
    flex: 1 1 12rem;
    justify-content: center;
    text-align: center;
}

.top-bar__row--live:has(.active-tournaments-nav:empty) {
    display: none;
}

.top-bar .brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    line-height: 0;
    background: #fff;
    border-radius: 8px;
    padding: 3px 10px;
}

.top-bar .brand__logo {
    display: block;
    height: 32px;
    width: auto;
    max-width: min(180px, 42vw);
    object-fit: contain;
}

.top-bar .brand__logo--short {
    display: none;
}

.nav-btn__short {
    display: none;
}

.top-actions {
    display: flex;
    flex: 1 1 auto;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.nav-btn {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 10px 22px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.nav-btn:hover {
    background-color: white;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover .club-switcher__prefix,
.nav-btn:hover .club-switcher__name {
    color: var(--primary);
}

.nav-btn.primary {
    background-color: var(--accent);
    border-color: var(--accent);
}

.nav-btn.primary:hover {
    background-color: white;
    color: var(--accent);
}

.active-tournaments-nav {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.nav-btn--tournament {
    padding: 8px 14px;
    font-size: 13px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.container {
    max-width: 900px;
    margin: 40px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

h1 {
    color: var(--primary);
    text-align: center;
    margin-top: 0;
}

p {
    line-height: 1.7;
    color: #555;
    font-size: 16px;
}

ul {
    line-height: 1.9;
    color: #555;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-label {
    font-size: 14px;
    font-weight: 600;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    white-space: nowrap;
}

.top-bar .club-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.club-switcher__prefix {
    white-space: nowrap;
    font-size: 18px;
    font-weight: 700;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    min-width: 240px;
    padding: 8px 0;
    z-index: 1100;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

.dropdown-menu button:hover:not(:disabled) {
    background: #f0f7fa;
    color: var(--primary);
}

.dropdown-menu button:disabled {
    color: #999;
    cursor: not-allowed;
    opacity: 0.55;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 900;
}

.modal {
    z-index: 1000;
}

.accounts-list {
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 12px;
}

.accounts-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.accounts-list th,
.accounts-list td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

.accounts-list th {
    color: var(--primary);
    font-weight: 700;
}

.accounts-list .btn-delete {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 768px) {
    /* Владелец: 1 лого+клуб, 2 меню, 3 активные турниры.
       Гость: 1 лого, 2 клуб, 3 меню (+активные в той же строке). */
    .top-bar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        align-items: stretch;
        padding: 8px 10px;
    }

    .top-bar__row--brand {
        grid-row: 1;
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .top-bar__row--club {
        grid-row: 2;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }

    .top-bar__row--club[aria-hidden="true"] {
        display: none;
    }

    .top-bar__row--nav {
        grid-row: 2;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .top-bar__row--nav::-webkit-scrollbar {
        display: none;
    }

    .top-bar.top-bar--guest .top-bar__row--nav {
        grid-row: 3;
    }

    .top-bar__row--live {
        grid-row: 3;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .top-bar__row--live::-webkit-scrollbar {
        display: none;
    }

    .top-bar .brand {
        align-self: center;
        padding: 2px 6px;
    }

    .top-bar .brand__logo--full {
        display: none;
    }

    .top-bar .brand__logo--short {
        display: block;
        height: 24px;
        max-width: 96px;
    }

    .top-bar .club-switcher {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        font-size: 15px;
    }

    /* На смартфоне в шапке только название клуба */
    .top-bar .club-place,
    .top-bar .guest-club-title .club-place {
        display: none;
    }

    .top-actions {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 5px;
        width: 100%;
        margin: 0;
    }

    .nav-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 18px;
        line-height: 1.2;
        white-space: nowrap;
    }

    .nav-btn__full {
        display: none;
    }

    .nav-btn__short {
        display: inline;
    }

    .nav-btn:hover {
        transform: none;
    }

    .nav-btn--tournament {
        max-width: 150px;
        padding: 8px 11px;
        font-size: 12px;
    }

    .active-tournaments-nav {
        gap: 5px;
        flex-wrap: nowrap;
    }

    .session-info {
        flex-wrap: wrap;
        width: 100%;
    }

    .session-label {
        white-space: normal;
        max-width: 100%;
        font-size: 13px;
        padding: 6px 10px;
    }

    .container {
        margin: 12px 10px 24px;
        padding: 18px 16px;
        border-radius: 8px;
    }

    h1 {
        font-size: 1.35rem;
        line-height: 1.3;
    }

    p,
    ul {
        font-size: 15px;
        line-height: 1.55;
    }

    .dropdown-menu {
        right: auto;
        left: 0;
        min-width: min(260px, calc(100vw - 24px));
    }
}
