/* Alineaciones Styles - Modernized */

.alineaciones-dashboard {
    min-height: 100vh;
    background: var(--bg);
}

.alineaciones-container {
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Jornada Header */
.jornada-header {
    background: var(--white);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.jornada-header h1 {
    margin: 0;
    color: var(--ink-strong);
    font-size: 1.25rem;
}

.jornada-nav {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.btn-jornada {
    padding: 0.55rem 1.1rem;
    background: var(--primary);
    color: var(--white);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: background var(--t-base, 180ms) ease, transform var(--t-fast, 120ms) ease;
    box-shadow: var(--shadow-xs);
}

.btn-jornada:hover {
    background: var(--primary-dark);
}

.btn-jornada:active {
    transform: translateY(1px);
}

.btn-jornada:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.select-jornada {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    min-width: 150px;
    background: var(--white);
    color: var(--ink);
    transition: border-color var(--t-base, 180ms) ease, box-shadow var(--t-base, 180ms) ease;
}

.select-jornada:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
}

/* Squad Panel (Left) */
.squad-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 250px);
}

.squad-panel h3 {
    margin: 0 0 1rem 0;
    color: var(--ink-strong);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.squad-filters {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 0.85rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-family: var(--font-sans);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    transition: all var(--t-base, 180ms) ease;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--ink-strong);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: var(--shadow-xs);
}

.squad-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    flex: 1;
    padding-right: 0.5rem;
}

.squad-list::-webkit-scrollbar {
    width: 8px;
}

.squad-list::-webkit-scrollbar-track {
    background: var(--surface-alt);
    border-radius: 4px;
}

.squad-list::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

.squad-list::-webkit-scrollbar-thumb:hover {
    background: var(--ink-soft);
}

.position-group {
    border-top: 2px solid var(--border);
    padding-top: 0.85rem;
}

.position-group.POR {
    border-color: var(--pos-por);
}

.position-group.DEF {
    border-color: var(--pos-def);
}

.position-group.MED {
    border-color: var(--pos-med);
}

.position-group.DEL {
    border-color: var(--pos-del);
}

.position-group-title {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--ink-strong);
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.position-group-players {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.player-item {
    background: var(--surface-alt);
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--t-base, 180ms) ease, border-color var(--t-base, 180ms) ease;
    border: 1px solid transparent;
}

.player-item:hover {
    background: var(--white);
    border-color: var(--border-strong);
}

.player-item.selected {
    background: rgba(20, 84, 58, 0.06);
    border-color: var(--primary);
}

.player-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.player-shield {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.player-text {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-weight: 600;
    color: var(--ink-strong);
    font-size: 0.875rem;
    margin-bottom: 0.15rem;
}

.player-details {
    display: flex;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--ink-muted);
    align-items: center;
}

.player-pos {
    padding: 1px 6px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    font-size: 0.65rem;
}

.player-pos.POR { color: var(--pos-por); border-color: rgba(200, 155, 60, 0.3); }
.player-pos.DEF { color: var(--pos-def); border-color: rgba(30, 78, 168, 0.25); }
.player-pos.MED { color: var(--pos-med); border-color: rgba(29, 107, 74, 0.25); }
.player-pos.DEL { color: var(--pos-del); border-color: rgba(184, 51, 42, 0.25); }

.btn-select {
    padding: 0.4rem 0.65rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-xs);
    font-family: var(--font-sans);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: background var(--t-base, 180ms) ease;
    min-width: 36px;
    line-height: 1;
}

.btn-select:hover {
    background: var(--primary-dark);
}

.btn-select.selected {
    background: var(--secondary);
}

/* Field Panel (Center/Right) */
.field-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    padding: 1.75rem;
}

/* Formation Selector */
.formation-selector {
    margin-bottom: 1.5rem;
    text-align: center;
}

.formation-selector label,
.formation-selector .formation-label {
    display: block;
    font-weight: 700;
    color: var(--ink-strong);
    margin-bottom: 0.85rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.formation-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.formation-btn {
    padding: 0.6rem 1.25rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all var(--t-base, 180ms) ease;
    color: var(--ink-strong);
    letter-spacing: 0.02em;
    font-feature-settings: 'tnum';
}

.formation-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.formation-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Football Field */
.football-field {
    background:
        repeating-linear-gradient(
            0deg,
            #1e6b3a 0,
            #1e6b3a 60px,
            #266f3f 60px,
            #266f3f 120px
        );
    border-radius: var(--radius-lg);
    padding: 2rem 1rem;
    min-height: 500px;
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-around;
    border: 3px solid rgba(255, 255, 255, 0.85);
    position: relative;
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.15),
        var(--shadow-md);
}

.football-field::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.35);
}

.football-field::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.field-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}

.line-label {
    color: var(--white);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: rgba(0, 0, 0, 0.45);
    padding: 0.2rem 0.85rem;
    border-radius: var(--radius-pill);
    backdrop-filter: blur(4px);
}

.positions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.position-slot {
    width: 110px;
    height: 120px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px dashed rgba(0, 0, 0, 0.18);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--t-base, 180ms) ease;
    position: relative;
}

.position-slot:hover {
    border-color: var(--primary);
    background: var(--white);
    transform: scale(1.04);
    box-shadow: var(--shadow-md);
}

.position-slot.filled {
    background: var(--white);
    border: 2px solid var(--primary);
    color: var(--ink);
    cursor: default;
    box-shadow: var(--shadow-sm);
}

.position-slot.filled:hover {
    transform: scale(1);
}

.slot-empty {
    font-size: 2rem;
    color: rgba(0, 0, 0, 0.18);
    font-weight: 300;
}

.slot-player {
    text-align: center;
    padding: 0.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    overflow: hidden;
}

.slot-shield {
    width: 28px;
    height: 28px;
    object-fit: contain;
    margin-bottom: 0.2rem;
    flex-shrink: 0;
}

.slot-player-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-strong);
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.1;
    max-height: 2.2em;
    width: 100%;
    word-break: break-word;
}

.slot-player-team {
    font-size: 0.68rem;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.slot-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    border: 2px solid var(--white);
    font-weight: bold;
    transition: transform var(--t-fast, 120ms) ease, background var(--t-base, 180ms) ease;
    box-shadow: var(--shadow-sm);
}

.slot-remove:hover {
    background: var(--accent-red-dark);
    transform: scale(1.1);
}

/* Save Section */
.save-section {
    margin-top: 1.5rem;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn-save {
    padding: 0.85rem 2.5rem;
    background: var(--secondary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--t-base, 180ms) ease, transform var(--t-fast, 120ms) ease, box-shadow var(--t-base, 180ms) ease;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.02em;
}

.btn-save:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-save:active {
    transform: translateY(0);
}

.btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-reset {
    padding: 0.85rem 1.75rem;
    background: var(--white);
    color: var(--accent-red-dark);
    border: 1px solid rgba(184, 51, 42, 0.25);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--t-base, 180ms) ease, transform var(--t-fast, 120ms) ease;
    letter-spacing: 0.02em;
}

.btn-reset:hover {
    background: rgba(184, 51, 42, 0.08);
    transform: translateY(-1px);
}

.save-status {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    display: none;
}

.save-status.show {
    display: block;
}

.save-status.success {
    background: #e7f5ed;
    color: #0a3424;
    border: 1px solid rgba(29, 107, 74, 0.3);
}

.save-status.error {
    background: #fbeae8;
    color: #6b1c16;
    border: 1px solid rgba(184, 51, 42, 0.3);
}

.save-status.info {
    background: #eef4f7;
    color: #173d4b;
    border: 1px solid rgba(23, 61, 75, 0.25);
}

.validation-errors {
    margin-top: 1rem;
    padding: 1rem;
    background: #fbeae8;
    color: #6b1c16;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(184, 51, 42, 0.3);
    display: none;
}

.validation-errors.show {
    display: block;
}

.validation-errors ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 320px 1fr;
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .squad-panel {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .jornada-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .formation-buttons {
        gap: 0.4rem;
    }

    .formation-btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.85rem;
    }

    .position-slot {
        width: 85px;
        height: 100px;
    }

    .slot-player-name {
        font-size: 0.7rem;
    }
    
    .slot-shield {
        width: 24px;
        height: 24px;
    }

    .positions {
        gap: 0.5rem;
    }

    .football-field {
        padding: 1rem 0.5rem;
        min-height: 400px;
    }
}
.countdown-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 2.15rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-lg);
    background: rgba(243, 156, 18, 0.1);
    color: #765a12;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.countdown-display.is-closed {
    border: 1px solid rgba(185, 28, 28, 0.45);
    letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   El once en juego — campo protagonista y plantilla accionable
   -------------------------------------------------------------------------- */

.page-alineaciones {
    background: var(--myth-paper);
}

.alineaciones-dashboard {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 35%),
        var(--myth-paper);
}

.alineaciones-container {
    max-width: 1440px;
    padding: clamp(1.25rem, 3vw, 3rem) clamp(0.75rem, 3vw, 2.5rem);
}

.jornada-header {
    align-items: flex-end;
    gap: 1.5rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 0;
    border-top: 4px solid var(--myth-red);
    border-radius: 0 0 10px 10px;
    background: var(--myth-night);
    box-shadow: 6px 6px 0 rgba(180, 55, 36, 0.16);
    color: var(--myth-paper-light);
}

.jornada-heading-copy {
    min-width: 0;
}

.jornada-kicker,
.panel-kicker {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--myth-red);
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    line-height: 1.2;
    text-transform: uppercase;
}

.jornada-header h1 {
    color: var(--myth-paper-light);
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3.1rem);
    letter-spacing: 0.035em;
    line-height: 0.95;
}

.jornada-header h1 strong {
    color: var(--myth-gold);
    white-space: nowrap;
}

.jornada-heading-copy p {
    max-width: 58ch;
    margin: 0.75rem 0 0;
    color: rgba(250, 245, 232, 0.72);
    font-size: 0.92rem;
    line-height: 1.5;
}

.jornada-header-actions {
    display: grid;
    justify-items: end;
    gap: 0.75rem;
    flex-shrink: 0;
}

.jornada-status-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    align-items: center;
}

.lineup-count-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(232, 212, 170, 0.3);
    background: rgba(250, 245, 232, 0.08);
    color: var(--myth-paper-light);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lineup-count-badge strong {
    color: var(--myth-gold);
    font-family: var(--font-mono);
    font-size: 1rem;
}

.btn-jornada-actual {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 44px;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--myth-blue);
    border-radius: 3px;
    background: var(--myth-blue);
    color: var(--myth-paper-light);
    font-family: var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.btn-jornada-actual:hover,
.btn-jornada-actual:focus-visible {
    background: var(--myth-blue-dark);
    color: var(--myth-paper-light);
}

.main-content {
    grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
    align-items: start;
}

.squad-panel,
.field-panel {
    border: 1px solid var(--myth-rule);
    border-radius: 8px;
    background: var(--myth-paper-light);
    box-shadow: 4px 4px 0 rgba(1, 23, 45, 0.08);
}

.squad-panel {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 112px);
    padding: 1.25rem;
}

.panel-heading,
.field-panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.panel-heading h2,
.field-panel-heading h2 {
    margin: 0;
    color: var(--myth-ink);
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
}

.squad-count {
    display: grid;
    place-items: center;
    min-width: 2.3rem;
    min-height: 2.3rem;
    border: 1px solid var(--myth-rule);
    color: var(--myth-red);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
}

.panel-help {
    margin: 0.75rem 0 1rem;
    color: var(--myth-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.squad-filters {
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.filter-btn {
    min-height: 36px;
    padding: 0.4rem 0.65rem;
    border-radius: 3px;
    background: transparent;
    color: var(--myth-muted);
}

.filter-btn:hover,
.filter-btn:focus-visible {
    border-color: var(--myth-blue);
    color: var(--myth-blue-dark);
}

.filter-btn.active {
    border-color: var(--myth-red);
    background: var(--myth-red);
    color: var(--myth-paper-light);
}

.squad-list {
    gap: 1rem;
    padding-right: 0.25rem;
}

.position-group {
    border-top: 1px solid var(--myth-rule);
    padding-top: 0.75rem;
}

.position-group-title {
    color: var(--myth-muted);
    font-family: var(--font-display);
    font-size: 0.76rem;
    letter-spacing: 0.12em;
}

.position-group-players {
    gap: 0.35rem;
}

.player-item {
    min-height: 58px;
    padding: 0.55rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #f1e7d3;
    cursor: pointer;
    user-select: none;
}

.player-item:hover,
.player-item:focus-visible {
    border-color: var(--myth-blue);
    background: var(--myth-white);
    outline: none;
}

.player-item.selected {
    border-color: var(--myth-red);
    background: rgba(180, 55, 36, 0.08);
}

.player-item.is-dragging {
    opacity: 0.55;
}

.player-info {
    gap: 0.55rem;
}

.player-shield {
    width: 32px;
    height: 32px;
}

.player-name {
    font-size: 0.82rem;
}

.btn-select {
    display: grid;
    place-items: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: var(--myth-night);
    color: var(--myth-paper-light);
    font-size: 1rem;
}

.btn-select.selected {
    background: var(--myth-red);
}

.field-panel {
    min-width: 0;
    padding: clamp(1rem, 2vw, 1.75rem);
}

.field-panel-heading {
    align-items: end;
    margin-bottom: 1rem;
}

.formation-selector {
    margin-bottom: 0;
    text-align: right;
}

.formation-selector .formation-label {
    margin-bottom: 0.45rem;
    color: var(--myth-muted);
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
}

.formation-buttons {
    justify-content: flex-end;
    gap: 0.35rem;
}

.formation-btn {
    min-height: 40px;
    padding: 0.45rem 0.65rem;
    border-radius: 3px;
    background: transparent;
    color: var(--myth-ink);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.formation-btn:hover,
.formation-btn:focus-visible {
    border-color: var(--myth-blue);
    color: var(--myth-blue-dark);
    transform: none;
}

.formation-btn.active {
    border-color: var(--myth-red);
    background: var(--myth-red);
    color: var(--myth-paper-light);
}

.field-status {
    display: flex;
    align-items: center;
    min-height: 42px;
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.8rem;
    border-left: 3px solid var(--myth-blue);
    background: rgba(8, 120, 154, 0.08);
    color: var(--myth-navy);
    font-size: 0.84rem;
    font-weight: 600;
}

.field-panel.is-complete .field-status {
    border-color: var(--myth-red);
    background: rgba(180, 55, 36, 0.1);
}

.football-field {
    min-height: clamp(500px, 60vw, 650px);
    padding: 2rem 1rem;
    overflow: hidden;
    border: 2px solid rgba(250, 245, 232, 0.86);
    border-radius: 8px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 12%, transparent 12% 24%),
        linear-gradient(135deg, var(--field-green-light), var(--field-green) 45%, var(--field-green-dark));
    box-shadow: inset 0 0 0 1px rgba(250, 245, 232, 0.18), 5px 5px 0 rgba(1, 23, 45, 0.15);
    isolation: isolate;
}

.football-field::before,
.football-field::after {
    display: none;
}

.pitch-markings {
    position: absolute;
    z-index: 0;
    inset: 18px;
    border: 1px solid rgba(250, 245, 232, 0.38);
    pointer-events: none;
}

.pitch-halfway {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(250, 245, 232, 0.42);
}

.pitch-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 112px;
    height: 112px;
    border: 1px solid rgba(250, 245, 232, 0.42);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.pitch-center-spot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(250, 245, 232, 0.7);
    transform: translate(-50%, -50%);
}

.pitch-box {
    position: absolute;
    left: 29%;
    width: 42%;
    height: 18%;
    border: 1px solid rgba(250, 245, 232, 0.38);
}

.pitch-box-top {
    top: 0;
    border-top: 0;
}

.pitch-box-bottom {
    bottom: 0;
    border-bottom: 0;
}

.pitch-goal {
    position: absolute;
    left: 42%;
    width: 16%;
    height: 2.5%;
    border: 1px solid rgba(250, 245, 232, 0.48);
}

.pitch-goal-top {
    top: -1px;
    border-top: 0;
}

.pitch-goal-bottom {
    bottom: -1px;
    border-bottom: 0;
}

.field-line {
    gap: 0.3rem;
}

.line-label {
    padding: 0.15rem 0.55rem;
    border: 1px solid rgba(250, 245, 232, 0.22);
    border-radius: 2px;
    background: rgba(1, 23, 45, 0.56);
    color: var(--myth-paper-light);
    font-family: var(--font-display);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
}

.positions {
    width: 100%;
    gap: clamp(0.3rem, 1.2vw, 1rem);
}

.position-slot {
    width: 104px;
    height: 112px;
    flex: 0 1 104px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--myth-paper-light);
    transition: transform var(--t-base, 180ms) ease, filter var(--t-base, 180ms) ease;
}

.position-slot:hover,
.position-slot:focus-visible {
    border: 0;
    background: transparent;
    box-shadow: none;
    outline: none;
    transform: translateY(-3px);
}

.position-slot:focus-visible .slot-empty,
.position-slot:focus-visible .slot-player {
    outline: 3px solid var(--myth-gold);
    outline-offset: 3px;
}

.position-slot.drop-target {
    filter: drop-shadow(0 0 9px rgba(213, 162, 62, 0.85));
}

.slot-empty {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border: 1px dashed rgba(250, 245, 232, 0.68);
    border-radius: 50%;
    background: rgba(1, 23, 45, 0.22);
    color: rgba(250, 245, 232, 0.86);
    font-family: var(--font-display);
    font-size: 1.8rem;
}

.position-slot.filled {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.position-slot.filled:hover {
    transform: translateY(-3px);
}

.slot-player {
    width: 88px;
    height: 88px;
    padding: 0.45rem;
    border: 3px solid var(--myth-paper-light);
    border-radius: 50%;
    background: var(--myth-paper-light);
    box-shadow: 0 3px 0 rgba(1, 23, 45, 0.28);
    color: var(--myth-ink);
    gap: 0.08rem;
}

.position-slot--por .slot-player {
    border-color: var(--myth-gold);
}

.position-slot--def .slot-player {
    border-color: var(--pos-def);
}

.position-slot--med .slot-player {
    border-color: var(--pos-med);
}

.position-slot--del .slot-player {
    border-color: var(--pos-del);
}

.slot-shield {
    width: 24px;
    height: 24px;
    margin-bottom: 0.05rem;
}

.slot-player-name {
    color: var(--myth-ink);
    font-size: 0.68rem;
    line-height: 1.05;
}

.slot-player-team {
    color: var(--myth-muted);
    font-size: 0.56rem;
}

.slot-remove {
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    border: 2px solid var(--myth-paper-light);
    background: var(--myth-red);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1;
}

.slot-remove:hover,
.slot-remove:focus-visible {
    background: var(--myth-red-dark);
    outline: 2px solid var(--myth-gold);
    outline-offset: 2px;
    transform: none;
}

.save-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--myth-rule);
    text-align: left;
}

.save-summary {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--myth-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.save-summary-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--myth-blue);
}

.field-panel.is-complete .save-summary-dot {
    background: var(--myth-red);
}

.action-buttons {
    margin-bottom: 0;
    justify-content: flex-end;
}

.btn-save,
.btn-reset {
    min-height: 44px;
    border-radius: 3px;
}

.btn-save {
    background: var(--myth-red);
}

.btn-save:hover,
.btn-save:focus-visible {
    background: var(--myth-red-dark);
}

.btn-reset {
    color: var(--myth-red-dark);
    border-color: rgba(180, 55, 36, 0.35);
    background: transparent;
}

.btn-reset:hover,
.btn-reset:focus-visible {
    background: rgba(180, 55, 36, 0.08);
}

.save-status,
.validation-errors {
    grid-column: 1 / -1;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .field-panel {
        order: -1;
    }

    .squad-panel {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .jornada-header {
        align-items: stretch;
    }

    .jornada-header-actions {
        justify-items: stretch;
    }

    .jornada-status-line {
        justify-content: space-between;
    }

    .btn-jornada-actual {
        justify-content: space-between;
    }

    .field-panel-heading {
        display: grid;
        align-items: start;
    }

    .formation-selector {
        text-align: left;
    }

    .formation-buttons {
        justify-content: flex-start;
    }

    .football-field {
        min-height: 540px;
        padding: 1.5rem 0.4rem;
    }

    .position-slot {
        width: 84px;
        height: 100px;
        flex-basis: 84px;
    }

    .slot-player {
        width: 76px;
        height: 76px;
    }

    .slot-empty {
        width: 64px;
        height: 64px;
    }

    .slot-remove {
        width: 38px;
        height: 38px;
    }

    .save-section {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        display: grid;
        grid-template-columns: 1fr 1.35fr;
    }

    .action-buttons button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .alineaciones-container {
        padding-inline: 0.55rem;
    }

    .field-panel,
    .squad-panel {
        padding: 0.85rem;
    }

    .football-field {
        min-height: 500px;
    }

    .position-slot {
        width: 72px;
        height: 88px;
        flex-basis: 72px;
    }

    .slot-player {
        width: 68px;
        height: 68px;
        border-width: 2px;
    }

    .slot-shield {
        width: 19px;
        height: 19px;
    }

    .slot-player-name {
        font-size: 0.6rem;
    }

    .slot-player-team {
        font-size: 0.5rem;
    }

    .line-label {
        font-size: 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .player-item,
    .formation-btn,
    .position-slot,
    .slot-remove,
    .btn-save,
    .btn-reset {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Estado de alineación: la herramienta comunica primero qué puede hacer
   -------------------------------------------------------------------------- */
.jornada-header-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.btn-jornada-rules {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.65rem 0.8rem;
    border: 1px solid rgba(250, 245, 232, 0.3);
    border-radius: 3px;
    color: var(--myth-paper-light);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

.btn-jornada-rules:hover,
.btn-jornada-rules:focus-visible {
    border-color: var(--myth-gold);
    color: var(--myth-gold);
}

.lineup-status-strip {
    grid-area: state;
    margin-top: 1.35rem;
    padding-top: 1.05rem;
    border-top: 1px solid var(--myth-rule);
}

.lineup-status-strip h2 {
    margin: 0.3rem 0 0;
    color: var(--myth-ink);
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2.5vw, 1.8rem);
    letter-spacing: -0.02em;
    line-height: 1;
    text-transform: uppercase;
}

.lineup-status-strip p {
    max-width: 58ch;
    margin: 0.5rem 0 0;
    color: var(--myth-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.confirmation-details {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.45rem 0.8rem;
    margin-top: 0.8rem;
    color: var(--myth-muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.confirmation-details strong {
    color: var(--myth-red);
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.06em;
}

.confirmation-details small {
    color: var(--myth-muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 0;
    text-transform: none;
}

.field-panel[data-lineup-state="readonly"] .field-status {
    border-color: var(--myth-gold);
    background: rgba(213, 162, 62, 0.1);
}

.field-panel[data-lineup-state="readonly"] .position-slot,
.field-panel[data-lineup-state="readonly"] .slot-remove {
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .jornada-header-links {
        justify-content: stretch;
    }

    .jornada-header-links > * {
        flex: 1 1 0;
    }

}

@media (max-width: 480px) {
    .lineup-status-strip {
        margin-top: 1rem;
        padding-top: 0.9rem;
    }
}

/* Cabecera y estado forman una sola superficie de preparación. */
.alineaciones-dashboard .jornada-header {
    display: grid;
    grid-template-areas:
        "copy actions"
        "state state";
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.alineaciones-dashboard .jornada-heading-copy {
    grid-area: copy;
}

.alineaciones-dashboard .jornada-header-actions {
    grid-area: actions;
}

@media (max-width: 768px) {
    .alineaciones-dashboard .jornada-header {
        grid-template-areas:
            "copy"
            "actions"
            "state";
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .alineaciones-dashboard .jornada-header-actions {
        justify-items: stretch;
    }
}
/* Identity states stay distinct from an empty, valid manager roster. */
.alineacion-identity-state {
    max-width: 38rem;
    margin: 4rem auto;
    padding: 2.5rem 2rem;
    text-align: center;
    color: var(--ink-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

/* Selector y navegacion de jornada: compactos para conservar el masthead. */
.page-alineaciones .lineup-jornada-context {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
}

.page-alineaciones .lineup-jornada-context > #jornada-heading {
    display: none;
}

.page-alineaciones .lineup-jornada-nav {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.15rem;
    max-width: 100%;
    min-width: 0;
}

.page-alineaciones .lineup-jornada-nav strong {
    flex: 0 0 auto;
}

.page-alineaciones .jornada-nav-button {
    display: inline-grid;
    place-items: center;
    width: 1.45rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid rgba(242, 231, 205, 0.45);
    border-radius: 0;
    color: var(--myth-paper-light);
    background: transparent;
    font: 700 1.1rem/1 var(--myth-font-label);
}

.page-alineaciones .jornada-nav-button:hover,
.page-alineaciones .jornada-nav-button:focus-visible {
    border-color: var(--myth-gold);
    color: var(--myth-gold);
    background: rgba(242, 231, 205, 0.08);
}

.page-alineaciones .jornada-nav-button:disabled {
    opacity: 0.32;
    cursor: not-allowed;
}

.page-alineaciones .lineup-jornada-picker {
    display: inline-flex;
    width: auto;
    min-width: 0;
}

.page-alineaciones .lineup-jornada-picker .select-jornada {
    width: 6.25rem;
    min-height: 1.75rem;
    height: 1.75rem;
    min-width: 0;
    max-width: 100%;
    padding: 0.25rem 1.45rem 0.25rem 0.45rem;
    border: 1px solid rgba(242, 231, 205, 0.65);
    border-radius: 0;
    color: #000 !important;
    background: #fff;
    font: 700 0.68rem/1.1 var(--myth-font-label);
    letter-spacing: 0.02em;
}

.page-alineaciones .lineup-jornada-picker .select-jornada option,
.page-alineaciones .lineup-jornada-picker .select-jornada option:checked {
    color: #000 !important;
    background: #fff;
    font-weight: 700;
}

.page-alineaciones .lineup-jornada-picker .select-jornada:focus-visible {
    outline: 2px solid var(--myth-gold);
    outline-offset: 2px;
}

@media (max-width: 560px) {
    .page-alineaciones .lineup-jornada-picker .select-jornada {
        width: 7rem;
    }
}

.alineacion-identity-state h2 {
    margin: 0 0 0.75rem;
    color: var(--ink-strong);
}

.alineacion-identity-state p {
    margin: 0;
}
