:root {
    color-scheme: light;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    background: #0f172a;
    color: #0f172a;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 40%, #0f172a 100%);
    min-height: 100vh;
    color: #0f172a;
}

.alert {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: rgba(248, 113, 113, 0.2);
    color: #b91c1c;
    font-weight: 600;
}

.form-help {
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.7);
    margin-top: 1rem;
}

.portal-header {
    padding: 1.5rem 1.25rem 1rem;
    color: #f8fafc;
}

.portal-header__content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.portal-header__branding {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.portal-header__branding:focus-visible {
    outline: 2px solid rgba(248, 250, 252, 0.85);
    outline-offset: 4px;
}

.portal-header__branding-logo {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.portal-header__branding-logo--placeholder {
    font-weight: 700;
    color: #f8fafc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.portal-header__branding-logo img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.portal-header__branding-text {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.portal-header__branding-title {
    font-size: 1.25rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portal-header__branding-subtitle {
    font-size: 0.85rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.portal-header__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.portal-header__nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(248, 250, 252, 0.25);
    background: rgba(15, 23, 42, 0.2);
    color: #f8fafc;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.portal-header__nav a:hover,
.portal-header__nav a:focus-visible {
    background: rgba(248, 250, 252, 0.18);
    border-color: rgba(248, 250, 252, 0.4);
}

.portal-header__nav a.is-active {
    background: rgba(248, 250, 252, 0.85);
    color: #0f172a;
    border-color: rgba(248, 250, 252, 1);
}

.portal-header__actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.portal-header__season {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.portal-header__season-current {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(248, 250, 252, 0.35);
    background: rgba(15, 23, 42, 0.35);
    color: inherit;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.portal-header__season-current svg {
    width: 0.85rem;
    height: 0.85rem;
}

.portal-header__season-menu {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 0.65rem);
    background: rgba(15, 23, 42, 0.95);
    border-radius: 1rem;
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.55);
    padding: 0.6rem;
    display: none;
    min-width: 220px;
    z-index: 10;
}

.portal-header__season.is-open .portal-header__season-menu {
    display: block;
}

.portal-header__season-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.portal-header__season-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.75rem;
    border: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.portal-header__season-option:hover,
.portal-header__season-option:focus-visible {
    background: rgba(148, 163, 184, 0.25);
    color: #f8fafc;
}

.portal-header__season-option.is-active {
    background: rgba(14, 116, 144, 0.45);
    color: #f8fafc;
}

.portal-header__season-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.45rem;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.25);
    color: #38bdf8;
}

.portal-header__logout-form {
    margin: 0;
}

.portal-header__logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.15rem;
    border-radius: 999px;
    border: 1px solid rgba(248, 250, 252, 0.4);
    background: rgba(248, 250, 252, 0.08);
    color: #f8fafc;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.portal-header__logout:hover,
.portal-header__logout:focus-visible {
    background: rgba(248, 250, 252, 0.18);
}

.portal-main {
    padding: 0 1.25rem 2.5rem;
    display: grid;
    gap: 1rem;
}

.portal-main--narrow {
    max-width: 600px;
    margin: 0 auto;
}

.card {
    background: rgba(248, 250, 252, 0.95);
    border-radius: 1.35rem;
    padding: 1.25rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
}

.card h1,
.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    color: #0f172a;
}

.card p,
.card span,
.card li {
    color: #1e293b;
    line-height: 1.5;
}

.card strong {
    color: #0f172a;
}

.season-period {
    margin: 0 0 0.85rem;
    font-size: 0.9rem;
    color: #1f2937;
}

select,
input,
button {
    width: 100%;
    border: none;
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-family: inherit;
}

select,
input {
    background: rgba(226, 232, 240, 0.75);
    color: #0f172a;
}

button {
    background: #f59e0b;
    color: #0f172a;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 15px 30px rgba(245, 158, 11, 0.35);
    cursor: pointer;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(14, 165, 233, 0.15);
    color: #0369a1;
}

.badge[data-genre="F"] {
    background: rgba(236, 72, 153, 0.18);
    color: #be185d;
}

.badge[data-genre="H"] {
    background: rgba(14, 165, 233, 0.15);
    color: #0369a1;
}

.badge[data-genre="NC"] {
    background: rgba(148, 163, 184, 0.25);
    color: #475569;
}

.badge[data-profil] {
    background: rgba(99, 102, 241, 0.18);
    color: #4338ca;
}

.badge[data-profil="pointeur"] {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.badge[data-profil="polyvalent"] {
    background: rgba(147, 51, 234, 0.18);
    color: #7c3aed;
}

.badge[data-profil="tireur"] {
    background: rgba(239, 68, 68, 0.18);
    color: #b91c1c;
}

.badge.inactive {
    background: rgba(148, 163, 184, 0.25);
    color: #475569;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after,
[data-tooltip]::before {
    position: absolute;
    left: 50%;
    opacity: 0;
    pointer-events: none;
    transition: none;
    z-index: 10;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    transform: translate(-50%, -6px);
    background: #0f172a;
    color: #ffffff;
    padding: 0.45rem 0.65rem;
    border-radius: 0.65rem;
    font-size: 0.85rem;
    white-space: pre-line;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
    max-width: 24rem;
}

[data-tooltip]::before {
    content: '';
    bottom: calc(100% + 4px);
    transform: translate(-50%, -6px);
    border: 6px solid transparent;
    border-top-color: #0f172a;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus::after,
[data-tooltip]:focus::before {
    opacity: 1;
    transform: translate(-50%, -2px);
}

thead {
    background: rgba(226, 232, 240, 0.8);
}

th,
td {
    padding: 0.65rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.live-results {
    display: grid;
    gap: 1.25rem;
}

.live-results__rounds {
    display: grid;
    gap: 0.85rem;
}

.live-round {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.55);
    overflow: hidden;
}

.live-round[open] {
    background: rgba(248, 250, 252, 0.85);
}

.live-round summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    cursor: pointer;
    font-weight: 600;
}

.live-round summary::-webkit-details-marker {
    display: none;
}

.live-round__badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.live-round__matches {
    display: grid;
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

.live-match {
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.05);
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
}

.live-match__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #0f172a;
}

.live-match__meta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.live-match__terrain {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.live-match__chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.live-match__chip--done {
    background: rgba(34, 197, 94, 0.2);
    color: #15803d;
}

.live-match__score {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.live-match__status {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2563eb;
}

.live-match__teams {
    display: grid;
    gap: 0.75rem;
}

.live-match__team {
    display: grid;
    gap: 0.5rem;
}

.live-match__team-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.live-match__players {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.6rem;
}

.live-match__players li {
    display: flex;
}

.player-link {
    border: none;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.player-link:hover,
.player-link:focus-visible {
    background: rgba(37, 99, 235, 0.2);
    color: #1e40af;
}

.live-match__team--bye .live-match__team-name {
    font-style: italic;
    color: #475569;
}

.tournament-sections {
    display: grid;
    gap: 1rem;
}

.tournament-sections h2 {
    margin-bottom: 0;
}

.tournament-sections__grid {
    display: grid;
    gap: 1rem;
}

.tournament-card {
    background: rgba(248, 250, 252, 0.95);
    border-radius: 1.35rem;
    padding: 1.15rem;
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.15);
    display: grid;
    gap: 0.5rem;
}

.tournament-card__meta {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
}

.tournament-card__placeholder {
    margin: 0;
    font-size: 0.85rem;
    color: #1f2937;
    opacity: 0.8;
}

.tournament-card--empty {
    text-align: center;
}

.player-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: grid;
    place-items: center;
    padding: 1.5rem;
    z-index: 100;
}

.player-modal[hidden] {
    display: none;
}

.player-modal__dialog {
    position: relative;
    background: #f8fafc;
    border-radius: 1.25rem;
    padding: 1.5rem;
    width: min(320px, 100%);
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.35);
    display: grid;
    gap: 1rem;
}

.player-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #0f172a;
}

.player-modal__stats {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.player-modal__stats div {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.9rem;
    color: #0f172a;
}

.player-modal__stats dt {
    margin: 0;
}

.player-modal__stats dd {
    margin: 0;
    font-weight: 700;
}

.season-selector {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.season-selector input[type="password"] {
    width: min(100%, 18rem);
    justify-self: center;
    box-sizing: border-box;
}

.tournament-history {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tournament-history__item {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: #ffffff;
    color: #0f172a;
    padding: 1rem 1.25rem;
}

.tournament-history__item > summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    gap: 0.5rem;
}

.tournament-history__content {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.tournament-history__ranking {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.calendar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.calendar-list__item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    background: rgba(248, 250, 252, 0.85);
    color: #0f172a;
}

.calendar-list__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.live-ranking .table-scroll {
    margin-top: 1rem;
}

.live-ranking__grid {
    margin-top: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

.live-ranking__column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.live-ranking__column > h3 {
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

@media (min-width: 640px) {
    .live-match__teams {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }

    .tournament-sections__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .portal-main {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-main > .card:first-child {
        grid-column: 1 / -1;
    }

    .portal-main > .live-ranking {
        grid-column: 1 / -1;
    }

    .live-round__matches {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .live-ranking__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tournament-sections__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
