/* ===== 편집모드 ===== */
body.editing .player-row,
body.editing .crew-info-card { outline: 1px dashed rgba(0,240,255,.5); cursor: move; }
body.editing .player-row.idle { opacity: .6; }

.grid-guide-overlay {
  position: fixed; inset: 0; z-index: 400; pointer-events: none;
  display: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.10) 0 1px, transparent 1px var(--guide-cell-h, 40px)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 1px, transparent 1px var(--guide-cell-w, 40px));
}
body.editing .grid-guide-overlay { display: block; }

#editor-toolbar {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: none; gap: 8px; align-items: center;
  background: rgba(10,14,26,.95); border: 1px solid rgba(0,240,255,.4);
  border-radius: 8px; padding: 8px 12px; color: #fff; font-family: sans-serif; font-size: 13px;
}
body.editing #editor-toolbar { display: flex; flex-wrap: wrap; max-width: 96vw; }
#editor-toolbar button { background: #1A1F2E; color: #fff; border: 1px solid #334; border-radius: 5px; padding: 5px 9px; cursor: pointer; }
#editor-toolbar button:hover { background: #24304a; }
#editor-toolbar button.primary { background: #00838f; border-color: #00b0c0; }
#editor-toolbar button.danger { background: #7a1f2f; border-color: #b03048; }
#editor-toolbar .ed-mode { font-weight: 800; color: #00F0FF; margin-right: 4px; }
#editor-toolbar input { width: 46px; background: #0A0E1A; color: #fff; border: 1px solid #334; border-radius: 4px; padding: 3px; }

@keyframes edSelPulse {
  0%, 100% { outline: 5px solid #00F0FF; outline-offset: 0; background-color: rgba(0,240,255,.22);
             box-shadow: 0 0 16px 5px rgba(0,240,255,.85), inset 0 0 14px rgba(0,240,255,.4); }
  50%      { outline: 5px solid #FFE100; outline-offset: 2px; background-color: rgba(255,225,0,.30);
             box-shadow: 0 0 36px 13px rgba(255,225,0,.95), inset 0 0 20px rgba(255,225,0,.5); }
}
/* high-contrast cyan↔yellow blink; higher specificity than `body.editing .player-row` so it wins the dashed outline */
body.editing .player-row.ed-selected, body.editing .crew-info-card.ed-selected {
  z-index: 6;
  animation: edSelPulse .55s ease-in-out infinite;
}
.ed-resize-handle {
  position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px;
  background: #00F0FF; border-radius: 3px; cursor: nwse-resize; z-index: 6; display: none;
}
body.editing .ed-selected .ed-resize-handle { display: block; }
.ed-blocked { outline: 2px solid #FF3366 !important; }

/* 번호 뱃지 + (크루) 팀 칩을 좌상단에 나란히 배치 */
.ed-badge-row {
  position: absolute; top: 2px; left: 3px; z-index: 7;
  display: inline-flex; align-items: center; gap: 3px; pointer-events: none;
}
.ed-num-badge {
  font-family: sans-serif; font-size: clamp(9px, 1.4vh, 15px); font-weight: 800;
  color: #00F0FF; background: rgba(10,14,26,.72);
  border: 1px solid rgba(0,240,255,.5); border-radius: 4px;
  padding: 0 4px; line-height: 1.35;
}
.ed-team-chip {
  font-family: sans-serif; font-size: clamp(9px, 1.4vh, 15px); font-weight: 900;
  color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 4px;
  padding: 0 5px; line-height: 1.35; text-shadow: 0 1px 1px rgba(0,0,0,.5);
}
/* 인스펙터 R/B 팀 토글 */
#editor-toolbar .ed-team-toggle { display: inline-flex; align-items: center; gap: 3px; margin: 0 4px; }
#editor-toolbar .ed-team-btn {
  border: 1px solid #445; border-radius: 5px; padding: 4px 8px; cursor: pointer;
  font-weight: 900; color: #cfe; background: #1A1F2E;
}
#editor-toolbar .ed-team-btn.t1.active { background: #ef4444; border-color: #ff8a8a; color: #fff; }
#editor-toolbar .ed-team-btn.t2.active { background: #3b82f6; border-color: #9bc0ff; color: #fff; }
body.editing .crew-info-card { position: relative; }

#editor-toolbar .ed-modes { display: inline-flex; gap: 4px; margin-right: 4px; }
#editor-toolbar .ed-mode-btn { background: #1A1F2E; color: #cfe; border: 1px solid #334; border-radius: 5px; padding: 5px 9px; cursor: pointer; font-weight: 700; }
#editor-toolbar .ed-mode-btn:hover { background: #24304a; }
#editor-toolbar .ed-mode-btn.active { background: #00838f; border-color: #00F0FF; color: #fff; }
#editor-toolbar .ed-field { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; opacity: .9; }
#editor-toolbar .ed-field input { width: 52px; }

#editor-toolbar .ed-slots, #editor-toolbar .ed-lps { display:inline-flex; gap:3px; }
#editor-toolbar .ed-slot-btn, #editor-toolbar .ed-lp-btn { background:#1A1F2E; color:#cfe; border:1px solid #334; border-radius:5px; padding:4px 8px; cursor:pointer; font-weight:700; }
#editor-toolbar .ed-slot-btn.active, #editor-toolbar .ed-lp-btn.active { background:#00838f; border-color:#00F0FF; color:#fff; }
#editor-toolbar .ed-slot-btn.is-live { box-shadow: inset 0 -3px 0 #00FF88; }
