.director-ref-pick { border: 0; padding: 0; background: transparent; font: inherit; color: inherit; }
.director-ref-pick em { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-pop { --reference-card-min: 160px; }
.reference-pop .reference-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--reference-card-min), 1fr)); gap: 12px; align-items: start; align-content: start; }
.reference-pop .reference-more { display: block; margin: 16px auto; padding: 10px 18px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--panel-2); font: inherit; cursor: pointer; }
.reference-pop .reference-actions, .reference-pop .reference-saved-grid, .reference-pop .style-saved-grid { display: contents; }
.reference-pop [hidden] { display: none !important; }
.reference-pop .style-library-status { min-width: 0; }
.reference-pop .style-create-cta { display: block; padding: 9px 10px; margin: 8px 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 650 12px var(--sans, sans-serif); }
.reference-pop .style-create-tile:hover .style-create-cta { background: #ff4030; }
.reference-pop .style-saved-card { position: relative; display: block; width: 100%; min-width: 0; padding: 0; background: #131415; color: #fff; text-align: left; border: 0; overflow: hidden; }
.reference-pop .style-saved-card[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
.reference-pop .style-saved-face { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; height: 100%; color: var(--accent); font-size: 32px; }
.reference-pop .style-saved-card strong { position: absolute; left: 0; right: 0; bottom: 0; padding: 35px 10px 10px; background: linear-gradient(transparent, #000d); font-size: 12px; overflow-wrap: anywhere; }
.reference-pop .style-saved-card:has(.style-saved-meta) strong { padding-bottom: 28px; }
.reference-pop .style-saved-meta { position: absolute; left: 10px; right: 10px; bottom: 10px; color: #bfc1c2; font: 9px var(--mono); }
.reference-pop .style-retry { align-self: flex-start; margin: 0 14px 14px; }
.style-retry { padding: 0; border: 0; background: none; color: #c6c8c9; font-size: 14px !important; cursor: pointer; }
html.creator-ui .reference-pop .style-create-cta { padding: 12px 16px; font-size: 15px; }
html.creator-ui .reference-pop .style-saved-card strong { font-size: 16px; }

/* Desktop proportions measured from the Higgsfield preset dialog: 800 × 560. */
.style-dialog { position: fixed; inset: 0; margin: auto; width: min(800px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 8px; overflow: auto; overscroll-behavior: contain; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 32px 100px #0009; font: inherit; color-scheme: dark; }
.style-dialog::backdrop { background: rgba(6,6,7,.72); backdrop-filter: blur(8px); }
.style-dialog [hidden] { display: none !important; }
.style-dialog button, .style-dialog input { font: inherit; }
.style-dialog button { cursor: pointer; }
.style-dialog button:disabled { cursor: default; }
.style-dialog button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.style-create { display: grid; grid-template-columns: 316px minmax(0,1fr); gap: 4px; min-height: 542px; }
.style-intro { min-width: 0; padding: 28px 28px 20px; display: flex; flex-direction: column; }
.style-intro h2 { margin: 0 0 20px; font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -1px; text-transform: uppercase; color: var(--accent); }
.style-intro p { margin: 0 0 20px; font-size: 14px; line-height: 20px; color: var(--muted); }
.style-moodboard { flex: 1; min-height: 0; overflow: hidden; background: var(--bg); border-radius: 18px; }
.style-moodboard img, .style-moodboard video { display: block; width: 100%; height: 100%; max-height: 328px; object-fit: cover; }
.style-form { min-width: 0; padding: 12px 20px 22px; background: var(--panel-2); border-radius: 20px; }
.style-form-header { display: flex; align-items: center; justify-content: space-between; height: 32px; margin-bottom: 24px; }
.style-form-header h2 { margin: 0; font-size: 16px; font-weight: 650; }
.style-close { display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: #ffffff08; color: var(--muted); font-size: 18px !important; }
.style-close:hover { background: #ffffff12; color: #fff; }
.style-name-label, .style-upload-heading { font-size: 14px; font-weight: 500; }
.style-form input[name="name"] { display: block; width: 100%; height: 40px; margin: 8px 0 24px; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 14px; outline: none; }
.style-form input::placeholder { color: var(--muted); }
.style-form input:focus-visible { border-color: var(--accent); }
.style-upload-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.style-file-count { color: var(--muted); font: 10px var(--mono); }
.style-drop { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; width: 100%; height: 268px; padding: 20px; background: var(--bg); border: 1px dashed #363636; border-radius: 18px; color: var(--text); text-align: center; transition: background .15s, border-color .15s; }
.style-drop:hover, .style-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.style-drop-copy { max-width: 370px; font-size: 14px; line-height: 20px; color: var(--muted); }
.style-upload-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #363636; border-radius: 50%; color: var(--text); }
.style-upload-icon svg { width: 22px; height: 22px; }
.style-drop.has-files { height: 64px; padding: 12px; flex-direction: row; }
.style-drop.has-files .style-drop-copy { font-size: 12px; line-height: 16px; }
.style-drop.has-files .style-upload-icon { flex: none; width: 30px; height: 30px; }
.style-files { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.style-files:not(:empty) { margin-top: 12px; }
.style-file { position: relative; min-width: 0; }
.style-file img, .style-file video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; background: var(--bg); }
.style-file span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; color: var(--muted); margin-top: 5px; }
.style-file button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; color: #fff; background: #111c; }
.style-create-status { margin-top: 12px; color: #ff9187; font-size: 14px; line-height: 1.5; }
.style-create-status:empty, .style-cost:empty { display: none; }
.style-submit { display: block; width: 100%; min-height: 48px; margin-top: 24px; padding: 12px 16px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700 !important; font-size: 14px !important; }
.style-submit:hover:not(:disabled) { background: #ff4033; }
.style-submit:disabled { background: #a52319; color: #fff; }
.style-cost { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }

.style-submit { min-height: 40px; margin-top: 24px; padding: 10px 16px; border-radius: 10px; }
/* The scroll container stays block-level; only its unconstrained inner grid sizes rows. */
.reference-pop .picker-grid { display: block; }
.reference-pop .reference-actions > .picker-upload, .reference-pop .style-create-tile, .reference-pop .style-saved-card { height: auto; aspect-ratio: 9 / 16; }
.reference-pop .style-create-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 12px; overflow: hidden; border: 1px solid #303234; border-radius: 14px; background: #222426; color: var(--text); box-shadow: inset 0 1px 4px #ffffff06; }
.reference-pop .style-create-tile:hover { border-color: #555; }
.style-card-content { position: absolute; top: 30%; left: 10px; right: 10px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.style-card-content strong { font-size: 16px; line-height: 1.08; font-weight: 750; letter-spacing: -.4px; text-transform: uppercase; text-align: center; }
.reference-pop .style-create-cta { margin: 0; padding: 10px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--accent); color: #fff; }
.style-card-art { position: absolute; left: 8%; right: 8%; bottom: -8%; height: 32%; }
.style-card-art img { position: absolute; bottom: 0; width: 46%; height: 100%; object-fit: cover; border: 2px solid #b5b5b5; border-radius: 10px; box-shadow: 0 4px 12px #0006; }
.style-card-art img:first-child { left: 0; height: 82%; transform: rotate(12deg); }
.style-card-art img:nth-child(2) { left: 28%; z-index: 1; transform: rotate(-5deg); }
.style-card-art img:last-child { right: 0; height: 78%; transform: rotate(4deg); }
html.creator-ui .reference-pop { --reference-card-min: 196px; }
html.creator-ui .style-card-content strong { font-size: 20px; }
@media (max-width: 640px) {
  .style-dialog { width: min(440px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
  .style-create { display: block; min-height: 0; }
  .style-intro { display: none; }
  .style-form { padding: 16px; }
  .style-form input[name="name"] { font-size: 16px; }
  .style-drop { height: 240px; }
  .reference-pop .reference-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) { .style-drop { transition: none; } }
