/* Orion: the Morpheus console palette (morpheus-backend admin.css, dark),
   with the night-sky player look of the Morpheus desktop app. */
:root {
  color-scheme: dark;
  --background: #0c0f10;
  --foreground: #e8eceb;
  --card: #141919;
  --muted: #202627;
  --muted-foreground: #a3adab;
  --faint: #7d8886;
  --soft: #c9d1cf;
  --primary: #06e0a9;
  --primary-foreground: #0b1316;
  --accent: rgba(6, 224, 169, 0.13);
  --accent-foreground: #70ebcc;
  --warning: #f7ae31;
  --warning-foreground: #f7c66e;
  --destructive: #ff8a8a;
  --border: rgba(128, 178, 166, 0.16);
  --border-strong: rgba(128, 178, 166, 0.3);
  --radius: 10px;
  --font-sans: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  font: 15px/1.5 var(--font-sans);
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-foreground); text-decoration: none; }
a:hover { color: #a8f5e1; }

h1 { margin: 0; font-size: 28px; font-weight: 700; }
h2 { margin: 0; }
p { margin: 0; }

.muted { color: var(--muted-foreground); }
.fine { font-size: 13px; color: var(--faint); }
.error { color: var(--destructive); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --- buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--foreground);
  background: transparent;
}
.btn-primary { background: var(--primary); color: var(--primary-foreground); font-weight: 700; }
.btn-primary:hover { background: #3debc0; color: var(--primary-foreground); }
.btn-secondary { background: var(--muted); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-ghost { color: var(--soft); }
.btn-ghost:hover { background: var(--muted); }
.btn-small { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* --- top bar --- */

.top { border-bottom: 1px solid var(--border); background: rgba(20, 25, 25, 0.85); }
.top-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--foreground);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
}
.brand:hover { color: var(--foreground); }
.nav { display: flex; gap: 6px; flex: 1 1 auto; }
.nav a {
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: 14px;
}
.nav a.is-active { background: var(--accent); color: var(--accent-foreground); }

.user-menu { position: relative; }
.user-menu summary {
  list-style: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-panel {
  position: absolute;
  right: 0;
  top: 52px;
  z-index: 10;
  min-width: 240px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  box-shadow: 0 20px 45px -18px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-menu-name { font-weight: 600; }
.user-menu-email { font-size: 13px; color: var(--muted-foreground); margin-bottom: 8px; }

/* --- page layouts --- */

.page { max-width: 1440px; margin: 0 auto; padding: 32px 32px 64px; }
.page-narrow { max-width: 1040px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-direction: column; gap: 4px; }

.auth {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 25, 25, 0.9);
  box-shadow: 0 20px 45px -18px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 30px; letter-spacing: 0.02em; }
.auth-dev { width: 100%; }

/* --- upload --- */

.dropzone {
  border: 2px dashed rgba(6, 224, 169, 0.45);
  border-radius: 16px;
  background: rgba(6, 224, 169, 0.05);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  color: var(--primary);
  transition: background 0.15s, border-color 0.15s;
}
.dropzone.is-over { background: rgba(6, 224, 169, 0.12); border-color: var(--primary); }
.dropzone-title { font-size: 18px; font-weight: 600; color: var(--foreground); }
.dropzone-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.batches { display: flex; flex-direction: column; gap: 24px; }
.batch { border: 1px solid var(--border); border-radius: 16px; background: var(--card); overflow: hidden; }
.batch-head { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--border); }
.batch-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.batch-title { font-size: 17px; font-weight: 700; }
.batch-title span { font-weight: 500; color: var(--muted-foreground); }
.batch-bytes { font-size: 14px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.batch-counts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--soft); }
.batch-counts strong { color: var(--foreground); }
.batch-counts .count-done strong { color: var(--accent-foreground); }
.batch-counts .count-failed strong { color: var(--destructive); }
.batch-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.progress { height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: var(--primary); transition: width 0.2s; }
.batch.is-paused .progress-bar { background: var(--faint); }

.batch-files { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; }
.file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(128, 178, 166, 0.1);
}
.file:last-child { border-bottom: 0; }
.file-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #4a5452; }
.file-name { flex: 1 1 260px; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { width: 76px; text-align: right; font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.file-state { flex: 0 1 300px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.file-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.file-bar span { display: block; height: 100%; width: 0; background: var(--primary); }
.file-label { white-space: nowrap; }

.file[data-state="done"] .file-dot { background: var(--primary); }
.file[data-state="done"] .file-label { color: var(--accent-foreground); }
.file[data-state="duplicate"] .file-dot,
.file[data-state="waiting"] .file-dot { background: #4a5452; }
.file[data-state="duplicate"] .file-label,
.file[data-state="waiting"] .file-label { color: var(--faint); }
.file[data-state="checking"] .file-dot,
.file[data-state="uploading"] .file-dot { background: var(--foreground); }
.file[data-state="failed"] .file-dot { background: var(--destructive); }
.file[data-state="failed"] .file-label { color: var(--destructive); white-space: normal; }

/* --- shared pieces --- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.input {
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  min-width: 0;
}
.input:focus { border-color: var(--primary); outline: none; }
.input::placeholder { color: var(--faint); }
select.input { padding-right: 10px; }

.btn-danger { border-color: rgba(255, 138, 138, 0.4); color: var(--destructive); }
.btn-danger:hover { background: rgba(255, 138, 138, 0.1); }

.flash {
  max-width: 1440px;
  margin: 0 auto 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 600;
}

.back-link { display: inline-block; font-size: 14px; font-weight: 600; margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--muted);
  font-size: 12px;
  color: var(--soft);
}
.chip-warning { background: transparent; border: 1px dashed rgba(247, 174, 49, 0.5); color: var(--warning-foreground); }
.chip-removable { gap: 2px; height: 32px; padding: 0 4px 0 12px; font-size: 13px; color: var(--foreground); }
.chip-removable button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.chip-removable button:hover { background: rgba(255, 255, 255, 0.08); color: var(--foreground); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span, .pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pill-link span { color: var(--faint); }
.pill input:checked + span, .pill-link.is-on {
  border-color: var(--primary);
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 600;
}
.pill-link.is-on span { color: var(--accent-foreground); }
.pill input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.pill-link:hover, .pill span:hover { border-color: var(--border-strong); color: var(--foreground); }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.empty {
  padding: 64px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  text-align: center;
  color: var(--muted-foreground);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.empty-title { font-size: 16px; font-weight: 600; color: var(--foreground); }

/* --- top bar tools on the library --- */

.top-inner .nav { flex: 0 1 auto; }
.top-search { flex: 1 1 320px; min-width: 0; position: relative; color: var(--faint); }
.top-search svg { position: absolute; left: 14px; top: 13px; }
.top-search .input { width: 100%; padding-left: 42px; }
.top-inner:not(:has(.top-search)) .nav { flex: 1 1 auto; }

/* --- library --- */

.library-layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.filters { flex: 1 1 240px; max-width: 280px; }
.filters form { display: flex; flex-direction: column; gap: 26px; }
.filter { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.filter-title {
  margin: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.filter-range { display: flex; align-items: center; gap: 8px; }
.filter-range .input { width: 0; flex: 1; height: 40px; }
.filter-warning {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(247, 174, 49, 0.35);
  background: rgba(247, 174, 49, 0.08);
  gap: 8px;
}
.filter-warning .check { font-weight: 600; color: var(--warning-foreground); }
.filter-warning .check input { accent-color: var(--warning); }
.filter-warning p { font-size: 13px; color: #c9b48c; }

.results { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.results-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.results-head > p { margin-right: 4px; font-size: 14px; }
.results-count { color: var(--foreground); }
.results-clear { font-size: 14px; font-weight: 600; }
.results-sort { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted-foreground); }
.results-sort .input { height: 40px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.card-link { display: flex; flex-direction: column; height: 100%; color: var(--foreground); }
.card-link:hover { color: var(--foreground); }

/* Select box and edit button sit on the thumbnail; they show on hover, focus or while selecting. */
.card-select, .card-edit {
  position: absolute;
  top: 8px;
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.card-select { left: 8px; }
.card-edit { right: 8px; padding: 0; }
.card-select input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.card:hover .card-select, .card:hover .card-edit,
.card-select:focus-within, .card-edit:focus-visible,
.grid.is-selecting .card-select, .card.is-selected .card-select { opacity: 1; }
.card-edit:hover { background: var(--muted); }
@media (hover: none) { .card-select, .card-edit { opacity: 1; } }

/* --- editing several scenes --- */

.bulk-bar {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(1100px, calc(100% - 32px));
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: rgba(20, 25, 25, 0.97);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bulk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.bulk-count { margin-right: auto; font-size: 15px; }
.bulk-add .tag-editor { flex: 1 1 320px; gap: 6px; }
.bulk-add .tag-editor-chips { min-height: 0; }
.tag-menu-up { top: auto; bottom: 50px; }
body.has-bulk-bar main { padding-bottom: 240px; }

.quick-edit {
  width: min(520px, calc(100% - 32px));
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
.quick-edit::backdrop { background: rgba(0, 0, 0, 0.6); }
.quick-edit-form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
.quick-edit-head { display: flex; align-items: center; justify-content: space-between; }
.quick-edit-head h2 { font-size: 18px; }
.quick-edit-head .player-button { font-size: 22px; }
.quick-edit-thumb { border-radius: 10px; overflow: hidden; }
.quick-edit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.quick-edit-actions .btn-ghost { margin-right: auto; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.card-meta { font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: radial-gradient(ellipse at 50% 120%, #10201c 0%, #05080c 65%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(232, 236, 235, 0.25);
}
.thumb-mark svg { display: block; }
.thumb-badge {
  position: absolute;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(5, 8, 12, 0.8);
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.thumb-badge-right { right: 8px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 8px; font-size: 14px; }

/* --- scene page and processing --- */

.scene-layout { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.player-panel { flex: 999 1 640px; min-width: 0; }
.player-info {
  position: absolute;
  left: 14px;
  top: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.7);
  font-size: 12px;
  font-weight: 600;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}

.scene-side { flex: 1 1 340px; max-width: 440px; display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.input-title { height: 48px; font-size: 20px; font-weight: 700; }

.tag-editor { display: flex; flex-direction: column; gap: 10px; }
.tag-editor-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }
.tag-editor-field { position: relative; }
.tag-editor-field .input { width: 100%; }
.tag-menu {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 50px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  box-shadow: 0 20px 45px -18px rgba(0, 0, 0, 0.6);
}
.tag-option {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}
.tag-option.is-active, .tag-option:hover { background: var(--muted); }
.tag-option-new { color: var(--accent-foreground); font-weight: 600; }
.tag-option-meta { font-size: 12px; color: var(--faint); white-space: nowrap; }

.suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.suggest strong { color: var(--foreground); }

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 18px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.facts dt { color: var(--muted-foreground); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts-mono { font-family: var(--font-mono); font-size: 13px; color: var(--soft); }
.facts-path { font-size: 13px; color: var(--soft); }

.scene-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.scene-danger {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.save-status { min-height: 20px; }

.process-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.process-title h1 { font-size: 26px; }
.process-title .back-link { margin-bottom: 2px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; max-width: 640px; }
.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.step.is-tagged { background: var(--accent); color: var(--accent-foreground); border-color: transparent; }
.step.is-current { border-color: var(--primary); color: var(--foreground); outline: 2px solid var(--primary); outline-offset: 1px; }
.process-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.process-save { flex: 1 1 auto; }

/* --- player --- */

.player-panel { display: flex; flex-direction: column; gap: 18px; }
.player {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #05080c;
  outline: none;
}
.player-stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player-stage:fullscreen { aspect-ratio: auto; }
.player-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.player-canvas.is-dragging { cursor: grabbing; }
.player-hint {
  position: absolute;
  right: 14px;
  top: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.7);
  font-size: 12px;
  color: var(--muted-foreground);
  pointer-events: none;
}
.player-info { pointer-events: none; }
.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 120%, #10201c 0%, #05080c 65%);
  color: var(--muted-foreground);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.player-loading.is-error { color: var(--destructive); }
.player-capture { position: absolute; right: 14px; bottom: 14px; }
.player-controls {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 14px 10px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.player-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.player-spacer { flex: 1 1 auto; }

/* Timeline: a tall hit area around a thin track, like a video player. */
.timeline {
  --progress: 0%;
  position: relative;
  height: 28px;
  cursor: pointer;
  touch-action: none;
  outline: none;
  user-select: none;
}
.timeline-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 999px;
  background: rgba(232, 236, 235, 0.16);
  overflow: hidden;
  transition: height 0.12s, margin-top 0.12s;
}
.timeline:hover .timeline-track, .timeline.is-scrubbing .timeline-track, .timeline:focus-visible .timeline-track {
  height: 6px;
  margin-top: -3px;
}
.timeline-fill { width: var(--progress); height: 100%; background: var(--primary); }
.timeline-knob {
  position: absolute;
  top: 50%;
  left: var(--progress);
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--foreground);
  box-shadow: 0 0 0 4px rgba(6, 224, 169, 0.25);
  transform: scale(0.85);
  transition: transform 0.12s;
}
.timeline:hover .timeline-knob, .timeline.is-scrubbing .timeline-knob { transform: scale(1.1); }
.timeline:focus-visible .timeline-knob { box-shadow: 0 0 0 3px var(--primary); }
.timeline-markers { position: absolute; inset: 0; pointer-events: none; }
.timeline-marker {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 12px;
  margin: -6px 0 0 -1px;
  border-radius: 1px;
  background: var(--accent-foreground);
  opacity: 0.8;
}
.timeline-tip {
  position: absolute;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(5, 8, 12, 0.9);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: nowrap;
}
.player-controls.is-disabled { opacity: 0.5; pointer-events: none; }
.player-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.player-button:hover { background: var(--muted); color: var(--foreground); }
.player-play { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); }
.player-play:hover { background: #3debc0; color: var(--primary-foreground); }
.player-play .icon-pause, .player-play.is-playing .icon-play { display: none; }
.player-play.is-playing .icon-pause { display: block; }
.player-time { font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.player-frame { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 72px; }

.thumb-picker { display: flex; flex-direction: column; gap: 10px; }
.thumb-picker-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.thumb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.thumb-tile {
  padding: 6px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.thumb-tile:hover { border-color: var(--border-strong); }
.thumb-tile.is-selected { border-color: var(--primary); background: rgba(6, 224, 169, 0.1); }
.thumb-tile img, .thumb-tile-pending { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: 8px; background: #05080c; }
.thumb-tile-caption { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 2px 0; font-size: 13px; font-weight: 600; }
.thumb-tile-badge { font-size: 12px; font-weight: 500; color: var(--faint); }
.thumb-tile-badge.is-on { padding: 1px 8px; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); font-size: 11px; font-weight: 700; }

.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-badge-left { left: 8px; }
.thumb-badge-motion { color: var(--accent-foreground); }
.thumb-badge-muted { color: var(--muted-foreground); }
.thumb-badge-error { color: var(--destructive); }

.notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--muted);
  font-size: 14px;
  color: var(--soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.notice-error { background: rgba(255, 138, 138, 0.08); border: 1px solid rgba(255, 138, 138, 0.3); }

/* --- curation --- */

.inv-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.inv-stat {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.inv-stat strong { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-stat span { font-size: 14px; color: var(--soft); }
.inv-stat small { font-size: 12px; color: var(--faint); }

.curate, .curate-group { display: flex; flex-direction: column; gap: 20px; }
.curate-head, .curate-group-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.curate-group-head h1 { font-size: 24px; }
.curate-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.curate-list li + li { border-top: 1px solid rgba(128, 178, 166, 0.1); }
.curate-row { display: flex; align-items: center; gap: 16px; padding: 10px 16px; color: var(--foreground); }
.curate-row:hover { background: var(--muted); color: var(--foreground); }
.curate-row-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.curate-thumbs { display: flex; gap: 4px; flex: none; }
.curate-thumb {
  width: 72px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #05080c;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(232, 236, 235, 0.3);
  flex: none;
}
.curate-thumb img { width: 100%; height: 100%; object-fit: cover; }

.curate-sync {
  flex: 1 1 520px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
}
.curate-timeline { flex: 1 1 auto; }
.curate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.candidate {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  overflow: hidden;
}
.candidate .player { border: 0; border-radius: 0; }
.candidate.is-kept { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.candidate.is-reference { border-style: dashed; }
.candidate-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.candidate-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 600; overflow-wrap: anywhere; }
.candidate-title a { color: var(--foreground); }
.candidate-title a:hover { color: var(--accent-foreground); }
.candidate-number {
  min-width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.curate-paths { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--faint); display: flex; flex-direction: column; gap: 2px; }
.curate-paths li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.facts-compact { gap: 4px 14px; font-size: 13px; }
.candidate-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: auto; }
.keep {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.keep input { width: 18px; height: 18px; accent-color: var(--primary); }
.candidate.is-kept .keep { border-color: var(--primary); background: var(--accent); color: var(--accent-foreground); }
.curate-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0;
  background: linear-gradient(to top, var(--background) 70%, transparent);
}
.curate-actions .save-status { margin-right: auto; }
.curate-keys { text-align: right; }

.destination { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.destination legend { margin-bottom: 8px; }
.destination-option {
  flex: 1 1 280px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
}
.destination-option input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); }
.destination-option > span { display: flex; flex-direction: column; gap: 2px; }
.destination-option:has(input:checked) { border-color: var(--primary); background: rgba(6, 224, 169, 0.06); }

.notice-row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- versions and appearances on the scene page --- */

.related { display: flex; flex-direction: column; gap: 10px; }
.related-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.related-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.related-list li + li { border-top: 1px solid rgba(128, 178, 166, 0.1); }
.related-item { display: flex; align-items: center; gap: 14px; padding: 8px 14px; color: var(--foreground); }
.related-item:hover { background: var(--muted); color: var(--foreground); }
.related-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.candidate-inside a { font-weight: 600; }

/* --- type, categories, rating, hidden --- */

.field-row { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.field-row .field { flex: 1 1 160px; }
.stars { display: inline-flex; gap: 2px; }
.star {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4a5452;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.star.is-on { color: var(--warning); }
.star:hover { background: var(--muted); }
.stars:hover .star { color: #4a5452; }
.stars:hover .star:hover, .stars .star:has(~ .star:hover) { color: var(--warning-foreground); }
.stars-static { color: #4a5452; letter-spacing: 1px; font-size: 13px; }
.stars-static .is-on { color: var(--warning); }
.card-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted-foreground); }
.card-badges > span:not(.stars-static) { padding: 1px 7px; border-radius: 6px; background: var(--muted); }
.badge-hidden { color: var(--warning-foreground); }
.card-badges > .badge-status { background: var(--accent); color: var(--accent-foreground); }
.card-filename { font-size: 14px; overflow-wrap: anywhere; }
.card-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.related-row { display: flex; align-items: center; gap: 8px; padding-right: 10px; }
.related-row .related-item { flex: 1 1 auto; min-width: 0; }

/* --- curate grid and compare --- */

.curate-search { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 1 560px; }
.curate-search .input[type=search] { flex: 1 1 240px; }
.pills-gap { flex: 0 0 16px; }
.suggestions { display: flex; flex-direction: column; gap: 8px; }
.suggestion-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
}
.suggestion:hover { border-color: var(--primary); color: var(--foreground); }
.suggestion-text { display: flex; flex-direction: column; min-width: 0; }
.suggestion .curate-thumb { width: 56px; }
.candidate.is-main { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.candidate.is-left-out { opacity: 0.55; }
.candidate.is-main .keep { border-color: var(--primary); background: var(--accent); color: var(--accent-foreground); }
.candidate-rating { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bundle-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
}
.bundle-settings .field { flex: 1 1 260px; }

/* --- upload: links into the library --- */

.file-open { font-size: 13px; font-weight: 600; }
.recent { display: flex; flex-direction: column; gap: 10px; }
.recent-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.recent-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(128, 178, 166, 0.1);
}
.recent-item:last-child { border-bottom: 0; }
.recent-name { font-weight: 600; }
.recent-actions { margin-left: auto; display: flex; gap: 8px; }

@media (max-width: 640px) {
  .top-inner, .page { padding-left: 16px; padding-right: 16px; }
  .file { padding: 12px 16px; }
  .file-state { flex-basis: 100%; }
  .filters { max-width: none; }
  .results-sort { margin-left: 0; }
  .top-upload { display: none; }
}
