/* [경기장] 메인 레이아웃 */
.field-wrapper {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    margin: 4% 0;
    position: relative;
}

.team {
    flex: 1;
    padding: 20px;
    text-align: center;
    position: relative;
    border: 2px solid white;
}

/* 세로형 원코트 필드 전용 스타일 (그라운드 이미지 통일) */
.vertical-field-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
    overflow: hidden;
    /* [수정] 외부 배경을 경기장과 동일한 잔디색 및 가로 줄무늬로 통일 */
    background-color: #2e7d32; 
    background-image: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.04) 50%,
        transparent 50%
    );
    background-size: 100% 80px;
    position: relative;
}

.vertical-field {
    /* [수정] 컨테이너와 배경이 통일되었으므로 배경 제거하고 투명하게 설정 */
    background-color: transparent;
    background-image: none;
    position: relative;
    width: auto;
    height: 85%;
    aspect-ratio: 10 / 14;
    border: 4px solid rgba(255,255,255,0.6); /* 경기장 외곽 라인은 유지하여 전술판 느낌 강조 */
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.3); /* 그림자는 살짝 줄여 일체감 부여 */
    overflow: visible; 
    margin-bottom: 80px;
    border-radius: 4px;
    z-index: 5;
}

/* 경기장 라인 (하얀색 반투명 전술판 감성) */
.vertical-field .goal-line { 
    width: 100%; height: 2px; background-color: rgba(255, 255, 255, 0.5); 
    position: absolute; left: 0; bottom: 0; 
}
.vertical-field .center-circle { 
    width: 140px; height: 140px; border: 2px solid rgba(255, 255, 255, 0.5); 
    border-radius: 50%; position: absolute; left: 50%; top: -70px; transform: translateX(-50%); 
}
.vertical-field .penalty-box { 
    width: 66%; height: 18%; border: 2px solid rgba(255, 255, 255, 0.5); 
    border-bottom: 0; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); 
}
.vertical-field .goal-area { 
    width: 34%; height: 6.5%; border: 2px solid rgba(255, 255, 255, 0.5); 
    border-bottom: 0; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); 
}
.vertical-field .penalty-arc { 
    width: 130px; height: 85px; border: 2px solid rgba(255, 255, 255, 0.5); 
    border-bottom: 0; border-radius: 100px 100px 0 0; 
    position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); 
}

/* 이름표 스타일 (초록 그라운드용 고가독성) */
.depth-name-plate {
    background: rgba(0, 0, 0, 0.85) !important; /* 검정 캡슐 */
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    margin-top: -2px; /* 이름표끼리 살짝 겹치게 */
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); /* 입체감 */
    border: 0.5px solid rgba(255, 255, 255, 0.1); /* 연한 하얀색 테두리 */
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 95%; /* 영역 초과 방지 */
    min-width: 60px;
    text-align: center;
    font-size: 11px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; /* 겹침 방지 우선순위 */
}

/* 선발 선수(Index 0)는 조금 더 돋보이게 테두리 강조 및 위로 올림 */
.depth-name-plate:not(.is-sub) {
    border-color: rgba(255, 255, 255, 0.5);
    z-index: 10;
}

/* 서브 선수는 스케일, 투명도, 색상을 낮춰 뒷배경 느낌 주기 */
.depth-name-plate.is-sub {
    opacity: 0.9;
    transform: scale(0.95);
    background: rgba(20, 20, 20, 0.85) !important;
    color: rgba(255, 255, 255, 0.7);
    font-weight: normal;
    z-index: 5;
}

.jersey-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
    margin-bottom: 2px;
    transform: scale(1);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.name-plates-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.depth-jersey {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
    z-index: 99;
    background-color: var(--team-a-color, #e11d48);
    /* 유니폼 모양 컷팅 */
    clip-path: polygon(15% 0%, 85% 0%, 100% 25%, 85% 35%, 85% 100%, 15% 100%, 15% 35%, 0% 25%);
    border: 1px solid rgba(255,255,255,0.2);
    box-sizing: border-box;
}

.depth-jersey.gk {
    background-color: #f59e0b !important; /* 골키퍼 오렌지색 */
}

.depth-slot {
    position: absolute;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    z-index: 100;
    pointer-events: none;
}

/* 대기 명단 사이드바 선수 카드 스타일 */
.sidebar-player-card {
    transition: all 0.2s ease;
}

.sidebar-player-card:hover {
    background-color: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.sidebar-player-card.selected-backup {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.sidebar-player-card.selected-backup .depth-name-plate {
    background-color: #3b82f6;
    border-color: #2563eb;
}

/* [신규] 전술 블록 레이어 스타일 */
.tactical-blocks-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 필드에 show-blocks 클래스가 있을 때만 표시 */
.team.show-blocks .tactical-blocks-layer {
    opacity: 1;
}

.tactical-block-zone {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 20px;
    border-right: 1.5px dashed rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

.tactical-block-zone.defensive { width: 66.6%; background: rgba(239, 68, 68, 0.03); }
.tactical-block-zone.midfield-left { width: 33.4%; border-right: 0; background: rgba(59, 130, 246, 0.03); }
.tactical-block-zone.midfield-right { width: 33.4%; background: rgba(59, 130, 246, 0.03); }
.tactical-block-zone.attacking { width: 66.6%; border-right: 0; background: rgba(16, 185, 129, 0.03); }

.block-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 세로형 원코트 대응 (누적 포메이션 등) */
.vertical-field .tactical-blocks-layer {
    flex-direction: column;
}

.vertical-field .tactical-block-zone {
    width: 100% !important;
    border-right: 0;
    border-bottom: 1.5px dashed rgba(255, 255, 255, 0.2);
    justify-content: center;
    padding-bottom: 0;
}

/* [신규] 누적 포메이션 모달 모바일 반응형 대응 */
@media (max-width: 768px) {
    #cumulative-modal .modal-content {
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    #cumulative-modal .modal-body {
        flex-direction: column !important;
        overflow-y: auto !important;
    }
    
    .vertical-field-container {
        height: 50vh !important;
        flex: none !important;
        padding: 15px 10px !important;
    }
    
    .vertical-field {
        height: 95% !important;
        margin-bottom: 20px !important;
    }
    
    #cumulative-sidebar {
        width: 100% !important;
        height: 50vh !important;
        flex: none !important;
        border-l: 0 !important;
        border-t: 1px solid #eee !important;
    }
    
    #cumulative-squad-list {
        display: grid !important; 
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    
    .sidebar-player-card {
        padding: 8px 4px !important;
    }
    
    .sidebar-player-card .depth-name-plate {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 9px !important;
    }

    #cumulative-modal .modal-header {
        padding: 10px 15px !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    #cumulative-modal .modal-header .flex.items-center.gap-4 {
        gap: 8px !important;
        width: 100% !important;
        justify-content: space-between !important;
    }

    #cumulative-modal h2 {
        font-size: 16px !important;
    }

    #cumulative-formation-select {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }

    /* [신규] 전술판 모달 모바일 반응형 대응 */
    #tactics-modal .modal-content {
        height: 100% !important;
        width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }

    #tactics-modal .modal-body {
        padding-bottom: 80px !important; /* 하단 툴바 공간 확보 */
    }

    #tactics-modal .tactics-toolbar {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 50 !important;
        background: rgba(255, 255, 255, 0.9) !important;
        backdrop-filter: blur(10px) !important;
        border-top: 1px solid #eee !important;
        border-bottom: 0 !important;
        padding: 8px !important;
        justify-content: space-around !important;
    }

    #tactics-modal .tactics-toolbar > div {
        padding: 4px !important;
    }

    #tactics-modal .tactics-toolbar button {
        width: 44px !important;
        height: 44px !important;
    }

    #tactics-modal .w-px.h-8 {
        display: none !important; /* 구분선 숨기기 */
    }
}
