/* Fenaky workspace: compact rail, contextual panels and media-first libraries. */
:root { --rail-width: 76px; --rail-offset: 100px; --workspace-panel-width: 308px; --workspace-gap: 12px; }
.workspace-shell { --content-offset: var(--rail-offset); min-height: 100dvh; }
.workspace-shell[data-panel="avatars"], .workspace-shell[data-panel="video"] { --content-offset: calc(var(--rail-offset) + var(--workspace-panel-width) + var(--workspace-gap)); }
.workspace-shell[data-panel="video"] { --workspace-panel-width: 332px; }
.workspace-shell [hidden] { display: none !important; }
.workspace-rail { position: fixed; z-index: 50; inset: 12px auto 12px 12px; width: var(--rail-width); display: flex; flex-direction: column; align-items: center; padding: 15px 6px 10px; background: #141416; border: 1px solid #36363c; border-radius: 22px; }
.workspace-brand { display: grid; place-items: center; flex: none; width: 52px; height: 52px; margin-bottom: 22px; border-radius: 13px; }
.workspace-brand img { display: block; width: 40px; height: 40px; }
.workspace-brand:hover { background: var(--surface-raised); }
.rail-primary, .rail-secondary { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.rail-secondary { margin-top: auto; padding-top: 24px; align-items: center; }
.rail-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 62px; padding: 10px 2px; border-radius: 13px; color: #b4b2bd; font-size: 11px; font-weight: 600; line-height: 1.2; text-decoration: none; transition: background 180ms, color 180ms; }
.rail-item .icon { width: 21px; height: 21px; flex-basis: 21px; }
.rail-item:hover { color: var(--text); background: #242328; }
.rail-item.active, .rail-item[aria-current="page"], .rail-item[aria-expanded="true"] { color: #e5dcff; background: #30293e; }
.rail-item[aria-expanded="true"]::after { content: ''; position: absolute; right: -7px; height: 16px; width: 3px; border-radius: 2px; background: var(--purple); }
.rail-divider { width: 26px; height: 1px; background: #3c3a43; margin: 6px 0 10px; }
.rail-account { display: grid; place-items: center; flex: none; width: 35px; height: 35px; border: 1px solid #3b3843; border-radius: 50%; background: #24212c; }
.rail-account:hover { border-color: var(--purple); background: #31283e; }
.workspace-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; height: 72px; margin-left: var(--content-offset); padding: 0 30px; border-bottom: 1px solid #26262c; background: var(--bg); }
.workspace-location { display: flex; align-items: center; gap: 13px; font-size: 12px; min-width: 0; }
#workspace-location { font-weight: 650; color: #e1dfe8; white-space: nowrap; }
.workspace-location-divider { color: #59555f; }
#workspace-context { color: #aaa6b5; white-space: nowrap; }
.workspace-topbar .google-login { min-height: 35px; padding: 8px 12px; font-size: 11px; flex: none; }
.workspace-shell main { padding: 26px 30px 38px; margin-left: var(--content-offset); max-width: none; min-width: 0; }
.workspace-shell .minimal-footer { margin-left: var(--rail-offset); padding: 22px 30px; }
.workspace-shell .portfolio-studio { display: block; }
.workspace-shell .portfolio-gallery { container-type: inline-size; container-name: workspace-gallery; }
.workspace-panel { position: fixed; z-index: 40; top: 12px; bottom: 12px; left: var(--rail-offset); width: var(--workspace-panel-width); height: calc(100dvh - 24px); padding: 0; background: #18181c; border: 1px solid #36333e; border-radius: 18px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #494050 transparent; animation: panel-enter 220ms cubic-bezier(.16,1,.3,1); }
.workspace-panel-heading { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; min-height: 65px; padding: 16px 20px; background: #18181c; border-bottom: 1px solid #2f2c35; }
.workspace-panel-heading h2 { font: 500 18px/1.25 var(--display); letter-spacing: -.02em; }
.panel-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 6px; color: #b8b1c2; border-radius: 7px; }
.panel-close .icon { width: 17px; height: 17px; }
.panel-close:hover { color: var(--text); background: #302b39; }
.workspace-shell .catalog-filters { max-height: none; padding-bottom: 0; }
.workspace-shell .catalog-filter-heading { padding: 24px 20px 26px; }
.catalog-filter-heading h3 { font: 500 21px/1.25 var(--display); letter-spacing: -.025em; max-width: 16ch; }
.workspace-shell .catalog-filter-heading p { font-size: 11px; margin-top: 8px; color: #b0a8bc; }
.workspace-shell .catalog-filter-group { padding: 0 20px; margin-bottom: 26px; }
.workspace-shell .catalog-filter-choices { gap: 10px; }
.workspace-shell .catalog-filter-choice { border-radius: 10px; background: #26252b; }
.workspace-shell .catalog-filter-choice .filter-label { padding: 9px 10px; font-size: 11px; }
.workspace-shell .catalog-filter-actions { position: sticky; bottom: 0; z-index: 3; background: #18181c; border-top: 1px solid #2f2c35; padding: 13px 20px; }
.workspace-shell .catalog-filter-actions span { font-size: 11px; color: #b0a8bc; }
.workspace-shell .video-configurator { display: flex; flex-direction: column; max-height: none; padding: 0; overflow: clip; }
.workspace-shell .video-configurator .workspace-panel-heading { position: relative; flex: none; }
.workspace-shell .video-config-body { padding: 20px; flex: 1 1 auto; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #494050 transparent; }
.workspace-shell .video-configurator .upload-zone { min-height: 192px; margin: 0; border-color: #4d415f; background: #211d29; }
.workspace-shell .video-configurator .visual-config-footer { flex: none; padding: 16px 20px; background: #211d29; border-top: 1px solid #393141; }
.workspace-shell .video-configurator .visual-config-footer .button { min-height: 42px; font-size: 11px; }
.workspace-shell .video-configurator .visual-config-footer > small { font-size: 11px; line-height: 1.6; color: #b5a7c5; }
.workspace-shell .field-hint, .workspace-shell .empty-motion-note, .workspace-shell .video-meta { color: #b1a6be; }
.workspace-shell .video-prompt-field textarea::placeholder { color: #afa4bb; }
.workspace-shell .video-prompt-field textarea { caret-color: var(--purple); }
.workspace-shell .video-prompt-label small { color: #b1a6be; }
.more-panel { display: flex; flex-direction: column; width: 292px; }
.more-links { padding: 14px 10px; }
.more-links a { display: flex; align-items: center; gap: 12px; padding: 15px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; color: #e1dce8; }
.more-links a > .icon { width: 19px; height: 19px; color: #b9aacb; flex: none; }
.more-links a > .icon:last-child { width: 14px; height: 14px; margin-left: auto; color: #8f849f; }
.more-links a small { display: block; margin-top: 5px; font-size: 11px; line-height: 1.4; color: #b3a9c0; font-weight: 400; }
.more-links a:hover, .more-links a[aria-current="page"] { background: #2a2534; }
.more-panel-foot { display: grid; gap: 5px; margin-top: auto; padding: 20px; border-top: 1px solid #2f2c35; font-size: 12px; font-weight: 600; }
.more-panel-foot > span:last-child { font-size: 11px; color: #b1a6be; font-weight: 400; }
.workspace-backdrop { display: none; }
.workspace-shell .explore-intro { padding: 8px 10px 28px; }
.workspace-shell .portrait-fan { height: 204px; margin-bottom: 16px; overflow: clip; }
.workspace-shell .explore-intro h1 { font-size: 30px; max-width: 26ch; }
.workspace-shell .explore-intro p { margin-top: 10px; font-size: 11px; color: #b1a6be; }
.workspace-shell .explore-grid-heading { margin: 20px 0; padding-top: 20px; border-top: 1px solid #2a272f; }
.workspace-shell .explore-grid-heading h2 { color: #e9e3f1; font: 500 18px/1.3 var(--display); }
.workspace-shell .catalog-results-status { color: #b1a6be; font-size: 11px; }
.catalog-toolbar-actions { display: flex; align-items: center; gap: 16px; }
.catalog-toolbar-actions .button { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.workspace-shell .portfolio-masonry, .workspace-shell .motion-masonry { columns: auto var(--gallery-card-width, 230px); column-gap: 14px; }
.workspace-shell .portfolio-card { margin-bottom: 14px; border-radius: 12px; }
.workspace-shell .library-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 1px 0 24px; }
.library-heading h1 { font: 500 28px/1.2 var(--display); letter-spacing: -.025em; }
.library-heading p { color: #b0a8bc; margin-top: 8px; font-size: 12px; line-height: 1.6; }
.library-heading .button { min-height: 38px; font-size: 11px; padding-inline: 14px; white-space: nowrap; }
.library-tabs { display: flex; align-items: center; gap: 26px; border-bottom: 1px solid #2c2931; margin-bottom: 18px; }
.library-tabs button { position: relative; display: flex; align-items: center; gap: 9px; padding: 0 0 13px; font-size: 12px; color: #ada5ba; font-weight: 600; white-space: nowrap; }
.library-tabs button > span { font-size: 11px; color: #b0a7bd; font-weight: 500; font-variant-numeric: tabular-nums; }
.library-tabs button[aria-pressed="true"] { color: #efe7ff; }
.library-tabs button[aria-pressed="true"]::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--purple); }
.library-tabs button:hover { color: var(--text); }
.library-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.gallery-search { display: flex; align-items: center; gap: 9px; min-height: 38px; width: clamp(220px, 24vw, 330px); padding: 0 12px; border: 1px solid #35313d; border-radius: 8px; background: #1d1b22; }
.gallery-search > .icon { width: 16px; height: 16px; color: #a99db7; flex: none; }
.gallery-search input { width: 100%; padding: 9px 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 11px; min-width: 0; caret-color: var(--purple); }
.gallery-search input::placeholder { color: #b0a6bd; }
.gallery-search:focus-within { border-color: var(--purple); outline: 2px solid #b5a0ff40; outline-offset: 1px; }
.gallery-select { position: relative; display: flex; align-items: center; gap: 8px; height: 38px; border: 1px solid #35313d; border-radius: 8px; background: #1d1b22; }
.gallery-select select { appearance: none; background: transparent; color: #d4ccdf; border: 0; height: 100%; padding: 0 31px 0 12px; font: inherit; font-size: 11px; cursor: pointer; border-radius: inherit; }
.gallery-select select option { background: #222027; color: var(--text); }
.gallery-select > .icon { position: absolute; pointer-events: none; right: 10px; width: 12px; height: 12px; color: #b2a7c0; }
.gallery-density { display: flex; align-items: center; gap: 10px; margin-left: auto; padding: 8px 0 8px 8px; }
.gallery-density > .icon { width: 16px; height: 16px; color: #b0a6bd; }
.gallery-density input { width: 90px; height: 3px; accent-color: var(--purple); cursor: pointer; }
.gallery-results { color: #b0a6bd; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 45px; text-align: right; }
.workspace-shell .media-card { position: relative; width: 100%; padding: 0; break-inside: avoid; margin-bottom: 18px; background: transparent; border-radius: 0; overflow: visible; }
.workspace-shell .media-card::after { display: none; }
.workspace-shell .media-card.selected { outline: none; }
.workspace-shell .media-preview { position: relative; display: block; width: 100%; padding: 0; margin: 0; border-radius: 12px; overflow: hidden; background: #222027; }
.workspace-shell .media-preview video { display: block; width: 100%; height: auto; object-fit: cover; }
.workspace-shell .selected .media-preview { outline: 2px solid var(--purple); outline-offset: 2px; }
.media-duration { position: absolute; bottom: 10px; right: 10px; padding: 4px 6px; border-radius: 5px; background: #111114d9; color: #f3eff7; font-size: 11px; line-height: 1.3; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.workspace-shell .video-favorite { right: 10px; top: 10px; width: 30px; height: 30px; background: #17131be6; border: 1px solid #ffffff29; }
.workspace-shell .video-favorite[aria-pressed="true"] { background: #3d2d50; color: #ddcaff; }
.workspace-shell .portfolio-pick { top: 10px; left: 10px; right: auto; width: 26px; height: 26px; }
.media-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 11px 1px 0; font-size: 11px; font-weight: 600; color: #d5cddf; }
.media-caption small { font-size: 11px; font-weight: 400; color: #b0a6bd; }
.asset-info { display: flex; align-items: center; gap: 12px; padding: 11px 1px 0; }
.asset-info > div { flex: 1; min-width: 0; }
.asset-info h2 { font: 600 11px/1.5 var(--font); color: #ddd5e7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-info p { margin-top: 4px; color: #b0a6bd; font-size: 11px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.asset-download { display: grid; place-items: center; flex: none; width: 30px; height: 30px; color: #b5a5c7; border-radius: 7px; }
.asset-download .icon { width: 16px; height: 16px; }
.asset-download:hover { background: #2b2435; color: #e5d6ff; }
.workspace-shell .asset-tag { top: 10px; left: 10px; font-size: 11px; letter-spacing: 0; text-transform: none; background: #19151de6; color: #ecdefb; }
.workspace-shell .asset-pending { border-radius: 12px; overflow: hidden; }
.assets-refresh-error { color: #d5c2e6; margin-bottom: 16px; font-size: 11px; }
.workspace-shell .media-card:hover { translate: none; box-shadow: none; }
.workspace-shell .motion-card:hover video { scale: 1.025; }
.workspace-shell .media-preview:hover { box-shadow: none; translate: none; }
.workspace-shell .portfolio-card:hover { transform: none; box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.workspace-shell :is(button, a, select, input[type="range"]):focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
.workspace-shell ::selection { color: #181321; background: #c5b4ff; }
/* Cloud account and library: account state on both controls, owned images beside videos. */
.rail-account .icon { width: 17px; height: 17px; color: #e5dcff; }
.rail-account:disabled, .workspace-topbar .google-login:disabled { opacity: .6; cursor: progress; }
.workspace-shell .media-preview img { display: block; width: 100%; height: auto; }
@keyframes panel-enter { from { opacity: .7; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@container workspace-gallery (min-width: 850px) {
  .workspace-shell .explore-intro { display: grid; grid-template-columns: 1fr 1.35fr; grid-template-rows: auto auto; align-items: center; text-align: left; gap: 0 24px; padding: 8px 0 16px; }
  .workspace-shell .explore-intro .portrait-fan { grid-column: 2; grid-row: 1 / 3; margin: 0; height: 234px; }
  .workspace-shell .explore-intro h1 { grid-column: 1; grid-row: 1; align-self: end; font-size: 34px; }
  .workspace-shell .explore-intro p { grid-column: 1; grid-row: 2; align-self: start; }
}
@media (max-width: 1050px) {
  .workspace-topbar { padding-inline: 22px; }
  .workspace-shell main { padding-inline: 22px; }
  .gallery-density { margin-left: 0; }
  .gallery-results { margin-left: auto; }
}
@media (max-width: 760px) {
  :root { --rail-width: 62px; --rail-offset: 82px; }
  .workspace-rail { inset: 8px auto 8px 8px; border-radius: 18px; padding: 10px 4px; }
  .workspace-brand { width: 44px; height: 44px; margin-bottom: 12px; }
  .rail-item { min-height: 56px; font-size: 11px; gap: 6px; }
  .rail-item .icon { width: 19px; height: 19px; }
  .rail-secondary { padding-top: 14px; gap: 2px; }
  .workspace-shell[data-panel] { --content-offset: var(--rail-offset); }
  .workspace-panel { top: 8px; bottom: 8px; height: calc(100dvh - 16px); width: min(var(--workspace-panel-width), calc(100vw - var(--rail-offset) - 12px)); border-radius: 15px; z-index: 60; }
  .workspace-backdrop:not([hidden]) { display: block; position: fixed; z-index: 35; inset: 0 0 0 var(--rail-offset); background: #06050999; }
  .workspace-topbar { height: 62px; padding-inline: 14px; }
  .workspace-topbar .google-login { display: none; }
  .workspace-location { gap: 9px; font-size: 11px; }
  .workspace-shell main { padding: 20px 14px 28px; }
  .workspace-shell .minimal-footer { padding: 20px 14px; flex-direction: column; align-items: start; }
  .workspace-shell .minimal-footer nav { flex-wrap: wrap; gap: 10px 16px; }
  .workspace-shell .explore-intro { padding: 0 0 18px; }
  .workspace-shell .explore-intro h1 { font-size: 25px; }
  .workspace-shell .portrait-fan { height: 166px; margin-bottom: 12px; }
  .workspace-shell .explore-grid-heading { margin-top: 15px; gap: 10px; align-items: start; }
  .catalog-toolbar-actions { gap: 8px; align-items: end; flex-direction: column; }
  .workspace-shell .portfolio-masonry, .workspace-shell .motion-masonry { columns: 2; column-gap: 10px; }
  .workspace-shell .library-heading { align-items: start; flex-direction: column; gap: 14px; margin-bottom: 22px; }
  .library-heading h1 { font-size: 25px; }
  .library-heading p { font-size: 11px; }
  .library-toolbar { gap: 8px; }
  .gallery-search { width: 100%; }
  .gallery-density { display: none; }
  .gallery-select select { padding-left: 10px; font-size: 11px; }
  .library-tabs { gap: 20px; }
  .library-tabs button { font-size: 11px; gap: 6px; }
  .gallery-results { flex-basis: 100%; text-align: left; }
  .media-caption { align-items: start; flex-direction: column; gap: 2px; font-size: 11px; }
  .asset-info h2 { font-size: 11px; }
  .asset-info p { font-size: 11px; }
  .asset-download { width: 24px; }
  .workspace-shell .ed-layout { display: flex; flex-direction: column; gap: 20px; }
  .workspace-shell .ed-config { width: 100%; position: static; }
  .workspace-shell .ed-work { width: 100%; }
  .character-sheet-dialog { width: calc(100% - 24px); padding: 16px; }
  .character-sheet-cta { min-width: 0; width: 100%; }
}
@media (max-width: 430px) {
  .workspace-shell .portfolio-masonry, .workspace-shell .motion-masonry { columns: 1; }
}
@media (max-height: 630px) {
  .workspace-rail { overflow-y: auto; scrollbar-width: none; }
  .workspace-brand { margin-bottom: 10px; }
  .rail-item { min-height: 48px; }
  .rail-secondary { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .workspace-panel { animation: none; }
  .rail-item { transition: none; }
  .workspace-shell .motion-card:hover video { scale: 1; }
}
