/* Reference-to-video only. Measured against the live SeaVid upload workflow. */
.reference-workbench .reference-materials { display: grid; gap: 12px; }
.reference-material-preview { position: relative; height: 208px; overflow: hidden; border-radius: 22px; background: radial-gradient(circle at top,rgba(255,255,255,.06),transparent 55%),linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,.02)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.reference-material-preview > img, .reference-material-preview > video { width: 100%; height: 100%; object-fit: contain; display: block; }
.reference-material-preview > audio { position: absolute; width: calc(100% - 32px); left: 16px; top: calc(50% - 24px); }
.reference-file-card { height: 100%; max-width: 260px; margin: auto; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.reference-file-icon { display: grid; place-items: center; width: 64px; height: 64px; flex-shrink: 0; margin-bottom: 16px; border: 1px solid #2e2d26; border-radius: 50%; background: #11100bd9; color: #c9c7c1; box-shadow: 0 1px 2px #0002; }
.reference-file-icon svg { width: 24px; height: 24px; }
.reference-file-card > strong { max-width: 100%; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
.reference-file-card > small { margin-top: 4px; color: #c9c7c1; font-size: 12px; line-height: 16px; }
.reference-audio-wave-shell { margin-top: 16px; width: min(100%,200px); padding: 12px; border: 1px solid #2e2d26b3; border-radius: 999px; background: #11100bb3; }
.reference-audio-wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 36px; width: 100%; }
.reference-audio-wave span { display: block; flex: 0 0 6px; width: 6px; border-radius: 999px; background: #f5f4efb3; }
.reference-material-thumb .reference-audio-wave { height: 100%; padding-inline: 20px; }
.reference-material-thumb .reference-audio-wave span { flex: 0 1 6px; min-width: 1px; }
.reference-material-badges { position: absolute; top: 8px; left: 8px; z-index: 1; display: flex; align-items: center; gap: 8px; }
.reference-material-badge { padding: 2px 8px; border-radius: 6px; background: #11100b; font-size: 11px; font-weight: 600; line-height: 20px; }
.reference-material-type { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: #11100b; color: #c9c7c1; }
.reference-material-type svg { width: 14px; height: 14px; }
.reference-material-dot { width: 10px; height: 10px; border-radius: 50%; background: #c9c7c166; }
.reference-empty-grid { height: 100%; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 16px; }
.reference-empty-grid > button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; border: 1px solid #2e2d26; border-radius: 6px; background: #11100bb3; cursor: pointer; }
.reference-empty-grid > button:hover { background: #29282180; }
.reference-empty-grid > button > span { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #2e2d26; border-radius: 6px; background: #11100b; color: #c9c7c1; }
.reference-empty-grid svg { width: 16px; height: 16px; }
.reference-empty-grid strong { font-size: 14px; font-weight: 500; }
.reference-material-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.reference-material-kinds { display: flex; gap: 8px; }
.reference-material-kinds > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }
.reference-material-kinds svg { width: 14px; height: 14px; }
.reference-kind-image { background: #0ea5e929; color: #bae6fd; }
.reference-kind-video { background: #10b98129; color: #a7f3d0; }
.reference-kind-audio { background: #f59e0b29; color: #fde68a; }
.reference-material-count { padding: 4px 12px; border-radius: 999px; white-space: nowrap; font-size: 12px; line-height: 16px; color: #c9c7c1; background: #ffffff0d; box-shadow: inset 0 0 0 1px #ffffff12; }
.reference-material-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 2px 2px; }
.reference-material-thumb { display: flex; flex-direction: column; flex: 0 0 92px; width: 92px; padding: 8px; border: 1px solid #2e2d26; border-radius: 8px; background: #11100b; text-align: left; cursor: pointer; }
.reference-material-thumb.active { border-color: #f4f4ec80; box-shadow: 0 0 0 2px #f4f4ec26; }
.reference-material-thumb > span { display: flex; align-items: center; justify-content: space-between; gap: 3px; margin-bottom: 8px; }
.reference-material-thumb b { padding: 2px 8px; border-radius: 6px; background: #ffffff08; font-size: 10px; line-height: 16px; font-weight: 600; white-space: nowrap; }
.reference-material-thumb i { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; border-radius: 6px; background: #ffffff08; color: #c9c7c1; }
.reference-material-thumb svg { width: 12px; height: 12px; }
.reference-material-thumb > div { display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden; border: 1px solid #2e2d26; border-radius: 8px; background: #ffffff08; }
.reference-material-thumb img, .reference-material-thumb video { width: 100%; height: 100%; object-fit: cover; }
.reference-material-thumb > div > svg { width: 24px; height: 24px; }
.reference-material-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; }
.reference-material-tools > div { display: flex; gap: 4px; }
.reference-material-tools button { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 6px; font-size: 18px; background: transparent; color: #c9c7c1; cursor: pointer; }
.reference-material-tools > div:first-child button { border: 1px solid #3b3a31; background: #ffffff06; }
.reference-material-tools svg { width: 16px; height: 16px; }
.reference-material-tools button:hover { background: #ffffff0d; }
.reference-material-tools button:disabled { opacity: .5; pointer-events: none; }
.reference-material-tools button[data-action="remove-upload"] { color: #ef4444; }
.reference-tooltip { position: fixed; z-index: 1100; pointer-events: none; max-width: calc(100vw - 16px); padding: 6px 12px; border-radius: 6px; background: #f5f4ef; color: #11100b; box-shadow: 0 2px 8px #0004; font-size: 12px; line-height: 16px; font-weight: 400; }
.reference-tooltip::after { content: ""; position: absolute; left: var(--reference-arrow-x); bottom: -5px; width: 10px; height: 10px; border-radius: 2px; background: #f5f4ef; transform: translateX(-50%) rotate(45deg); }
.reference-tooltip[data-side="bottom"]::after { top: -5px; bottom: auto; }
.reference-tooltip-rich { width: 380px; padding: 8px 12px; border: 1px solid #333337; background: #19191c; color: #dedee0; font-size: 13px; line-height: 18px; box-shadow: 0 4px 10px #0003; }
.reference-tooltip-rich strong { display: block; font-size: 14px; line-height: 20px; font-weight: 500; }
.reference-tooltip-rich p { margin: 6px 0 0; font-size: 13px; font-weight: 500; }
.reference-tooltip-rich .reference-tooltip-muted { color: #b8b8bb; }
.reference-prompt-mention { margin-left: auto; padding: 0; font-size: 18px; background: transparent; color: #c9c7c1; cursor: pointer; }
.reference-mention-menu { position: absolute; z-index: 8; right: 8px; top: 12px; min-width: 110px; padding: 4px; border: 1px solid #3b3a31; border-radius: 8px; background: #181710; box-shadow: 0 8px 24px #0006; }
.reference-mention-menu[hidden], .reference-inputs[hidden] { display: none; }
.reference-mention-menu button { display: block; width: 100%; padding: 8px; background: transparent; text-align: left; cursor: pointer; }
.reference-mention-menu button:hover { background: #ffffff0d; }
.measured-workbench .control-panel { --tool-control-inset: 20px; }
.measured-workbench .workbench-scroll { margin-right: calc(1px - var(--tool-control-inset)); padding-right: calc(var(--tool-control-inset) + 2px); scrollbar-gutter: stable; overscroll-behavior: contain; }
.measured-workbench .job-queue-list { overflow-x: hidden; scrollbar-gutter: stable; overscroll-behavior: contain; }
.reference-guide-page { max-width: none; padding: 42px 0 80px; }
.workbench-guide-hero { display: flex; flex-direction: column; align-items: center; padding: 40px 0; text-align: center; }
.workbench-guide-hero h1 { width: calc(100% - 32px); max-width: 1200px; margin: 0 0 16px; font-family: "Noto Serif SC","Noto Serif TC","Source Serif 4",Georgia,"Times New Roman",serif; font-size: 40px; font-weight: 400; line-height: 1.12; }
.workbench-guide-hero > p { width: calc(100% - 32px); max-width: 1200px; margin: 0 0 48px; font-size: 16px; line-height: 28px; color: #c9c7c1; }
.workbench-guide-hero-media { width: calc(100% - 48px); max-width: 1024px; border: 1px solid #2e2d26; border-radius: 16px; overflow: hidden; background: #11100b; }
.workbench-guide-hero-media video { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }
.reference-guide-page > :not(.workbench-guide-hero) { max-width: 1100px; margin-left: auto; margin-right: auto; padding-left: 32px; padding-right: 32px; }
.reference-guide-page .guide-intro { margin-top: 72px; max-width: 824px; }
/* Wheel/trackpad scrolling never reveals these handles. Only direct pointer
   contact with the thumb (or dragging it) changes its transparent colour. */
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list) { scrollbar-width: auto; scrollbar-color: auto; }
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list)::-webkit-scrollbar { width: 6px; height: 6px; background: transparent; }
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list)::-webkit-scrollbar-track { background: transparent; }
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list)::-webkit-scrollbar-thumb { background: transparent; background-clip: padding-box; border: 2px solid transparent; border-radius: 9999px; }
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list)::-webkit-scrollbar-thumb:hover { background-color: #f5f4ef80; }
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list)::-webkit-scrollbar-thumb:active { background-color: #f5f4efaa; }
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list)::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
:is(.measured-workbench .workbench-scroll,.measured-workbench .reference-material-strip,.measured-workbench .workbench-model-dropdown,.measured-workbench .workbench-upload-items,.measured-workbench textarea,.measured-workbench .job-queue-list)::-webkit-scrollbar-corner { background: transparent; }
.reference-workbench .prompt-box textarea { min-height: 180px; }
.reference-workbench .ratio-options { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
.reference-workbench .ratio-options button { min-width: 0; }
@media (min-width: 1024px) {
  :root { --sidebar-item-inset: 18px; }
  body:has(.measured-workbench):not(.sidebar-collapsed) .sidebar { width: var(--sidebar); }
  body:has(.measured-workbench):not(.sidebar-collapsed) .content { margin-left: var(--sidebar); }
  body:has(.measured-workbench):not(.sidebar-collapsed) .main-nav a { height: 45px; min-height: 45px; padding: 0 var(--sidebar-item-inset); gap: 12px; font-size: 16px; }
  body:has(.measured-workbench):not(.sidebar-collapsed) .main-nav a svg { width: 19px; height: 19px; }
  .measured-workbench .studio-breadcrumb { padding-inline: 20px; }
  .measured-workbench .studio-shell.no-job, .measured-workbench .studio-shell.has-job { grid-template-columns: min(384px,33vw) minmax(0,1fr); padding: 0 16px 14px; gap: 12px; }
  .measured-workbench .control-panel { padding: 20px; }
  .reference-workbench .studio-shell.no-job .preview-panel { padding: 24px; }
  .reference-workbench .studio-shell.no-job .preview-stage { width: calc(100% - 48px); max-width: 1024px; height: min(520px,calc(100% - 48px)); max-height: 520px; aspect-ratio: auto; }
  .reference-workbench .studio-shell.no-job .preview-stage .stage-media { width: 100%; height: 100%; object-fit: contain; }
}
@media (min-width: 1280px) { .measured-workbench .studio-shell.no-job, .measured-workbench .studio-shell.has-job { grid-template-columns: 384px minmax(0,1fr); } }
@media (max-width: 639px) {
  .reference-material-preview { height: 176px; }
  .reference-material-summary { gap: 6px; }
  .reference-material-kinds { gap: 4px; }
  .reference-material-kinds > span { width: 28px; height: 28px; }
  .reference-material-count { font-size: 11px; padding-inline: 6px; }
  .reference-material-tools { gap: 4px; }
  .reference-material-tools button { width: 32px; height: 32px; flex-basis: 32px; }
  .reference-workbench .ratio-options { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .reference-guide-page { padding-top: 16px; }
  .workbench-guide-hero { padding-top: 32px; }
  .workbench-guide-hero h1 { font-size: 30px; }
  .workbench-guide-hero > p { font-size: 14px; line-height: 24px; margin-bottom: 32px; }
  .reference-guide-page > :not(.workbench-guide-hero) { padding-inline: 18px; }
}
@media (max-width: 900px) { .measured-workbench .control-panel { --tool-control-inset: 12px; } }
