body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #121212;
  color: #fff;
  user-select: none;
}

/* 防止元素获得焦点时显示光标 */
.role-item, .team-role-item, .slot, .name-overlay, .attr, .role-detail, .team-label, .team-header, .clear-btn, .attr-btn, .status-btn, .drop-zone {
  pointer-events: auto;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  outline: none;
}

/* 禁用默认的焦点行为 */
.role-item:focus, .team-role-item:focus, .slot:focus, .name-overlay:focus, .attr:focus, .role-detail:focus, .team-label:focus, .team-header:focus, .clear-btn:focus, .attr-btn:focus, .status-btn:focus, .drop-zone:focus {
  outline: none;
  box-shadow: none;
}
nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 10px;
  background-color: #1e1e1e;
  border-bottom: 1px solid #333;
}
nav button {
  margin-right: 10px;
  padding: 8px 16px;
  cursor: pointer;
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 5px;
}
nav button:hover {
  background-color: #555;
}
.toggle-container {
  display: flex;
  align-items: center;
  margin-right: 15px;
}
.toggle-label {
  color: #fff;
  margin-right: 8px;
  font-size: 14px;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #555;
  transition: .4s;
  border-radius: 20px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .toggle-slider {
  background-color: #4ade80;
}
input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
.clear-all-btn {
  margin-left: auto;
  background-color: #dc3545;
}
.clear-all-btn:hover {
  background-color: #c82333;
}
.page {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
}
.hidden { display: none; }
.left-panel { flex: 1; min-width: 300px; padding: 20px; border-right: 1px solid #333; background:#1a1a1a; overflow-y: auto; }
.role-list-container {
  border: 1px solid #333;
  border-radius: 5px;
  padding: 10px;
  background: #2a2a2a;
  margin-bottom: 0;
  box-sizing: border-box;
}

#roleList {
  margin-bottom: 0;
}

.drop-zone {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 100px;
  background: rgba(74, 222, 128, 0.3);
  border: 4px dashed #4ade80;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  color: #4ade80;
  z-index: 9999;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(74, 222, 128, 0.7);
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.drop-zone:hover,
.drop-zone.drag-over {
  background: rgba(74, 222, 128, 0.4);
  border: 4px solid #4ade80;
  box-shadow: 0 0 40px rgba(74, 222, 128, 1);
  transform: translate(-50%, -50%) scale(1.1);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.7);
  }
  50% {
    box-shadow: 0 0 50px rgba(74, 222, 128, 1);
  }
  100% {
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.7);
  }
}
.right-panel { flex: 1; min-width: 300px; padding: 20px; background:#1a1a1a; overflow-y: auto; }

#teamSection {
  box-sizing: border-box;
}
.role-list { display: flex; flex-direction: column; gap: 20px; }

.role-section .role-list, #teamRoleList { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
.role-section {
  margin-bottom: 30px;
  border: 1px solid #333;
  border-radius: 5px;
  padding: 15px;
  background: #2a2a2a;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.section-btn {
  padding: 3px 8px;
  font-size: 12px;
  background: #555;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.section-btn:hover {
  background: #777;
}

.role-item, .team-role-item { position: relative; width: 80px; height: 80px; border: 1px solid #333; display: flex; align-items: center; justify-content: center; cursor: pointer; background:#2a2a2a; }

.status-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #4ade80;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.status-btn.remove {
  background: #dc2626;
}

.status-btn.remove:hover {
  background: #b91c1c;
}

.role-item:hover .status-btn {
  opacity: 1;
}

.role-item:hover .status-btn:not(.remove):hover {
  background: #22c55e;
}

.role-item:hover .status-btn.remove:hover {
  background: #b91c1c;
}

.attr-group {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.attr-group label {
  color: #fff;
  font-weight: 600;
  min-width: 50px;
}

.attr-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.attr-btn {
  width: 40px;
  height: 40px;
  background: #333;
  color: #fff;
  border: 1px solid #555;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.attr-btn:hover {
  background: #555;
}

.attr-btn.active {
  background: #4ade80;
  border-color: #4ade80;
  color: #000;
}
.role-item img, .team-role-item img { max-width: 90%; max-height: 80%; position:absolute; top:5%; left:50%; transform:translateX(-50%); }
.name-overlay { position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,.7); color:#fff; text-align:center; padding:3px 2px; font-size:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; z-index:5; }
.attr { position:absolute; bottom:18px; right:5px; background:rgba(0,0,0,.7); color:#fff; padding:2px 4px; font-size:10px; border-radius:2px; user-select: none; pointer-events: none; }
.uses { position:absolute; top:5px; right:5px; min-width:18px; text-align:center; padding:2px 4px; font-size:12px; border-radius:4px; }
.uses.green { background:#16a34a; }
.uses.red { background:#dc2626; }
.team-role-item.not-available { opacity:.4; cursor:not-allowed; }
.role-detail { text-align:center; background:#2a2a2a; padding:20px; border-radius:10px; }
.role-detail img { width:150px; height:150px; margin-bottom:20px; }
.team-section { display:flex; flex-direction:column; gap:10px; padding:15px; }
.team-row { position:relative; display:flex; align-items:center; gap:10px; background:#2a2a2a; padding:10px 20px 10px 10px; border-radius:5px; min-height:60px; transition:transform .2s,opacity .2s; flex-wrap: wrap; }
.team-row.dragging { opacity:.8; transform:translateY(-10px); box-shadow:0 4px 8px rgba(0,0,0,.3); }
.team-header { display: flex; align-items: center; flex-shrink: 0; margin-right: 15px; }
.team-handle { cursor:move; font-size:20px; color:#fff; flex-shrink:0; margin-right:10px; }
.team-label { font-size:14px; font-weight:600; z-index:10; flex-shrink:0; }
.team-slots { display:flex; gap:8px; flex:1; justify-content:center; flex-wrap: wrap; }
.slot { width: 50px; height: 50px; border:2px dashed #555; display:flex; align-items:center; justify-content:center; position:relative; background:#333; border-radius:5px; }
.slot img { max-width:100%; max-height:100%; }
.slot .attr { position:absolute; bottom:2px; right:2px; background:rgba(0,0,0,.7); color:#fff; padding:1px 3px; font-size:8px; border-radius:2px; }

.delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #dc2626;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.slot:hover .delete-btn {
  opacity: 1;
}
.clear-btn { position:absolute; bottom:5px; right:5px; padding:3px 6px; font-size:12px; background:#555; color:#fff; border:none; border-radius:3px; cursor:pointer; }
.clear-btn:hover { background:#777; }

.delete-team-btn {
  position: absolute;
  top: -8px;
  right: 0px;
  width: 20px;
  height: 20px;
  background: #dc2626;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.team-row:hover .delete-team-btn {
  opacity: 1;
}

.add-team-btn {
  margin-top: 15px;
  padding: 10px;
  background: #4ade80;
  color: #000;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  width: 100%;
  text-align: center;
  transition: background 0.3s ease;
}

.add-team-btn:hover {
  background: #22c55e;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
  .page {
    flex-direction: column;
  }
  
  .left-panel,
  .right-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #333;
  }
  
  .team-row {
    flex-direction: column;
    align-items: flex-start;
    min-height: auto;
  }
  
  .team-label {
    position: static;
    margin-bottom: 10px;
  }
  
  .team-slots {
    width: 100%;
    justify-content: flex-start;
  }
  
  .slot {
    width: 60px;
    height: 60px;
  }
  
  .drop-zone {
    width: 200px;
    height: 100px;
    font-size: 32px;
  }
}

@media screen and (max-width: 480px) {
  .role-list {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
  
  .role-item, .team-role-item {
    width: 60px;
    height: 60px;
  }
  
  .slot {
    width: 50px;
    height: 50px;
  }
  
  .drop-zone {
    width: 150px;
    height: 80px;
    font-size: 24px;
  }
}