:root {
  --font-display: "Cinzel", "Palatino Linotype", serif;
  --bg: #08060a;
  --bg-elevated: #0e0a10;
  --panel: #151018;
  --border: #2d1f30;
  --border-bright: #4a3055;
  --text: #f3e8ef;
  --muted: #9a8798;
  --accent: #c94b7a;
  --accent-soft: rgba(201, 75, 122, 0.14);
  --accent-dim: #6a2348;
  --input-bg: #0f0a12;
  --focus: #e8bfd4;
  --moon: #d4a5c9;
  --blood: #8b1538;
  --shadow-glow: rgba(201, 75, 122, 0.22);
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgba(201, 75, 122, 0.35);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -25%, rgba(92, 26, 58, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(45, 20, 55, 0.4) 0%, transparent 45%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(30, 12, 35, 0.5) 0%, transparent 50%),
    linear-gradient(180deg, #0c080e 0%, var(--bg) 40%, #060408 100%);
  color: var(--text);
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18, 10, 22, 0.97) 0%, rgba(10, 6, 12, 0.92) 100%);
  box-shadow:
    0 1px 0 rgba(201, 75, 122, 0.12),
    0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px var(--shadow-glow));
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.88rem;
  color: var(--moon);
  text-shadow: 0 0 24px rgba(212, 165, 201, 0.35);
}

.brand-tagline {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: flex-end;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

.nav a:hover {
  color: var(--focus);
  text-shadow: 0 0 12px var(--shadow-glow);
}

.main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.panel {
  background: linear-gradient(145deg, rgba(21, 16, 24, 0.95) 0%, rgba(12, 8, 14, 0.98) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow:
    0 0 0 1px rgba(201, 75, 122, 0.06) inset,
    0 8px 32px rgba(0, 0, 0, 0.35);
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--moon);
  text-shadow: 0 2px 20px rgba(92, 26, 58, 0.5);
}

.lede {
  color: var(--muted);
  max-width: 52ch;
}

.muted {
  color: var(--muted);
  margin-top: 0.35rem;
}

.link-list {
  padding-left: 1.2rem;
}

.link-list a {
  color: var(--focus);
}

.tips h2 {
  margin-top: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.tips-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.tips-list li {
  margin-bottom: 0.35rem;
}

.dropzone {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  background: var(--input-bg);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone-active {
  border-color: var(--accent);
  background: rgba(201, 75, 122, 0.06);
}

.dropzone-busy {
  opacity: 0.85;
  pointer-events: none;
}

.import-video-section {
  margin-top: 0;
}

.import-video-section .import-tips {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.import-prompt-hint {
  margin: 0 0 0.25rem;
}

.import-video-section .import-image-preview-row,
.queue-add-panel .import-image-preview-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.import-video-section .import-thumb,
.queue-add-panel .import-thumb {
  width: auto;
  max-width: min(12rem, 100%);
  height: auto;
  max-height: 5rem;
  object-fit: contain;
  object-position: left center;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--border);
  background: var(--input-bg);
}

.import-video-section .source-select-preview,
.queue-add-panel .source-select-preview {
  margin-top: 0.35rem;
}

.path-b-toggle-section {
  margin-top: 1.5rem;
}

.path-b-toggle-btn {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

.path-b-toggle-hint {
  margin: 0.65rem 0 0;
}

.path-b-advanced-block {
  margin-top: 0;
}

.dropzone input[type="file"] {
  margin-top: 0.75rem;
  color: var(--muted);
}

.spinner-line::before {
  content: "";
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.5rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  color: #ff8a9a;
  margin-top: 0.75rem;
  font-size: 0.92rem;
}

.descriptor-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .descriptor-grid {
    grid-template-columns: 200px 1fr;
    align-items: start;
  }
}

.thumb-wrap {
  margin: 0;
}

.thumb {
  width: auto;
  max-width: min(200px, 100%);
  height: auto;
  max-height: min(50vh, 360px);
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  background: var(--input-bg);
}

.image-detail-panel .thumb,
.image-standalone .thumb {
  max-width: min(400px, 100%);
  max-height: min(72vh, 720px);
}

.detail-thumb-btn {
  display: block;
  width: 100%;
  margin: 0 0 0.35rem;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
}

.detail-thumb-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 10px;
}

.detail-thumb-btn .thumb-wrap {
  display: block;
  margin-bottom: 0.35rem;
}

.detail-thumb-hint {
  display: block;
  margin-top: 0.25rem;
}

.detail-fullsize-link-wrap {
  margin: 0.35rem 0 0.5rem;
}

a.link-fullsize {
  font-size: 0.82rem;
  color: var(--focus);
  text-decoration: none;
}

a.link-fullsize:hover {
  text-decoration: underline;
}

.image-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem 1rem;
  background: rgba(12, 10, 14, 0.92);
  cursor: zoom-out;
}

.image-lightbox-img {
  max-width: min(100%, 96vw);
  max-height: calc(96vh - 2rem);
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border);
}

.image-lightbox-close {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10001;
  cursor: pointer;
}

.fields-grid {
  display: grid;
  gap: 0.75rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.fields-grid .full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="number"],
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  text-transform: none;
  letter-spacing: normal;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.prompt-area {
  min-height: 140px;
  resize: vertical;
}

.prompt-components {
  margin-top: 1rem;
}

.sliders {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.sliders label {
  grid-column: 1;
}

.slider-val {
  font-variant-numeric: tabular-nums;
  color: var(--focus);
  min-width: 1.5rem;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  margin-top: 0.5rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(155deg, #d45a8a 0%, var(--accent) 40%, var(--accent-dim) 100%);
  border-color: var(--blood);
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(139, 21, 56, 0.35);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn.ghost:hover:not(:disabled) {
  border-color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: linear-gradient(145deg, #1a121f, #120c16);
  color: var(--text);
  border: 1px solid var(--border-bright);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--shadow-glow);
  max-width: min(420px, calc(100vw - 2rem));
  z-index: 50;
}

.section-title {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.table-lede {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.table-lede code {
  font-size: 0.85em;
  color: var(--focus);
}

.nav-cards .section-title {
  margin-bottom: 0.75rem;
}

.nav-card-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.nav-card {
  display: block;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}

.nav-card:hover {
  border-color: var(--focus);
  color: var(--focus);
}

.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1.25rem;
}

.stat-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--focus);
}

.stat-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.data-table thead th {
  background: var(--input-bg);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.prompt-cell {
  max-width: 280px;
}

.ellipsis {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-table .prompt-cell {
  max-width: 200px;
}

.small {
  font-size: 0.82rem;
}

.nowrap {
  white-space: nowrap;
}

.inline-link {
  color: var(--focus);
}

.review-progress {
  margin: 0 0 1rem;
  font-weight: 600;
}

.review-queue-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1rem;
}

.review-queue-nav .muted {
  margin: 0;
  flex: 1 1 12rem;
}

.empty-review h2 {
  margin-top: 0;
}

.review-split {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 1100px) {
  .review-split {
    display: grid;
    grid-template-columns: 1fr minmax(340px, 420px);
    align-items: start;
  }
}

.review-split-left {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.review-split-right {
  min-width: 0;
}

@media (min-width: 1100px) {
  .review-split-right {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

.review-rating-panel {
  padding: 1rem;
}

.review-rating-panel .section-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.review-rating-panel .rating-radio-groups {
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.review-rating-panel .rating-row-label {
  min-width: 7rem;
  font-size: 0.72rem;
}

.review-rating-panel .rating-radio-row {
  gap: 0.25rem 0.6rem;
}

.review-rating-panel .rating-toggle-row {
  gap: 0.25rem 0.6rem;
}

.review-rating-panel .sliders label {
  font-size: 0.82rem;
}

.review-rating-panel .composite-preview {
  margin: 0 0 0.4rem;
}

.review-rating-panel .review-sliders {
  margin-bottom: 0.6rem;
}

.review-rating-panel .actions {
  margin-top: 0.5rem;
}

.review-video-panel {
  padding: 0;
  overflow: hidden;
}

.review-video {
  display: block;
  width: 100%;
  max-height: min(70vh, 640px);
  background: #000;
}

.review-video-loop-row {
  margin: 0.65rem 0 0;
}

.review-video-loop {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.review-meta-grid {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.review-meta-grid .thumb-wrap {
  max-width: min(220px, 100%);
  justify-self: start;
}

.thumb.review-source-thumb {
  max-width: 100%;
  max-height: min(55vh, 420px);
}

@media (min-width: 720px) {
  .review-meta-grid {
    grid-template-columns: minmax(0, 220px) 1fr;
  }
}

.meta-heading {
  margin: 1rem 0 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.meta-heading:first-child {
  margin-top: 0;
}

.prompt-block {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 0.95rem;
}

.params-dl {
  margin: 0;
  display: grid;
  gap: 0.35rem 1rem;
}

.params-dl > div {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.params-dl dt {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.params-dl dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.review-structure-hint {
  margin: 1rem 0 0;
  max-width: 62ch;
  line-height: 1.45;
}

.review-sliders {
  margin-bottom: 1rem;
}

.rating-radio-groups {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.rating-radio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.rating-row-label {
  min-width: 11rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rating-radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}

.rating-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.rating-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-transform: none;
  letter-spacing: normal;
}

.rating-toggle-side {
  font-size: 0.9rem;
  color: var(--text);
  min-width: 1.75rem;
}

.rating-toggle-side.is-inactive {
  color: var(--muted);
  opacity: 0.55;
}

.rating-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.rating-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.rating-switch-track {
  display: block;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.15s ease;
  position: relative;
}

.rating-switch-track::after {
  content: "";
  position: absolute;
  width: 1.15rem;
  height: 1.15rem;
  left: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.rating-switch-input:checked + .rating-switch-track {
  background: var(--accent);
}

.rating-switch-input:checked + .rating-switch-track::after {
  transform: translate(1.2rem, -50%);
  background: var(--text);
}

.rating-switch-input:focus-visible + .rating-switch-track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.composite-preview {
  margin: 0 0 0.75rem;
}

.review-sliders .na-skip {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0 0.35rem;
}

.main.library-wide {
  max-width: min(1420px, 100%);
}

.library-page .page-head {
  margin-bottom: 1.25rem;
}

.prompts-add-form .fields-grid {
  margin-top: 0.75rem;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  color: var(--muted);
}

.sortable-th:hover {
  color: var(--focus);
}

.sort-ind {
  font-size: 0.65rem;
  margin-left: 0.25rem;
  opacity: 0.85;
}

.cell-edit {
  cursor: text;
  min-height: 1.25rem;
}

.cell-edit:hover {
  outline: 1px dashed var(--border);
  border-radius: 4px;
}

.cell-input {
  width: 100%;
  min-width: 120px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--focus);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
}

.cell-select {
  width: 100%;
  max-width: 140px;
}

.prompt-snippet {
  cursor: pointer;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-snippet:hover {
  color: var(--focus);
}

.active-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: normal;
}

.active-toggle input {
  accent-color: var(--accent);
}

.images-layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 960px) {
  .images-layout {
    grid-template-columns: 1fr minmax(300px, 400px);
  }
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
}

.image-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--input-bg);
  cursor: pointer;
  padding: 0;
  aspect-ratio: 1;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-tile:hover {
  border-color: var(--focus);
}

.image-tile.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 0 20px var(--shadow-glow);
}

.image-detail-panel {
  position: sticky;
  top: 4.5rem;
}

.experiment-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.experiment-mini-table th,
.experiment-mini-table td {
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.experiment-mini-table th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.experiment-mini-table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.experiment-mini-table .prompt-preview {
  max-width: 180px;
  white-space: pre-wrap;
  word-break: break-word;
}

.library-subhead {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.analytics-page .analytics-section {
  margin-bottom: 1.5rem;
}

.analytics-chart-grid.four {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.analytics-chart-grid.single-wide {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 900px) {
  .analytics-chart-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.analytics-chart-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}

.analytics-chart-title {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.analytics-chart-wrap {
  position: relative;
  height: 240px;
}

.analytics-chart-wrap-tall {
  height: 280px;
  margin-top: 0.75rem;
}

.analytics-empty {
  margin: 0.35rem 0 0;
}

.inline-code {
  font-size: 0.85em;
  background: var(--input-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.heatmap-scroll {
  overflow-x: auto;
  margin-top: 1rem;
}

.heatmap-table {
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 640px;
}

.heatmap-table th,
.heatmap-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  text-align: center;
  vertical-align: middle;
}

.heatmap-corner {
  text-align: left;
  min-width: 140px;
  background: var(--panel);
  color: var(--muted);
}

.heatmap-col-head {
  max-width: 120px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel);
  line-height: 1.25;
}

.heatmap-row-head {
  text-align: left;
  max-width: 220px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel);
  line-height: 1.25;
}

.heatmap-cell {
  min-width: 72px;
}

.heatmap-avg {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
}

.heatmap-n {
  display: block;
  font-size: 0.68rem;
  opacity: 0.85;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.favorite-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.favorite-card:hover {
  border-color: var(--focus);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.favorite-thumb {
  margin: 0;
  aspect-ratio: 1;
  background: var(--panel);
}

.favorite-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.favorite-prompt {
  margin: 0;
  padding: 0.65rem 0.75rem 0.35rem;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
}

.favorite-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0 0.75rem 0.75rem;
  font-size: 0.72rem;
}

.favorite-scores div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.favorite-scores dt {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.favorite-scores dd {
  margin: 0;
  font-weight: 600;
  color: var(--focus);
}

.favorite-scores-dense {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  font-size: 0.68rem;
}

.queue-table .queue-thumb-cell {
  width: 64px;
  vertical-align: middle;
}

.queue-inline-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.queue-table .prompt-cell {
  max-width: 36ch;
  display: inline-block;
  vertical-align: top;
}

.queue-run-actions {
  margin-top: 0.5rem;
}

[x-cloak] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.recommend-page .tab-bar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.recommend-page .tab-btn {
  font: inherit;
  cursor: pointer;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--muted);
}

.recommend-page .tab-btn:hover {
  color: var(--focus);
  border-color: var(--focus);
}

.recommend-page .tab-btn.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.recommend-source-toggle {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.recommend-thumb-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.recommend-thumb {
  width: min(200px, 100%);
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}

.recommend-subhead {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.descriptor-dl {
  margin: 0;
  display: grid;
  gap: 0.35rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  font-size: 0.88rem;
}

.descriptor-row dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.descriptor-row dd {
  margin: 0.15rem 0 0;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.recommend-actions {
  margin-top: 1.25rem;
  gap: 0.65rem;
}

.recommend-save-actions {
  align-self: center;
}

.recommend-traits-form {
  margin-top: 0.75rem;
}

.recommend-results {
  margin-top: 0.5rem;
}

.table-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.recommend-similar-table .num {
  font-variant-numeric: tabular-nums;
}

.btn.small {
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
}

.ai-prompt-copy-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ai-suggestion-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.markdown-body {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 1.1rem 0 0.5rem;
  font-size: 1.05rem;
  color: var(--focus);
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body p {
  margin: 0.5rem 0;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.5rem 0;
  padding-left: 1.35rem;
}

.markdown-body code {
  font-size: 0.88em;
  background: var(--input-bg);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
}

.markdown-body pre {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 0.86rem;
}

.markdown-body pre code {
  background: none;
  padding: 0;
}

.markdown-body blockquote {
  margin: 0.65rem 0;
  padding-left: 0.85rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

/* Archive viewer */
.archive-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 960px) {
  .archive-layout {
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  }
}

.archive-filter-grid {
  display: grid;
  gap: 0.85rem 1rem;
  margin-top: 0.75rem;
}

.archive-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.archive-filter-field.full {
  grid-column: 1 / -1;
}

.archive-filter-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.archive-checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.archive-multiselect {
  min-height: 6rem;
  max-height: 12rem;
  font-size: 0.85rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem;
}

.archive-filter-actions {
  margin-top: 1rem;
  flex-wrap: wrap;
}

.archive-player-panel .archive-empty-hint {
  margin: 0;
}

.archive-player-wrap {
  margin-top: 0.5rem;
}

.archive-now-playing {
  margin-top: 1rem;
}

.archive-now-thumb-row {
  display: grid;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 560px) {
  .archive-now-thumb-row {
    grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
  }
}

.archive-now-thumb {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.archive-now-id {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.archive-now-prompt {
  margin: 0 0 0.75rem;
  max-height: 8rem;
  overflow-y: auto;
}

.archive-mini-dl {
  font-size: 0.85rem;
}

.archive-transport {
  margin-top: 1rem;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.archive-loop {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

/* Queue page: preview + row actions */
.queue-preview-panel .queue-preview-empty {
  margin: 0.5rem 0 0;
}

.queue-preview-body {
  margin-top: 0.75rem;
}

.queue-preview-video-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.queue-preview-video {
  display: block;
  width: 100%;
  max-height: min(70vh, 640px);
}

.queue-preview-meta {
  margin: 0.75rem 0 0.35rem;
}

.queue-preview-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.queue-preview-loop {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.queue-actions-col {
  width: 1%;
  white-space: nowrap;
}

.queue-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.queue-row-previewing {
  box-shadow: inset 3px 0 0 var(--accent);
}

.btn.danger-text {
  color: var(--blood);
  border-color: rgba(139, 21, 56, 0.45);
}

.btn.danger-text:hover:not(:disabled) {
  background: rgba(139, 21, 56, 0.12);
  border-color: var(--blood);
}

@media (max-width: 540px) {
  .brand-tagline {
    display: none;
  }

  .nav {
    gap: 0.5rem 0.75rem;
  }
}

/* --- Auth landing (sign in / password reset) --- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-shell {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.auth-brand-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: var(--moon);
}

.auth-brand-tag {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-main {
  width: 100%;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.auth-heading {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  color: var(--moon);
  font-weight: 600;
}

.auth-lead {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

.auth-banner {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-banner--ok {
  background: rgba(46, 120, 80, 0.2);
  border: 1px solid rgba(100, 180, 130, 0.35);
  color: #c8e8d4;
}

.auth-banner--err {
  background: rgba(139, 21, 56, 0.15);
  border: 1px solid rgba(201, 75, 122, 0.35);
  color: #f0c4d4;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-top: 0.35rem;
}

.auth-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.auth-input:focus {
  outline: none;
  border-color: var(--border-bright);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.auth-submit {
  margin-top: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
  background: linear-gradient(180deg, var(--accent-dim), #3a1028);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.auth-submit:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 20px var(--shadow-glow);
}

.auth-footer-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
}

.auth-footer-links a {
  color: var(--accent);
  text-decoration: none;
}

.auth-footer-links a:hover {
  text-decoration: underline;
}

.auth-code {
  display: block;
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  color: var(--moon);
}

.auth-inline-code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  color: var(--moon);
}

.auth-muted {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.nav a.nav-logout {
  color: var(--accent);
}
