/* Freefield web UI. Dark studio: near-black canvas, dark rounded cards, one lime accent,
   wide uppercase display type. Fonts are self-hosted (web/fonts, SIL OFL). */
@font-face { font-family: "Archivo Variable"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(fonts/archivo.woff2) format("woff2-variations"); }
@font-face { font-family: "Inter Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/inter.woff2) format("woff2-variations"); }

:root {
  --bg: #09090a; --bg-2: #0f0f11; --panel: #151517; --panel-2: #1b1b1e; --panel-3: #232327;
  --line: #222226; --line-2: #2e2e33; --ink: #f4f4f2; --dim: #9b9ba3; --faint: #66666e;
  --accent: #6e3663; --accent-ink: #ffffff; --accent-soft: rgba(110, 54, 99, .18);
  --accent-soft-2: rgba(110, 54, 99, .35); --accent-hover: #87447a;
  --accent-bg: rgba(110, 54, 99, .14); --accent-line: rgba(110, 54, 99, .25);
  --accent-vbar: #42203b;
  --violet: #b49cff; --pink: #ff5c9d; --bad: #ff6b5e; --ok: #8fe07c; --warn: #ffc65c;
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --top: 56px;
  --font: "Inter Variable", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo Variable", "Archivo", "Inter Variable", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.display { font-family: var(--display); font-weight: 800; font-stretch: 118%; text-transform: uppercase; letter-spacing: -.01em; line-height: .95; }
.dim { color: var(--dim); } .faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 1em; height: 1em; flex: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2f; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ top bar */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--top); display: flex; align-items: center; gap: 18px;
  padding: 0 18px; background: rgba(9, 9, 10, .86); backdrop-filter: blur(14px); border-bottom: 1px solid #161618; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; font-size: 16px; flex: none; }
.logo .mark { width: 26px; height: 26px; }
.nav-main { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: visible; flex-wrap: wrap; scrollbar-width: none; }
.nav-main::-webkit-scrollbar { display: none; }
.nav-main a { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px; color: #c9c9cf; font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.nav-main a:hover { color: var(--ink); background: #141416; }
.nav-main a[aria-current="page"] { color: var(--accent); }
.nav-main .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; flex: none; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .02em; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.tag.violet { background: var(--violet); color: #160f2b; }
.tag.pink { background: var(--pink); color: #2b0716; }
.tag.ghost { background: transparent; color: var(--dim); box-shadow: inset 0 0 0 1px var(--line-2); }
.tag.dark { background: rgba(0, 0, 0, .55); color: var(--ink); backdrop-filter: blur(6px); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn.menu-btn { display: none; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: #c9c9cf; cursor: pointer; font-size: 17px; }
.icon-btn:hover { background: #18181b; color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 0;
  background: var(--panel-2); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn.lime { background: var(--accent); color: var(--accent-ink); }
.btn.lime:hover { background: var(--accent-hover); }
.btn.white { background: #f4f4f2; color: #0b0b0c; }
.btn.white:hover { background: #fff; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost:hover { background: #141416; }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.danger:hover { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.gpu { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: #111113; color: #d4d4d8; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.gpu:hover { border-color: #3a3a40; }
.gpu .dot { width: 8px; height: 8px; border-radius: 50%; background: #5b5b63; flex: none; }
.gpu.warm .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.gpu.waking .dot { background: var(--warn); animation: pulse 1.1s infinite; }
.gpu.error .dot, .gpu.off .dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

/* ------------------------------------------------------------------ shared bits */
.view { min-height: calc(100vh - var(--top)); }
.page { padding: 26px 22px 80px; max-width: 1480px; margin: 0 auto; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 38px 0 14px; }
.sec-head h2 { margin: 0; font-size: 26px; }
.sec-head p { margin: 6px 0 0; color: var(--dim); font-size: 13px; }
.more { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap; }
.more:hover { color: var(--accent); }
.pill-link { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--panel-2); font-weight: 600; font-size: 13px; }
.pill-link:hover { background: var(--panel-3); }
.pills { display: flex; gap: 6px; overflow-x: visible; flex-wrap: wrap; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pills button { flex: none; height: 32px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; color: #bdbdc4; font-weight: 600; font-size: 13px; cursor: pointer; }
.pills button:hover { color: var(--ink); background: #141416; }
.pills button[aria-pressed="true"] { background: var(--panel-3); color: var(--ink); }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #111113; border: 1px solid #1c1c1f; width: max-content; max-width: 100%; overflow-x: visible; flex-wrap: wrap; scrollbar-width: none; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent;
  color: #aeaeb6; font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: #232327; color: var(--ink); }
.empty { color: var(--dim); text-align: center; padding: 40px 16px; }
img.alpha, .alpha img { background: repeating-conic-gradient(#202024 0% 25%, #141416 0% 50%) 50% / 16px 16px; }
.wave { background: radial-gradient(120% 140% at 50% 120%, var(--accent-bg), #0d0d0f 70%); }
.kbd { font: 600 11px var(--font); padding: 1px 5px; border-radius: 5px; background: #1f1f23; color: var(--dim); }
pre.code { margin: 0; padding: 12px 14px; border-radius: 10px; background: #0d0d0f; border: 1px solid var(--line); overflow-x: visible; flex-wrap: wrap; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #d6d6dc; }
.toast-host { position: fixed; left: 50%; top: calc(var(--top) + 12px); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; pointer-events: none; justify-items: center; }
.toast { pointer-events: auto; background: #1d1d20; border: 1px solid var(--line-2); color: var(--ink); padding: 10px 14px; border-radius: 12px; font-size: 13px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5); max-width: min(560px, calc(100vw - 32px)); white-space: pre-wrap; animation: rise .25s var(--ease); }
.toast.err { border-color: rgba(255, 107, 94, .5); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* media tiles: a card that plays its loop on hover or when visible */
.media { position: relative; overflow: hidden; background: #0d0d0f; }
.media > img, .media > video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }   /* a tall photo in a wide card keeps the head */
.media > img.contain { object-fit: contain; }
.media .badges { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 5px; flex-wrap: wrap; }
.media .badges.top { top: 10px; bottom: auto; }
.media .typeicon { position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px;
  background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px); color: #fff; font-size: 13px; }

/* masonry: columns built in JS so the newest item stays first in reading order */
.masonry { display: flex; gap: 12px; align-items: flex-start; }
.masonry > .col { flex: 1 1 0; min-width: 0; display: grid; gap: 12px; }

/* ------------------------------------------------------------------ explore */
.hero-wrap { position: relative; margin: 0 -22px; }
.hero-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 31%); gap: 12px; overflow-x: visible; flex-wrap: wrap; scroll-snap-type: x mandatory;
  padding: 0 22px; scroll-padding: 0 22px; scrollbar-width: none; }
.hero-row::-webkit-scrollbar { display: none; }
.hero-card { position: relative; scroll-snap-align: start; aspect-ratio: 16 / 11; border-radius: var(--r-xl); overflow: hidden; background: #111; cursor: pointer; isolation: isolate; }
.hero-card .media { position: absolute; inset: 0; }
.hero-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .78)); z-index: 1; pointer-events: none; }
.hero-card .txt { position: absolute; left: 18px; right: 18px; bottom: 16px; z-index: 2; }
.hero-card h3 { margin: 8px 0 6px; font-size: clamp(20px, 1.9vw, 28px); }
.hero-card p { margin: 0; color: #d0d0d6; font-size: 13px; max-width: 46ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-card .media > video, .hero-card .media > img { transition: transform .6s var(--ease); }
.hero-card:hover .media > video, .hero-card:hover .media > img { transform: scale(1.03); }
.hero-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(20, 20, 22, .82); color: #fff; display: grid; place-items: center; font-size: 18px; backdrop-filter: blur(8px); }
.hero-nav.prev { left: 30px; } .hero-nav.next { right: 30px; }
.hero-nav:hover { background: #2a2a2e; }
.promo { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); gap: 14px; margin-top: 14px; }
.promo-lead { border-radius: var(--r-xl); padding: 26px; background: radial-gradient(140% 100% at 0% 0%, var(--accent-bg) 0%, #121314 55%); border: 1px solid var(--accent-line);
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 280px; }
.promo-lead h2 { margin: 0; font-size: clamp(28px, 3vw, 42px); }
.promo-lead h2 em { font-style: normal; color: var(--accent); }
.promo-lead p { margin: 0; color: #bdbdc4; max-width: 42ch; }
.promo-lead .row { display: flex; gap: 8px; flex-wrap: wrap; }
.tiles6 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile6 { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid #1d1d20; cursor: pointer;
  transition: border-color .15s, background .15s; min-height: 132px; }
.tile6:hover { border-color: #34343a; background: #18181b; }
.tile6 .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #202024; color: var(--accent); font-size: 19px; }
.tile6 .t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.tile6 p { margin: 0; color: var(--dim); font-size: 13px; }
.m-item { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--panel); cursor: pointer; }
.m-item .media > img, .m-item .media > video { height: auto; }
.m-item .media.audio { aspect-ratio: 4 / 3; display: grid; place-items: center; }
.m-item .media.audio > img { height: auto; object-fit: contain; padding: 0 12px; }
.m-item .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 12px 10px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .75));
  display: flex; align-items: center; justify-content: space-between; gap: 8px; opacity: 0; transition: opacity .2s; font-size: 13px; font-weight: 600; }
.m-item:hover .cap, .m-item:focus-visible .cap { opacity: 1; }
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.how > div { padding: 18px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid #1d1d20; }
.how h3 { margin: 10px 0 6px; font-size: 15px; }
.how p { margin: 0; color: var(--dim); font-size: 13px; }
.how .n { font-family: var(--display); font-weight: 800; font-stretch: 118%; color: var(--accent); font-size: 22px; }

/* ------------------------------------------------------------------ apps page */
.apps-head { display: grid; gap: 14px; padding-top: 8px; }
.apps-head .ic { width: 34px; height: 34px; color: var(--ink); font-size: 26px; }
.apps-head h1 { margin: 0; font-size: clamp(32px, 4.4vw, 58px); }
.apps-head h1 em { font-style: normal; color: var(--accent); }
.apps-head p { margin: 0; color: var(--dim); }
.apps-bar { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; min-width: 0; }
.apps-bar .pills { flex: 1 1 320px; min-width: 0; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--panel); border: 1px solid #1f1f22; width: min(260px, 100%); flex: none; color: var(--dim); }
.search input { border: 0; background: transparent; color: var(--ink); font: inherit; width: 100%; outline: none; }
.app-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 14px; }
.app-card { display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 12px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid #1c1c1f; cursor: pointer;
  transition: border-color .15s, background .15s; min-width: 0; }
.app-card:hover { border-color: #33333a; background: #18181b; }
.app-card .media { aspect-ratio: 1 / 1; border-radius: 11px; }
.app-card .media.audio > img { object-fit: contain; padding: 0 10px; }
.app-card .media .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #3a3a40; font-size: 40px; }
.app-card h3 { margin: 0 4px; font-size: 14px; font-weight: 700; }
.app-card p { margin: 0 4px; color: var(--dim); font-size: 12.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.app-card .btn { margin: auto 4px 0; height: 32px; border-radius: 9px; font-size: 12.5px; }

/* ------------------------------------------------------------------ workspace */
.ws { display: grid; min-height: calc(100vh - var(--top)); }
.ws.l-sidebar { grid-template-columns: 425px minmax(0, 1fr); }
.ws-main { min-width: 0; padding: 14px 20px 40px; display: flex; flex-direction: column; gap: 14px; }
.ws.l-composer .ws-main { padding-bottom: 230px; }
.ws-top { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.ws-top .right { display: flex; gap: 6px; align-items: center; }
.feed-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 40px 16px 20px; position: relative; isolation: isolate; min-height: 46vh; }
.feed-empty::before { content: ""; position: absolute; left: 50%; top: 48%; width: min(720px, 90vw); height: 360px; transform: translate(-50%, -50%); z-index: -1;
  background: radial-gradient(closest-side, rgba(70, 140, 130, .22), rgba(70, 140, 130, 0)); filter: blur(10px); }
.feed-empty .glass { width: 74px; height: 74px; margin: 0 auto 22px; border-radius: 22px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .03)); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 20px 50px rgba(0, 0, 0, .5); backdrop-filter: blur(10px); }
.feed-empty .glass svg { width: 40px; height: 40px; }
.feed-empty h2 { margin: 0; font-size: clamp(30px, 4vw, 52px); }
.feed-empty h2 span { display: block; color: #7d7d86; }
.feed-empty p { margin: 14px auto 0; color: var(--dim); max-width: 52ch; }
.feed-empty .ex { margin: 26px auto 0; display: inline-flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border-radius: 14px; background: rgba(21, 21, 23, .8);
  border: 1px solid var(--line); cursor: pointer; text-align: left; }
.feed-empty .ex:hover { border-color: #3a3a40; }
.feed-empty .ex .media { width: 54px; height: 54px; border-radius: 9px; flex: none; }
.feed-empty .ex b { display: block; font-size: 13px; }
.feed-empty .ex small { color: var(--dim); font-size: 12px; }
.feed { min-width: 0; }
.feed.dense .masonry > .col, .feed.dense .masonry { gap: 8px; }

/* result card */
.rcard { position: relative; border-radius: var(--r); overflow: hidden; background: var(--panel); cursor: pointer; min-height: 60px; }
.rcard .media > img, .rcard .media > video { height: auto; }
.rcard .media.audio { aspect-ratio: 16 / 9; display: grid; place-items: center; }
.rcard .media.audio > img { height: auto; object-fit: contain; padding: 0 14px; }
.rcard .ov { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 8px; opacity: 0; transition: opacity .15s;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent 30%, transparent 62%, rgba(0, 0, 0, .7)); }
.rcard:hover .ov, .rcard:focus-within .ov { opacity: 1; }
.rcard .ov .row { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.rcard .ov .acts { display: flex; gap: 4px; }
.rcard .ov .meta { font-size: 12px; color: #e3e3e8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mini { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; border: 0; background: rgba(15, 15, 17, .75); color: #fff; cursor: pointer;
  backdrop-filter: blur(8px); font-size: 14px; }
.mini:hover { background: rgba(40, 40, 44, .9); }
.mini.lime { background: var(--accent); color: var(--accent-ink); }
.rcard.pending { aspect-ratio: 1 / 1; background: #121214; cursor: default; }
.rcard.pending.video { aspect-ratio: 16 / 9; }
.rcard.pending .shimmer { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .05) 50%, transparent 70%) #121214;
  background-size: 220% 100%; animation: shimmer 1.6s linear infinite; }
.rcard.pending > img.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.8); opacity: .85; }
@keyframes shimmer { to { background-position: -120% 0; } }
.rcard.pending .state { position: absolute; left: 12px; right: 12px; bottom: 12px; display: grid; gap: 8px; z-index: 2; }
.rcard.pending .state b { font-size: 13px; }
.rcard.pending .state small { color: var(--dim); font-size: 12px; }
.bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s var(--ease); }
.bar.indet > i { width: 35%; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.rcard.pending .stop { position: absolute; right: 8px; top: 8px; z-index: 2; }
.rcard.failed { background: #1a1112; border: 1px solid rgba(255, 107, 94, .25); padding: 14px; display: grid; gap: 10px; cursor: default; }
.rcard.failed b { color: var(--bad); font-size: 13px; }
.rcard.failed pre { margin: 0; white-space: pre-wrap; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace; color: #e6c8c5; max-height: 180px; overflow: auto; }
.rcard.failed .row { display: flex; gap: 6px; }

/* composer: the floating prompt bar */
.composer { position: fixed; z-index: 30; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(940px, calc(100% - 32px));
  background: rgba(24, 24, 27, .92); border: 1px solid #2c2c31; border-radius: 22px; padding: 12px; box-shadow: 0 24px 80px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(18px); display: grid; gap: 10px; }
.composer.drag { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 24px 80px rgba(0, 0, 0, .65); }
.cmp-top { display: flex; gap: 10px; align-items: flex-start; padding: 2px 4px 0; }
.cmp-attach { display: flex; gap: 8px; flex: none; }
.att { position: relative; width: 56px; height: 56px; border-radius: 11px; overflow: hidden; background: #0f0f11; border: 1px solid #333; flex: none; }
.att img, .att video { width: 100%; height: 100%; object-fit: cover; }
.att .x { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .7); color: #fff; font-size: 11px;
  display: grid; place-items: center; cursor: pointer; padding: 0; }
.att .lbl { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9.5px; font-weight: 700; text-align: center; background: rgba(0, 0, 0, .6); padding: 1px 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att.need { border: 1px dashed #55555c; display: grid; place-items: center; color: #8a8a93; cursor: pointer; background: transparent; font-size: 20px; }
.att.need:hover { border-color: var(--accent); color: var(--accent); }
.att.need.missing { border-color: var(--bad); color: var(--bad); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.cmp-prompt { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; color: var(--ink); font: 15px/1.5 var(--font); padding: 6px 2px;
  min-height: 48px; max-height: 220px; }
.cmp-prompt::placeholder { color: #75757e; }
.cmp-prompt.missing::placeholder { color: var(--bad); }
.cmp-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmp-row .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 11px; border: 0; background: #26262a; color: #e4e4e8;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 260px; }
.chip:hover { background: #2f2f34; }
.chip .k { color: #8f8f98; font-weight: 500; }
.chip .v { overflow: hidden; text-overflow: ellipsis; }
.chip.square { width: 34px; padding: 0; justify-content: center; font-size: 16px; }
.chip.model { padding-left: 4px; }
.chip.model .thumb { width: 26px; height: 26px; border-radius: 8px; overflow: hidden; background: #111; flex: none; }
.chip.model .thumb img, .chip.model .thumb video { width: 100%; height: 100%; object-fit: cover; }
.chip.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft-2); }
.chip.filled .k { color: var(--accent); }
.count { display: inline-flex; align-items: center; height: 34px; border-radius: 11px; background: #26262a; padding: 0 4px; gap: 2px; font-weight: 700; font-size: 13px; }
.count button { width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: #c8c8ce; cursor: pointer; font-size: 15px; }
.count button:hover:not(:disabled) { background: #333338; color: #fff; }
.count button:disabled { opacity: .35; cursor: default; }
.count span { min-width: 30px; text-align: center; }
.count span small { color: var(--faint); font-weight: 600; }
.generate { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 22px; border-radius: 14px; border: 0; cursor: pointer; background: var(--accent);
  color: var(--accent-ink); font-family: var(--display); font-weight: 800; font-stretch: 112%; font-size: 15px; letter-spacing: .01em; text-transform: uppercase;
  transition: background .15s, transform .1s, box-shadow .15s; white-space: nowrap; }
.generate:hover { background: var(--accent-hover); box-shadow: 0 0 0 4px var(--accent-soft); }
.generate:active { transform: translateY(1px); }
.generate .cost { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font); font-stretch: 100%; font-weight: 700; font-size: 13px; text-transform: none; opacity: .8; }
.generate:disabled { background: #34342f; color: #8c8c80; cursor: not-allowed; box-shadow: none; }
.generate.wide { width: 100%; justify-content: center; height: 50px; }
.cmp-hint { font-size: 12px; color: var(--dim); padding: 0 6px; }
.cmp-hint.err { color: var(--bad); }

/* popovers (selects, sliders, seed, model switcher) */
.pop { position: fixed; z-index: 85; min-width: 220px; max-width: min(380px, calc(100vw - 24px)); max-height: min(440px, calc(100vh - 100px)); overflow: auto;
  background: #1b1b1e; border: 1px solid #2f2f35; border-radius: 14px; padding: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); animation: rise .14s var(--ease); }
.pop h4 { margin: 6px 8px 8px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.pop .opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; border: 0; background: transparent; color: #e4e4e8;
  text-align: left; cursor: pointer; font-size: 13.5px; }
.pop .opt:hover, .pop .opt:focus-visible { background: #27272b; }
.pop .opt .chk { margin-left: auto; color: var(--accent); visibility: hidden; }
.pop .opt[aria-selected="true"] .chk { visibility: visible; }
/* a multiple select: picked options carry their number (the order they run in) or a check */
.pop h4 .n { margin-left: 8px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.pop h4 .mini-link { float: right; border: 0; background: none; color: var(--dim); font: inherit; text-transform: none; letter-spacing: 0; cursor: pointer; padding: 0; }
.pop h4 .mini-link:hover { color: var(--ink); }
.multi-list { max-height: 360px; overflow-y: auto; }
.pop .usein { max-height: min(460px, 70vh); overflow-y: auto; }
.pop .usein details summary { padding: 8px 10px; color: var(--dim); cursor: pointer; font-size: 13px; }
.pop .opt[aria-pressed="true"] { color: var(--ink); background: #1f1f23; }
.pop .opt .pick { margin-left: auto; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 800; }
.pop .opt .pick svg { width: 12px; height: 12px; }
.pop .opt .thumb { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; background: #111; flex: none; }
.pop .opt .thumb img, .pop .opt .thumb video { width: 100%; height: 100%; object-fit: cover; }
.pop .opt .two { display: grid; min-width: 0; }
.pop .opt .two small { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .pad { padding: 8px 10px 10px; display: grid; gap: 10px; }
.pop textarea, .pop input[type="number"], .pop input[type="text"] { width: 100%; background: #111113; border: 1px solid #2e2e33; color: var(--ink); border-radius: 10px; padding: 8px 10px; font: inherit; }
.pop textarea { min-height: 120px; resize: vertical; }
.pop .row { display: flex; gap: 6px; align-items: center; }
.pop .help { color: var(--dim); font-size: 12px; margin: 0; }

/* ranges and switches */
.range { display: grid; gap: 6px; }
.range .top { display: flex; justify-content: space-between; font-size: 13px; }
.range .top b { font-weight: 700; color: var(--ink); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), #333338 var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #333338; }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; margin-top: -6px; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #38383e; transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); background: #11140a; }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* sidebar layout (video and tools) */
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); display: flex; flex-direction: column; border-right: 1px solid #18181b; background: #0c0c0d; min-width: 0; }
.side-tabs { display: flex; gap: 2px; padding: 12px 14px 0; border-bottom: 1px solid #18181b; overflow-x: visible; flex-wrap: wrap; scrollbar-width: none; flex: none; }
.side-tabs::-webkit-scrollbar { display: none; }
.side-tabs button { flex: none; height: 36px; padding: 0 8px; border: 0; background: transparent; color: #9a9aa2; font-weight: 600; font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.side-tabs button:hover { color: var(--ink); }
.side-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.side-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.side-scroll > * { flex: none; min-width: 0; }
.model-card { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 8.5; background: #141416; cursor: pointer; isolation: isolate; flex: none; }
.model-card .media { position: absolute; inset: 0; }
.model-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .1), rgba(0, 0, 0, .72)); z-index: 1; pointer-events: none; }
.model-card .txt { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 2; }
.model-card .txt h3 { margin: 0; font-size: 20px; color: var(--accent); }
.model-card .txt p { margin: 3px 0 0; font-size: 12px; color: #d8d8de; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-card .change { position: absolute; top: 10px; right: 10px; z-index: 2; height: 28px; padding: 0 10px; border-radius: 8px; border: 0; background: rgba(15, 15, 17, .72);
  color: #fff; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; backdrop-filter: blur(8px); }
.model-card .change:hover { background: rgba(40, 40, 44, .9); }
.drop { position: relative; display: grid; place-items: center; align-content: center; text-align: center; gap: 6px; min-height: 132px; padding: 18px; border-radius: 14px; background: #151517;
  border: 1px dashed #2e2e33; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-bg); }
.drop.missing { border-color: var(--bad); animation: shake .35s; }
.drop .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #222226; color: #e4e4e8; font-size: 17px; }
.drop b { font-size: 13.5px; }
.drop small { color: var(--dim); font-size: 12px; }
.drop.has { padding: 0; min-height: 0; border-style: solid; border-color: #26262a; overflow: hidden; display: block; }
.drop.has img, .drop.has video { width: 100%; max-height: 240px; object-fit: contain; background: #0b0b0c; }
.drop.has audio { width: calc(100% - 16px); margin: 10px 8px; }
.drop .bar2 { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.drop .fname { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); font-size: 11.5px; padding: 3px 7px; border-radius: 6px; background: rgba(0, 0, 0, .6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: #151517; border: 1px solid #1d1d20; }
.field > .lbl { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: #e4e4e8; }
.field > .lbl small { color: var(--faint); font-weight: 500; }
.field textarea { width: 100%; min-height: 96px; resize: vertical; border: 0; outline: none; background: transparent; color: var(--ink); font: 14px/1.5 var(--font); padding: 0; }
.field textarea.short { min-height: 56px; }
.field textarea::placeholder { color: #6e6e77; }
.field textarea.missing::placeholder { color: var(--bad); }
.field input[type="text"], .field input[type="number"] { width: 100%; background: #0f0f11; border: 1px solid #2a2a2f; color: var(--ink); border-radius: 10px; padding: 8px 10px; font: inherit; }
.field .help { margin: 0; color: var(--dim); font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 11px; background: #0f0f11; }
.seg button { flex: 1 1 auto; min-width: 0; min-height: 30px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: #a9a9b1; font-weight: 600; font-size: 12.5px; cursor: pointer; line-height: 1.25; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: #2a2a2f; color: var(--ink); }
.seg.modes button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg.modes svg { width: 15px; height: 15px; }
.side-scroll > .seg.modes { margin: 2px 0 4px; }
.cmp-row > .seg.modes { flex: none; padding: 2px; }
.cmp-row > .seg.modes button { min-height: 28px; padding: 4px 10px; }
.selrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 0;
  background: #0f0f11; color: var(--ink); cursor: pointer; font-size: 13.5px; }
.selrow:hover { background: #18181b; }
.selrow .v { display: flex; align-items: center; gap: 6px; color: #d8d8de; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.togrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.togrow .t { display: grid; }
.togrow .t small { color: var(--dim); font-size: 12px; }
details.adv { border-radius: 14px; background: #151517; border: 1px solid #1d1d20; }
details.adv > summary { list-style: none; cursor: pointer; padding: 12px; font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: space-between; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv[open] > summary .i-chev { transform: rotate(180deg); }
details.adv > .in { padding: 0 12px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
details.adv > .in > .field { background: #111113; }
.side-foot { flex: none; padding: 12px 14px 14px; border-top: 1px solid #18181b; display: grid; gap: 8px; background: #0c0c0d; }
.side-foot .row { display: flex; gap: 8px; align-items: center; }
.side-foot .row .generate { flex: 1; min-width: 0; justify-content: center; padding: 0 14px; }
.side-note { margin: 0; font-size: 12px; color: var(--dim); text-align: center; }
.side-note.err { color: var(--bad); text-align: left; white-space: pre-wrap; }

/* workspace hero (empty history) */
.ws-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: center; padding: 22px; border-radius: var(--r-xl);
  background: radial-gradient(120% 140% at 0% 0%, var(--accent-bg) 0%, #111113 60%); border: 1px solid var(--accent-line); }
.ws-hero h1 { margin: 0; font-size: clamp(28px, 3.2vw, 46px); }
.ws-hero p { margin: 12px 0 0; color: #c2c2c9; max-width: 50ch; }
.ws-hero .row { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.ws-hero .flow { display: flex; gap: 10px; align-items: center; justify-content: flex-end; min-width: 0; }
.ws-hero .flow .ins { display: grid; gap: 8px; flex: none; width: 26%; }
.ws-hero .flow .ins .media { border-radius: 10px; aspect-ratio: 1 / 1; }
.ws-hero .flow .arrow { color: var(--accent); font-size: 20px; flex: none; }
.ws-hero .flow .out { flex: 1; min-width: 0; border-radius: 14px; overflow: hidden; }
.ws-hero .flow .out .media { aspect-ratio: 16 / 10; }
.ws-hero .flow .out .media.audio { display: grid; place-items: center; }
.ws-hero .flow .out .media.audio > img { height: auto; object-fit: contain; padding: 0 12px; }

/* how it works */
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.card { padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid #1d1d20; display: grid; gap: 10px; align-content: start; }
.card h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.card p { margin: 0; color: var(--dim); font-size: 13px; }
table.models { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.models td { padding: 7px 4px; border-top: 1px solid var(--line); vertical-align: top; }
table.models td:first-child { overflow-wrap: anywhere; }
table.models td.r { text-align: right; white-space: nowrap; color: var(--dim); }
.vbar { position: relative; height: 10px; border-radius: 6px; background: #222226; overflow: visible; }
.vbar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent-vbar), var(--accent)); }
.vbar > i.whole { background: rgba(255, 255, 255, .14); }
.vbar > b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--pink); border-radius: 2px; }
.vbar > u { position: absolute; top: -6px; bottom: -6px; width: 1px; background: #55555c; }
.fit { font-size: 12px; font-weight: 700; }
.fit.ok { color: var(--ok); } .fit.tight { color: var(--warn); } .fit.big { color: var(--violet); }

/* library and examples */
.ex-big { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; padding: 16px; border-radius: var(--r-xl); background: var(--panel); border: 1px solid #1d1d20; }
.ex-big .stage { border-radius: 14px; overflow: hidden; background: #0b0b0c; display: grid; place-items: center; min-height: 240px; }
.ex-big .stage img, .ex-big .stage video { width: 100%; max-height: 70vh; object-fit: contain; }
.ex-big .stage audio { width: 90%; }
.ex-big .stage .audio-box { width: 92%; display: grid; gap: 12px; padding: 20px 0; }
.ex-big .side2 { display: grid; gap: 14px; align-content: start; }
.ins-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ins-row figure { margin: 0; width: 92px; display: grid; gap: 4px; }
.ins-row .media { width: 92px; height: 92px; border-radius: 10px; }
.ins-row figcaption { font-size: 11.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dl.vals { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; }
dl.vals dt { color: var(--dim); }
dl.vals dd { margin: 0; overflow-wrap: anywhere; }
.statline { display: flex; gap: 6px; flex-wrap: wrap; }
.statline span { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 8px; background: #1f1f23; color: #cfcfd6; font-size: 12px; font-weight: 600; }

/* vram map */
.vtable { display: grid; gap: 6px; }
.vrow { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 140px; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid #1c1c1f; cursor: pointer; }
.vrow:hover { border-color: #33333a; }
.vrow .nm { display: grid; } .vrow .nm small { color: var(--dim); font-size: 12px; }
.vscale { position: relative; height: 18px; margin: 0 0 4px; font-size: 11px; color: var(--faint); }
.vscale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--dim); }
.legend i { display: inline-block; width: 18px; height: 8px; border-radius: 4px; vertical-align: middle; margin-right: 6px; }

/* ------------------------------------------------------------------ viewer modal and compare */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(5, 5, 6, .9); backdrop-filter: blur(10px); display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal .stage { position: relative; display: grid; place-items: center; padding: 56px 64px; min-width: 0; min-height: 0; }
.modal .stage img, .modal .stage video { max-width: 100%; max-height: calc(100vh - 112px); object-fit: contain; border-radius: 12px; }
.modal .stage .audio-box { width: min(720px, 100%); display: grid; gap: 14px; }
.modal .stage .audio-box img { width: 100%; border-radius: 12px; }
.modal .stage .audio-box audio { width: 100%; }
.modal .close { position: absolute; top: 14px; left: 14px; }
.modal .navb { position: absolute; top: 50%; transform: translateY(-50%); }
.modal .navb.prev { left: 14px; } .modal .navb.next { right: 14px; }
.modal .round { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #1d1d20; color: #fff; display: grid; place-items: center; cursor: pointer; font-size: 18px; }
.modal .round:hover { background: #2c2c30; }
.modal aside { background: #111113; border-left: 1px solid #1e1e21; padding: 18px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.modal aside .approw { display: flex; align-items: center; gap: 10px; }
.modal aside .approw .media { width: 38px; height: 38px; border-radius: 10px; flex: none; }
.modal aside .approw b { display: block; }
.modal aside .approw small { color: var(--dim); font-size: 12px; }
.modal aside .prompt { padding: 12px; border-radius: 12px; background: #18181b; border: 1px solid #222226; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.modal aside .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modal aside .acts .btn { width: 100%; }
.modal aside .acts .btn.lime { grid-column: 1 / -1; height: 42px; }
.cmpx { position: fixed; inset: 0; z-index: 85; background: #070708; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: fade .18s ease; }
.cmpx header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #18181b; }
.cmpx header h2 { margin: 0; font-size: 18px; }
.cmpx header .grow { flex: 1; }
.cmpx .panes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; min-height: 0; }
.cmpx .pane { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; min-height: 0; border-radius: 16px; background: #0f0f11; border: 1px solid #1c1c1f; padding: 10px; }
.cmpx .pane .lab { display: flex; align-items: center; gap: 8px; }
.cmpx .pane .lab input { background: transparent; border: 0; color: var(--ink); font: 700 14px var(--font); width: 100%; outline: none; }
.cmpx .pane .lab input:focus { box-shadow: 0 1px 0 var(--accent); }
.cmpx .pane .box { display: grid; place-items: center; min-height: 0; overflow: hidden; border-radius: 10px; background: #0a0a0b; }
.cmpx .pane .box img, .cmpx .pane .box video { max-width: 100%; max-height: 100%; object-fit: contain; }
.cmpx .pane .box audio { width: 90%; }
.cmpx .pane .info { font-size: 12px; color: var(--dim); display: flex; gap: 12px; flex-wrap: wrap; }
.cmpx .pane .drop { min-height: 100%; height: 100%; width: 100%; }
.cmpx .wipe { position: relative; margin: 10px; border-radius: 16px; overflow: hidden; background: #0a0a0b; min-height: 0; touch-action: none; cursor: ew-resize; user-select: none; }
.cmpx .wipe img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.cmpx .wipe .handle { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; }
.cmpx .wipe .handle::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.cmpx .wipe .tagl, .cmpx .wipe .tagr { position: absolute; top: 12px; padding: 4px 9px; border-radius: 7px; background: rgba(0, 0, 0, .6); font-size: 12px; font-weight: 700; }
.cmpx .wipe .tagl { left: 12px; } .cmpx .wipe .tagr { right: 12px; }
.cmpx footer { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid #18181b; }
.cmpx footer input[type="range"] { flex: 1; }
.cmpx footer .t { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--dim); min-width: 92px; text-align: right; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .promo { grid-template-columns: 1fr; }
  .ws.l-sidebar { grid-template-columns: 375px minmax(0, 1fr); }
  .hero-row { grid-auto-columns: minmax(300px, 44%); }
}
@media (max-width: 900px) {
  .nav-main .opt-hide { display: none; }
  .modal { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; overflow-y: auto; }
  .modal .stage { padding: 56px 12px 12px; }
  .modal .stage img, .modal .stage video { max-height: 60vh; }
  .modal aside { border-left: 0; border-top: 1px solid #1e1e21; }
  .ws-hero { grid-template-columns: 1fr; }
  .ws-hero .flow { justify-content: flex-start; }
  .ex-big { grid-template-columns: 1fr; }
  .vrow { grid-template-columns: 1fr; gap: 8px; }
}
@media (max-width: 760px) {
  :root { --top: 52px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .logo .word { display: none; }
  .nav-right .cta, .nav-right .gpu .lbl-long { display: none; }
  .nav-main { display: none; }
  .icon-btn.menu-btn { display: inline-grid; }
  .ws-top .right { display: none; }
  .search { width: 100%; }
  .page { padding: 18px 16px 80px; }
  .hero-wrap { margin: 0 -16px; }
  .hero-row { grid-auto-columns: 84%; padding: 0 16px; scroll-padding: 0 16px; }
  .hero-nav { display: none; }
  .tiles6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how { grid-template-columns: 1fr; }
  .ws.l-sidebar { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid #18181b; }
  .side-scroll { overflow: visible; }
  .ws-main { padding: 12px 16px 30px; }
  .ws.l-composer .ws-main { padding-bottom: 260px; }
  .composer { bottom: 10px; width: calc(100% - 20px); border-radius: 18px; padding: 10px; }
  .generate { height: 42px; padding: 0 16px; }
  .cmp-row .grow { display: none; }
  .cmp-row .generate { margin-left: auto; }
  .cmpx .panes { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .app-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* gallery selects (the effects): a picker of cards and a wall on Explore, each card playing its lab example */
.pop.wide { max-width: min(640px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 100px)); }
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 2px 6px 8px; }
.fx-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.fx-tile { display: grid; gap: 6px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; min-width: 0; }
.fx-tile .media { aspect-ratio: 3 / 4; border-radius: var(--r); background: var(--panel-3); outline: 2px solid transparent; outline-offset: 2px;
  transition: outline-color .15s var(--ease); }
.fx-tile .media .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #3a3a40; font-size: 26px; }
.fx-tile .lbl { font-size: 12.5px; font-weight: 600; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-tile:hover .lbl, .fx-tile:focus-visible .lbl, .fx-tile[aria-pressed="true"] .lbl { color: var(--ink); }
.fx-tile:hover .media { outline-color: var(--line-2); }
.fx-tile[aria-pressed="true"] .media { outline-color: var(--accent); }
.fx-wall .fx-tile .media { border-radius: var(--r-lg); }
.fx-wall .fx-tile .lbl { font-size: 13.5px; color: var(--ink); }
.fx-cell { position: relative; min-width: 0; }
.fx-cell > .fx-tile { width: 100%; }
.fx-cell > .flag, .m-item > .flag { position: absolute; top: 6px; right: 6px; z-index: 2; opacity: 0; transition: opacity .15s var(--ease); }
.fx-cell:hover > .flag, .fx-cell:focus-within > .flag, .m-item:hover > .flag, .m-item:focus-within > .flag, .flag[aria-pressed="true"] { opacity: 1; }
.mini.flag[aria-pressed="true"] { background: var(--pink); color: #2b0716; }
.btn.flag[aria-pressed="true"] { background: var(--pink); color: #2b0716; border-color: transparent; }
.fx-now { border-radius: var(--r); overflow: hidden; }
.fx-now .media { aspect-ratio: 4 / 3; }

/* hosted demo: the "Start here" row on Explore */
.start5 { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 30px; }
.start-card { display: grid; gap: 4px; padding: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.start-card:hover, .start-card:focus-visible { border-color: var(--accent); }
.start-card .media { aspect-ratio: 4 / 3; overflow: hidden; margin-bottom: 6px; }
.start-card .media > img, .start-card .media > video { width: 100%; height: 100%; object-fit: cover; }
.start-card .nm { padding: 0 12px; font-weight: 600; font-size: 14.5px; }
.start-card .dim { padding: 0 12px; font-size: 12.5px; color: var(--dim); }

/* top-bar menus (menu.js): hover Image, Video or Audio for every app of that studio and the models behind them */
.mm { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0 auto; width: min(1240px, calc(100vw - 24px)); z-index: 45;
  max-height: calc(100vh - var(--top) - 22px); overflow: auto; overscroll-behavior: contain; background: #121214; border: 1px solid #26262b;
  border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .65); animation: rise .14s var(--ease); }
.mm[data-studio="audio"] { width: min(760px, calc(100vw - 24px)); }
.mm-inner { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 12px 22px; padding: 18px 18px 14px; }
.mm-audio { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mm h4 { display: flex; align-items: baseline; gap: 8px; margin: 0 8px 10px; font-size: 12.5px; font-weight: 500; color: var(--dim); }
.mm h4 .n { color: var(--faint); font-size: 12px; }
.mm h5 { margin: 6px 8px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.mm-cols { columns: 3 230px; column-gap: 14px; }
.mm-cols.one { columns: 1; }
.mm-group { break-inside: avoid; padding-bottom: 12px; }
.mm-models { border-left: 1px solid var(--line); padding-left: 18px; align-self: start; position: sticky; top: 0; }
.mm-item { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 6px 8px; border-radius: 10px; color: var(--ink); }
.mm-item:hover, .mm-item:focus-visible { background: #1d1d21; }
.mm-item[aria-current="page"] .nm { color: var(--accent); }
.mm-thumb { display: grid; place-items: center; width: 38px; height: 38px; flex: none; overflow: hidden; border-radius: 9px; background: #1a1a1d;
  box-shadow: inset 0 0 0 1px #27272c; color: var(--dim); font-size: 17px; }
.mm-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.mm-thumb.glyph { color: #d6d6db; }
.mm-txt { display: grid; gap: 1px; min-width: 0; }
.mm-item.model .mm-txt { flex: 1; }
.mm-txt b { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; font-weight: 600; }
.mm-txt .nm, .mm-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-txt small { font-size: 12px; color: var(--dim); }
.mm .tag { height: 16px; padding: 0 5px; font-size: 9.5px; flex: none; }
.mm-txt b .n { margin-left: auto; padding-left: 6px; font-size: 11.5px; font-weight: 500; color: var(--faint); flex: none; }
@media (max-width: 1000px) {
  .mm-inner, .mm-audio { grid-template-columns: minmax(0, 1fr); }
  .mm-models { border-left: 0; border-top: 1px solid var(--line); padding: 14px 0 0; position: static; }
}
@media (max-width: 760px) { .mm { display: none; } }

/* the brush for painted inputs (paint.js, inpaint): the mask is drawn at the photo's own size, shown as a tint */
.drop.paint { overflow: hidden; }
.drop.paint > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; pointer-events: none; }
.drop.paint > :not(img) { position: relative; }
.drop.paint.off { opacity: .6; cursor: not-allowed; }
.drop.has canvas.mask-preview { display: block; width: 100%; max-height: 240px; object-fit: contain; background: #0b0b0c; }
.painter { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .78); animation: rise .14s var(--ease); }
.pt-box { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; width: min(1100px, 100%); height: min(860px, 100%); padding: 16px;
  background: #151517; border: 1px solid #2a2a2f; border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.pt-box header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pt-box h3 { margin: 0 0 2px; font-size: 16px; }
.pt-box .help { margin: 0; color: var(--dim); font-size: 12.5px; }
.pt-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; border-radius: 12px; background: #0b0b0c; }
.pt-canvas { display: block; touch-action: none; cursor: none; }
.pt-cursor { position: absolute; border: 2px solid var(--accent); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.pt-box footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pt-size { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dim); }
.pt-size input { width: 140px; }

/* === HILLFIELD MODEL CATALOGUE START === */
/* One catalogue, every box. Tokens come from app.css; no new palette. */
.models-page { max-width: 1640px; }
.mdl-shell { display: grid; gap: 16px; min-width: 0; }
.mdl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.mdl-head h1 { margin: 0; font-size: clamp(34px, 4.4vw, 58px); }
.mdl-head p { margin: 8px 0 0; font-size: 13.5px; }
.mdl-stats { display: flex; flex-wrap: wrap; gap: 7px 18px; margin-top: 12px; color: var(--dim); font-size: 12.5px; }
.mdl-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mdl-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mdl-toolbar { position: sticky; top: var(--top); z-index: 22; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; background: linear-gradient(var(--bg) 72%, rgba(9, 9, 10, .72)); }
.mdl-search { flex: 1 1 300px; display: flex; align-items: center; gap: 8px; min-width: 0; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 12px; background: #111113; color: var(--dim); }
.mdl-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mdl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.mdl-search input::placeholder { color: var(--faint); }
.mdl-search input::-webkit-search-cancel-button { filter: invert(.6); }
.mdl-layouts { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: #0f0f11; border: 1px solid #1b1b20; flex-wrap: wrap; }
.mdl-layout { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border: 0; border-radius: 8px;
  background: transparent; color: #a9a9b1; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.mdl-layout:hover { color: var(--ink); }
.mdl-layout[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent-line); }
.mdl-layout svg { width: 14px; height: 14px; }
.mdl-body { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 22px; align-items: start; min-width: 0; }
.mdl-facets { position: sticky; top: calc(var(--top) + 64px); max-height: calc(100vh - var(--top) - 78px); overflow: auto; padding: 2px 8px 8px 0; }
.mdl-facets-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0 8px; }
.mdl-facets-head b { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.mdl-link { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--dim); font: inherit;
  font-size: 12px; font-weight: 600; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.mdl-link:hover { color: var(--ink); background: #1a1a1e; }
.mdl-facet { border-top: 1px solid #1b1b1f; padding: 7px 0; }
.mdl-facet summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; color: #d4d4d9; font-size: 12.5px; font-weight: 600; list-style: none; padding: 3px 2px; }
.mdl-facet summary::-webkit-details-marker { display: none; }
.mdl-facet summary b { color: var(--faint); font-size: 11.5px; font-weight: 600; }
.mdl-facet-list { display: grid; gap: 2px; padding: 3px 0 2px; }
.mdl-facet-btn { display: flex; justify-content: space-between; gap: 8px; width: 100%; min-height: 26px; padding: 3px 7px; border: 0; border-radius: 6px;
  background: transparent; color: #b8b8c0; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.mdl-facet-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-facet-btn b { color: var(--faint); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.mdl-facet-btn:hover { color: var(--ink); background: #1a1a1e; }
.mdl-facet-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }
.mdl-facet-btn[aria-pressed="true"] b { color: var(--accent); }
.mdl-content { min-width: 0; display: grid; gap: 12px; }
.mdl-content-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mdl-count { color: var(--dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mdl-export { display: flex; gap: 3px; align-items: center; }
.mdl-grid { display: grid; gap: 12px; min-width: 0; }
.mdl-grid.poster { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }
.mdl-grid.dense { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
.mdl-card { display: grid; grid-template-rows: auto 1fr; min-width: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--ink); text-align: left; overflow: hidden; cursor: pointer; }
.mdl-card:hover { border-color: var(--line-2); background: #19191c; transform: translateY(-1px); }
.mdl-thumb { position: relative; display: block; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; background: #101012; }
.mdl-grid.dense .mdl-thumb { aspect-ratio: 1 / 1; }
.mdl-thumb img, .mdl-thumb video { width: 100%; height: 100%; object-fit: cover; }
.mdl-thumb.monogram { display: grid; place-items: center; align-content: center; gap: 4px; background:
  radial-gradient(120% 90% at 30% 10%, var(--accent-soft), transparent 60%), linear-gradient(155deg, #1d1d22, #0f0f11); }
.mdl-thumb.monogram span { font-family: var(--display); font-weight: 800; font-stretch: 118%; font-size: 30px; letter-spacing: .02em; color: #d8d8dd; }
.mdl-thumb.monogram small { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.mdl-thumb.monogram.lora { background: radial-gradient(120% 90% at 30% 10%, rgba(180, 156, 255, .2), transparent 60%), linear-gradient(155deg, #1d1d22, #0f0f11); }
.mdl-thumb.monogram.vae { background: radial-gradient(120% 90% at 30% 10%, rgba(255, 198, 92, .16), transparent 60%), linear-gradient(155deg, #1d1d22, #0f0f11); }
.mdl-thumb.monogram.aux { background: radial-gradient(120% 90% at 30% 10%, rgba(155, 155, 163, .14), transparent 60%), linear-gradient(155deg, #1d1d22, #0f0f11); }
.mdl-flag { position: absolute; top: 7px; left: 7px; padding: 2px 6px; border-radius: 5px; background: rgba(0, 0, 0, .66); color: var(--ink);
  font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; backdrop-filter: blur(5px); }
.mdl-card-body { display: grid; gap: 4px; min-width: 0; padding: 9px 10px 10px; }
.mdl-card-body b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-card-sub { color: var(--dim); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-card-foot { display: flex; align-items: center; gap: 5px; color: var(--faint); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.mdl-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }
.mdl-chips { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.mdl-card .mdl-chips { margin-top: 2px; }
.mdl-chip { display: inline-flex; align-items: center; max-width: 100%; height: 17px; padding: 0 5px; border-radius: 4px;
  background: #242429; color: #bdbdc5; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mdl-chip.on { background: var(--accent-soft); color: var(--accent); }
.mdl-chip.off { background: #1d1d21; color: var(--faint); }
.mdl-chip.lab { background: rgba(180, 156, 255, .16); color: var(--violet); }
.mdl-chip.retired { background: rgba(255, 107, 94, .14); color: var(--bad); }
.mdl-chip.aux { background: rgba(255, 198, 92, .12); color: var(--warn); }
.mdl-chip.alias { background: rgba(180, 156, 255, .12); color: var(--violet); }
.mdl-chip.note { background: rgba(255, 198, 92, .12); color: var(--warn); }
.mdl-chip.ghost { background: transparent; color: var(--dim); box-shadow: inset 0 0 0 1px var(--line-2); }
.mdl-rows { display: grid; gap: 5px; }
.mdl-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 90px 150px 76px auto; align-items: center; gap: 12px; width: 100%;
  min-height: 58px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); text-align: left; cursor: pointer; }
.mdl-row:hover { background: #19191c; border-color: var(--line-2); }
.mdl-row .mdl-thumb { width: 46px; aspect-ratio: 1 / 1; border-radius: 8px; }
.mdl-row .mdl-thumb.monogram span { font-size: 15px; }
.mdl-row .mdl-thumb.monogram small { display: none; }
.mdl-row-main { display: grid; gap: 2px; min-width: 0; }
.mdl-row-main b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-row-main span { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-row-role, .mdl-row-base, .mdl-row-size { color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-row-size { text-align: right; font-variant-numeric: tabular-nums; }
.mdl-family { display: grid; gap: 20px; min-width: 0; }
.mdl-family-sec { display: grid; gap: 8px; min-width: 0; padding-bottom: 16px; border-bottom: 1px solid #1b1b1f; }
.mdl-family-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mdl-family-head h2 { margin: 0; font-family: var(--display); font-weight: 800; font-stretch: 118%; text-transform: uppercase; font-size: 20px; letter-spacing: -.01em; }
.mdl-growth { flex: 1; }
.mdl-role-sec { display: grid; gap: 6px; }
.mdl-role-sec h3 { display: flex; align-items: center; gap: 7px; margin: 2px 0 0; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.mdl-table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.mdl-table { width: 100%; min-width: 1120px; border-collapse: collapse; font-size: 12px; }
.mdl-table th { position: sticky; top: 0; z-index: 2; padding: 0; background: #17171a; border-bottom: 1px solid var(--line-2); text-align: left; }
.mdl-table th:first-child { padding-left: 10px; }
.mdl-sort { display: inline-flex; align-items: center; gap: 4px; width: 100%; padding: 9px 8px; border: 0; background: transparent; color: var(--dim);
  font: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; text-align: left; cursor: pointer; white-space: nowrap; }
.mdl-sort:hover, .mdl-sort.on { color: var(--ink); }
.mdl-sort svg { width: 11px; height: 11px; }
.mdl-table td { padding: 7px 8px; border-bottom: 1px solid #1c1c20; color: #d7d7dc; vertical-align: middle; }
.mdl-table tr:last-child td { border-bottom: 0; }
.mdl-table tbody tr { cursor: pointer; }
.mdl-table tbody tr:hover { background: #1a1a1e; }
.mdl-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mdl-table td small { font-size: 10.5px; }
.mdl-model-cell { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.mdl-model-cell .mdl-thumb { width: 34px; aspect-ratio: 1 / 1; border-radius: 7px; flex: none; }
.mdl-model-cell .mdl-thumb.monogram span { font-size: 11px; }
.mdl-model-cell .mdl-thumb.monogram small { display: none; }
.mdl-model-cell > span { display: grid; gap: 1px; min-width: 0; }
.mdl-model-cell b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-model-cell small { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.mdl-unknown { color: var(--warn); font-size: 11px; }
.mdl-empty { display: grid; place-items: center; gap: 8px; padding: 60px 20px; border: 1px dashed var(--line-2); border-radius: 14px; color: var(--dim); text-align: center; }
.mdl-empty svg { width: 30px; height: 30px; color: var(--faint); }
.mdl-empty b { color: var(--ink); font-size: 14px; }
.mdl-empty p { margin: 0; max-width: 620px; font-size: 12.5px; }
.mdl-overlay { position: fixed; inset: 0; z-index: 88; background: rgba(0, 0, 0, .58); backdrop-filter: blur(3px); }
.mdl-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 89; width: min(540px, 100vw); display: flex; flex-direction: column;
  background: #121214; border-left: 1px solid var(--line-2); box-shadow: -24px 0 60px rgba(0, 0, 0, .5); overflow: hidden; }
.mdl-drawer-close { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line-2); border-radius: 10px; background: rgba(10, 10, 12, .7); color: var(--ink); cursor: pointer; }
.mdl-drawer-close:hover { background: #232328; }
.mdl-drawer-body { display: grid; gap: 18px; padding: 18px 20px 26px; overflow: auto; }
.mdl-drawer-top { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: start; padding-right: 34px; }
.mdl-drawer-top .mdl-thumb { aspect-ratio: 1 / 1; border-radius: 12px; }
.mdl-drawer-top .mdl-thumb.monogram span { font-size: 26px; }
.mdl-drawer-top h2 { margin: 2px 0 6px; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.mdl-path { margin: 0 0 8px; color: var(--faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; overflow-wrap: anywhere; }
.mdl-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mdl-sec { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid #1e1e23; }
.mdl-sec h3 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.mdl-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #1e1e23; border: 1px solid #1e1e23; border-radius: 10px; overflow: hidden; }
.mdl-fact { display: grid; gap: 2px; min-width: 0; padding: 8px 10px; background: #161619; }
.mdl-fact span { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.mdl-fact b { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-prov-list { display: grid; gap: 2px; }
.mdl-prov { color: var(--faint); font-size: 10px; overflow-wrap: anywhere; }
.mdl-apps { display: flex; flex-wrap: wrap; gap: 4px; }
.mdl-app { display: inline-flex; align-items: center; gap: 5px; height: 27px; padding: 0 9px; border-radius: 7px; background: #1d1d22; color: #d4d4da; font-size: 11.5px; font-weight: 600; }
.mdl-app:hover { background: #292930; color: var(--ink); }
.mdl-related { display: grid; gap: 3px; }
.mdl-related-item { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border: 1px solid #202025; border-radius: 8px; background: #161619; color: var(--ink); text-align: left; cursor: pointer; }
.mdl-related-item:hover { background: #1d1d22; }
.mdl-related-item > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.mdl-related-item small { white-space: nowrap; }
.mdl-authored { display: grid; gap: 4px; }
.mdl-authored-row { display: grid; gap: 3px; padding: 7px 9px; border: 1px solid #202025; border-radius: 8px; background: #161619; }
.mdl-authored-row b { font-size: 11.5px; }
.mdl-authored-row code { color: var(--accent); font-size: 10.5px; overflow-wrap: anywhere; }
.mdl-authored-row small { overflow-wrap: anywhere; }
.mdl-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mdl-field { display: grid; gap: 4px; min-width: 0; }
.mdl-field.wide { grid-column: 1 / -1; }
.mdl-field > span { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.mdl-field > small { color: var(--faint); font-size: 10px; }
.mdl-input { width: 100%; min-width: 0; border: 1px solid #2a2a30; border-radius: 8px; background: #0f0f11; color: var(--ink);
  padding: 7px 9px; font: inherit; font-size: 12px; outline: none; }
.mdl-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.mdl-input { min-height: 60px; resize: vertical; }
.mdl-drawer-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.mdl-drawer-foot .btn { min-width: 128px; }
.mdl-conflict { margin: 0; padding: 9px 10px; border-radius: 8px; background: rgba(255, 107, 94, .1); color: #ffd2ce; font-size: 11.5px; }
.mdl-conflict .mdl-link { color: var(--ink); text-decoration: underline; }
@media (max-width: 1040px) {
  .mdl-body { grid-template-columns: 1fr; }
  .mdl-facets { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; padding: 0; }
  .mdl-facets-head { grid-column: 1 / -1; }
  .mdl-facet { border-top: 1px solid #1b1b1f; }
}
@media (max-width: 760px) {
  .mdl-toolbar { position: static; }
  .mdl-layout span { display: none; }
  .mdl-layout { padding: 0 10px; }
  .mdl-grid.poster { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
  .mdl-grid.dense { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); }
  .mdl-row { grid-template-columns: 42px minmax(0, 1fr) 72px auto; gap: 8px; }
  .mdl-row-role, .mdl-row-base { display: none; }
  .mdl-drawer-top { grid-template-columns: 92px minmax(0, 1fr); }
  .mdl-facts { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .models-page { padding-left: 14px; padding-right: 14px; }
  .mdl-head-actions { width: 100%; }
  .mdl-grid.poster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mdl-grid.dense { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mdl-form { grid-template-columns: 1fr; }
  .mdl-field.wide { grid-column: auto; }
  .mdl-row { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .mdl-row-size { display: none; }
}
/* === HILLFIELD MODEL CATALOGUE END === */

/* ------------------------------------------------------------------ accent color picker */
.accent-btn { position: relative; }
.accent-btn .accent-swatch {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22), 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform .15s ease, box-shadow .15s ease;
}
.accent-btn:hover .accent-swatch {
  transform: scale(1.1);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.accent-native-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.pop.accent-popover {
  padding: 14px;
  width: 278px;
  box-sizing: border-box;
}
.accent-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.accent-pop-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}
.accent-pop-title svg {
  color: var(--accent);
}
.accent-reset-link {
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.accent-reset-link:hover {
  color: var(--ink);
  background: #202024;
}

/* 2D Canvas Area */
.accent-canvas-wrap {
  position: relative;
  width: 250px;
  height: 130px;
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}
.accent-2d-canvas {
  display: block;
  width: 250px;
  height: 130px;
}
.accent-crosshair {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* Sliders */
.accent-sliders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.accent-slider-row {
  display: grid;
  grid-template-columns: 58px 1fr 34px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}
.accent-slider-row label {
  color: var(--dim);
  font-weight: 600;
}
.accent-slider-val {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.accent-slider-row input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background: #232328;
  cursor: pointer;
}
.accent-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #151517;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.accent-slider-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #151517;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.accent-hue-slider {
  background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%) !important;
}
.accent-chroma-slider {
  background: linear-gradient(to right, #808080, var(--slider-hue, #ff0000)) !important;
}
.accent-light-slider {
  background: linear-gradient(to right, #000000, var(--slider-hue, #ff0000), #ffffff) !important;
}

/* Bottom hex & system button */
.accent-pop-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.accent-hex-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #111113;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 4px 8px;
  flex: 1;
}
.accent-preview-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.accent-hex-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  text-transform: uppercase;
}
.accent-sys-btn {
  flex: none;
  height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
  gap: 5px;
}

/* Presets row */
.accent-presets {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.accent-preset-chip {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: transform .12s ease;
}
.accent-preset-chip:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 1.5px #ffffff;
}

/* === HILLFIELD REDESIGN: ZERO HORIZONTAL SCROLL & RESPONSIVE GROUPING === */
html, body {
  overflow-x: clip;
  max-width: 100vw;
}
.topbar {
  height: auto;
  min-height: var(--top);
  flex-wrap: wrap;
  padding: 8px 18px;
  row-gap: 6px;
}
.nav-main {
  flex-wrap: wrap;
  overflow: visible;
  overflow-x: visible;
  flex: 1 1 auto;
}
.nav-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.side-tabs {
  flex-wrap: wrap;
  overflow: visible;
  overflow-x: visible;
  gap: 4px;
  padding: 10px 12px;
}
.side-tabs button {
  flex: 1 1 auto;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border-bottom: 0;
  margin-bottom: 0;
  background: #151517;
  text-align: center;
}
.side-tabs button:hover {
  background: #1d1d21;
}
.side-tabs button[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-color: transparent;
}
.seg {
  flex-wrap: wrap;
  height: auto;
  min-height: 36px;
  gap: 3px;
  padding: 3px;
}
.seg button {
  flex: 1 1 auto;
  min-height: 28px;
  padding: 4px 8px;
  white-space: normal;
  line-height: 1.15;
}
.ws-top {
  height: auto;
  min-height: 50px;
  flex-wrap: wrap;
  padding: 8px 20px;
  gap: 8px;
}
.tabs {
  flex-wrap: wrap;
  overflow: visible;
  overflow-x: visible;
  max-width: 100%;
}
.tabs button {
  flex: 1 1 auto;
  justify-content: center;
}
.pills {
  flex-wrap: wrap !important;
  overflow: visible !important;
  overflow-x: visible !important;
}
.hero-row {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  overflow: visible;
  overflow-x: visible;
  scroll-snap-type: none;
}
.hero-nav {
  display: none;
}

/* === HILLFIELD REDESIGN: +25% SIDEBAR WIDTH & MODEL TABS === */
.ws.l-sidebar {
  grid-template-columns: 425px minmax(0, 1fr);
}
@media (max-width: 1180px) {
  .ws.l-sidebar {
    grid-template-columns: 375px minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .ws.l-sidebar {
    grid-template-columns: 1fr;
  }
}
.model-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: #141417;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.model-tabs button {
  flex: 1 1 auto;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background .12s, color .12s;
  text-align: center;
}
.model-tabs button:hover {
  color: var(--ink);
  background: #1d1d22;
}
.model-tabs button[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-soft-2);
}

/* === HILLFIELD REDESIGN: EDITABLE SLIDER NUM, 1-100 QUEUE COUNT & MULTI-LORA STACK === */
.range .top {
  align-items: center;
  gap: 8px;
}
.field input[type="number"].range-num,
input[type="number"].range-num {
  width: 72px;
  height: 26px;
  padding: 2px 6px;
  border-radius: 7px;
  background: #0f0f11;
  border: 1px solid #2a2a2f;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.field input[type="number"].range-num:focus,
input[type="number"].range-num:focus {
  outline: none;
  border-color: var(--accent);
}
.side-foot .row {
  flex-wrap: wrap;
}
.count-box {
  display: contents;
}
.count {
  height: 46px;
  padding: 0 6px;
  gap: 4px;
}
input[type="number"].count-num {
  width: 46px;
  height: 30px;
  padding: 0 4px;
  border: 1px solid #35353c;
  border-radius: 7px;
  background: #161619;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
input[type="number"].count-num::-webkit-outer-spin-button,
input[type="number"].count-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.count-max {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  margin-right: 2px;
}
.count-presets {
  order: -1;
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.count-chip {
  flex: 1 1 auto;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid #26262b;
  background: #151518;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.count-chip:hover {
  color: var(--ink);
  border-color: #3a3a42;
}
.count-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--ink);
  border-color: var(--accent);
}
.lora-stack {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed #26262c;
}
.lora-stack-item {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #101012;
  border: 1px solid #242429;
}
.lora-stack-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lora-stack-head .selrow {
  height: 32px;
  font-size: 12.5px;
  background: #17171b;
  flex: 1;
  min-width: 0;
}
.lora-stack-rm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 0;
  background: #1d1d22;
  color: var(--dim);
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  flex: none;
}
.lora-stack-rm:hover {
  background: rgba(255, 107, 94, 0.2);
  color: var(--bad);
}
.lora-add {
  justify-self: start;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px dashed #34343c;
  background: #121215;
  color: var(--dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lora-add:hover {
  border-color: var(--accent);
  color: var(--ink);
}

/* === HILLFIELD STUDIO SHELL, ZERO-SCROLL COMPOSER, DETAIL DIALOG & FLOW CANVAS START === */
:root {
  --rail-w: 56px;
  --head-h: 52px;
  --top: 0px;
}

body {
  padding-left: var(--rail-w);
  min-height: 100vh;
  overflow-x: clip;
}

.view {
  min-height: 100vh;
}

/* Hide scrollbars on inline-scrollable zones and popovers */
.no-scroll-pop,
.cmp-lora-zone,
.cmp-textarea,
.cmp-adv-drawer,
.flow-node-carousel,
.fnp-input {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scroll-pop::-webkit-scrollbar,
.cmp-lora-zone::-webkit-scrollbar,
.cmp-textarea::-webkit-scrollbar,
.cmp-adv-drawer::-webkit-scrollbar,
.flow-node-carousel::-webkit-scrollbar,
.fnp-input::-webkit-scrollbar {
  display: none;
}

/* ------------------------------------------------------------------ 1. Fixed Icon-Only Left Side Rail (56px) */
.siderail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 60;
  background: #0b0b0d;
  border-right: 1px solid #1b1b1f;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 12px;
  gap: 8px;
  user-select: none;
}

.rail-logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  margin-bottom: 4px;
  position: relative;
}
.rail-logo .mark {
  width: 30px;
  height: 30px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.rail-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.rail-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 0;
  background: transparent;
  color: #8f8f99;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
  transition: background .14s, color .14s;
}
.rail-btn:hover {
  background: #18181c;
  color: var(--ink);
}
.rail-btn[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* Hover tooltip on side rail icons */
.rail-btn[data-tip]::after,
.rail-logo[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: #1b1b1f;
  border: 1px solid #2d2d34;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s, transform .12s;
  z-index: 80;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}
.rail-btn[data-tip]:hover::after,
.rail-logo[data-tip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Attached [+] button on outer edge of Side Rail next to Flow Canvas icon */
.rail-flow-wrap {
  position: relative;
  display: grid;
  place-items: center;
}
.rail-flow-add {
  position: absolute;
  left: calc(100% + 7px);
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #383842;
  background: #141418;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  z-index: 65;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .55);
  transition: background .14s, border-color .14s, transform .12s;
}
.rail-flow-add:hover,
.rail-flow-add[aria-expanded="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* GPU status dot on rail icon */
.rail-gpu-dot {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5b5b63;
  box-shadow: 0 0 0 2px #0b0b0d;
}
.rail-gpu.warm .rail-gpu-dot { background: var(--ok); }
.rail-gpu.waking .rail-gpu-dot { background: var(--warn); animation: pulse 1.1s infinite; }
.rail-gpu.error .rail-gpu-dot,
.rail-gpu.off .rail-gpu-dot { background: var(--bad); }

/* ------------------------------------------------------------------ 2. Uniform 52px Stage Header */
.surface-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.stage-header {
  position: sticky;
  top: 0;
  z-index: 35;
  height: var(--head-h);
  min-height: var(--head-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: rgba(11, 11, 13, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid #1b1b1f;
}

.sh-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sh-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: wrap;
}

.sh-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sh-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.sh-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: #a6a6b0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sh-pill:hover {
  background: #18181d;
  color: var(--ink);
}
.sh-pill[aria-pressed="true"] {
  background: #222228;
  color: var(--ink);
}

/* Mode Icon Buttons: icon-only with temporary label reveal on hover / active */
.sh-mode-ic {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: #141418;
  color: #9e9ea8;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.sh-mode-ic:hover {
  background: #1d1d23;
  color: var(--ink);
}
.sh-mode-ic[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--ink);
  border-color: var(--accent-line);
}
.sh-mode-all {
  font-size: 12px;
  font-weight: 700;
}

/* Direct 1-click subtool pills in Stage Header */
.sh-sub-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #9a9aa4;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.sh-sub-pill:hover {
  background: #19191f;
  color: var(--ink);
}
.sh-sub-pill[aria-pressed="true"] {
  background: #23232a;
  color: var(--ink);
  border-color: #34343e;
}

.sh-src-group {
  display: inline-flex;
  background: #131317;
  border: 1px solid #202026;
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.sh-src-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: #9696a0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.sh-src-btn:hover { color: var(--ink); }
.sh-src-btn[aria-pressed="true"] {
  background: #25252c;
  color: var(--ink);
}

.stage-body {
  padding: 16px 20px 60px;
  flex: 1;
}

/* ------------------------------------------------------------------ 3. Studio Workspace & Full-Height Zero-Scroll Composer (100vh) */
.ws-studio {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  min-height: 100vh;
}

.cmp-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0d0d10;
  border-right: 1px solid #1b1b20;
}

/* Uniform 52px Composer Header: Base-grouped Model Selector, no chevron, no scrollbars */
.cmp-header {
  height: var(--head-h);
  min-height: var(--head-h);
  padding: 0 14px;
  border-bottom: 1px solid #1b1b20;
  display: flex;
  align-items: center;
  flex: none;
}

.cmp-model-btn {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #24242b;
  background: #141418;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color .14s, background .14s;
}
.cmp-model-btn:hover {
  background: #1a1a20;
  border-color: #363640;
}
.cmp-base-tag {
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  flex: none;
}
.cmp-model-name {
  font-size: 13.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Base-Grouped Model Popover */
.cmp-model-pop {
  display: grid;
  gap: 8px;
  padding: 4px;
}
.cmp-mgroup {
  display: grid;
  gap: 2px;
}
.cmp-mgroup-head {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  padding: 4px 8px 2px;
}
.cmp-mopt {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.cmp-mopt:hover { background: #24242b; }
.cmp-mopt[aria-selected="true"] {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.cmp-mopt-nm { font-size: 13px; font-weight: 600; }
.cmp-mopt-sub { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Composer Body: structured top-to-bottom without page scroll */
.cmp-body {
  flex: 1;
  min-height: 0;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

/* 1. Top: Single-Row LoRA Zone (capped at 30% max vertical height, inline scroll no scrollbar) */
.cmp-lora-zone {
  max-height: 30%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
.cmp-lora-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 6px 0 10px;
  border-radius: 9px;
  background: #141418;
  border: 1px solid #23232a;
  flex: none;
}
.cmp-lora-name {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  padding: 0;
}
.cmp-lora-name:hover { color: var(--accent); }
.cmp-lora-rm {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex: none;
}
.cmp-lora-rm:hover { background: rgba(255, 107, 94, .18); color: var(--bad); }
.cmp-lora-add {
  align-self: flex-start;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px dashed #2e2e37;
  background: #121216;
  color: #a4a4b0;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.cmp-lora-add:hover { border-color: var(--accent); color: var(--ink); }

/* Minimal - / + Stepper Control */
.stp {
  display: inline-flex;
  align-items: center;
  height: 26px;
  border-radius: 7px;
  background: #1c1c22;
  border: 1px solid #2b2b33;
  padding: 0 2px;
  flex: none;
}
.stp-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  color: #c8c8d2;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0;
}
.stp-btn:hover { background: #2c2c35; color: #fff; }
.stp-val {
  width: 46px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
}

/* 2. Below LoRAs: Low-Ceremony Reference / Input Media Row */
.cmp-ref-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}
.cmp-ref-thumb {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 10px;
  overflow: hidden;
  background: #141418;
  border: 1px solid #2e2e36;
  flex: none;
}
.cmp-ref-thumb img,
.cmp-ref-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cmp-ref-aud {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--accent);
}
.cmp-ref-tag {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .72);
  color: #7dd3fc;
  font-size: 9.5px;
  font-weight: 700;
}
.cmp-ref-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.cmp-ref-mask {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 0;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.cmp-ref-mask.has { background: var(--accent); color: var(--accent-ink); }

.cmp-ref-add {
  position: relative;
  height: 36px;
  min-width: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px dashed #32323b;
  background: #131317;
  color: #9e9ea8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  font-size: 14px;
}
.cmp-ref-add:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.cmp-ref-add.missing {
  border-color: var(--bad);
  color: var(--bad);
  animation: shake .35s;
}
.cmp-ref-plus {
  font-size: 12px;
  font-weight: 800;
}
.cmp-ref-lbl {
  font-size: 12px;
  font-weight: 600;
}

/* 3. Center: Prompt Composer (capped at 30% max vertical height, inline scroll no scrollbar) */
.cmp-prompt-box {
  flex: 1 1 auto;
  max-height: 30%;
  min-height: 92px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #141418;
  border: 1px solid #222229;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cmp-prompt-box:focus-within {
  border-color: #363642;
}
.cmp-textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: 13.5px/1.5 var(--font);
  overflow-y: auto;
}
.cmp-textarea::placeholder { color: #686873; }
.cmp-textarea.missing::placeholder { color: var(--bad); }

.cmp-tag-pills,
.fnp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.at-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 600;
}

/* 4. Bottom Anchored Dock: Expandable Advanced Drawer + [Ratio] [MP] [Ct] [Advanced] + Generate */
.cmp-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
}

.cmp-adv-drawer {
  max-height: 210px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 12px;
  background: #141418;
  border: 1px solid #24242c;
  display: grid;
  gap: 7px;
}
.cmp-adv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}
.cmp-adv-row.wide {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.cmp-adv-lbl {
  font-size: 12px;
  font-weight: 600;
  color: #b4b4be;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-adv-sel,
.cmp-adv-txt,
.cmp-seed-in {
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid #2b2b33;
  background: #1c1c22;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.cmp-seed-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cmp-seed-in { width: 88px; text-align: right; }

/* Single-Row Active Summary Bar */
.cmp-summary-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.cmp-sum-chip {
  height: 32px;
  padding: 0 6px;
  border-radius: 9px;
  border: 1px solid #24242c;
  background: #151519;
  color: #d8d8e0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  transition: background .12s, border-color .12s;
}
.cmp-sum-chip:hover,
.cmp-sum-chip[aria-expanded="true"] {
  background: #1f1f26;
  border-color: var(--accent);
  color: var(--ink);
}

.cmp-gen-btn {
  height: 44px;
  border-radius: 11px;
  width: 100%;
}

/* Main Stage Viewport */
.ws-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.ws-stage-body {
  padding: 16px 20px 60px;
  flex: 1;
}

/* Mobile Radial Pie Menu for Modes */
.ws-pie-trig {
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid #2a2a33;
  background: #16161b;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.pie-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(5, 5, 7, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
}
.pie-wheel {
  position: relative;
  width: 260px;
  height: 260px;
  display: grid;
  place-items: center;
}
.pie-center {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #18181e;
  border: 1px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 18px;
  color: var(--ink);
}
.pie-center small { font-size: 10px; color: var(--dim); }
.pie-slice {
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid #2e2e38;
  background: #15151a;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}
.pie-slice span { font-size: 10.5px; font-weight: 700; }
.pie-slice.active,
.pie-slice:hover {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ------------------------------------------------------------------ 4. Home Skeleton View (#/home) */
.home-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.home-surface-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid #1e1e24;
  transition: border-color .14s, background .14s;
}
.home-surface-card:hover {
  border-color: var(--accent);
  background: #19191e;
}
.hsc-ic {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex: none;
}
.hsc-txt {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.hsc-txt b { font-size: 14px; }
.hsc-txt small { font-size: 12px; color: var(--dim); }

.home-skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.home-skel-card {
  border-radius: 14px;
  background: #121216;
  border: 1px dashed #282830;
  padding: 14px;
  display: grid;
  gap: 12px;
}
.home-skel-preview {
  height: 120px;
  border-radius: 10px;
  background: #0d0d10;
  display: grid;
  place-items: center;
  padding: 20px;
}
.home-skel-lines {
  width: 100%;
  display: grid;
  gap: 8px;
}
.home-skel-lines span {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: #1c1c22;
}
.home-skel-lines span:nth-child(2) { width: 75%; }
.home-skel-lines span:nth-child(3) { width: 50%; }
.home-skel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.home-skel-foot b { display: block; font-size: 13.5px; }
.home-skel-foot small { color: var(--dim); font-size: 11.5px; }

/* ------------------------------------------------------------------ 5. Split Media Detail Dialog (Screenshot 5) */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 6, 8, 0.86);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 28px 56px 76px;
}
.detail-card {
  width: min(1240px, 100%);
  height: min(760px, calc(100vh - 110px));
  background: #111114;
  border: 1px solid #26262e;
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  box-shadow: 0 32px 90px rgba(0, 0, 0, .75);
}
.detail-side {
  padding: 20px;
  border-right: 1px solid #1e1e24;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.detail-time {
  color: var(--dim);
  font-size: 12.5px;
}
.detail-top-acts {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-ic-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.detail-ic-btn:hover { background: #1e1e24; }
.detail-dl-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #383842;
  background: #17171c;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.detail-dl-box:hover { border-color: var(--ink); }

.detail-prompt-sec {
  display: grid;
  gap: 8px;
}
.detail-sec-lbl {
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
}
.detail-prompt-txt {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.detail-ref-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid #2d2d35;
  background: #18181d;
}
.detail-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-ref-link {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #1b1b21;
  color: #dfdfe6;
  font-size: 12px;
  font-weight: 600;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-dims {
  margin-top: auto;
  font-size: 12px;
  color: var(--faint);
}

.detail-stage {
  position: relative;
  background: #16161a;
  display: grid;
  place-items: center;
  padding: 48px 28px;
  min-width: 0;
  min-height: 0;
}
.detail-stage img,
.detail-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}
.detail-stage-top {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-top-pill {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid #2e2e36;
  background: rgba(17, 17, 20, .85);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.detail-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid #2e2e36;
  background: rgba(17, 17, 20, .85);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.detail-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(24, 24, 29, .8);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 92;
}
.detail-nav.prev { left: 12px; }
.detail-nav.next { right: 12px; }

.detail-strip {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(17, 17, 20, .88);
  border: 1px solid #26262e;
  z-index: 92;
}
.detail-strip-item {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  background: #111;
  cursor: pointer;
}
.detail-strip-item.active { border-color: #fff; }
.detail-strip-item img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------------ 6. 11Labs-Style App-Node Flow Canvas (#/flow) */
.flow-surface {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: #09090b;
  background-image: radial-gradient(#24242b 1.25px, transparent 1.25px);
  background-size: 24px 24px;
  user-select: none;
  outline: none;
  cursor: grab;
}
.flow-surface.panning { cursor: grabbing; }

.flow-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
}

.flow-edges {
  position: absolute;
  top: 0;
  left: 0;
  width: 6000px;
  height: 4000px;
  overflow: visible;
  pointer-events: none;
}
.flow-edge {
  fill: none;
  stroke: #2c4a6f;
  stroke-width: 2.2px;
  transition: stroke .12s, stroke-width .12s;
}
.flow-edge.hover,
.flow-edge.temp {
  stroke: #38bdf8;
  stroke-width: 3px;
}
.flow-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18px;
  pointer-events: stroke;
  cursor: pointer;
}

/* Cursor-Following (×) Wire Cutter on Line Hover */
.flow-wire-cut {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #38bdf8;
  background: #0d1520;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 55;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .65);
  padding: 0;
}
.flow-wire-cut:hover {
  background: var(--bad);
  border-color: var(--bad);
}

/* Floating Node List Menu (attached to side rail [+], never shifts canvas) */
.flow-add-menu {
  position: fixed;
  left: calc(var(--rail-w) + 12px);
  top: 64px;
  width: 268px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: #121216;
  border: 1px solid #2b2b34;
  border-radius: 14px;
  padding: 8px;
  z-index: 65;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .72);
  display: grid;
  gap: 3px;
}
.fam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 6px;
  font-size: 12.5px;
  font-weight: 700;
}
.fam-reset {
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.fam-reset:hover { color: var(--ink); }
.fam-sec {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  padding: 6px 8px 2px;
}
.fam-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.fam-item:hover { background: #1d1d24; }
.fam-ic {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1c1c23;
  color: var(--ink);
  display: grid;
  place-items: center;
  flex: none;
}
.fam-txt { display: grid; min-width: 0; }
.fam-txt b { font-size: 12.5px; font-weight: 600; }
.fam-txt small { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Node Card & Above-Node Carousel */
.flow-node-wrap {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: default;
}

/* Above-node horizontal history carousel: oldest left -> newest right, image-only */
.flow-node-carousel {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
  max-width: 100%;
}
.fnc-item {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .16);
  background: #121215;
  padding: 0;
  flex: none;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.fnc-item:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, .45); }
.fnc-item.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(56, 189, 248, .35); }
.fnc-item img { width: 100%; height: 100%; object-fit: cover; }

.flow-node-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: #b4b4be;
  cursor: grab;
}
.fnm-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e4e4ec;
}
.fnm-right {
  color: #9e9ea8;
  font-size: 11.5px;
}

.flow-node-card {
  border-radius: 16px;
  background: #141417;
  border: 1.5px solid #27272f;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  transition: border-color .14s, box-shadow .14s;
}
.flow-node-card.selected {
  border-color: #e4e4ec;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .7);
}

.flow-node-stage {
  position: relative;
  height: 230px;
  background: #0c0c0e;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}
.flow-node-stage.upload-stage { height: 280px; }
.flow-node-stage > img,
.flow-node-stage > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fns-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #70707b;
  font-size: 12.5px;
  font-weight: 500;
}
.fns-spark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px dashed #32323c;
  display: grid;
  place-items: center;
  color: #8e8e99;
}

/* Corner Reference Thumbnails in Bottom-Left of Node Media Stage */
.fns-corner-refs {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 6px;
  z-index: 3;
}
.fns-ref-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid #fff;
  background: #111;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
}
.fns-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flow-run-here-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  height: 28px;
  padding: 0 11px;
  border-radius: 8px;
  border: 0;
  background: rgba(244, 244, 246, .95);
  color: #0b0b0d;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.flow-run-here-btn:hover { background: #fff; }

/* Node Prompt Area */
.flow-node-prompt {
  position: relative;
  padding: 10px 12px 12px;
  background: #1c1c20;
  border-top: 1px solid #26262d;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fnp-input {
  width: 100%;
  min-height: 54px;
  max-height: 92px;
  padding-right: 76px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: 12.5px/1.45 var(--font);
}
.fnp-input::placeholder { color: #72727d; }

.fnp-run-group {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  height: 30px;
  border-radius: 8px;
  background: #f4f4f6;
  color: #0b0b0d;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}
.fnp-run-main {
  height: 100%;
  padding: 0 11px;
  border: 0;
  background: transparent;
  color: #0b0b0d;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.fnp-run-chev {
  height: 100%;
  padding: 0 6px;
  border: 0;
  border-left: 1px solid rgba(0, 0, 0, .12);
  background: transparent;
  color: #0b0b0d;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.fnp-run-main:hover,
.fnp-run-chev:hover {
  background: #fff;
}

/* Circular Left/Right I/O Ports */
.flow-port {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid #2c4a6f;
  background: #10243a;
  color: #60a5fa;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  z-index: 5;
  transition: transform .12s, background .12s, border-color .12s;
}
.flow-port:hover {
  transform: scale(1.12);
  background: #173758;
  border-color: #60a5fa;
}
.flow-port.in.media {
  left: -40px;
  bottom: 84px;
}
.flow-port.in.text {
  left: -40px;
  bottom: 42px;
  background: #1d1d22;
  border-color: #383842;
  color: #a6a6b2;
  font-family: Georgia, serif;
}
.flow-port.out.media {
  right: -40px;
  top: 56px;
}

/* Floating Bottom Pill Toolbar below Selected Node */
.flow-node-toolbar {
  align-self: center;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 8px;
  border-radius: 999px;
  background: #18181c;
  border: 1px solid #2d2d36;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .65);
  z-index: 10;
}
.fnt-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: #e4e4ec;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.fnt-btn:hover { background: #26262e; }
.fnt-sep {
  width: 1px;
  height: 18px;
  background: #2e2e37;
  margin: 0 2px;
}
.fnt-ic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #c8c8d2;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
}
.fnt-ic:hover { background: #26262e; color: #fff; }
.fnt-ic.danger:hover { color: var(--bad); }
.fnt-ic.more-circle {
  border: 1px solid #484854;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .ws-studio {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .detail-card {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    height: calc(100vh - 90px);
  }
}

@media (max-width: 760px) {
  .ws-studio {
    grid-template-columns: 1fr;
  }
  .cmp-panel {
    position: static;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid #1b1b20;
  }
  .ws-mode-bar .sh-mode-ic {
    display: none;
  }
  .ws-pie-trig {
    display: inline-flex;
  }
}
/* === HILLFIELD STUDIO SHELL, ZERO-SCROLL COMPOSER, DETAIL DIALOG & FLOW CANVAS END === */

/* === QUEUE DRAWER + TASK SCHEDULER (right side, non-blocking) === */
.queue-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: clamp(340px, 30vw, 420px);
  background: var(--panel); border-left: 1px solid var(--line-2);
  transform: translateX(calc(100% + 24px));
  transition: transform .22s cubic-bezier(.2,.7,.3,1);
  display: flex; flex-direction: column; visibility: hidden;
}
.queue-drawer.open { transform: translateX(0); visibility: visible; }
.queue-drawer .qd-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.queue-drawer .qd-title { display: flex; align-items: center; gap: 8px; color: var(--ink); margin-right: auto; }
.queue-drawer .qd-title svg { width: 17px; height: 17px; color: var(--accent); }
.queue-drawer .qd-nav { display: flex; gap: 2px; background: #121215; padding: 3px; border-radius: 10px; }
.queue-drawer .qd-pill { border: 0; background: transparent; color: var(--dim); width: 30px; height: 28px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.queue-drawer .qd-pill:hover { color: var(--ink); background: #1b1b1f; }
.queue-drawer .qd-pill[aria-pressed="true"] { color: var(--ink); background: var(--panel-3); }
.queue-drawer .qd-pill svg { width: 16px; height: 16px; }
.queue-drawer .qd-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.queue-drawer .qd-count { font-size: 12px; margin-left: auto; }
.queue-drawer .qd-body { overflow-y: auto; padding: 12px 14px 20px; flex: 1; min-height: 0; }
.queue-drawer .qd-body h4 { margin: 12px 0 8px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.queue-drawer .qd-jobs, .queue-drawer .qd-history { display: grid; gap: 8px; }
.queue-drawer .qd-empty { color: var(--dim); font-size: 12.5px; padding: 10px 2px; }
.qd-jobcard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.qd-jobcard.done { opacity: .68; }
.qd-jobcard.canceled { opacity: .5; }
.qd-job { display: flex; align-items: center; gap: 8px; }
.qd-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--dim); }
.qd-dot.scheduled { background: var(--warn); }
.qd-dot.running { background: var(--accent); animation: pulse 1.2s infinite; }
.qd-dot.done { background: var(--ok); }
.qd-dot.canceled { background: var(--faint); }
.qd-job-main b { display: block; font-size: 12.5px; }
.qd-job-main small { color: var(--dim); font-size: 11.5px; }
.qd-job-main { flex: 1; min-width: 0; }
.qd-tasks { display: grid; gap: 3px; }
.qd-task { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink); }
.qd-task .qd-models { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.qd-task .qd-att { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34%; }
.rail-queue { position: relative; }
.rail-queue-dot { position: absolute; top: 5px; right: 5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 9.5px; font-weight: 800; display: grid; place-items: center; }

/* --- scheduler dialog: paper ratio, composer 3/4 + scheduled list 1/4 --- */
.sched-dialog {
  position: fixed; z-index: 90; left: 50%; top: 50%;
  width: min(960px, 94vw, calc(90vh / 1.414));
  aspect-ratio: 1 / 1.414; max-height: 90vh;
  transform: translate(-50%, -46%) scale(.98);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .16s ease, transform .16s ease, visibility 0s .16s;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden;
}
.sched-dialog.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1); transition: opacity .16s ease, transform .16s ease; }
.sched-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sched-head .sched-subline { flex: 1; min-width: 0; color: var(--dim); font-size: 12px; text-align: right; }
.sched-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.sched-title svg { width: 17px; height: 17px; color: var(--accent); }
.sched-head .mini { display: none; }
.sched-body { display: grid; grid-template-columns: 3fr 1fr; flex: 1; min-height: 0; }
.sched-compose { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; border-right: 1px solid var(--line); min-width: 0; }
.sched-side { padding: 14px; overflow-y: auto; min-width: 0; }
.sched-side h5 { margin: 0 0 10px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.sched-side .qd-jobcard { margin-bottom: 8px; }
.sched-row { display: flex; align-items: center; gap: 10px; }
.sched-lbl { width: 84px; flex: none; font-size: 12.5px; color: var(--dim); font-weight: 600; }
.sched-models { flex: 1; justify-content: flex-start; }
.sched-picked { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; align-items: center; padding-left: 94px; }
.sched-picked-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 12.5px; font-weight: 600; }
.sched-picked-chip svg { width: 13px; height: 13px; color: var(--accent); }
.sched-picked .warn { color: var(--warn); }
.sched-attach-row { display: flex; align-items: center; gap: 10px; flex: 1; padding-left: 94px; }
.sched-attach.add { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--dim); background: transparent; cursor: pointer; font: inherit; font-size: 12.5px; }
.sched-attach.add:hover { color: var(--ink); border-color: var(--accent-line); background: var(--accent-bg); }
.sched-attach-view { display: inline-flex; align-items: center; gap: 10px; }
.sched-attach-view img, .sched-attach-view video { width: 42px; height: 42px; object-fit: cover; border-radius: 9px; background: #111; }
.sched-attach-x { color: var(--dim); }
.sched-attach-x:hover { color: var(--bad); }
.sched-prompt { width: calc(100% - 94px); margin-left: 94px; background: #101012; border: 1px solid var(--line-2); color: var(--ink); border-radius: 12px; padding: 10px 12px; font: inherit; resize: vertical; min-height: 92px; }
.sched-prompt:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 2px var(--accent-soft); }
.sched-actions { display: flex; gap: 10px; align-items: center; margin-left: 94px; }
.sched-actions .wide { flex: 1; }
.sched-staged { display: grid; gap: 5px; }
.qd-staged-head { color: var(--dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.sched-staged-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.sched-staged-models { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-list-body { display: grid; gap: 8px; }
.sched-model-pop { padding: 6px; }
.sched-model-pop h5 { margin: 8px 6px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.sched-mchips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.sched-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--dim); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.sched-chip:hover { color: var(--ink); border-color: var(--accent-line); }
.sched-chip svg { width: 13px; height: 13px; }
.sched-chip .chk { display: none; color: var(--accent); }
.sched-chip.picked { color: var(--ink); background: var(--accent-bg); border-color: var(--accent-line); }
.sched-chip.picked .chk { display: inline-grid; }
.sched-chip small { color: var(--faint); font-weight: 500; }
.pop.sched-pop { max-width: 560px; max-height: min(480px, 68vh); }

@media (max-width: 920px) {
  .queue-drawer { width: min(94vw, 420px); }
  .sched-dialog { aspect-ratio: auto; height: min(88vh, 100%); width: 96vw; }
  .sched-body { grid-template-columns: 1fr; }
  .sched-side { border-top: 1px solid var(--line); max-height: 30%; }
  .sched-prompt, .sched-attach-row, .sched-actions, .sched-picked { margin-left: 0; padding-left: 0; width: 100%; }
}
/* === QUEUE DRAWER + TASK SCHEDULER END === */
