/* ── 基础 ────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f0f13; color: #e0e0e0; min-height: 100vh; }

/* ── 顶栏 ────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: rgba(15,15,19,0.95); backdrop-filter: blur(10px); border-bottom: 1px solid #2a2a35; }
.topbar h1 { font-size: 18px; font-weight: 600; color: #c8a0ff; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
#stats { font-size: 13px; color: #888; }

/* ── 按钮 ─────────────────────────────────── */
.btn { padding: 6px 16px; border: 1px solid #3a3a4a; border-radius: 6px; background: #1a1a22; color: #ccc; cursor: pointer; font-size: 13px; transition: all .2s; }
.btn:hover { background: #2a2a38; border-color: #5a5a6a; }
.btn-primary { background: #6b3fa0; border-color: #7b4fb0; color: #fff; }
.btn-primary:hover { background: #7b4fb0; }
.btn-primary:disabled { background: #3a2a4a; border-color: #4a3a5a; color: #888; cursor: not-allowed; }
.btn.active { background: #6b3fa0; border-color: #7b4fb0; color: #fff; }

/* ── 筛选栏 ───────────────────────────────── */
.filters { padding: 12px 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; border-bottom: 1px solid #1e1e28; background: #13131a; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 13px; color: #999; white-space: nowrap; }
.filter-buttons { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-btn { padding: 4px 12px; border-radius: 4px; border: 1px solid #2a2a35; background: transparent; color: #aaa; cursor: pointer; font-size: 12px; transition: all .2s; }
.filter-btn:hover { border-color: #5a5a6a; color: #ddd; }
.filter-btn.active { background: #2a2a38; border-color: #6b3fa0; color: #c8a0ff; }
.search-group { margin-left: auto; }
#search { padding: 6px 12px; border: 1px solid #2a2a35; border-radius: 6px; background: #1a1a22; color: #ddd; font-size: 13px; width: 200px; outline: none; }
#search:focus { border-color: #6b3fa0; }
#search::placeholder { color: #555; }

/* ── 网格 ─────────────────────────────────── */
.grid { padding: 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }

/* ── 角色卡片 ─────────────────────────────── */
.card { border-radius: 8px; overflow: hidden; background: #1a1a22; border: 2px solid transparent; cursor: pointer; transition: all .2s; position: relative; }
.card:hover { border-color: #6b3fa0; transform: translateY(-2px); }
.card.selected { border-color: #c8a0ff; box-shadow: 0 0 12px rgba(200,160,255,0.3); }
.card-img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #222; }
.card-img.placeholder { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a28, #252535); color: #555; font-size: 11px; }
.card-info { padding: 8px; }
.card-name { font-size: 13px; font-weight: 600; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 11px; color: #777; margin-top: 2px; display: flex; justify-content: space-between; }
.card-job { color: #c8a0ff; }
.card-pos { color: #f0a050; }
.card-select { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; font-size: 12px; color: transparent; transition: all .2s; }
.card.selected .card-select { background: #c8a0ff; border-color: #c8a0ff; color: #000; font-weight: bold; }
.card:hover .card-select { border-color: rgba(255,255,255,0.8); }

/* ── 弹窗 ─────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.modal-content { position: relative; z-index: 1; max-width: 90vw; max-height: 90vh; overflow: auto; background: #1a1a22; border-radius: 12px; border: 1px solid #2a2a35; }
.modal-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(0,0,0,0.6); color: #ddd; cursor: pointer; font-size: 16px; z-index: 2; }
.modal-close:hover { background: rgba(0,0,0,0.8); }
.modal-body { padding: 24px; }
.modal-images { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.modal-images img { max-height: 60vh; max-width: 400px; border-radius: 8px; object-fit: contain; }
.modal-images .placeholder { width: 300px; height: 400px; display: flex; align-items: center; justify-content: center; background: #222; border-radius: 8px; color: #555; font-size: 14px; }
.modal-info { margin-top: 16px; text-align: center; }
.modal-info .name { font-size: 20px; font-weight: 700; color: #c8a0ff; }
.modal-info .detail { font-size: 14px; color: #999; margin-top: 4px; }
.modal-info .motto { font-size: 16px; color: #e0c080; margin-top: 8px; font-style: italic; }
.modal-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }

/* ── 状态标签 ─────────────────────────────── */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-done { background: #1a3a2a; color: #50c878; border: 1px solid #2a5a3a; }
.status-pending { background: #2a2a1a; color: #c8a030; border: 1px solid #4a4a2a; }

/* ── 加载 ─────────────────────────────────── */
.loading { grid-column: 1/-1; text-align: center; padding: 60px; color: #666; }

/* ── 响应式 ───────────────────────────────── */
@media (max-width: 640px) {
  .topbar { flex-direction: column; gap: 8px; padding: 10px 16px; }
  .filters { padding: 8px 16px; }
  .grid { padding: 12px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .search-group { margin-left: 0; width: 100%; }
  #search { width: 100%; }
}
