:root {
    --mtt-navy: #082f49;
    --mtt-green: #328e32;
    --mtt-blue: #006abe;
}

body { background: #f5f7fa; color: var(--mtt-navy); }
.container { max-width: 1120px; }
.site-header { border-top: 4px solid var(--mtt-green); }
.brand-link { display: inline-block; flex-shrink: 0; }
.brand-logo { display: block; width: 190px; max-width: 46vw; height: auto; }
.brand-tagline { color: var(--mtt-navy); }
.welcome-panel { background: #eaf2f7; border-left: 5px solid var(--mtt-blue); }
.welcome-intro { max-width: 38rem; }
.section-label { color: #275e2d; font-size: .8rem; font-weight: 700; letter-spacing: .14em; }
.play-note { border-left: 3px solid var(--mtt-green); }
a { color: #005a9f; }
a:focus-visible { outline: 3px solid var(--mtt-blue); outline-offset: 4px; }
.skip-link:focus { display: block; padding: .75rem; background: white; }

/* Signed-in pages use the available width, with navigation beside the workspace on desktop. */
.signed-in-layout { min-height: 100dvh !important; }
.signed-in-layout .brand-logo { width: 120px; max-width: 30vw; }
.signed-in-layout .site-header > div { padding-inline: clamp(1rem, 2vw, 2rem); }
.app-workspace { display: flex; flex-direction: column; min-width: 0; }
.app-content { flex: 1; min-width: 0; }
.app-main { padding: clamp(1.25rem, 3vw, 3rem); overflow-wrap: anywhere; }
.tournament-layout .app-content { background: #edf7f0; }
.tournament-layout .app-sidebar { background: #f5fbf6 !important; border-color: #b9d8c0 !important; }
.tournament-layout .app-main { border-top: 4px solid var(--mtt-green); }
.setup-check-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; flex: 0 0 1.6rem; border: 2px solid #9aa9b3; border-radius: 50%; color: #687984; font-weight: 700; line-height: 1; }
.setup-check-icon.complete { border-color: var(--mtt-green); background: var(--mtt-green); color: #fff; }
.setup-overview-grid { display: grid; align-items: start; gap: 1rem; }
.setup-overview-grid .setup-panel { margin-bottom: 0 !important; }
.setup-page { font-size: .94rem; }
.setup-page .setup-panel { padding: 1.25rem !important; }
.setup-page .h2 { font-size: 1.65rem; }
.setup-page .h5 { font-size: 1rem; }
.setup-page .table > :not(caption) > * > * { padding: .45rem .6rem; }
.setup-page .schedule-summary .table > :not(caption) > * > * { padding: .2rem .4rem; }
.setup-page .schedule-summary .table { font-size: .86rem; }
.setup-page .schedule-summary > summary { cursor: pointer; list-style: none; }
.setup-page .schedule-summary > summary::-webkit-details-marker { display: none; }
.setup-page .schedule-summary > summary::after { content: '＋'; color: var(--mtt-blue); font-size: .9rem; margin-left: auto; }
.setup-page .schedule-summary[open] > summary::after { content: '−'; }
.setup-page .schedule-summary > summary:focus-visible { outline: 3px solid var(--mtt-blue); outline-offset: 3px; }
.match-day-row > * { background: color-mix(in srgb, var(--competition-color) 7%, #fff) !important; }
.match-day-row > :first-child { border-left: .3rem solid var(--competition-color); }
.match-competition-spot { display: inline-block; width: .72rem; height: .72rem; margin-right: .35rem; border-radius: 50%; background: var(--competition-color); box-shadow: 0 0 0 1px rgba(8, 47, 73, .25); vertical-align: -.03rem; }
.match-day-score { display: inline-block; margin-left: .4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.match-day-table th[data-label="Queue"] { white-space: nowrap; }
@media (max-width: 767.98px) {
    .match-day-table thead { display: none; }
    .match-day-table,
    .match-day-table tbody,
    .match-day-table tr,
    .match-day-table th,
    .match-day-table td { display: block; width: 100%; }
    .match-day-table tr {
        margin-bottom: .75rem;
        padding: .45rem .75rem;
        border: 1px solid color-mix(in srgb, var(--competition-color) 35%, #cbd5dc);
        border-left: .35rem solid var(--competition-color);
        border-radius: .6rem;
        background: color-mix(in srgb, var(--competition-color) 7%, #fff);
    }
    .match-day-table tr:last-child { margin-bottom: 0; }
    .match-day-table tr > * {
        display: flex;
        align-items: baseline;
        gap: .65rem;
        padding: .2rem 0;
        border: 0;
        background: transparent !important;
        text-align: left !important;
        overflow-wrap: anywhere;
        line-height: 1;
    }
    .match-day-table tr > :first-child { border-left: 0; }
    .match-day-table tr > *::before {
        content: attr(data-label);
        flex: 0 0 5.75rem;
        color: #527064;
        font-size: .72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
    }
    .match-day-table th[data-label="Queue"] { font-size: 1rem; }
    .match-day-table td[data-label="Team 1"],
    .match-day-table td[data-label="Team 2"] { font-weight: 700; }
    .match-day-table td[data-label="Status"] { align-items: flex-start; flex-wrap: wrap; }
    .match-day-table td[data-label="Status"]::before { align-self: center; }
    .match-day-table .match-competition-spot { flex: 0 0 auto; }
}
.public-match-display { min-height: 100vh; padding: clamp(.75rem, 2vw, 1.5rem); background: #edf7f0; color: var(--mtt-navy); }
.public-display-header { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin-bottom: clamp(.85rem, 2vw, 1.5rem); }
.public-display-logo { display: block; width: clamp(3.5rem, 7vw, 5.5rem); height: auto; flex: 0 0 auto; }
.public-display-header h1 { margin: 0; font-size: clamp(1.2rem, 2.4vw, 2rem); }
.public-display-refresh { color: #527064; font-size: clamp(.72rem, 1.2vw, .9rem); }
.public-display-section { margin-bottom: clamp(1rem, 3vw, 2rem); }
.public-display-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.public-display-section-heading h2 { margin: 0; font-size: clamp(1.2rem, 3vw, 2rem); }
.public-display-section-heading span { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; padding: .15rem .55rem; border-radius: 999px; background: #fff; border: 1px solid #c8ddd0; font-weight: 700; }
.public-display-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.public-match-card { border-left: .45rem solid var(--competition-color); border-radius: .65rem; padding: clamp(.8rem, 2vw, 1.25rem); background: color-mix(in srgb, var(--competition-color) 10%, #fff); box-shadow: 0 .15rem .6rem rgba(8, 47, 73, .08); }
.public-match-card { position: relative; padding-right: clamp(5.5rem, 9vw, 7rem); }
.public-match-number { position: absolute; top: .65rem; right: .65rem; padding: .25rem .45rem; border-radius: .35rem; background: var(--competition-color); color: #fff; font-size: clamp(.75rem, 1.4vw, 1rem); font-weight: 800; line-height: 1.1; white-space: nowrap; }
.public-match-meta { color: #527064; font-size: clamp(.75rem, 1.4vw, .95rem); font-weight: 700; }
.public-match-teams { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .6rem; font-size: clamp(1rem, 2.4vw, 1.7rem); font-weight: 700; }
.public-match-teams span { flex: 1; }
.public-match-teams span:last-child { text-align: right; }
.public-match-teams strong { color: #527064; font-size: .8em; }
.public-display-empty { margin: 0; padding: 1rem; border: 1px dashed #b9d8c0; border-radius: .65rem; color: #527064; background: rgba(255, 255, 255, .55); }
.public-next-match { max-width: 70rem; }
.public-display-match-panels { display: grid; gap: clamp(1rem, 2vw, 1.5rem); }
@media (min-width: 992px) {
    .public-display-match-panels { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); align-items: start; }
    .public-display-match-panels .public-display-section { min-width: 0; }
}
.public-display-error { max-width: 42rem; margin: 10vh auto; padding: 2rem; }
.public-standings-controls { display: grid; gap: .6rem; margin-bottom: 1rem; }
.public-standings-title { position: absolute; top: 50%; left: 50%; margin: 0; transform: translate(-50%, -50%); font-size: clamp(1.35rem, 3vw, 2.2rem); white-space: nowrap; }
.public-standings-stage-list, .public-standings-view { display: flex; flex-wrap: wrap; gap: .4rem; }
.public-standings-stage, .public-standings-view a { color: var(--mtt-navy); text-decoration: none; border: 1px solid #c8ddd0; border-radius: 999px; padding: .3rem .65rem; background: rgba(255,255,255,.7); font-size: .85rem; }
.public-standings-stage.active, .public-standings-view a.active { color: #fff; background: var(--mtt-navy); border-color: var(--mtt-navy); }
.public-standings-method { margin: 0 0 1rem; color: #527064; font-size: clamp(.78rem, 1.4vw, .95rem); }
.public-standings-table-wrap { overflow-x: auto; background: rgba(255,255,255,.75); border: 1px solid #c8ddd0; border-radius: .65rem; }
.public-standings-table { width: 100%; border-collapse: collapse; font-size: clamp(.75rem, 1.5vw, 1rem); }
.public-standings-table th, .public-standings-table td { padding: .55rem .65rem; border-bottom: 1px solid #dcebe0; text-align: right; white-space: nowrap; }
.public-standings-table th:nth-child(2), .public-standings-table td:nth-child(2) { text-align: left; white-space: normal; min-width: 10rem; }
.public-standings-table tbody tr:last-child th, .public-standings-table tbody tr:last-child td { border-bottom: 0; }
.setup-page .form-control,
.setup-page .form-select { font-size: .92rem; padding: .35rem .65rem; }
.setup-page .btn { font-size: .92rem; }
.competition-accordion {
    gap: .75rem;
}
.competition-accordion > .accordion-item {
    margin-bottom: 0;
    border: 1px solid color-mix(in srgb, var(--competition-color) 45%, #cbd5dc);
    border-left: .35rem solid var(--competition-color);
    border-radius: .65rem !important;
    overflow: hidden;
    background: color-mix(in srgb, var(--competition-color) 8%, #fff);
}
.competition-accordion > .accordion-item:last-child { margin-bottom: 0; }
.competition-accordion .accordion-button:not(.collapsed) {
    color: var(--mtt-navy);
    background: color-mix(in srgb, var(--competition-color) 14%, #fff);
    box-shadow: inset 0 -1px 0 rgba(8, 47, 73, .12);
}
.competition-accordion .accordion-button.collapsed {
    background: color-mix(in srgb, var(--competition-color) 10%, #fff);
}
.competition-accordion .accordion-body {
    background: color-mix(in srgb, var(--competition-color) 5%, #fff);
}
.competition-accordion .competition-cancelled .accordion-button,
.competition-accordion .competition-cancelled .accordion-body {
    color: #6c757d;
}
.competition-header { min-width: 0; }
.competition-header .accordion-button { min-width: 0; }
.competition-color-swatch {
    display: inline-block;
    flex: 0 0 1rem;
    width: 1rem;
    height: 1rem;
    margin-right: .55rem;
    border: 2px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    background: var(--competition-color);
    box-shadow: 0 0 0 1px rgba(8, 47, 73, .25);
}
.competition-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 1.55rem;
    width: 1.55rem;
    height: 1.55rem;
    margin-right: .65rem;
    border: 1px solid #b9c8d2;
    border-radius: 50%;
    background: #f1f5f8;
    color: #536875;
    font-size: .78rem;
    font-weight: 700;
}
.competition-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.5rem;
    border: 0;
    border-right: 1px solid #cbd5dc;
    background: #f8fbfd;
    color: #60717d;
    cursor: grab;
    touch-action: none;
}
.competition-drag-handle:hover,
.competition-drag-handle:focus-visible { background: #eef4f8; color: var(--mtt-navy); }
.competition-drag-handle:active { cursor: grabbing; }
.drag-handle-icon { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.collapse-chevron { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.entry-import-toggle[aria-expanded="true"] .collapse-chevron { transform: rotate(180deg); }
.competition-item { transition: width .15s ease, margin .15s ease, transform .15s ease, box-shadow .15s ease; }
.competition-dragging {
    position: relative;
    z-index: 5;
    opacity: 1;
    width: 50%;
    margin-left: .75rem;
    transform: rotate(-1.2deg) scale(1.015);
    transform-origin: center center;
    border: 2px solid #d39e00;
    border-radius: .65rem;
    background: #fffdf3;
    box-shadow: 0 .75rem 1.5rem rgba(8, 47, 73, .24), 0 0 0 .2rem rgba(211, 158, 0, .18);
}
.competition-dragging .competition-header {
    background: #fff3cd;
}
.competition-dragging .competition-drag-handle {
    background: #ffe69c;
    color: #664d03;
    cursor: grabbing;
}
.stage-row { border-color: rgba(8, 47, 73, .16) !important; }
.stage-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(8, 47, 73, .08);
    color: var(--mtt-navy);
    font-size: .78rem;
    font-weight: 700;
}
@media (max-width: 575.98px) {
    .competition-dragging { width: 86%; }
}
@media (min-width: 1200px) {
    .setup-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.app-navigation { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem; }
.app-nav-link { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border-radius: .65rem; text-decoration: none; font-weight: 600; }
.menu-icon, .menu-chevron { width: 1.25rem; height: 1.25rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.menu-chevron { width: .9rem; height: .9rem; margin-left: auto; }
.app-nav-group[open] > summary .menu-chevron { transform: rotate(90deg); }
.app-nav-link:hover { background: #f0f5f8; }
.app-nav-link.active { color: #fff; background: var(--mtt-navy); }
.app-nav-link-disabled { color: #60717d; cursor: default; opacity: .72; }
.app-nav-link-disabled:hover { background: transparent; }
.app-nav-group { min-width: 0; }
.app-nav-group summary { cursor: pointer; list-style: none; }
.app-nav-group summary::-webkit-details-marker { display: none; }
.app-nav-group summary:focus-visible { outline: 3px solid var(--mtt-blue); outline-offset: 3px; }
.app-subnavigation { display: flex; flex-direction: column; padding: .25rem 0 .25rem 1rem; }
.app-subnavigation .app-nav-link { border-left: 3px solid var(--mtt-green); }
.app-content footer { padding-inline: .5rem; }
.mtt-footer-attribution { color: #526875; }
.mtt-footer-attribution a { color: var(--mtt-navy); font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.mtt-footer-attribution a:hover { color: var(--mtt-green); }
.mtt-footer-meta { color: #71818a; }
.app-sidebar { border-bottom: 1px solid var(--bs-border-color); }
.app-sidebar-mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mobile-nav-toggle { display: none; align-items: center; gap: .5rem; }
.hamburger-icon { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.account-navigation { min-width: 0; }
.account-menu { position: relative; min-width: 0; }
.account-menu-toggle {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem .8rem;
    border: 1px solid #c9d5df;
    border-radius: .65rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
}
.account-menu-toggle::-webkit-details-marker { display: none; }
.account-menu-toggle:hover, .account-menu[open] .account-menu-toggle { background: #eef4f8; }
.account-menu-toggle:focus-visible { outline: 3px solid var(--mtt-blue); outline-offset: 3px; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(36vw, 18rem); }
.account-menu-panel {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    width: 12rem;
    max-width: calc(100vw - 3rem);
    padding: .4rem;
    z-index: 1000;
}
.account-menu-panel .dropdown-item { padding: .7rem .85rem; border-radius: .35rem; }
.account-menu-panel .dropdown-item:hover,
.account-menu-panel .dropdown-item:focus { background: #eef4f8; color: var(--mtt-navy); }

@media (min-width: 992px) {
    .app-workspace { flex-direction: row; }
    .app-sidebar { flex: 0 0 240px; border-bottom: 0; }
    .app-navigation { flex-direction: column; }
    .app-navigation.collapse { display: flex !important; }
}

@media (max-width: 991.98px) {
    .app-sidebar { border-right: 0 !important; }
    .app-sidebar-mobile-bar { padding-bottom: .75rem !important; }
    .mobile-nav-toggle { display: inline-flex; }
    .app-navigation.collapse:not(.show) { display: none; }
    .app-navigation { flex-direction: column; padding-top: .5rem; }
}

/* Keep the development marker visible while scrolling without blocking controls. */
.environment-development { padding: 38px 8px 8px; }
.environment-development::after {
    content: "";
    position: fixed;
    inset: 0;
    border: 8px solid #ff1a1a;
    pointer-events: none;
    z-index: 2000;
}
.development-label {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 16px;
    background: #ff1a1a;
    color: #000;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    line-height: 20px;
    border-radius: 0 0 6px 6px;
    pointer-events: none;
    z-index: 2001;
}

.team-board-competition { min-height: 7rem; background: #f8fafc; }
.team-drop-zone { min-height: 3rem; padding: .5rem; border: 1px dashed #ced4da; border-radius: .5rem; }
.team-board-card { cursor: grab; transition: opacity .15s, box-shadow .15s, background-color .15s; }
.team-board-card:active { cursor: grabbing; }
.team-dragging { opacity: .45; }
.team-drag-invalid { border-color: #dc3545 !important; }
.team-drag-feedback { font-weight: 600; }
.team-drop-target { background: #e6f4ff; outline: 2px dashed #0d6efd; outline-offset: 3px; }
.team-board-player { cursor: grab; }
.team-board-player:hover, .team-board-player:focus-visible { background: #eef4f8; }
.team-player-id { font-size: .7rem; }
.player-multi-competition-indicator { font-weight: 700; }
.player-dragging { opacity: .45; }
.player-drop-target { background: #fff3cd; outline: 2px dashed #fd7e14; }
.pool-board-column { background: #f8fafc; }
.pool-drop-zone { min-height: 4rem; padding: .25rem; border: 1px dashed #ced4da; border-radius: .5rem; }
.pool-team-card { cursor: grab; transition: opacity .15s, box-shadow .15s, background-color .15s; }
.pool-team-card:active { cursor: grabbing; }
.pool-team-dragging { opacity: .45; }
.pool-drop-target { background: #e6f4ff; outline: 2px dashed #0d6efd; outline-offset: 3px; }
.pool-drag-handle { letter-spacing: -.25rem; padding-right: .25rem; user-select: none; }
.team-feedback-message { white-space: pre-line; }
.team-drag-handle { color: #6c757d; letter-spacing: -.25rem; padding-right: .25rem; user-select: none; }

.dupr-preview { max-width: 62rem; margin-inline: auto; }
.dupr-preview-heading { margin-bottom: 1.25rem; }
.dupr-preview-panel { overflow: hidden; }
.dupr-embed-frame {
    display: block;
    width: 100%;
    min-height: 42rem;
    border: 0;
    background: #fff;
}
@media (max-width: 575.98px) {
    .dupr-embed-frame { min-height: 46rem; }
}
