.Lindex-title {
    text-align: center;
}

.leagues-container,
.league-detail {
    width: min(44rem, calc(100% - 1.5rem));
    margin: clamp(1.25rem, 4vw, 2rem) auto 2rem;
    color: var(--accent-ink);
}

.league-index-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.league-index-header .league-actions {
    margin-bottom: 0;
}

@media (min-width: 64rem) {
    .league-index-header {
        flex-direction: row;
        justify-content: space-between;
    }
}

.league-index-header h1,
.league-detail-header h1 {
    margin: 0;
    font-size: clamp(1.65rem, 4vw, 2.2rem);
    line-height: 1.2;
}

.league-detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #cbd2dc;
}

.league-detail-header h1 {
    flex: 1 1 18rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.league-invite {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.6rem;
    color: #4e5c71;
    font-size: 0.875rem;
    font-weight: 600;
}

@media (max-width: 600px) {
    .league-detail-header h1 {
        flex-basis: 100%;
        text-align: center;
    }

    .league-invite {
        justify-content: center;
        margin-inline: auto;
    }
}

.league-invite-control {
    display: flex;
    max-width: 100%;
}

.league-invite-control input,
.league-invite-control button {
    box-sizing: border-box;
    min-height: 44px;
}

.league-invite-control input {
    width: 5.5rem;
    min-width: 0;
    padding: 0 0.45rem;
    border: 1px solid #cbd2dc;
    border-radius: 0.375rem 0 0 0.375rem;
    background: #ffffff;
    color: var(--accent-ink);
    font: 600 0.95rem ui-monospace, monospace;
    text-align: center;
}

.league-invite-control button {
    min-width: 4.5rem;
    padding: 0 0.55rem;
    border: 0;
    border-radius: 0 0.375rem 0.375rem 0;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.league-invite-control button:hover {
    background: var(--surface-raised);
}

.leagues-panel,
.standings-panel {
    overflow: hidden;
    border: 1px solid #d8dfe9;
    border-radius: 0.375rem;
    background: #ffffff;
}

.standings-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
    margin-bottom: 0.6rem;
}

.standings-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.standings-header span {
    color: #4e5c71;
    font-size: 0.875rem;
}

.leagues-table,
.standings-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    text-align: left;
    overflow-wrap: anywhere;
}

:is(.leagues-table, .standings-table) :is(th, td) {
    box-sizing: border-box;
    padding: 0.75rem 0;
}

:is(.leagues-table, .standings-table) thead {
    border-bottom: 1px solid #d8dfe9;
    background: #f1f3f7;
    color: #4e5c71;
    font-size: 0.8rem;
}

:is(.leagues-table, .standings-table) thead th {
    padding-block: 0.65rem;
}

:is(.leagues-table, .standings-table) tbody tr + tr {
    border-top: 1px solid #e8ecf2;
}

.leagues-table .league-rank,
.standings-table .standings-rank {
    width: clamp(3.25rem, 15vw, 5rem);
    text-align: center;
}

.leagues-table td.league-rank,
.standings-table td.standings-rank {
    color: #4e5c71;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.standings-table .standings-leader td.standings-rank {
    color: #a91935;
    font-weight: 700;
}

.standings-own-row {
    background: #f3f6fc;
}

.leagues-table tbody .league-name,
.standings-player {
    font-weight: 600;
}

.league-name a,
.standings-player a {
    color: var(--accent-ink);
    text-decoration-color: var(--accent);
    text-underline-offset: 0.2em;
}

.league-name a:hover,
.standings-player a:hover {
    color: #a91935;
}

.standings-you {
    display: inline-block;
    margin-inline-start: 0.35rem;
    color: #4e5c71;
    font-size: 0.75rem;
}

.leagues-table .league-points,
.standings-table .standings-points {
    width: clamp(4.25rem, 20vw, 8rem);
    padding-inline: 0.4rem clamp(0.85rem, 4vw, 1.5rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.leagues-empty,
.standings-empty {
    margin: 0;
    padding: 1.5rem;
    color: #4e5c71;
    text-align: center;
}

.leagues-table thead .league-name,
.league-name a {
    padding-inline: clamp(0.85rem, 4vw, 1.5rem);
}

.leagues-table tbody .league-name {
    padding: 0;
}

.league-name a {
    display: block;
    box-sizing: border-box;
    min-height: 44px;
    padding-block: 0.75rem;
}

.leagues-table tbody tr:is(:hover, :focus-within) {
    background: #f3f6fc;
}

.league-name a:focus-visible {
    outline: 2px solid #a91935;
    outline-offset: -2px;
}

.standings-pagination .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    margin: 0.75rem 0 0;
    padding: 0;
    font: inherit;
}

.standings-pagination .pagination a,
.standings-pagination .pagination .disabled {
    display: inline-grid;
    box-sizing: border-box;
    min-width: 2.75rem;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.4rem 0.6rem;
    place-items: center;
    border: 1px solid #d8dfe9;
    border-radius: 0.5rem;
    background: #ffffff;
    color: var(--accent-ink);
    font-size: 0.875rem;
    font-weight: 700;
}

.standings-pagination .pagination .disabled {
    background: #edf1f8;
    color: #5b687b;
}

.standings-pagination .pagination a:hover {
    background: #edf1f8;
}

.league-detail :is(a, button, input):focus-visible {
    outline: 2px solid #a91935;
    outline-offset: 2px;
}

/* new*/

.new-form {
    display: flex;
    justify-content: center;
    align-items: center;
}

.name-input {
    background-color: #ffffff;
    border-color: #cccccc;
    color: #333333;
}

.create-league {
    background-color: rgb(184, 94, 94);
    color: #fff;
    font-weight: 200;
}

.create-league:hover {
    cursor: pointer;
    background-color: var(--primary);
}

/*forms*/
/* old form styles
.league-form-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.new-form {
    width: 100%;
    max-width: 600px;

    margin-bottom: 20px;

}

.new-form form {
    display: flex;
    align-items: center;
}

.new-form form label {
    width: 150px;

}

.new-form form .name-input {
    flex: 1;

    margin: 0 10px;

}

.new-form form .create-league {
    width: 150px;

}
*/ 
/* NEW DROPDOWN */

.league-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

/* the toggle button itself */
.league-dropdown {
    position: relative;
}

.league-dropdown-toggle {
    display: inline-block;
    padding: 10px 10px;
    background-color: rgb(184, 94, 94);
    color: #fff;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    list-style: none; 
}

.league-dropdown-toggle::-webkit-details-marker {
    display: none;
}

.league-dropdown-toggle:hover {
    background-color: var(--primary);
}

/* the panel that drops down when opened */
.league-dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 340px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 10;
}

/* hide the actual radio inputs */
.league-tab-input {
    display: none;
}

/* tab labels row */
.league-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 16px;
}

.league-tab-label {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.league-tab-label:hover {
    color: #666;
}

/* hide both panels by default, show the one matching the checked radio */
.league-tab-panel {
    display: none;
}

#tab-create:checked ~ .league-tabs label[for="tab-create"],
#tab-join:checked ~ .league-tabs label[for="tab-join"] {
    color: rgb(184, 94, 94);
    border-bottom-color: rgb(184, 94, 94);
}

#tab-create:checked ~ .league-tab-panel--create,
#tab-join:checked ~ .league-tab-panel--join {
    display: block;
}

/* forms inside the panel go vertical instead of the old horizontal row */
.league-tab-panel form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.league-tab-panel form label {
    font-weight: bold;
    width: auto;
}

.league-tab-panel .name-input {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 8px;
    border-radius: 4px;
}

.league-tab-panel .create-league {
    width: 100%;
    padding: 8px 0;
    border-radius: 4px;
    border: none;
}

@media only screen and (max-width: 450px) {
    .league-dropdown-panel {
        width: 90vw;
        left: 50%;
    }
}

@media only screen and (max-width: 450px) {
    .new-form form label {
        width: 75px;

    }

    .new-form form .create-league {
        width: 100px;

    }

    .new-form form .name-input {
        width: 75px;

    }
}
