:root {
    --results-blue: #0b5ed7;
    --results-blue-dark: #061b3a;
    --results-blue-mid: #0a478f;
    --results-blue-soft: #e8f3ff;
    --results-ink: #10284d;
    --results-muted: #667b96;
    --results-line: rgba(137, 180, 222, .48);
    --results-surface: #ffffff;
    --results-page: #eef7ff;
    --results-gold: #fff3cf;
    --results-silver: #edf3f8;
    --results-bronze: #f8e7d9;
    --results-shadow: 0 18px 42px rgba(6, 27, 58, .11);
}

body.results-page {
    margin: 0;
    background:
        radial-gradient(circle at 12% -8%, rgba(11, 94, 215, .23), transparent 30rem),
        radial-gradient(circle at 88% 0%, rgba(25, 167, 206, .16), transparent 34rem),
        linear-gradient(180deg, #eaf6ff 0%, #f7fbff 34%, #eef6ff 100%);
    color: var(--results-ink);
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

body.results-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255,255,255,.32) 25%, transparent 25%) 0 0 / 34px 34px,
        linear-gradient(315deg, rgba(255,255,255,.22) 25%, transparent 25%) 0 0 / 34px 34px;
    opacity: .26;
}

.results-shell {
    width: min(100% - 32px, 1280px);
    margin: 0 auto 44px;
}

.results-title {
    margin: 24px auto 16px;
    color: var(--results-blue-dark);
    font-size: clamp(20px, 2vw, 28px);
    font-weight: 800;
    line-height: 1.18;
    text-align: center;
    letter-spacing: -.025em;
}

.results-title-sub {
    display: block;
    margin: 0 auto 12px;
    color: var(--results-ink);
    font-size: 0.68em;
    font-weight: 500;
    letter-spacing: 0;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    max-width: 820px;
    margin: 0 auto 22px;
}

.results-summary--compact {
    max-width: 780px;
}

.results-stat {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid rgba(151, 190, 224, .68);
    border-radius: 14px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 10px 24px rgba(15, 72, 128, .08);
    text-align: center;
    backdrop-filter: blur(8px);
}

.results-stat--featured {
    border-color: rgba(11, 94, 215, .28);
    background: linear-gradient(180deg, #f5faff, #eaf3ff);
}

.results-stat-label {
    display: block;
    margin-bottom: 3px;
    color: var(--results-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.045em;
    line-height: 1.25;
    text-transform: uppercase;
}

.results-stat-value {
    display: block;
    color: var(--results-blue-dark);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.results-stat-value--compact {
    font-size: 16px;
}

.results-section-title {
    margin: 26px 0 10px;
    color: var(--results-blue-dark);
    font-size: 19px;
    line-height: 1.3;
    text-align: center;
}

.results-table-wrap {
    width: max-content;
    max-width: 100%;
    margin: 0 auto 24px;
    overflow-x: auto;
    border: 1px solid rgba(137, 180, 222, .62);
    border-radius: 16px;
    background: var(--results-surface);
    box-shadow: var(--results-shadow);
    -webkit-overflow-scrolling: touch;
}

.results-table-wrap--narrow {
    max-width: 780px;
}

.results-page table.proto,
.results-page table.proto-table,
.results-page table.result-table {
    width: max-content !important;
    min-width: min(100%, 720px);
    max-width: none !important;
    margin: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--results-surface);
    color: var(--results-ink);
    font-family: inherit;
    font-size: 14px;
    white-space: nowrap;
}

.results-page table.proto th,
.results-page table.proto-table th,
.results-page table.result-table th {
    padding: 11px 13px;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(180deg, #07518d, #064775);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.25;
    text-align: center;
}

.results-page table.proto th:first-child,
.results-page table.proto-table th:first-child,
.results-page table.result-table th:first-child {
    border-top-left-radius: 15px;
}

.results-page table.proto th:last-child,
.results-page table.proto-table th:last-child,
.results-page table.result-table th:last-child {
    border-top-right-radius: 15px;
    border-right: 0;
}

.results-page table.proto td,
.results-page table.proto-table td,
.results-page table.result-table td {
    padding: 9px 13px;
    border: 0;
    border-right: 1px solid #edf1f4;
    border-bottom: 1px solid var(--results-line);
    background: transparent;
    text-align: center;
    white-space: nowrap;
}

.results-page table.proto td:last-child,
.results-page table.proto-table td:last-child,
.results-page table.result-table td:last-child {
    border-right: 0;
}

.results-page table.proto tr:last-child td,
.results-page table.proto-table tr:last-child td,
.results-page table.result-table tr:last-child td {
    border-bottom: 0;
}

.results-page table.proto tr:nth-child(even),
.results-page table.proto-table tr:nth-child(even),
.results-page table.result-table tr:nth-child(even) {
    background: #f8fafb;
}

.results-page table a {
    color: var(--results-blue-dark) !important;
    font-weight: 700;
    text-decoration: none !important;
}

.results-page table a:hover {
    text-decoration: underline !important;
}

.results-page th.sortable:hover {
    background: var(--results-blue-dark);
}

.results-page th.sortable .arrow {
    opacity: 0.75;
}

.results-page tr.place-1 { background: var(--results-gold) !important; }
.results-page tr.place-2 { background: var(--results-silver) !important; }
.results-page tr.place-3 { background: var(--results-bronze) !important; }

.results-page tr.place-1 td:first-child,
.results-page tr.place-2 td:first-child,
.results-page tr.place-3 td:first-child {
    border-left: 4px solid #d7a916;
    font-weight: 800;
}
.results-page tr.place-2 td:first-child { border-left-color: #9aaab5; }
.results-page tr.place-3 td:first-child { border-left-color: #b87545; }

.results-page tr.totals-row,
.results-page tr.totals-row td {
    background: var(--results-blue-dark) !important;
    color: #fff;
    font-weight: 800;
}

.results-page tr.totals-row td:first-child {
    border-bottom-left-radius: 15px;
}

.results-page tr.totals-row td:last-child {
    border-bottom-right-radius: 15px;
}

.results-page .team-divider td {
    background: var(--results-blue-soft) !important;
    color: var(--results-blue-dark) !important;
    font-weight: 700;
    text-align: center;
}

.results-page .day-divider td {
    background: #d5e8f4 !important;
    color: var(--results-blue-dark) !important;
    font-weight: 800;
    text-align: center;
}

.results-page .team-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 520px);
    gap: 18px;
    align-items: center;
    max-width: 1050px;
    margin: 22px auto 20px;
    padding: 18px;
    border: 1px solid var(--results-line);
    border-radius: 14px;
    background: rgba(255,255,255,.94);
    box-shadow: var(--results-shadow);
}

.results-page .results-panel--narrow {
    max-width: 780px;
}

.results-page .team-overview--no-photos {
    grid-template-columns: minmax(0, 1fr);
}

.results-page .team-overview-details {
    line-height: 1.7;
}

.results-page .team-overview-details p { margin: 0; }

.results-page .participant-overview {
    max-width: 640px;
    text-align: left;
}

.results-page .participant-overview-primary {
    margin-bottom: 14px;
}

.results-page .participant-overview-label,
.results-page .participant-overview-meta-item span {
    display: block;
    color: var(--results-muted);
    font-size: 12px;
}

.results-page .participant-overview-name {
    display: block;
    color: var(--results-blue-dark);
    font-size: 20px;
    line-height: 1.3;
}

.results-page .participant-overview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.results-page .participant-overview-meta-item {
    min-width: 105px;
    padding: 7px 10px;
    border: 1px solid var(--results-line);
    border-radius: 9px;
    background: #f6f9fb;
    line-height: 1.35;
}

.results-page .participant-overview-meta-item strong {
    display: block;
    color: var(--results-blue-dark);
    font-size: 13px;
}

.results-page .team-photos {
    margin: 0;
    gap: 8px;
}

.results-page .team-photos img {
    width: min(150px, 30%);
    height: 105px;
    max-height: none;
    border-radius: 8px;
    object-fit: cover;
}

.results-empty {
    margin: 24px auto;
    color: var(--results-muted);
    text-align: center;
}

/* Shared report navigation: override the legacy inline header styling. */
.report-menu-wrapper {
    box-sizing: border-box;
    width: min(100% - 32px, 1280px);
    min-height: 58px;
    margin: 12px auto 22px;
    padding: 8px 88px 8px 12px;
    gap: 14px;
    border: 1px solid rgba(151, 190, 224, .64);
    border-radius: 18px;
    background: rgba(255,255,255,.82);
    box-shadow: 0 12px 28px rgba(15, 72, 128, .08);
    backdrop-filter: blur(10px);
}

.report-menu-wrapper .public-logo {
    display: block;
    flex: 0 0 auto;
    width: 56px;
    height: 38px;
    background: url('/API/logos/israfish_logo_transparent.png') center/contain no-repeat;
}

.report-menu-wrapper .public-logo img {
    display: block;
    width: 56px;
    height: 38px;
    max-width: none;
    object-fit: contain;
    opacity: 0;
}

.menu-center {
    gap: 8px;
}

.menu-btn {
    box-sizing: border-box;
    min-height: 38px;
    padding: 10px 14px;
    border: 1px solid var(--results-blue-mid);
    border-radius: 11px;
    background: var(--results-blue-mid);
    color: #fff !important;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 16px;
    text-decoration: none;
    box-shadow: 0 8px 16px rgba(6, 27, 58, .09);
}

.menu-btn:hover {
    border-color: var(--results-blue-dark);
    background: var(--results-blue-dark);
}

.menu-btn.active {
    border-color: rgba(122, 177, 225, .72);
    background: #ffffff;
    color: var(--results-blue-dark) !important;
    opacity: 1;
    box-shadow: none;
}

.menu-right {
    top: 10px;
    right: 12px;
    gap: 6px;
    font-size: 0;
}

.menu-right .menu-btn {
    min-width: 42px;
    min-height: 36px;
    padding: 9px 11px;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 900px) {
    .results-shell { width: min(100% - 24px, 1280px); }
    .results-page .team-overview { grid-template-columns: 1fr; }
    .results-page .team-photos { justify-content: flex-start; }
    .report-menu-wrapper {
        width: calc(100% - 24px);
        padding-right: 12px;
    }
    .menu-right {
        position: static;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    body.results-page { font-size: 14px; }
    .report-menu-wrapper .public-logo { margin: 0 auto; }
    .menu-center { width: 100%; }
    .menu-btn { flex: 1 1 135px; text-align: center; }
    .results-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .results-stat { padding: 10px; }
    .results-stat-value { font-size: 18px; }
    .results-title {
        margin-top: 18px;
        font-size: clamp(19px, 6vw, 23px);
    }
    .results-page table.proto th,
    .results-page table.proto-table th,
    .results-page table.result-table th,
    .results-page table.proto td,
    .results-page table.proto-table td,
    .results-page table.result-table td { padding: 8px 9px; }
    .results-table-wrap--narrow { max-width: 100%; }
    .results-summary--compact,
    .results-panel--narrow { max-width: 100%; }
}

@media (max-width: 420px) {
    .results-shell { width: calc(100% - 16px); }
    .results-summary { grid-template-columns: 1fr 1fr; gap: 7px; }
    .results-stat-label { font-size: 10px; }
    .results-stat-value { font-size: 16px; }
    .results-stat-value--compact { font-size: 13px; }
    .results-page .team-overview { padding: 13px; }
    .results-page .team-photos img { width: calc(50% - 4px); height: 100px; }
}

/* Public daily results: keep numeric columns compact and let the team column fit its content. */
.results-page table.daily-results-table {
    width: max-content !important;
    min-width: 0;
    table-layout: auto;
}

.results-page table.daily-results-table th,
.results-page table.daily-results-table td {
    border-right-color: #d5dee8;
    border-bottom: 1px solid #d5dee8;
}

.results-page table.daily-results-table th:last-child,
.results-page table.daily-results-table td:last-child {
    border-right: 0;
}

.results-page table.daily-results-table .daily-results-col-place { width: 58px; }
.results-page table.daily-results-table .daily-results-col-sector { width: 68px; }
.results-page table.daily-results-table .daily-results-col-zone { width: 58px; }
.results-page table.daily-results-table .daily-results-col-day { width: 66px; }
.results-page table.daily-results-table .daily-results-col-total { width: 74px; }
.results-page table.daily-results-table .daily-results-col-fish { width: 60px; }
.results-page table.daily-results-table .daily-results-col-team { width: auto; }

.results-page table.daily-results-table th.daily-results-cell-place,
.results-page table.daily-results-table th.daily-results-cell-sector,
.results-page table.daily-results-table th.daily-results-cell-zone,
.results-page table.daily-results-table th.daily-results-cell-day,
.results-page table.daily-results-table th.daily-results-cell-total,
.results-page table.daily-results-table th.daily-results-cell-fish,
.results-page table.daily-results-table td.daily-results-cell-place,
.results-page table.daily-results-table td.daily-results-cell-sector,
.results-page table.daily-results-table td.daily-results-cell-zone,
.results-page table.daily-results-table td.daily-results-cell-day,
.results-page table.daily-results-table td.daily-results-cell-total,
.results-page table.daily-results-table td.daily-results-cell-fish {
    padding-right: 6px;
    padding-left: 6px;
}

.results-page table.daily-results-table th.daily-results-cell-team {
    text-align: center;
}

.results-page table.daily-results-table td.daily-results-cell-team {
    text-align: left;
}

.results-page table.daily-results-table td.daily-results-cell-team {
    padding-top: 7px;
    padding-bottom: 7px;
}

.results-page .daily-results-team-link,
.results-page .daily-results-team-separator,
.results-page .daily-results-team-members {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.results-page .daily-results-team-link {
    line-height: 1.2;
}

.results-page .daily-results-team-members {
    color: var(--results-muted);
    font-size: 0.88em;
    font-weight: 500;
    line-height: 1.12;
}

/* Desktop public report menu should size to its content, not to the page/table width. */
@media (min-width: 901px) {
    .report-menu-wrapper {
        width: fit-content;
        max-width: calc(100% - 32px);
        min-height: 0;
        padding: 8px 12px;
        align-items: center;
    }

    .report-menu-wrapper .public-logo {
        margin-right: 2px;
    }

    .menu-right {
        position: static !important;
        width: auto;
        margin-left: 2px;
        justify-content: center;
    }
}

/* Daily results desktop compact mode for long tournaments */
@media (min-width: 901px) {
    .results-table-wrap--daily {
        max-width: calc(100vw - 64px);
    }

    .results-page table.daily-results-table {
        table-layout: fixed;
    }

    .results-page table.daily-results-table .daily-results-col-team {
        width: clamp(360px, 30vw, 430px);
    }

    .results-page table.daily-results-table .daily-results-col-day {
        width: 86px;
    }

    .results-page table.daily-results-table .daily-results-col-total {
        width: 86px;
    }

    .results-page table.daily-results-table th.daily-results-cell-day,
    .results-page table.daily-results-table td.daily-results-cell-day,
    .results-page table.daily-results-table th.daily-results-cell-total,
    .results-page table.daily-results-table td.daily-results-cell-total {
        padding-right: 5px;
        padding-left: 5px;
        font-size: 13px;
    }

    .results-page table.daily-results-table td.daily-results-cell-team {
        max-width: clamp(360px, 30vw, 430px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Public delegation participants page */
.delegation-participants-page .results-title--delegation-members {
    font-size: clamp(16px, 1.45vw, 20px);
    line-height: 1.18;
}

.delegation-participants-page .results-title--delegation-members span {
    display: block;
}

.delegation-participants-page .results-title--delegation-members .results-title-subline {
    margin-top: 4px;
    font-size: 0.82em;
    font-weight: 750;
}

.delegation-participants-page .results-summary--content {
    width: fit-content;
    max-width: calc(100% - 32px);
    grid-template-columns: 1fr;
}

.delegation-participants-page .results-summary--content .results-stat {
    width: fit-content;
    min-width: 0;
    padding: 12px 22px;
}

.delegation-participants-page .results-table-wrap--delegation-roster {
    width: fit-content;
    max-width: calc(100% - 32px);
}

.delegation-participants-page table.delegation-roster-table {
    width: max-content !important;
    min-width: 0;
}

.delegation-participants-page table.delegation-roster-table th,
.delegation-participants-page table.delegation-roster-table td {
    padding: 8px 13px;
}

.delegation-participants-page table.delegation-roster-table .delegation-roster-role,
.delegation-participants-page table.delegation-roster-table .delegation-roster-name {
    text-align: left;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-head_coach,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-coach {
    background: #eaf3ff !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-administrator {
    background: #fff6e5 !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete.delegation-pair-1 {
    background: #edf6ff !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete.delegation-pair-2 {
    background: #eefdf5 !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete.delegation-pair-3 {
    background: #fffbe8 !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-reserve {
    background: #f3f4f6 !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-helper {
    background: #eefcf7 !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-press {
    background: #f6efff !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-other {
    background: #f8fafc !important;
}

@media (max-width: 768px) {
    .delegation-participants-page .results-table-wrap--delegation-roster,
    .delegation-participants-page .results-summary--content {
        max-width: 100%;
    }

    .delegation-participants-page table.delegation-roster-table {
        width: 100% !important;
    }
}

/* Public delegation participants: grouped row colors */
.delegation-participants-page table.delegation-roster-table tr[class*="delegation-role-"] {
    background: #f8fafc !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-head_coach,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-coach,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-administrator {
    background: #eaf3ff !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete {
    background: #eefdf5 !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-reserve {
    background: #f3f4f6 !important;
}

.delegation-participants-page table.delegation-roster-table tr.delegation-role-helper,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-press,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-other {
    background: #f6efff !important;
}

/* Public delegation participants: force all main athletes to one color */
.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete.delegation-pair-1,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete.delegation-pair-2,
.delegation-participants-page table.delegation-roster-table tr.delegation-role-athlete.delegation-pair-3 {
    background: #eefdf5 !important;
}
