:root {
    --midnight: #140C24;
    --deep-navy: #10153a;
    --royal-indigo: #18153f;
    --dark-violet: #201444;
    --panel-overlay: rgba(13, 15, 41, 0.75);
    --gold: #f7e6a2;
    --rich-gold: #d4aa49;
    --burnished-gold: #a1731b;
    --muted-gold: #f1d183;
    --muted-text: #cdd7ff;
    --glow: rgba(247, 230, 162, 0.2);
    --tournament-input-surface: linear-gradient(to right, rgba(14, 15, 35, .7), rgba(12, 14, 31, .8)), linear-gradient(90deg, rgba(12, 10, 20, .9) 25%, rgba(12, 10, 20, .7) 75%);
    --tournament-text-gradient: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 50%, var(--burnished-gold) 100%);
}

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

.tournament {
    max-width: 1180px;
    margin: 1.5rem auto 2rem;
    padding: 0 1.25rem 2.5rem;
    color: #e7ebff;
}

.tournament__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.tournament__titles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tournament__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: rgba(231, 235, 255, 0.75);
}

.tournament h1 {
    margin: 0;
    font-size: 2.1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.48), 0 0 18px rgba(194, 200, 214, 0.5);
}

.tournament__search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tournament__search-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem 0.6rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(247, 230, 162, 0.35);
    background: linear-gradient(135deg, rgba(13, 16, 44, 0.88) 0%, rgba(20, 18, 44, 0.92) 100%);
    box-shadow: inset 0 0 0 1px rgba(161, 115, 27, 0.14), 0 10px 22px rgba(6, 4, 16, 0.5);
    min-width: 260px;
}

.tournament__search-field:focus-within {
    border-color: rgba(247, 230, 162, 0.7);
    box-shadow: inset 0 0 0 1px rgba(161, 115, 27, 0.18), 0 12px 28px rgba(6, 4, 16, 0.65);
}

.tournament__search-field svg {
    width: 18px;
    height: 18px;
    fill: rgba(231, 235, 255, 0.85);
}

.tournament__search-field input {
    width: 100%;
    background: transparent;
    border: none;
    color: #e7ebff;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.1rem 0;
}

.tournament__search-field input::placeholder {
    color: rgba(231, 235, 255, 0.65);
}

.tournament__search-field input:focus {
    outline: none;
}

.tournament__sort {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(231, 235, 255, 0.82);
}

.tournament__sort-field {
    position: relative;
    min-width: 240px;
    border-radius: 14px;
    background: radial-gradient(circle at 20% 20%, rgba(247, 230, 162, 0.08), transparent 32%),
        linear-gradient(135deg, rgba(10, 12, 30, 0.95) 0%, rgba(20, 17, 38, 0.98) 100%);
    border: 1px solid rgba(247, 230, 162, 0.32);
    box-shadow: inset 0 0 0 1px rgba(153, 116, 37, 0.16), 0 12px 28px rgba(6, 4, 16, 0.55);
    padding: 0.35rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tournament__select-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: none;
    background: linear-gradient(135deg, rgba(18, 18, 34, 0.95) 0%, rgba(22, 19, 40, 0.98) 100%);
    color: rgba(231, 235, 255, 0.9);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.tournament__select-toggle:hover,
.tournament__sort-field:focus-within .tournament__select-toggle {
    background: linear-gradient(135deg, rgba(21, 23, 46, 0.98) 0%, rgba(28, 23, 51, 1) 100%);
    box-shadow: 0 10px 24px rgba(5, 3, 14, 0.55);
    color: #ffe6a8;
}

.tournament__sort-field:focus-within {
    border-color: rgba(247, 230, 162, 0.7);
    box-shadow: inset 0 0 0 1px rgba(247, 230, 162, 0.28), 0 12px 28px rgba(6, 4, 16, 0.6);
}

.tournament__select-arrow {
    width: 12px;
    height: 12px;
    position: relative;
}

.tournament__select-arrow::before,
.tournament__select-arrow::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(247, 230, 162, 0.85);
    border-bottom: 2px solid rgba(247, 230, 162, 0.85);
    transform: rotate(45deg);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.tournament__sort-field.is-open .tournament__select-arrow::before,
.tournament__sort-field.is-open .tournament__select-arrow::after {
    transform: rotate(-135deg);
}

.tournament__select-list {
    list-style: none;
    padding: 0.35rem;
    margin: 0.25rem 0 0;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: linear-gradient(135deg, rgba(12, 14, 31, 0.98) 0%, rgba(16, 16, 36, 0.98) 100%);
    border: 1px solid rgba(247, 230, 162, 0.35);
    box-shadow: 0 14px 28px rgba(5, 3, 14, 0.65);
    border-radius: 12px;
    max-height: 240px;
    overflow-y: auto;
    transform-origin: top center;
    transform: translateY(-6px) scaleY(0.96);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 10;
}

.tournament__select-list::-webkit-scrollbar {
    width: 10px;
}

.tournament__select-list::-webkit-scrollbar-track {
    background: rgba(18, 18, 34, 0.85);
    border-radius: 10px;
}

.tournament__select-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(247, 230, 162, 0.6), rgba(179, 137, 55, 0.7));
    border-radius: 10px;
}

.tournament__sort-field.is-open .tournament__select-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scaleY(1);
}

.tournament__select-list li {
    margin: 0;
}

.tournament__select-list button {
    width: 100%;
    border: none;
    background: transparent;
    color: rgba(231, 235, 255, 0.88);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.tournament__select-list button[aria-selected="true"] {
    background: linear-gradient(135deg, rgba(247, 230, 162, 0.12), rgba(179, 137, 55, 0.1));
    color: #f7e6a2;
}

.tournament__select-list button:hover,
.tournament__select-list button:focus-visible {
    outline: none;
    background: linear-gradient(135deg, rgba(247, 230, 162, 0.16), rgba(179, 137, 55, 0.16));
    color: #ffeec4;
    transform: translateX(2px);
}

.tournament__select-list button:active {
    transform: translateX(2px) translateY(1px);
}

.tournament__create {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
}

.tournament__create button {
    position: relative;
    border-radius: 14px;
    border: 1px solid rgba(247, 230, 162, 0.45);
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, var(--gold) 0%, var(--muted-gold) 50%, var(--burnished-gold) 100%);
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(247, 230, 162, 0.25), 0 12px 28px rgba(9, 7, 20, 0.55);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.22s ease, border-color 0.18s ease, background-image 0.28s ease;
}

.tournament__create button:hover,
.tournament__create button:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(247, 230, 162, 0.7);
    background-image: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.48), 0 0 18px rgba(194, 200, 214, 0.5);
}

.tournament__card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.card {
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    padding: 1.1rem 1.5rem 1.1rem 1.25rem;
    min-height: 140px;
    background: linear-gradient(180deg, rgba(13, 16, 44, 0.9) 0%, rgba(20, 18, 44, 0.92) 45%, rgba(12, 15, 42, 0.96) 100%);
    border-radius: 18px;
    border: 1px solid rgba(247, 230, 162, 0.22);
    box-shadow: 0 18px 40px rgba(5, 4, 15, 0.55), 0 0 18px rgba(247, 230, 162, 0.08);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.25s ease, border-color 0.2s ease;
    cursor: pointer;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(247, 230, 162, 0.07), transparent 60%);
    pointer-events: none;
}

.card:hover,
.card:focus-within {
    transform: translateY(-3px);
    border-color: rgba(247, 230, 162, 0.5);
    box-shadow: 0 22px 50px rgba(6, 4, 18, 0.65), inset 0 0 0 1px rgba(247, 230, 162, 0.25);
}

.card:focus-visible {
    outline: 2px solid var(--muted-gold);
    outline-offset: 3px;
}

.card__logo {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(21, 20, 51, 0.95), rgba(12, 15, 42, 0.95));
    border-radius: 14px;
    border: 1px solid rgba(247, 230, 162, 0.22);
    box-shadow: 0 12px 28px rgba(6, 4, 16, 0.45), 0 0 18px rgba(247, 230, 162, 0.12);
}

.card__logo img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
}

.card__content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card__name {
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.48), 0 0 18px rgba(194, 200, 214, 0.5);
}

.card__status {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(247, 230, 162, 0.2);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: capitalize;
    color: #e7ebff;
    background: rgba(231, 235, 255, 0.08);
}

.card__status--finished {
    color: #ffd7d7;
    background: rgba(255, 93, 93, 0.12);
    border-color: rgba(255, 93, 93, 0.35);
}

.card__status--online {
    color: #c1ffd8;
    background: rgba(54, 196, 132, 0.14);
    border-color: rgba(54, 196, 132, 0.4);
}

.card__status--preparation {
    color: #ffe9ad;
    background: rgba(247, 230, 162, 0.12);
    border-color: rgba(247, 230, 162, 0.35);
}

.card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem;
    margin-top: 0.1rem;
    color: rgba(231, 235, 255, 0.78);
    font-weight: 600;
}

.card__date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
}

.card__players {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.2rem;
    font-weight: 700;
    color: var(--muted-text);
}

.card__tag {
    margin-top: 0.35rem;
    color: #f7d87c;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.card__players-count {
    color: #f7e6a2;
    letter-spacing: 0.03em;
}

.card__addition {
    margin: 0.25rem 0 0;
    color: rgba(231, 235, 255, 0.78);
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__empty {
    grid-column: 1 / -1;
    padding: 1.75rem;
    border-radius: 16px;
    border: 1px dashed rgba(247, 230, 162, 0.35);
    background: rgba(12, 15, 42, 0.85);
    text-align: center;
    color: var(--muted-text);
}

.card__empty--filtered {
    margin: 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: 0.55rem 0.95rem;
    border-radius: 12px;
    border: 1px solid rgba(247, 230, 162, 0.25);
    background: rgba(18, 20, 48, 0.8);
    color: #e7ebff;
    text-decoration: none;
    font-weight: 700;
}

.pagination a:hover,
.pagination a:focus-visible {
    border-color: rgba(247, 230, 162, 0.7);
    background-image: linear-gradient(135deg, var(--gold) 0%, var(--muted-gold) 50%, var(--burnished-gold) 100%);
    color: #0c102a;
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.48), 0 0 18px rgba(194, 200, 214, 0.5);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 9, 21, 0.8);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 1000;
}

.modal.modal--visible {
    display: flex;
}

.modal > div,
.modal form {
    width: min(520px, 95%);
}

#modal {
    background: linear-gradient(170deg, rgba(13, 16, 44, 0.95) 0%, rgba(28, 20, 64, 0.92) 48%, rgba(15, 21, 50, 0.95) 100%);
    border-radius: 18px;
    border: 1px solid rgba(247, 230, 162, 0.25);
    box-shadow: 0 18px 40px rgba(5, 4, 15, 0.55), inset 0 0 0 1px rgba(161, 115, 27, 0.15);
    padding: 1.5rem;
    color: #e7ebff;
    flex-direction: column;
    gap: 0.75rem;
}

#modal h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
    font-size: 2.1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.48), 0 0 18px rgba(194, 200, 214, 0.5);

}

.tab {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(247, 230, 162, 0.2);
    padding-bottom: 0.75rem;
    margin-top: 0.25rem;
}

.tab button {
    background: none;
    border: 1px solid rgba(247, 230, 162, 0.35);
    border-radius: 12px;
    padding: 0.55rem 0.9rem;
    color: #e7ebff;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.25s ease;
}

.tab button.active,
.tab button:hover,
.tab button:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(247, 230, 162, 0.7);
    background-image: linear-gradient(135deg, var(--gold) 0%, var(--muted-gold) 50%, var(--burnished-gold) 100%);
    color: #0c102a;
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.48), 0 0 18px rgba(194, 200, 214, 0.5);
}

.tab-content {
    display: none;
    padding: 1rem 0 0;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    margin-top: 0;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#tournament-form input,
#tournament-form select,
#tournament-form textarea,
#tournament-form button {
    width: 100%;
    box-sizing: border-box;
}

#tournament-form {
    display: flex;
    flex-direction: column;
}

.tournament__form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

.tournament__form-group label {
    font-weight: 700;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.8;
}

#tournament-form input,
#tournament-form select,
#tournament-form textarea {
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(247, 230, 162, 0.26);
    background: rgba(12, 15, 42, 0.85);
    color: #746242;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(161, 115, 27, 0.18);
}

#tournament-form input:focus,
#tournament-form select:focus,
#tournament-form textarea:focus {
    outline: none;
    border-color: rgba(247, 230, 162, 0.7);
    box-shadow: 0 0 0 2px rgba(247, 230, 162, 0.2), inset 0 0 0 1px rgba(247, 230, 162, 0.25);
    background-image: var(--tournament-input-surface), var(--tournament-text-gradient);
}

#tournament-form input::placeholder,
#tournament-form textarea::placeholder,
#tournament-form select option {
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.8;
}

#tournament-form input::-webkit-input-placeholder,
#tournament-form textarea::-webkit-input-placeholder {
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.5;
}

#tournament-form input::-moz-placeholder,
#tournament-form textarea::-moz-placeholder,
#tournament-form input:-ms-input-placeholder,
#tournament-form textarea:-ms-input-placeholder,
#tournament-form input::-ms-input-placeholder,
#tournament-form textarea::-ms-input-placeholder {
    background: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.5;
}

#tournament-form button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.75rem 1.1rem;
    border-radius: 14px;
    border: 1px solid rgba(247, 230, 162, 0.45);
    background: linear-gradient(135deg, var(--gold) 0%, var(--muted-gold) 50%, var(--burnished-gold) 100%);
    color: #0c102a;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(247, 230, 162, 0.25), 0 12px 28px rgba(9, 7, 20, 0.55);
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.modal__close {
    position: relative;
    border-radius: 14px;
    border: 1px solid rgba(247, 230, 162, 0.45);
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, var(--gold) 0%, var(--muted-gold) 50%, var(--burnished-gold) 100%);
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(247, 230, 162, 0.25), 0 12px 28px rgba(9, 7, 20, 0.55);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.22s ease, border-color 0.18s ease, background-image 0.28s ease;
}

.modal__close:hover,
.modal__close:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(247, 230, 162, 0.7);
    background-image: linear-gradient(135deg, var(--gold) 0%, var(--rich-gold) 45%, var(--burnished-gold) 100%);
    text-shadow: 0 0 10px rgba(170, 170, 170, 0.48), 0 0 18px rgba(194, 200, 214, 0.5);
}

#tournament-form button:hover,
#tournament-form button:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(247, 230, 162, 0.7);
    box-shadow: 0 16px 32px rgba(8, 6, 20, 0.65), inset 0 0 0 1px rgba(247, 230, 162, 0.25);
}

.form-error {
    color: #f19f9f;
    font-size: 0.9rem;
    margin-top: 0.35rem;
}

.form-status {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--muted-text);
}

@media (max-width: 720px) {
    .tournament__header {
        justify-content: flex-start;
    }

    .tournament__search {
        width: 100%;
    }

    .tournament__search-field {
        width: 100%;
    }

    .card {
        min-height: 200px;
    }

    .card__logo {
        width: 96px;
        height: 96px;
    }

    .card__logo img {
        width: 72px;
        height: 72px;
    }
}