* {
    box-sizing: border-box;
}

:root {
    --ink: #10203a;
    --muted: #64728a;
    --line: #dce3ec;
    --panel: #ffffff;
    --page: #f3f6fa;
    --navy: #101b35;
    --navy-2: #182949;
    --accent: #12a77b;
    --accent-soft: #e4f7f1;
    --danger: #d14545;
    --live: #d9272e;
    --gold: #f3bd3d;
    --shadow: 0 14px 40px rgba(16, 32, 58, 0.09);
    --radius: 18px;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(18, 167, 123, 0.09), transparent 28rem),
        var(--page);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.site-shell {
    width: min(1480px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.hero {
    overflow: hidden;
    padding: clamp(24px, 4vw, 46px);
    border-radius: 28px;
    color: #fff;
    background:
        linear-gradient(120deg, rgba(16, 27, 53, 0.97), rgba(24, 41, 73, 0.94)),
        linear-gradient(45deg, var(--accent), var(--navy));
    box-shadow: var(--shadow);
}

.hero__topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero .eyebrow {
    color: #75e3c3;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(2.1rem, 5vw, 4.6rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    letter-spacing: -0.03em;
}

h3 {
    margin-bottom: 0;
    font-size: 1.35rem;
}

.hero__intro {
    max-width: 650px;
    margin-bottom: 0;
    color: #cbd7ea;
    font-size: 1.03rem;
}

.hero__badge {
    display: grid;
    flex: 0 0 auto;
    width: 88px;
    height: 88px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--navy);
    background: var(--gold);
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.35);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
}

.summary-card {
    padding: 17px 18px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(8px);
}

.summary-card span {
    display: block;
    margin-bottom: 5px;
    color: #b8c5da;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.summary-card strong {
    font-size: 1.65rem;
}

.summary-card--live strong {
    color: #ff8589;
}

.progress-track {
    height: 7px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.progress-track__bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #75e3c3, var(--gold));
    transition: width 400ms ease;
}

.tabs {
    position: sticky;
    z-index: 20;
    top: 10px;
    display: flex;
    gap: 8px;
    margin: 18px 0;
    padding: 8px;
    overflow-x: auto;
    border: 1px solid rgba(220, 227, 236, 0.9);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 30px rgba(16, 32, 58, 0.06);
    backdrop-filter: blur(16px);
}

.tab {
    min-width: max-content;
    padding: 10px 18px;
    border: 0;
    border-radius: 11px;
    color: var(--muted);
    background: transparent;
    font-weight: 800;
}

.tab:hover,
.tab:focus-visible {
    color: var(--ink);
    background: #edf1f6;
}

.tab.is-active {
    color: #fff;
    background: var(--navy);
}

.panel {
    display: none;
    padding: clamp(20px, 3vw, 34px);
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel.is-active {
    display: block;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.section-heading--compact {
    margin-bottom: 14px;
}

.section-note,
.updated {
    max-width: 590px;
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    text-align: right;
}

.filters,
.planner-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(145px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
}

label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

select {
    width: 100%;
    min-height: 43px;
    padding: 9px 36px 9px 12px;
    border: 1px solid #cad4e1;
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
}

.button {
    min-height: 43px;
    padding: 9px 16px;
    border: 1px solid var(--navy);
    border-radius: 10px;
    color: #fff;
    background: var(--navy);
    font-weight: 800;
}

.button:hover,
.button:focus-visible {
    transform: translateY(-1px);
}

.button--secondary {
    border-color: #c8d2df;
    color: var(--ink);
    background: #fff;
}

.next-match {
    margin-bottom: 24px;
}

.next-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    padding: 20px;
    border: 1px solid #b8e7da;
    border-radius: 17px;
    background: linear-gradient(125deg, #f0fbf7, #f9fcfb);
}

.next-card__team:last-child {
    text-align: right;
}

.next-card__centre {
    text-align: center;
}

.next-card__label {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.next-card__time {
    display: block;
    color: var(--ink);
    font-weight: 900;
}

.match-days {
    display: grid;
    gap: 22px;
}

.match-day h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.84rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.match-day h3::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.match-card {
    position: relative;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    transition: border-color 150ms ease, transform 150ms ease;
}

.match-card:hover {
    transform: translateY(-2px);
    border-color: #b7c3d3;
}

.match-card.is-live {
    border-color: #ffb3b6;
    box-shadow: inset 4px 0 0 var(--live);
}

.match-card__meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 11px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #fff;
    background: var(--live);
    font-size: 0.72rem;
    line-height: 1;
    white-space: nowrap;
}

.match-team {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 34px;
}

.match-team + .match-team {
    margin-top: 6px;
}

.team-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    color: #fff;
    background: var(--navy-2);
    font-size: 0.65rem;
    font-weight: 900;
}

.team-mark img {
    width: 100%;
    height: 100%;
    padding: 4px;
    object-fit: contain;
    background: #fff;
}

.match-team__identity {
    display: block;
    min-width: 0;
}

.team-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-team__scorers {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 650;
    line-height: 1.35;
    white-space: normal;
}

.match-scorer {
    display: inline;
}

.match-scorer__ball {
    display: inline-block;
    margin-right: 4px;
    color: var(--accent);
    font-size: 0.62rem;
    vertical-align: 0.08em;
}

.match-scorer__separator {
    color: #9aa6b7;
}

.bracket-match .match-team__scorers {
    font-size: 0.66rem;
}

.team-score {
    min-width: 24px;
    text-align: right;
    font-size: 1.1rem;
    font-weight: 900;
}

.penalties {
    color: var(--muted);
    font-size: 0.72rem;
}

.empty-state {
    padding: 28px;
    border: 1px dashed #c5cfdb;
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
    background: #f8fafc;
}

.group-tabs {
    display: flex;
    gap: 7px;
    margin-bottom: 16px;
    padding-bottom: 4px;
    overflow-x: auto;
}

.group-tab {
    min-width: 42px;
    height: 40px;
    border: 1px solid #cad4e1;
    border-radius: 10px;
    color: var(--muted);
    background: #fff;
    font-weight: 900;
}

.group-tab.is-active {
    border-color: var(--navy);
    color: #fff;
    background: var(--navy);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid #e7ecf2;
    text-align: center;
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: #f7f9fc;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td.team-cell {
    min-width: 195px;
    text-align: left;
    font-weight: 800;
}

.team-cell__inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.position-cell {
    width: 44px;
    font-weight: 900;
}

.qualifies-direct td:first-child {
    box-shadow: inset 4px 0 0 var(--accent);
}

.qualifies-third td:first-child {
    box-shadow: inset 4px 0 0 var(--gold);
}

.knocked-out td:first-child {
    box-shadow: inset 4px 0 0 var(--danger);
}

.third-place-section {
    margin-top: 34px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.third-qualifier {
    background: var(--accent-soft);
}

.bracket-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    margin: -8px 0 18px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 700;
}

.bracket-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bracket-legend__hint {
    margin-left: auto;
}

.bracket-legend__line {
    display: inline-block;
    width: 34px;
    height: 0;
    border-top: 3px solid #8797ad;
}

.bracket-legend__line--loser {
    border-top-style: dashed;
}

.bracket-legend__team {
    display: inline-block;
    width: 28px;
    height: 16px;
    border: 1px solid transparent;
    border-radius: 5px;
}

.bracket-legend__team--confirmed {
    border-color: #8fd3bd;
    background: #ddf5ed;
    box-shadow: inset 4px 0 0 var(--accent);
}

.bracket-legend__team--projected {
    border-color: #ebcf7b;
    background: #fff7dc;
    box-shadow: inset 4px 0 0 var(--gold);
}

.bracket .match-team--confirmed,
.bracket .match-team--projected {
    margin-right: -4px;
    margin-left: -4px;
    padding: 3px 5px;
    border: 1px solid transparent;
    border-radius: 8px;
}

.bracket .match-team--confirmed {
    border-color: #a8ddcc;
    background: #e7f8f2;
    box-shadow: inset 4px 0 0 var(--accent);
}

.bracket .match-team--projected {
    border-color: #edd58b;
    background: #fff8e3;
    box-shadow: inset 4px 0 0 var(--gold);
}

.bracket .match-team--confirmed .team-mark {
    box-shadow: 0 0 0 2px rgba(18, 167, 123, 0.22);
}

.bracket .match-team--projected .team-mark {
    box-shadow: 0 0 0 2px rgba(243, 189, 61, 0.28);
}

.bracket {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, minmax(240px, 1fr));
    align-items: start;
    gap: 56px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px 16px;
    isolation: isolate;
}

.bracket-connectors {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: visible;
}

.bracket-stage {
    position: relative;
    z-index: 1;
    min-width: 240px;
}

.bracket-stage h3 {
    position: relative;
    z-index: 2;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #fff;
    background: var(--navy);
    font-size: 0.82rem;
    text-align: center;
    text-transform: uppercase;
}

.bracket-stage__matches {
    position: relative;
    min-height: 240px;
}

.bracket .match-card {
    padding: 12px;
}

.bracket-match {
    position: absolute;
    z-index: 2;
    width: 100%;
    background: #fff;
    outline: none;
    transition:
        opacity 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

.bracket-match:focus-visible,
.bracket-match.is-route-highlighted {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(18, 167, 123, 0.16), var(--shadow);
}

.bracket-match.is-route-dimmed {
    opacity: 0.32;
}

.bracket-connector {
    fill: none;
    stroke: #8797ad;
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
    transition: opacity 160ms ease, stroke-width 160ms ease, stroke 160ms ease;
}

.bracket-connector--loser {
    stroke-dasharray: 7 6;
}

.bracket-connector.is-route-highlighted {
    stroke: var(--accent);
    stroke-width: 4;
}

.bracket-connector--loser.is-route-highlighted {
    stroke: var(--gold);
}

.bracket-connector.is-route-dimmed {
    opacity: 0.13;
}

.planner-controls {
    grid-template-columns: minmax(210px, 1fr) repeat(3, auto);
}

.favourite-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
}

.favourite-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid #b9e3d7;
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 0.82rem;
    font-weight: 800;
}

.favourite-chip button {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
    font-weight: 900;
}

.status-message {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid #f1caca;
    border-radius: 12px;
    color: #7a2626;
    background: #fff1f1;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 6px 0;
    color: var(--muted);
    font-size: 0.77rem;
}

footer p {
    margin: 0;
}

@media (max-width: 1000px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .matches-grid {
        grid-template-columns: 1fr;
    }

    .planner-controls {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .site-shell {
        width: min(100% - 18px, 1480px);
        margin-top: 9px;
    }

    .hero {
        padding: 24px 18px;
        border-radius: 21px;
    }

    .hero__badge {
        width: 62px;
        height: 62px;
        font-size: 0.9rem;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .summary-card {
        padding: 13px;
    }

    .summary-card strong {
        font-size: 1.3rem;
    }

    .panel {
        padding: 19px 14px;
        border-radius: 18px;
    }

    .section-heading {
        display: block;
    }

    .section-note,
    .updated {
        margin-top: 7px;
        text-align: left;
    }

    .bracket-legend__hint {
        width: 100%;
        margin-left: 0;
    }

    .filters,
    .planner-controls {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .next-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .next-card__team:last-child {
        text-align: center;
    }

    footer {
        display: block;
    }

    footer p + p {
        margin-top: 5px;
    }
}

@media print {
    body {
        background: #fff;
    }

    .hero,
    .tabs,
    .planner-controls,
    footer,
    #favouriteChips {
        display: none !important;
    }

    .site-shell {
        width: 100%;
        margin: 0;
    }

    .panel {
        display: none !important;
        border: 0;
        box-shadow: none;
    }

    #myPlannerPanel {
        display: block !important;
        padding: 0;
    }

    .match-card {
        break-inside: avoid;
    }
}
