:root {
  --bg: #0b0d12;
  --panel: #141824;
  --text: #eef2ff;
  --muted: #9aa4bf;
  --accent: #6ea8ff;
  --border: #273044;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.container { max-width: 1080px; margin: 0 auto; padding: 1.25rem; }
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; }
.nav { display: flex; gap: 1rem; align-items: center; }
.nav a, .link-button { color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
.hero { padding: 2rem 0; }
.hero-actions { display: flex; gap: .75rem; margin-top: 1rem; }
.btn {
  display: inline-block; padding: .6rem 1rem; border-radius: .5rem;
  border: 1px solid var(--border); color: var(--text); background: var(--panel); text-decoration: none;
}
.btn.primary { background: var(--accent); color: #08111f; border-color: transparent; font-weight: 600; }
.form-grid { display: grid; gap: .75rem; max-width: 720px; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: .55rem .65rem; border-radius: .45rem; border: 1px solid var(--border);
  background: var(--panel); color: var(--text);
}
.muted { color: var(--muted); }
.error { color: #ff8a8a; }
.gallery-filter { display: flex; gap: .5rem; flex-wrap: wrap; }
.gallery-filter .btn.primary { pointer-events: none; }
.gallery-no-video {
  width: 100%; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px dashed var(--border); border-radius: .4rem; font-size: .9rem;
}
.gallery-prompt { margin: .5rem 0; line-height: 1.45; }
.gallery-prompt-text {
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}
.gallery-prompt-dots { color: var(--muted); white-space: nowrap; }
.gallery-error { font-size: .85rem; margin: .35rem 0; }
.gallery-card-failed { border-color: rgba(255,138,138,.35); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.gallery-card { background: var(--panel); border: 1px solid var(--border); border-radius: .6rem; padding: .75rem; }
.gallery-card a,
.pager a {
  color: var(--accent);
  text-decoration: none;
}
.gallery-card a:hover,
.pager a:hover { text-decoration: underline; }
.skeleton { background: linear-gradient(90deg, #1a2130, #222a3d, #1a2130); animation: pulse 1.2s infinite; border-radius: .4rem; }
@keyframes pulse { 0%,100%{opacity:.7} 50%{opacity:1} }
.pager { display: flex; gap: 1rem; margin-top: 1rem; }
.pack-grid { display: flex; gap: .75rem; flex-wrap: wrap; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .95rem; }
.admin-table th, .admin-table td { border: 1px solid var(--border); padding: .5rem .65rem; text-align: left; vertical-align: top; }
.admin-table th { background: var(--panel); }
.row-actions { display: flex; gap: .75rem; align-items: center; }
.success { color: #7dffb0; }
.admin-subnav { display: flex; gap: 1rem; margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.admin-subnav a { color: var(--muted); text-decoration: none; }
.admin-subnav a.active { color: var(--accent); font-weight: 600; }
.admin-search { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; max-width: 480px; }
.admin-search input { flex: 1; min-width: 180px; padding: .5rem .65rem; border-radius: .45rem; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-panel { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: .6rem; padding: 1.25rem; width: min(420px, 92vw); display: grid; gap: .5rem; }
.modal-panel input { padding: .5rem .65rem; border-radius: .45rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }
.hidden { display: none !important; }

.gen-pipeline {
  list-style: none;
  margin: 1.25rem 0 .75rem;
  padding: 0;
  display: grid;
  gap: .65rem;
  max-width: 420px;
}
.gen-pipeline li {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--muted);
  font-size: .95rem;
  transition: color .25s ease;
}
.gen-step-marker {
  flex-shrink: 0;
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--panel);
}
.gen-pipeline li.done {
  color: var(--text);
}
.gen-pipeline li.done .gen-step-marker {
  border-color: #7dffb0;
  background: #7dffb0;
}
.gen-pipeline li.active {
  color: var(--accent);
  font-weight: 600;
}
.gen-pipeline li.active .gen-step-marker {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 168, 255, .25);
  animation: gen-step-pulse 1.4s ease-in-out infinite;
}
.gen-pipeline li.pending .gen-step-marker {
  opacity: .6;
}
@keyframes gen-step-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: .85; }
}
.gen-elapsed { margin: 0 0 .35rem; }
.gen-activity {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .35rem;
  color: var(--text);
  font-size: .95rem;
}
.gen-pulse {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: gen-step-pulse 1s ease-in-out infinite;
}
.gen-hint { font-size: .85rem; margin-top: .5rem; max-width: 520px; }

/* Movie mode */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .25rem; }
.movie-form textarea { font-family: inherit; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.movie-list { display: grid; gap: .6rem; }
.movie-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--panel); border: 1px solid var(--border); border-radius: .6rem; padding: .85rem 1rem;
  color: var(--text); text-decoration: none;
}
.movie-row:hover { border-color: var(--accent); }
.movie-row-status { display: flex; gap: .5rem; flex-wrap: wrap; }
.badge {
  display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--bg); white-space: nowrap;
}
.badge.ok { color: #7dffb0; border-color: rgba(125,255,176,.4); }
.badge.bad { color: #ff8a8a; border-color: rgba(255,138,138,.4); }
.style-bible { background: var(--panel); border-left: 3px solid var(--accent); padding: .6rem .85rem; border-radius: .4rem; }
.final-cut { margin: 1rem 0; }
.scene { margin: 1.75rem 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.scene-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.scene-head h2 { margin: 0 0 .2rem; font-size: 1.2rem; }
.scene-activity { display: inline-flex; margin-left: .75rem; font-size: .9rem; }
.script-text pre { white-space: pre-wrap; font-family: inherit; color: var(--muted); font-size: .9rem; margin: .4rem 0 0; }
.scene-cut { margin: .75rem 0; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-top: 1rem; }
.shot-card { background: var(--panel); border: 1px solid var(--border); border-radius: .6rem; padding: .75rem; display: grid; gap: .5rem; align-content: start; }
.shot-card[data-status="Completed"] { border-color: rgba(125,255,176,.35); }
.shot-card[data-status="Failed"], .shot-card[data-status="Refunded"] { border-color: rgba(255,138,138,.4); }
.shot-head { display: flex; justify-content: space-between; align-items: center; }
.shot-media video, .shot-skeleton, .shot-placeholder { width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: .4rem; display: flex; align-items: center; justify-content: center; }
.shot-placeholder { background: var(--bg); border: 1px dashed var(--border); font-size: .9rem; }
.shot-skeleton { color: var(--muted); font-size: .9rem; }
.shot-edit { display: grid; gap: .4rem; }
.shot-edit textarea { width: 100%; padding: .5rem .6rem; border-radius: .45rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: inherit; font-size: .9rem; }
.shot-edit-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .9rem; }
.shot-edit-row input { width: 4.5rem; padding: .3rem .4rem; border-radius: .4rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.shot-actions { font-size: .9rem; }
.shot-actions button[disabled] { opacity: .4; cursor: default; }
.shot-add { border-style: dashed; }
.shot-error, .shot-note { margin: 0; font-size: .85rem; }
.btn[disabled] { opacity: .45; cursor: default; }
