/* ====== Shortverse — Library Base Styles ======
   Unified styles for all library pages: people, scene, script, voice, BGM */

/* ── Page Layout ── */
.lib-header {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.lib-header nav a:hover { opacity: .7; }

.lib-main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 40px; }

.lib-hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.lib-hero p { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* ── Toolbar ── */
.lib-toolbar { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; flex-wrap: wrap; }
.lib-search {
  flex: 1; min-width: 200px; padding: 10px 16px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); font-size: 14px; color: var(--text);
  font-family: var(--font);
}
.lib-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.lib-search::placeholder { color: var(--text-muted); }
.lib-filters { display: flex; gap: 8px; align-items: center; }
.lib-filters select {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 13px; color: var(--text);
  font-family: var(--font); cursor: pointer;
}

/* ── Tabs ── */
.lib-tabs { display: flex; gap: 4px; padding: 4px; background: var(--btn-bg); border-radius: var(--radius-sm); }
.lib-tab {
  padding: 7px 16px; border: none; background: transparent;
  color: var(--text-dim); font-size: 13px; font-weight: 500;
  border-radius: 6px; cursor: pointer; transition: all .2s;
  font-family: var(--font); -webkit-tap-highlight-color: transparent;
}
.lib-tab:hover { color: var(--text); }
.lib-tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ── Visibility Badge ── */
.lib-vis-badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs);
  font-size: 11px; font-weight: 500; margin-right: 6px;
}
.lib-vis-badge.public { background: var(--accent-light); color: var(--accent); }
.lib-vis-badge.pro { background: #e8f0ff; color: #3b6ef0; }
.lib-vis-badge.max { background: #f3e8ff; color: #7c3aed; }
.lib-vis-badge.private { background: #fff3d4; color: #b06d00; }
.lib-vis-badge.discover { background: #e8f5e9; color: #2e7d32; }

/* ── Buttons ── */
.lib-btn-primary {
  padding: 8px 20px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--font); transition: opacity .15s;
}
.lib-btn-primary:hover { opacity: .85; }
.lib-btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.lib-btn-outline {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 13px;
  cursor: pointer; font-family: var(--font); transition: all .15s;
}
.lib-btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.lib-btn-danger {
  padding: 8px 20px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--danger); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: var(--font); transition: all .15s;
}
.lib-btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.lib-btn-sm {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--btn-bg); color: var(--text); font-size: 11px;
  cursor: pointer; font-family: var(--font); transition: all .15s;
}
.lib-btn-sm:hover { border-color: var(--accent); color: var(--accent); }

/* ── Grid ── */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.lib-empty { grid-column: 1/-1; text-align: center; color: var(--text-dim); padding: 40px; }

/* ── Card ── */
.lib-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  cursor: pointer; transition: all .2s;
}
.lib-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.lib-card-image {
  width: 100%; height: 180px; background: var(--btn-bg);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.lib-card-image img { width: 100%; height: 100%; object-fit: cover; }
.lib-card-no-img { font-size: 40px; color: var(--text-dim); opacity: .3; }

.lib-card-body { padding: 14px; }
.lib-card-name { font-size: 15px; font-weight: 600; }
.lib-card-role {
  display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: var(--accent-light); color: var(--accent); margin-left: 6px;
}
.lib-card-desc {
  font-size: 11px; color: var(--text-dim); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-card-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: flex; gap: 8px; }
.lib-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.lib-card-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: var(--btn-bg); color: var(--text-dim);
}
.lib-card-voice {
  font-size: 11px; color: var(--text-dim); margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lib-card-author { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.lib-card-actions {
  display: flex; gap: 6px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── FAB ── */
.lib-fab {
  position: fixed; bottom: 32px; right: 32px; z-index: 50;
  width: 56px; height: 56px; border-radius: 28px; border: none;
  background: var(--accent); color: #fff;
  font-size: 28px; font-weight: 300; line-height: 1;
  box-shadow: 0 4px 16px rgba(79,140,255,.35);
  cursor: pointer; font-family: var(--font);
  transition: all .2s var(--spring);
  display: flex; align-items: center; justify-content: center;
}
.lib-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(79,140,255,.45); }

/* ── Modal ── */
.lib-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s var(--ease);
}
.lib-modal {
  background: var(--card); border-radius: 16px;
  max-width: 800px; width: 95%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl); position: relative;
  animation: scaleIn .25s var(--spring);
}
.lib-modal-close {
  position: sticky; top: 12px; right: 12px; float: right; z-index: 10;
  width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--card); color: var(--text-dim); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.lib-modal-close:hover { background: var(--btn-bg); }
.lib-modal-body { display: flex; gap: 20px; padding: 24px; }

/* Modal image area */
.lib-modal-image { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.lib-modal-image-display {
  width: 240px; height: 240px; border-radius: 12px; overflow: hidden;
  background: var(--btn-bg); display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); cursor: pointer; transition: opacity .15s;
}
.lib-modal-image-display:hover { opacity: .85; }
.lib-modal-image-display img { width: 100%; height: 100%; object-fit: cover; }
.lib-modal-image-placeholder { color: var(--text-dim); font-size: 14px; }
.lib-modal-image-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; justify-content: center; }

/* Modal fields */
.lib-modal-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.lib-modal-fields label {
  font-size: 11px; color: var(--text-dim); font-weight: 500; margin-bottom: -4px;
}
.lib-modal-fields input, .lib-modal-fields select, .lib-modal-fields textarea {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 13px; font-family: var(--font);
}
.lib-modal-fields input:focus, .lib-modal-fields select:focus, .lib-modal-fields textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light);
}
.lib-field-row { display: flex; gap: 10px; }
.lib-field-row > div { display: flex; flex-direction: column; gap: 0; }
.lib-modal-btns {
  display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--border);
}

/* Field sections */
.lib-section {
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.lib-section:last-child { border-bottom: none; margin-bottom: 16px; }
.lib-section-label {
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px;
}

/* ── AI Dialog ── */
.lib-ai-dialog {
  background: linear-gradient(135deg, rgba(79,140,255,.08), rgba(79,140,255,.04));
  border: 1px solid rgba(79,140,255,.2);
  border-radius: 10px; padding: 12px; margin-bottom: 14px;
}
.lib-ai-dialog-label {
  font-size: 12px; font-weight: 600; color: var(--accent);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.lib-ai-dialog textarea {
  width: 100%; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; font-family: var(--font);
  resize: vertical; min-height: 56px; margin-bottom: 8px;
}
.lib-ai-dialog textarea:focus { outline: none; border-color: var(--accent); }
.lib-ai-dialog .lib-ai-generate-btn {
  padding: 6px 16px; border: none; border-radius: 8px;
  cursor: pointer; font-size: 12px; font-weight: 600; font-family: var(--font);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff;
  transition: opacity .15s;
}
.lib-ai-dialog .lib-ai-generate-btn:hover { opacity: .85; }
.lib-ai-dialog .lib-ai-generate-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Project Picker (for "use" flow) ── */
.lib-picker-card {
  background: var(--card); border-radius: 16px;
  max-width: 420px; width: 92%; padding: 24px;
  box-shadow: var(--shadow-xl); position: relative;
}
.lib-project-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: background .15s; border: 1px solid transparent;
}
.lib-project-item:hover { background: var(--btn-bg); }
.lib-project-item.selected { border-color: var(--accent); background: var(--accent-light); }
.lib-project-item-name { font-size: 14px; font-weight: 500; }
.lib-project-item-meta { font-size: 11px; color: var(--text-dim); }
.lib-project-item-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--card); color: var(--accent); font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: var(--font);
}
.lib-project-item-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Toast ── */
.lib-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: var(--radius-full); font-size: 14px; z-index: 300;
  color: #fff; pointer-events: none;
  animation: toastIn .3s var(--ease), toastOut .3s var(--ease) 2.5s forwards;
}
.lib-toast.success { background: var(--confirm); }
.lib-toast.error { background: var(--danger); }
.lib-toast.info { background: var(--accent); }

/* ── Lightbox ── */
.lib-lightbox {
  position: fixed; inset: 0; z-index: 500; display: none;
}
.lib-lightbox.show { display: block; }
.lib-lightbox-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.88);
  cursor: zoom-out;
}
.lib-lightbox-content {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; pointer-events: none;
}
.lib-lightbox-image-wrap {
  pointer-events: auto; display: flex; align-items: center; justify-content: center;
  flex: 1; max-height: 100%;
}
.lib-lightbox-image-wrap img {
  max-width: 100%; max-height: 90vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.4);
}
.lib-lightbox-close {
  position: absolute; top: 16px; right: 24px;
  width: 40px; height: 40px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.5);
  color: #fff; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 510; pointer-events: auto; transition: background .15s;
}
.lib-lightbox-close:hover { background: rgba(255,255,255,.15); }

/* ── Responsive ── */
@media (max-width: 800px) {
  .lib-lightbox-content { flex-direction: column; padding: 12px; }
  .lib-lightbox-image-wrap img { max-height: 50vh; }
  .lib-modal-body { flex-direction: column; align-items: center; }
  .lib-modal-image { width: 100%; }
  .lib-modal-image-display { width: 200px; height: 200px; }
}
@media (max-width: 767px) {
  .lib-hero h1 { font-size: 22px; }
  .lib-toolbar { flex-direction: column; gap: 8px; }
  .lib-search { min-width: unset; width: 100%; }
  .lib-filters { flex-wrap: wrap; width: 100%; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .lib-card-image { height: 130px; }
  .lib-card-name { font-size: 13px; }
  .lib-card-meta { font-size: 10px; }
  .lib-modal { width: 95%; max-height: 85vh; padding: 16px; }
  .lib-modal-image-display { width: 160px; height: 160px; }
  .lib-fab { bottom: 80px; right: 16px; width: 48px; height: 48px; font-size: 24px; }
}
@media (max-width: 480px) {
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .lib-card-image { height: 110px; }
}

/* ── Backward-compat aliases: cl-* → lib-* ── */
.cl-hero h1, .sl-hero h1, .scl-hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.cl-hero p, .sl-hero p, .scl-hero p { color: var(--text-dim); font-size: 14px; margin-top: 4px; }
.cl-toolbar, .sl-toolbar, .scl-toolbar, .vl-toolbar { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; flex-wrap: wrap; }
#cl-search, #sl-search, #scl-search {
  flex: 1; min-width: 200px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); font-size: 14px;
  color: var(--text); font-family: var(--font);
}
#cl-search:focus, #sl-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
#cl-search::placeholder, #sl-search::placeholder { color: var(--text-muted); }
.cl-filters, .sl-filters, .scl-filters { display: flex; gap: 8px; align-items: center; }
.cl-filters select, .sl-filters select {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 13px; color: var(--text); font-family: var(--font); cursor: pointer;
}

/* Buttons */
.cl-btn-primary, .scl-btn-primary, .sl-btn-primary, .vl-btn-primary, .btn-primary, .vep-btn-primary { padding: 8px 20px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font); transition: opacity .15s; }
.cl-btn-primary:hover, .scl-btn-primary:hover, .sl-btn-primary:hover, .vl-btn-primary:hover, .btn-primary:hover, .vep-btn-primary:hover { opacity: .85; }
.cl-btn-primary:disabled, .scl-btn-primary:disabled, .sl-btn-primary:disabled, .vl-btn-primary:disabled, .btn-primary:disabled, .vep-btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.cl-btn-outline, .scl-btn-outline, .sl-btn-outline, .vl-btn-secondary, .vep-btn-secondary, .vep-btn-outline, .btn-action { padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font-size: 13px; cursor: pointer; font-family: var(--font); transition: all .15s; }
.cl-btn-outline:hover, .scl-btn-outline:hover, .sl-btn-outline:hover, .vl-btn-secondary:hover, .vep-btn-secondary:hover, .vep-btn-outline:hover, .btn-action:hover { border-color: var(--accent); color: var(--accent); }
.cl-btn-danger, .scl-btn-danger, .sl-btn-danger, .vl-btn-danger, .btn-danger { padding: 8px 20px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--danger); font-size: 13px; font-weight: 500; cursor: pointer; font-family: var(--font); transition: all .15s; }
.cl-btn-danger:hover, .scl-btn-danger:hover, .sl-btn-danger:hover, .vl-btn-danger:hover, .btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.cl-btn-sm, .scl-btn-sm, .sl-btn-sm, .btn-sm, .btn-primary-sm { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--btn-bg); color: var(--text); font-size: 11px; cursor: pointer; font-family: var(--font); transition: all .15s; }
.cl-btn-sm:hover, .scl-btn-sm:hover, .sl-btn-sm:hover, .btn-sm:hover, .btn-primary-sm:hover { border-color: var(--accent); color: var(--accent); }

/* Grid & Cards */
.cl-grid, .sl-grid, .scl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cl-empty, .sl-empty, .scl-empty { grid-column: 1/-1; text-align: center; color: var(--text-dim); padding: 40px; }
.cl-card, .scl-card, .sl-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; cursor: pointer; transition: all .2s; }
.cl-card:hover, .scl-card:hover, .sl-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cl-card-portrait, .sl-card-image, .scl-card-image { width: 100%; height: 180px; background: var(--btn-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cl-card-portrait img, .sl-card-image img { width: 100%; height: 100%; object-fit: cover; }
.cl-card-no-img, .sl-card-no-img, .scl-card-no-img { font-size: 40px; color: var(--text-dim); opacity: .3; }
.cl-card-body, .sl-card-body, .scl-card-body { padding: 14px; }
.cl-card-name, .sl-card-name, .scl-card-name { font-size: 15px; font-weight: 600; }
.cl-card-role { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--accent-light); color: var(--accent); margin-left: 6px; }
.cl-card-desc, .sl-card-desc, .scl-card-desc { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cl-card-meta, .sl-card-meta, .scl-card-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: flex; gap: 8px; }
.cl-card-tags, .sl-card-tags, .scl-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.cl-card-tags, .sl-card-tags, .scl-card-tags { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--btn-bg); color: var(--text-dim); }
.cl-card-voice { font-size: 11px; color: var(--text-dim); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-card-actions, .sl-card-actions, .scl-card-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

/* FAB */
.cl-fab, .sl-fab, .scl-fab, .vl-fab { position: fixed; bottom: 32px; right: 32px; z-index: 50; width: 56px; height: 56px; border-radius: 28px; border: none; background: var(--accent); color: #fff; font-size: 28px; font-weight: 300; line-height: 1; box-shadow: 0 4px 16px rgba(79,140,255,.35); cursor: pointer; font-family: var(--font); transition: all .2s var(--spring); display: flex; align-items: center; justify-content: center; }
.cl-fab:hover, .sl-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(79,140,255,.45); }

/* Modal */
.cl-modal, .sl-modal, .scl-modal { background: var(--card); border-radius: 16px; max-width: 800px; width: 95%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); position: relative; animation: scaleIn .25s var(--spring); }
.cl-modal-close, .sl-modal-close, .scl-modal-close { position: sticky; top: 12px; right: 12px; float: right; z-index: 10; width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--border); background: var(--card); color: var(--text-dim); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.cl-modal-close:hover, .sl-modal-close:hover { background: var(--btn-bg); }
.cl-modal-body, .sl-modal-body, .scl-modal-body { display: flex; gap: 20px; padding: 24px; }
.cl-modal-portrait, .sl-modal-image, .scl-modal-episodes { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
#cl-portrait-display, #sl-image-display { width: 240px; height: 240px; border-radius: 12px; overflow: hidden; background: var(--btn-bg); display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); cursor: pointer; transition: opacity .15s; }
#cl-portrait-display:hover, #sl-image-display:hover { opacity: .85; }
#cl-portrait-display img, #sl-image-display img { width: 100%; height: 100%; object-fit: cover; }
#cl-portrait-placeholder, #sl-image-placeholder { color: var(--text-dim); font-size: 14px; }
#cl-portrait-actions, #sl-image-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; justify-content: center; }

/* Fields */
.cl-modal-fields, .sl-modal-fields, .scl-modal-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cl-modal-fields label, .sl-modal-fields label { font-size: 11px; color: var(--text-dim); font-weight: 500; margin-bottom: -4px; }
.cl-modal-fields input, .sl-modal-fields input, .cl-modal-fields select, .sl-modal-fields select, .cl-modal-fields textarea, .sl-modal-fields textarea { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font-size: 13px; font-family: var(--font); }
.cl-modal-fields input:focus, .sl-modal-fields input:focus, .cl-modal-fields select:focus, .sl-modal-fields select:focus, .cl-modal-fields textarea:focus, .sl-modal-fields textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.cl-field-row, .sl-field-row, .scl-field-row { display: flex; gap: 10px; }
.cl-field-row > div, .sl-field-row > div { display: flex; flex-direction: column; gap: 0; }
.cl-modal-btns, .sl-modal-btns, .scl-modal-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }

/* Sections */
.cl-section, .sl-section, .scl-section { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cl-section:last-child, .sl-section:last-child { border-bottom: none; margin-bottom: 16px; }
.cl-section-label, .sl-section-label, .scl-section-label { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }

/* AI Dialog */
.cl-ai-dialog, .sl-ai-dialog, .scl-ai-dialog { background: linear-gradient(135deg, rgba(79,140,255,.08), rgba(79,140,255,.04)); border: 1px solid rgba(79,140,255,.2); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.cl-ai-dialog-label, .sl-ai-dialog-label, .scl-ai-dialog-label { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.cl-ai-dialog textarea, .sl-ai-dialog textarea, .scl-ai-dialog textarea { width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; font-family: var(--font); resize: vertical; min-height: 56px; margin-bottom: 8px; }
.cl-ai-dialog textarea:focus, .sl-ai-dialog textarea:focus { outline: none; border-color: var(--accent); }
#cl-ai-generate-btn, #sl-ai-generate-btn { padding: 6px 16px; border: none; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; font-family: var(--font); background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff; transition: opacity .15s; }
#cl-ai-generate-btn:hover, #sl-ai-generate-btn:hover { opacity: .85; }
#cl-ai-generate-btn:disabled, #sl-ai-generate-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Picker */
.cl-picker-card, .sl-picker-card, .scl-picker-card { background: var(--card); border-radius: 16px; max-width: 420px; width: 92%; padding: 24px; box-shadow: var(--shadow-xl); position: relative; }
.cl-project-item, .sl-project-item, .scl-project-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background .15s; border: 1px solid transparent; }
.cl-project-item:hover, .sl-project-item:hover { background: var(--btn-bg); }
.cl-project-item.selected, .sl-project-item.selected { border-color: var(--accent); background: var(--accent-light); }
.cl-project-item-name, .sl-project-item-name { font-size: 14px; font-weight: 500; }
.cl-project-item-meta, .sl-project-item-meta { font-size: 11px; color: var(--text-dim); }
.cl-project-item-btn, .sl-project-item-btn { padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--card); color: var(--accent); font-size: 11px; font-weight: 500; cursor: pointer; transition: all .15s; font-family: var(--font); }
.cl-project-item-btn:hover, .sl-project-item-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Toast */
.cl-toast, .sl-toast, .scl-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 24px; border-radius: var(--radius-full); font-size: 14px; z-index: 300; color: #fff; pointer-events: none; animation: toastIn .3s var(--ease), toastOut .3s var(--ease) 2.5s forwards; }
.cl-toast.success, .sl-toast.success { background: var(--confirm); }
.cl-toast.error, .sl-toast.error { background: var(--danger); }
.cl-toast.info, .sl-toast.info { background: var(--accent); }

/* Lightbox */
#cl-lightbox, #sl-lightbox { position: fixed; inset: 0; z-index: 500; display: none; }
#cl-lightbox.show, #sl-lightbox.show { display: block; }
#cl-lightbox-backdrop, #sl-lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.88); cursor: zoom-out; }
#cl-lightbox-content, #sl-lightbox-content { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; pointer-events: none; }
#cl-lightbox-image-wrap, #sl-lightbox-image-wrap { pointer-events: auto; display: flex; align-items: center; justify-content: center; flex: 1; max-height: 100%; }
#cl-lightbox-image-wrap img, #sl-lightbox-image-wrap img { max-width: 100%; max-height: 90vh; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.4); }
#cl-lightbox-close, #sl-lightbox-close { position: absolute; top: 16px; right: 24px; width: 40px; height: 40px; border-radius: 20px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.5); color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 510; pointer-events: auto; transition: background .15s; }
#cl-lightbox-close:hover, #sl-lightbox-close:hover { background: rgba(255,255,255,.15); }

/* Vis tabs (scene + people lib) */
.sl-vis-tab, .cl-vis-tab { padding: 7px 16px; border: none; background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 500; border-radius: 6px; cursor: pointer; transition: all .2s; font-family: var(--font); }
.sl-vis-tab.active, .cl-vis-tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sl-vis-badge, .cl-vis-badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 500; margin-right: 6px; }
.sl-vis-badge.public, .cl-vis-badge.public { background: var(--accent-light); color: var(--accent); }
.sl-vis-badge.pro, .cl-vis-badge.pro { background: #e8f0ff; color: #3b6ef0; }
.sl-vis-badge.max, .cl-vis-badge.max { background: #f3e8ff; color: #7c3aed; }
.sl-vis-badge.private, .cl-vis-badge.private { background: #fff3d4; color: #b06d00; }

/* Header */
#cl-header, #sl-header, #scl-header, #vl-header, #header, #vh-header, #ve-header, #vc-header, #disc-header-bar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
.brand-subtitle { font-size:11px; color:var(--text-dim); margin-left:8px; padding-left:8px; border-left:1.5px solid var(--border); font-weight:400; white-space:nowrap; }
#cl-header nav a:hover, #sl-header nav a:hover { opacity: .7; }
#cl-main, #sl-main, #scl-main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 40px; }

/* Admin batch bar */
.cl-batch-bar, .sl-batch-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 14px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  animation: fadeIn .2s var(--ease);
}
.cl-batch-count, .sl-batch-count { font-size: 12px; font-weight: 600; color: var(--accent); margin-right: 4px; }
.cl-card-check, .sl-card-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 22px; height: 22px; background: rgba(255,255,255,.9);
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.cl-card-check input, .sl-card-check input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }
.cl-card, .scl-card, .sl-card { position: relative; }
.cl-card, .scl-card.selected, .sl-card.selected { box-shadow: 0 0 0 2px var(--accent); }

/* Mobile responsive */
@media (max-width: 800px) {
  #cl-lightbox-content, #sl-lightbox-content { flex-direction: column; padding: 12px; }
  #cl-lightbox-image-wrap img, #sl-lightbox-image-wrap img { max-height: 50vh; }
  .cl-modal-body, .sl-modal-body, .scl-modal-body { flex-direction: column; align-items: center; }
  .cl-modal-portrait, .sl-modal-image, .scl-modal-episodes { width: 100%; }
  #cl-portrait-display, #sl-image-display { width: 200px; height: 200px; }
}
@media (max-width: 767px) {
  .cl-hero h1, .sl-hero h1, .scl-hero h1 { font-size: 22px; }
  .cl-toolbar, .sl-toolbar, .scl-toolbar, .vl-toolbar { flex-direction: column; gap: 8px; }
  #cl-search, #sl-search, #scl-search { min-width: unset; width: 100%; }
  .cl-filters, .sl-filters, .scl-filters { flex-wrap: wrap; width: 100%; }
  .cl-grid, .sl-grid, .scl-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .cl-card-portrait, .sl-card-image, .scl-card-image { height: 130px; }
  .cl-card-name, .sl-card-name, .scl-card-name { font-size: 13px; }
  .cl-card-meta, .sl-card-meta, .scl-card-meta { font-size: 10px; }
  .cl-modal, .sl-modal, .scl-modal { width: 95%; max-height: 85vh; padding: 16px; }
  .cl-modal-fields, .sl-modal-fields, .scl-modal-fields { grid-template-columns: 1fr; }
  .cl-fab, .sl-fab, .scl-fab, .vl-fab { bottom: 80px; right: 16px; width: 48px; height: 48px; font-size: 24px; }
}
@media (max-width: 480px) {
  .cl-grid, .sl-grid, .scl-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .cl-card-portrait, .sl-card-image, .scl-card-image { height: 110px; }
}
