body {
    margin: 0; padding: 0;
    background-color: transparent;
    min-height: 100vh;
    font-family: 'Pretendard', sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

body.dark-mode { background-color: #121212; }
body.broadcast-mode { background-color: transparent !important; }

.standalone-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-bottom: 100px;
}

/* 경기 인스턴스: 겹침 방지 및 가독성 중심 간격 설정 */
.match-instance-wrapper {
    margin: 10px 0;
    width: fit-content;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
    position: relative;
}

@media (min-width: 1025px) {
    .match-instance-wrapper { transform: scale(1.1); margin: 20px 0; }
}
@media (max-width: 1024px) {
    .match-instance-wrapper { transform: scale(0.9); margin: 5px 0; }
}
@media (max-width: 768px) {
    .match-instance-wrapper { transform: scale(0.8); margin: -5px 0; }
}
@media (max-width: 600px) {
    .match-instance-wrapper { transform: scale(0.7); margin: -12px 0; }
}
@media (max-width: 480px) {
    .match-instance-wrapper { transform: scale(0.65); margin: -15px 0; }
}
@media (max-width: 380px) {
    .match-instance-wrapper { transform: scale(0.6); margin: -18px 0; }
}

/* 1차전 표시 영역 */
.first-leg-display {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    text-align: center;
    background: rgba(0, 0, 0, 0.95);
    color: #ffd700;
    padding: 2px 0;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    font-weight: 800;
    z-index: 5;
    border: 1px solid #333;
    border-bottom: none;
}
.first-leg-display.show { display: block; }

.first-leg-spacer { height: 22px; width: 100%; background: transparent; }
.first-leg-spacer.hidden { display: none !important; }

/* PK 바: 한 줄 레이아웃 강제 고정 */
.pk-bar {
    display: none;
    width: 100%;
    background: #000;
    border-top: 1px solid #333;
    height: 40px;
    align-items: center;
    justify-content: center;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
}
.pk-bar:not(.hidden) { display: flex !important; }

.pk-team-wrapper { flex: 1; display: flex; align-items: center; min-width: 0; }
.pk-team-wrapper.left { justify-content: flex-end; }
.pk-team-wrapper.right { justify-content: flex-start; }

.pk-score-box {
    background: #111;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    border-left: 1px solid #333;
    border-right: 1px solid #333;
    color: white;
    flex-shrink: 0;
}
.pk-label { color: #ffd700; font-size: 14px; margin-right: 4px; }
.kicker-dots { display: flex; gap: 4px; padding: 0 10px; }

/* 팀 검색 그리드 뷰 최적화 */
#search-results.grid-view {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 12px !important;
    padding: 10px !important;
}
#search-results.grid-view .search-result-item {
    min-height: 140px !important;
    padding: 10px 5px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
}
#search-results.grid-view .team-name {
    display: block !important;
    width: 100%;
    font-size: 12px !important;
    font-weight: 800 !important;
    text-align: center !important;
    color: #1e293b !important;
    margin-top: 8px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
}
#search-results.grid-view .team-logo { width: 50px !important; height: 50px !important; }

.team-wrapper.show-controls .team-controls { display: flex; }
.color-picker-input { width: 0; height: 0; visibility: hidden; position: absolute; }
.modal { z-index: 2000; }
#search-results { max-height: 400px; overflow-y: auto; }