/* ── Aoraitsu Connect 在线玩家弹窗样式 ── */

.players-dialog {
  --shape-corner: 28px;
}

.players-dialog::part(panel) {
  width: min(calc((100vw - 32px) * 0.7), calc(((100vh - 32px) * 18 / 10) * 0.7)) !important;
  height: min(calc((100vh - 32px) * 0.7), calc(((100vw - 32px) * 10 / 18) * 0.7)) !important;
  max-width: calc(100vw - 32px) !important;
  max-height: calc(100vh - 32px) !important;
  aspect-ratio: 18 / 10;
  border-radius: 28px;
  border: 1px solid rgba(var(--mdui-color-outline-variant), 0.45);
  background-color: rgb(var(--mdui-color-surface));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
  padding: 0;
  overflow: hidden !important;
}

.players-dialog::part(body) {
  height: 100%;
  padding: 0;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

.players-dialog-header {
  padding: 24px 24px 16px 24px;
  background: linear-gradient(135deg, rgba(var(--mdui-color-primary-container), 0.12), rgba(var(--mdui-color-surface-container), 0.15));
  position: relative;
  overflow: hidden;
}

.players-dialog-map-image-frame {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 18%, rgba(0, 0, 0, 0.14) 42%, rgba(0, 0, 0, 0.68) 74%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, transparent 18%, rgba(0, 0, 0, 0.14) 42%, rgba(0, 0, 0, 0.68) 74%, #000 100%);
}

.players-dialog-map-image {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: auto;
  min-width: 100%;
  min-height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  opacity: 0.7;
  display: block;
  transform: translate(-50%, -50%);
}

.players-dialog-close {
  /* Now inside .players-dialog-top-right flex container */
}

.players-dialog-header-layout {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.header-details {
  flex: 1;
  min-width: 0;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  margin-bottom: 2px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.players-dialog-refresh-icon--spinning {
  animation: players-dialog-refresh-spin 0.8s linear infinite;
}

@keyframes players-dialog-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.action-btn {
  --shape-corner: 12px;
}

.players-dialog-top-right {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 20;
  pointer-events: auto;
}

.custom-action-btn.edit-btn {
  color: rgb(var(--mdui-color-on-surface-variant)) !important;
}

.custom-action-btn.delete-btn {
  color: rgb(var(--mdui-color-error)) !important;
}

.players-dialog-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: rgb(var(--mdui-color-on-surface));
  line-height: 1.4;
  word-break: break-all;
}

.players-dialog-subtitle-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.players-dialog-subtitle {
  font-size: 0.85rem;
  color: rgb(var(--mdui-color-primary));
  background-color: rgba(var(--mdui-color-primary), 0.08);
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  letter-spacing: 0.2px;
}

.address-copy-btn {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  color: rgba(var(--mdui-color-on-surface), 0.5) !important;
  transition: color 0.2s ease !important;
}

.address-copy-btn:hover {
  color: rgb(var(--mdui-color-primary)) !important;
}

.address-copy-btn mdui-icon {
  font-size: 16px !important;
}

/* 弹出框底部元信息行 (玩家数量 + 地图名称) */
.players-dialog-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 20px;
  margin-top: 12px;
}

.players-dialog-meta-row .meta-item {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: rgb(var(--mdui-color-on-surface-variant));
  white-space: nowrap;
}

.players-dialog-meta-row .meta-item.players,
.players-dialog-meta-row .meta-item.game-type {
  flex-shrink: 0;
}

.players-dialog-meta-row .meta-text {
  font-weight: 550;
}

/* 地图单独一行样式 */
.players-dialog-map-row {
  display: flex;
  align-items: center;
  margin-top: 8px;
  font-size: 0.9rem;
  color: rgb(var(--mdui-color-on-surface-variant));
  white-space: nowrap;
}

.players-dialog-map-row .map-tag {
  color: rgba(var(--mdui-color-on-surface), 0.5);
  margin-left: 4px;
}

.players-dialog-tier-chip {
  margin-right: 8px;
  flex-shrink: 0;
}

.players-dialog-content {
  padding: 16px 24px 24px 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
}

/* 状态页样式 */
.players-dialog-loading,
.players-dialog-error,
.players-dialog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: rgb(var(--mdui-color-on-surface-variant));
  flex: 1;
}

.players-dialog-loading p,
.players-dialog-error p,
.players-dialog-empty p {
  margin: 16px 0 0 0;
  font-size: 0.95rem;
}

/* 玩家列表 header */
.players-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 4px;
}

.players-list-header .count {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(var(--mdui-color-on-surface), 0.6);
}

/* 玩家列表网格 */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background-color: rgba(var(--mdui-color-surface-container-low), 0.45);
  border: 1px solid rgba(var(--mdui-color-outline-variant), 0.2);
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.player-item:hover {
  background-color: rgb(var(--mdui-color-surface-container-high));
  border-color: rgba(var(--mdui-color-primary), 0.3);
  transform: translateY(-1px);
}

.player-name {
  font-weight: 550;
  color: rgb(var(--mdui-color-on-surface));
  font-size: 0.9rem;
  margin-right: 16px;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.player-meta .score {
  color: rgb(var(--mdui-color-primary));
  font-weight: 600;
  background-color: rgba(var(--mdui-color-primary), 0.08);
  padding: 1px 6px;
  border-radius: 4px;
}

.player-meta .time {
  color: rgb(var(--mdui-color-on-surface-variant));
}
