/* 포지션 색상 */
.pos-GK { background-color: #f0ad00 !important; color: #fff; }
.pos-DF { background-color: #2f6fd6 !important; color: #fff; }
.pos-MF { background-color: #1f9d55 !important; color: #fff; }
.pos-FW { background-color: #d63a3a !important; color: #fff; }
.pos-ALL { background-color: #7b4bc4 !important; color: #fff; }
.badge + .badge { margin-left: 2px; }

/* 팀 색상 */
.team-blue { --team: #1e5bc6; }
.team-orange { --team: #f26b1d; }
.team-solo { --team: #198754; }
.card.team-blue, .card.team-orange, .card.team-solo { border-top: 4px solid var(--team); }

/* 참석자 선택 */
.player-picker { display: flex; flex-wrap: wrap; gap: 6px; max-height: 360px; overflow-y: auto; }
.attendee-label { display: inline-flex; align-items: center; gap: 4px; }
.btn-check:checked + .attendee-label .text-muted { color: #ddd !important; }

/* 쿼터 카드 */
.quarter-card { background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid #ddd; max-width: 520px; }
.qc-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--team); color: #fff; }
.qc-title { font-size: .9rem; opacity: .9; }
.qc-label { font-weight: 700; font-size: 1.15rem; }

.pitch {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-around; gap: 14px;
  min-height: 340px; padding: 18px 10px;
  background-color: #3a9d4a;
  background-image: repeating-linear-gradient(0deg, #3a9d4a 0 40px, #35904a 40px 80px);
}
.pitch::before, .pitch::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); border: 2px solid rgba(255,255,255,.55); }
.pitch::before { top: -2px; width: 45%; height: 42px; border-top: none; }       /* 상대 박스 */
.pitch::after  { bottom: -2px; width: 45%; height: 42px; border-bottom: none; } /* 우리 박스 */
.pitch-line { position: relative; z-index: 1; display: flex; justify-content: space-evenly; flex-wrap: wrap; gap: 6px; }

.pchip {
  display: inline-block; min-width: 64px; padding: 6px 10px; border-radius: 999px;
  text-align: center; font-weight: 600; font-size: .9rem; cursor: pointer; user-select: none;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.pchip.pref2 { border-style: dashed; }
.pchip.pref-none { border-color: #ffe066; }
.pchip.on-bench { background: #eee; color: #333; border-color: #ccc; box-shadow: none; }
.pchip.selected { outline: 3px solid #111; outline-offset: 2px; }

.bench { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px; background: #f7f7f7; min-height: 48px; }
.bench-label { font-weight: 700; font-size: .85rem; color: #666; margin-right: 4px; }

/* 이미지 캡처 시 선택 표시 제거 */
.capturing .pchip.selected { outline: none; }

/* ------------------------------------------------------------------
   선수 목록 (모바일 우선: 선수마다 한 블록, 넓은 화면에서는 한 줄)
   ------------------------------------------------------------------ */
/* 모바일: 1줄 = 이름·포지션 + 수정/삭제, 2줄 = 플래그 버튼 */
.player-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; scroll-margin-top: 16px; }
.player-main { order: 1; flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.player-name { font-weight: 600; font-size: 1.05rem; margin-right: 4px; }
.player-actions { order: 2; display: flex; gap: 6px; margin-left: auto; }
.player-flags { order: 3; flex: 1 1 100%; display: flex; gap: 6px; }
.player-row:target { background: #fff8e1; }
.flag-btn { white-space: nowrap; }
.flag-off { color: #888; border-color: #ddd; }
.flag-off b { font-weight: 400; }
@media (min-width: 768px) {
  /* 넓은 화면: 이름 · 플래그 · 수정/삭제 한 줄 */
  .player-flags { order: 2; flex: 0 0 auto; }
  .player-actions { order: 3; margin-left: 0; }
}

/* ------------------------------------------------------------------
   경기 배분 화면 - 모바일
   ------------------------------------------------------------------ */
.picker-tools { flex: 1 1 260px; max-width: 360px; }
.picker-tools #search { flex: 1 1 auto; min-width: 0; }

.result-nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin-bottom: 8px;
  background: #fff; border-bottom: 1px solid #eee; scrollbar-width: none;
}
.result-nav::-webkit-scrollbar { display: none; }
.result-nav .btn { white-space: nowrap; }
.scroll-target { scroll-margin-top: 64px; }

.img-item { margin: 0 0 16px; text-align: center; }
.img-item img { max-width: 100%; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; }
.img-item figcaption { font-size: .8rem; color: #666; margin-top: 4px; }

/* 더블탭 확대/지연 없이 바로 반응 */
.pchip, .btn, label.btn { touch-action: manipulation; }

@media (max-width: 991.98px) {
  /* 참석자 목록은 페이지 스크롤로 보고, 배분 버튼은 화면 아래에 고정 */
  .player-picker { max-height: none; }
  .generate-bar {
    position: sticky; bottom: 0; z-index: 10; background: #fff;
    box-shadow: 0 -2px 8px rgba(0,0,0,.08);
    padding-bottom: calc(.5rem + env(safe-area-inset-bottom, 0px));
  }
  /* iOS 는 16px 미만 입력칸을 누르면 화면을 확대한다 */
  .form-control, .form-select { font-size: 16px; }
  .quarter-card { max-width: none; }
}

/* 손가락으로 누르기 쉬운 크기 */
@media (pointer: coarse) {
  .btn-sm { min-height: 36px; padding-left: .7rem; padding-right: .7rem; }
  .pchip { min-height: 38px; }
}

/* ------------------------------------------------------------------
   양팀 모드: 팀 직접 배정 보드 (대기 / 파랑 / 주황)
   ------------------------------------------------------------------ */
.tb-zone { border: 2px dashed #ccc; border-radius: 10px; padding: 8px; min-height: 96px; background: #fafafa; height: 100%; }
.tb-zone.team-blue { border-color: var(--team); background: #eef3fc; }
.tb-zone.team-orange { border-color: var(--team); background: #fdf1ea; }
.tb-zone.drag-over { box-shadow: 0 0 0 3px rgba(25, 135, 84, .35); }
.tb-head { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.team-blue .tb-head, .team-orange .tb-head { color: var(--team); }
.tb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-chip {
  display: inline-flex; align-items: center; gap: 3px; min-height: 34px; padding: 4px 8px;
  border: 1px solid #555; border-radius: 6px; background: #fff; font-size: .875rem;
  cursor: grab; user-select: none; touch-action: manipulation;
}
.tb-chip.picked { outline: 3px solid #198754; outline-offset: 1px; }
/* 이름이 줄바꿈되지 않게, 좁은 팀 칸에서는 조금 작게 */
.tb-chip { white-space: nowrap; }
.team-blue .tb-chip, .team-orange .tb-chip { padding: 4px 6px; font-size: .8125rem; }
.team-blue .tb-chip .badge, .team-orange .tb-chip .badge { font-size: .625rem; padding: .3em .4em; }
