/* 내 사령관 / 내 장비세트 (my-commanders-ui.js, my-gear-sets-ui.js).
   Colors resolve through tokens.css so light/dark follow the rest of the app. */

.library-view .heading { gap: 12px; }
.library-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.library-note { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.library-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---- commanders table ---- */
.library-row td { vertical-align: middle; }
.library-name { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.library-name strong { display: block; font-size: 13px; }
.library-name small { display: block; color: var(--muted); font-size: 11px; }
.library-thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--surface-3); flex: 0 0 auto; }
.library-thumb-blank { display: inline-grid; place-items: center; color: var(--muted); font-weight: 800; }
.library-badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent-text); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.library-badge.awake { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn-text); letter-spacing: 0; margin-left: 4px; }
.library-row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.library-row-actions .btn, .library-card-actions .btn { padding: 6px 10px; font-size: 12px; }
.library-row-actions .btn[disabled], .library-card-actions .btn[disabled] { opacity: .45; cursor: not-allowed; }
.library-confirm { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--danger-text); }
.library-message { margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5; }
.library-message.error { background: var(--danger-soft); color: var(--danger-text); border: 1px solid var(--danger); }
.library-message.ok { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.library-import { margin-bottom: 14px; }
.library-import ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.library-import li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.library-import li > span { flex: 1 1 160px; min-width: 0; font-size: 13px; }

/* ---- gear set cards ---- */
.library-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.library-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0; }
.library-card h3 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.library-card-meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.library-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.library-gear-mini { width: 208px; height: 336px; margin: 0 auto; }
.library-gear-mini .equipment-grid { transform: scale(.8); transform-origin: 0 0; }

/* Rarity background for slots outside #equipment-grid (theme.css scopes it to the builder). */
.library-gear .slot[data-rarity]:not([data-rarity=""]) .slot-icon {
  background: var(--grade-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), inset 0 -6px 12px rgba(0, 0, 0, .18);
}
.library-gear .slot .special-mark { width: 29px; height: 29px; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible; right: -10px; bottom: -8px; }
.library-gear .slot .special-mark img { width: 100%; height: 100%; border: 0; border-radius: 0; background: none; box-shadow: none; }
.library-gear .slot.active { outline: 2px solid var(--accent); outline-offset: 3px; }
.library-gear button.slot { cursor: pointer; font: inherit; }
.library-gear.readonly button.slot { cursor: default; pointer-events: none; }

/* ---- editor modal ---- */
.library-editor { width: min(820px, 100%); }
.library-editor .commander-picker-head h2 { overflow-wrap: anywhere; }
.library-field { margin-bottom: 14px; }
.library-field > label, .library-field > .label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.library-field input[type="text"], .library-field input[type="search"], .library-field select { box-sizing: border-box; width: 100%; }
.library-selected { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); margin-bottom: 10px; min-height: 44px; font-size: 13px; }
.library-selected.empty { color: var(--muted); }
.library-editor .commander-picker-list { max-height: 260px; overflow: auto; }
.library-editor .commander-option[hidden] { display: none; }
.library-hint { display: none; margin: 4px 0 14px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn-text); font-size: 12px; font-weight: 700; }
.library-hint.show { display: block; }
.library-editor-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.library-error { margin-top: 10px; color: var(--danger-text); font-size: 12px; line-height: 1.5; }

.library-gear-editor { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.library-gear-editor .detail-gear-grid.equipment-grid { margin: 0 auto; }
.library-option-panel { min-width: 0; }
.library-option-panel .option-grid { max-height: 260px; overflow: auto; padding-right: 4px; }
.library-option-panel .option[hidden] { display: none; }
.library-option-panel .subgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.library-option-panel .option.picked { border-color: var(--blue, var(--accent)); }
.library-preview-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 8px; }
.library-editor .commander-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.library-preview { min-height: 34px; font-size: 12px; }
.library-summary { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

.library-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); font-size: 13px; box-shadow: var(--shadow-lg, 0 10px 30px #0004); }

@media (max-width: 560px) {
  .library-view .heading { display: block; }
  .library-view .heading .library-actions { margin-top: 12px; }
  .library-view .heading .library-actions .btn { margin-top: 0; }
  .library-cards { grid-template-columns: minmax(0, 1fr); }
  .library-gear-editor { grid-template-columns: minmax(0, 1fr); }
  .library-option-panel .subgrid { grid-template-columns: minmax(0, 1fr); }
  .library-editor { padding: 16px; }
  .library-editor .commander-picker-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .library-editor-foot .btn { flex: 1 1 auto; }
}
