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

.tables-pdf-export {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tables-pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: 1px solid #d4a017;
    border-radius: 999px;
    background: rgba(212, 160, 23, 0.14);
    color: #d4a017;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tables-pdf-icon {
    flex-shrink: 0;
}

.tables-pdf-button:hover:not(:disabled) {
    background: #d4a017;
    color: #18181b;
    transform: translateY(-1px);
}

.tables-pdf-button:focus-visible {
    outline: 2px solid #d4a017;
    outline-offset: 3px;
}

.tables-pdf-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tables-pdf-status {
    margin: 0;
    min-height: 1.2em;
    font-size: 0.85rem;
    color: #a0a0a0;
}

/* no reserved space under the button until there is a message to show */
.tables-pdf-status:empty {
    display: none;
}

.standings-group {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.standings-group[hidden] {
    display: none;
}

/* League / Handicap switch above the A and B tables - same segmented control
   as the .sp-seg toggle on the index page. */
.standings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 20px;
}

.standings-header .section-title {
    margin-bottom: 0;
}

.standings-tabs {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    overflow: hidden;
    flex-shrink: 0;
}

.standings-tab-btn {
    background: none;
    border: 0;
    color: #a0a0a0;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 5px 10px;
    cursor: pointer;
}

.standings-tab-btn + .standings-tab-btn {
    border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.standings-tab-btn.active {
    background: rgba(212, 160, 23, 0.16);
    color: #d4a017;
}

.standings-tab-btn:focus-visible {
    outline: 2px solid #d4a017;
    outline-offset: -2px;
}

.standings-block-title {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #e0d6c8;
}

.league-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    font-size: 0.95rem;
}

.league-table thead tr:first-child th:first-child {
    border-top-left-radius: 12px;
}

.league-table thead tr:first-child th:last-child {
    border-top-right-radius: 12px;
}

.league-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.league-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.league-table th,
.league-table td {
    padding: 15px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.league-table th:first-child,
.league-table td:first-child {
    border-left: 3px solid rgba(196, 30, 58, 0.3);
}

.league-table th:last-child,
.league-table td:last-child {
    border-right: 3px solid rgba(196, 30, 58, 0.3);
}

.league-table thead th {
    border-top: 3px solid rgba(196, 30, 58, 0.3);
}

.league-table tbody tr:last-child td {
    border-bottom: 3px solid rgba(196, 30, 58, 0.3);
}

.league-table th {
    background: rgba(196, 30, 58, 0.35);
    font-weight: bold;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    white-space: nowrap;
    line-height: 1.3;
}

.league-table td:not(:first-child):not(:nth-child(2)):not(:nth-child(3)):not(.shots-cell) {
    max-width: 100px;
}

.league-table th:nth-child(2) {
    text-align: left;
}

/* Sortable headers get extra left padding; match the cell padding so the
   Shooter heading lines up with the start of the names. */
#leagueTableHead th:nth-child(2),
#leagueTableHead th:nth-child(3),
.standings-head th:nth-child(2) {
    padding-left: 15px;
}

#leagueTableHead th:nth-child(3),
#leagueTable td:nth-child(3) {
    text-align: left;
}

.league-table td:nth-child(2) {
    text-align: left;
    font-weight: 600;
}

.shooter-link {
    color: inherit;
    text-decoration: none;
}

.shooter-link:hover {
    color: #d4a017;
    text-decoration: underline;
}

.league-table td {
    font-size: 0.95rem;
}

.league-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

.league-table tr.team-highlight td {
    background: rgba(255, 193, 7, 0.18);
}

.league-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 26px;
    padding-right: 26px;
}

.league-table th[data-sort]:hover {
    background: rgba(196, 30, 58, 0.5);
}

.league-table th[data-sort]::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0.6em;
    opacity: 0.5;
}

/* Sorted column picked out in gold (same gold as match.css's .hc-cell). */
.league-table th[data-sort].sorted-col,
.league-table tbody td.sorted-col,
.league-table tbody td.sorted-col a {
    color: #d4a017;
}

.league-table th[data-sort].sort-asc::after {
    content: '\25B2';
    opacity: 1;
}

.league-table th[data-sort].sort-desc::after {
    content: '\25BC';
    opacity: 1;
}

.league-table .team-cell {
    cursor: pointer;
}

.league-table td:first-child {
    color: #a0a0a0;
    font-weight: 600;
}

.team-standings-table .team-cell {
    cursor: default;
}

.team-standings-table .team-cell a {
    color: inherit;
    text-decoration: none;
}

.team-standings-table .team-cell a:hover {
    color: #d4a017;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .league-table th,
    .league-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
}

.pagination {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.stats-search {
    display: none;
    justify-content: center;
    margin-bottom: 20px;
}

.stats-search-input {
    width: 100%;
    max-width: 360px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.stats-search-input::placeholder {
    color: #7f7f88;
}

.stats-search-input:focus {
    outline: none;
    border-color: rgba(212, 160, 23, 0.7);
    background: rgba(255, 255, 255, 0.1);
}

#statsPaginationBottom {
    margin-top: 20px;
    margin-bottom: 0;
}

.pagination-label {
    color: #e0d6c8;
    font-size: 0.95rem;
}

.pagination-arrow {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #e0d6c8;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.pagination-arrow:hover:not(:disabled) {
    background: rgba(196, 30, 58, 0.25);
    color: #ffffff;
}

.pagination-arrow:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rotate-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(24, 24, 27, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.rotate-overlay.visible {
    display: flex;
}

.rotate-overlay-content {
    text-align: center;
    padding: 40px 30px;
    max-width: 320px;
}

.rotate-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: rotateHint 2s ease-in-out infinite;
}

@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(90deg); }
    75% { transform: rotate(0deg); }
}

.rotate-overlay-content h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #c41e3a;
}

.rotate-overlay-content p {
    font-size: 0.95rem;
    color: #a0a0a0;
    margin-bottom: 24px;
    line-height: 1.5;
}

.rotate-dismiss {
    background: rgba(196, 30, 58, 0.3);
    color: #ffffff;
    border: 1px solid rgba(196, 30, 58, 0.5);
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.rotate-dismiss:hover {
    background: rgba(196, 30, 58, 0.5);
}