/* igen: private image studio. Mobile-first, system fonts. The palette comes from the logo: its pastel
   clay letters (mint, coral, peach, lilac, sampled from igen-logo.png) on deep ink navy. Lilac is the
   one brand accent (links, selection, focus, the main button); mint means OK, coral means trouble. */
:root {
  --bg: #0d0f1a;
  --panel: #151826;
  --panel-2: #1c2033;
  --raised: #242941;
  --line: #2a2e45;
  --line-2: #3a4060;
  --text: #ecebf5;
  --muted: #a4a6be;
  --lilac: #b89cea;          /* the logo's n, lifted for text on dark */
  --lilac-deep: #a37ecc;     /* the logo's n, as sampled: filled buttons */
  --mint: #7dd8bf;           /* the i */
  --coral: #ef9f98;          /* the g */
  --peach: #eabfa5;          /* the e */
  --accent: var(--lilac);
  --accent-ink: #17132b;     /* text on filled accent */
  --accent-soft: rgba(184, 156, 234, .14);
  --accent-line: rgba(184, 156, 234, .55);
  --ok: var(--mint);
  --bad: var(--coral);
  --warn: var(--peach);
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 14px 32px -16px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(184, 156, 234, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* beat display: grid/flex on hidden elements */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--text); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.05rem; font-weight: 650; color: var(--text); letter-spacing: .01em; }
.muted { color: var(--muted); }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li + li { margin-top: 8px; }
a, button, .chip, input, select, textarea { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
:focus-visible { outline: none; box-shadow: var(--ring); }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(13, 15, 26, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: block; flex: none; line-height: 0; text-decoration: none; border-radius: 8px; }
.brand img { display: block; height: 30px; width: auto; }
.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.top nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.top nav a:hover { color: var(--text); background: var(--panel-2); }
.top nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.top form { margin: 0; }
.foot form { margin: 0 0 6px; }
@media (max-width: 480px) {
  .top { gap: 8px; }
  .top nav { gap: 2px; }
  .top nav a { padding: 6px 5px; font-size: .875rem; } /* admins get five links */
  .top:has(nav a:nth-child(5)) .brand { display: none; } /* ...and need the brand's room for them */
  .top form { display: none; } /* Log out lives in the footer on phones */
}
@media (min-width: 481px) { .foot form { display: none; } }

/* layout */
.page { max-width: 960px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 16px; }

/* forms */
label { display: block; font-weight: 600; margin: 0 0 6px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
}
input[type="text"]:hover, input[type="password"]:hover, input[type="number"]:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--ring); }
::placeholder { color: var(--muted); opacity: .75; }
button {
  appearance: none; border: 0; cursor: pointer;
  padding: 12px 18px; border-radius: 10px; font-weight: 700;
  background: var(--lilac-deep); color: var(--accent-ink);
}
button:hover:not(:disabled) { background: var(--lilac); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button.secondary:hover:not(:disabled) { background: var(--raised); border-color: var(--line-2); }
button.link { background: none; color: var(--muted); padding: 6px 8px; font-weight: 500; }
button.link:hover:not(:disabled) { background: none; color: var(--text); }
.error { color: var(--bad); margin: 10px 0 0; }

/* status */
.status::before { content: ""; display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: .5em; vertical-align: .05em; background: var(--muted); }
.status.ok::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(125, 216, 191, .18); }
.status.bad::before { background: var(--bad); box-shadow: 0 0 0 3px rgba(239, 159, 152, .18); }

.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a.button {
  display: inline-block; text-decoration: none; text-align: center;
  padding: 10px 16px; border-radius: 10px; font-weight: 700; background: var(--lilac-deep); color: var(--accent-ink);
}
a.button:hover { background: var(--lilac); color: var(--accent-ink); }
a.button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
a.button.secondary:hover { background: var(--raised); border-color: var(--line-2); }
img.pixel { image-rendering: pixelated; }

/* generate */
#gen-msg { margin: 0; min-height: 1.4em; }
.notice.small { padding: 8px 12px; }
button.danger, button.secondary.danger { color: var(--bad); border-color: rgba(239, 159, 152, .4); }
button.secondary.danger:hover:not(:disabled) { background: rgba(239, 159, 152, .12); border-color: var(--bad); }
#notify { margin-top: 10px; padding-left: 0; }

/* job lists */
.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.job { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; } /* thumb, text, Cancel/Remove */
.job-text { min-width: 0; }
.job-text p { margin: 0; }
.job-prompt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job.failed .small { color: var(--bad); white-space: normal; }
.thumb {
  display: block; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--panel-2);
  aspect-ratio: 1; width: 100%; cursor: pointer;
}
.thumb:hover img { filter: brightness(1.06); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb.placeholder { cursor: default; }
.thumb.placeholder.claimed { background: linear-gradient(110deg, var(--panel-2) 30%, rgba(184, 156, 234, .22) 50%, var(--panel-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.thumb.placeholder.failed { background: rgba(239, 159, 152, .15); }
@keyframes shimmer { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .thumb.placeholder.claimed { animation: none; } * { transition: none !important; } }

/* gallery */
.toolbar { display: flex; gap: 8px; }
.toolbar select { max-width: 260px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 8px; } }
#more { justify-self: center; }

/* viewer */
.viewer {
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text);
  width: min(960px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
}
.viewer::backdrop { background: rgba(6, 7, 13, .85); }
.viewer-body { display: grid; }
.viewer-img { background: #07080e; display: flex; justify-content: center; }
.viewer-img img { display: block; max-width: 100%; max-height: 62dvh; object-fit: contain; }
.viewer-img img.pixel { width: min(100%, 62dvh); height: auto; }
.viewer-meta { padding: 14px 16px 16px; display: grid; gap: 10px; align-content: start; }
.viewer-meta p { margin: 0; }
.v-prompt { font-weight: 600; }
.viewer-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: .875rem; }
.viewer-meta dt { color: var(--muted); }
.viewer-meta dd { margin: 0; overflow-wrap: anywhere; }
.viewer-meta details { font-size: .875rem; color: var(--muted); }
.viewer .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer .actions > * { flex: 1 1 auto; }
@media (min-width: 760px) {
  .viewer-body { grid-template-columns: 1fr 300px; }
  .viewer-img img { max-height: calc(100dvh - 18px); }
  .viewer-img img.pixel { width: min(100%, calc(100dvh - 18px)); }
}
/* Previous / Next: while the viewer can step through a list, every image fits the same box */
.viewer-img { position: relative; align-items: center; }
.v-nav, .v-pos { display: none; }
.viewer.has-nav .viewer-img { height: min(62dvh, 100vw); }
.viewer.has-nav .viewer-img img { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.viewer.has-nav .v-nav {
  display: grid; place-items: center; position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0 0 4px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(13, 15, 26, .62); color: #fff; font-size: 1.9rem; line-height: 1; cursor: pointer;
}
.viewer.has-nav .v-nav:hover:not(:disabled) { background: rgba(13, 15, 26, .9); border-color: var(--accent-line); }
.viewer.has-nav .v-nav:disabled { opacity: .25; cursor: default; }
.v-prev { left: 8px; }
.v-next { right: 8px; }
.viewer.has-nav .v-pos {
  display: block; position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  padding: 2px 10px; border-radius: 999px; background: rgba(13, 15, 26, .62); color: #fff; font-size: .75rem;
}
@media (min-width: 760px) { .viewer.has-nav .viewer-img { height: min(calc(100dvh - 18px), 720px); } }

/* presets */
.notice { margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(125, 216, 191, .1); border: 1px solid rgba(125, 216, 191, .25); color: var(--ok); }
.presets { display: grid; gap: 12px; }
.preset h2 { margin: 0; }
.preset.off { opacity: .7; }
.preset-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.preset-head p { margin: 4px 0 0; }
.preset > p.small { margin: 10px 0 0; }
.preset-actions { display: flex; gap: 8px; margin-top: 12px; }
.preset-actions form { margin: 0; }
.preset-actions button { padding: 8px 14px; }
.badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); vertical-align: middle; }
.editor { display: grid; gap: 18px; }
.editor h2 { margin: 0; }
.editor fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; min-width: 0; }
.editor legend { padding: 0 6px; color: var(--accent); font-weight: 700; }
.editor textarea { resize: vertical; }
.editor p.small { margin: 6px 0 0; }
.editor .error.small { margin-top: 6px; }
.editor [aria-invalid="true"] { border-color: var(--bad); }
.editor .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor .actions { display: flex; gap: 10px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; margin: 0; }
label.check input { width: 20px; height: 20px; accent-color: var(--lilac-deep); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
input[type="number"] { -moz-appearance: textfield; }

/* accounts */
.center { text-align: center; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; } /* sign-up honeypot */
.badge.hot { background: var(--coral); color: var(--accent-ink); }
.top nav .badge { margin-left: 4px; vertical-align: 1px; }
.users { display: grid; gap: 14px; }
.user { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.user:first-child { border-top: 0; padding-top: 0; }
.user p { margin: 0; }
.user.off { opacity: .7; }
.user details summary { cursor: pointer; color: var(--accent); }
.user details[open] { display: grid; gap: 10px; }
.user details form { margin: 0; }
form.quotas { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 8px; align-items: end; }
form.quotas label { font-weight: 500; font-size: .8rem; color: var(--muted); margin: 0; }
form.quotas input { padding: 8px; margin-top: 4px; }
form.quotas button { padding: 9px 14px; }
@media (max-width: 480px) { form.quotas { grid-template-columns: repeat(3, 1fr); } form.quotas button { grid-column: 1 / -1; } }
form.inline { display: flex; gap: 8px; }
form.inline input { flex: 1; min-width: 0; padding: 9px; }
form.inline button { padding: 9px 14px; white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions form { margin: 0; }
.row-actions button { padding: 8px 14px; }
/* Workers page */
.badge.on { background: rgba(125, 216, 191, .16); color: var(--ok); }
.token-card { border-color: var(--accent-line); }
.token-card p { margin: 0 0 10px; }
.snippet { margin: 0 0 10px; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: .82rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.caps-problems { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.worker-line { overflow-wrap: anywhere; }
dl.quota { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 10px; }
dl.quota dt { color: var(--muted); }
dl.quota dd { margin: 0; }

/* login */
.login { max-width: 360px; margin: 0 auto; padding: 10vh 16px 16px; }
.login .brand { margin: 0 0 24px; }
.login .brand img { height: 80px; margin: 0 auto; }
.login form { display: grid; gap: 12px; }

/* landing (login.php): prints made with igen thrown across the whole window as a background
   (placed by initLanding in igen.js), with the intro, login and "What it makes" floating on top */
.scatter { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: radial-gradient(120% 100% at 50% 40%, #1d2236 0%, #141829 55%, #0d0f1a 100%); }
.scatter::after { content: ""; position: absolute; inset: 0; z-index: 35; pointer-events: none;
  background: radial-gradient(ellipse 46% 60% at 50% 45%, rgba(13, 15, 26, .6) 0%, rgba(13, 15, 26, .25) 70%, rgba(13, 15, 26, .1) 100%); }
.print { position: absolute; margin: 0; left: var(--x); top: var(--y); width: var(--w); z-index: var(--z, 1);
  transform: translate(-50%, -50%) rotate(var(--r, 0deg)); padding: max(5px, calc(var(--w, 200px) * .035)) max(5px, calc(var(--w, 200px) * .035)) 0;
  background: #f6f3ec; border-radius: 2px; box-shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 30px -8px rgba(0, 0, 0, .65);
  visibility: hidden; transition: transform .25s ease, box-shadow .25s ease; }
.scatter.ready .print { visibility: visible; animation: throw .6s cubic-bezier(.2, .8, .3, 1) backwards; animation-delay: var(--d, 0s); }
@keyframes throw {
  from { opacity: 0; transform: translate(-50%, -50%) translate(var(--fx, 0), var(--fy, -40px)) rotate(calc(var(--r, 0deg) * 2.5)) scale(1.25); }
}
.print img { display: block; width: 100%; height: auto; background: #ddd; }
.print figcaption { padding: .45em .2em .6em; text-align: center; color: #3d3a46;
  font: 500 clamp(10px, 6.5cqw, 14px)/1.2 "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print { container-type: inline-size; }
.print:hover { z-index: 40; transform: translate(-50%, -50%) rotate(0deg) scale(1.08);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .35), 0 26px 44px -10px rgba(0, 0, 0, .75); }
@media (prefers-reduced-motion: reduce) {
  .scatter.ready .print { animation: none; }
  .print { transition: none; }
  .print:hover { transform: translate(-50%, -50%) rotate(var(--r, 0deg)); }
}

/* the page on top: two panels in the middle; the gaps between them let the prints be hovered */
.landing-page .foot { position: relative; z-index: 1; text-shadow: 0 1px 3px #000; }
.landing { position: relative; z-index: 1; pointer-events: none; max-width: 470px; margin: 0 auto;
  padding: max(28px, 7vh) 16px 8px; display: grid; gap: 18px; }
.landing > * { pointer-events: auto; }
.panel { background: rgba(21, 24, 38, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .85); }
.landing-hero { display: grid; gap: 14px; }
.landing .brand { margin: 0; line-height: 0; }
.landing .brand img { height: 64px; width: auto; }
.lede { margin: 0; font-size: 1.04rem; line-height: 1.55; color: var(--text); }
.landing-hero form { display: grid; gap: 12px; }
.landing-hero form p { margin: 0; }
.landing-features h2 { margin: 0 0 12px; }
.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.features li { padding: 8px 10px 8px 12px; border-radius: 10px; background: rgba(13, 15, 26, .55);
  border-left: 3px solid var(--tone); color: var(--muted); font-size: .88rem; line-height: 1.4; }
.features b { display: block; color: var(--text); font-size: .95rem; margin-bottom: 1px; }
.f-photo { --tone: var(--peach); } .f-words { --tone: var(--lilac); } .f-art { --tone: var(--mint); }
.f-edit { --tone: var(--coral); } .f-compare { --tone: #8cc8f2; }
@media (max-width: 640px) {
  /* phones: the panels start lower, leaving a clear view of the pile at the top */
  .landing { padding-top: 32vh; padding-top: 32svh; }
  .scatter::after { background: linear-gradient(to bottom, rgba(13, 15, 26, 0) 0%, rgba(13, 15, 26, .1) 28%, rgba(13, 15, 26, .45) 45%); }
}

/* studio: the form on the left, the final prompt, Generate and results on the right (one column on phones) */
.page.studio-page { max-width: 1240px; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.studio-main, .side-card { display: grid; gap: 14px; }
/* single-column grids: a track that may shrink, so one long chip or word can't widen the page */
.page.studio-page, .studio-main, .side-card, .studio-side, .recipe, .settings, .panel { grid-template-columns: minmax(0, 1fr); }
.studio-side { display: grid; gap: 16px; min-width: 0; }
.studio-side .card > h2 { margin-bottom: 10px; }
@media (min-width: 1000px) {
  .studio { grid-template-columns: minmax(0, 1fr) 400px; }
  .studio-side { position: sticky; top: 64px; max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; padding-right: 2px; }
}
.studio textarea { resize: vertical; }
#prompt { min-height: 84px; }
.studio p.small, .studio .field p.small { margin: 6px 0 0; }
.studio .row, .editor .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor .row.three { grid-template-columns: repeat(3, 1fr); }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.tabs > * { flex: 1; padding: 9px 12px; border-radius: 9px; background: none; color: var(--muted); border: 0; text-align: center; text-decoration: none; font-weight: 700; }
.tabs > *:hover:not([aria-selected="true"]):not([aria-current="page"]) { background: var(--panel-2); color: var(--text); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.toolbar .tabs { flex: 0 0 auto; padding: 3px; }
.toolbar .tabs > * { padding: 7px 14px; }
.guide > summary::marker, .more > summary::marker { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; align-items: center; margin: 0; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); font-weight: 500; font-size: .9rem; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--line-2); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.chip:has(input:focus-visible) { box-shadow: var(--ring); }
#models .chip { border-radius: 10px; padding: 8px 12px; }
#models .chip > span { display: grid; line-height: 1.25; }
#models .chip small { color: var(--muted); font-size: .75rem; }
#models .chip:has(input:checked) small { color: var(--text); }
#model-extras { display: grid; gap: 6px; }
#model-extras p.small { margin: -2px 0 4px 30px; }
.photo-pick { display: flex; gap: 10px; align-items: center; }
.photo-pick img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.studio input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--bg); color: var(--muted); }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--raised); }
input[type="search"] { width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--text); }

/* help: one short tip per part; the rest behind "more" */
.tip { margin: 6px 0 0; font-size: .85rem; line-height: 1.45; color: var(--muted); }
.tip b { color: var(--text); font-weight: 600; }
ul.notes { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
#model-notes:empty, #style-tip:empty, #sampling-tip:empty { display: none; }
.studio[data-mode="t2i"] [data-only="edit"], .studio[data-mode="edit"] [data-only="t2i"] { display: none; }
.studio.tips-off .tip, .studio.tips-off .more { display: none; }
.more { font-size: .85rem; color: var(--muted); }
.more > summary { cursor: pointer; width: max-content; max-width: 100%; color: var(--muted); }
.more > summary:hover { color: var(--text); }
.more[open] > summary { margin-bottom: 6px; }
.more p { margin: 0; }
.more b { color: var(--text); font-weight: 600; }
.studio-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.guide { flex: 1; min-width: 0; font-size: .9rem; }
.guide > summary { cursor: pointer; color: var(--text); font-weight: 650; }
.guide ol { margin: 8px 0 2px; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }
.guide ol ::marker { color: var(--accent); }
.guide b { color: var(--text); }
#tips-toggle { white-space: nowrap; padding: 2px 0; }

/* one colour per part of the prompt: the style, then each look group (catalogue order) */
.tone-0 { --tone: #b89cea; } .tone-1 { --tone: #eabfa5; } .tone-2 { --tone: #ef9f98; } .tone-3 { --tone: #f0c674; }
.tone-4 { --tone: #8cc8f2; } .tone-5 { --tone: #7dd8bf; } .tone-6 { --tone: #cdc6b4; } .tone-7 { --tone: #f2a7d6; } .tone-8 { --tone: #bfe08c; }

/* the recipe: chips for the style and each look option */
.recipe { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(255, 255, 255, .012); }
h2.label { font-size: 1rem; font-weight: 600; margin: 0; }
.rchips { display: flex; flex-wrap: wrap; gap: 8px; }
.rchip { display: inline-flex; align-items: stretch; border-radius: 999px; overflow: hidden; max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.rchip button { background: none; border: 0; color: var(--text); border-radius: 0; font-weight: 500; }
.rchip button:hover:not(:disabled) { background: color-mix(in srgb, var(--tone) 22%, transparent); }
.rchip-main { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; min-width: 0; overflow: hidden; text-align: left; }
.rchip-main::after { content: "\25BE"; font-size: .7rem; color: var(--tone); }
.rchip-group { font-size: .75rem; color: var(--tone); font-weight: 650; white-space: nowrap; }
.rchip-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rchip button.rchip-x { flex: none; }
.rchip button.rchip-x { padding: 4px 12px 4px 8px; font-size: 1.1rem; line-height: 1; color: var(--muted);
  border-left: 1px solid color-mix(in srgb, var(--tone) 30%, transparent); }
.rchip button.rchip-x:hover:not(:disabled) { color: var(--text); }
.rchip-add { padding: 7px 14px; border-radius: 999px; background: none; color: var(--accent); border: 1px dashed var(--accent-line); font-weight: 600; }
.rchip-add:hover:not(:disabled) { background: var(--accent-soft); color: var(--text); }
.recipe .field label { font-size: .875rem; font-weight: 600; }
#style-tip { margin: 0; }

/* settings bar: compact summaries that open one panel at a time */
.settings { display: grid; gap: 10px; }
.settings-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.setting { display: grid; gap: 1px; text-align: left; padding: 9px 12px; border-radius: 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); font-weight: 600; min-width: 0; }
.setting:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line-2); }
.setting[aria-expanded="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.setting-name::after { content: " \25BE"; color: var(--accent); font-size: .75rem; }
.setting[aria-expanded="true"] .setting-name::after { content: " \25B4"; }
.setting .sum { color: var(--muted); font-weight: 500; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(255, 255, 255, .012); }
.panel > .tip { margin: 0; }
.panel .field label, .panel .row label { font-size: .875rem; }
#size-follows { margin: 0; }
.aspect { display: inline-flex; align-items: center; gap: 7px; }
.shape { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .8; }
.shape.r1x1 { width: 12px; height: 12px; } .shape.r4x3 { width: 14px; height: 10.5px; } .shape.r3x2 { width: 15px; height: 10px; }
.shape.r16x9 { width: 16px; height: 9px; } .shape.r21x9 { width: 18px; height: 7.7px; } .shape.r3x4 { width: 10.5px; height: 14px; }
.shape.r2x3 { width: 10px; height: 15px; } .shape.r9x16 { width: 9px; height: 16px; }

/* the final prompt, coloured by where each part came from, and Generate */
.final { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.final p { margin: 0; }
.final-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.final-actions { display: flex; gap: 2px; flex: none; }
.final-actions button { padding: 2px 6px; color: var(--accent); }
.final-text { font-size: .92rem; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.seg { color: var(--tone, var(--text)); background: color-mix(in srgb, var(--tone, transparent) 10%, transparent); border-radius: 4px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 2px; }
.seg-prompt { color: var(--text); font-weight: 700; }
.seg-extra { color: var(--text); background: rgba(255, 255, 255, .06); }
.seg-trigger { color: var(--muted); background: none; }
#final-note { margin: 0; }
.go-bar { display: grid; gap: 10px; }
#summary { margin: 0; }
#go { width: 100%; padding: 14px 18px; font-size: 1.02rem; }
.preset-admin { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-admin button { flex: 1 1 auto; padding: 10px 14px; }
.queue #worker-line, .queue #quota-line { margin: 0 0 8px; }
.tiles.run-tiles { grid-template-columns: repeat(2, 1fr); }
#this-run p.small { margin: 10px 0 0; }
@media (min-width: 760px) { .recent-card .jobs { grid-template-columns: 1fr 1fr; column-gap: 24px; } }
@media (max-width: 999px) {
  /* phones and narrow windows: Generate stays at the bottom of the screen */
  .go-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    padding: 10px 16px max(10px, env(safe-area-inset-bottom)); background: rgba(13, 15, 26, .94); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); }
  .go-bar #summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .8rem; }
  #go { width: auto; padding: 12px 20px; }
  body.page-generate .page { padding-bottom: 96px; }
}
label.check.small { font-size: .875rem; }

/* the picker: sample tiles for the style and each look group */
.picker { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text);
  width: min(820px, calc(100vw - 24px)); max-height: min(760px, calc(100dvh - 24px)); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); }
.picker[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.picker::backdrop { background: rgba(6, 7, 13, .8); }
.picker-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px 8px; }
.picker-head h2 { margin: 0; white-space: nowrap; }
.picker-head button { padding: 9px 16px; }
.picker-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 14px 8px; border-bottom: 1px solid var(--line); }
.ptab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 9px; background: none; color: var(--muted);
  font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.ptab:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.ptab[aria-selected="true"] { color: var(--text); background: color-mix(in srgb, var(--tone) 14%, transparent); border-color: color-mix(in srgb, var(--tone) 45%, transparent); }
.ptab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.ptab .count { font-size: .72rem; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--tone); color: var(--accent-ink); }
.picker-panel { overflow-y: auto; padding: 10px 14px 14px; display: grid; gap: 10px; align-content: start; }
.picker-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.picker-bar p { margin: 0; }
.picker-tools { display: flex; flex: none; }
.picker-tools button { color: var(--accent); padding: 2px 8px; }
.picker-tools button[aria-pressed="true"] { color: var(--text); }
.picker-status { margin: 0; padding: 0 14px 12px; min-height: 1.4em; color: var(--muted); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.opt { display: grid; align-content: start; gap: 4px; padding: 6px 6px 8px; text-align: left; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; font-weight: 500; }
.opt:hover:not(:disabled) { background: var(--panel-2); border-color: color-mix(in srgb, var(--tone) 60%, transparent); }
.opt[aria-pressed="true"] { border-color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, var(--bg)); box-shadow: 0 0 0 1px var(--tone) inset; }
.opt[aria-disabled="true"] { opacity: .45; }
.opt-img { position: relative; display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--tone) 18%, var(--panel-2)); }
.opt-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.opt[aria-pressed="true"] .opt-img::after { content: "\2713"; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: var(--tone); color: var(--accent-ink); }
.opt-ph { display: grid; place-items: center; width: 100%; height: 100%; font-size: 2.2rem; font-weight: 800; color: var(--tone); }
.opt-label { font-weight: 650; font-size: .9rem; line-height: 1.25; }
.opt-group { color: var(--tone); font-weight: 600; }
.opt-adds { font-size: .75rem; line-height: 1.35; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  /* a bottom sheet on phones */
  .picker { width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: 88dvh; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .picker-head { grid-template-columns: minmax(0, 1fr) auto; }
  .picker-head input { grid-column: 1 / -1; grid-row: 2; }
  .picker-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .opt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .opt-adds { display: none; }
  .picker-status { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
.dialog { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); width: min(440px, calc(100vw - 24px)); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); }
.dialog::backdrop { background: rgba(6, 7, 13, .85); }
.dialog-form { display: grid; gap: 12px; padding: 16px; margin: 0; }
.dialog-form h2 { margin: 0; }
.dialog-form p { margin: 0; }
.dialog .actions { display: flex; gap: 8px; }
.dialog .actions > * { flex: 1; }

/* runs and compare */
.toolbar { flex-wrap: wrap; align-items: center; }
.runs { display: grid; gap: 14px; }
.run { display: grid; gap: 12px; }
.run-head { display: grid; gap: 10px; }
.run-head p { margin: 0; }
.run-prompt { font-weight: 700; overflow-wrap: anywhere; }
.run-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.run-actions > * { padding: 8px 12px; font-size: .875rem; }
@media (min-width: 640px) { .run-head { grid-template-columns: 1fr auto; align-items: start; } .run-actions { justify-content: flex-end; } }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 520px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 800px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; margin: 0; min-width: 0; }
.tile figcaption { font-size: .8rem; margin-top: 4px; line-height: 1.3; overflow-wrap: anywhere; }
.tile.failed figcaption .muted { color: var(--bad); }
.pick { position: absolute; top: 6px; left: 6px; margin: 0; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; background: rgba(13, 15, 26, .75); cursor: pointer; }
.pick input { width: 18px; height: 18px; accent-color: var(--lilac-deep); margin: 0; cursor: pointer; }
.compare-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--panel-2);
  border: 1px solid var(--accent-line); box-shadow: 0 12px 34px rgba(0, 0, 0, .55); width: max-content; max-width: calc(100vw - 24px); font-size: .875rem; }
.compare-bar button { padding: 8px 14px; }
body:has(.compare-bar:not([hidden])) .page { padding-bottom: 96px; } /* the bar never hides the last row */
.compare { padding: 0; border: 0; background: #07080e; color: var(--text); width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; }
.compare::backdrop { background: #07080e; }
.compare-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: rgba(7, 8, 14, .9); z-index: 1; }
.compare-head p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding: 0 16px 16px; }
.compare-strip figure { flex: 0 0 100%; scroll-snap-align: center; margin: 0; }
.compare-strip img { display: block; width: 100%; max-height: calc(100dvh - 130px); object-fit: contain; background: #000; border-radius: 6px; }
.compare-strip figcaption { font-size: .85rem; margin-top: 6px; }
@media (min-width: 760px) {
  .compare-strip { display: grid; overflow: visible; grid-template-columns: repeat(2, 1fr); }
  .compare-strip.n3, .compare-strip.n5, .compare-strip.n6 { grid-template-columns: repeat(3, 1fr); }
  .compare-strip.n2 img { max-height: calc(100dvh - 120px); }
  .compare-strip.n4 img, .compare-strip.n5 img, .compare-strip.n6 img { max-height: calc(50dvh - 70px); }
}

/* models card */
.models-table { display: grid; gap: 8px; }
.model-row { display: grid; grid-template-columns: 1fr auto auto 64px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.model-row:first-child { border-top: 0; }
.model-row.off { opacity: .6; }
.model-name { display: grid; min-width: 0; }
.model-row .order input { padding: 8px; text-align: center; }
@media (max-width: 480px) { .model-row { grid-template-columns: 1fr auto auto; } .model-row .model-name { grid-column: 1 / -1; } .model-row .order { justify-self: end; } }
