/* =====================================================
   Round Robin Tournament View
   ===================================================== */

.rr-page {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding-bottom: 60px;
    margin-top: 2%;
}

/* ── Tabs ──────────────────────────────────────────── */
.rr-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px 16px 0;
}

.rr-tab {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-family: Montserrat, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 16px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.rr-tab:hover {
    background: rgba(255,255,255,0.09);
    color: rgba(255,255,255,0.9);
}

.rr-tab-active {
    background: rgba(99,102,241,0.18);
    border-color: rgba(99,102,241,0.5);
    color: #818cf8;
}

/* ── Layout ────────────────────────────────────────── */
.rr-layout {
    display: flex;
    gap: 20px;
    width: clamp(20rem, 94%, 1200px);
    align-items: flex-start;
}

.rr-matches-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rr-standings-col {
    width: 420px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
}

@media (max-width: 860px) {
    .rr-layout {
        flex-direction: column;
    }
    .rr-standings-col {
        width: 100%;
        position: static;
    }
    .rr-host-controls {
        flex-wrap: wrap;
    }
    .rr-host-danger {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .rr-page {
        gap: 12px;
    }
    .rr-tabs {
        padding: 8px 10px 0;
        gap: 4px;
        width: 100%;
        box-sizing: border-box;
    }
    .rr-tab {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
    .rr-match {
        padding: 12px 14px;
    }
    .rr-matchup {
        gap: 6px;
    }
    .rr-team {
        font-size: 0.82rem;
    }
    .rr-score {
        font-size: 0.95rem;
    }
    .rr-host-controls {
        padding: 12px 14px;
        gap: 10px;
    }
    .rr-host-danger {
        justify-content: center;
    }
    .sf-banner-title {
        font-size: 1.3rem;
    }
    .sf-podium {
        gap: 6px;
        padding: 6px 8px 0;
    }
    .sf-podium-name {
        font-size: 0.78rem;
        max-width: 90px;
    }
}

.rr-col-title {
    font-family: Montserrat, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 4px;
}

.rr-loading,
.rr-empty,
.rr-error {
    color: rgba(255,255,255,0.35);
    font-family: Montserrat, sans-serif;
    font-size: 0.85rem;
    padding: 16px 0;
    text-align: center;
}

.rr-error { color: #f87171; }

/* ── Match card ────────────────────────────────────── */
.rr-match {
    background: #15151b;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 120ms ease;
}

.rr-match:hover {
    border-color: rgba(255,255,255,0.1);
}

.rr-match-done       { border-left: 3px solid rgba(99,102,241,0.35); }
.rr-match-pending    { border-left: 3px solid rgba(255,255,255,0.08); }
.rr-match-inprogress { border-left: 3px solid rgba(250,176,5,0.5); }

.rr-match-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.rr-match-label {
    font-size: 0.65rem;
    color: #4e5261;
    font-family: Montserrat, sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.rr-badge {
    font-family: Montserrat, sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.rr-badge-done       { background: rgba(99,102,241,0.12);  color: #818cf8; }
.rr-badge-draw       { background: rgba(234,179,8,0.12);   color: #ca8a04; }
.rr-badge-pending    { background: rgba(255,255,255,0.05);  color: #4e5261; }
.rr-badge-inprogress { background: rgba(250,176,5,0.12);    color: #fab005; }

.rr-matchup {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rr-team {
    flex: 1;
    font-family: Montserrat, sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    color: #c4c9de;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rr-team-right { text-align: right; }

.rr-team-winner { color: #818cf8; font-weight: 600; }
.rr-team-loser  { color: #5e6378; }
.rr-team-draw   { color: #ca8a04; }

.rr-score-display {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.rr-score {
    font-family: Montserrat, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #7a8099;
    min-width: 24px;
    text-align: center;
}

.rr-score-win  { color: #818cf8; }

@keyframes rrScorePop {
    0%   { transform: scale(1);    text-shadow: none; }
    35%  { transform: scale(1.5);  text-shadow: 0 0 8px #4ade80, 0 0 18px #4ade80; }
    100% { transform: scale(1);    text-shadow: none; }
}
.rr-score-pop {
    animation: rrScorePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    display: inline-block;
}
.rr-score-sep  { color: #333849; font-size: 0.9rem; }

/* ── Score form (captain) ──────────────────────────── */
.rr-score-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 4px;
}

.rr-score-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rr-score-inputs label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: Montserrat, sans-serif;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
}

.rr-score-inputs input[type="number"] {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #fff;
    font-family: Montserrat, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 6px 10px;
    width: 70px;
    text-align: center;
    outline: none;
    transition: border-color 0.15s;
}

.rr-score-inputs input[type="number"]:focus {
    border-color: rgba(99,102,241,0.5);
}

.rr-vs {
    color: rgba(255,255,255,0.25);
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 16px;
}

.rr-btn-submit {
    align-self: flex-start;
    background: rgba(99,102,241,0.15);
    border: 1px solid rgba(99,102,241,0.35);
    border-radius: 8px;
    color: #818cf8;
    cursor: pointer;
    font-family: Montserrat, sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 7px 18px;
    transition: background 0.15s, border-color 0.15s;
}

.rr-btn-submit:hover:not(:disabled) {
    background: rgba(99,102,241,0.25);
    border-color: rgba(99,102,241,0.6);
}

.rr-btn-submit--saving,
.rr-btn-submit:disabled {
    background: rgba(99,102,241,0.07);
    border-color: rgba(99,102,241,0.15);
    color: rgba(129,140,248,0.45);
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Standings table ───────────────────────────────── */
.rr-table-wrapper {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
}

.rr-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Montserrat, sans-serif;
    font-size: 0.8rem;
    background: #15151b;
    border-radius: 16px;
    overflow: hidden;
}

.rr-table thead tr {
    background: #222529a8;
}

.rr-table th {
    color: #4e5261;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    padding: 8px 12px;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.rr-row {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 120ms ease;
}

.rr-row:last-child { border-bottom: none; }

.rr-row td {
    color: #b0b5cc;
    padding: 11px 12px;
    text-align: center;
}

.rr-row:hover td { background: rgba(255,255,255,0.03); }

.rr-rank      { color: #5e6378 !important; font-weight: 600; font-size: 0.8rem; }
.rr-team-name { text-align: left !important; font-weight: 500; color: #c4c9de !important; display:flex; justify-content: space-between;}
.rr-wins      { color: #b0b5cc; font-weight: 600; }
.rr-draws     { color: #b0b5cc; }
.rr-losses    { color: #b0b5cc; }
.rr-pts       { color: #c4c9de; font-weight: 700; }

.rr-row-self td { color: #818cf8 !important; }
.rr-row-self:hover td { background: rgba(99,102,241,0.06) !important; }

/* ── Place colours ─────────────────────────────────── */
.rr-row.place-1 td { color: #fdd064 !important; font-weight: 600; }
.rr-row.place-2 td { color: #dfdfdf !important; font-weight: 600; }
.rr-row.place-3 td { color: #e3b188 !important; font-weight: 600; }
.rr-row.place-1 .rr-team-name,
.rr-row.place-2 .rr-team-name,
.rr-row.place-3 .rr-team-name { font-weight: 600; }

/* ── Host controls ─────────────────────────────────── */
.rr-host-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 14px 20px;
    width: clamp(20rem, 94%, 1200px);
    box-sizing: border-box;
}

.rr-btn-reset-round {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 8px;
    color: #f59e0b;
    cursor: pointer;
    font-family: Montserrat, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 18px;
    transition: background 0.15s, border-color 0.15s;
}

.rr-btn-reset-round:hover:not(:disabled) {
    background: rgba(245,158,11,0.2);
    border-color: rgba(245,158,11,0.55);
}

.rr-btn-reset-round:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rr-host-hint {
    font-family: Montserrat, sans-serif;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.35);
}

/* ── Danger zone ───────────────────────────────────── */
.rr-host-danger {
    display: flex;
    gap: 10px;
    width: clamp(20rem, 94%, 1200px);
    justify-content: flex-end;
}

.rr-host-danger .psBtn--finish {
    background: rgba(34,197,94,0.1);
    border-color: rgba(34,197,94,0.3);
    color: #22c55e;
}

.rr-host-danger .psBtn--cancel {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
}

.rr-host-danger .psBtn--reset-trn {
    background: rgba(245,158,11,0.1);
    border-color: rgba(245,158,11,0.3);
    color: #f59e0b;
}

/* ── Edit score ────────────────────────────────────── */
.rr-edit-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
    margin-left: auto;
    transition: background 0.15s;
}

.rr-edit-btn:hover,
.rr-edit-btn--active {
    background: rgba(255,255,255,0.08);
}

.rr-inline-edit {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 8px;
}

.rr-dual-score-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rr-score-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.rr-score-label {
    font-family: Montserrat, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rr-versus-sep {
    color: rgba(255,255,255,0.25);
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 20px;
}

.rr-score-input-edit {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #fff;
    font-family: Montserrat, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 6px 10px;
    width: 70px;
    text-align: center;
    outline: none;
    transition: border-color 0.15s;
}

.rr-score-input-edit:focus {
    border-color: rgba(99,102,241,0.5);
}

/* ── Score stepper ─────────────────────────────────── */
.edit-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.edit-stepper-minus,
.edit-stepper-plus {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-family: Montserrat, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, border-color 0.12s;
    line-height: 1;
    padding: 0;
}

.edit-stepper-minus:hover:not(:disabled),
.edit-stepper-plus:hover:not(:disabled) {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.25);
}

.edit-stepper-minus:disabled,
.edit-stepper-plus:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.edit-stepper-val {
    font-family: Montserrat, sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    min-width: 28px;
    text-align: center;
}

.rr-draw-hint {
    font-family: Montserrat, sans-serif;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.3);
    margin: 0;
    text-align: center;
}

/* ── Header tooltip ────────────────────────────────── */
.th-tip {
    cursor: default;
    border-bottom: 1px dashed rgba(255,255,255,0.25);
    padding-bottom: 1px;
}

#th-tooltip {
    position: fixed;
    background: #1e2533;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: rgba(255,255,255,0.85);
    font-family: Montserrat, sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    padding: 4px 9px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 9999;
}

#th-tooltip.th-tooltip--visible { opacity: 1; }

/* ── Roster expand ─────────────────────────────────── */
.sr-expand-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    transition: background 0.12s;
}

.sr-expand-btn:hover { background: rgba(255,255,255,0.07); }

.sr-expand-btn img { transition: transform 0.2s; }

.sr-roster-row td {
    padding: 4px 12px 10px !important;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sr-roster {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sr-member {
    font-family: Montserrat, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 20px;
    padding: 3px 10px;
}

.sr-captain {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fab005;
    margin-left: 4px;
}

/* ── Finished panel ────────────────────────────────── */
.sf-banner {
    text-align: center;
    padding: 28px 20px 16px;
}

.sf-banner-label {
    font-family: Montserrat, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
}

.sf-banner-title {
    font-family: Montserrat, sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin: 6px 0 0;
    letter-spacing: 0.02em;
}

.sf-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    padding: 10px 20px 0;
}

.sf-podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 220px;
}

.sf-podium-medal {
    font-size: 2rem;
    margin-bottom: 8px;
}

.sf-podium-name {
    font-family: Montserrat, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-bottom: 4px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sf-podium-record {
    font-family: Montserrat, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    margin-bottom: 10px;
}

.sf-podium-block {
    width: 100%;
    border-radius: 8px 8px 0 0;
}

.sf-block-1 { height: 80px; background: rgba(253,208,100,0.15); border: 1px solid rgba(253,208,100,0.3); border-bottom: none; }
.sf-block-2 { height: 54px; background: rgba(223,223,223,0.08); border: 1px solid rgba(223,223,223,0.2);  border-bottom: none; }
.sf-block-3 { height: 36px; background: rgba(227,177,136,0.08); border: 1px solid rgba(227,177,136,0.2);  border-bottom: none; }

.sf-place-1 .sf-podium-name { color: #fdd064; }
.sf-place-2 .sf-podium-name { color: #dfdfdf; }
.sf-place-3 .sf-podium-name { color: #e3b188; }
