/**
 * Apex Play Off - Frontend Stylesheet (Obsidian & Kinetic Red Theme)
 * 5-Column x 5-Band Horizontal Layout
 * Designed for Kinetic Seven Theme.
 */

:root {
    --apex-surface-0: #0a0a0a;
    --apex-surface-1: #121212;
    --apex-surface-2: #181818;
    --apex-surface-3: #262626;
    --apex-surface-4: #333333;
    
    --apex-red: #990000;
    --apex-red-hover: #b82014;
    --apex-neon-red: #ff2e24;
    --apex-red-glow: rgba(153, 0, 0, 0.45);
    
    --apex-gold: #d4af37;
    --apex-gold-bright: #ffd700;
    --apex-gold-glow: rgba(212, 175, 55, 0.35);
    
    --apex-silver: #94a3b8;
    --apex-bronze: #cd7f32;
    
    --apex-text-high: #ffffff;
    --apex-text-med: #e5e2e1;
    --apex-text-low: #8e8b8a;
    
    --apex-font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --apex-font-body: 'Lexend', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base Wrapper */
.apex-playoff-wrapper {
    background: var(--apex-surface-0);
    background-image: 
        radial-gradient(circle at 50% 30%, rgba(153, 0, 0, 0.08) 0%, transparent 60%),
        linear-gradient(to bottom, var(--apex-surface-0), #080808);
    color: var(--apex-text-high);
    padding: 24px 16px;
    border: 1px solid var(--apex-surface-3);
    font-family: var(--apex-font-body);
    box-sizing: border-box;
    margin: 25px 0;
    position: relative;
    overflow: hidden;
    width: 100%;
}

/* Empty State */
.apex-playoff-empty {
    background: var(--apex-surface-1);
    border: 1px dashed var(--apex-surface-3);
    padding: 40px 20px;
    text-align: center;
    color: var(--apex-text-low);
    font-size: 15px;
}

/* Cup Tabs */
.apex-cup-tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--apex-surface-4) var(--apex-surface-0);
}

.apex-cup-tab-btn {
    background: var(--apex-surface-2);
    border: 1px solid var(--apex-surface-3);
    color: var(--apex-text-med);
    font-family: var(--apex-font-display);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 0;
}

.apex-cup-tab-btn:hover {
    background: var(--apex-surface-3);
    color: var(--apex-text-high);
    border-color: var(--apex-surface-4);
}

.apex-cup-tab-btn.active {
    background: var(--apex-red);
    color: #fff;
    border-color: var(--apex-neon-red);
    box-shadow: 0 0 15px var(--apex-red-glow);
}

.apex-cup-tab-btn.cup-gold.active {
    background: linear-gradient(135deg, #b8860b 0%, #d4af37 100%);
    border-color: #ffd700;
    color: #000;
    text-shadow: none;
}

.apex-cup-tab-btn.cup-silver.active {
    background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
    border-color: #cbd5e1;
    color: #000;
}

.apex-cup-tab-btn.cup-bronze.active {
    background: linear-gradient(135deg, #92400e 0%, #cd7f32 100%);
    border-color: #f59e0b;
    color: #fff;
}

/* Cup Header */
.apex-cup-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--apex-surface-3);
    padding-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.apex-cup-heading {
    font-family: var(--apex-font-display) !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--apex-text-high) !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.apex-cup-gold-bar {
    width: 5px;
    height: 22px;
    background: var(--apex-red);
    display: inline-block;
}

.apex-btn-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--apex-surface-2, #181818);
    border: 1px solid var(--apex-surface-3, #262626);
    color: var(--apex-text-med, #e5e2e1);
    padding: 6px 14px;
    font-family: var(--apex-font-display, inherit);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 4px;
    line-height: 1.2;
}

.apex-btn-view-toggle:hover {
    background: var(--apex-surface-3, #262626);
    border-color: var(--apex-red, #990000);
    color: var(--apex-text-high, #ffffff);
    box-shadow: 0 0 14px var(--apex-red-glow, rgba(153, 0, 0, 0.4));
    transform: translateY(-1px);
}

.apex-btn-view-toggle:active {
    transform: translateY(0);
}

.apex-btn-view-toggle.is-calendar-active {
    background: var(--apex-surface-3, #262626);
    border-color: var(--apex-gold, #c5a059);
    color: var(--apex-gold-bright, #ffd700);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.25);
}

.apex-btn-view-toggle.is-calendar-active:hover {
    border-color: var(--apex-gold-bright, #ffd700);
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.4);
}

.apex-toggle-svg {
    stroke: currentColor;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.apex-btn-view-toggle:hover .apex-toggle-svg {
    transform: rotate(15deg);
}

/* View Containers */
.apex-view-container {
    width: 100%;
    position: relative;
}

/* SportsPress Native Event Blocks in Obsidian Dark Wrapper */
.apex-sp-calendar-wrapper {
    width: 100%;
    padding: 15px 0 25px 0;
    box-sizing: border-box;
}

.apex-sp-calendar-wrapper .sp-template-event-blocks {
    margin: 0 !important;
}

.apex-sp-calendar-wrapper .sp-event-blocks {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.apex-sp-calendar-wrapper .sp-event-blocks > li,
.apex-sp-calendar-wrapper .sp-event-block {
    background: var(--apex-surface-1, #131313) !important;
    border: 1px solid var(--apex-surface-3, #262626) !important;
    border-radius: 6px !important;
    padding: 14px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    flex: 1 1 calc(33.333% - 16px) !important;
    min-width: 260px !important;
    box-sizing: border-box !important;
}

.apex-sp-calendar-wrapper .sp-event-blocks > li:hover,
.apex-sp-calendar-wrapper .sp-event-block:hover {
    border-color: var(--apex-red, #990000) !important;
    box-shadow: 0 0 18px var(--apex-red-glow, rgba(153, 0, 0, 0.35)) !important;
    transform: translateY(-2px) !important;
}

/* Fallback Notice when no calendar configured */
.apex-no-calendar-notice {
    background: var(--apex-surface-1, #131313);
    border: 1px dashed var(--apex-surface-3, #262626);
    border-radius: 6px;
    padding: 35px 20px;
    text-align: center;
    margin: 20px 0;
}

.apex-no-calendar-notice .apex-notice-icon {
    font-size: 32px;
    margin-bottom: 12px;
    line-height: 1;
}

.apex-no-calendar-notice .apex-notice-title {
    font-family: var(--apex-font-display, inherit);
    font-size: 16px;
    font-weight: 700;
    color: var(--apex-text-high, #ffffff);
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apex-no-calendar-notice .apex-notice-desc {
    font-size: 13px;
    color: var(--apex-text-low, #8e8b8a);
    margin: 0 auto;
    max-width: 500px;
    line-height: 1.5;
}

/* ==========================================================================
   5-COLUMN x 5-BAND HORIZONTAL TOURNAMENT GRID (ONE-SCREEN VIEW)
   ========================================================================== */
.apex-5x5-bracket-wrapper {
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 10px 0 25px 0 !important;
    box-sizing: border-box !important;
    scrollbar-width: thin;
    scrollbar-color: var(--apex-surface-4) var(--apex-surface-0);
    -webkit-overflow-scrolling: touch;
}

.apex-5x5-bracket-grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(170px, 1fr)) !important;
    grid-template-rows: 40px repeat(5, minmax(90px, auto)) !important;
    column-gap: 28px !important;
    row-gap: 16px !important;
    width: 100% !important;
    max-width: 1380px !important;
    margin: 0 auto !important;
    position: relative !important;
    box-sizing: border-box !important;
    align-items: center !important;
    padding: 10px 15px !important;
}

/* Column positions */
.apex-grid-header-cell.col-1, .apex-grid-cell.col-1 { grid-column: 1 !important; }
.apex-grid-header-cell.col-2, .apex-grid-cell.col-2 { grid-column: 2 !important; }
.apex-grid-header-cell.col-3, .apex-grid-cell.col-3 { grid-column: 3 !important; }
.apex-grid-header-cell.col-4, .apex-grid-cell.col-4 { grid-column: 4 !important; }
.apex-grid-header-cell.col-5, .apex-grid-cell.col-5 { grid-column: 5 !important; }

/* Row positions */
.apex-grid-header-cell { 
    grid-row: 1 !important; 
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}
.apex-grid-cell.row-2 { grid-row: 2 !important; }
.apex-grid-cell.row-3 { grid-row: 3 !important; }
.apex-grid-cell.row-4 { grid-row: 4 !important; }
.apex-grid-cell.row-5 { grid-row: 5 !important; }
.apex-grid-cell.row-6 { grid-row: 6 !important; }

.apex-grid-cell {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    width: 100% !important;
    position: relative !important;
    z-index: 2 !important;
}

/* Header Badges */
.apex-round-badge {
    background: var(--apex-surface-2);
    border: 1px solid var(--apex-surface-3);
    color: var(--apex-text-high);
    font-family: var(--apex-font-display);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 10px;
    display: inline-block;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ==========================================================================
   MATCH CARD (CRISP, READABLE, FIXED COMPACT HEIGHT)
   ========================================================================== */
.apex-match-card {
    background: var(--apex-surface-1);
    border: 1px solid var(--apex-surface-3);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    border-radius: 3px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

.apex-match-card:hover {
    border-color: var(--apex-surface-4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85);
    z-index: 5;
}

.apex-match-card.is-played {
    border-color: var(--apex-surface-3);
}

/* Grand Final Card */
.apex-match-card.is-grand-final {
    border: 1px solid var(--apex-gold);
    box-shadow: 0 0 22px rgba(212, 175, 55, 0.2), 0 8px 26px rgba(0, 0, 0, 0.85);
    background: linear-gradient(180deg, #161616 0%, #101010 100%);
}

.apex-match-card.is-grand-final:hover {
    border-color: var(--apex-gold-bright);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.35), 0 10px 30px rgba(0, 0, 0, 0.9);
}

/* Tercer Puesto Card */
.apex-match-card.is-tercer-puesto {
    border: 1px solid rgba(205, 127, 50, 0.4);
}

/* Meta Bar */
.apex-match-meta {
    background: var(--apex-surface-2);
    padding: 3px 6px;
    font-size: 9px;
    color: var(--apex-text-low);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--apex-surface-3);
    line-height: 1.2;
    overflow: hidden;
}

.apex-meta-date, .apex-meta-venue {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apex-meta-date i, .apex-meta-venue i {
    font-size: 10px;
    width: 10px;
    height: 10px;
}

.apex-slot-badge {
    background: var(--apex-surface-3);
    color: var(--apex-text-high);
    font-family: var(--apex-font-display);
    font-size: 8.5px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 2px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid var(--apex-surface-4);
    flex-shrink: 0;
}

.apex-pk-badge {
    background: var(--apex-red);
    color: #fff;
    font-size: 8px;
    font-weight: 900;
    padding: 0 4px;
    border-radius: 2px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Dual Dates for 2-Leg Series */
.apex-meta-dual-dates {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 8.5px;
    color: var(--apex-text-low);
    flex: 1;
    overflow: hidden;
}

.apex-meta-dual-dates strong {
    color: var(--apex-text-med);
}

/* Team Row */
.apex-match-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 6px;
    border-bottom: 1px solid var(--apex-surface-3);
    transition: background 0.2s ease;
    gap: 4px;
    overflow: hidden;
}

.apex-match-team:last-of-type {
    border-bottom: none;
}

/* Winner side indicators */
.apex-match-card.wing-left .apex-match-team.team-winner {
    background: rgba(153, 0, 0, 0.16);
    border-left: 3px solid var(--apex-neon-red);
}

.apex-match-card.wing-right .apex-match-team.team-winner {
    background: rgba(153, 0, 0, 0.16);
    border-right: 3px solid var(--apex-neon-red);
}

.apex-match-card.wing-center .apex-match-team.team-winner {
    background: rgba(212, 175, 55, 0.18);
    border-left: 3px solid var(--apex-gold-bright);
}

.apex-team-info {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.apex-team-crest {
    width: 17px;
    height: 17px;
    object-fit: contain;
    flex-shrink: 0;
}

.apex-crest-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--apex-text-low);
    opacity: 0.55;
    flex-shrink: 0;
}

.apex-crest-placeholder svg {
    display: block;
    width: 100%;
    height: 100%;
}

.apex-champion-podium .apex-crest-placeholder {
    color: var(--apex-gold);
    opacity: 0.85;
}

.apex-team-name {
    font-family: var(--apex-font-display);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--apex-text-high);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.apex-team-name.is-placeholder {
    color: var(--apex-text-low);
    font-style: italic;
    font-weight: 500;
}

/* Team Single Score */
.apex-team-score {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
    flex-shrink: 0;
}

.apex-score-val {
    font-family: var(--apex-font-display);
    font-size: 12.5px;
    font-weight: 800;
    color: var(--apex-text-high);
    min-width: 12px;
    text-align: center;
}

.apex-score-val.empty {
    color: var(--apex-surface-4);
}

.apex-score-pk {
    font-size: 9px;
    font-weight: 800;
    color: var(--apex-neon-red);
}

/* 2-Leg Series Dual Scores & Points */
.apex-series-scores {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 3px;
    flex-shrink: 0;
}

.apex-score-leg {
    font-family: var(--apex-font-display);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--apex-text-high);
    background: var(--apex-surface-2);
    border: 1px solid var(--apex-surface-3);
    padding: 1px 3px;
    min-width: 9px;
    text-align: center;
    border-radius: 2px;
}

.apex-score-pts {
    font-family: var(--apex-font-display);
    font-size: 10px;
    font-weight: 800;
    color: var(--apex-text-med);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--apex-surface-3);
    padding: 1px 4px;
    text-align: center;
    white-space: nowrap;
    border-radius: 2px;
}

.apex-score-pts.is-winner-pts {
    background: var(--apex-red);
    color: #ffffff;
    border-color: var(--apex-neon-red);
    box-shadow: 0 0 6px var(--apex-red-glow);
}

/* 2-Leg Series Bottom Badge */
.apex-leg-badge {
    background: var(--apex-surface-0);
    color: var(--apex-gold);
    font-size: 7.5px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    padding: 2px 4px;
    border-top: 1px solid var(--apex-surface-3);
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Champion Podium */
.apex-champion-podium {
    width: 100% !important;
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.16) 0%, rgba(18, 18, 18, 0.95) 100%);
    border: 1px solid var(--apex-gold);
    box-shadow: 0 0 22px var(--apex-gold-glow), 0 8px 24px rgba(0,0,0,0.6);
    padding: 8px 6px;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    border-radius: 3px;
    margin: 0 !important;
}

.apex-podium-trophy-badge {
    font-family: var(--apex-font-display);
    font-size: 10px;
    font-weight: 900;
    color: var(--apex-gold-bright);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 2px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    white-space: nowrap;
}

.apex-podium-team-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow: hidden;
}

.apex-podium-crest {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
    flex-shrink: 0;
}

.apex-podium-name {
    font-family: var(--apex-font-display);
    font-size: 11.5px;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tercer Puesto */
.apex-tercer-puesto-wrapper {
    width: 100% !important;
    margin: 0 !important;
}

.apex-tercer-badge {
    font-family: var(--apex-font-display);
    font-size: 9px;
    font-weight: 800;
    color: var(--apex-bronze);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 3px;
}

/* ==========================================================================
   INTERACTIVE LINEAGE & TEAM HIGHLIGHTING (CLEAN, NO MESSY LINES)
   ========================================================================== */
.apex-match-card, 
.apex-champion-podium,
.apex-grid-cell,
.apex-match-team,
.apex-slot-badge {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* 1. Bracket Lineage Highlighting */
.apex-5x5-bracket-grid.has-active-lineage .apex-match-card:not(.card-lineage-hovered):not(.card-lineage-connected),
.apex-5x5-bracket-grid.has-active-lineage .apex-champion-podium:not(.card-lineage-hovered):not(.card-lineage-connected) {
    opacity: 0.38 !important;
    filter: grayscale(0.4) !important;
    transform: scale(0.985) !important;
}

/* Hovered Card: Strong Vibrant Neon Cyan Accent */
.apex-match-card.card-lineage-hovered,
.apex-champion-podium.card-lineage-hovered {
    opacity: 1 !important;
    filter: none !important;
    border-color: #00ffcc !important;
    box-shadow: 0 0 24px rgba(0, 255, 204, 0.65), 0 10px 30px rgba(0, 0, 0, 0.95) !important;
    transform: translateY(-3px) scale(1.03) !important;
    z-index: 25 !important;
}

.apex-match-card.card-lineage-hovered .apex-slot-badge {
    background: #00ffcc !important;
    color: #000000 !important;
    border-color: #00ffcc !important;
    font-weight: 900 !important;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.8) !important;
}

/* Connected Pathway Cards (Ancestors / Descendants) */
.apex-match-card.card-lineage-connected,
.apex-champion-podium.card-lineage-connected {
    opacity: 1 !important;
    filter: none !important;
    border-color: rgba(0, 255, 204, 0.85) !important;
    box-shadow: 0 0 16px rgba(0, 255, 204, 0.35), 0 6px 20px rgba(0, 0, 0, 0.85) !important;
    transform: translateY(-1px) scale(1.015) !important;
    z-index: 20 !important;
}

.apex-match-card.card-lineage-connected .apex-slot-badge {
    background: rgba(0, 255, 204, 0.2) !important;
    color: #00ffcc !important;
    border-color: #00ffcc !important;
    font-weight: 800 !important;
}

/* 2. Team Tracking Highlighting */
.apex-5x5-bracket-grid.has-active-team-hover .apex-match-card:not(.card-team-highlight),
.apex-5x5-bracket-grid.has-active-team-hover .apex-champion-podium:not(.card-team-highlight) {
    opacity: 0.35 !important;
    filter: grayscale(0.5) !important;
}

.apex-match-card.card-team-highlight,
.apex-champion-podium.card-team-highlight {
    opacity: 1 !important;
    filter: none !important;
    border-color: var(--apex-gold) !important;
    box-shadow: 0 0 22px rgba(255, 215, 0, 0.55), 0 8px 25px rgba(0, 0, 0, 0.9) !important;
    transform: translateY(-2px) scale(1.02) !important;
    z-index: 22 !important;
}

.apex-match-team.team-highlight-active {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.22) 0%, rgba(255, 215, 0, 0.06) 100%) !important;
    border-left: 3px solid var(--apex-gold-bright) !important;
}

.apex-match-team.team-highlight-active .apex-team-name {
    color: var(--apex-gold-bright) !important;
    font-weight: 900 !important;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5) !important;
}

/* ==========================================================================
   2-LEG MATCH SELECTION MODAL (OBSIDIAN & KINETIC RED)
   ========================================================================== */
body.apex-modal-open {
    overflow: hidden;
}

.apex-match-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.apex-match-modal-dialog {
    background: var(--apex-surface-1, #121212);
    border: 1px solid var(--apex-surface-4, #333333);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(153, 0, 0, 0.25);
    border-radius: 6px;
    width: 100%;
    max-width: 440px;
    padding: 22px 24px;
    position: relative;
    box-sizing: border-box;
    animation: apexModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--apex-font-body);
}

@keyframes apexModalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.apex-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--apex-text-low, #8e8b8a);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s ease;
}

.apex-modal-close:hover {
    color: var(--apex-text-high, #ffffff);
}

.apex-modal-header {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--apex-surface-3, #262626);
    padding-bottom: 10px;
}

.apex-modal-tag {
    font-family: var(--apex-font-display);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--apex-neon-red, #ff2e24);
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
}

.apex-modal-title {
    font-family: var(--apex-font-display);
    font-size: 18px;
    font-weight: 800;
    color: var(--apex-text-high, #ffffff);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: -0.01em;
}

.apex-modal-matchup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--apex-surface-2, #181818);
    border: 1px solid var(--apex-surface-3, #262626);
    padding: 12px 14px;
    border-radius: 4px;
    margin-bottom: 18px;
    gap: 10px;
}

.apex-modal-team {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.apex-modal-team.apex-modal-visita {
    justify-content: flex-end;
    text-align: right;
    flex-direction: row-reverse;
}

.apex-modal-crest-wrap {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.apex-modal-crest {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.apex-modal-team-name {
    font-family: var(--apex-font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--apex-text-high, #ffffff);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apex-modal-vs {
    font-family: var(--apex-font-display);
    font-size: 10px;
    font-weight: 900;
    color: var(--apex-red, #990000);
    padding: 0 4px;
    flex-shrink: 0;
}

.apex-modal-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.apex-modal-leg-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--apex-surface-2, #181818);
    border: 1px solid var(--apex-surface-3, #262626);
    padding: 12px 14px;
    border-radius: 4px;
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--apex-text-high, #ffffff) !important;
}

.apex-modal-leg-btn:hover {
    background: var(--apex-surface-3, #262626);
    border-color: var(--apex-red, #990000);
    box-shadow: 0 0 16px var(--apex-red-glow, rgba(153, 0, 0, 0.45));
    transform: translateY(-1px);
}

.apex-modal-leg-btn.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-style: dashed;
}

.apex-modal-leg-btn.is-disabled:hover {
    background: var(--apex-surface-2, #181818);
    border-color: var(--apex-surface-3, #262626);
    box-shadow: none;
    transform: none;
}

.apex-leg-btn-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.apex-leg-btn-badge {
    background: var(--apex-red, #990000);
    color: #ffffff;
    font-family: var(--apex-font-display);
    font-size: 9.5px;
    font-weight: 900;
    padding: 3px 7px;
    border-radius: 2px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.apex-modal-leg-btn.btn-vuelta .apex-leg-btn-badge {
    background: var(--apex-surface-4, #333333);
    color: var(--apex-text-med, #e5e2e1);
    border: 1px solid var(--apex-surface-4, #333333);
}

.apex-leg-btn-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.apex-leg-btn-title {
    font-family: var(--apex-font-display);
    font-size: 13px;
    font-weight: 800;
    color: var(--apex-text-high, #ffffff);
    text-transform: uppercase;
}

.apex-leg-btn-meta {
    font-size: 11px;
    color: var(--apex-text-low, #8e8b8a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apex-leg-btn-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.apex-leg-btn-score {
    font-family: var(--apex-font-display);
    font-size: 13px;
    font-weight: 800;
    color: var(--apex-gold-bright, #ffd700);
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
}

.apex-leg-btn-arrow {
    font-size: 16px;
    font-weight: 900;
    color: var(--apex-neon-red, #ff2e24);
    transition: transform 0.2s ease;
}

.apex-modal-leg-btn:hover .apex-leg-btn-arrow {
    transform: translateX(3px);
}

