/* Pixmint UI. Dark is the default look; prefers-color-scheme: light and the header toggle (data-theme) switch it.
   Sections: tokens, base, header, buttons / forms, generator card + popovers, results feed, lightbox, app shell (tools + editor),
   modals / toasts, content sections (generated SEO pages), home grids, footer, gallery / history, login. */

/* ---- tokens ------------------------------------------------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --bg: #090e0c;
  --bg-2: #0d1411;
  --surface: #111a16;
  --surface-2: #17221d;
  --surface-3: #1f2d26;
  --border: #22312a;
  --border-2: #2f4238;
  --text: #e9f2ed;
  --muted: #93a89d;
  --accent: #3ddc97;
  --accent-hover: #68e8b0;
  --accent-soft: rgba(61, 220, 151, 0.12);
  --accent-line: rgba(61, 220, 151, 0.42);
  --on-accent: #03231a;
  --danger: #ff8d85;
  --danger-soft: rgba(255, 141, 133, 0.12);
  --warn: #f5b95a;
  --warn-soft: rgba(245, 185, 90, 0.12);
  --scrim: rgba(2, 6, 4, 0.66);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.5);
  --shimmer: rgba(255, 255, 255, 0.07);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f8f6; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #eff3f0; --surface-3: #e3eae6;
    --border: #dde5e0; --border-2: #c8d5cd; --text: #13201a; --muted: #5a6b62;
    --accent: #0b7f61; --accent-hover: #096a51; --accent-soft: #e0f4ec; --accent-line: rgba(11, 127, 97, 0.45); --on-accent: #ffffff;
    --danger: #b42318; --danger-soft: #fdeceb; --warn: #9a5b00; --warn-soft: #fff4de; --scrim: rgba(10, 25, 18, 0.45);
    --shadow: 0 1px 2px rgba(10, 30, 20, 0.05), 0 6px 20px rgba(10, 30, 20, 0.07); --shadow-lg: 0 18px 50px rgba(10, 30, 20, 0.2);
    --shimmer: rgba(255, 255, 255, 0.7);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8f6; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #eff3f0; --surface-3: #e3eae6;
  --border: #dde5e0; --border-2: #c8d5cd; --text: #13201a; --muted: #5a6b62;
  --accent: #0b7f61; --accent-hover: #096a51; --accent-soft: #e0f4ec; --accent-line: rgba(11, 127, 97, 0.45); --on-accent: #ffffff;
  --danger: #b42318; --danger-soft: #fdeceb; --warn: #9a5b00; --warn-soft: #fff4de; --scrim: rgba(10, 25, 18, 0.45);
  --shadow: 0 1px 2px rgba(10, 30, 20, 0.05), 0 6px 20px rgba(10, 30, 20, 0.07); --shadow-lg: 0 18px 50px rgba(10, 30, 20, 0.2);
  --shimmer: rgba(255, 255, 255, 0.7);
}

/* ---- base --------------------------------------------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
body.lb-on, body.nav-open { overflow: hidden; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 56px; }
h1 { font-size: clamp(1.7rem, 4.2vw, 2.3rem); line-height: 1.12; margin: 0 0 8px; letter-spacing: -0.025em; }
h2 { font-size: 1.25rem; margin: 0 0 8px; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
img { max-width: 100%; }
.lead { color: var(--muted); max-width: 46rem; margin-bottom: 18px; font-size: 1.04rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.skip { position: absolute; left: -999px; top: 0; z-index: 200; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }

/* images: fixed boxes + shimmer until the file has loaded (common.js sets .is-loaded / .is-error) */
img[loading="lazy"]:not(.is-loaded):not(.is-error) { background: var(--surface-2) linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%) 0 0 / 220% 100% no-repeat; animation: shimmer-bg 1.4s infinite linear; }
img.is-error { background: var(--surface-2); }
@keyframes shimmer-bg { from { background-position: 160% 0; } to { background-position: -60% 0; } }

/* ---- header ------------------------------------------------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 60; border-bottom: 1px solid var(--border); }
.site-header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.hdr { max-width: 1180px; margin: 0 auto; padding: 9px 16px; display: flex; align-items: center; gap: 14px; min-height: 58px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.logo img { width: 26px; height: 26px; }
.burger { display: none; width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; }
.burger span { width: 18px; height: 2px; border-radius: 2px; background: var(--text); }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-b, .nav-l { display: inline-flex; align-items: center; gap: 5px; padding: 8px 12px; border-radius: 9px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.94rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.nav-b:hover, .nav-l:hover, .nav-g.open > .nav-b { background: var(--surface-2); color: var(--text); }
.nav-g.has-cur > .nav-b, .nav-l[aria-current="page"] { color: var(--accent); }
.chev { transition: transform 0.15s; }
.nav-g.open > .nav-b .chev { transform: rotate(180deg); }
.nav-g { position: relative; }
.nav-m { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 270px; padding: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 5; }
.nav-m::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.nav-m.wide { min-width: 600px; gap: 4px 16px; grid-template-columns: 1fr 1fr; }
.nav-g.open > .nav-m { display: block; }
.nav-g.open > .nav-m.wide { display: grid; }
@media (hover: hover) and (min-width: 960px) {
  .nav-g:hover > .nav-m { display: block; }
  .nav-g:hover > .nav-m.wide { display: grid; }
  .nav-g:hover > .nav-b { background: var(--surface-2); color: var(--text); }
}
.nav-m a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav-m a:hover, .nav-m a:focus-visible { background: var(--surface-2); }
.nav-m a[aria-current="page"] .nm-t { color: var(--accent); }
.nm-t { font-weight: 600; font-size: 0.92rem; }
.nm-h { font-size: 0.78rem; color: var(--muted); }
.nm-cap { margin: 4px 10px 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.nav-close, .nav-theme { display: none; }
.nav-scrim { display: none; }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.chip-credits { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.88rem; text-decoration: none; white-space: nowrap; border: 1px solid transparent; }
.chip-credits:hover { border-color: var(--accent-line); }
.acct { position: relative; }
.acct-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 800; cursor: pointer; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 10; display: grid; }
.acct-menu a, .acct-menu button { display: block; text-align: left; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); font: inherit; font-size: 0.92rem; text-decoration: none; cursor: pointer; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--surface-2); }
.am-head, .am-credits { display: grid; padding: 8px 10px; min-width: 0; overflow-wrap: anywhere; }
.am-head { border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.am-credits { border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 700; color: var(--accent); }

@media (max-width: 959px) {
  .burger { display: inline-flex; }
  .nav { position: fixed; top: 0; left: 0; bottom: 0; width: min(88vw, 340px); flex-direction: column; align-items: stretch; gap: 2px; padding: 60px 12px 24px; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border-2); transform: translateX(-104%); visibility: hidden; transition: transform 0.22s ease, visibility 0s 0.22s; z-index: 2; box-shadow: var(--shadow-lg); }
  body.nav-open .nav { transform: none; visibility: visible; transition-delay: 0s; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 1; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .nav-close { display: inline-flex; position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 10px; font-size: 1.4rem; line-height: 1; cursor: pointer; }
  .nav-b, .nav-l { width: 100%; justify-content: space-between; padding: 12px; font-size: 1rem; color: var(--text); }
  .nav-m, .nav-m.wide { position: static; display: none; min-width: 0; padding: 0 0 6px 8px; background: transparent; border: 0; box-shadow: none; }
  .nav-g.open > .nav-m, .nav-g.open > .nav-m.wide { display: block; }
  .nav-m::before { display: none; }
  .nav-theme { display: block; margin-top: auto; padding: 12px; text-align: left; border: 0; border-top: 1px solid var(--border); background: none; color: var(--muted); font: inherit; cursor: pointer; }
}
@media (max-width: 520px) { .theme-btn { display: none; } .hdr { gap: 10px; } .pills li:nth-child(4) { display: none; } }

/* ---- buttons, forms ------------------------------------------------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 11px; min-height: 32px; font-size: 0.85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 48px; font-size: 1.02rem; }
.btn-ghost { background: none; border-color: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn .bi { display: inline-flex; }
textarea, input[type="text"], input[type="email"], select { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 12px; }
textarea { resize: vertical; min-height: 110px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%2393a89d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
label.field { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 6px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); }
.hint { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 0.9rem; margin: 10px 0; }
.notice.err { background: var(--danger-soft); color: var(--danger); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--border-2); background: var(--surface); color: var(--text); border-radius: 9px; padding: 7px 12px; font: inherit; font-size: 0.9rem; cursor: pointer; min-height: 36px; }
.seg button:hover { border-color: var(--accent-line); }
.seg button[aria-pressed="true"], .seg button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.tag { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 1px; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.tag.grey { background: var(--surface-3); color: var(--muted); }
.tag.new { background: var(--warn-soft); color: var(--warn); }
.tag.lock { background: var(--surface-3); color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; display: inline-block; flex: none; }
.spin.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 4px; border-radius: 2px; overflow: hidden; background: var(--surface-3); margin-top: 8px; width: 100%; }
.progress i { display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1.1s infinite ease-in-out; }
@keyframes slide { from { margin-left: -40%; } to { margin-left: 100%; } }

/* ---- hero + generator card ----------------------------------------------------------------------------------------------------- */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 0; padding: 0; margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 8px; opacity: 0.6; }
.crumbs a { color: var(--muted); }
.hero { margin-bottom: 4px; }
.hero-c { text-align: center; padding: 14px 0 4px; }
.hero-c h1 { font-size: clamp(2rem, 5.4vw, 3.2rem); letter-spacing: -0.03em; max-width: 18ch; margin-inline: auto; text-wrap: balance; }
.hero-c .lead { margin-inline: auto; margin-bottom: 14px; }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; margin: 0 0 6px; }
.pills li { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.pills li:first-child { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.widget { margin-bottom: 8px; }
.gen { max-width: 920px; margin: 18px auto 0; }
.gen-card { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); box-shadow: var(--shadow); transition: border-color 0.15s, box-shadow 0.15s; }
.gen-card:focus-within { border-color: var(--accent-line); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.gen-card.over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gen-top { display: flex; gap: 14px; padding: 14px 14px 4px; align-items: flex-start; }
.refs { display: grid; grid-template-columns: 82px; gap: 8px; flex: none; }
.refs.has { grid-template-columns: repeat(2, 82px); }
.thumbs { display: contents; }
.ref-add { width: 82px; height: 82px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1.5px dashed var(--border-2); border-radius: 12px; background: var(--surface-2); color: var(--muted); font: inherit; cursor: pointer; padding: 0; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.ref-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ref-t { font-size: 0.78rem; font-weight: 700; line-height: 1.1; }
.ref-s { font-size: 0.68rem; opacity: 0.8; line-height: 1.1; }
.refs-first .ref-add { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.thumb { position: relative; width: 82px; height: 82px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-2); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.busy img { opacity: 0.45; }
.thumb .spin { position: absolute; top: 50%; left: 50%; margin: -7px 0 0 -7px; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 14px; line-height: 22px; padding: 0; cursor: pointer; }
.gen-prompt { flex: 1; min-width: 0; }
.gen-prompt textarea { border: 0; background: transparent; resize: none; min-height: 84px; padding: 6px 2px; font-size: 1.04rem; line-height: 1.5; outline: none; border-radius: 0; }
.gen-prompt textarea::placeholder { color: var(--muted); opacity: 0.75; }
.gen-bar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; padding: 8px 12px 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 7px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: border-color 0.12s, background 0.12s; max-width: 100%; }
.chip:hover, .chip[aria-expanded="true"] { border-color: var(--accent-line); background: var(--surface-3); }
.chip .chev { color: var(--muted); flex: none; }
.chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip > .ashape { margin-left: 4px; }
.mico { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 800; color: #fff; background: #5f6f67; flex: none; }
.mico.v-bytedance { background: #3b6df0; }
.mico.v-openai { background: #56635d; }
.mico.v-google { background: #d99a1c; }
.mico.v-xai { background: #7a5ad0; }
.ashape { display: inline-block; border: 1.6px solid currentColor; border-radius: 3px; color: var(--muted); flex: none; }
.gen-go { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.gen-chars { font-size: 0.76rem; color: var(--muted); }
.btn-go { min-height: 42px; padding: 0 20px; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.gen-note { text-align: center; font-size: 0.84rem; color: var(--muted); margin: 10px 0 0; }
.gen > .notice { text-align: center; margin: 10px auto 0; max-width: 620px; background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent-line); border-radius: 999px; padding: 7px 16px; font-size: 0.84rem; }
.gen-ref-note { text-align: center; }
/* free-use rules under the Generate button / above the tool: plain text, readable without JS */
.free-rules { max-width: 640px; margin: 10px auto 0; text-align: center; font-size: 0.84rem; line-height: 1.5; color: var(--muted); }
.app > .free-rules, .app-ed > .free-rules { max-width: none; text-align: left; margin: 0 0 10px; }
/* gallery visibility row (signed-in: shows PUBLIC / PRIVATE with an inline switch) */
.gal-vis { max-width: 640px; margin: 10px auto 0; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; text-align: left; font-size: 0.84rem; color: var(--muted); }
.gal-vis .gv-t { flex: 1 1 260px; text-align: center; }
.gal-vis.has-switch { justify-content: space-between; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.gal-vis.has-switch .gv-t { text-align: left; }
.gal-vis strong { color: var(--text); letter-spacing: 0.02em; }
.sw { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--text); font: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer; padding: 2px; min-height: 32px; }
.sw .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-2); position: relative; transition: background 0.15s; flex: none; }
.sw .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.sw[aria-checked="true"] .track { background: var(--accent); }
.sw[aria-checked="true"] .track::after { transform: translateX(16px); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sw:disabled { opacity: 0.6; cursor: progress; }
.method { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 6px 16px 4px; margin: 10px 0 18px; }
.method .tbl-wrap { border: 0; background: none; margin: 4px 0 8px; }
.method .txt { margin: 0; }
.updated { color: var(--muted); font-size: 0.86rem; margin: 0 0 8px; }

/* popovers (model / aspect ratio / count). Bottom sheets on phones. */
.pop { position: absolute; z-index: 40; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.pop-back { display: none; }
.pop-model { width: min(660px, calc(100vw - 32px)); min-height: 300px; display: grid; grid-template-columns: 230px minmax(0, 1fr); max-height: min(470px, 72vh); overflow: hidden; }
.pm-vendors { padding: 8px; border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface-2); display: grid; gap: 4px; align-content: start; }
.pm-v { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text); font: inherit; cursor: pointer; }
.pm-v:hover { background: var(--surface-3); }
.pm-v[aria-selected="true"] { background: var(--surface); border-color: var(--border-2); }
.pm-v.dim { opacity: 0.6; }
.pv-b { display: grid; gap: 1px; min-width: 0; }
.pv-b strong { font-size: 0.9rem; }
.pv-b small { color: var(--muted); font-size: 0.76rem; line-height: 1.3; }
.pm-models { padding: 8px; overflow-y: auto; display: grid; gap: 4px; align-content: start; }
.opt { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; width: 100%; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text); font: inherit; cursor: pointer; }
.opt:hover:not(:disabled) { background: var(--surface-2); }
.opt[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent-line); }
.opt.soon { opacity: 0.5; cursor: not-allowed; }
.opt-b { display: grid; gap: 2px; min-width: 0; }
.opt-n { font-weight: 700; font-size: 0.93rem; }
.opt-n .tag:first-of-type { margin-left: 8px; }
.opt-d { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.opt-m { display: grid; justify-items: end; gap: 1px; text-align: right; white-space: nowrap; }
.opt-m b { font-size: 0.9rem; color: var(--accent); }
.opt-m small { color: var(--muted); font-size: 0.72rem; }
.pop-small { padding: 10px; min-width: 250px; }
.pop-cap { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 2px 4px 8px; }
.opt-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.opt-grid.c { grid-template-columns: repeat(4, 1fr); }
.opt-a, .opt-c { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 64px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.opt-c { min-height: 46px; font-size: 1rem; }
.opt-a:hover, .opt-c:hover { border-color: var(--accent-line); }
.opt-a[aria-selected="true"], .opt-c[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.opt-a .ashape { color: currentColor; }
@media (max-width: 640px) {
  .pop-back { display: block; position: fixed; inset: 0; z-index: 39; background: var(--scrim); }
  .pop, .pop-model { position: fixed; left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; z-index: 41; max-height: 82vh; padding-bottom: env(safe-area-inset-bottom); }
  .pop-model { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .pm-vendors { display: flex; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; gap: 6px; }
  .pm-v { flex: none; align-items: center; padding: 8px 10px; }
  .pv-b small { display: none; }
  .pop-small { padding: 14px 14px 18px; }
  .opt-grid { gap: 8px; }
}
@media (max-width: 640px) {
  .gen-top { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 12px 2px; }
  .refs, .refs.has { display: flex; flex-wrap: wrap; }
  .thumbs { display: contents; }
  .ref-add, .thumb { width: 62px; height: 62px; border-radius: 10px; }
  .ref-add { flex-direction: row; gap: 4px; width: auto; padding: 0 12px; }
  .ref-s { display: none; }
  .gen-prompt textarea { min-height: 72px; }
  .gen-bar { padding: 8px 10px 12px; }
  .gen-go { width: 100%; margin-left: 0; }
  .gen-chars { display: none; }
  .btn-go { width: 100%; }
}

/* ---- results feed -------------------------------------------------------------------------------------------------------------- */
.feed { margin-top: 22px; }
.feed-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius); margin-bottom: 14px; font-size: 0.92rem; }
.runs { display: grid; gap: 18px; }
.run { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; scroll-margin-top: 84px; animation: run-in 0.3s ease both; }
@keyframes run-in { from { opacity: 0; transform: translateY(8px); } }
.run-prompt { font-size: 0.98rem; margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.run-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rtag { font-size: 0.74rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.rtag.time { border-color: transparent; background: none; padding-left: 2px; }
.rtag.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.run-grid { display: grid; gap: 10px; margin-top: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.run-grid.n1 { grid-template-columns: minmax(0, 460px); }
.run-grid.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.run-grid.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); aspect-ratio: 1 / 1; min-width: 0; }
.tile:has(> .tile-hit img:not(.is-loaded):not(.is-error))::before, .tile.loading::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%); animation: shimmer 1.4s infinite; z-index: 1; pointer-events: none; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.tile-hit { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; display: block; }
.tile-hit:focus-visible { outline-offset: -4px; }
.tile-hit img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 0.3s; }
.tile-hit img.is-loaded { opacity: 1; }
.tile-acts { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; opacity: 0; transition: opacity 0.15s; z-index: 3; }
.tile:hover .tile-acts, .tile:focus-within .tile-acts { opacity: 1; }
@media (hover: none) { .tile-acts { opacity: 1; } }
.tile-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: rgba(8, 13, 11, 0.74); color: #fff; border: 1px solid rgba(255, 255, 255, 0.16); cursor: pointer; padding: 0; text-decoration: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tile-btn:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tile-state { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; text-align: center; font-size: 0.85rem; color: var(--muted); }
.tile-state strong { color: var(--text); font-size: 0.92rem; }
.tile-state.err { color: var(--danger); }
.tile-state.err strong { color: var(--danger); }
.tile-state .ts-why { word-break: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tile-state small { color: var(--muted); }
.ts-time { font-size: 0.78rem; min-height: 1.2em; }
.ts-bar { width: min(72%, 180px); height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.ts-bar i { display: block; height: 100%; width: 4%; background: var(--accent); border-radius: 2px; transition: width 0.5s linear; }
.ts-signin { font-size: 0.76rem; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; margin-top: 2px; }
.ts-signin:hover { color: var(--accent); }
button.vis { position: absolute; top: 8px; left: 8px; z-index: 3; border: 1px solid var(--border-2); background: rgba(8, 13, 11, 0.74); color: #d7e3dc; font: inherit; font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; cursor: pointer; min-height: 26px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
button.vis.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.vis.mid { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
button.vis:disabled { opacity: 0.6; cursor: wait; }
button.vis.info:disabled { opacity: 0.9; cursor: default; }
.run-foot { margin-top: 12px; display: grid; gap: 8px; }
.run-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.run-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.vis-note { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; border: 1px dashed var(--border-2); border-radius: var(--radius); }
.results { display: grid; gap: 16px; }
@media (max-width: 640px) { .run-grid.n3, .run-grid.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .run { padding: 12px; } }

/* sticky compact prompt bar */
.sticky-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--border); animation: sb-in 0.2s ease; }
@keyframes sb-in { from { transform: translateY(100%); } }
.sb-in { max-width: 780px; margin: 0 auto; display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border-2); border-radius: 999px; padding: 5px 5px 5px 18px; box-shadow: var(--shadow); }
.sb-in:focus-within { border-color: var(--accent-line); }
.sb-in input { border: 0; background: transparent; padding: 8px 0; outline: none; border-radius: 0; min-width: 0; }
.sb-in .btn { border-radius: 999px; font-weight: 800; white-space: nowrap; min-height: 40px; }
body.has-sticky .toasts { bottom: 84px; }
body.has-sticky .site-footer { padding-bottom: 70px; }

/* ---- lightbox ------------------------------------------------------------------------------------------------------------------- */
.lb { position: fixed; inset: 0; z-index: 90; background: rgba(3, 7, 5, 0.95); display: flex; flex-direction: column; animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; color: #fff; }
.lb-count { font-size: 0.9rem; opacity: 0.8; }
.lb-btn, .lb-nav { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.1); color: #fff; border: 0; cursor: pointer; text-decoration: none; padding: 0; }
.lb-btn:hover, .lb-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lb-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 64px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; opacity: 0; transition: opacity 0.2s; }
.lb-img.is-loaded { opacity: 1; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-nav.prev { left: 12px; } .lb-nav.next { right: 12px; }
.lb-cap { text-align: center; color: #c5d2cb; padding: 10px 20px 18px; margin: 0; font-size: 0.9rem; max-height: 4.6em; overflow: hidden; }
@media (max-width: 640px) { .lb-stage { padding: 0 8px; } .lb-nav { top: auto; bottom: 8px; transform: none; background: rgba(0, 0, 0, 0.55); } }

/* ---- app shell: preset tools (left controls / right image) and the editor ------------------------------------------------------ */
.app { margin-top: 10px; }
.app-shell { display: grid; grid-template-columns: 340px minmax(0, 1fr); border: 1px solid var(--border-2); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; min-height: 580px; box-shadow: var(--shadow); }
.app-side { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; }
.side-body { padding: 16px; display: grid; gap: 20px; align-content: start; flex: 1; }
.side-foot { padding: 14px 16px 16px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); z-index: 3; }
.side-foot .hint { text-align: center; margin: 8px 0 0; }
.side-h { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 8px; }
.side-block label.field:first-child { margin-top: 0; }
.drop.big { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 26px 14px; border: 1.5px dashed var(--border-2); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font: inherit; cursor: pointer; text-align: center; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.drop.big svg { color: var(--accent); margin-bottom: 4px; }
.drop.big strong { color: var(--text); font-size: 1rem; }
.drop.big:hover, .drop.big.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.cur { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.cur img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border-2); }
.cur span { flex: 1; color: var(--muted); }
.app-main { padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; background: var(--bg-2); }
.app-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stage-wrap { position: relative; flex: 1; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; justify-content: center; align-items: center; min-height: 300px; }
.stage { position: relative; line-height: 0; max-width: 100%; }
.stage canvas { max-width: 100%; height: auto; display: block; }
.stage .paint { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.6; touch-action: none; cursor: crosshair; }
.stage.no-paint .paint { display: none; }
.compare { position: relative; line-height: 0; max-width: 100%; user-select: none; -webkit-user-select: none; }
.compare img { max-width: 100%; max-height: 66vh; display: block; }
.app-ed .compare img { max-height: 52vh; }
.compare .after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos, 50%)); }
.compare .after img { width: 100%; height: 100%; object-fit: fill; }
.compare .bar { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); pointer-events: none; }
.compare .bar::after { content: "\2194"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #111; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 8px rgba(0, 0, 0, 0.45); line-height: 1; }
.compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare .lbl { position: absolute; top: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 0.72rem; line-height: 1.4; }
.compare .lbl.l { left: 8px; } .compare .lbl.r { right: 8px; }
.app-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 22px 10px; }
.ae-t { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.015em; margin: 0 0 6px; }
.ae-s { color: var(--muted); max-width: 32rem; margin: 0 0 22px; }
.samples { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.sample { width: 128px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; transition: border-color 0.15s, transform 0.15s; }
.sample:hover { border-color: var(--accent); transform: translateY(-2px); }
.sample img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.sample span { display: block; padding: 7px 10px; font-size: 0.82rem; font-weight: 600; }
.sample.busy { opacity: 0.55; pointer-events: none; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.ed-steps .steps { margin: 0; }
.step { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px 3px 3px; font-size: 0.78rem; background: var(--surface-2); color: var(--muted); }
.step img { width: 34px; height: 34px; border-radius: 5px; object-fit: cover; display: block; }
.step.cur { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 0.85rem; color: var(--muted); }
.status .progress { flex-basis: 100%; margin-top: 0; }
.app .notice { margin-bottom: 10px; }
@media (max-width: 899px) {
  /* one column, interleaved: photo upload, then the intro + samples (or the image once one is loaded), then options + Run */
  .app-shell { display: flex; flex-direction: column; min-height: 0; }
  .app-side, .side-body { display: contents; }
  .side-body > .side-block { order: 3; padding: 16px; border-top: 1px solid var(--border); }
  .side-body > .side-block:first-child { order: 1; border-top: 0; }
  .app-main { order: 2; border-top: 1px solid var(--border); }
  .app.has-img .app-main { order: 0; border-top: 0; }
  .app.has-img .side-body > .side-block:first-child { border-top: 1px solid var(--border); }
  .side-foot { order: 4; position: static; }
  .app-empty { padding: 10px 0; }
  .ae-s { margin-bottom: 14px; }
  .sample { width: calc(33.3% - 8px); min-width: 96px; max-width: 150px; }
  .stage-wrap { min-height: 220px; }
}

/* editor */
.ed { border: 1px solid var(--border-2); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.ed-top { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--border-2); }
.ed-top .app-bar { justify-content: flex-end; }
.ed-brush { display: flex; align-items: center; gap: 10px 16px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ed-brush .hint { margin: 0; flex: 1 1 240px; }
.eb-size { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.eb-size input { width: 140px; }
.ed-canvas { padding: 14px; display: flex; flex-direction: column; min-height: 420px; }
.ed-canvas .stage-wrap { min-height: 360px; }
.ed-bar { display: flex; gap: 10px; align-items: flex-end; margin: 0 14px 12px; padding: 8px 8px 8px 16px; border: 1px solid var(--border-2); border-radius: 16px; background: var(--surface-2); }
.ed-bar:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-input { flex: 1; min-width: 0; align-self: center; }
.ed-input textarea { border: 0; background: transparent; resize: none; min-height: 38px; max-height: 150px; padding: 8px 0; outline: none; border-radius: 0; line-height: 1.45; }
.ed-note { margin: 0; padding: 8px 0; color: var(--muted); font-size: 0.92rem; }
.ed-act { display: flex; gap: 8px; align-items: center; flex: none; }
.sel select { width: auto; border-radius: 999px; padding: 8px 30px 8px 14px; background-color: var(--surface); font-size: 0.85rem; font-weight: 600; max-width: 200px; }
.ed-act .btn-primary { border-radius: 999px; min-height: 42px; padding: 0 20px; font-weight: 800; white-space: nowrap; }
.ed-hint { margin: -4px 16px 10px; text-align: right; }
.ed .status { margin: 0 16px 10px; }
.ed-steps { border-top: 1px solid var(--border); padding: 10px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ed-steps .side-h { margin: 0; }
@media (max-width: 640px) {
  .ed-bar { flex-direction: column; align-items: stretch; margin: 0 10px 10px; padding: 10px 12px; }
  .ed-act { justify-content: space-between; }
  .ed-act .sel { flex: 1; } .sel select { max-width: 100%; width: 100%; }
  .ed-canvas { padding: 10px; }
  .ed-hint { text-align: left; margin-inline: 12px; }
  .ed-top .app-bar { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
  .ed-top .app-bar .btn { flex: none; }
}

/* ---- modals / toasts ------------------------------------------------------------------------------------------------------------ */
.modal-back { position: fixed; inset: 0; z-index: 100; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); animation: fade 0.15s ease; }
.modal { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-lg); max-height: 92vh; overflow-y: auto; }
.modal h2 { margin-bottom: 4px; }
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--bg); padding: 10px 12px 10px 14px; border-radius: 10px; font-size: 0.92rem; box-shadow: var(--shadow-lg); animation: run-in 0.2s ease both; }
.toast.err { background: var(--danger); color: #fff; }
:root:not([data-theme="light"]) .toast.err { background: #5b1f1b; color: #ffd9d5; border: 1px solid #8a3029; }
.toast-msg { flex: 1; word-break: break-word; }
.toast-act { flex: none; border: 1px solid currentColor; background: none; color: inherit; font: inherit; font-weight: 700; font-size: 0.82rem; padding: 4px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.toast-x { flex: none; border: 0; background: none; color: inherit; opacity: 0.7; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.ts-overlay { position: fixed; inset: 0; z-index: 110; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ts-card { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 360px; width: 100%; }
.ts-card p { margin: 0; font-weight: 600; text-align: center; }
.ts-holder { min-height: 65px; max-width: 100%; overflow-x: auto; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .toast.err { background: var(--danger); color: #fff; border: 0; } }

/* sign-in modal */
.login-head { text-align: center; margin-bottom: 18px; }
.login-logo { display: block; margin: 0 auto 10px; border-radius: 14px; }
.login-head h2 { margin: 0 0 4px; }
.login-sub { color: var(--accent); font-weight: 600; margin: 0 0 4px; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; padding: 12px 16px; text-decoration: none; }
.btn-google:hover { background: #f6f8fa; }
.g-icon { display: inline-flex; }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; margin: 16px 0 6px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-note { text-align: center; margin-top: 14px; }

/* ---- content sections of the generated pages ----------------------------------------------------------------------------------- */
.seo { margin-top: 28px; }
.sec { margin-top: 56px; scroll-margin-top: 90px; }
.sec > h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.2; margin-bottom: 14px; letter-spacing: -0.02em; }
.txt { max-width: 46rem; }
.txt p, .txt li { line-height: 1.68; }
.txt ul, .txt ol { padding-left: 1.3rem; margin: 0 0 12px; }
.txt li { margin-bottom: 6px; }
.txt h3 { margin-top: 18px; font-size: 1.05rem; }
.sec > .txt { color: color-mix(in srgb, var(--text) 86%, var(--muted)); margin-bottom: 18px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }
.ex-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); margin: 14px 0; }
.ex-grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
figure.ex { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
figure.ex img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background-color: var(--surface-2); }
figure.ex figcaption { padding: 10px 12px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
.prm { color: var(--muted); font-size: 0.82rem; line-height: 1.45; display: block; word-break: break-word; }
.prm .k { font-weight: 700; }
.ba-set { margin: 14px 0 22px; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 760px; }
.ba-cap { font-size: 0.9rem; margin-top: 8px; max-width: 46rem; }
.how { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 46rem; }
.how li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; align-items: start; }
.how li::before { content: counter(s); grid-row: 1 / span 2; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.how li span { color: var(--muted); }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); margin: 12px 0; }
.cards .card { box-shadow: none; }
.cards .card h3 { margin-bottom: 6px; }
.cards .card p { margin: 0; color: var(--muted); font-size: 0.93rem; line-height: 1.55; }
a.lcard { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); transition: border-color 0.15s, transform 0.15s; }
a.lcard:hover { border-color: var(--accent); transform: translateY(-2px); }
a.lcard span { color: var(--muted); font-size: 0.9rem; }
a.lcard.soon { opacity: 0.55; pointer-events: none; }
.lcard.soon { opacity: 0.55; }
div.lcard { cursor: default; }
.tbl-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tbl-wrap table.t { min-width: 520px; }
table.t { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.t th, table.t td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.t th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
table.t th[scope="row"] { color: var(--text); font-weight: 600; font-size: inherit; }
table.t tr:last-child th, table.t tr:last-child td { border-bottom: 0; }
.faq { max-width: 46rem; display: grid; gap: 4px; }
.faq .qa { padding: 14px 0; border-bottom: 1px solid var(--border); }
.faq h3 { margin-bottom: 4px; }
.faq p { margin: 0; line-height: 1.6; color: color-mix(in srgb, var(--text) 84%, var(--muted)); }
.cta-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 18px; margin-top: 44px; }
.cta-band p { margin: 0; font-weight: 600; max-width: 40rem; }
.cmp-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin: 0 0 8px; }
.cmp-h { font-size: 1.05rem; margin: 26px 0 2px; }
.cmp-p { margin: 0 0 10px; max-width: 46rem; }
.promptbox { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 12px; font-size: 0.9rem; color: var(--muted); line-height: 1.55; }
@media (max-width: 520px) { .cmp-grid { gap: 8px; } figure.ex figcaption { padding: 8px; font-size: 0.82rem; } .ba { gap: 6px; } }

/* ---- home grids: tools (split covers), models, inspiration wall ----------------------------------------------------------------- */
@property --p { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
.tool-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.tool-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); text-decoration: none; color: var(--text); transition: border-color 0.15s, transform 0.2s, box-shadow 0.2s; }
.tool-card:hover { border-color: var(--accent-line); transform: translateY(-3px); box-shadow: var(--shadow); }
.split { --p: 50%; transition: --p 0.4s ease; display: block; position: relative; aspect-ratio: 5 / 4; overflow: hidden; background: var(--surface-2); }
.tool-card:hover .split { --p: 64%; }
.split-a, .split-b { position: absolute; inset: 0; display: block; }
.split-a { clip-path: inset(0 calc(100% - var(--p)) 0 0); }
.split-b { clip-path: inset(0 0 0 var(--p)); }
.split img { display: block; width: 100%; height: 100%; object-fit: cover; }
.split-bar { position: absolute; top: 0; bottom: 0; left: var(--p); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); }
.split-bar::after { content: ""; position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45); }
.split-l { position: absolute; bottom: 8px; padding: 2px 8px; font-size: 0.68rem; font-weight: 700; background: rgba(0, 0, 0, 0.62); color: #fff; border-radius: 6px; }
.split-l.l { left: 8px; } .split-l.r { right: 8px; }
.tc-body { display: block; padding: 12px 14px 14px; }
.tc-body h3 { margin: 0 0 4px; font-size: 1.05rem; }
.tc-t { color: var(--muted); font-size: 0.9rem; line-height: 1.45; display: block; }
.model-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.model-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); transition: border-color 0.15s, transform 0.15s; }
a.model-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.model-card .mico { width: 38px; height: 38px; border-radius: 10px; font-size: 1.05rem; }
.model-card.soon { opacity: 0.5; cursor: default; }
.mc-body { display: grid; gap: 3px; min-width: 0; }
.mc-body h3 { margin: 0; font-size: 1rem; }
.mc-d { color: var(--text); font-size: 0.88rem; line-height: 1.4; }
.mc-m { color: var(--muted); font-size: 0.78rem; }
.inspire { column-gap: 12px; columns: 4 210px; }
.insp { position: relative; display: block; break-inside: avoid; margin: 0 0 12px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 1 / 1; border: 1px solid var(--border); text-decoration: none; color: #fff; }
.insp.tall { aspect-ratio: 3 / 4; } .insp.wide { aspect-ratio: 4 / 3; }
.insp img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.insp:hover img { transform: scale(1.04); }
.insp-l { position: absolute; left: 0; right: 0; bottom: 0; padding: 36px 10px 10px; display: flex; flex-direction: column; gap: 6px; background: linear-gradient(transparent, rgba(3, 8, 6, 0.86)); opacity: 0; transition: opacity 0.2s; }
.insp:hover .insp-l, .insp:focus-visible .insp-l { opacity: 1; }
@media (hover: none) { .insp-l { opacity: 1; } }
.insp-n { font-size: 0.8rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.insp-try { align-self: flex-start; font-size: 0.74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
@media (max-width: 520px) { .inspire { columns: 2; column-gap: 8px; } .insp { margin-bottom: 8px; } .tool-cards { grid-template-columns: 1fr 1fr; gap: 10px; } .tc-t { display: none; } .tc-body { padding: 10px; } }

/* ---- pricing / tables / footer ----------------------------------------------------------------------------------------------------- */
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.price { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.prose { max-width: 46rem; } .prose h2 { margin-top: 22px; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; margin-top: 24px; }
.ftr { max-width: 1180px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.ftr a { color: var(--muted); }
.ftr2 { max-width: 1180px; margin: 0 auto; padding: 24px 16px 4px; display: grid; gap: 18px 22px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ftr2 .fh { font-weight: 700; color: var(--text); margin: 0 0 6px; font-size: 0.85rem; }
.ftr2 ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ftr2 a { color: var(--muted); text-decoration: none; }
.ftr2 a:hover { color: var(--accent); text-decoration: underline; }

/* ---- public gallery (/gallery, /p/<id>, History) --------------------------------------------------------------------------------------- */
.gfilter { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; }
.gfilter a { border: 1px solid var(--border-2); background: var(--surface); color: var(--text); border-radius: 9px; padding: 6px 11px; font-size: 0.88rem; text-decoration: none; white-space: nowrap; }
.gfilter a:hover { border-color: var(--accent); }
.gfilter a[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.ggrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); align-items: start; }
.gitem { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.gitem a { display: block; line-height: 0; background: var(--surface-2); }
.gitem img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; } /* square thumbnails; the item page shows the full image */
.gitem figcaption { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.gprompt { font-size: 0.85rem; line-height: 1.35; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gmodel { font-size: 0.75rem; color: var(--muted); }
.gmore { text-align: center; margin: 22px 0 8px; }
.ginfo { max-width: 46rem; margin-top: 22px; }
#shared { margin-bottom: 26px; }
.pitem { display: grid; gap: 22px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 900px) { .pitem { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }
.pfig { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); line-height: 0; }
.pfig img { width: 100%; height: auto; display: block; }
.pfig.hid img { filter: blur(24px); }
.pinfo h2 { margin-top: 0; }
.pmeta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0; font-size: 0.93rem; }
.pmeta dt { color: var(--muted); }
.pmeta dd { margin: 0; }
.pinfo .row { margin: 14px 0; }
details.report { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
details.report summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details.report select { max-width: 340px; }
@media (max-width: 520px) {
  .ggrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gfilter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .gfilter::-webkit-scrollbar { display: none; }
  .gitem figcaption { padding: 6px 8px 8px; }
  .gprompt { font-size: 0.8rem; -webkit-line-clamp: 2; }
  .pmeta { grid-template-columns: 1fr; gap: 0; } .pmeta dd { margin-bottom: 8px; }
}

/* skeleton rows (history, gallery "load more") */
.sk { display: block; height: 14px; border-radius: 6px; background: var(--surface-3); margin-bottom: 8px; width: 70%; }
.sk.s { width: 40%; }
.gskel .gthumb { aspect-ratio: 1 / 1; background: var(--surface-2); position: relative; overflow: hidden; }
.gskel .gthumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%); animation: shimmer 1.4s infinite; }
.gskel figcaption { width: 100%; }
