* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 40px;

    font-family: Arial, Helvetica, sans-serif;

    background:
        radial-gradient(circle at top left, #24304a 0, transparent 35%),
        #151820;

    color: #ffffff;
}

/* Main page */

.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.main-header {
    margin-bottom: 40px;
}

.main-header h1 {
    margin: 0;
    font-size: 44px;
}

.main-header p {
    margin: 10px 0 0;
    color: #9ca6b5;
    font-size: 17px;
}

.event-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.event-card {
    position: relative;

    display: flex;
    align-items: flex-end;

    min-height: 170px;
    padding: 24px;

    overflow: hidden;

    background: linear-gradient(145deg, #272d38, #20252e);
    border: 1px solid #343c49;
    border-radius: 16px;

    color: #ffffff;
    text-decoration: none;

    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.event-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 5px;

    background: #6687ff;
}

.event-card::after {
    content: "Open event →";

    position: absolute;
    top: 22px;
    right: 22px;

    color: #8fa5ff;
    font-size: 14px;
}

.event-card:hover {
    transform: translateY(-5px);

    border-color: #6687ff;

    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.3);
}

.event-card-name {
    position: relative;
    z-index: 1;

    font-size: 25px;
    font-weight: 700;
}

/* Event page */

.page-header {
    max-width: 1200px;
    margin: 0 auto 45px;
}

.back-link {
    display: inline-block;
    margin-bottom: 25px;

    color: #aeb8c8;
    text-decoration: none;
    font-size: 15px;
}

.back-link:hover {
    color: #ffffff;
}

h1 {
    margin: 0;
    font-size: 42px;
}

.page-description {
    margin-top: 10px;
    color: #9ca6b5;
    font-size: 17px;
}

.categories {
    max-width: 1200px;
    margin: 0 auto;
}

.category-section {
    margin-bottom: 20px;
}

.category-section h2 {
    margin-bottom: 8px;

    color: #d7dce5;
    font-size: 21px;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.portal-button {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 85px;
    padding: 22px;

    background: #252a33;
    border: 1px solid #343b47;
    border-radius: 12px;

    color: #ffffff;
    text-decoration: none;

    transition:
        transform 0.2s,
        background 0.2s,
        border-color 0.2s;
}

.portal-button:hover {
    transform: translateY(-3px);

    background: #2d3440;
    border-color: #5578ff;
}

.button-name {
    font-size: 18px;
    font-weight: 600;
}

.button-arrow {
    color: #839cff;
    font-size: 22px;
}

@media (max-width: 600px) {
    body {
        padding: 24px;
    }

    .main-header h1,
    h1 {
        font-size: 32px;
    }

    .event-card {
        min-height: 140px;
    }
}

/* Placeholder buttons */

.portal-button.placeholder {
    background: #1b1f26;
    border-color: #3a3f47;
    color: #777;
}

.portal-button.placeholder .button-arrow {
    color: #666;
}

.portal-button.placeholder:hover {
    transform: none;
    background: #1b1f26;
    border-color: #3a3f47;
    cursor: default;
    box-shadow: none;
}


.event-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
}

.status-page-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    min-width: 210px;
    padding: 16px 20px;

    background: #252a33;
    border: 1px solid #3a4351;
    border-radius: 10px;

    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.status-page-button span {
    color: #839cff;
    font-size: 20px;
}

.status-page-button:hover {
    background: #2d3440;
    border-color: #6687ff;
    transform: translateY(-2px);
}



/* Per Game Status page */

.status-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.status-tabs-page .back-link {
    margin-bottom: 24px;
}

.status-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 24px;
}

.status-header h1 {
    margin: 0;
}

.status-summary {
    padding: 12px 18px;
    background: #252a33;
    border: 1px solid #343b47;
    border-radius: 8px;
    color: #aeb8c8;
    font-size: 14px;
    white-space: nowrap;
}

.status-summary #completed-count {
    color: #46d483;
    font-weight: 800;
}

.status-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    padding-bottom: 2px;
    overflow-x: auto;
}

.status-tab {
    flex: 0 0 auto;
    padding: 11px 16px;
    background: #1c2028;
    border: 1px solid #343b47;
    border-radius: 9px;
    color: #aeb8c8;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.status-tab:hover {
    background: #252b35;
    border-color: #526074;
    color: #ffffff;
}

.status-tab.is-active {
    background: #34405f;
    border-color: #6687ff;
    color: #ffffff;
    box-shadow: inset 0 -2px 0 #6687ff;
}

.status-tab-panel {
    display: none;
}

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

.status-panel-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
}

.status-panel-heading h2 {
    margin: 0 0 5px;
    font-size: 20px;
}

.status-panel-heading p {
    margin: 0;
    color: #8f99aa;
    font-size: 13px;
}

.category-progress {
    flex: 0 0 auto;
    padding: 9px 13px;
    background: #1d222b;
    border: 1px solid #343b47;
    border-radius: 8px;
    color: #9ca6b5;
    font-size: 13px;
    white-space: nowrap;
}

.category-progress strong {
    color: #46d483;
}

.status-table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: #1d2129;
    border: 1px solid #343b47;
    border-radius: 12px;
}

.status-table {
    width: 100%;
    min-width: 860px;
    table-layout: fixed;
    border-collapse: collapse;
}

.status-table th,
.status-table td {
    height: 58px;
    padding: 10px 14px;
    border-right: 1px solid #343b47;
    border-bottom: 1px solid #343b47;
}

.status-table th:last-child,
.status-table td:last-child {
    border-right: none;
}

.status-table tbody tr:last-child td {
    border-bottom: none;
}

.status-table th {
    background: #252a33;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

.status-table .game-column {
    width: 260px;
    text-align: left;
}

.status-table .status-column {
    min-width: 145px;
}

.game-name {
    background: #20242c;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    vertical-align: middle;
}

.status-cell {
    background: #1d2129;
    text-align: center;
    vertical-align: middle;
}

.status-table tbody tr:hover .game-name,
.status-table tbody tr:hover .status-cell {
    background: #252a33;
}

.status-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    cursor: pointer;
}

.status-checkbox input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.checkmark,
.summary-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: #171a20;
    border: 2px solid #49515f;
    border-radius: 7px;
    color: transparent;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.status-checkbox:hover .checkmark {
    border-color: #748094;
    transform: scale(1.05);
}

.status-checkbox input:checked + .checkmark,
.summary-check.is-complete {
    background: #238b57;
    border-color: #46d483;
    color: #ffffff;
}

.status-checkbox input:focus-visible + .checkmark {
    outline: 3px solid rgba(102, 135, 255, 0.45);
    outline-offset: 3px;
}

.summary-status-cell {
    position: relative;
}

.status-summary-table tr.is-fully-complete .game-name,
.status-summary-table tr.is-fully-complete .status-cell {
    background: rgba(35, 139, 87, 0.12);
}

@media (max-width: 800px) {
    .status-header,
    .status-panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .status-summary,
    .category-progress {
        align-self: flex-start;
    }

    .status-table .game-column {
        width: 210px;
    }
}


/* Main-page tools */

.portal-tools-section,
.events-section {
    margin-bottom: 42px;
}

.portal-tools-section h2,
.events-section h2 {
    margin: 0 0 14px;
    font-size: 21px;
}

.portal-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 18px;
}

.tool-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;

    min-height: 145px;
    padding: 24px;

    background:
        linear-gradient(
            135deg,
            rgba(87, 117, 255, 0.22),
            rgba(37, 42, 51, 0.95)
        );

    border: 1px solid #526dd8;
    border-radius: 15px;

    color: #ffffff;
    text-decoration: none;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: #839cff;
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.28);
}

.tool-card-label {
    color: #9eb0ff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tool-card h3 {
    margin: 10px 0 8px;
    font-size: 23px;
}

.tool-card p {
    max-width: 430px;
    margin: 0;
    color: #b8c0cf;
    line-height: 1.45;
}

.tool-card-arrow {
    color: #9eb0ff;
    font-size: 27px;
}


/* Bracket generator form */

.bracket-page {
    width: calc(100vw - 60px);
    max-width: none;
    margin: 0 auto;
}

.bracket-page-header {
    margin-bottom: 30px;
}

.bracket-form-card {
    max-width: 850px;
    padding: 26px;

    background: #1d2129;
    border: 1px solid #343b47;
    border-radius: 14px;
}

.bracket-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    color: #e5e8ee;
    font-size: 14px;
    font-weight: 700;
}

.form-field select,
.form-field textarea {
    width: 100%;
    padding: 13px 14px;

    background: #151820;
    border: 1px solid #3b4351;
    border-radius: 8px;

    color: #ffffff;
    font-family: inherit;
    font-size: 14px;

    outline: none;
}

.form-field select:focus,
.form-field textarea:focus {
    border-color: #6687ff;
}

.form-field textarea {
    resize: vertical;
    line-height: 1.5;
}

.team-list-field {
    grid-column: 1 / -1;
}

.field-help {
    color: #8f99aa;
    font-size: 12px;
    line-height: 1.4;
}

.generate-bracket-button {
    grid-column: 1 / -1;

    padding: 14px 20px;

    background: #5578ff;
    border: none;
    border-radius: 8px;

    color: #ffffff;
    font-size: 15px;
    font-weight: 700;

    cursor: pointer;
}

.generate-bracket-button:hover {
    background: #6988ff;
}

/* =========================================================
   BRACKET GENERATOR
   ========================================================= */

.generated-bracket-section {
    width: 100%;
    margin-top: 38px;
}

.generated-bracket-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.generated-bracket-header h2 {
    margin: 0 0 6px;
}

.generated-bracket-header p {
    margin: 0;
    color: #9ca6b5;
}

.bracket-scroll {
    width: 100%;
    padding: 24px;
    overflow: auto;
    background: #141820;
    border: 1px solid #343b47;
    border-radius: 14px;
}

.bracket-canvas,
.single-bracket-canvas,
.double-bracket-canvas {
    position: relative;
    width: max-content;
    min-width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

.double-bracket-canvas {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.bracket-area {
    position: relative;
    z-index: 2;
}

.bracket-section-heading {
    margin: 0 0 18px;
    color: #ffffff;
    font-size: 21px;
}

.lower-bracket-area {
    min-height: 0;
    padding-top: 24px;
    border-top: 1px solid #343b47;
}

.upper-bracket-area {
    min-height: 0;
}

.bracket-rounds {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: stretch;
    gap: 90px;
    width: max-content;
    min-width: 100%;
}

.bracket-rounds.bracket-position-grid {
    display: grid !important;
    grid-template-columns:
        repeat(var(--bracket-columns), 250px) !important;
    column-gap: 90px !important;
    row-gap: 0 !important;
    width: max-content !important;
    min-width: max-content !important;
    align-items: stretch !important;
    justify-content: start !important;
}

.bracket-round {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: 250px;
    min-width: 250px;
}

.bracket-rounds.bracket-position-grid > .bracket-round {
    grid-row: 1 !important;
    width: 250px !important;
    min-width: 250px !important;
    margin-left: 0 !important;
}

.bracket-round > h3 {
    width: 100%;
    min-height: 42px;
    margin: 0;
    color: #bfc7d4;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.round-matches {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    gap: 24px;
}

.upper-bracket-area .bracket-rounds,
.upper-bracket-area .bracket-position-grid {
    min-height: 500px;
}

.lower-bracket-area .bracket-rounds,
.lower-bracket-area .bracket-position-grid {
    min-height: 310px;
}

.bracket-match {
    position: relative;
    z-index: 2;
    width: 250px;
    min-height: 112px;
    overflow: hidden;
    background: #252b35;
    border: 1px solid #4a5362;
    border-radius: 7px;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.25);
}

.match-label {
    padding: 7px 10px;
    background: #343c48;
    border-bottom: 1px solid #4a5362;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.lower-match .match-label {
    background: #3b3544;
}

.grand-final-match {
    border-color: #6687ff;
    box-shadow:
        0 0 0 1px rgba(102, 135, 255, 0.2),
        0 9px 25px rgba(0, 0, 0, 0.3);
}

.grand-final-match .match-label {
    background: #4b61bb;
}

.bracket-team {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 8px 10px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
}

.bracket-team + .bracket-team {
    border-top: 1px solid #414957;
}

.bracket-team span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-score {
    flex: 0 0 auto;
    min-width: 24px;
    padding-left: 8px;
    border-left: 1px solid #4a5362;
    color: #b8c0ce;
    text-align: center;
}

.grand-final-round {
    margin-left: 140px;
}

.grand-final-round .round-matches {
    justify-content: center;
}

.bracket-rounds.bracket-position-grid > .grand-final-round {
    margin-left: 0 !important;
}

.bracket-lines {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1 !important;
    display: block !important;
    width: 100%;
    height: 100%;
    overflow: visible !important;
    pointer-events: none !important;
}

.bracket-connector {
    fill: none;
    stroke: #8d9bb2;
    stroke-width: 2.5;
    stroke-linecap: square;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.grand-final-connector {
    stroke: #7994ff;
    stroke-width: 2.5;
}

@media (max-width: 800px) {
    .bracket-rounds {
        gap: 55px;
    }

    .bracket-rounds.bracket-position-grid {
        grid-template-columns:
            repeat(var(--bracket-columns), 220px) !important;
        column-gap: 55px !important;
    }

    .bracket-round,
    .bracket-match,
    .bracket-rounds.bracket-position-grid > .bracket-round {
        width: 220px !important;
        min-width: 220px !important;
    }
}

/* Bracket CSV export */

.generated-bracket-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.export-csv-button {
    padding: 11px 18px;

    background: #252b35;
    border: 1px solid #6687ff;
    border-radius: 8px;

    color: #ffffff;
    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.export-csv-button:hover {
    transform: translateY(-2px);

    background: #34405f;
    border-color: #8da2ff;
}

@media (max-width: 700px) {
    .generated-bracket-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =========================================================
   CLUB STANDINGS
   ========================================================= */

.standings-page {
    max-width: 980px;
}

.standings-header {
    margin-bottom: 30px;
}

.standings-title-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.page-label {
    display: block;
    margin-bottom: 8px;
    color: #89a5ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.standings-title-row h1 {
    margin: 0 0 8px;
    font-size: 42px;
}

.standings-title-row p {
    margin: 0;
    color: #aeb8ca;
}

.standings-summary {
    min-width: 120px;
    padding: 16px 18px;
    background: #202632;
    border: 1px solid #394455;
    border-radius: 10px;
    text-align: center;
}

.standings-summary span {
    display: block;
    color: #ffffff;
    font-size: 26px;
    font-weight: 800;
}

.standings-summary small {
    color: #9ba7ba;
    font-size: 12px;
}

.standings-card {
    overflow: hidden;
    background: #1b2029;
    border: 1px solid #384150;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.standings-table-header,
.standings-row {
    display: grid;
    grid-template-columns:
        80px
        minmax(180px, 1fr)
        120px
        190px;
    align-items: center;
}

.standings-table-header {
    padding: 14px 20px;
    background: #242b36;
    border-bottom: 1px solid #3b4554;
    color: #9eabc0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.standings-row {
    min-height: 58px;
    padding: 0 20px;
    border-bottom: 1px solid #303846;
    transition: background-color 0.15s ease;
}

.standings-table-header > *,
.standings-row > * {
    padding: 0 16px;
}

.standings-table-header > *:not(:last-child),
.standings-row > *:not(:last-child) {
    border-right: 1px solid #343d4b;
}

.standings-table-header span:nth-child(3),
.standings-table-header span:nth-child(4),
.standing-points,
.standing-participations {
    text-align: right;
}

.standings-row:last-child {
    border-bottom: 0;
}

.standings-row:hover {
    background: #252c37;
}

.standings-row.top-three {
    background:
        linear-gradient(
            90deg,
            rgba(79, 115, 255, 0.12),
            rgba(79, 115, 255, 0.02)
        );
}

.standing-rank {
    color: #aeb8ca;
    font-weight: 700;
}

.rank-medal {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    background: #2d3850;
    border: 1px solid #6079c9;
    border-radius: 50%;
    color: #ffffff;
}

.standings-row:nth-child(1) .rank-medal {
    background: #5d4a1e;
    border-color: #c9a645;
}

.standings-row:nth-child(2) .rank-medal {
    background: #454b55;
    border-color: #929aa6;
}

.standings-row:nth-child(3) .rank-medal {
    background: #5b3d2c;
    border-color: #ad7555;
}

.standing-club {
    overflow: hidden;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.standing-points {
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
}

.standing-participations {
    color: #c3cad5;
    font-size: 15px;
    font-weight: 700;
}

.inactive-club {
    background: #191d24;
}

.inactive-club .standing-club,
.inactive-club .standing-rank,
.inactive-club .standing-points,
.inactive-club .standing-participations {
    color: #7b8594;
}

.standings-empty {
    padding: 40px;
    color: #aeb8ca;
    text-align: center;
}

@media (max-width: 700px) {
    .standings-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .standings-summary {
        width: 100%;
    }

    .standings-title-row h1 {
        font-size: 34px;
    }

    .standings-table-header,
    .standings-row {
        grid-template-columns:
            50px
            minmax(0, 1fr)
            70px
            110px;
        padding-right: 14px;
        padding-left: 14px;
    }

    .standing-club,
    .standing-points,
    .standing-participations {
        font-size: 14px;
    }
}

/* ---------------------------------------------------------
   Draw simulator
--------------------------------------------------------- */

.draw-simulator-page {
    width: min(1500px, 100%);
    margin: 0 auto;
}

.draw-page-header {
    margin-bottom: 30px;
}

.draw-page-header h1 {
    margin: 0 0 8px;
}

.draw-page-header p,
.draw-section-heading p {
    margin: 0;
    color: #9ca6b5;
}

.draw-setup-card,
.draw-pools-panel,
.draw-bracket-panel {
    background: #1d2129;
    border: 1px solid #343b47;
    border-radius: 14px;
}

.draw-setup-card {
    max-width: 1050px;
    padding: 26px;
}

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

.draw-section-heading h2 {
    margin: 0 0 6px;
    font-size: 21px;
}

.draw-setup-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 18px;
}

.draw-setup-grid .form-field input,
.draw-control-field select,
.seed-team-row input {
    width: 100%;
    padding: 12px 13px;
    background: #151820;
    border: 1px solid #3b4351;
    border-radius: 8px;
    color: #ffffff;
    font: inherit;
    outline: none;
}

.draw-setup-grid .form-field input:focus,
.draw-control-field select:focus,
.seed-team-row input:focus {
    border-color: #6687ff;
}

.draw-restriction-option {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 11px;
    color: #dfe5ee;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.draw-restriction-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.draw-checkbox-visual {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #171a20;
    border: 2px solid #49515f;
    border-radius: 6px;
    color: transparent;
}

.draw-restriction-option input:checked + .draw-checkbox-visual {
    background: #238b57;
    border-color: #46d483;
    color: #ffffff;
}

.draw-build-button {
    grid-column: 1 / -1;
}

.draw-workspace {
    margin-top: 30px;
}

.draw-workspace-grid {
    display: grid;
    grid-template-columns: minmax(430px, 0.9fr) minmax(500px, 1.1fr);
    gap: 24px;
    align-items: start;
}

.draw-pools-panel,
.draw-bracket-panel {
    padding: 24px;
}

.seed-pools {
    display: grid;
    gap: 16px;
}

.seed-pool-card {
    overflow: hidden;
    background: #191d24;
    border: 1px solid #343b47;
    border-radius: 10px;
}

.seed-pool-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 14px;
    background: #252b35;
    border-bottom: 1px solid #343b47;
}

.seed-badge {
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
}

.seed-remaining {
    color: #98a5b8;
    font-size: 12px;
    font-weight: 700;
}

.seed-team-list {
    display: grid;
}

.seed-team-row {
    display: grid;
    grid-template-columns: 100px minmax(160px, 1fr) 75px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #303846;
}

.seed-team-row:last-child {
    border-bottom: 0;
}

.seed-team-row.is-drawn {
    background: rgba(70, 212, 131, 0.06);
}

.seed-team-code {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.seed-team-code span {
    color: #ffffff;
    font-weight: 800;
}

.seed-team-code small,
.seed-team-state {
    color: #8f99aa;
    font-size: 11px;
}

.seed-team-row.is-drawn .seed-team-state {
    color: #46d483;
}

.draw-bracket-heading {
    align-items: flex-start;
}

.draw-controls-card {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px;
    background: #191d24;
    border: 1px solid #343b47;
    border-radius: 10px;
}

.draw-control-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.draw-control-field label {
    color: #dfe5ee;
    font-size: 13px;
    font-weight: 700;
}

.draw-primary-button,
.draw-secondary-button {
    min-height: 43px;
    padding: 10px 15px;
    border-radius: 8px;
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.draw-primary-button {
    background: #5578ff;
    border: 1px solid #6687ff;
}

.draw-primary-button:hover {
    background: #6988ff;
}

.draw-secondary-button {
    background: #252b35;
    border: 1px solid #455061;
}

.draw-secondary-button:hover:not(:disabled) {
    border-color: #6687ff;
}

.draw-primary-button:disabled,
.draw-secondary-button:disabled {
    opacity: 0.45;
    cursor: default;
}

.draw-group-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 12px;
}

.draw-group-legend-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 29px;
    padding: 9px 18px;
    background: hsl(var(--group-hue) 42% 22%);
    border: 1px solid hsl(var(--group-hue) 78% 60%);
    border-radius: 9px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.draw-message {
    margin-bottom: 18px;
    padding: 11px 13px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.draw-message-success {
    background: rgba(70, 212, 131, 0.08);
    border: 1px solid rgba(70, 212, 131, 0.35);
    color: #9ce5bd;
}

.draw-message-error {
    background: rgba(255, 105, 105, 0.08);
    border: 1px solid rgba(255, 105, 105, 0.35);
    color: #ffaaaa;
}

.draw-first-round {
    display: grid;
    gap: 14px;
}

.draw-match-card {
    overflow: hidden;
    background: #252b35;
    border: 1px solid #4a5362;
    border-radius: 8px;
}

.draw-match-header {
    padding: 8px 12px;
    background: #343c48;
    border-bottom: 1px solid #4a5362;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.draw-bracket-slot {
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 9px 12px;
}

.draw-bracket-slot + .draw-bracket-slot {
    border-top: 1px solid #414957;
}

/* Draw simulator: color first-round teams by their source group. */
.draw-bracket-slot.has-group-color {
    background: hsl(var(--group-hue) 42% 22%);
    border-left: 4px solid hsl(var(--group-hue) 78% 60%);
}

.draw-bracket-slot.has-group-color small {
    color: hsl(var(--group-hue) 45% 76%);
}

.draw-bracket-slot strong,
.draw-bracket-slot small {
    display: block;
}

.draw-bracket-slot strong {
    color: #ffffff;
    font-size: 13px;
}

.draw-bracket-slot small {
    margin-top: 3px;
    color: #8f99aa;
    font-size: 11px;
}

.draw-bracket-slot.is-empty strong,
.draw-bracket-slot.is-empty small {
    color: #667183;
}

@media (max-width: 1050px) {
    .draw-workspace-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .draw-setup-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .draw-controls-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

@media (max-width: 560px) {
    .draw-setup-grid {
        grid-template-columns: 1fr;
    }

    .seed-team-row {
        grid-template-columns: 75px minmax(120px, 1fr);
    }

    .seed-team-state {
        grid-column: 2;
    }
}

/* Draw simulator: latest draw highlight */
.draw-bracket-slot.is-latest-placement {
    position: relative;
    box-shadow: inset 0 0 0 2px #ffffff;
    animation: draw-placement-flash 0.7s ease-out;
}

.draw-placement-tag {
    margin-left: auto;
    padding: 4px 7px;
    background: rgba(102, 135, 255, 0.18);
    border: 1px solid rgba(131, 156, 255, 0.55);
    border-radius: 5px;
    color: #aebeff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.draw-message-success {
    font-size: 14px;
    font-weight: 800;
}

@keyframes draw-placement-flash {
    0% {
        background: rgba(102, 135, 255, 0.42);
    }
    100% {
        background: rgba(102, 135, 255, 0.16);
    }
}


/* =========================================================
   DRAW SIMULATOR V4 — compact two-column workspace
   Options / draw controls on top, pools / matches below
   ========================================================= */

.draw-top-grid,
.draw-workspace-grid {
    display: grid;
    grid-template-columns: minmax(390px, 0.86fr) minmax(620px, 1.14fr);
    gap: 18px;
    align-items: start;
}

.draw-top-grid {
    margin-bottom: 18px;
}

.draw-setup-card,
.draw-actions-panel,
.draw-pools-panel,
.draw-bracket-panel {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.draw-setup-card,
.draw-actions-panel {
    padding: 18px;
    background: #1d2129;
    border: 1px solid #343b47;
    border-radius: 14px;
}

.draw-workspace {
    margin-top: 0;
}

.draw-pools-panel,
.draw-bracket-panel {
    padding: 16px;
}

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

.draw-section-heading h2 {
    margin-bottom: 3px;
    font-size: 18px;
}

.draw-section-heading p {
    font-size: 12px;
}

.draw-compact-heading {
    margin-bottom: 10px;
}

.draw-setup-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 11px 12px;
}

.draw-setup-grid .form-field input,
.draw-setup-grid .form-field select,
.draw-control-field select,
.seed-team-row input {
    padding: 8px 10px;
    min-height: 36px;
}

.draw-restriction-option,
.draw-build-button {
    grid-column: 1 / -1;
}

.draw-restriction-option {
    gap: 8px;
    font-size: 12px;
}

.draw-checkbox-visual {
    width: 23px;
    height: 23px;
}

.draw-build-button {
    padding: 10px 14px;
}

.draw-actions-heading {
    align-items: center;
}

.draw-controls-card {
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 8px;
    margin-bottom: 9px;
    padding: 10px;
}

.draw-control-field {
    gap: 4px;
}

.draw-control-field label {
    font-size: 11px;
}

.draw-primary-button,
.draw-secondary-button {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 11px;
}

.draw-result-message,
.draw-message {
    margin-bottom: 0;
    padding: 8px 10px;
    font-size: 12px;
}

.seed-pools {
    gap: 10px;
}

.seed-pool-title {
    padding: 8px 10px;
}

.seed-team-row {
    grid-template-columns: 72px minmax(130px, 1fr) 58px;
    gap: 8px;
    padding: 6px 8px;
}

.seed-team-code span {
    font-size: 13px;
}

.seed-team-code small,
.seed-team-state,
.seed-remaining {
    font-size: 9px;
}

/* Two match cards per row on desktop. 16 matches = only 8 compact rows. */
.draw-first-round {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.draw-match-header {
    padding: 5px 8px;
    font-size: 10px;
}

.draw-bracket-slot {
    min-height: 37px;
    padding: 5px 8px;
}

.draw-bracket-slot strong {
    font-size: 11px;
}

.draw-bracket-slot small {
    margin-top: 1px;
    font-size: 9px;
}

.draw-placement-tag {
    padding: 3px 5px;
    font-size: 7px;
}

@media (min-width: 1250px) {
    .draw-actions-panel {
        position: sticky;
        top: 12px;
        z-index: 5;
    }
}

@media (max-width: 1120px) {
    .draw-top-grid,
    .draw-workspace-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 700px) {
    .draw-first-round {
        grid-template-columns: 1fr;
    }

    .draw-controls-card,
    .draw-setup-grid {
        grid-template-columns: 1fr;
    }

    .draw-restriction-option,
    .draw-build-button {
        grid-column: 1;
    }
}

/* =========================================================
   DRAW SIMULATOR V5 — fixed two-column flow
   Left: options + seed pools
   Right: draw controls + single-column first round
   ========================================================= */

.draw-main-grid {
    display: grid;
    grid-template-columns: minmax(390px, 0.84fr) minmax(620px, 1.16fr);
    gap: 18px;
    align-items: start;
}

.draw-left-column,
.draw-right-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.draw-main-grid .draw-setup-card,
.draw-main-grid .draw-actions-panel,
.draw-main-grid .draw-pools-panel,
.draw-main-grid .draw-bracket-panel {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* First round starts immediately below the draw notification. */
.draw-main-grid .draw-bracket-panel {
    padding: 14px 16px 16px;
}

.draw-main-grid .draw-actions-panel {
    padding-bottom: 12px;
}

/* Always one match per row. */
.draw-main-grid .draw-first-round {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 6px;
}

/* Compact match cards so many are visible without excessive scrolling. */
.draw-main-grid .draw-match-header {
    padding: 4px 8px;
    font-size: 10px;
}

.draw-main-grid .draw-bracket-slot {
    min-height: 31px;
    padding: 4px 8px;
}

.draw-main-grid .draw-bracket-slot strong {
    font-size: 11px;
    line-height: 1.1;
}

.draw-main-grid .draw-bracket-slot small {
    margin-top: 0;
    font-size: 8px;
    line-height: 1.1;
}

.draw-main-grid .draw-compact-heading {
    margin-bottom: 7px;
}

.draw-main-grid .draw-bracket-panel .draw-section-heading h2 {
    font-size: 17px;
}

.draw-main-grid .draw-bracket-panel .draw-section-heading p {
    font-size: 11px;
}

@media (max-width: 1120px) {
    .draw-main-grid {
        grid-template-columns: 1fr;
    }

    .draw-main-grid .draw-first-round {
        grid-template-columns: 1fr !important;
    }
}


/* Draw Simulator v6: random draw controls */
.draw-controls-card {
    grid-template-columns: 1fr;
}

.draw-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.draw-button-row .draw-primary-button,
.draw-button-row .draw-secondary-button {
    flex: 1 1 135px;
}

.draw-random-button {
    background: #4468e8;
}

.draw-random-button:hover {
    background: #5276f4;
}

.draw-complete-title {
    margin-bottom: 6px;
    font-weight: 800;
}

.draw-complete-summary {
    display: grid;
    gap: 3px;
}

.draw-complete-match {
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.draw-complete-match strong {
    min-width: 64px;
}

@media (max-width: 700px) {
    .draw-button-row {
        flex-direction: column;
    }

    .draw-button-row .draw-primary-button,
    .draw-button-row .draw-secondary-button {
        flex-basis: auto;
        width: 100%;
    }
}

/* =========================================================
   Schedule Adjust ENC
========================================================= */

.enc-schedule-page {
    width: min(1540px, calc(100vw - 64px));
    margin: 0 auto;
}

.enc-schedule-header {
    margin-bottom: 24px;
}

.enc-title-row,
.enc-game-heading,
.enc-section-heading-row,
.enc-priority-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.enc-title-row h1 {
    margin: 0 0 8px;
}

.enc-title-row p,
.enc-section-heading-row p,
.enc-subcard-heading p,
.enc-priority-heading span,
.enc-method-note p {
    margin: 0;
    color: #9ca6b5;
    line-height: 1.45;
}

.enc-source-badge {
    min-width: 205px;
    padding: 14px 16px;
    background: #202632;
    border: 1px solid #394455;
    border-radius: 10px;
}

.enc-source-badge span,
.enc-overview-label,
.enc-swap-current span,
.enc-swap-suggested span,
.enc-game-kicker {
    display: block;
    margin-bottom: 4px;
    color: #8f99aa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.enc-source-badge strong {
    display: block;
    overflow: hidden;
    color: #ffffff;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enc-control-card,
.enc-country-card,
.enc-game-card,
.enc-empty-state,
.enc-method-note {
    padding: 22px;
    background: #1d2129;
    border: 1px solid #343b47;
    border-radius: 14px;
}

.enc-control-card {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    margin-bottom: 18px;
}

.enc-date-control,
.enc-priority-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.enc-date-control label,
.enc-priority-section label,
.enc-priority-field label {
    color: #e5e8ee;
    font-size: 13px;
    font-weight: 700;
}

.enc-date-control select,
.enc-priority-field select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    background: #151820;
    border: 1px solid #3b4351;
    border-radius: 8px;
    color: #ffffff;
}

.enc-priority-heading {
    align-items: center;
    margin-bottom: 14px;
}

.enc-priority-heading span {
    margin-top: 4px;
    font-size: 12px;
}

.enc-priority-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 10px;
}

.enc-optimize-button {
    flex: 0 0 auto;
    padding: 11px 16px;
    background: #5578ff;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.enc-optimize-button:hover {
    background: #6988ff;
}

.enc-day-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.enc-day-overview > div {
    padding: 14px 16px;
    background: #202632;
    border: 1px solid #394455;
    border-radius: 10px;
}

.enc-day-overview strong {
    color: #ffffff;
    font-size: 18px;
}

.enc-country-card {
    margin-bottom: 18px;
}

.enc-section-heading-row h2,
.enc-game-heading h2,
.enc-subcard-heading h3 {
    margin: 0;
}

.enc-section-heading-row p,
.enc-subcard-heading p {
    margin-top: 5px;
    font-size: 13px;
}

.enc-country-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 16px;
}

.enc-country-list span,
.enc-country-chip {
    padding: 6px 9px;
    background: #252b35;
    border: 1px solid #3a4351;
    border-radius: 7px;
    color: #dbe0e8;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.enc-country-chip:hover {
    background: #2d3542;
    border-color: #4a5567;
}

.enc-country-chip.active {
    background: rgba(85, 120, 255, 0.16);
    border-color: #5578ff;
    color: #ffffff;
}

.enc-day-schedule-card {
    margin-bottom: 18px;
    padding: 22px;
    background: #1d2129;
    border: 1px solid #343b47;
    border-radius: 14px;
}

.enc-day-timeline-wrapper {
    margin-top: 16px;
    overflow-x: auto;
    background: #181c23;
    border: 1px solid #303845;
    border-radius: 11px;
}

.enc-day-timeline {
    display: grid;
    min-width: 640px;
}

.enc-day-timeline-corner,
.enc-day-timeline-header {
    padding: 10px 12px;
    background: #252b35;
    border-bottom: 1px solid #303845;
    border-right: 1px solid #303845;
    color: #aeb8c8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.enc-day-timeline-header:last-child {
    border-right: 0;
}

.enc-day-timeline-ruler {
    position: relative;
    border-right: 1px solid #303845;
}

.enc-day-timeline-mark {
    box-sizing: border-box;
    padding: 4px 10px 0 0;
    border-bottom: 1px solid #262c36;
    color: #9eb0ff;
    font-size: 11px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.enc-day-timeline-column {
    position: relative;
    border-right: 1px solid #262c36;
    background-image: linear-gradient(to bottom, #262c36 1px, transparent 1px);
    background-repeat: repeat-y;
    background-position: top left;
}

.enc-day-timeline-column.game-start {
    border-left: 2px solid #3b4351;
}

.enc-day-timeline-column:last-child {
    border-right: 0;
}

.enc-day-timeline-block {
    position: absolute;
    left: 4px;
    right: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 5px 8px;
    background: #20252e;
    border: 1px solid #303845;
    border-radius: 7px;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.enc-day-timeline-block.highlighted {
    background: rgba(85, 120, 255, 0.18);
    border-color: #5578ff;
    box-shadow: 0 0 0 1px rgba(85, 120, 255, 0.35);
    z-index: 1;
}

.enc-day-timeline-time {
    color: #7c8698;
    font-size: 10px;
    font-weight: 700;
}

.enc-day-timeline-block.highlighted .enc-day-timeline-time {
    color: #c3cdff;
}

.enc-day-timeline-group {
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.enc-day-timeline-block.highlighted .enc-day-timeline-group {
    color: #cdd8ff;
}

.enc-day-timeline-match {
    overflow: hidden;
    color: #9aa4b5;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enc-day-timeline-block.highlighted .enc-day-timeline-match {
    color: #dbe2ff;
}

.enc-game-card {
    margin-bottom: 22px;
}

.enc-game-heading {
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid #343b47;
}

.enc-game-kicker {
    color: #89a5ff;
}

.enc-region-total,
.enc-group-regions,
.enc-swap-regions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.region-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid #475264;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.region-pill.small {
    min-height: 23px;
    padding: 3px 7px;
    font-size: 10px;
}

.region-pill.americas {
    background: rgba(94, 132, 255, 0.11);
    border-color: #5068b8;
    color: #a9baff;
}

.region-pill.emea {
    background: rgba(83, 207, 142, 0.09);
    border-color: #3f765c;
    color: #91dfb6;
}

.region-pill.asia {
    background: rgba(214, 164, 76, 0.10);
    border-color: #7d6335;
    color: #e2c37e;
}

.enc-game-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 18px;
}

.enc-subcard,
.enc-suggested-schedule {
    overflow: hidden;
    background: #181c23;
    border: 1px solid #303845;
    border-radius: 11px;
}

.enc-subcard-heading {
    padding: 15px 16px;
    background: #20252e;
    border-bottom: 1px solid #303845;
}

.enc-group-row {
    display: grid;
    grid-template-columns: 105px 190px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 12px;
    border-bottom: 1px solid #2c333f;
}

.enc-group-row:last-child,
.enc-swap-row:last-child {
    border-bottom: 0;
}

.enc-group-name {
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}

.enc-group-name small {
    display: block;
    margin-top: 3px;
    color: #8490a2;
    font-size: 10px;
    font-weight: 600;
}

.enc-group-countries {
    color: #aeb8c8;
    font-size: 11px;
    line-height: 1.35;
}

.enc-swap-row {
    display: grid;
    grid-template-columns: 118px minmax(75px, 1fr) 24px minmax(75px, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 56px;
    padding: 8px 12px;
    border-bottom: 1px solid #2c333f;
}

.enc-swap-row.changed {
    background: rgba(85, 120, 255, 0.08);
}

.enc-swap-time {
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
}

.enc-swap-current,
.enc-swap-suggested {
    color: #d8dee8;
    font-size: 13px;
    font-weight: 800;
}

.enc-swap-suggested {
    color: #a9baff;
}

.enc-swap-arrow {
    color: #77849a;
    text-align: center;
}

.enc-suggested-schedule {
    margin-top: 16px;
}

.enc-schedule-table-wrapper {
    overflow-x: auto;
}

.enc-schedule-table {
    width: 100%;
    border-collapse: collapse;
}

.enc-schedule-table th,
.enc-schedule-table td {
    padding: 10px 14px;
    border-right: 1px solid #303845;
    border-bottom: 1px solid #303845;
    text-align: left;
}

.enc-schedule-table th:last-child,
.enc-schedule-table td:last-child {
    border-right: 0;
}

.enc-schedule-table tbody tr:last-child td {
    border-bottom: 0;
}

.enc-schedule-table th {
    background: #252b35;
    color: #aeb8c8;
    font-size: 11px;
    text-transform: uppercase;
}

.enc-schedule-table td {
    color: #ffffff;
    font-size: 13px;
}

.enc-schedule-table td:first-child {
    width: 100px;
    color: #9eb0ff;
    font-weight: 800;
}

.enc-empty-state,
.enc-method-note {
    margin-top: 18px;
}

.enc-empty-state h2 {
    margin-top: 0;
}

.enc-method-note strong {
    display: block;
    margin-bottom: 6px;
    color: #ffffff;
}

.enc-method-note p {
    font-size: 12px;
}

@media (max-width: 1100px) {
    .enc-control-card,
    .enc-game-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 760px) {
    .enc-schedule-page {
        width: min(100%, calc(100vw - 32px));
    }

    .enc-title-row,
    .enc-game-heading,
    .enc-priority-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .enc-source-badge {
        width: 100%;
    }

    .enc-day-overview,
    .enc-priority-grid {
        grid-template-columns: 1fr;
    }

    .enc-group-row,
    .enc-swap-row {
        grid-template-columns: 1fr;
    }

    .enc-swap-arrow {
        display: none;
    }
}

/* ---------------------------------------------------------
   Schedule Adjust ENC - cross-game priorities / timeline
--------------------------------------------------------- */

.enc-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.enc-export-button {
    padding: 11px 16px;
    background: #202631;
    border: 1px solid #59677c;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.enc-export-button:hover {
    background: #2a3240;
    border-color: #839cff;
}

.enc-priority-grid-with-games {
    grid-template-columns: repeat(5, minmax(180px, 1fr));
}

.enc-priority-pair {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.enc-priority-item label,
.enc-game-priority-item label,
.enc-country-selector label {
    display: block;
    margin-bottom: 6px;
    color: #dfe5ef;
    font-size: 11px;
    font-weight: 800;
}

.enc-priority-item select,
.enc-game-priority-item select,
.enc-country-selector select {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    background: #151820;
    border: 1px solid #3b4351;
    border-radius: 7px;
    color: #ffffff;
    font-size: 12px;
}

.enc-group-list,
.enc-swap-list {
    display: flex;
    flex-direction: column;
}

.enc-country-selector {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
    align-items: end;
    gap: 20px;
    padding-top: 18px;
    border-top: 1px solid #343b47;
}

.enc-country-selector span {
    color: #8f99aa;
    font-size: 11px;
    line-height: 1.4;
}

.enc-day-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.enc-conflict-number {
    color: #ff9e9e !important;
}

.enc-ok-number {
    color: #46d483 !important;
}

.enc-country-timeline-card {
    margin-top: 18px;
    padding: 20px;
    background: #1d2129;
    border: 1px solid #343b47;
    border-radius: 12px;
}

.enc-country-timeline-card h2 {
    margin: 4px 0 4px;
    font-size: 24px;
}

.enc-country-timeline-card p {
    margin: 0;
    color: #909bab;
    font-size: 12px;
}

.enc-timeline {
    margin-top: 18px;
}

.enc-timeline-item {
    display: grid;
    grid-template-columns: 105px 18px minmax(0, 1fr);
    gap: 12px;
    min-height: 64px;
}

.enc-timeline-time {
    padding-top: 5px;
    text-align: right;
}

.enc-timeline-time strong {
    display: block;
    color: #ffffff;
    font-size: 16px;
}

.enc-timeline-time span {
    display: block;
    margin-top: 3px;
    color: #8290a4;
    font-size: 10px;
}

.enc-timeline-marker {
    position: relative;
}

.enc-timeline-marker::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 8px;
    width: 1px;
    background: #3c4656;
}

.enc-timeline-marker::after {
    content: "";
    position: absolute;
    top: 8px;
    left: 4px;
    width: 9px;
    height: 9px;
    background: #6687ff;
    border: 2px solid #1d2129;
    border-radius: 50%;
}

.enc-timeline-item:last-child .enc-timeline-marker::before {
    bottom: 48px;
}

.enc-timeline-content {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #181c23;
    border: 1px solid #303845;
    border-radius: 8px;
}

.enc-timeline-content strong,
.enc-timeline-content span,
.enc-timeline-content em {
    display: block;
}

.enc-timeline-content strong {
    color: #ffffff;
    font-size: 13px;
}

.enc-timeline-content span {
    margin-top: 3px;
    color: #aeb8c8;
    font-size: 11px;
}

.enc-timeline-content em {
    margin-top: 5px;
    color: #ff9e9e;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
}

.enc-timeline-item.conflict .enc-timeline-marker::after {
    background: #d85d5d;
}

.enc-timeline-item.conflict .enc-timeline-content {
    border-color: #7b4848;
    background: rgba(122, 48, 48, 0.12);
}

.enc-timeline-empty {
    margin-top: 15px;
    padding: 18px;
    background: #181c23;
    border: 1px solid #303845;
    border-radius: 8px;
    color: #8f99aa;
    font-size: 12px;
}

@media (max-width: 1250px) {
    .enc-priority-grid-with-games {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }
}

@media (max-width: 900px) {
    .enc-priority-grid-with-games,
    .enc-day-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .enc-country-selector {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

@media (max-width: 600px) {
    .enc-priority-grid-with-games,
    .enc-day-overview {
        grid-template-columns: 1fr;
    }

    .enc-action-buttons {
        width: 100%;
    }

    .enc-optimize-button,
    .enc-export-button {
        flex: 1 1 100%;
    }

    .enc-timeline-item {
        grid-template-columns: 75px 16px minmax(0, 1fr);
        gap: 8px;
    }
}


/* Draw simulator: visually de-emphasize teams already placed in the bracket. */
.seed-team-row.is-drawn {
    background: rgba(120, 128, 142, 0.10);
    opacity: 0.48;
}

.seed-team-row.is-drawn .seed-team-code span,
.seed-team-row.is-drawn .seed-team-code small,
.seed-team-row.is-drawn .seed-team-state {
    color: #7d8592;
}

.seed-team-row.is-drawn input {
    background: #181b21;
    border-color: #303640;
    color: #777f8b;
}

.seed-team-row.is-drawn .seed-team-state {
    color: #7d8592;
}


/* =========================================================
   DRAW SIMULATOR — seed-pool group tint + larger bracket names
   ========================================================= */

/* Use the same dynamic group hue as the bracket/legend for every group A-Z. */
.seed-team-row.has-group-color:not(.is-drawn) .seed-team-code span {
    color: hsl(var(--group-hue) 82% 62%);
}

.seed-team-row.has-group-color:not(.is-drawn) input {
    background: hsl(var(--group-hue) 42% 16% / 0.72);
    border-color: hsl(var(--group-hue) 68% 48% / 0.75);
}

.seed-team-row.has-group-color:not(.is-drawn) input:focus {
    border-color: hsl(var(--group-hue) 82% 62%);
    box-shadow: 0 0 0 2px hsl(var(--group-hue) 82% 62% / 0.14);
}

/* Available should stand out; drawn remains greyed out. */
.seed-team-row:not(.is-drawn) .seed-team-state {
    color: #46d483;
    font-weight: 800;
}

.seed-team-row.is-drawn .seed-team-state {
    color: #7d8592;
    font-weight: 400;
}

/* Bracket team name + seed share the first line. */
.draw-bracket-slot .draw-team-details {
    min-width: 0;
    flex: 1 1 auto;
}

.draw-bracket-slot .draw-team-mainline {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.draw-bracket-slot .draw-team-mainline strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draw-bracket-slot .draw-team-seed {
    display: inline-block;
    flex: 0 0 auto;
    margin: 0;
    color: hsl(var(--group-hue) 45% 76%);
    font-weight: 600;
    white-space: nowrap;
}

.draw-bracket-slot .draw-team-meta {
    display: block;
    margin-top: 1px;
}

/* Override the earlier compact bracket sizing. */
.draw-main-grid .draw-bracket-slot {
    min-height: 38px;
    padding: 5px 8px;
}

.draw-main-grid .draw-bracket-slot .draw-team-mainline strong {
    font-size: 15px;
    line-height: 1.08;
}

.draw-main-grid .draw-bracket-slot .draw-team-seed {
    font-size: 9px;
    line-height: 1.1;
}

.draw-main-grid .draw-bracket-slot .draw-team-meta {
    font-size: 8px;
    line-height: 1.1;
}

/* Empty slots keep the compact original appearance. */
.draw-main-grid .draw-bracket-slot.is-empty strong {
    font-size: 11px;
}

.draw-main-grid .draw-bracket-slot.is-empty small {
    font-size: 8px;
}


/* =========================================================
   DRAW SIMULATOR — group legend beside Seed pools heading
   ========================================================= */

.draw-seed-pools-heading {
    align-items: center;
}

.draw-seed-pools-legend {
    justify-content: flex-end;
    margin: 0;
    max-width: 72%;
}

.draw-seed-pools-legend .draw-group-legend-item {
    min-height: 27px;
    padding: 5px 9px;
    font-size: 11px;
}

@media (max-width: 900px) {
    .draw-seed-pools-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .draw-seed-pools-legend {
        justify-content: flex-start;
        max-width: 100%;
    }
}




/* Group legend — larger, but always one row */
.draw-pools-panel .draw-group-legend {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
}

.draw-pools-panel .draw-group-legend-item {
    flex: 1 1 0;
    min-width: 0;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 800;
    border-width: 2px;
    border-radius: 7px;
}








