﻿/* ============================================
   TOURNAMENT STAGES - CONSOLIDATED
   Includes:
   - enhanced navigator / progress / stage shell
   - original visualizer styles
   - slider styles for single-stage carousel view
   - RESPONSIVE BREAKPOINTS

   ============================================ */

/* ============================================
   MAIN CONTAINER
   ============================================ */

.tournament-stages-flow {
    width: 100%;
    margin: 0;
    padding: 0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 1.5rem;
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 20px;
    color: #6b7280;
    text-align: center;
}

    .empty-state svg {
        width: 42px;
        height: 42px;
        stroke: #9ca3af;
    }

.tournament-stages-navigator {
    margin-bottom: 1.5rem;
}

/* ============================================
   NAVIGATOR / UINAVIGATOR CONTENT
   ============================================ */

.navigator-stages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    .navigator-stages {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

.nav-stage-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    background: rgba(102, 126, 234, 0.08);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #1f2937;
    text-align: left;
}

    .nav-stage-item:hover {
        background: rgba(102, 126, 234, 0.14);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    }

    .nav-stage-item.active {
        background: white;
        color: #667eea;
        border-color: #c7d2fe;
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.18);
    }

    .nav-stage-item.completed {
        border-left: 4px solid #10b981;
    }

    .nav-stage-item.inprogress {
        border-left: 4px solid #f59e0b;
    }

    .nav-stage-item.notstarted {
        border-left: 4px solid #d1d5db;
    }

.nav-stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.14);
    font-weight: 700;
    flex-shrink: 0;
}

.nav-stage-item.active .nav-stage-icon {
    background: #667eea;
    color: white;
}

.nav-stage-icon svg {
    width: 20px;
    height: 20px;
}

.nav-stage-info {
    flex: 1;
    min-width: 0;
}

.nav-stage-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-stage-meta {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
}

.nav-stage-item.active .nav-stage-meta {
    opacity: 0.7;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f59e0b;
    animation: pulse 2s infinite;
}

/* ============================================
   TOURNAMENT PROGRESS CARD
   ============================================ */

.tournament-progress-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

@media (min-width: 768px) {
    .tournament-progress-card {
        padding: 2rem;
        padding-top: 0rem;
    }
}

    .tournament-progress-card .progress-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
        gap: 1rem;
    }

.progress-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

    .progress-title svg {
        width: 28px;
        height: 28px;
        stroke: #667eea;
    }

    .progress-title h4 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 700;
        color: #111827;
    }

@media (min-width: 768px) {
    .progress-title h4 {
        font-size: 1.5rem;
    }
}

.progress-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: #e5e7eb;
}

.progress-percentage {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 768px) {
    .progress-percentage {
        font-size: 2.5rem;
    }
}

.progress-bar-container {
    position: relative;
}

.progress-bar-container.mb-stages {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 16px;
    background: linear-gradient(to right, #f3f4f6, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    background-size: 200% 100%;
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    animation: shimmer 3s ease infinite;
}

.progress-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shine 2s infinite;
}

.progress-milestones {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.milestone {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 500;
}

.progress-stages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

@media (min-width: 576px) {
    .progress-stages-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

.progress-stage-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    width: 100%;
    text-align: left;
}

    .progress-stage-card:hover {
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.10);
    }

    .progress-stage-card.active {
        outline: 2px solid rgba(59, 130, 246, 0.35);
        border-radius: 16px;
    }

    .progress-stage-card.completed {
        background: linear-gradient(135deg, #d1fae5, #a7f3d0);
        border-color: #10b981;
    }

    .progress-stage-card.in-progress {
        background: linear-gradient(135deg, #fef3c7, #fde68a);
        border-color: #f59e0b;
        animation: pulse 2s infinite;
    }

    .progress-stage-card.not-started {
        background: white;
    }

.stage-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.stage-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: lightgray;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-stage-card.completed .stage-icon {
    background: #10b981;
    color: white;
}

.progress-stage-card.in-progress .stage-icon {
    background: #f59e0b;
    color: white;
}

.stage-icon svg {
    width: 18px;
    height: 18px;
}

.stage-number {
    font-weight: 700;
    font-size: 0.9rem;
}

.stage-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: lightgray;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-stage-card.completed .stage-status-badge {
    background: #065f46;
    color: white;
}

.progress-stage-card.in-progress .stage-status-badge {
    background: #92400e;
    color: white;
}

.stage-card-body {
    margin-top: 0.75rem;
}

.stage-label {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.stage-mini-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #4b5563;
    font-weight: 500;
}

    .mini-stat svg {
        width: 14px;
        height: 14px;
        stroke: #9ca3af;
    }

/* ============================================
   SLIDER
   ============================================ */

.stages-slider {
    /*margin-top: 1.5rem;*/
}

/* Mobile-only nav bar — hidden on desktop */
.mobile-stage-nav {
    display: none;
}

.slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.slider-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    border-radius: 14px;
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: #1f2937;
    color: white;
}

@media (min-width: 576px) {
    .slider-nav-btn {
        padding: 0.85rem 1rem;
        font-size: 1rem;
    }
}

    .slider-nav-btn:hover:not(:disabled) {
        transform: translateY(-1px);
    }

    .slider-nav-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.slider-counter {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    font-size: 0.875rem;
    color: #111827;
}

@media (min-width: 576px) {
    .slider-counter {
        font-size: 1rem;
    }
}

.slider-counter-label {
    opacity: 0.7;
    font-weight: 500;
}

.slider-stage-shell {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
}

.active-stage {
    animation: stageFadeIn 0.25s ease;
}

.slider-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.75;
    background: #cbd5e1;
}

    .slider-dot.active {
        width: 28px;
        opacity: 1;
        background: #2563eb;
    }

.stage-footer-summary {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-right: 10px;
    padding-bottom: 10px;
}

.stage-footer-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

/* ============================================
   STAGE SHELL
   ============================================ */

.stage-container {
    position: relative;
    scroll-margin-top: 100px;
}

.stage-wrapper {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border: 2px solid #e5e7eb;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

    .stage-wrapper:hover {
        box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
    }

    .stage-wrapper.type-knockout {
        border-top: 6px solid #ef4444;
    }

    .stage-wrapper.type-roundrobin {
        border-top: 6px solid #3b82f6;
    }

    .stage-wrapper.type-group {
        border-top: 6px solid #10b981;
    }

    .stage-wrapper.type-stepladder {
        border-top: 6px solid #8b5cf6;
    }

    .stage-wrapper.type-manual {
        border-top: 6px solid #f59e0b;
    }

    .stage-wrapper.type-custom {
        border-top: 6px solid #6366f1;
    }

.stage-card-header-main {
    background: linear-gradient(to right, #f9fafb, #ffffff);
    padding: 1rem;
    border-bottom: 2px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (min-width: 768px) {
    .stage-card-header-main {
        padding: 2rem;
        gap: 1.5rem;
    }
}

.stage-header-left {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    flex: 1;
    min-width: 0;
}

.stage-badges-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.stage-order-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-align: center;
}

.stage-title-group {
    flex: 1;
    min-width: 0;
}

    .stage-title-group h2 {
        margin: 0 0 0.5rem;
        font-size: 1.25rem;
        font-weight: 800;
        color: #111827;
    }

@media (min-width: 576px) {
    .stage-title-group h2 {
        font-size: 1.5rem;
    }
}

@media (min-width: 768px) {
    .stage-title-group h2 {
        font-size: 2rem;
    }
}

.stage-description {
    margin: 0;
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.5;
}

.stage-header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.stage-type-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #4b5563;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

    .stage-type-badge svg {
        width: 20px;
        height: 20px;
        stroke: #9ca3af;
    }

.stage-status-badge-large {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

    .stage-status-badge-large.badge-notstarted {
        background: #f3f4f6;
        color: #6b7280;
    }

    .stage-status-badge-large.badge-inprogress {
        background: #fef3c7;
        color: #92400e;
        box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.2);
        animation: pulse 2s infinite;
    }

    .stage-status-badge-large.badge-completed {
        background: #d1fae5;
        color: #065f46;
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
    }

    .stage-status-badge-large svg,
    .spinner-tiny {
        width: 18px;
        height: 18px;
    }

.spinner-tiny {
    border: 2px solid #fde68a;
    border-top-color: #92400e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Context strip — shown on branch child stages and filter-successor stages */
.stage-context-strip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.25rem;
    background: linear-gradient(to right, #eef2ff, #f5f3ff);
    border-bottom: 1px solid #e0e7ff;
    border-left: 3px solid #667eea;
    font-size: 0.775rem;
    font-weight: 600;
    color: #4338ca;
    letter-spacing: 0.15px;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .stage-context-strip {
        padding: 0.45rem 2rem;
        font-size: 0.8rem;
    }
}

.stage-context-strip svg {
    flex-shrink: 0;
    stroke: #667eea;
    opacity: 0.85;
}

.stage-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: #f3f4f6;
    border-bottom: 2px solid #f3f4f6;
}

@media (min-width: 768px) {
    .stage-stats-bar {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

.stat-box {
    background: white;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    .stat-box {
        padding: 1.25rem;
        gap: 1rem;
    }
}

    .stat-box:hover {
        background: #f9fafb;
    }

    .stat-box.success {
        background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    }

    .stat-box svg {
        width: 20px;
        height: 20px;
        stroke: #667eea;
        flex-shrink: 0;
    }

@media (min-width: 768px) {
    .stat-box svg {
        width: 28px;
        height: 28px;
    }
}

    .stat-box.success svg {
        stroke: #10b981;
    }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-box .stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: #111827;
    line-height: 1;
    margin-bottom: 0.25rem;
}

@media (min-width: 576px) {
    .stat-box .stat-value {
        font-size: 1.25rem;
    }
}

@media (min-width: 768px) {
    .stat-box .stat-value {
        font-size: 1.5rem;
    }
}

.stat-box .stat-label {
    font-size: 0.6rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (min-width: 576px) {
    .stat-box .stat-label {
        font-size: 0.65rem;
        letter-spacing: 0.4px;
    }
}

@media (min-width: 768px) {
    .stat-box .stat-label {
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }
}

.stage-content-wrapper {
    padding: 1rem;
    background: #fafbfc;
}

@media (min-width: 768px) {
    .stage-content-wrapper {
        padding: 2rem;
    }
}

/* ============================================
   LEGACY TIMELINE / CONNECTOR
   kept for compatibility if reused elsewhere
   ============================================ */

.stages-timeline {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.stage-flow-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    position: relative;
}

.connector-decoration {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.connector-line {
    width: 4px;
    height: 60px;
    background: linear-gradient(to bottom, #667eea, #764ba2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.connector-pulse {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #667eea;
    animation: pulse-move 3s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

.connector-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    color: white;
}

.connector-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .connector-icon svg {
        width: 20px;
        height: 20px;
    }

.connector-text {
    display: flex;
    flex-direction: column;
}

.connector-count {
    font-size: 1.125rem;
    font-weight: 700;
}

.connector-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* ============================================
   BASE VISUALIZER
   ============================================ */

.stage-visualizer {
    padding: 1.5rem;
}

.stage-visualizer-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.stage-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.stage-name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.stage-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-notstarted {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-inprogress {
    background: #fef3c7;
    color: #92400e;
}

.badge-completed {
    background: #d1fae5;
    color: #065f46;
}

.stage-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
}

    .meta-item svg {
        width: 16px;
        height: 16px;
        stroke: #9ca3af;
    }

.meta-label {
    font-weight: 500;
}

.meta-value {
    font-weight: 600;
    color: #111827;
}

/* legacy type helpers */
.stage-knockout {
    border-left: 4px solid #ef4444;
}

.stage-roundrobin {
    border-left: 4px solid #3b82f6;
}

.stage-group {
    border-left: 4px solid #10b981;
}

.stage-stepladder {
    border-left: 4px solid #8b5cf6;
}

.stage-manual {
    border-left: 4px solid #f59e0b;
}

.stage-swiss {
    border-left: 4px solid #ec4899;
}

.stage-doubleelim {
    border-left: 4px solid #6366f1;
}

/* ============================================
   DOUBLE ELIMINATION VISUALIZER
   ============================================ */

.double-knockout-stage {
    padding: 0.5rem 0;
}

.double-elim-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    color: #1d4ed8;
    font-size: 0.875rem;
    line-height: 1.5;
}

.double-elim-info svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.bracket-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.bracket-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.875rem;
    border-bottom: 2px solid #e5e7eb;
}

.bracket-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.bracket-header h4 svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.bracket-header.championship h4 {
    color: #b45309;
}

.bracket-header.championship {
    border-bottom-color: #fde68a;
}

.bracket-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
    padding-left: 26px; /* align under the text, after icon */
}

.winners-bracket .bracket-header h4 {
    color: #065f46;
}

.winners-bracket .bracket-header {
    border-bottom-color: #a7f3d0;
}

.losers-bracket .bracket-header h4 {
    color: #1e3a8a;
}

.losers-bracket .bracket-header {
    border-bottom-color: #bfdbfe;
}

.grand-finals-matches {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.grand-finals-match-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bracket-reset-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bracket-reset-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.stage-progress-summary {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
}

.progress-stat {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
    min-width: 140px;
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-icon.winners {
    background: #d1fae5;
    color: #065f46;
}

.stat-icon.losers {
    background: #dbeafe;
    color: #1e3a8a;
}

.stat-icon.finals {
    background: #fef3c7;
    color: #b45309;
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.stat-details .stat-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.stat-details .stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
}

/* ============================================
   KNOCKOUT VISUALIZER
   ============================================ */

.knockout-bracket {
    padding: 1rem 0;
}

.bracket-container {
    display: flex;
    gap: 3rem;
    overflow-x: auto;
    padding: 1rem;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    min-width: 280px;
}

.bracket-round-label {
    font-weight: 700;
    font-size: 1.125rem;
    color: #111827;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.bracket-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    gap: 2rem;
}

.bracket-match {
    position: relative;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

    .bracket-match:hover {
        border-color: #3b82f6;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    }

    .bracket-match.completed {
        border-color: #d1fae5;
        background: #f0fdf4;
    }

.bracket-matchup {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    transition: all 0.2s ease;
}

    .bracket-team.winner {
        background: #d1fae5;
        font-weight: 700;
        border: 2px solid #10b981;
    }

    .bracket-team.tbd {
        opacity: 0.5;
        font-style: italic;
    }

    .bracket-team .team-name {
        flex: 1;
        font-size: 0.95rem;
    }

    .bracket-team .team-score {
        font-weight: 700;
        font-size: 1.125rem;
        color: #111827;
        min-width: 40px;
        text-align: right;
    }

.bracket-match-date {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
}

/* ============================================
   ROUND ROBIN VISUALIZER
   ============================================ */

.roundrobin-table {
    padding: 1rem 0;
}

.roundrobin-standings {
    margin-bottom: 2rem;
}

    .roundrobin-standings h4,
    .roundrobin-matches h4,
    .custom-round h4 {
        margin: 0 0 1rem;
        font-size: 1.125rem;
        font-weight: 700;
        color: #111827;
    }

.standings-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

    .standings-table thead {
        background: #f9fafb;
    }

    .standings-table th,
    .standings-table td {
        padding: 0.75rem;
        text-align: left;
    }

    .standings-table th {
        font-weight: 600;
        font-size: 0.875rem;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .standings-table tbody tr {
        border-bottom: 1px solid #f3f4f6;
        transition: background 0.2s ease;
    }

        .standings-table tbody tr:hover {
            background: #f9fafb;
        }

        .standings-table tbody tr.qualified {
            background: #f0fdf4;
            border-left: 4px solid #10b981;
        }

.pos-col {
    width: 50px;
    text-align: center;
    font-weight: 700;
}

.team-col {
    min-width: 200px;
}

.stat-col {
    width: 60px;
    text-align: center;
}

    .stat-col.positive {
        color: #10b981;
        font-weight: 600;
    }

    .stat-col.negative {
        color: #ef4444;
        font-weight: 600;
    }

.qualified-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0fdf4;
    border: 1px solid #d1fae5;
    border-radius: 8px;
    color: #065f46;
    font-size: 0.875rem;
}

    .qualified-note svg {
        width: 20px;
        height: 20px;
        stroke: #10b981;
    }

.roundrobin-matches {
    margin-top: 2rem;
}

.round-group {
    margin-bottom: 1.5rem;
}

    .round-group h5,
    .group-matches h5 {
        margin: 0 0 0.75rem;
        font-size: 1rem;
        font-weight: 600;
        color: #4b5563;
    }

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rr-match {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s ease;
}

    .rr-match:hover {
        border-color: #3b82f6;
        box-shadow: 0 2px 6px rgba(59, 130, 246, 0.1);
    }

    .rr-match.completed {
        background: #f9fafb;
    }

    .rr-match .match-teams {
        display: flex;
        align-items: center;
        gap: 1rem;
        flex: 1;
    }

    .rr-match .team {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .rr-match .team-name {
        font-size: 0.95rem;
    }

    .rr-match .team-score {
        font-weight: 700;
        font-size: 1.125rem;
        padding: 0.25rem 0.5rem;
        background: #f3f4f6;
        border-radius: 4px;
    }

        .rr-match .team-score.winner {
            background: #d1fae5;
            color: #065f46;
        }

    .rr-match .vs {
        color: #9ca3af;
        font-weight: 600;
        font-size: 0.75rem;
    }

    .rr-match .match-status {
        font-size: 0.75rem;
    }

/* ============================================
   GROUP STAGE VISUALIZER
   ============================================ */

.group-stage {
    padding: 1rem 0;
}

.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.group-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

    .group-card:hover {
        border-color: #10b981;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    }

.group-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 1rem 1.5rem;
}

    .group-header h4 {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 700;
    }

.group-standings {
    padding: 1rem;
}

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

    .group-table thead {
        background: #f9fafb;
    }

    .group-table th,
    .group-table td {
        padding: 0.5rem;
        text-align: left;
        font-size: 0.875rem;
    }

    .group-table th {
        font-weight: 600;
        color: #6b7280;
    }

    .group-table tbody tr {
        border-bottom: 1px solid #f3f4f6;
    }

        .group-table tbody tr.qualified {
            background: #f0fdf4;
            font-weight: 600;
        }

.group-matches {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.group-match {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

    .group-match.completed {
        background: #f0fdf4;
        border-color: #d1fae5;
    }

    .group-match .match-info {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        font-size: 0.875rem;
    }

    .group-match .score {
        font-weight: 700;
        color: #111827;
    }

    .group-match .vs {
        color: #9ca3af;
        font-size: 0.75rem;
    }

/* ============================================
   STEPLADDER VISUALIZER
   ============================================ */

.stepladder-bracket {
    padding: 1rem 0;
}

.stepladder-explanation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
    margin-bottom: 2rem;
    color: #92400e;
}

    .stepladder-explanation svg {
        width: 24px;
        height: 24px;
        stroke: #d97706;
        flex-shrink: 0;
    }

    .stepladder-explanation p {
        margin: 0;
        font-size: 0.875rem;
    }

.stepladder-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 800px;
    margin: 0 auto;
}

.stepladder-step {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    transition: all 0.2s ease;
}

    .stepladder-step:hover {
        border-color: #8b5cf6;
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    }

    .stepladder-step.completed {
        border-color: #d1fae5;
        background: #f0fdf4;
    }

    .stepladder-step.championship {
        border: 3px solid #fbbf24;
        background: linear-gradient(135deg, #fef3c7, #ffffff);
        box-shadow: 0 8px 20px rgba(251, 191, 36, 0.3);
    }

.step-number {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: #8b5cf6;
}

.stepladder-step.championship .step-number {
    color: #d97706;
}

.step-number svg {
    width: 24px;
    height: 24px;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step-matchup {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

    .step-team.winner {
        background: #d1fae5;
        border-color: #10b981;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
    }

    .step-team.tbd {
        opacity: 0.5;
        font-style: italic;
    }

    .step-team .team-info {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
    }

    .step-team .team-name {
        font-size: 1rem;
        font-weight: 600;
    }

    .step-team .team-seed {
        padding: 0.25rem 0.5rem;
        background: #e5e7eb;
        border-radius: 4px;
        font-size: 0.75rem;
        font-weight: 700;
        color: #4b5563;
    }

    .step-team .team-score {
        font-size: 1.5rem;
        font-weight: 700;
        color: #111827;
    }

.step-vs {
    text-align: center;
    font-weight: 700;
    color: #9ca3af;
    font-size: 0.875rem;
}

.step-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.match-date {
    font-size: 0.875rem;
    color: #6b7280;
}

.step-advancement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1e40af;
}

    .step-advancement svg {
        width: 16px;
        height: 16px;
        stroke: #3b82f6;
    }

.step-connector {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

    .step-connector svg {
        width: 20px;
        height: 60px;
        color: #d1d5db;
    }

/* ============================================
   MANUAL STAGE VISUALIZER
   ============================================ */

.manual-stage {
    padding: 1rem 0;
}

.manual-stage-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
    margin-bottom: 2rem;
    color: #92400e;
}

    .manual-stage-info svg {
        width: 24px;
        height: 24px;
        stroke: #d97706;
        flex-shrink: 0;
    }

    .manual-stage-info p {
        margin: 0;
        font-size: 0.875rem;
    }

.manual-matches-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.date-group {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.date-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

    .date-header svg {
        width: 20px;
        height: 20px;
        stroke: #6b7280;
    }

    .date-header h4 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 700;
        color: #111827;
    }

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.manual-match {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

    .manual-match:hover {
        border-color: #f59e0b;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
    }

    .manual-match.completed {
        border-color: #d1fae5;
        background: #f0fdf4;
    }

    .manual-match .match-time {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
        color: #6b7280;
        font-size: 0.875rem;
    }

        .manual-match .match-time svg {
            width: 16px;
            height: 16px;
        }

    .manual-match .match-number {
        font-size: 0.75rem;
        font-weight: 600;
        color: #9ca3af;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 0.5rem;
    }

    .manual-match .match-teams {
        margin-bottom: 0.75rem;
    }

    .manual-match .team-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        background: #f9fafb;
        border-radius: 4px;
        margin-bottom: 0.25rem;
    }

        .manual-match .team-row.winner {
            background: #d1fae5;
            font-weight: 700;
        }

    .manual-match .versus {
        text-align: center;
        color: #9ca3af;
        font-weight: 600;
        font-size: 0.75rem;
        padding: 0.25rem 0;
    }

    .manual-match .match-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 0.75rem;
        border-top: 1px solid #e5e7eb;
    }

    .manual-match .match-location {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        font-size: 0.75rem;
        color: #6b7280;
    }

        .manual-match .match-location svg {
            width: 14px;
            height: 14px;
        }

/* ============================================
   CUSTOM STAGE VISUALIZER
   ============================================ */

.custom-stage {
    padding: 1rem 0;
}

.custom-stage-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #ede9fe;
    border: 1px solid #ddd6fe;
    border-radius: 8px;
    margin-bottom: 2rem;
    color: #5b21b6;
}

    .custom-stage-info svg {
        width: 24px;
        height: 24px;
        stroke: #7c3aed;
        flex-shrink: 0;
    }

    .custom-stage-info p {
        margin: 0;
        font-size: 0.875rem;
    }

.custom-round {
    margin-bottom: 2rem;
}

.custom-matches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.custom-match {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

    .custom-match:hover {
        border-color: #8b5cf6;
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    }

    .custom-match.completed {
        background: #f0fdf4;
        border-color: #d1fae5;
    }

    .custom-match .match-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #e5e7eb;
    }

    .custom-match .match-number {
        font-size: 0.875rem;
        font-weight: 600;
        color: #4b5563;
    }

    .custom-match .match-matchup {
        margin-bottom: 0.75rem;
    }

    .custom-match .team-line {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        background: #f9fafb;
        border-radius: 4px;
        margin-bottom: 0.25rem;
    }

    .custom-match .team-score.winner {
        background: #d1fae5;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-weight: 700;
    }

    .custom-match .vs-line {
        text-align: center;
        color: #9ca3af;
        font-weight: 600;
        font-size: 0.75rem;
        padding: 0.25rem 0;
    }

    .custom-match .match-date {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid #e5e7eb;
        font-size: 0.875rem;
        color: #6b7280;
    }

        .custom-match .match-date svg {
            width: 16px;
            height: 16px;
        }

/* ============================================
   SPINNERS / ANIMATIONS
   ============================================ */

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #fde68a;
    border-top-color: #d97706;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes shine {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.85;
        transform: scale(1.02);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-move {
    0%, 100% {
        top: 0;
        opacity: 0;
    }

    50% {
        top: 50%;
        opacity: 1;
    }
}

@keyframes stageFadeIn {
    from {
        opacity: 0;
        transform: translateX(14px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .navigator-stages {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .progress-stages-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .stage-stats-bar {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .bracket-container {
        gap: 2rem;
    }

    .bracket-round {
        min-width: 240px;
    }

    .groups-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tournament-progress-card {
        display: none;
    }

    /* Grid-based layouts collapse to 1 column except stats bar (2-col) */
    .progress-stages-grid,
    .matches-grid {
        grid-template-columns: 1fr;
    }

    /* Stats bar: 2x grid so 4 stats = 2 rows of 2 instead of 4 tall rows */
    .stage-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tighten the UiNavigator card to just be a slim pill container */
    .tournament-stages-navigator .ui-navigator {
        padding: 0.625rem 0.75rem;
        border-radius: 12px;
        margin-bottom: 0.75rem;
        box-shadow: none;
    }

    .tournament-stages-navigator .ui-navigator-header {
        display: none;
    }

    .tournament-stages-navigator .ui-navigator-content {
        margin-top: 0;
    }

    /* Hide the whole desktop navigator — replaced by mobile-stage-nav below */
    .tournament-stages-navigator {
        display: none;
    }

    /* Mobile stage navigator: ‹ Stage Name  2/4  › */
    .mobile-stage-nav {
        display: flex;
        align-items: center;
        gap: 0;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 0.75rem;
        overflow: hidden;
    }

    .msn-arrow {
        flex-shrink: 0;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        cursor: pointer;
        color: #334155;
        transition: background 0.15s;
    }

    .msn-arrow:disabled {
        color: #cbd5e1;
        cursor: default;
    }

    .msn-arrow:not(:disabled):active {
        background: #f1f5f9;
    }

    .msn-arrow svg {
        width: 20px;
        height: 20px;
    }

    .msn-center {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border-left: 1px solid #e2e8f0;
        border-right: 1px solid #e2e8f0;
        padding: 8px 4px;
        min-width: 0;
    }

    .msn-name {
        font-size: 14px;
        font-weight: 700;
        color: #1e293b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .msn-counter {
        font-size: 11px;
        color: #94a3b8;
        font-weight: 500;
        margin-top: 1px;
    }

    /* Stage navigator: compact pill strip (removed — replaced by mobile-stage-nav) */
    .navigator-stages {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding: 2px 0 6px;
        scrollbar-width: none;
        margin-top: 0.25rem;
    }

    .navigator-stages::-webkit-scrollbar {
        display: none;
    }

    /* Pill: just the name, no icon, no meta */
    .nav-stage-item {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 6px 14px;
        min-width: unset;
        max-width: unset;
        flex-shrink: 0;
        border-radius: 20px;
        background: #f1f5f9;
        border: 1.5px solid transparent;
        box-shadow: none;
        transform: none !important;
    }

    .nav-stage-item:hover {
        background: #e2e8f0;
        transform: none !important;
        box-shadow: none;
    }

    .nav-stage-item.active {
        background: #eff6ff;
        border-color: #93c5fd;
        color: #1d4ed8;
        box-shadow: none;
    }

    .nav-stage-item.completed {
        border-left-width: 1.5px;
        border-color: #6ee7b7;
    }

    .nav-stage-item.inprogress {
        border-left-width: 1.5px;
        border-color: #fcd34d;
    }

    /* Hide icon — pill is text only */
    .nav-stage-icon {
        display: none;
    }

    .nav-stage-info {
        text-align: left;
    }

    .nav-stage-name {
        font-size: 0.8rem;
        font-weight: 600;
        white-space: nowrap;
        margin-bottom: 0;
    }

    /* Hide match count meta */
    .nav-stage-meta {
        display: none;
    }

    /* Tighten stage card header */
    .stage-card-header-main {
        padding: 1rem;
    }

    .stage-header-left {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Show type badge inline with order badge to save vertical space */
    .stage-badges-group {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .stage-order-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
    }

    .stage-type-badge {
        padding: 0.35rem 0.75rem;
        font-size: 0.75rem;
    }

    .stage-type-badge svg {
        width: 14px;
        height: 14px;
    }

    .stage-status-badge-large {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }

    .stage-title-group h2 {
        font-size: 1.25rem;
    }

    .stage-content-wrapper,
    .stage-visualizer {
        padding: 1rem;
    }

    .stat-box {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .stat-box svg {
        width: 18px;
        height: 18px;
    }

    .bracket-container {
        gap: 1.5rem;
    }

    .bracket-round {
        min-width: 200px;
    }

    .stepladder-steps {
        padding: 0;
    }

    .slider-header {
        flex-direction: column;
        align-items: stretch;
    }

    .slider-counter {
        justify-content: center;
    }

    .progress-title h4 {
        font-size: 1.25rem;
    }

    .progress-percentage {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .tournament-progress-card .progress-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .progress-stats {
        width: 100%;
        justify-content: space-between;
    }

    .connector-info {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .stage-footer-summary {
        justify-content: center;
    }

    /* Very small screens: stats bar also 1 col */
    .stage-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .stage-card-header-main {
        padding: 0.875rem;
    }

    .stage-title-group h2 {
        font-size: 1.1rem;
    }

    .stage-content-wrapper,
    .stage-visualizer {
        padding: 0.875rem;
    }
}

/* ============================================
   MOBILE MATCH ROW — hidden by default, shown only inside stages on mobile
   ============================================ */

.match-row-mobile {
    display: none;
}

@media (max-width: 768px) {
    /* Swap: hide card, show compact row */
    .tournament-stages-flow .match-card-wrapper .ui-match-card {
        display: none;
    }

    .tournament-stages-flow .match-row-mobile {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        border-bottom: 1px solid #f1f5f9;
        min-width: 0;
    }

    .tournament-stages-flow .match-card-wrapper:last-child .match-row-mobile {
        border-bottom: none;
    }

    /* Wrap all matches in a clean rounded list container */
    .tournament-stages-flow .row.g-3,
    .tournament-stages-flow .row.g-2 {
        background: #ffffff;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
        margin: 0 !important;
        padding: 0;
        overflow: hidden;
    }

    .tournament-stages-flow .row.g-3 > [class*="col-"],
    .tournament-stages-flow .row.g-2 > [class*="col-"] {
        padding: 0 !important;
    }

    /* Match number */
    .mrm-num {
        font-size: 10px;
        font-weight: 700;
        color: #94a3b8;
        flex-shrink: 0;
        min-width: 22px;
        letter-spacing: 0.02em;
    }

    /* Team names — equal flex, truncate */
    .mrm-team {
        flex: 1;
        font-size: 13px;
        font-weight: 600;
        color: #334155;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

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

    .mrm-team.winner {
        color: #059669;
        font-weight: 700;
    }

    /* Score block — centered, fixed width */
    .mrm-score-block {
        display: flex;
        align-items: center;
        gap: 3px;
        flex-shrink: 0;
    }

    .mrm-score {
        font-size: 15px;
        font-weight: 800;
        color: #1e293b;
        min-width: 26px;
        text-align: center;
        line-height: 1;
    }

    .mrm-score.winner {
        color: #059669;
    }

    .mrm-score.mrm-score-empty {
        color: #cbd5e1;
        font-weight: 400;
    }

    .mrm-dash {
        font-size: 11px;
        font-weight: 600;
        color: #94a3b8;
        padding: 0 1px;
    }

    /* Status dot */
    .mrm-status-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        flex-shrink: 0;
        background: #cbd5e1;
    }

    .mrm-status-dot.completed {
        background: #10b981;
    }

    .mrm-status-dot.inprogress {
        background: #f59e0b;
        box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
    }

    .mrm-status-dot.scheduled {
        background: #60a5fa;
    }

    .mrm-status-dot.cancelled {
        background: #f87171;
    }

    /* Games link */
    .tournament-stages-flow .match-games-toggle {
        padding: 4px 12px 8px;
    }

    .tournament-stages-flow .games-link-btn {
        font-size: 11px;
        color: #4f46e5;
        background: none;
        border: none;
        box-shadow: none;
        padding: 0;
    }
}