/* ============================================================
   Votara — Minimal SPA Styles
   ============================================================ */

/* ── Reset + Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: #0c0e14;
  color: #d4d4dc;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: #7ea8f7; text-decoration: none; transition: color .15s; }
a:hover { color: #a8c8ff; }
img { max-width: 100%; }
button, input, select, textarea {
  font-family: inherit; font-size: inherit; color: inherit;
}

/* ── Layout ────────────────────────────────────────────────── */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
  background: #12141d;
  border-bottom: 1px solid #1e2133;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.site-header .logo {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.2rem; font-weight: 700; color: #e0e0e8; letter-spacing: .05em;
}
.site-header .logo img { height: 28px; }
.main-content { flex: 1; padding: 1.5rem; max-width: 1200px; margin: 0 auto; width: 100%; }
.site-footer {
  text-align: center; padding: 1rem; font-size: .8rem; color: #555;
  border-top: 1px solid #1a1c28; margin-top: 2rem;
  display: flex; justify-content: center; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: #555; text-decoration: none; transition: color .15s; }
.footer-links a:hover { color: #9ca3b8; }

/* ── Navigation ────────────────────────────────────────────── */
nav.main-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav.main-nav a {
  padding: .35rem .65rem; border-radius: 6px; font-size: .85rem;
  color: #9ca3b8; transition: all .15s;
}
nav.main-nav a:hover, nav.main-nav a.active { background: #1a1e2e; color: #c8cddf; }
nav.main-nav .separator { width: 1px; background: #252838; margin: 0 .35rem; }
nav.main-nav .nav-admin { color: #b08df0; }
nav.main-nav .nav-admin:hover { color: #c9a8ff; background: #1e1a2e; }

/* ── Admin Pending Badge ──────────────────────────────────── */
.nav-admin-wrap { position: relative; display: inline-flex; align-items: center; }
.admin-badge {
  position: absolute; top: -4px; right: -12px;
  background: #e84a4a; color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; cursor: pointer; line-height: 1;
  animation: badge-pulse 2s ease-in-out 1;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
.admin-pending-dropdown {
  position: absolute; top: calc(100% + 8px); right: -16px;
  background: #161822; border: 1px solid #2a2d3a;
  border-radius: 6px; padding: 6px 0; min-width: 220px; z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.admin-pending-dropdown::before {
  content: ''; position: absolute; top: -6px; right: 20px;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 6px solid #2a2d3a;
}
.admin-pending-item {
  display: flex !important; justify-content: space-between; align-items: center;
  padding: 8px 14px !important; font-size: 13px; color: #9ca3b8 !important;
  text-decoration: none; gap: 12px;
}
.admin-pending-item:hover { background: rgba(255,255,255,.05); color: #e0e0e8 !important; }
.admin-pending-count {
  background: rgba(232,74,74,.15); color: #e84a4a; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px; min-width: 20px; text-align: center;
}

/* ── Hamburger ────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: .5rem; margin-left: auto;
  flex-direction: column; gap: 5px;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: #9ca3b8; border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  nav.main-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: #12141d; border-bottom: 1px solid #1e2133;
    flex-direction: column; padding: .5rem 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
  }
  nav.main-nav.open { display: flex; }
  nav.main-nav a { padding: .6rem .75rem; font-size: .9rem; }
  nav.main-nav .separator { width: 100%; height: 1px; margin: .25rem 0; }
}

/* ── Admin Sidebar Layout ──────────────────────────────────── */
.admin-shell {
  display: flex; flex: 1; min-height: calc(100vh - 60px);
}
.admin-sidebar {
  width: 220px; min-width: 220px;
  background: #101220; border-right: 1px solid #1e2133;
  padding: 1.25rem 0; position: sticky; top: 52px;
  height: calc(100vh - 52px); overflow-y: auto;
}
.admin-sidebar-toggle {
  display: none; /* hidden on desktop */
}
.admin-sidebar-title {
  padding: 0 1rem .75rem; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: #555;
}
.admin-sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.admin-sidebar-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1rem; font-size: .84rem; color: #8a8fa8;
  transition: all .15s; border-left: 3px solid transparent;
}
.admin-sidebar-link:hover {
  background: #161830; color: #c4c8df;
}
.admin-sidebar-link.active {
  background: #161830; color: #b08df0;
  border-left-color: #b08df0; font-weight: 500;
}
.sidebar-icon { font-size: 1rem; width: 20px; text-align: center; }
.admin-main {
  flex: 1; padding: 1.5rem 2rem; max-width: 1100px; overflow-x: hidden;
}
@media (max-width: 768px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    width: 100%; min-width: 100%; position: static;
    height: auto; border-right: none; border-bottom: 1px solid #1e2133;
    padding: 0;
  }
  .admin-sidebar-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: .6rem .75rem;
    background: none; border: none; cursor: pointer;
  }
  .admin-sidebar-toggle .admin-sidebar-title {
    padding: 0; margin: 0; font-size: .8rem; color: #888;
  }
  .admin-sidebar-arrow {
    font-size: .9rem; color: #666; transition: transform .2s;
  }
  .admin-sidebar.expanded .admin-sidebar-arrow { transform: rotate(180deg); }
  .admin-sidebar-nav {
    flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 0 .5rem .5rem;
    display: none;
  }
  .admin-sidebar.expanded .admin-sidebar-nav { display: flex; }
  .admin-sidebar-link {
    padding: .45rem .7rem; font-size: .82rem; border-left: none;
    border-bottom: 2px solid transparent; border-radius: 6px;
    background: #12141d;
  }
  .admin-sidebar-link:hover { background: #1a1e2e; }
  .admin-sidebar-link.active {
    border-left-color: transparent; border-bottom-color: #b08df0;
    background: #1e1a2e;
  }
  .admin-sidebar-link .sidebar-icon { font-size: 1.1rem; width: 20px; }
  .admin-main { padding: .75rem; }
  .admin-main .page-header h1 { font-size: 1.3rem; }
  .admin-main .page-header p { font-size: .82rem; }
}

/* ── Image upload widget ──────────────────────────────────── */
.img-upload-widget {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.img-upload-input { display: none; }
.img-upload-btn { cursor: pointer; }
.img-upload-preview { margin-top: .5rem; }
.img-current-display {
  display: flex; flex-direction: column; align-items: flex-start; gap: .5rem;
  margin-bottom: .75rem;
}
.img-current-display.hidden { display: none; }
.img-current-preview {
  max-width: 240px; max-height: 240px; object-fit: cover;
  border-radius: 8px; border: 1px solid #252838;
}
.img-upload-controls.hidden, .img-gen-panel.hidden { display: none; }

/* ── Settings page ────────────────────────────────────────── */
.settings-grid {
  display: flex; flex-direction: column; gap: .5rem;
}
.settings-integration-card {
  padding: .75rem 1rem; background: #12141d;
  border: 1px solid #252838; border-radius: 6px;
}

/* ── Page Headers ──────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 1px solid #1e2133;
}
.page-header h1 { font-size: 1.6rem; color: #e8e8f0; font-weight: 600; }
.page-header p { color: #888; margin-top: .25rem; }
.page-header .breadcrumb { font-size: .8rem; color: #666; margin-bottom: .25rem; }
.page-header .breadcrumb a { color: #6a8ad4; }

/* ── Cards ─────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  background: #14161f;
  border: 1px solid #1e2133;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .2s, transform .15s;
}
.card:hover { border-color: #2e3555; transform: translateY(-1px); }
.card-body { padding: 1.15rem; }
.card h3 { font-size: 1.05rem; color: #d8d8e8; margin-bottom: .35rem; }
.card p { font-size: .87rem; color: #888; }
.card .card-meta { font-size: .78rem; color: #666; margin-top: .5rem; }
.follower-belongings { font-size: .75rem; color: #a89060; margin-top: .35rem; font-style: italic; }
.card .card-actions { margin-top: .75rem; display: flex; gap: .5rem; flex-wrap: wrap; }

.card.card-coming-soon {
  border-style: dashed;
  border-color: #2a2d40;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  opacity: .5;
}
.card.card-coming-soon:hover { transform: none; border-color: #2a2d40; }
.card.card-coming-soon h3 { color: #666; font-size: .95rem; font-weight: 500; }
.card.card-coming-soon p { font-size: .8rem; color: #555; }
@media (max-width: 768px) { .card.card-coming-soon { display: none; } }

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse; font-size: .87rem;
}
table.data-table th {
  text-align: left; padding: .65rem .75rem; font-weight: 600;
  color: #8890a8; background: #12141d; border-bottom: 2px solid #1e2133;
  white-space: nowrap;
}
table.data-table td {
  padding: .6rem .75rem; border-bottom: 1px solid #181a24;
  vertical-align: top;
}
table.data-table tr:hover td { background: #15171f; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; font-size: .82rem; font-weight: 600;
  color: #8890a8; margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .55rem .75rem;
  background: #12141d; border: 1px solid #252838;
  border-radius: 6px; color: #d4d4dc; transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: #4a6fa5;
}
.form-textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-inline { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }
.form-inline .form-select { width: auto; min-width: 120px; }

/* ── Auth divider ─────────────────────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; border-top: 1px solid #252838;
}
.auth-divider span { color: #666; font-size: .82rem; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .9rem; border-radius: 6px;
  font-size: .85rem; font-weight: 500; border: 1px solid transparent;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #3a6bc5; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #4a7dd8; }
.btn-success { background: #2a8c5a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #35a06a; }
.btn-danger { background: #a83232; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c03c3c; }
.btn-warning { background: #8a6d20; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #a07e28; }
.btn-outline {
  background: #1a1c28; border: 1px solid #353950; color: #b0b8cf;
}
.btn-outline:hover:not(:disabled) { background: #22253a; border-color: #4a5070; color: #c8cddf; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn-group { display: flex; gap: .35rem; flex-wrap: wrap; }
.admin-edit-link { vertical-align: middle; margin-left: .5rem; font-size: .8rem; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 4px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge-live { background: #1a3a2a; color: #4ae88a; }
.badge-active { background: #1a3a2a; color: #4ae88a; }
.badge-legacy { background: #2a2a1a; color: #c8b84a; }
.badge-draft { background: #1a1a2a; color: #7a8ac8; }
.badge-review { background: #2a1a2a; color: #c87aad; }
.badge-open { background: #1a2a3a; color: #4ac8e8; }
.badge-closed { background: #2a1a1a; color: #c87a7a; }
.badge-published { background: #1a3a1a; color: #4ae84a; }
.badge-proposed { background: #2a2a1a; color: #c8c84a; }
.badge-approved { background: #1a3a2a; color: #4ae88a; }
.badge-rejected { background: #3a1a1a; color: #e84a4a; }
.badge-applied { background: #0d2b3a; color: #38d9f5; border: 1px solid #38d9f5; }
.badge-paused { background: #2a2a2a; color: #a0a0a0; }
.badge-archived { background: #1a1a1a; color: #666; }
.badge-resolved { background: #1a2a1a; color: #4ac84a; }
.badge-inactive { background: #1a1a1a; color: #888; }
.badge-info { background: #1a2a3a; color: #4ac8e8; border: 1px solid #4ac8e8; }
.badge-prologue { background: #1a2a3a; color: #4ac8e8; border: 1px solid #4ac8e8; }
.badge-default { background: #1a1e28; color: #8890a8; }
.badge-item { background: #1a2a2a; color: #4ac8c8; }
.badge-pet { background: #2a1a2a; color: #c84ac8; }
.badge-relic { background: #2a2a1a; color: #c8c84a; }
.badge-admin { background: #2a1a3a; color: #a04ae8; }
.badge-mod { background: #1a2a3a; color: #4a8ae8; }
.badge-user { background: #1a1a2a; color: #7a8ac8; }
.badge-success { background: #1a3a2a; color: #4ae88a; }
.badge-danger { background: #3a1a1a; color: #e84a4a; }
.badge-warning { background: #2a2a1a; color: #c8c84a; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 1rem; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  padding: .65rem 1rem; border-radius: 8px;
  font-size: .85rem; font-weight: 500;
  opacity: 0; transform: translateX(40px);
  transition: opacity .3s, transform .3s;
  pointer-events: auto; max-width: 360px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-info { background: #1a2a3a; color: #7ac8f0; border: 1px solid #254060; }
.toast-success { background: #1a3a2a; color: #4ae88a; border: 1px solid #205040; }
.toast-error { background: #3a1a1a; color: #f07a7a; border: 1px solid #502020; }
.toast-warning { background: #3a2a1a; color: #f0c07a; border: 1px solid #504020; }

/* ── Modal ─────────────────────────────────────────────────── */
#modal-container:empty { display: none; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: #14161f; border: 1px solid #252838; border-radius: 12px;
  padding: 1.5rem; min-width: 360px; max-width: 520px; width: 90%;
}
.modal-box h2 { font-size: 1.15rem; color: #e0e0e8; margin-bottom: .75rem; }
.modal-box p { color: #888; margin-bottom: 1rem; font-size: .9rem; }
.modal-box .modal-actions { display: flex; gap: .5rem; justify-content: flex-end; }

/* ── Voting Widget ──────────────────────────────── */
.voting-widget-link {
  display: block; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.voting-widget-link:hover { transform: translateY(-2px); }
.voting-widget-link:hover .voting-widget { border-color: #7b8aff44; box-shadow: 0 4px 24px rgba(123,138,255,.08); }
.voting-widget {
  background: #12141c; border: 1px solid #1e2030; border-radius: 12px;
  overflow: hidden; margin-bottom: 1.5rem; transition: border-color .2s, box-shadow .2s;
}
.vw-hero {
  position: relative; height: 300px; background-size: cover; background-position: center;
}
.vw-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(12,14,20,1) 0%, rgba(12,14,20,.7) 40%, rgba(12,14,20,.2) 70%, transparent 100%);
}
.vw-hero-content {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 1.25rem 1.5rem;
}
.vw-header-plain { padding: 1.25rem 1.5rem .5rem; }
.vw-junction-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .12em;
  color: #7b8aff; font-weight: 600; margin-bottom: .35rem;
}
.vw-prompt {
  font-size: 1.15rem; line-height: 1.4; color: #eee; margin: 0;
  font-weight: 600;
}
.vw-body { padding: 1rem 1.5rem 1.25rem; }
.vw-meta {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-size: .8rem; color: #888; margin-bottom: 1rem;
}
.vw-meta-sep { color: #444; }
.vw-status {
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: .7rem;
  padding: .15rem .5rem; border-radius: 4px;
}
.vw-status-open { background: rgba(76,205,196,.15); color: #4ecdc4; }
.vw-status-closed { background: rgba(255,107,138,.15); color: #ff6b8a; }
.vw-options { display: flex; flex-direction: column; gap: .75rem; }
.vw-option {
  background: #181a24; border: 1px solid #1e2030; border-radius: 8px;
  padding: .75rem 1rem; transition: border-color .2s;
}
.vw-option:hover { border-color: #2a2d3a; }
.vw-option-leading { border-color: #7b8aff44; }
.vw-option-top {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem;
}
.vw-option-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px; font-size: .75rem;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.vw-option-label { flex: 1; font-size: .9rem; color: #ccc; line-height: 1.3; }
.vw-option-emoji { font-size: 1.1rem; flex-shrink: 0; }
.vw-bar-track {
  height: 6px; background: #0c0e14; border-radius: 3px; overflow: hidden;
}
.vw-bar-fill {
  height: 100%; border-radius: 3px; transition: width .4s ease;
  min-width: 0;
}
.vw-option-stats {
  display: flex; justify-content: space-between; margin-top: .35rem;
  font-size: .75rem; color: #666;
}
.vw-pct { font-weight: 600; color: #999; }
.vw-locked { margin-bottom: .75rem; }
.vw-note { font-size: .8rem; color: #666; margin-top: .75rem; }
.vw-actions { margin-top: 1rem; }
.vw-fb-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #1877f2; color: #fff; padding: .5rem 1.25rem;
  border-radius: 8px; font-size: .85rem; font-weight: 600;
  text-decoration: none; transition: background .2s;
}
.vw-fb-btn:hover { background: #166fe5; color: #fff; }

@media (max-width: 600px) {
  .vw-hero { height: 200px; }
  .vw-hero-content { padding: .75rem 1rem; }
  .vw-prompt { font-size: 1rem; }
  .vw-body { padding: .75rem 1rem 1rem; }
}

/* Thumbnail modal */
.modal-box.thumbnail-modal { max-width: 780px; max-height: 92vh; overflow-y: auto; }
.thumbnail-modal .thumb-form {
  display: grid; grid-template-columns: auto 1fr; gap: .5rem .75rem; align-items: center;
}
.thumbnail-modal .thumb-form label { color: #888; font-size: .85rem; text-align: right; }
.thumbnail-modal .thumb-form select,
.thumbnail-modal .thumb-form input[type="text"] {
  background: #1a1d2e; border: 1px solid #2a2d3a; color: #e0e0e8;
  border-radius: 6px; padding: .35rem .5rem; font-size: .85rem;
}
.thumbnail-modal .thumb-preview-wrap {
  position: relative; margin: .75rem 0;
}
.thumbnail-modal .thumb-preview {
  background: #111; border-radius: 8px;
  aspect-ratio: 16 / 9; width: 100%; max-height: 340px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #2a2d3a); overflow: hidden;
}
.thumbnail-modal .thumb-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbnail-modal .thumb-preview-placeholder { color: #555; font-size: .85rem; }
.thumbnail-modal .thumb-text-overlay {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%);
  z-index: 10; text-align: center; pointer-events: auto; user-select: none;
  white-space: nowrap; padding: 4px 8px;
}
.thumbnail-modal .thumb-text-title {
  color: #fff; font-weight: 900; line-height: 1.15;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.8), 0 0 20px rgba(0,0,0,0.5);
}
.thumbnail-modal .thumb-text-subtitle {
  font-weight: 700; line-height: 1.2; margin-top: 2px;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
  word-break: break-word;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; gap: .75rem;
  color: #666; padding: 2rem; justify-content: center;
}
.spinner {
  width: 20px; height: 20px; border: 2px solid #252838;
  border-top-color: #4a6fa5; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sections ──────────────────────────────────────────────── */
.section { margin-bottom: 2rem; }
.section-title {
  font-size: 1.05rem; color: #b0b4c8; font-weight: 600;
  margin-bottom: .75rem; padding-bottom: .35rem;
  border-bottom: 1px solid #1e2133;
  display: flex; justify-content: space-between; align-items: center;
}

/* ── Admin Help Guide ──────────────────────────────────────── */
.admin-help-guide { margin: 8px 0 16px; }
.admin-help-toggle {
  background: none; border: none; color: var(--accent, #5b6eea); cursor: pointer;
  font-size: 13px; padding: 4px 0; display: flex; align-items: center; gap: 6px;
}
.admin-help-toggle:hover { text-decoration: underline; }
.admin-help-arrow { transition: transform .2s; }
.admin-help-guide:not(.collapsed) .admin-help-arrow { transform: rotate(180deg); }
.admin-help-body {
  background: var(--surface, #161822); border: 1px solid var(--border, #2a2d3a);
  border-radius: 6px; padding: 16px; margin-top: 8px;
  font-size: 13px; line-height: 1.6; color: var(--text-muted, #8a8fa8);
}
.admin-help-guide.collapsed .admin-help-body { display: none; }
.admin-help-body h4 { color: var(--text, #e2e4ea); margin: 12px 0 4px; font-size: 13px; }
.admin-help-body h4:first-child { margin-top: 0; }
.admin-help-body p { margin: 4px 0 8px; }
.admin-help-body ul { margin: 4px 0 8px 16px; }
.admin-help-body li { margin-bottom: 4px; }
.admin-help-body ol { margin: 4px 0 8px 16px; }
.admin-help-body ol li { margin-bottom: 4px; }
.admin-help-body .help-flow {
  font-family: monospace; background: rgba(255,255,255,.04);
  padding: 8px 12px; border-radius: 4px; margin: 8px 0; font-size: 12px;
}

/* ── Collapsible Form Sections ─────────────────────────────── */
.section-collapsible {
  opacity: 1;
  transition: opacity .25s ease;
}
.section-collapsible.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 0;
  pointer-events: none;
}

/* ── Virtue Bars ───────────────────────────────────────────── */
.virtue-bar-wrap { margin-bottom: .5rem; }
.virtue-bar-label {
  display: flex; justify-content: space-between;
  font-size: .8rem; color: #8890a8; margin-bottom: .2rem;
}
.virtue-bar {
  position: relative;
  height: 8px; background: #1a1e28; border-radius: 4px; overflow: hidden;
}
.virtue-bar-base {
  position: absolute; height: 100%;
  border-right: 2px solid rgba(255, 255, 255, 0.45);
  z-index: 1;
}
.virtue-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #3a6bc5, #7ea8f7);
  transition: width .4s ease;
}

/* ── Virtue Sliders (Admin) ───────────────────────────────── */
.virtue-slider-group {
  margin-bottom: .75rem; padding-bottom: .75rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.virtue-slider-group:last-child { border-bottom: none; }
.form-range {
  flex: 1; height: 6px;
  accent-color: #3a6bc5;
  cursor: pointer;
}

/* ── Canon Timeline ────────────────────────────────────────── */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: ''; position: absolute; left: .4rem; top: 0; bottom: 0;
  width: 2px; background: #1e2133;
}
.timeline-item { position: relative; margin-bottom: 1rem; }
.timeline-item::before {
  content: ''; position: absolute; left: -1.1rem; top: .45rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: #3a6bc5; border: 2px solid #0c0e14;
}
.timeline-item .tl-date { font-size: .75rem; color: #555; }
.timeline-item .tl-title { font-size: .9rem; color: #c8cddf; font-weight: 500; }
.timeline-item .tl-summary { font-size: .82rem; color: #777; margin-top: .15rem; }

/* ── Vote Widget ───────────────────────────────────────────── */
.vote-widget {
  background: #14161f; border: 1px solid #2a3060;
  border-radius: 12px; padding: 1.25rem;
}
.vote-widget h3 { color: #c8cddf; margin-bottom: .75rem; }
/* Episode workflow stepper */
.episode-flow {
  display: flex; align-items: center; overflow-x: auto; gap: 0;
  padding: .25rem 0;
}
.flow-step {
  display: flex; flex-direction: column; align-items: center; min-width: 60px; flex-shrink: 0;
}
.flow-dot {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; border: 2px solid #3a3d4a; background: #1a1c28; color: #555;
}
.flow-label { font-size: .65rem; color: #555; margin-top: .2rem; text-align: center; white-space: nowrap; }
.flow-line { width: 16px; height: 2px; background: #2a2d3a; flex-shrink: 0; margin-top: -14px; }
.flow-done .flow-dot { background: #1a3a1a; border-color: #2a6a2a; color: #6fcf97; }
.flow-done .flow-label { color: #6fcf97; }
.flow-done + .flow-line { background: #2a6a2a; }
.flow-current .flow-dot { background: #1a2a4a; border-color: #4a7aff; color: #8ab0ff; animation: flow-pulse 2s infinite; }
.flow-current .flow-label { color: #8ab0ff; font-weight: 600; }
@keyframes flow-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(74,122,255,0.3); } 50% { box-shadow: 0 0 0 6px rgba(74,122,255,0); } }

/* Video trim slider */
.trim-track { touch-action: none; user-select: none; }
.trim-track:hover { border-color: #4a5aff; }
.trim-range { transition: none; pointer-events: none; }
.trim-track:hover .trim-range { background: rgba(123,138,255,0.35); }

.vote-option {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .75rem; background: #181a24;
  border-radius: 8px; margin-bottom: .5rem;
}
.vote-option .opt-key {
  font-weight: 700; color: #4a8ae8; min-width: 1.5rem; text-align: center;
}
.vote-option .opt-label { flex: 1; color: #c8cddf; }
.vote-option .opt-reaction {
  font-size: .75rem; color: #666; background: #12141d;
  padding: .15rem .4rem; border-radius: 4px;
}
.opt-edit-row {
  gap: .5rem;
}
.opt-edit-row .opt-edit-key { width: 3rem; min-width: 3rem; text-align: center; font-weight: 700; }
.opt-edit-row .opt-edit-label { flex: 1; }
.opt-edit-row .opt-edit-reaction { width: 5.5rem; min-width: 5.5rem; font-size: .82rem; }
.opt-edit-row .btn-danger {
  padding: .2rem .5rem; font-size: .85rem; line-height: 1;
  border-radius: 4px; min-width: auto;
}
.vote-meta { font-size: .8rem; color: #666; margin-top: .5rem; }

/* ── JSON Block ────────────────────────────────────────────── */
.json-block {
  background: #0e1018; border: 1px solid #1e2133;
  border-radius: 6px; padding: .75rem;
  font-size: .78rem; color: #8890a8;
  white-space: pre-wrap; word-break: break-word;
  max-height: 400px; overflow: hidden auto;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem; color: #555; font-size: .9rem;
}

/* ── Panels ────────────────────────────────────────────────── */
.panel {
  background: #14161f; border: 1px solid #1e2133;
  border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem;
}
.panel h3 { color: #c8cddf; margin-bottom: .5rem; font-size: 1rem; }

/* ── Narrative Style Picker ────────────────────────────────── */
.narrative-style-picker { margin-bottom: 1.5rem; }
.ns-preset-row { display: flex; gap: .75rem; align-items: flex-end; margin-bottom: 1.25rem; }
.ns-axis { margin-bottom: .85rem; }
.ns-axis-header { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; }
.ns-axis-label { font-weight: 600; color: #c8cddf; font-size: .85rem; }
.ns-axis-emoji { font-size: 1rem; }
.ns-axis-tag { font-size: .65rem; color: #5a6080; background: #1a1c28; border-radius: .5rem; padding: .1rem .4rem; }
.ns-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.ns-chip {
  padding: .3rem .65rem; border-radius: 1rem;
  border: 1px solid #2a2e3a; background: #14161e; color: #7880a0;
  cursor: pointer; font-size: .78rem; transition: all .15s; white-space: nowrap;
}
.ns-chip:hover { border-color: #4a8ae8; color: #c8cddf; }
.ns-chip.selected { background: #1a2a3e; border-color: #4a8ae8; color: #6ac0e8; }
.ns-chip-multi.selected { background: #1a3a2a; border-color: #4ae88a; color: #5ae89a; }

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: #14161f; border: 1px solid #1e2133;
  border-radius: 10px; padding: 1rem; text-align: center;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: #7ea8f7; }
.stat-card .stat-label { font-size: .78rem; color: #666; text-transform: uppercase; letter-spacing: .05em; }

/* ── Workshop Tabs ─────────────────────────────────────────── */
.workshop-tab {
  background: transparent; border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: #8890a8; padding: .45rem .9rem; font-size: .82rem;
  cursor: pointer; transition: all .15s;
}
.workshop-tab:hover { color: #c8cddf; background: #1a1e2e; }
.workshop-tab.active {
  color: #b08df0; border-bottom-color: #b08df0;
  background: #14161f;
}

/* ── Codex Guide ──────────────────────────────────────────── */
.codex-guide {
  display: flex; flex-direction: column; gap: 1rem;
}
.codex-guide-card {
  display: flex; gap: 1.25rem; align-items: flex-start;
  padding: 1.25rem 1.5rem; border-radius: 10px;
  background: linear-gradient(135deg, rgba(26,30,46,.8), rgba(18,20,29,.95));
  border: 1px solid #1e2133;
}
.codex-guide-card:hover { border-color: #2a3050; }
.codex-guide-icon {
  font-size: 1.6rem; flex-shrink: 0; width: 40px; text-align: center;
  line-height: 1; padding-top: .15rem;
}
.codex-guide-title {
  font-size: 1.05rem; font-weight: 600; color: #e0e0e8; margin-bottom: .35rem;
}
.codex-guide-text {
  font-size: .88rem; color: #9ca3b8; line-height: 1.55;
}
.codex-guide-text strong { color: #c8cddf; }
.codex-guide-link {
  display: inline-block; margin-top: .5rem;
  font-size: .82rem; color: #7a8ac8; transition: color .15s;
}
.codex-guide-link:hover { color: #a0b0e8; }
@media (max-width: 768px) {
  .codex-guide-card { padding: 1rem; gap: .75rem; }
  .codex-guide-icon { font-size: 1.3rem; width: 32px; }
}

/* ── Vault ─────────────────────────────────────────────────── */
.vault-locked {
  text-align: center; padding: 3rem; color: #888;
}
.vault-locked h2 { color: #c8a84a; margin-bottom: .5rem; }

/* ── Memory snapshot ───────────────────────────────────────── */
.memory-section {
  background: #0e1018; border: 1px solid #1e2133;
  border-radius: 8px; padding: 1rem; margin-bottom: 1rem;
}
.memory-section h4 {
  font-size: .85rem; color: #7ea8f7; text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: .5rem;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-row { flex-direction: column; }
  .card-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .stat-card { padding: .75rem; border-radius: 8px; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .stat-card .stat-label { font-size: .7rem; }
  .section-title { font-size: .85rem; }
  .main-content { padding: .75rem; }
}

/* ── Misc ──────────────────────────────────────────────────── */
.muted { color: #555; font-style: italic; }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .75rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none; }
.portrait-sm {
  width: 48px; height: 48px; border-radius: 8px;
  object-fit: cover; background: #1a1e28;
}
.portrait-lg {
  width: 120px; height: 120px; border-radius: 12px;
  object-fit: cover; background: #1a1e28;
}

/* Entity images (cards / detail banners) */
.entity-img {
  width: 100%; max-height: 280px; object-fit: cover;
  border-radius: 10px; margin-bottom: .75rem;
  background: #1a1e28; display: block;
}
.card .entity-img { max-height: 180px; border-radius: 8px 8px 0 0; margin-bottom: 0; }

/* Image adjuster (inline drag-to-reposition for admins) */
.img-adjust-wrap { position: relative; margin-bottom: .75rem; }
.img-adjust-wrap .entity-img { margin-bottom: 0; }
.img-adjust-btn {
  position: absolute; bottom: .5rem; right: .5rem;
  background: rgba(0,0,0,.65); color: #ccc; border: 1px solid rgba(255,255,255,.15);
  font-size: .75rem; padding: 3px 10px; border-radius: 6px;
  cursor: pointer; opacity: 0; transition: opacity .2s;
}
.img-adjust-wrap:hover .img-adjust-btn { opacity: 1; }
.img-adjust-wrap.adjusting { outline: 2px solid #5b7fff; border-radius: 10px; }
.img-adjust-wrap.adjusting .entity-img { user-select: none; -webkit-user-select: none; }
.img-adjust-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; background: rgba(0,0,0,.75);
  border-radius: 0 0 10px 10px;
}
.img-adjust-hint { flex: 1; font-size: .78rem; color: #aaa; }

/* Character sets gallery */
.char-sets-gallery { display: flex; gap: 1rem; flex-wrap: wrap; }
.char-set-item { text-align: center; max-width: 220px; }
.char-set-img {
  width: 200px; height: 200px; object-fit: cover;
  border-radius: 8px; background: #1a1e28; display: block;
  margin-bottom: .35rem;
}
.char-set-label { color: #aaa; }

/* Character roster chips (group expand) */
.char-roster-chip {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  text-decoration: none; color: #c8cee0; padding: .35rem .5rem;
  border-radius: 6px; transition: background .15s;
  min-width: 60px; text-align: center;
}
.char-roster-chip:hover { background: rgba(255,255,255,.06); }

/* Table thumbnails */
.thumb-img {
  width: 36px; height: 36px; border-radius: 6px;
  object-fit: cover; background: #1a1e28; vertical-align: middle;
}

/* ── Hex Map ──────────────────────────────────────────────── */
.hex-map-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #1e2133;
  border-radius: 10px;
  background: #0a0c12;
}
.hex-map-svg {
  width: 100%;
  height: auto;
  min-height: 420px;
  max-height: 620px;
  display: block;
}
.hex-map-svg polygon {
  stroke-width: 1.5;
  transition: fill .15s, stroke .15s;
  cursor: default;
}

/* Empty hexes (admin grid placeholders) */
.hex-empty {
  fill: rgba(20, 22, 31, 0.4);
  stroke: #252838;
  stroke-dasharray: 4 3;
  cursor: pointer;
}
.hex-empty:hover {
  fill: rgba(42, 46, 64, 0.6);
  stroke: #6a8ad4;
  stroke-dasharray: none;
}

/* Occupied hex (admin) */
.hex-region {
  stroke: #3a4060;
  stroke-width: 2;
  cursor: pointer;
}
.hex-region:hover {
  stroke: #6a8ad4;
  stroke-width: 2.5;
  filter: brightness(1.2);
}

/* Fog / undiscovered hex (public) */
.hex-fog {
  fill: #0e1018;
  stroke: #181a24;
  stroke-width: 1;
  opacity: 0.7;
}

/* Discovered hex (public) */
.hex-discovered {
  stroke: #3a4060;
  stroke-width: 2;
  cursor: pointer;
}
.hex-discovered:hover {
  stroke: #7ea8f7;
  stroke-width: 2.5;
  filter: brightness(1.15);
}

/* Selected hex highlight */
.hex-selected {
  stroke: #6a8ad4 !important;
  stroke-width: 3 !important;
  filter: drop-shadow(0 0 6px rgba(106, 138, 212, 0.5));
}

/* Labels inside hexes */
.hex-label {
  font-size: 9px;
  font-weight: 600;
  fill: #d4d4dc;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
}
.hex-label-fog {
  fill: #333;
  font-size: 14px;
}

/* Tooltip on hover */
.hex-tooltip {
  position: absolute;
  background: #14161f;
  border: 1px solid #252838;
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .8rem;
  color: #d4d4dc;
  pointer-events: none;
  z-index: 50;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.hex-tooltip .tooltip-name { font-weight: 600; color: #e8e8f0; margin-bottom: .2rem; }
.hex-tooltip .tooltip-meta { font-size: .72rem; color: #666; }

/* Detail panel for public map */
.hex-detail-panel { margin-top: 1rem; }

/* Danger level stroke overrides */
.hex-danger-1 { stroke: #5a5a2a !important; }
.hex-danger-2 { stroke: #6a5a2a !important; }
.hex-danger-3 { stroke: #7a4a2a !important; }
.hex-danger-4 { stroke: #8a3a2a !important; }
.hex-danger-5 { stroke: #a82a2a !important; }

/* Unplaced region badges */
.hex-unplaced { cursor: pointer; }
.hex-unplaced:hover { background: #2a2e40; }

/* Color legend */
.hex-legend {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-top: .75rem; font-size: .75rem; color: #666;
}
.hex-legend-item { display: flex; align-items: center; gap: .3rem; }
.hex-legend-swatch {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid #252838; display: inline-block;
}

@media (max-width: 768px) {
  .hex-map-svg { min-height: 280px; max-height: 450px; }
}

/* ── World Builder Progress ──────────────────────────────── */
.wb-progress-list {
  display: flex; flex-direction: column; gap: .4rem;
  padding: .5rem 0;
}
.wb-progress-list > div {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .6rem; border-radius: 6px;
  font-size: .9rem; transition: background .2s;
}
.wb-step-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: .75rem; flex-shrink: 0;
}
.wb-step-done { color: #7ae6a0; }
.wb-step-done .wb-step-icon { background: #1a3a28; color: #7ae6a0; }
.wb-step-active { color: #7ea8f7; background: #141830; }
.wb-step-active .wb-step-icon { background: #1a2848; color: #7ea8f7; animation: wb-pulse 1.2s ease-in-out infinite; }
.wb-step-error { color: #e55; }
.wb-step-error .wb-step-icon { background: #3a1a1a; color: #e55; }
.wb-step-pending { color: #555; }
.wb-step-pending .wb-step-icon { background: #1a1c24; color: #444; }
@keyframes wb-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ── Character Profile (Public) ──────────────────────────── */

/* Hero header — banner + portrait overlay */
.char-hero {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: #12141d;
}
.char-hero-banner {
  width: 100%; height: 260px;
  object-fit: cover; display: block;
  filter: brightness(.7);
}
.char-hero-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(transparent, rgba(12,14,20,.92) 60%);
  display: flex; align-items: flex-end; gap: 1.25rem;
}
.char-hero-portrait {
  width: 96px; height: 96px; border-radius: 12px;
  object-fit: cover; border: 3px solid #1e2133;
  background: #1a1e28; flex-shrink: 0;
}
.char-hero-info { flex: 1; min-width: 0; }
.char-hero-name {
  font-size: 1.6rem; font-weight: 700; color: #e8e8f0;
  margin: 0; line-height: 1.2;
}
.char-hero-identity {
  font-size: .85rem; color: #8890a8; margin-top: .25rem;
}
.char-hero-status {
  display: inline-block; padding: .15rem .55rem; border-radius: 4px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; margin-left: .5rem;
}
.char-hero-status-wounded { background: #2a1a1a; color: #e7a03c; }
.char-hero-status-missing { background: #1a1a2a; color: #7a8ac8; }
.char-hero-status-deceased { background: #2a1a1a; color: #c87a7a; }
.char-hero-status-promoted { background: #1a2a1a; color: #4ae88a; }
.char-hero-no-banner {
  height: 140px;
  background: linear-gradient(135deg, #12141d 0%, #1a1e2e 100%);
}

/* About / Story section */
.char-about {
  font-size: .95rem; color: #bbb; line-height: 1.7;
  max-width: 720px;
}

/* Virtue compass — simplified public display */
/* Virtue flavor text */
.char-virtue-flavor {
  font-size: 1.05rem; line-height: 1.7;
  color: #8890a8; font-style: italic;
  text-align: center; padding: .5rem 1rem;
}
.char-virtue-flavor-name {
  font-weight: 600; font-style: normal;
}
/* Virtue accent colors */
.virtue-color-successful { color: #4ae88a; }
.virtue-color-wanderer   { color: #7ea8f7; }
.virtue-color-wise       { color: #e7c84a; }
.virtue-color-seeker     { color: #b08df0; }

/* Canon timeline — public view */
.char-timeline { position: relative; padding-left: 1.75rem; }
.char-timeline::before {
  content: ''; position: absolute; left: .5rem; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(180deg, #3a6bc5 0%, #1e2133 100%);
}
.char-tl-item { position: relative; margin-bottom: 1.25rem; }
.char-tl-item::before {
  content: ''; position: absolute; left: -1.25rem; top: .5rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: #3a6bc5; border: 2px solid #0c0e14;
}
.char-tl-item:first-child::before { background: #7ea8f7; }
.char-tl-date { font-size: .72rem; color: #555; margin-bottom: .15rem; }
.char-tl-title { font-size: .92rem; color: #c8cddf; font-weight: 500; }
.char-tl-summary { font-size: .82rem; color: #777; margin-top: .2rem; line-height: 1.5; }

/* Group card on profile */
.char-group-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem; background: #14161f;
  border: 1px solid #1e2133; border-radius: 10px;
  text-decoration: none; color: inherit; transition: border-color .2s;
}
.char-group-card:hover { border-color: #3a4060; }
.char-group-img {
  width: 56px; height: 56px; border-radius: 8px;
  object-fit: cover; background: #1a1e28; flex-shrink: 0;
}
.char-group-name { font-size: 1rem; color: #d8d8e8; font-weight: 500; }
.char-group-desc { font-size: .82rem; color: #777; margin-top: .15rem; }

/* Artifact chips */
.char-artifacts-grid {
  display: flex; gap: .75rem; flex-wrap: wrap;
}
.char-artifact-chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; background: #14161f;
  border: 1px solid #1e2133; border-radius: 8px;
  text-decoration: none; color: inherit; transition: border-color .2s;
}
.char-artifact-chip:hover { border-color: #3a4060; }
.char-artifact-img {
  width: 36px; height: 36px; border-radius: 6px;
  object-fit: cover; background: #1a1e28;
}
.char-artifact-name { font-size: .87rem; color: #c8cddf; }
.char-artifact-type { font-size: .72rem; color: #666; text-transform: uppercase; }

/* ── Artifact Detail ──────────────────────────────────────── */
.artifact-detail {
  display: flex; gap: 2rem; align-items: flex-start;
}
.artifact-detail-img {
  width: 200px; height: 200px; object-fit: cover;
  border-radius: 10px; background: #1a1e28; flex-shrink: 0;
}
.artifact-detail-info { flex: 1; min-width: 0; }
.artifact-detail-info h1 { margin: 0 0 1rem; font-size: 1.6rem; }
.artifact-detail-field {
  margin-bottom: .75rem; font-size: .9rem; color: #c8cddf;
}
.artifact-detail-label {
  display: block; font-size: .72rem; text-transform: uppercase;
  color: #666; letter-spacing: .04em; margin-bottom: .2rem;
}
@media (max-width: 768px) {
  .artifact-detail { flex-direction: column; gap: 1rem; }
  .artifact-detail-img { width: 120px; height: 120px; }
}

/* Character sets gallery — public view */
.char-media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.char-media-item {
  position: relative; border-radius: 8px; overflow: hidden;
  background: #1a1e28; aspect-ratio: 1;
}
.char-media-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.char-media-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: .35rem .5rem; font-size: .75rem; color: #ddd;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  text-align: center;
}

/* Profile section headers — mythic styling */
.char-section { margin-bottom: 2rem; }
.char-section-title {
  font-size: .78rem; font-weight: 600; color: #555;
  text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: .75rem; padding-bottom: .35rem;
  border-bottom: 1px solid #1a1c28;
}

@media (max-width: 768px) {
  .char-hero-banner { height: 180px; }
  .char-hero-overlay { padding: 1rem; gap: .75rem; }
  .char-hero-portrait { width: 72px; height: 72px; }
  .char-hero-name { font-size: 1.25rem; }
  .char-virtue-flavor { font-size: .92rem; padding: .25rem .5rem; }
  .char-media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ── Video Production / Storyboard ─────────────────────── */

.video-disk-usage {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; margin-bottom: 1rem;
  background: var(--surface, #161822); border-radius: 8px; border: 1px solid var(--border, #2a2d3a);
}
.disk-usage-bar {
  display: flex; height: 8px; flex: 1; max-width: 200px;
  border-radius: 4px; overflow: hidden; background: #1e2030;
}
.disk-segment { height: 100%; }
.disk-images  { background: #6c8ce8; }
.disk-tts     { background: #e8a06c; }
.disk-renders { background: #6ce89e; }
.disk-videos  { background: #c86ce8; }
.disk-usage-label { font-size: .82rem; color: var(--muted, #888); }

.video-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .75rem 0; margin-bottom: 1rem; border-bottom: 1px solid var(--border, #2a2d3a);
}
.video-stats { margin-left: auto; font-size: .85rem; color: var(--muted, #888); }
.toolbar-separator { width: 1px; height: 1.5rem; background: var(--border, #2a2d3a); margin: 0 .25rem; }
.toolbar-label { font-size: .82rem; color: var(--muted, #888); white-space: nowrap; margin: 0; }
.toolbar-select {
  font-size: .82rem; padding: .3rem .5rem; border-radius: 4px;
  background: var(--bg-card, #181a24); color: #e0e0e0;
  border: 1px solid var(--border, #2a2d3a);
}
.toolbar-select:focus { border-color: var(--primary, #6c8ce8); outline: none; }
.toolbar-range { width: 80px; cursor: pointer; accent-color: var(--primary, #6c8ce8); }

.caption-preview {
  margin: 0 0 .75rem; padding: 1rem;
  background: #111; border-radius: 8px;
  display: flex; justify-content: center; align-items: flex-end;
  min-height: 70px;
  border: 1px solid var(--border, #2a2d3a);
}
.caption-preview-text {
  text-align: center; font-weight: 700; line-height: 1.3;
  transition: all .15s;
}

/* Template Management Panel */
.templates-manage-panel {
  background: var(--card-bg, #161825); border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px; padding: 1rem; margin: .75rem 0;
}
.templates-manage-panel h4 { margin: 0 0 .75rem; font-size: 1rem; }
.template-item {
  display: flex; align-items: center; gap: .5rem; padding: .5rem 0;
  border-bottom: 1px solid var(--border, #2a2d3a); flex-wrap: wrap;
}
.template-item:last-of-type { border-bottom: none; }
.template-type-badge {
  font-size: .7rem; text-transform: uppercase; padding: 2px 6px;
  border-radius: 3px; background: #7b8aff22; color: #7b8aff; font-weight: 600;
}

.video-timeline {
  display: flex; gap: .5rem; overflow-x: auto; padding: .5rem 0 1rem;
  margin-bottom: 1rem;
}
.timeline-item {
  flex-shrink: 0; text-align: center; cursor: pointer; opacity: .8; transition: opacity .2s;
}
.timeline-item:hover { opacity: 1; }
.timeline-thumb {
  position: relative; width: 120px; height: 68px; border-radius: 4px; overflow: hidden;
  background: #1e2030; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; color: var(--muted, #888); border: 1px solid var(--border, #2a2d3a);
}
.timeline-thumb img { width: 100%; height: 100%; object-fit: cover; }
.timeline-dur { font-size: .72rem; color: var(--muted, #888); }

.scene-card {
  background: var(--surface, #161822); border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px; margin-bottom: .75rem; overflow: hidden;
}
.scene-card.collapsed .scene-body { display: none; }
.scene-card.scene-skipped { opacity: 0.35; border-color: #4a2020; }
.scene-card.scene-skipped .scene-header { background: rgba(80,20,20,0.3); }
.scene-card.dragging { opacity: 0.4; border-color: var(--accent, #5b6eea); }
.scene-card.drag-over { border-color: var(--accent, #5b6eea); box-shadow: 0 0 0 2px rgba(91,110,234,.3); }
.scene-header {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .75rem; cursor: pointer;
  background: rgba(255,255,255,.02);
}
.scene-header:hover { background: rgba(255,255,255,.04); }
.drag-handle { cursor: grab; font-size: 1.1rem; color: var(--muted, #888); user-select: none; }
.scene-duration { margin-left: .25rem; font-size: .82rem; color: var(--muted, #888); }

.scene-body { padding: .75rem; }

.scene-images {
  display: flex; gap: .75rem; margin-bottom: .75rem;
  position: relative; z-index: 0;
}
.scene-preview {
  text-align: center; position: relative; overflow: hidden;
}
.scene-preview label { display: block; font-size: .72rem; color: var(--muted, #888); margin-bottom: .25rem; }
.scene-preview img, .scene-preview video {
  max-height: 200px; max-width: 100%; border-radius: 4px; border: 1px solid var(--border, #2a2d3a);
  display: block; margin: 0 auto;
}
/* V-Crop position picker */
.vcrop-picker { margin-top: .5rem; }
.vcrop-container {
  position: relative; display: inline-block; overflow: hidden;
  border-radius: 4px; border: 1px solid var(--border, #2a2d3a);
  cursor: ew-resize; user-select: none;
}
.vcrop-container img.vcrop-bg,
.vcrop-container video.vcrop-bg {
  display: block; max-height: 120px; pointer-events: none;
}
.vcrop-rect {
  position: absolute; top: 0; height: 100%;
  border: 2px solid #7b8aff; background: rgba(123,138,255,0.15);
  pointer-events: none; transform: translateX(-50%);
}
.vcrop-slider { width: 200px; margin-top: .25rem; }

/* ── Waveform Word Sync Editor ───────────────────────────── */
.we-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  z-index: 9900; display: flex; align-items: center; justify-content: center;
}
.we-modal {
  background: #12141e; border: 1px solid #2a2d3a; border-radius: 10px;
  width: min(96vw, 1100px); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.we-header {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem; border-bottom: 1px solid #2a2d3a;
  background: #0e101a; flex-shrink: 0;
}
.we-title { font-size: .95rem; font-weight: 600; margin-right: auto; }
.we-toolbar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.we-btn {
  padding: .3rem .7rem; font-size: .8rem; border-radius: 4px; cursor: pointer;
  background: #1e2130; border: 1px solid #3a3d4a; color: inherit;
}
.we-btn:hover { background: #2a2d40; }
.we-btn-save { background: #1a3a1a; border-color: #2a6a2a; color: #6fcf97; }
.we-btn-save:hover { background: #1f4a1f; }
.we-zoom-label { font-size: .78rem; color: #888; display: flex; align-items: center; gap: .3rem; }
.we-zoom-label input { width: 70px; }
.we-close-btn {
  margin-left: .5rem; font-size: 1.2rem; background: none; border: none;
  cursor: pointer; color: #888; line-height: 1; padding: 0 .3rem;
}
.we-close-btn:hover { color: #fff; }
.we-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.we-scroll {
  flex: 1; overflow-x: auto; overflow-y: hidden; position: relative;
  cursor: default; min-height: 0;
}
.we-inner {
  position: relative; min-height: 140px; padding-bottom: 4px;
  user-select: none;
}
/* Ruler */
.we-ruler {
  height: 22px; position: relative; background: #0e101a;
  border-bottom: 1px solid #2a2d3a;
}
.we-tick {
  position: absolute; top: 4px; font-size: .68rem; color: #666;
  white-space: nowrap; transform: translateX(-50%);
}
.we-tick::before {
  content: ''; position: absolute; top: -4px; left: 50%;
  width: 1px; height: 4px; background: #3a3d4a;
}
/* Word blocks */
.we-blocks {
  position: relative; height: 36px; background: #0f1118;
  border-bottom: 1px solid #1e2130;
}
.we-block {
  position: absolute; top: 3px; height: 30px;
  background: #1e2a4a; border: 1px solid #4a5aff;
  border-radius: 3px; cursor: grab; overflow: hidden;
  display: flex; align-items: center;
  transition: background .1s;
}
.we-block:hover { background: #263360; border-color: #6a7aff; }
.we-block-dragging { cursor: grabbing; background: #2a3a6a; z-index: 10; }
.we-block-text {
  font-size: .72rem; padding: 0 6px; white-space: nowrap;
  overflow: hidden; pointer-events: none; flex: 1;
  text-overflow: ellipsis;
}
.we-block-resize {
  width: 6px; height: 100%; cursor: ew-resize; flex-shrink: 0;
  background: rgba(100,120,255,0.4);
}
.we-block-resize:hover { background: rgba(100,120,255,0.8); }
/* Canvas */
#we-canvas { display: block; position: relative; }
/* Playhead */
.we-playhead {
  position: absolute; top: 0; width: 2px; background: #ff5555;
  pointer-events: none; z-index: 5;
}
.we-playhead::before {
  content: ''; position: absolute; top: 0; left: -4px;
  border: 5px solid transparent; border-top-color: #ff5555;
}
/* Status bar */
.we-status {
  padding: .35rem 1rem; font-size: .78rem; color: #888;
  background: #0e101a; border-top: 1px solid #1e2130; flex-shrink: 0;
}
/* Footer */
.we-footer {
  padding: .5rem 1rem; background: #0c0e14; border-top: 1px solid #1e2130;
  display: flex; align-items: center; gap: 1rem; flex-shrink: 0;
}
.we-footer-hint { font-size: .75rem; color: #555; }

.scene-preview-has-video { position: relative; }
.scene-video-badge {
  position: absolute; top: 22px; right: 4px;
  background: #7b5ae8; color: #fff; padding: 1px 6px; border-radius: 3px;
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.scene-video-badge-sm {
  background: #7b5ae8; color: #fff; padding: 1px 5px; border-radius: 3px;
  font-size: .6rem; font-weight: 600; text-transform: uppercase; margin-left: .25rem;
}
.cam-badge {
  font-size: .7rem; padding: 1px 6px; border-radius: 3px; margin-left: .25rem;
}
.cam-shot { background: #2a1e3a; color: #b08aff; }
.cam-lens { background: #1e2a3a; color: #8ab0ff; }
.cam-move { background: #3a2a1e; color: #ffb08a; }
.detail-preview { min-width: 80px; }
.detail-preview .no-media { font-size: .75rem; color: #555; padding: 8px; text-align: center; }
.scene-preview .preview-actions { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

/* AI Video Panel */
.ai-video-panel {
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0;
  background: #13151e;
}
.ai-video-panel .aiv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-video-panel .aiv-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6a7a9a;
  white-space: nowrap;
}
.ai-video-panel select {
  background: #1e2130;
  border: 1px solid #2e3248;
  border-radius: 5px;
  color: #d0d8f0;
  font-size: .8rem;
  padding: 4px 8px;
  height: 30px;
}
.ai-video-panel select:focus {
  outline: none;
  border-color: #4a6aff;
}
.ai-video-panel .aiv-checks {
  display: flex;
  gap: 14px;
  margin-left: 4px;
}
.ai-video-panel .aiv-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: #aab0c8;
  margin: 0;
  cursor: pointer;
}
.ai-video-panel .aiv-prompt-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.ai-video-panel .aiv-prompt-row input[type="text"] {
  flex: 1;
  background: #1e2130;
  border: 1px solid #2e3248;
  border-radius: 5px;
  color: #d0d8f0;
  font-size: .82rem;
  padding: 6px 10px;
  height: 34px;
}
.ai-video-panel .aiv-prompt-row input[type="text"]:focus {
  outline: none;
  border-color: #4a6aff;
}
.ai-video-panel .aiv-status {
  margin-top: 6px;
  font-size: .75rem;
  color: #7a8aaa;
  min-height: 1.2em;
}
.ai-video-panel .aiv-status.error { color: #ff6a6a; }
.ai-video-panel .aiv-status.success { color: #6aff9a; }
.ambient-sound-info {
  font-size: .78rem; color: #8a9ab0; padding: 4px 8px; margin-top: 6px;
  background: rgba(255,255,255,.03); border-radius: 4px; border-left: 2px solid #3a4a5a;
}
.ambient-sound-icon { margin-right: 4px; }
.ambient-sound-section {
  background: rgba(255,255,255,.02); border: 1px solid var(--border, #2a2d3a);
  border-radius: 6px; padding: .6rem .75rem; margin: .5rem 0;
}
.ambient-sound-section textarea {
  width: 100%; margin-top: .35rem; font-size: .85rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit; padding: .35rem .5rem; resize: vertical;
}
.scene-video-remove, .scene-img-remove {
  position: absolute; top: 22px; left: 4px;
  padding: 0 4px; font-size: .75rem; line-height: 1.2;
}
.video-duration-info {
  font-size: .8rem; color: #e8a06c; padding: .25rem 0; margin-bottom: .5rem;
}
.scene-video-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-bottom: .5rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border, #2a2d3a);
}
.scene-video-actions label { font-size: .78rem; color: var(--muted, #888); margin-right: .25rem; }
.motion-disabled > select, .motion-disabled > input[type="range"] { opacity: 0.35; pointer-events: none; }
.motion-disabled > .motion-note { opacity: 0.7; }
.motion-note {
  font-size: .75rem; color: #e8a06c; font-style: italic; margin-right: .5rem;
}
.stock-video-duration {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(0,0,0,.7); color: #fff; padding: 1px 5px; border-radius: 3px;
  font-size: .65rem;
}
.timeline-item.has-video .timeline-thumb { border-color: #7b5ae8; }
.timeline-video-badge {
  position: absolute; top: 1px; right: 1px;
  background: #7b5ae8; color: #fff; font-size: .5rem; padding: 0 3px;
  border-radius: 2px; font-weight: 700;
}
.empty-preview {
  width: 100px; height: 80px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border, #2a2d3a); border-radius: 4px;
  font-size: .75rem; color: var(--muted, #888);
}

.scene-fields { margin-bottom: .75rem; }
.scene-fields label { display: block; font-size: .78rem; color: var(--muted, #888); margin-bottom: .2rem; margin-top: .5rem; }
.scene-fields textarea, .scene-fields input[type="text"] {
  width: 100%; padding: .4rem .5rem; font-size: .85rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit; resize: vertical;
}
.scene-fields textarea { min-height: 60px; }
.input-with-btn { display: flex; gap: .5rem; align-items: flex-start; }
.input-with-btn textarea { flex: 1; }
.scene-image-actions, .scene-motion, .scene-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-bottom: .5rem;
}
.scene-motion label { font-size: .78rem; color: var(--muted, #888); }
.scene-motion select, .scene-motion input[type="number"] {
  padding: .25rem .4rem; font-size: .82rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit;
}
.scene-motion input[type="range"] { width: 80px; }

.stock-search-modal {
  background: var(--surface, #161822); border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px; padding: .75rem; margin-top: .5rem;
}
.stock-search-bar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem;
}
.stock-search-bar input { flex: 1; min-width: 180px; padding: .4rem .6rem; font-size: .85rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit;
}
.stock-providers { display: flex; gap: .25rem; }
.stock-provider-btn {
  padding: .3rem .6rem; font-size: .78rem; border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid var(--border, #2a2d3a); color: var(--muted, #888);
  transition: all .15s;
}
.stock-provider-btn:hover { border-color: var(--primary, #6c8ce8); color: inherit; }
.stock-provider-btn.active {
  background: var(--primary, #6c8ce8); border-color: var(--primary, #6c8ce8); color: #fff;
}
.stock-results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .5rem;
}
.stock-result-item {
  border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border, #2a2d3a); transition: border-color .2s, transform .15s;
}
.stock-video-results {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.stock-video-results .stock-thumb-wrap { aspect-ratio: 16/9; }
.stock-result-item:hover { border-color: var(--primary, #6c8ce8); transform: translateY(-1px); }
.stock-thumb-wrap {
  position: relative; aspect-ratio: 1; overflow: hidden; background: rgba(255,255,255,.03);
}
.stock-thumb-wrap img, .stock-thumb-wrap video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .3s;
}
.stock-result-item:hover .stock-thumb-wrap img,
.stock-result-item:hover .stock-thumb-wrap video { transform: scale(1.05); }
.stock-hover-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .3rem;
  background: rgba(0,0,0,0); opacity: 0; transition: all .2s;
}
.stock-result-item:hover .stock-hover-overlay { background: rgba(0,0,0,.6); opacity: 1; }
.stock-video-item .stock-hover-overlay {
  inset: auto 0 0 0; flex-direction: row; justify-content: center;
  padding: .35rem; gap: .25rem;
}
.stock-video-item:hover .stock-hover-overlay { background: rgba(0,0,0,.8); opacity: 1; }
.stock-video-item .stock-thumb-wrap::after {
  content: '▶'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 2rem; color: rgba(255,255,255,.8); text-shadow: 0 0 8px rgba(0,0,0,.7);
  pointer-events: none; transition: opacity .2s;
}
.stock-video-item:hover .stock-thumb-wrap::after { opacity: 0; }
.stock-credit {
  padding: .2rem .4rem; font-size: .7rem; color: var(--muted, #888);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stock-loading, .stock-empty {
  grid-column: 1 / -1; text-align: center; padding: 1.5rem;
  color: var(--muted, #888); font-size: .85rem;
}
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border, #2a2d3a); border-top-color: var(--primary, #6c8ce8);
  border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle; margin-right: .4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.stock-pagination {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border, #2a2d3a);
}
.stock-page-info { font-size: .8rem; color: var(--muted, #888); }

.video-music-section, .video-render-section {
  background: var(--surface, #161822); border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px; padding: 1rem; margin-top: 1rem;
}
.video-music-section h3, .video-render-section h3 {
  margin: 0 0 .75rem; font-size: 1rem;
}
.music-library, .music-search {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-bottom: .75rem;
}
.music-library select, .music-search select,
.music-search input {
  padding: .35rem .5rem; font-size: .85rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit;
}
.music-timing {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  margin-bottom: .75rem; padding: .5rem .25rem;
  border-top: 1px solid var(--border, #2a2d3a);
}
.music-timing-grid {
  display: grid; grid-template-columns: auto 80px auto 80px;
  align-items: center; gap: .35rem .5rem;
}
.music-timing-grid label { font-size: .8rem; color: var(--muted, #888); white-space: nowrap; }
.music-timing-grid input {
  width: 80px; padding: .3rem .4rem; font-size: .85rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit;
}
.music-toggles { display: flex; gap: 1rem; align-items: center; }
.music-toggles .toggle-label { display: flex; align-items: center; gap: .35rem; font-size: .85rem; cursor: pointer; white-space: nowrap; }
#music-search-results {
  width: 100%; margin-top: .5rem;
}
.music-result-item {
  display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem;
  background: rgba(255,255,255,.02); border-radius: 6px; margin-bottom: .35rem;
}
.music-result-item span { flex: 1; font-size: .85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-result-item audio { height: 32px; flex-shrink: 0; }

.render-actions { display: flex; gap: .5rem; margin-bottom: .75rem; }
.render-list { display: flex; flex-direction: column; gap: .5rem; }
.render-item {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem;
  background: rgba(255,255,255,.02); border-radius: 6px;
}
.render-format { font-weight: 600; font-size: .85rem; min-width: 80px; }
.render-status { font-size: .82rem; padding: .1rem .5rem; border-radius: 4px; }
.status-pending { background: #333; color: #aaa; }
.status-rendering { background: #2a3a1a; color: #9de86c; }
.status-completed { background: #1a2a3a; color: #6cb8e8; }
.status-failed { background: #3a1a1a; color: #e86c6c; }
.render-error { font-size: .78rem; color: #e86c6c; }

.progress-bar {
  width: 120px; height: 8px; background: #1e2030; border-radius: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: #6ce89e; border-radius: 4px; transition: width .3s;
}

.publish-section, .publish-unified {
  background: rgba(255,255,255,.02); border-radius: 6px; padding: .75rem;
  margin-top: .75rem;
}
.publish-section h4, .publish-unified h3 { margin: 0 0 .5rem; }
.publish-section label, .publish-unified label { display: block; font-size: .78rem; color: var(--muted, #888); margin-top: .4rem; }
.publish-section input, .publish-section textarea,
.publish-unified input, .publish-unified textarea {
  width: 100%; padding: .35rem .5rem; font-size: .85rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit; margin-bottom: .25rem;
}
.publish-section textarea, .publish-unified textarea { min-height: 60px; resize: vertical; }
.publish-tabs { display: flex; gap: 0; margin-bottom: .75rem; border-bottom: 1px solid var(--border, #2a2d3a); }
.publish-tab {
  padding: .4rem 1rem; font-size: .85rem; cursor: pointer;
  background: none; border: none; color: #888; border-bottom: 2px solid transparent;
}
.publish-tab:hover { color: #bbb; }
.publish-tab.active { color: #7b8aff; border-bottom-color: #7b8aff; }
.publish-panel { padding: .25rem 0; }
.publish-paste-section {
  margin-top: .75rem; padding: .5rem; border: 1px dashed var(--border, #2a2d3a);
  border-radius: 6px; background: rgba(123,138,255,0.03);
}
.publish-paste-section label { margin-bottom: .25rem; }
/* Cut switcher tabs */
.cut-switcher {
  display: flex; align-items: center; gap: .25rem; margin-bottom: .75rem;
  padding: .5rem; background: var(--surface, #161822);
  border: 1px solid var(--border, #2a2d3a); border-radius: 8px;
  flex-wrap: wrap;
}
.cut-tab {
  padding: .35rem .75rem; font-size: .85rem; border-radius: 4px;
  color: #888; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
}
.cut-tab:hover { color: #bbb; background: rgba(255,255,255,.03); }
.cut-tab.active {
  color: #7b8aff; border-color: #7b8aff; background: rgba(123,138,255,.08);
}
.thumb-ai-result {
  background: rgba(123,138,255,.04); border: 1px solid var(--border, #2a2d3a);
  border-radius: 6px; padding: .6rem .75rem; margin-top: .5rem;
}
.thumb-ai-result textarea { resize: vertical; background: var(--bg, #0c0e14); color: #b0b8d0; }
.thumb-ai-result label { margin-top: .4rem; }
.thumb-paste-section {
  padding: .5rem; border: 1px dashed var(--border, #2a2d3a);
  border-radius: 6px; background: rgba(123,138,255,.03);
}
#publish-render-select {
  padding: .3rem .5rem; font-size: .85rem;
  background: var(--bg, #0c0e14); border: 1px solid var(--border, #2a2d3a);
  border-radius: 4px; color: inherit;
}

/* ── Oracle Agent Stepper ────────────────────────────── */
.oracle-stepper {
  display: flex; align-items: center; gap: 0; margin-bottom: 1.5rem;
  background: rgba(255,255,255,.03); border-radius: 10px; padding: .5rem;
}
.oracle-step {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem; cursor: pointer; border-radius: 8px;
  transition: background .2s; position: relative;
}
.oracle-step:hover { background: rgba(255,255,255,.06); }
.oracle-step.active { background: rgba(255,255,255,.08); }
.oracle-step-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.oracle-step.done .oracle-step-num { background: #22c55e; color: #fff; }
.oracle-step.current .oracle-step-num { background: var(--color-primary, #6366f1); color: #fff; animation: stepper-pulse 2s infinite; }
.oracle-step.pending .oracle-step-num { background: #2a2d3a; color: #555; }
.oracle-step-label { font-size: .85rem; font-weight: 600; }
.oracle-step.done .oracle-step-label { color: #22c55e; }
.oracle-step.current .oracle-step-label { color: var(--color-primary, #6366f1); }
.oracle-step.pending .oracle-step-label { color: #555; }
.oracle-step-arrow { color: #333; margin: 0 .15rem; font-size: 1.1rem; }
@keyframes stepper-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,.4); }
  50% { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
}

/* Agent panel below stepper */
.oracle-agent-panel {
  background: rgba(255,255,255,.03); border: 1px solid var(--border, #2a2d3a);
  border-radius: 8px; padding: 1.25rem; margin-bottom: 1.5rem;
}
.oracle-agent-panel .agent-prompt-box {
  background: #0a0c12; border: 1px solid #1e2030; border-radius: 6px;
  padding: 1rem; max-height: 400px; overflow-y: auto; position: relative;
  font-family: monospace; font-size: .78rem; white-space: pre-wrap; word-break: break-word;
  color: #aaa; margin-bottom: 1rem;
}
.oracle-agent-panel .agent-response-box {
  background: #0d1117; border: 1px solid #1a3a2a; border-radius: 6px;
  padding: 1rem; max-height: 300px; overflow-y: auto;
  font-family: monospace; font-size: .78rem; white-space: pre-wrap; word-break: break-word;
  color: #7ec; margin-bottom: 1rem;
}
.oracle-agent-panel .btn-copy-prompt {
  position: absolute; top: .5rem; right: .5rem; z-index: 1;
}
.raw-json-toggle {
  cursor: pointer; font-size: .82rem; color: #888; user-select: none;
  padding: .4rem 0; display: inline-flex; align-items: center; gap: .4rem;
}
.raw-json-toggle:hover { color: var(--color-primary, #6366f1); }
.raw-json-icon {
  font-family: monospace; font-weight: bold; font-size: .75rem;
  background: rgba(255,255,255,.06); border-radius: 3px; padding: .1rem .35rem;
}
