* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3daa2f;   /* verde cancha */
    --secondary-color: #2d8a22;  /* verde oscuro */
    --dark-color: #0d0d0d;       /* negro */
    --light-color: #1a1a1a;      /* gris oscuro */
    --card-color: #141414;       /* gris muy oscuro */
    --muted-text: #cbd5e1;
    --danger-color: #e17055;
    --warning-color: #f39c12;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark-color) 0%, #111111 100%);
    color: var(--muted-text);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 18px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.6em;
    margin-bottom: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 0.9em;
    opacity: 0.95;
}

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 12px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.navbar-brand h1 {
    font-size: 1.4em;
    margin: 0;
    white-space: nowrap;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.navbar-tagline {
    font-size: 0.85em;
    opacity: 0.95;
    margin: 0;
    flex: 1;
}

.navbar-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.4em;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.navbar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ── Navbar user area ── */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: 8px;
}

.navbar-username {
    font-size: 0.9em;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82em;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(231,76,60,0.5);
}

/* ===== APP LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: calc(100vh - 56px);
    gap: 0;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 250px;
    background: var(--card-color);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 999;
}

.sidebar-header {
    padding: 0 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.sidebar-header h3 {
    color: white;
    font-size: 1.1em;
    margin: 0;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--muted-text);
    font-size: 1.2em;
    cursor: pointer;
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 10px;
}

.nav-link {
    background: none;
    border: none;
    color: var(--muted-text);
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95em;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 4px 0 0 4px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-link.active {
    background: rgba(61, 170, 47, 0.2);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-icon {
    font-size: 1.1em;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(135deg, var(--dark-color) 0%, #111111 100%);
}

.main-tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.main-tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== PLAYER ANALYSIS SECTION ===== */
.player-analysis-card {
    background: var(--light-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pac-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.pac-avatar {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pac-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pac-info {
    flex: 1;
}

.pac-info h3 {
    color: white;
    font-size: 1.5em;
    margin-bottom: 5px;
}

.player-number,
.player-position,
.player-team {
    color: var(--muted-text);
    font-size: 0.9em;
    margin: 4px 0;
}

.player-position {
    color: var(--primary-color);
    font-weight: 600;
}

.player-team {
    color: var(--secondary-color);
}

.player-stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-box {
    background: var(--light-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    color: var(--muted-text);
    font-size: 0.85em;
    margin-bottom: 8px;
}

.stat-value {
    color: var(--primary-color);
    font-size: 2em;
    font-weight: bold;
}

.player-timeline {
    max-height: 300px;
    overflow-y: auto;
}

.player-timeline .timeline-item {
    background: var(--card-color);
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.9em;
}

.player-timeline .timeline-time {
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 8px;
}

.player-timeline .timeline-action {
    color: var(--muted-text);
}

.player-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar-container {
        flex-wrap: wrap;
    }

    .navbar-tagline {
        order: 3;
        width: 100%;
        margin-top: 5px;
        flex: none;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 56px;
        height: calc(100vh - 56px);
        transform: translateX(-100%);
        width: 250px;
        z-index: 999;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .app-layout {
        min-height: auto;
    }

    .main-container {
        min-height: calc(100vh - 56px);
    }

    .player-stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .player-charts-grid {
        grid-template-columns: 1fr;
    }
}


/* Main Layout */
main {
    margin-bottom: 40px;
}

.layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Sections */
section {
    background: var(--light-color);
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

section h2 {
    color: #fff;
    margin-bottom: 25px;
    font-size: 1.8em;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 15px;
}

section h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.2em;
}

section h4 {
    color: #fff;
}

/* Video Section */
.video-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.video-container iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
}

/* Controls */
.controls {
    background: rgba(255,255,255,0.05);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    margin-top: 0;
}

.controls h3 {
    margin-bottom: 6px;
    color: #fff;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Section header with toggle button */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 1.4em;
}

/* Layout toggle buttons */
.layout-toggle {
    display: flex;
    gap: 6px;
}

.btn-toggle {
    background: rgba(255,255,255,0.08);
    color: var(--muted-text);
    border: 1px solid rgba(255,255,255,0.15);
}

.btn-toggle:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

.btn-toggle.active {
    background: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}

/* Video layout — modo Con panel: triple columna (video | controles | cronología) */
.video-layout {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    align-items: flex-start;
}

.video-layout .video-container {
    flex: 1 1 auto;
    min-width: 0;
}

.video-layout .side-controls {
    flex: 0 0 330px;
    width: 330px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    align-self: flex-start;
    position: sticky;
    top: 10px;
}

/* Cronología: 3ª columna vertical sticky */
.video-layout > .timeline-section {
    flex: 0 0 260px;
    width: 260px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    align-self: flex-start;
    position: sticky;
    top: 10px;
    order: 0;
}

/* Video layout — modo ancho completo */
.video-layout.layout-full {
    flex-direction: column;
    flex-wrap: wrap;
}

.video-layout.layout-full .video-container {
    width: 100%;
    flex: none;
}

.video-layout.layout-full .side-controls {
    flex: none;
    width: 100%;
    max-height: none;
    overflow-y: visible;
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

/* En full, timeline cae debajo */
.video-layout.layout-full > .timeline-section {
    flex: none;
    width: 100%;
    max-height: none;
    overflow-y: visible;
    position: static;
    order: 99;
}

/* Video layout — modo doble columna: video | 2 cols de paneles | cronología */
.video-layout.layout-dual {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex-wrap: unset;
}

/* Video ocupa todo el ancho */
.video-layout.layout-dual .video-container {
    width: 100%;
    flex: none;
}

/* Controles: fila completa, tabs-shell se expande, paneles en 2 columnas */
.video-layout.layout-dual .side-controls {
    width: 100%;
    flex: none;
    max-height: none;
    overflow-y: visible;
    position: static;
    display: block;          /* tabs-shell ocupa todo el ancho */
    gap: 0;
}

/* El shell de tabs ocupa el 100% y tabs-nav queda a la izq */
.video-layout.layout-dual .tabs-shell {
    display: flex;
    flex-direction: row;
    gap: 0;
    width: 100%;
}

.video-layout.layout-dual .tab-nav {
    flex-direction: column;
    flex-shrink: 0;
}

/* tab-content y tab-pane activo se expanden */
.video-layout.layout-dual .tab-content {
    flex: 1;
    min-width: 0;
}

/* Paneles del pane activo en 2 columnas */
.video-layout.layout-dual .side-controls .tab-pane.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: start;
}

/* Paneles que deben ocupar las 2 columnas (reloj, video url) */
.video-layout.layout-dual .side-controls .tab-pane .clock-panel,
.video-layout.layout-dual .side-controls .tab-pane .panel-wide,
.video-layout.layout-dual .side-controls .tab-pane .panel:first-child:last-child {
    grid-column: 1 / -1;
}

/* Cronología debajo de todo, full width */
.video-layout.layout-dual > .timeline-section {
    width: 100%;
    flex: none;
    order: 0;
    max-height: 280px;
    overflow-y: auto;
}

/* compact row for URL input + button */
.row-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

.row-group input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: rgba(255,255,255,0.07);
    color: #fff;
    font-size: 0.82em;
}

/* Teams row */
.teams-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.team-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.team-col label {
    font-size: 0.7em;
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.team-col input {
    padding: 5px 7px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: rgba(255,255,255,0.07);
    color: #fff;
    font-size: 0.82em;
    width: 100%;
}

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

.score-col {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
    flex-shrink: 0;
}

.score-sep { color: var(--muted-text); font-size: 0.8em; }

/* Gol buttons */
.gol-row {
    display: flex;
    gap: 8px;
}

.gol-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-sm {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: #00a381; }

.btn-gol { width: 100%; padding: 7px 4px; font-size: 0.82em; }
.gol-a { background: #4a4a4a; color: #fff; }
.gol-a:hover { background: #0773c5; }
.gol-b { background: #e17055; color: #fff; }
.gol-b:hover { background: #cc5f44; }

.select-sm {
    width: 100%;
    padding: 2px 4px;
    border-radius: 5px;
    background: rgba(255,255,255,0.07);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 0.82em;
}

.select-sm option { background: #1a1a1a; }

/* Shot off-target button */
.btn-off { background: #636e72; color: #fff; }
.btn-off:hover { background: #4f5960; }

/* Shot / assist counters row */
.shot-counters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 0.76em;
    color: var(--muted-text);
    padding: 4px 2px 0;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.shot-counters b { color: var(--primary-color); }
.sc-sep { color: rgba(255,255,255,0.2); font-size: 0.85em; }

/* Players */
.player-lists {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.player-team-box {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.07);
}

.player-team-box h4 {
    color: var(--primary-color);
    font-size: 0.75em;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.05em;
}

.player-team-box ul {
    list-style: none;
    padding: 0; margin: 0;
    max-height: 410px;
    overflow-y: auto;
}

.player-team-box ul li {
    font-size: 0.78em;
    color: var(--muted-text);
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 4px;
}

.player-team-box ul li .btn-icon {
    margin-left: auto;
}

/* Assign row inside team box */
.assign-row {
    display: flex;
    gap: 5px;
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

/* Squad list */
.squad-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 160px;
    overflow-y: auto;
}

.squad-empty {
    font-size: 0.75em;
    color: rgba(255,255,255,0.3);
    text-align: center;
    padding: 8px 0;
    font-style: italic;
}

.squad-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 0.78em;
}

.pos-icon { font-size: 0.9em; flex-shrink: 0; }

.dorsal {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.8em;
    background: rgba(61, 170, 47,0.13);
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}

.player-name-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.team-badge {
    font-size: 0.72em;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    font-weight: bold;
}

.badge-a  { background: rgba(9,132,227,0.25); color: #74b9ff; }
.badge-b  { background: rgba(99,110,114,0.3); color: #b2bec3; }
.badge-free { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.3); }

/* Icon-only confirm button */
.btn-icon-only {
    flex-shrink: 0;
    width: 30px;
    padding: 5px 0;
    text-align: center;
    font-size: 1em;
    line-height: 1;
}

/* Small icon-only button (✕) */
.btn-icon {
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    font-size: 0.8em;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.btn-icon:hover { color: var(--danger-color); }

#manualScoreA, #manualScoreB {
    font-weight: bold;
    color: var(--primary-color);
}

.side-controls .controls { margin-top: 0; }

/* ── Tab system (vertical column) ──────────────── */
.tabs-shell {
    display: flex;
    flex-direction: row;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.tab-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 40px;
    flex-shrink: 0;
    padding: 2px 4px 2px 2px;
    border-right: 1px solid rgba(255,255,255,0.07);
    margin-right: 8px;
}

.tab-btn {
    flex: 0 0 auto;
    padding: 10px 2px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--muted-text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    transition: all 0.15s;
    white-space: nowrap;
    width: 100%;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.tab-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff;
}

.tab-icon {
    font-size: 1.25em;
    line-height: 1;
}

.tab-label {
    display: none;
}

.tab-content {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tab-pane {
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.tab-pane.active {
    display: flex;
}

/* ── Clock panel ────────────────────────────────── */
.clock-display {
    font-size: 2.2em;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
    letter-spacing: 0.08em;
    padding: 6px 0 4px;
    font-variant-numeric: tabular-nums;
}

.clock-config {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.clock-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.clock-row label {
    font-size: 0.7em;
    color: var(--muted-text);
}

.clock-input {
    padding: 5px 8px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: rgba(255,255,255,0.07);
    color: #fff;
    font-size: 0.85em;
    width: 100%;
}

.clock-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-reset {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
}
.btn-reset:hover { background: rgba(255,255,255,0.15); }

.clock-overlay-toggle {
    margin-top: 6px;
    font-size: 0.75em;
    color: var(--muted-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.clock-overlay-toggle input { cursor: pointer; }


/* legacy input-group for stats section */
.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.input-group input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: rgba(255,255,255,0.07);
    color: #fff;
    font-size: 0.85em;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-group button, .btn-primary-lg {
    padding: 6px 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-size: 0.82em;
}

.input-group button:hover, .btn-primary-lg:hover { background: #00a381; }

/* Charts Section */
.charts-section {
    /* part of the flex column layout */
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: var(--light-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-container h3 {
    margin-bottom: 15px;
    color: #fff;
    text-align: center;
}

.chart-container canvas {
    display: block;
}

/* ────────────────────────────────────────────
   SCORE OVERLAY — BASE & THEMES
──────────────────────────────────────────── */
.score-overlay {
    position: absolute;
    z-index: 10;
    color: white;
    user-select: none;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
    /* default pos — overridden by .pos-* */
    top: 8px; left: 50%; transform: translateX(-50%);
    transition: opacity 0.2s;
}

/* shared inner elements */
.ov-side { display: flex; align-items: center; gap: 6px; }
.ov-mid  { display: flex; align-items: center; justify-content: center; gap: 5px; }
.ov-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.ov-score { font-weight: 900; }
.ov-sep  { opacity: 0.7; }
.ov-time {
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    font-size: 1.1em;
    letter-spacing: 0.04em;
}
.ov-period { opacity: 0.85; font-weight: 800; }

/* ── THEME: CLASSIC ───────────────────────────── */
[data-theme="classic"] {
    background: rgba(0,0,0,0.75);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 6px 0;
    gap: 0;
    font-size: 0.97em;
}
[data-theme="classic"] .ov-side-a {
    padding: 2px 12px 2px 14px;
    gap: 9px;
}
[data-theme="classic"] .ov-side-b {
    padding: 2px 14px 2px 12px;
    gap: 9px;
}
[data-theme="classic"] .ov-mid {
    padding: 0 10px;
    border-left: 1px solid rgba(255,255,255,0.12);
    border-right: 1px solid rgba(255,255,255,0.12);
    flex-direction: column;
    gap: 0;
    min-width: 52px;
}
[data-theme="classic"] .ov-sep { font-size: 1.4em; font-weight: 900; line-height: 1; }
[data-theme="classic"] .ov-time   { font-size: 1em; font-weight: 900; color: var(--primary-color); }
[data-theme="classic"] .ov-period { font-size: 0.75em; opacity: 0.7; letter-spacing: 0.04em; }
[data-theme="classic"] .ov-score { font-size: 1.55em; line-height: 1; }
[data-theme="classic"] .ov-name  { font-size: 0.8em; }

/* ── THEME: BANDA (TV Broadcast full-width bar) ─────── */
[data-theme="banda"] {
    background: transparent;
    border-radius: 0;
    /* force full-width bottom regardless of pos- class */
    left: 0 !important; right: 0 !important;
    bottom: 0 !important; top: auto !important;
    transform: none !important;
    width: 100%;
    gap: 0;
}
[data-theme="banda"] .ov-side-a {
    flex: 1;
    background: color-mix(in srgb, var(--ov-color-a, #ffffff) 85%, black 15%);
    padding: 9px 14px;
    gap: 10px;
    justify-content: flex-end;
}
[data-theme="banda"] .ov-side-a .ov-name { order: -1; }
[data-theme="banda"] .ov-mid {
    flex: 0 0 80px;
    flex-direction: column;
    gap: 1px;
    background: rgba(5,10,20,0.92);
    padding: 4px 8px;
    font-size: 0.72em;
    letter-spacing: 0.04em;
}
[data-theme="banda"] .ov-sep { font-size: 1.6em; font-weight: 900; line-height: 1; }
[data-theme="banda"] .ov-time   { font-size: 1.1em; font-weight: 900; opacity: 1; }
[data-theme="banda"] .ov-period { font-size: 0.82em; opacity: 0.8; }
[data-theme="banda"] .ov-side-b {
    flex: 1;
    background: color-mix(in srgb, var(--ov-color-b, #e17055) 85%, black 15%);
    padding: 9px 14px;
    gap: 10px;
}
[data-theme="banda"] .ov-score { font-size: 1.5em; font-weight: 900; }
[data-theme="banda"] .ov-name  { font-size: 0.82em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── THEME: UEFA (compact top bar) ──────────────── */
[data-theme="fifa"] {
    background: rgba(248,248,248,0.95);
    color: #111;
    border-radius: 0 0 6px 6px;
    gap: 0;
    font-size: 0.88em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
[data-theme="fifa"] .ov-side-a {
    background: var(--ov-color-a, #ffffff);
    color: white;
    padding: 5px 10px 5px 12px;
    gap: 8px;
}
[data-theme="fifa"] .ov-mid {
    background: rgba(248,248,248,0.95);
    color: #111;
    padding: 4px 12px;
    gap: 5px;
    flex-direction: column;
    min-width: 54px;
    align-items: center;
}
[data-theme="fifa"] .ov-sep { display: none; }
[data-theme="fifa"] .ov-time   { font-size: 1em; font-weight: 900; color: #111; }
[data-theme="fifa"] .ov-period { font-size: 0.72em; color: #555; font-weight: 800; }
[data-theme="fifa"] .ov-side-b {
    background: var(--ov-color-b, #e17055);
    color: white;
    padding: 5px 12px 5px 10px;
    gap: 8px;
}
[data-theme="fifa"] .ov-score { font-size: 1.4em; font-weight: 900; line-height: 1; }
[data-theme="fifa"] .ov-score { color: inherit; }
[data-theme="fifa"] .ov-name  { font-size: 0.75em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; max-width: 80px; }

/* ── THEME: MODERN (floating card boxes) ────────── */
[data-theme="modern"] {
    background: transparent;
    border-radius: 0;
    gap: 6px;
}
[data-theme="modern"] .ov-side-a {
    background: linear-gradient(135deg, var(--ov-color-a, #ffffff), color-mix(in srgb, var(--ov-color-a, #ffffff) 60%, black));
    border-radius: 8px;
    padding: 8px 14px;
    gap: 8px;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
[data-theme="modern"] .ov-side-b {
    background: linear-gradient(135deg, var(--ov-color-b, #e17055), color-mix(in srgb, var(--ov-color-b, #e17055) 60%, black));
    border-radius: 8px;
    padding: 8px 14px;
    gap: 8px;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
[data-theme="modern"] .ov-mid {
    background: rgba(0,0,0,0.82);
    border-radius: 8px;
    padding: 6px 12px;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
[data-theme="modern"] .ov-sep  { font-size: 1.1em; font-weight: 900; }
[data-theme="modern"] .ov-time   { font-size: 1em; color: #fff; font-weight: 900; }
[data-theme="modern"] .ov-period { font-size: 0.72em; color: var(--primary-color); font-weight: 800; }
[data-theme="modern"] .ov-score { font-size: 1.7em; font-weight: 900; line-height: 1; }
[data-theme="modern"] .ov-name  { font-size: 0.73em; font-weight: 700; text-transform: uppercase; text-align: center; }

/* ── THEME: NEON ───────────────────────────────── */
[data-theme="neon"] {
    background: rgba(0,0,0,0.88);
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--ov-color-a, #00ffe0) 70%, white);
    box-shadow: 0 0 16px color-mix(in srgb, var(--ov-color-a, #00ffe0) 40%, transparent),
                inset 0 0 18px rgba(0,200,200,0.04);
    gap: 0;
    font-family: 'Courier New', monospace;
}
[data-theme="neon"] .ov-side-a {
    padding: 7px 14px;
    gap: 10px;
    color: color-mix(in srgb, var(--ov-color-a, #00ffe0) 90%, white);
}
[data-theme="neon"] .ov-mid {
    padding: 3px 12px;
    flex-direction: column;
    gap: 1px;
    border-left: 1px solid rgba(255,255,255,0.1);
    border-right: 1px solid rgba(255,255,255,0.1);
    min-width: 54px;
}
[data-theme="neon"] .ov-sep { font-size: 1.5em; color: rgba(255,255,255,0.5); line-height: 1; }
[data-theme="neon"] .ov-time   { font-size: 1em; font-weight: 900; letter-spacing: 0.08em; text-shadow: 0 0 8px currentColor; }
[data-theme="neon"] .ov-period { font-size: 0.75em; letter-spacing: 0.04em; font-weight: 800; }
[data-theme="neon"] .ov-side-b {
    padding: 7px 14px;
    gap: 10px;
    color: color-mix(in srgb, var(--ov-color-b, #ff79c6) 90%, white);
}
[data-theme="neon"] .ov-score {
    font-size: 1.55em; font-weight: 900; line-height: 1;
    text-shadow: 0 0 8px currentColor, 0 0 18px currentColor;
}
[data-theme="neon"] .ov-name { font-size: 0.78em; text-shadow: 0 0 6px currentColor; font-weight: 700; }

/* ── THEME: MINIMAL (tiny corner badge) ──────────── */
[data-theme="minimal"] {
    background: rgba(0,0,0,0.80);
    border-radius: 4px;
    border-left: 3px solid var(--ov-color-a, #ffffff);
    padding: 4px 9px 4px 7px;
    gap: 7px;
    font-size: 0.82em;
    align-items: center;
}
[data-theme="minimal"] .ov-side-a { gap: 5px; padding: 0; }
[data-theme="minimal"] .ov-side-b { gap: 5px; padding: 0; }
[data-theme="minimal"] .ov-mid { gap: 5px; padding: 0; flex-direction: row; }
[data-theme="minimal"] .ov-sep { color: rgba(255,255,255,0.4); }
[data-theme="minimal"] .ov-time   { font-size: 1em; font-weight: 900; opacity: 0.9; }
[data-theme="minimal"] .ov-period { font-size: 0.82em; color: var(--primary-color); font-weight: 900; }
[data-theme="minimal"] .ov-score { font-size: 1.15em; font-weight: 900; }
[data-theme="minimal"] .ov-name  { display: none; } /* extremely compact — no names */

/* ── Overlay position classes ──────────────────────── */
.score-overlay.pos-top-left    { top: 8px; left: 8px; right: auto; transform: none; }
.score-overlay.pos-top-center  { top: 8px; left: 50%; right: auto; transform: translateX(-50%); }
.score-overlay.pos-top-right   { top: 8px; right: 8px; left: auto; transform: none; }
.score-overlay.pos-bottom-left    { bottom: 8px; top: auto; left: 8px; right: auto; transform: none; }
.score-overlay.pos-bottom-center  { bottom: 8px; top: auto; left: 50%; right: auto; transform: translateX(-50%); }
.score-overlay.pos-bottom-right   { bottom: 8px; top: auto; right: 8px; left: auto; transform: none; }

/* ── Overlay size multipliers ──────────────────────── */
.score-overlay.overlay-small { font-size: 0.78em; }
.score-overlay.overlay-large  { font-size: 1.22em; }

/* ════════════════════════════════════════════════
   6 NEW LEAGUE-INSPIRED THEMES
════════════════════════════════════════════════ */

/* ── PREMIER LEAGUE ───────────────────────────── */
[data-theme="premier"] {
    background: rgba(56,0,60,0.96);
    border-radius: 0 0 8px 8px;
    gap: 0;
    font-size: 0.92em;
    border-bottom: 3px solid #00ff87;
    box-shadow: 0 3px 16px rgba(56,0,60,0.5);
}
[data-theme="premier"] .ov-side-a {
    flex: 1;
    padding: 6px 12px;
    gap: 8px;
    background: color-mix(in srgb, var(--ov-color-a, #1e88e5) 80%, #38003c 20%);
    justify-content: flex-end;
}
[data-theme="premier"] .ov-side-a .ov-name { order: -1; font-size: 0.72em; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
[data-theme="premier"] .ov-mid {
    flex: 0;
    flex-direction: column;
    background: #38003c;
    padding: 4px 14px;
    gap: 0;
    min-width: 64px;
    border-left: 1px solid #00ff8755;
    border-right: 1px solid #00ff8755;
}
[data-theme="premier"] .ov-sep   { font-size: 1.6em; font-weight: 900; color: #00ff87; line-height: 1; }
[data-theme="premier"] .ov-time   { font-size: 1em; font-weight: 900; color: #00ff87; }
[data-theme="premier"] .ov-period { font-size: 0.72em; color: rgba(255,255,255,0.6); font-weight: 800; }
[data-theme="premier"] .ov-side-b {
    flex: 1;
    padding: 6px 12px;
    gap: 8px;
    background: color-mix(in srgb, var(--ov-color-b, #e53935) 80%, #38003c 20%);
}
[data-theme="premier"] .ov-side-b .ov-name { font-size: 0.72em; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
[data-theme="premier"] .ov-score { font-size: 1.5em; font-weight: 900; line-height: 1; }

/* ── CHAMPIONS LEAGUE ─────────────────────────── */
[data-theme="champions"] {
    background: rgba(6,10,30,0.97);
    border: 1px solid #c9a84c;
    border-radius: 6px;
    gap: 0;
    font-size: 0.94em;
    box-shadow: 0 0 18px rgba(201,168,76,0.25);
}
[data-theme="champions"]::before {
    content: '★★★♥★★★';
    position: absolute;
    top: 0; left: 0; right: 0;
    text-align: center;
    font-size: 0.42em;
    color: #c9a84c;
    background: rgba(201,168,76,0.1);
    letter-spacing: 0.15em;
    padding: 2px 0;
    line-height: 1;
}
[data-theme="champions"] .ov-side-a {
    padding: 14px 14px 6px;
    gap: 9px;
}
[data-theme="champions"] .ov-side-b {
    padding: 14px 14px 6px;
    gap: 9px;
}
[data-theme="champions"] .ov-mid {
    flex-direction: column;
    padding: 14px 14px 4px;
    gap: 0;
    min-width: 60px;
    border-left: 1px solid rgba(201,168,76,0.25);
    border-right: 1px solid rgba(201,168,76,0.25);
}
[data-theme="champions"] .ov-sep   { font-size: 1.5em; font-weight: 900; color: #c9a84c; line-height: 1; }
[data-theme="champions"] .ov-time   { font-size: 1.05em; font-weight: 900; color: #c9a84c; }
[data-theme="champions"] .ov-period { font-size: 0.72em; color: rgba(255,255,255,0.55); font-weight: 800; }
[data-theme="champions"] .ov-score  { font-size: 1.5em; font-weight: 900; color: #fff; line-height: 1; }
[data-theme="champions"] .ov-name   { font-size: 0.78em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* ── LA LIGA ─────────────────────────────────── */
[data-theme="laliga"] {
    background: transparent;
    gap: 0;
    font-size: 0.9em;
    border-radius: 0;
}
[data-theme="laliga"] .ov-side-a {
    flex: 1;
    background: linear-gradient(135deg, #ff6b00 0%, #ee2c2c 100%);
    padding: 7px 12px;
    gap: 9px;
    justify-content: flex-end;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 100%, 0 100%);
}
[data-theme="laliga"] .ov-side-a .ov-name { order: -1; font-size: 0.7em; font-weight: 900; text-transform: uppercase; letter-spacing: 0.09em; }
[data-theme="laliga"] .ov-mid {
    background: rgba(10,10,10,0.96);
    padding: 5px 16px;
    flex-direction: column;
    gap: 0;
    min-width: 66px;
    z-index: 1;
}
[data-theme="laliga"] .ov-sep   { font-size: 1.55em; font-weight: 900; color: #ff6b00; line-height: 1; }
[data-theme="laliga"] .ov-time   { font-size: 1.05em; font-weight: 900; color: #ff6b00; }
[data-theme="laliga"] .ov-period { font-size: 0.72em; color: rgba(255,255,255,0.6); font-weight: 800; }
[data-theme="laliga"] .ov-side-b {
    flex: 1;
    background: linear-gradient(135deg, #ee2c2c 0%, #c0001c 100%);
    padding: 7px 12px;
    gap: 9px;
    clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%);
}
[data-theme="laliga"] .ov-side-b .ov-name { font-size: 0.7em; font-weight: 900; text-transform: uppercase; letter-spacing: 0.09em; }
[data-theme="laliga"] .ov-score { font-size: 1.5em; font-weight: 900; line-height: 1; }

/* ── SKY SPORTS ──────────────────────────────── */
[data-theme="sky"] {
    background: #0279bd;
    border-radius: 4px;
    gap: 0;
    font-size: 0.9em;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
[data-theme="sky"] .ov-side-a {
    background: color-mix(in srgb, var(--ov-color-a, #1a4f8c) 70%, #0279bd 30%);
    padding: 5px 11px 5px 13px;
    gap: 8px;
    border-right: 1px solid rgba(255,255,255,0.2);
}
[data-theme="sky"] .ov-mid {
    flex-direction: column;
    background: rgba(0,0,0,0.35);
    padding: 3px 12px;
    gap: 0;
    min-width: 60px;
}
[data-theme="sky"] .ov-sep   { font-size: 1.45em; font-weight: 900; line-height: 1; color: rgba(255,255,255,0.8); }
[data-theme="sky"] .ov-time   { font-size: 1.05em; font-weight: 900; color: #fff; }
[data-theme="sky"] .ov-period { font-size: 0.72em; font-weight: 800; color: rgba(255,200,0,0.9); }
[data-theme="sky"] .ov-side-b {
    background: color-mix(in srgb, var(--ov-color-b, #c0001c) 70%, #0279bd 30%);
    padding: 5px 13px 5px 11px;
    gap: 8px;
    border-left: 1px solid rgba(255,255,255,0.2);
}
[data-theme="sky"] .ov-score { font-size: 1.5em; font-weight: 900; line-height: 1; }
[data-theme="sky"] .ov-name  { font-size: 0.74em; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── COPA (Copa Libertadores / del Rey) ─────────── */
[data-theme="copa"] {
    background: rgba(12,12,12,0.96);
    border: 1px solid #b8952a;
    border-top: 3px solid #d4af37;
    border-radius: 0 0 6px 6px;
    gap: 0;
    font-size: 0.92em;
    box-shadow: 0 4px 20px rgba(212,175,55,0.2);
}
[data-theme="copa"] .ov-side-a {
    padding: 6px 12px;
    gap: 8px;
    border-right: 1px solid rgba(212,175,55,0.2);
}
[data-theme="copa"] .ov-mid {
    flex-direction: column;
    padding: 4px 12px;
    gap: 0;
    min-width: 58px;
}
[data-theme="copa"] .ov-sep   { font-size: 1.5em; font-weight: 900; color: #d4af37; line-height: 1; }
[data-theme="copa"] .ov-time   { font-size: 1.05em; font-weight: 900; color: #d4af37; }
[data-theme="copa"] .ov-period { font-size: 0.72em; font-weight: 800; color: rgba(212,175,55,0.75); }
[data-theme="copa"] .ov-side-b {
    padding: 6px 12px;
    gap: 8px;
    border-left: 1px solid rgba(212,175,55,0.2);
}
[data-theme="copa"] .ov-score  { font-size: 1.5em; font-weight: 900; color: #fff; line-height: 1; }
[data-theme="copa"] .ov-name   { font-size: 0.74em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255,255,255,0.8); }

/* ── RETRO (Classic 90s / digital scoreboard) ────── */
[data-theme="retro"] {
    background: #0d3300;
    border: 2px solid #2d7a00;
    border-radius: 5px;
    gap: 0;
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-size: 0.88em;
    box-shadow: 0 0 10px #1a6600aa, inset 0 0 25px rgba(0,80,0,0.3);
}
[data-theme="retro"] .ov-side-a {
    padding: 5px 10px;
    gap: 8px;
    color: #7fff00;
}
[data-theme="retro"] .ov-mid {
    flex-direction: column;
    padding: 3px 10px;
    gap: 0;
    min-width: 60px;
    border-left: 1px solid #2d7a00;
    border-right: 1px solid #2d7a00;
    background: rgba(0,60,0,0.5);
}
[data-theme="retro"] .ov-sep   { font-size: 1.5em; font-weight: 900; color: #7fff00; line-height: 1; text-shadow: 0 0 6px #7fff00; }
[data-theme="retro"] .ov-time   { font-size: 1.1em; font-weight: 900; color: #ffd700; text-shadow: 0 0 8px #ffd700; }
[data-theme="retro"] .ov-period { font-size: 0.75em; font-weight: 800; color: #7fff00; text-shadow: 0 0 5px #7fff00; }
[data-theme="retro"] .ov-side-b {
    padding: 5px 10px;
    gap: 8px;
    color: #7fff00;
}
[data-theme="retro"] .ov-score  { font-size: 1.5em; font-weight: 900; color: #7fff00; text-shadow: 0 0 8px #7fff00; line-height: 1; }
[data-theme="retro"] .ov-name   { font-size: 0.72em; color: rgba(127,255,0,0.75); letter-spacing: 0.06em; text-transform: uppercase; }

/* ── New theme preview thumbnails ─────────────────── */
.tp-premier  { background: linear-gradient(90deg, #1e88e5 25%, #38003c 25% 75%, #e53935 75%); color: #fff; padding: 0 3px; gap: 3px; }
.tp-premier b { color: #00ff87; font-size: 1.05em; }
.tp-champions { background: #060a1e; border: 1px solid #c9a84c; color: #c9a84c; border-radius: 3px; padding: 0 5px; gap: 4px; font-size: 0.95em; }
.tp-laliga  { background: linear-gradient(90deg, #ff6b00 25%, #0a0a0a 25% 75%, #ee2c2c 75%); color: #fff; padding: 0 3px; gap: 3px; }
.tp-laliga b { color: #ff6b00; background: #0a0a0a; padding: 0 4px; }
.tp-ll-sep   { color: #ff6b00; font-size: 1.1em; }
.tp-sky     { background: #0279bd; color: #fff; border-radius: 3px; padding: 0 5px; gap: 3px; }
.tp-sky b   { background: rgba(0,0,0,0.35); padding: 1px 4px; border-radius: 2px; }
.tp-copa    { background: #0c0c0c; border: 1px solid #d4af37; border-radius: 3px; color: #d4af37; padding: 0 5px; gap: 3px; }
.tp-retro   { background: #0d3300; border: 1px solid #2d7a00; color: #7fff00; font-family: monospace; border-radius: 3px; padding: 0 5px; gap: 3px; }
.tp-retro b { color: #ffd700; text-shadow: 0 0 4px #ffd700; }
.tp-r-min   { color: #7fff00; font-size: 0.9em; opacity: 0.8; }

/* ── DESIGN TAB CONTROLS ─────────────────────────── */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}
.theme-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 7px;
    cursor: pointer;
    padding: 6px 4px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}
.theme-btn:hover { background: rgba(255,255,255,0.11); border-color: rgba(255,255,255,0.2); }
.theme-btn.active { border-color: var(--primary-color); background: rgba(61, 170, 47,0.12); }
.theme-btn span { font-size: 0.68em; color: var(--muted-text); font-weight: 600; }
.theme-btn.active span { color: var(--primary-color); }

/* Theme preview thumbnails */
.tp {
    height: 28px; width: 100%;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; gap: 3px;
    font-size: 0.64em; font-weight: 700; overflow: hidden;
}
.tp span { font-size: 0.9em; opacity: 0.9; }
.tp b { font-size: 1.1em; }
.tp-classic { background: rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.15); color: #fff; border-radius: 5px; gap: 4px; padding: 0 4px; }
.tp-banda   { background: linear-gradient(90deg, #3daa2f 32%, rgba(0,0,0,0.85) 32% 68%, #e17055 68%); color: #fff; }
.tp-fifa    { background: rgba(248,248,248,0.95); color: #111; overflow: hidden; gap: 2px; padding: 0 2px; }
.tp-fifa span:first-child { background: #ffffff; color: #fff; padding: 1px 3px; border-radius: 2px; }
.tp-fifa span:last-child  { background: #e17055; color: #fff; padding: 1px 3px; border-radius: 2px; }
.tp-fifa .tp-dot { color: #999; }
.tp-modern  { background: transparent; gap: 4px; }
.tp-modern b { background: linear-gradient(135deg, #3daa2f 50%, #e17055 50%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 1.3em; }
.tp-modern span { color: rgba(255,255,255,0.4); font-size: 1.1em; }
.tp-neon    { background: rgba(0,0,0,0.85); border: 1px solid #00ffe0; color: #0ff; font-family: monospace; box-shadow: 0 0 7px #00ffe066; border-radius: 4px; padding: 0 4px; }
.tp-minimal { background: rgba(0,0,0,0.80); border-left: 3px solid #3daa2f; border-radius: 3px; padding: 0 6px; color: #fff; gap: 5px; }

.color-pairs { display: flex; flex-direction: column; gap: 7px; }
.color-pair  { display: flex; align-items: center; gap: 8px; }
.color-label { flex: 1; font-size: 0.82em; color: var(--muted-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.color-pick  { -webkit-appearance: none; appearance: none; width: 36px; height: 26px; border: none; border-radius: 5px; cursor: pointer; padding: 2px; background: rgba(255,255,255,0.08); flex-shrink: 0; }
.color-pick::-webkit-color-swatch-wrapper { padding: 2px; }
.color-pick::-webkit-color-swatch { border-radius: 3px; border: none; }

.period-btns { display: flex; gap: 5px; }
.period-btns .btn-sm { flex: 1; }
.period-btns .btn-sm.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* adjust form buttons */
.stats-input-grid button {
    padding: 8px 12px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.82em;
    font-weight: bold;
    transition: background 0.2s;
}

.stats-input-grid button:hover {
    background: #0773c5;
}

/* Stats Input Grid */
.stats-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stats-input-grid .input-group {
    flex-direction: column;
    margin-bottom: 0;
}

.stats-input-grid label {
    font-weight: bold;
    color: #fff;
    font-size: 0.95em;
    margin-bottom: 5px;
}

.stats-input-grid input {
    padding: 10px;
    border: 2px solid var(--light-color);
    border-radius: 6px;
    font-size: 0.95em;
}

.stats-input-grid input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 6px rgba(46, 204, 113, 0.2);
}

/* Footer */
footer {
    background: var(--dark-color);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 60px;
    border-top: 3px solid var(--primary-color);
}

footer p {
    margin: 0;
}

/* ── Compact scoreboard in Marcador tab ──────────── */
.scoreboard-compact {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}
.scoreboard-compact .sc-name input {
    width: 100%;
    text-align: center;
    font-size: 0.78em;
    padding: 5px 6px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: rgba(255,255,255,0.07);
    color: #fff;
}
.sc-center { display: flex; align-items: center; gap: 4px; justify-content: center; }
.sc-num { font-size: 1.7em; font-weight: 700; color: #fff; min-width: 22px; text-align: center; line-height: 1; }
.sc-sep-large { font-size: 1.4em; color: var(--muted-text); }
.gol-compact { display: flex; gap: 8px; }
.gol-side { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.btn-gol-compact {
    width: 100%; padding: 7px 0; font-size: 0.82em; font-weight: 700;
    border: none; cursor: pointer; border-radius: 5px; transition: all 0.2s;
}
.gol-side .gol-a.btn-gol-compact { background: #4a4a4a; color: #fff; }
.gol-side .gol-a.btn-gol-compact:hover { background: #0773c5; }
.gol-side .gol-b.btn-gol-compact { background: #e17055; color: #fff; }
.gol-side .gol-b.btn-gol-compact:hover { background: #cc5f44; }

/* ── Clock compact layout ─────────────────────────── */
.clock-cfg-row {
    display: grid; grid-template-columns: 1fr; gap: 6px; margin: 6px 0;
}
.clock-cfg-field label {
    font-size: 0.7em; color: var(--muted-text); display: block; margin-bottom: 2px;
}
.clock-cfg-field .clock-input { font-size: 0.82em; }
.clock-btns { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.clock-btns .btn-sm { flex: 1; min-width: 0; font-size: 0.75em; padding: 5px 4px; }

/* ─── Cinema floating matches panel ─────────────────────────────────────── */
.cinema-matches-panel {
    display: none;
}
body.cinema-mode .cinema-matches-panel {
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 16px;
    top: 60px;
    width: 260px;
    max-height: 80vh;
    background: rgba(8,10,18,0.9);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s, box-shadow 0.15s;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
    z-index: 9020;
}
body.cinema-mode .cinema-matches-panel.cv-open {
    opacity: 1;
    pointer-events: all;
}
body.cinema-mode .cinema-matches-panel.cv-minimized > *:not(.cv-handle) {
    display: none !important;
}
body.cinema-mode .cinema-matches-panel.cv-minimized {
    max-height: none;
    width: auto !important;
    min-width: 130px;
    border-radius: 8px;
}
.cinema-matches-list {
    overflow-y: auto;
    flex: 1;
    max-height: calc(80vh - 38px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}
.cinema-matches-list .match-card {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
}
/* end cinema matches panel */

/* ── Stats panel compact ──────────────────────────── */
.stat-pair { display: flex; gap: 6px; align-items: flex-start; min-width: 0; }
.stat-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.stat-btns { display: flex; gap: 3px; min-width: 0; }
.stat-btns .btn-sm { flex: 1; min-width: 32px; font-size: 1.05em; padding: 5px 2px; line-height: 1; }
.stat-counter { font-size: 0.70em; text-align: center; padding: 2px 0; color: var(--muted-text); white-space: nowrap; word-spacing: -1px; }
.stat-counter b { color: var(--primary-color); }
.stat-divider { color: rgba(255,255,255,0.1); align-self: stretch; display: flex; align-items: center; font-size: 1.1em; padding-bottom: 12px; }

/* ── Design tab ───────────────────────────────────── */
.design-toggle {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 0; cursor: pointer; font-size: 0.83em; color: var(--muted-text);
}
.design-toggle input { cursor: pointer; accent-color: var(--primary-color); }
.pos-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
}
.pos-btn {
    background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
    color: var(--muted-text); padding: 9px 0; border-radius: 6px;
    cursor: pointer; font-size: 1.15em; text-align: center; transition: all 0.15s;
}
.pos-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.pos-btn.active { background: var(--secondary-color); border-color: var(--secondary-color); color: #fff; }
.design-range { width: 100%; accent-color: var(--primary-color); }
.size-btns { display: flex; gap: 6px; }
.size-btns .btn-sm { flex: 1; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12); color: var(--muted-text); }
.size-btns .btn-sm.active { background: var(--secondary-color); border-color: var(--secondary-color); color: #fff; }


/* ── Match Timeline ───────────────────────────────── */
.timeline-section {
    margin-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 14px;
}
.timeline-header {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px;
}
.timeline-header-top {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
}
.timeline-filters {
    display: flex; gap: 6px; width: 100%;
    margin-bottom: 4px;
}
.timeline-filters select {
    flex: 1; min-width: 0;
}
.timeline-header h3 { margin-bottom: 0; font-size: 1em; color: #fff; }
.timeline-events {
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto; overflow-x: hidden;
    padding-left: 24px; padding-right: 2px;
    position: relative;
    min-height: 100px;
}
.tl-track-line {
    position: absolute; left: 10px; top: 0; bottom: 0;
    width: 2px; background: rgba(255,255,255,0.1); z-index: 1;
}
.tl-track-arrow {
    position: absolute; left: 2px; width: 18px;
    text-align: center; color: var(--primary-color, #00cec9);
    font-size: 0.85em; z-index: 2;
    transition: top 0.3s ease-out, opacity 0.2s; transform: translateY(-50%);
    text-shadow: 0 0 8px rgba(0, 206, 201, 0.6);
}
#timelineEventsContent {
    display: flex; flex-direction: column; gap: 6px; flex: 1;
}
.timeline-event {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 9px 5px 7px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.09);
    border-left-width: 3px;
    font-size: 0.8em;
    flex-shrink: 0;
    opacity: 0.5; /* Default is dimmed */
    transition: background 0.15s, opacity 0.3s ease, border-color 0.3s, box-shadow 0.3s;
}
.timeline-event.ev-active {
    opacity: 1 !important;
    box-shadow: 0 0 12px rgba(0, 206, 201, 0.25);
}
.timeline-event.ev-highlight {
    border-left-color: var(--primary-color, #00cec9) !important;
    background: rgba(0,206,201,0.08);
}
.timeline-event:hover { background: rgba(255,255,255,0.1); opacity: 1 !important; }
.timeline-event.ev-team-a { border-left-color: #9e9e9e; }
.timeline-event.ev-team-b { border-left-color: #e17055; }
.ev-min { display: flex; flex-direction: column; align-items: flex-start; min-width: 48px; gap: 1px; }
.ev-match-time { font-weight: 700; color: var(--primary-color); font-size: 0.90em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev-video-time  { font-weight: 400; color: var(--text-muted, #888); font-size: 0.72em; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: 0; }
.ev-icon { font-size: 1.05em; }
.ev-info { display: flex; flex-direction: column; gap: 0; line-height: 1.2; }
.ev-label { font-weight: 600; color: #fff; font-size: 0.85em; }
.ev-player { color: var(--muted-text); font-size: 0.78em; }
.ev-team-name { font-size: 0.72em; color: rgba(255,255,255,0.35); }
.btn-ev-del {
    background: none; border: none; color: rgba(255,255,255,0.2);
    cursor: pointer; font-size: 0.85em; padding: 0 1px; line-height: 1;
    margin-left: 2px; transition: color 0.15s; flex-shrink: 0;
}
.btn-ev-del:hover { color: var(--danger-color); }
.timeline-empty { color: rgba(255,255,255,0.3); font-size: 0.82em; font-style: italic; padding: 6px 0; }

/* Inicio del partido */
.timeline-event.ev-start {
    border-left-color: #3daa2f;
    background: rgba(61, 170, 47,0.08);
}

/* Eventos con seek (clickables) */
.timeline-event.ev-seekable,
.timeline-event.ev-start {
    cursor: pointer;
}
.timeline-event.ev-seekable:hover,
.timeline-event.ev-start:hover {
    background: rgba(255,255,255,0.13);
    border-color: rgba(255,255,255,0.25);
}
.ev-seek-hint {
    font-size: 0.7em;
    color: rgba(255,255,255,0.25);
    margin-left: 1px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.timeline-event.ev-seekable:hover .ev-seek-hint,
.timeline-event.ev-start:hover .ev-seek-hint {
    color: var(--primary-color);
}

/* ── Event view overlay (sobre el video) ─────────── */
.event-view-overlay {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0,0,0,0.80);
    color: #fff;
    padding: 7px 10px 7px 14px;
    border-radius: 26px;
    font-size: 0.88em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.event-view-overlay.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: all;
}
.ev-overlay-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 0.85em;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}
.ev-overlay-close:hover { color: #fff; }

/* ── Video timeline bar ─────────────────────────── */
.video-timeline-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 44px;
    z-index: 15;
    padding: 0 6px 0 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    pointer-events: none;
}

/* Botón toggle de la mini-cronología */
.vtl-toggle-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    pointer-events: all;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}
.vtl-toggle-btn:hover, .vtl-toggle-btn.active { background: rgba(255,255,255,0.28); color: #fff; }

/* Panel flotante de mini-cronología sobre la barra de tiempo del video */
.vtl-panel {
    position: absolute;
    bottom: 36px;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
    background: rgba(10,10,20,0.88);
    backdrop-filter: blur(10px);
    z-index: 14;
    pointer-events: none;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.vtl-panel.visible {
    max-height: 200px;
    pointer-events: all;
    overflow-y: auto;
}
.vtl-panel-inner {
    padding: 6px 10px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.vtl-panel-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.77em;
    color: #ddd;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}
.vtl-panel-row:hover { background: rgba(255,255,255,0.1); }
.vtl-panel-time {
    font-variant-numeric: tabular-nums;
    color: var(--primary-color, #00cec9);
    min-width: 36px;
    font-weight: 700;
    font-size: 1em;
}
.vtl-panel-vtime {
    color: #888;
    font-size: 0.88em;
    min-width: 44px;
}
.vtl-panel-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.vtl-panel-dot.vtl-a     { background: #9e9e9e; }
.vtl-panel-dot.vtl-b     { background: #e17055; }
.vtl-panel-dot.vtl-start { background: #3daa2f; }
.vtl-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
    pointer-events: none;
    overflow: visible;
}

.vtl-tick {
    position: absolute;
    top: 50%;
    width: 1px;
    height: 12px;
    margin-top: -6px;
    background: rgba(255,255,255,0.28);
    transform: translateX(-50%);
    pointer-events: none;
    border-radius: 1px;
}

.vtl-tick-label {
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
    letter-spacing: 0.01em;
}

/* Playhead — flecha que avanza con el video */
.vtl-playhead {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 18px;
    margin-top: -9px;
    background: #fff;
    border-radius: 1px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 0 4px rgba(255,255,255,0.7);
    transition: left 0.4s linear;
}
.vtl-playhead::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #fff;
    filter: drop-shadow(0 0 3px rgba(255,255,255,0.6));
}
.vtl-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(0,0,0,0.55);
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.12s, box-shadow 0.12s;
    z-index: 1;
}
.vtl-dot:hover {
    transform: translate(-50%, -50%) scale(1.55);
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
    z-index: 2;
}
.vtl-dot.vtl-a     { background: #9e9e9e; }
.vtl-dot.vtl-b     { background: #e17055; }
.vtl-dot.vtl-start { background: #3daa2f; }

/* ── Stats Resumen tab ───────────────────────────────────────────────────── */
.res-cmp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82em;
}
.res-cmp-table thead th {
    font-size: 0.85em;
    font-weight: 700;
    padding: 3px 4px 6px;
    color: #aaa;
}
.res-cmp-table th.rc-a,
.res-cmp-table td.rc-a { text-align: right; color: #c0c0c0; font-weight: 700; padding: 4px 6px; }
.res-cmp-table th.rc-b,
.res-cmp-table td.rc-b { text-align: left;  color: #e17055; font-weight: 700; padding: 4px 6px; }
.res-cmp-table td.rc-lbl {
    text-align: center;
    color: var(--muted-text);
    font-size: 0.88em;
    padding: 4px 2px;
    white-space: nowrap;
}
.rc-bar-row td { padding: 0 4px 5px; }
.res-bar {
    height: 4px;
    border-radius: 2px;
    display: flex;
    overflow: hidden;
    background: rgba(255,255,255,0.07);
}
.res-bar-a { background: #c0c0c0; transition: width 0.4s; }
.res-bar-b { background: #e17055; transition: width 0.4s; }

.res-list { display: flex; flex-direction: column; gap: 4px; }
.res-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82em;
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
}
.res-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.res-player { font-weight: 700; color: #eee; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-team-name { color: var(--muted-text); font-size: 0.88em; flex-shrink: 0; }
.res-count { font-weight: 700; color: #fff; margin-left: auto; flex-shrink: 0; }
.res-goal-badge { background: rgba(61, 170, 47,0.25); color: #3daa2f; border-radius: 4px; padding: 0 4px; font-size: 0.9em; margin-left: 3px; }
.res-empty { font-size: 0.78em; color: var(--muted-text); padding: 4px 6px; }

/* ═══════════════════════════════════════════════════════════
   MODO CINEMÁTICO — video full-viewport, paneles flotantes arrastrables
   ═══════════════════════════════════════════════════════════ */
body.cinema-mode { overflow: hidden; }
body.cinema-mode header { display: none; }
body.cinema-mode .navbar { display: none; }
body.cinema-mode .app-layout { min-height: 100vh; }
body.cinema-mode .sidebar { display: none; }
body.cinema-mode .main-container { padding: 0; }
body.cinema-mode main.container { padding: 0; max-width: none; }
body.cinema-mode .layout { gap: 0; }
body.cinema-mode .video-section {
    position: fixed; inset: 0; z-index: 9000;
    background: #000; padding: 0; border-radius: 0;
}
body.cinema-mode .section-header { display: none; }
/* Normal carousel hidden in cinema mode — replaced by floating panel */
body.cinema-mode .matches-carousel-section {
    display: none;
}
body.cinema-mode .video-layout {
    display: block;
    position: relative;
    width: 100vw; height: 100vh; gap: 0;
}
body.cinema-mode .video-container {
    position: absolute; inset: 0;
    width: 100% !important; height: 100% !important;
    border-radius: 0;
}
body.cinema-mode .video-container #player,
body.cinema-mode .video-container iframe {
    position: absolute !important; inset: 0 !important;
    width: 100% !important; height: 100% !important;
    border-radius: 0;
}

/* ─ Floating panels ────────────────────────────── */
body.cinema-mode .side-controls,
body.cinema-mode .video-layout > .timeline-section {
    position: absolute;
    z-index: 9020;
    background: rgba(8, 10, 18, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
    max-height: 80vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s, box-shadow 0.15s;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
    /* disable old sticky/scrolling */
    flex: none !important;
    width: auto !important;
    min-width: 0;
    max-width: none;
    top: 60px;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-top: 1px solid rgba(255,255,255,0.1); /* override standard border */
}
body.cinema-mode .side-controls.cv-open,
body.cinema-mode .video-layout > .timeline-section.cv-open {
    opacity: 1;
    pointer-events: all;
}
/* Default positions (overridden by drag) */
body.cinema-mode .side-controls     { right: 16px; left: auto;  width: 320px !important; }
body.cinema-mode .video-layout > .timeline-section { left: 16px; right: auto; width: 220px !important; }

/* Inner content scrollable */
body.cinema-mode .side-controls .tabs-shell,
body.cinema-mode .video-layout > .timeline-section .timeline-events {
    overflow-y: auto;
    flex: 1;
    max-height: calc(80vh - 38px);
}
body.cinema-mode .video-layout > .timeline-section .timeline-header {
    flex-shrink: 0;
    padding: 10px 10px 0 10px;
}
body.cinema-mode .video-layout > .timeline-section .timeline-header h3 {
    display: none;
}
body.cinema-mode .video-layout > .timeline-section .timeline-header .btn-off {
    margin-left: auto; /* push button to right when title is hidden */
}

/* Minimized: show only the handle bar */
body.cinema-mode .side-controls.cv-minimized > *:not(.cv-handle),
body.cinema-mode .video-layout > .timeline-section.cv-minimized > *:not(.cv-handle) {
    display: none !important;
}
body.cinema-mode .side-controls.cv-minimized,
body.cinema-mode .video-layout > .timeline-section.cv-minimized {
    max-height: none;
    width: auto !important;
    min-width: 130px;
    border-radius: 8px;
}

/* Drag handle */
.cv-handle {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    cursor: move;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    user-select: none;
    flex-shrink: 0;
    min-height: 36px;
}
body.cinema-mode .cv-handle  { display: flex; }
.cv-handle-icon  { font-size: 0.92em; flex-shrink: 0; }
.cv-handle-title {
    font-size: 0.76em; font-weight: 700;
    color: #bbb; flex: 1;
    letter-spacing: 0.04em; text-transform: uppercase;
}
.cv-handle-btn {
    background: none; border: none; color: #666;
    cursor: pointer; font-size: 1.05em; padding: 0 3px; line-height: 1;
    transition: color 0.12s;
}
.cv-handle-btn:hover { color: #fff; }

/* z-index for existing overlays */
body.cinema-mode .score-overlay      { z-index: 9010; }
body.cinema-mode .cinema-matches-panel { z-index: 9020; }
body.cinema-mode .video-timeline-bar  { z-index: 9015; }
body.cinema-mode .vtl-panel           { z-index: 9014; }

/* Cinema toolbar */
.cinema-bar {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 9030;
    height: 46px;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.72) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
body.cinema-mode .cinema-bar { display: flex; pointer-events: all; }
body.cinema-mode .video-container:hover .cinema-bar,
body.cinema-mode .cinema-bar:focus-within { opacity: 1; }
.cinema-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff; border-radius: 6px;
    padding: 5px 12px; font-size: 0.8em;
    cursor: pointer; transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.cinema-btn:hover, .cinema-btn.cv-active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}
.cinema-exit { background: rgba(200,60,60,0.25); border-color: rgba(200,60,60,0.4); }
.cinema-exit:hover { background: rgba(200,60,60,0.6); border-color: rgba(200,60,60,0.7); }

/* ── Widen side panel slightly for 5 tabs (Con panel default only) ─────────── */
.video-layout:not(.layout-dual):not(.layout-full) .side-controls { flex: 0 0 330px; width: 330px; }

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.4em;
    }

    section {
        padding: 12px;
    }

    /* stack video + side-controls vertically on mobile */
    .video-layout {
        flex-direction: column;
        flex-wrap: wrap;
    }

    .video-layout .side-controls {
        flex: 1 1 100%;
        width: 100%;
        max-height: none;
        position: static;
    }

    .video-layout > .timeline-section {
        flex: 1 1 100%;
        width: 100%;
        max-height: none;
        position: static;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .stats-input-grid {
        grid-template-columns: 1fr;
    }

    .gol-row {
        flex-direction: column;
    }

    .player-lists {
        flex-direction: column;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: slideIn 0.5s ease-out;
}

/* Utility */
.mb-20 {
    margin-bottom: 20px;
}

.text-center {
    text-align: center;
}

.text-primary {
    color: var(--primary-color);
}

.text-secondary {
    color: var(--secondary-color);
}

/* -- PERFILES DE JUGADORES -------------------------- */
.perfiles-list {
    display: flex; flex-direction: column; gap: 10px;
    max-height: 480px; overflow-y: auto; padding-right: 4px;
}
.profile-card {
    display: flex; gap: 12px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 10px; align-items: flex-start;
}
.profile-photo {
    width: 60px; height: 60px; border-radius: 50%;
    background: #111; border: 2px solid var(--primary-color);
    flex-shrink: 0; background-size: cover; background-position: center;
    cursor: pointer; position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.profile-photo::after {
    content: "📷"; font-size: 20px; opacity: 0.4;
    transition: opacity 0.2s;
}
.profile-photo[style*="background-image"]::after {
    display: none;
}
.profile-photo:hover::after {
    opacity: 1;
}
.profile-info {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px;
}
.profile-info h4 {
    margin: 0; font-size: 0.95em; color: #fff; display: flex; justify-content: space-between;
}
.profile-info h4 span.pos { font-size: 0.8em; color: var(--primary-color); }
.profile-stats-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.profile-stat {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(0,0,0,0.3); border-radius: 4px; padding: 4px 6px;
}
.profile-stat label { font-size: 0.7em; color: #bbb; }
.profile-stat input {
    width: 36px; background: transparent; border: none; color: #fff;
    font-weight: bold; text-align: right; font-size: 0.8em;
}

/* ===== ACTIONS + VIDEO LAYOUT ===== */
.actions-video-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-top: 15px;
    align-items: start;
}

.actions-list-side {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}

.actions-list-side .player-timeline {
    max-height: none;
    height: 560px;
    overflow-y: auto;
}

.video-player-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-video-container {
    width: 100%;
    height: 380px;
    flex-shrink: 0;
    background: var(--card-color);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.video-player-side .player-charts-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 0;
}

.action-time-display {
    text-align: center;
    padding: 10px;
    background: var(--card-color);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1em;
    font-weight: bold;
    color: var(--primary-color);
}

.player-timeline .timeline-item.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-timeline .timeline-item.clickable:hover {
    background: rgba(61, 170, 47, 0.15);
    border-left-color: var(--primary-color);
    transform: translateX(4px);
}

.player-timeline .timeline-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-timeline .timeline-item.active {
    background: rgba(61, 170, 47, 0.25);
    border-left-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(61, 170, 47, 0.3);
}

/* Match session groups */
.match-session-group {
    margin-bottom: 18px;
}

.match-session-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(61, 170, 47, 0.12);
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 0.3px;
}

.match-session-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.match-session-icon {
    font-size: 1em;
}

.match-session-count {
    margin-left: auto;
    font-size: 0.9em;
    opacity: 0.7;
    font-weight: 400;
}

.assign-video-btn {
    background: rgba(61, 170, 47, 0.15);
    border: 1px solid rgba(61, 170, 47, 0.4);
    color: var(--primary-color);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.75em;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.assign-video-btn:hover {
    background: rgba(61, 170, 47, 0.3);
}

.action-score-badge {
    margin-left: auto;
    flex-shrink: 0;
    background: var(--card-color);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8em;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

@media (max-width: 1024px) {
    .actions-video-layout {
        grid-template-columns: 1fr;
    }
}
}
.profile-stat input:focus { outline: none; border-bottom: 1px solid var(--primary-color); }

/* ===== ADMIN PANEL ===== */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: var(--primary-dark, #009872); }

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text-color);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover { background: rgba(255,255,255,0.14); }

.btn-edit {
    background: rgba(61, 170, 47,0.15);
    border: 1px solid rgba(61, 170, 47,0.35);
    color: var(--primary-color);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.82em;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-edit:hover { background: rgba(61, 170, 47,0.3); }

.btn-danger {
    background: rgba(231,76,60,0.12);
    border: 1px solid rgba(231,76,60,0.35);
    color: #ff8a80;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.82em;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover { background: rgba(231,76,60,0.28); }

/* Users table */
.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.users-table th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    color: var(--muted-text);
    font-weight: 600;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.users-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    vertical-align: middle;
}

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

.users-table td:last-child {
    display: flex;
    gap: 6px;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: 700;
    margin-right: 8px;
    vertical-align: middle;
}

.badge-you {
    background: rgba(61, 170, 47,0.2);
    color: var(--primary-color);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.75em;
    margin-left: 6px;
    vertical-align: middle;
}

.role-badge {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 500;
}

.role-admin {
    background: rgba(155,89,182,0.2);
    color: #c39bd3;
    border: 1px solid rgba(155,89,182,0.3);
}

.role-user {
    background: rgba(61, 170, 47, 0.15);
    color: #7dc878;
    border: 1px solid rgba(61, 170, 47, 0.25);
}

/* ===== MODAL ===== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    background: var(--card-color);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted-text);
    font-size: 1.2em;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--text-color); }

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.modal-body .form-group label {
    font-size: 0.83em;
    color: var(--muted-text);
    font-weight: 500;
}

.modal-body .form-group input,
.modal-body .form-group select {
    padding: 9px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus {
    border-color: var(--primary-color);
}

.modal-error {
    color: #ff8a80;
    font-size: 0.85em;
    min-height: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* nav-link admin variant */
.nav-link-admin {
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 8px;
    padding-top: 16px;
}


/* ─── CARRUSEL DE PARTIDOS ─────────────────────────────────────────────────── */
.matches-carousel-section {
    background: rgba(10,10,10,0.92);
    border-bottom: 1px solid rgba(61,170,47,0.2);
    padding: 6px 20px 6px;
}
.matches-carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.matches-carousel-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-color);
}
.matches-carousel-nav {
    display: flex;
    gap: 4px;
}
.carousel-nav-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: #ccc;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.carousel-nav-btn:hover {
    background: rgba(61,170,47,0.18);
    color: #fff;
}
.matches-carousel-track-wrap {
    overflow: hidden;
    position: relative;
    max-height: 500px;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 1;
}
.matches-carousel-section.collapsed .matches-carousel-track-wrap {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}
.matches-carousel-section.collapsed .matches-carousel-header {
    margin-bottom: 0;
}
.carousel-toggle-btn {
    font-size: 1rem !important;
    transition: transform 0.3s ease;
}
.matches-carousel-section.collapsed .carousel-toggle-btn {
    transform: rotate(180deg);
}
.matches-carousel-track {
    display: flex;
    gap: 10px;
    transition: transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
    will-change: transform;
}
.match-card {
    flex: 0 0 180px;
    background: #141414;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.match-card:hover {
    transform: scale(1.03);
    border-color: rgba(61,170,47,0.5);
    box-shadow: 0 4px 18px rgba(0,0,0,0.5);
    z-index: 1;
}
.match-card.active-match {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color), 0 4px 18px rgba(61,170,47,0.25);
}
.match-card-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
    background: #111;
}
.match-card-body {
    padding: 7px 9px 8px;
}
.match-card-date {
    font-size: 0.65rem;
    color: #666;
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}
.match-card-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 4px;
}
.match-card-team {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.match-card-team.team-a { text-align: right; color: #ddd; }
.match-card-team.team-b { text-align: left; color: #999; }
.match-card-result {
    font-size: 0.85rem;
    font-weight: 900;
    color: #fff;
    background: #1e1e1e;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.05em;
}
.match-card-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
}
