/* =========================================================
   Imagify UI — frontend only
   Direction: a camera viewfinder. Quiet ink surfaces, one violet-to-blue
   brand gradient, thirds grid + corner brackets on the drop zone.
   Desktop = top navigation + two-column hero. Mobile = dock + thumb-first flow.
   ========================================================= */

/* ---------- tokens ---------- */
:root {
  --f-display: "Bricolage Grotesque", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-body: "Figtree", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0a0b11;
  --surface: #11131b;
  --surface-2: #181b26;
  --surface-3: #202434;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .15);
  --ink: #f3f4f8;
  --ink-2: #c3c8d8;
  --muted: #8d93a8;
  --accent: #8f81ff;
  --accent-soft: rgba(143, 129, 255, .14);
  --grad: linear-gradient(135deg, #6a4bf2 0%, #2f7cf0 100%);
  --on-accent: #fff;
  --ok: #3ddc97;
  --danger: #ff6b81;
  --shadow-panel: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 40px 80px -40px rgba(0, 0, 0, .8), 0 0 0 1px rgba(0, 0, 0, .3);
  --shadow-pop: 0 18px 50px -18px rgba(0, 0, 0, .75);
  --glow: radial-gradient(60% 60% at 50% 0%, rgba(106, 75, 242, .22), transparent 70%);
  --header-h: 68px;
  --dock-h: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eff1f7;
  --surface-3: #e6e9f2;
  --line: rgba(16, 20, 40, .09);
  --line-2: rgba(16, 20, 40, .18);
  --ink: #0f1222;
  --ink-2: #3a4058;
  --muted: #5f667c;
  --accent: #5a3fe0;
  --accent-soft: rgba(90, 63, 224, .09);
  --ok: #0b8f5b;
  --danger: #d02a47;
  --shadow-panel: 0 1px 0 #fff inset, 0 30px 60px -34px rgba(30, 40, 90, .28), 0 0 0 1px rgba(16, 20, 40, .06);
  --shadow-pop: 0 18px 40px -16px rgba(30, 40, 90, .28);
  --glow: radial-gradient(60% 60% at 50% 0%, rgba(106, 75, 242, .10), transparent 70%);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f5f6fa; --surface: #ffffff; --surface-2: #eff1f7; --surface-3: #e6e9f2;
    --line: rgba(16, 20, 40, .09); --line-2: rgba(16, 20, 40, .18);
    --ink: #0f1222; --ink-2: #3a4058; --muted: #5f667c;
    --accent: #5a3fe0; --accent-soft: rgba(90, 63, 224, .09);
    --ok: #0b8f5b; --danger: #d02a47;
    --shadow-panel: 0 1px 0 #fff inset, 0 30px 60px -34px rgba(30, 40, 90, .28), 0 0 0 1px rgba(16, 20, 40, .06);
    --shadow-pop: 0 18px 40px -16px rgba(30, 40, 90, .28);
    --glow: radial-gradient(60% 60% at 50% 0%, rgba(106, 75, 242, .10), transparent 70%);
    color-scheme: light;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg) var(--glow) no-repeat; background-size: 100% 640px;
  color: var(--ink); font: 400 16px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden;
}
[hidden] { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; }
img, video { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; transition: top .2s; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.m-only { display: none; }

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.03em; line-height: 1.08; text-wrap: balance; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
  transition: background .18s, border-color .18s, transform .12s, box-shadow .18s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: var(--grad); border-color: transparent; color: var(--on-accent); box-shadow: 0 10px 28px -12px rgba(76, 90, 240, .9), 0 1px 0 rgba(255, 255, 255, .25) inset; }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-quiet { border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; text-decoration: none;
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.theme-ico { display: none; }
:root[data-theme="auto"] .ti-auto, :root[data-theme="light"] .ti-light, :root[data-theme="dark"] .ti-dark { display: block; }

.link-btn { background: none; border: 0; padding: 6px 4px; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; border-radius: 8px; }
.link-btn:hover { color: var(--ink); }

input[type=search], input[type=password], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; transition: border-color .18s, background .18s;
}
input[type=search]:hover, input[type=password]:hover, textarea:hover, select:hover { border-color: var(--line-2); }
:is(input, textarea, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
select {
  appearance: none; padding: 9px 34px 9px 12px; font-size: 14px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d93a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
textarea { padding: 14px; resize: vertical; min-height: 128px; font: 13.5px/1.7 var(--f-mono); }
input[type=password] { padding: 12px 14px; width: 100%; }

/* ---------- header (desktop) ---------- */
.top { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); }
.top-in { max-width: 1200px; margin: 0 auto; height: var(--header-h); padding: 0 32px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font: 700 21px/1 var(--f-display); letter-spacing: -.04em; }
.brand-mark { width: 34px; height: 34px; filter: drop-shadow(0 6px 14px rgba(90, 86, 240, .35)); }
.main-nav { display: flex; gap: 2px; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 11px; border: 0; background: none;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: color .18s, background .18s;
}
.nav-tab .i { width: 18px; height: 18px; }
.nav-tab:hover { color: var(--ink); background: var(--surface-2); }
.nav-tab.on { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- dock (mobile only) ---------- */
.dock { display: none; }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 72px 32px 40px; }
.section { margin-top: 128px; }
.section-head { max-width: 640px; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(30px, 3.4vw, 44px); }
.section-head p { margin-top: 14px; color: var(--muted); font-size: 17px; max-width: 54ch; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 24px 80px; align-items: center;
  grid-template-areas: "copy panel" "perks panel";
}
.hero-copy { grid-area: copy; align-self: end; }
.hero h1 { font-size: clamp(44px, 5.2vw, 70px); line-height: 1.03; letter-spacing: -.045em; max-width: 14.5ch; }
.lede { margin-top: 24px; font-size: 18px; line-height: 1.65; color: var(--muted); max-width: 46ch; }
.lede b { color: var(--ink-2); font-weight: 600; }
.perks { grid-area: perks; align-self: start; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.perks li { display: grid; gap: 14px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.perk-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.perks b { display: block; font: 700 15px/1.25 var(--f-display); letter-spacing: -.02em; }
.perks span.s { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ---------- upload panel ---------- */
.panel { grid-area: panel; display: grid; gap: 16px; padding: 18px; border-radius: 26px; background: var(--surface); box-shadow: var(--shadow-panel); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; transition: color .18s, background .18s; }
.seg button .i { width: 18px; height: 18px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 0 0 1px var(--line); }
:root[data-theme="light"] .seg button.on { box-shadow: 0 1px 3px rgba(20, 30, 70, .12), 0 0 0 1px var(--line); }

/* the viewfinder */
.drop {
  --inset: 16px;
  position: relative; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center;
  min-height: 300px; padding: 40px 28px; border-radius: 18px; cursor: pointer; isolation: isolate; overflow: hidden;
  background-color: var(--surface-2);
  background-image:
    linear-gradient(to right, transparent calc(100% - 1px), color-mix(in srgb, var(--ink) 6%, transparent) 0),
    linear-gradient(to bottom, transparent calc(100% - 1px), color-mix(in srgb, var(--ink) 6%, transparent) 0);
  background-size: 33.3334% 33.3334%;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s, background-color .2s;
}
.drop:hover, .drop:focus-visible, .drop.over { --inset: 26px; background-color: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); outline: 0; }
.drop:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.vf { position: absolute; width: 28px; height: 28px; border: 0 solid var(--accent); pointer-events: none; transition: inset .28s cubic-bezier(.2, .8, .2, 1), opacity .2s; opacity: .9; }
.vf-tl { top: var(--inset); left: var(--inset); border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 10px; }
.vf-tr { top: var(--inset); right: var(--inset); border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 10px; }
.vf-bl { bottom: var(--inset); left: var(--inset); border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 10px; }
.vf-br { bottom: var(--inset); right: var(--inset); border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 10px; }
.drop-ico { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 10px; border-radius: 18px; background: var(--grad); color: #fff; box-shadow: 0 14px 30px -12px rgba(76, 90, 240, .85), 0 1px 0 rgba(255, 255, 255, .3) inset; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.drop-ico .i { width: 26px; height: 26px; }
.drop:hover .drop-ico, .drop.over .drop-ico { transform: translateY(-4px); }
.drop strong { font: 700 20px/1.2 var(--f-display); letter-spacing: -.03em; }
.drop-sub { color: var(--muted); font-size: 14px; }
.drop-limit { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 55%, transparent); box-shadow: 0 0 0 1px var(--line); color: var(--muted); font-size: 12.5px; }
.drop-limit .i { width: 15px; height: 15px; }

.urlbox { display: grid; gap: 12px; }
.urlbox .row { gap: 12px; }

.opts-wrap { border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.opts-wrap summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; user-select: none; border-radius: 14px; }
.opts-wrap summary::-webkit-details-marker { display: none; }
.opts-wrap summary .i { width: 18px; height: 18px; color: var(--muted); }
.opts-wrap summary .chev { margin-left: auto; transition: transform .2s; }
.opts-wrap[open] summary .chev { transform: rotate(180deg); }
.summary-hint { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-hint + .chev { margin-left: 0; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 4px 14px 16px; }
.opts[data-off] .field:not(.switch-row) { opacity: .4; pointer-events: none; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.field select { width: 100%; color: var(--ink); font-weight: 500; }
.field-wide { grid-column: 1 / -1; }
.field .q-head { display: flex; justify-content: space-between; }
.field output { color: var(--ink); font-variant-numeric: tabular-nums; }
.switch-row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); font-size: 14px; cursor: pointer; }
.switch-row small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; margin-top: 2px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.switch input:checked + i { background: var(--grad); box-shadow: none; }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 3px; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; margin: 0; }

/* ---------- upload queue ---------- */
.queue { list-style: none; padding: 0; display: grid; gap: 12px; margin-top: 40px; }
.queue:empty { margin: 0; }
.item { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 8px 16px; align-items: center; padding: 14px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); animation: pop .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.thumb { grid-row: span 2; width: 68px; height: 68px; border-radius: 12px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.meta { min-width: 0; }
.name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-top: 2px; font-size: 13px; color: var(--muted); }
.sub .i { width: 14px; height: 14px; }
.sub b { color: var(--ink); font-weight: 600; }
.save { padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); font-weight: 700; font-size: 12px; }
.bar-p { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.bar-p i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--grad); transition: width .2s; }
.item.err { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 55%, transparent); }
.item.err .sub { color: var(--danger); }
.item.ok .bar-p { display: none; }
.res { grid-column: 1 / -1; display: grid; gap: 10px; }
.short { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font: 13.5px var(--f-mono); }
.short > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: background .18s, border-color .18s, color .18s; }
.chip .i { width: 15px; height: 15px; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.main { background: var(--grad); border-color: transparent; color: #fff; }
.chip.main:hover { filter: brightness(1.1); }
.chip.done { background: var(--ok); border-color: transparent; color: #07140d; }

/* ---------- recent ---------- */
.recent { margin-top: 56px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.recent h2 { font: 700 18px/1.2 var(--f-display); letter-spacing: -.02em; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.rgrid button { position: relative; padding: 0; border: 0; aspect-ratio: 1; border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.rgrid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.rgrid button:hover img { transform: scale(1.06); }
.rgrid .cp { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(8, 9, 14, .55); opacity: 0; transition: opacity .18s; }
.rgrid button:hover .cp, .rgrid button:focus-visible .cp { opacity: 1; }

/* ---------- features (bento) ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.feat { display: flex; flex-direction: column; gap: 10px; padding: 26px; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); grid-column: span 2; }
.feat.wide { grid-column: span 3; }
.feat-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.feat h3 { font-size: 21px; }
.feat p { color: var(--muted); font-size: 15px; line-height: 1.65; max-width: 44ch; }
.feat-vis { margin-top: auto; padding-top: 18px; }
.vis-bars { display: grid; gap: 12px; }
.vis-bar { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.vis-bar div { display: flex; justify-content: space-between; }
.vis-bar b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.vis-bar i { display: block; height: 10px; border-radius: 6px; background: var(--surface-3); }
.vis-bar.after i { width: 12%; background: var(--grad); }
.vis-meta { display: grid; gap: 8px; font: 13px var(--f-mono); }
.vis-meta div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.vis-meta s { text-decoration-thickness: 1.5px; text-decoration-color: var(--danger); }
.vis-meta em { font: 600 11.5px var(--f-body); font-style: normal; color: var(--ok); white-space: nowrap; }
.vis-link { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--surface-2); font: 13px var(--f-mono); color: var(--ink-2); overflow: hidden; }
.vis-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vis-link .i { width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.vis-types { display: flex; gap: 8px; }
.vis-types span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); }

/* ---------- steps ---------- */
.steps { list-style: none; padding: 0; counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.steps li { counter-increment: step; position: relative; padding-top: 34px; border-top: 1px solid var(--line-2); }
.steps li::before { content: counter(step); position: absolute; top: -19px; left: 0; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--grad); color: #fff; font: 700 16px var(--f-display); box-shadow: 0 0 0 6px var(--bg); }
.steps h3 { font-size: 21px; margin-bottom: 8px; }
.steps p { color: var(--muted); font-size: 15.5px; max-width: 34ch; }

/* ---------- FAQ ---------- */
.faq { display: grid; max-width: 820px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 4px; cursor: pointer; list-style: none; font: 600 18px/1.35 var(--f-display); letter-spacing: -.02em; border-radius: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .i { color: var(--muted); transition: transform .25s, color .18s; }
.faq summary:hover .i { color: var(--ink); }
.faq details[open] summary .i { transform: rotate(180deg); color: var(--accent); }
.faq .ans { padding: 0 4px 24px; color: var(--muted); font-size: 16px; line-height: 1.75; max-width: 64ch; }
.faq .ans a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- developer strip ---------- */
.dev { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: center; padding: 44px; border-radius: 28px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.dev h2 { font-size: clamp(28px, 3vw, 38px); }
.dev p { margin: 14px 0 26px; color: var(--muted); max-width: 44ch; }
.codebox { border-radius: 16px; background: #0b0d14; color: #dfe3f0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); overflow: hidden; }
.codebox-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); color: #8d93a8; font-size: 13px; }
.codebox-top .i { width: 16px; height: 16px; }
.codebox pre { padding: 18px 20px; overflow: auto; font: 13.5px/1.8 var(--f-mono); white-space: pre; }
.t-dim { color: #6f7690; } .t-key { color: #a99bff; } .t-str { color: #7fe3b7; }

/* ---------- gallery ---------- */
.view-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; }
.view-head h2 { font-size: clamp(28px, 3vw, 38px); }
.bar { display: flex; gap: 10px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search .i { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; width: 18px; height: 18px; }
.search input { width: 100%; padding: 11px 14px 11px 42px; min-height: 44px; }
.grid { columns: 5 200px; column-gap: 14px; }
.card { break-inside: avoid; margin-bottom: 14px; position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 16px; overflow: hidden; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; text-align: left; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-pop); }
.card img { display: block; width: 100%; height: auto; min-height: 64px; }
.card .ph { display: grid; place-items: center; gap: 8px; padding: 34px 12px; color: var(--muted); font-size: 12.5px; text-align: center; word-break: break-all; }
.card .ph .i { width: 28px; height: 28px; }
.card .cap { position: absolute; inset: auto 0 0; padding: 30px 12px 10px; font-size: 12.5px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); opacity: 0; transition: opacity .18s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card:hover .cap, .card:focus-visible .cap { opacity: 1; }
.card .tick { position: absolute; top: 10px; left: 10px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .45); display: none; place-items: center; color: #fff; }
.card .tick .i { width: 14px; height: 14px; }
.selecting .card .tick { display: grid; }
.card.sel { box-shadow: inset 0 0 0 3px var(--accent); }
.card.sel .tick { background: var(--grad); border-color: transparent; }
.empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 90px 20px; color: var(--muted); }
.empty .drop-ico { margin-bottom: 4px; }
.empty h3 { color: var(--ink); font-size: 22px; }

/* ---------- dialogs, lightbox, toast ---------- */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-pop), 0 0 0 1px var(--line-2); }
dialog[open] { animation: dlg .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes dlg { from { opacity: 0; transform: translateY(10px) scale(.98); } }
dialog::backdrop { background: rgba(5, 6, 10, .62); backdrop-filter: blur(6px); }
dialog form { display: grid; gap: 14px; padding: 26px; }
.dlg-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.dlg-ico.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
dialog h3 { font-size: 22px; }
dialog p { color: var(--muted); font-size: 15px; }
.err-text { color: var(--danger); font-size: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
label.lbl { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }

.lb { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; background: rgba(5, 6, 10, .96); color: #fff; box-shadow: none; }
.lb[open] { display: grid; grid-template-rows: auto 1fr; animation: none; }
.lb-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top)); }
.lb-top #lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb .icon-btn { background: rgba(255, 255, 255, .09); border-color: transparent; color: #fff; }
.lb .icon-btn:hover { background: rgba(255, 255, 255, .17); }
.lb-stage { display: grid; place-items: center; padding: 0 76px 28px; min-height: 0; }
.lb-stage > * { max-width: 100%; max-height: 100%; border-radius: 12px; }
.lb-stage iframe { width: min(960px, 100%); height: 100%; border: 0; background: #fff; }
.nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: 48px; height: 48px; border-radius: 50%; }
.nav.l { left: 16px; } .nav.r { right: 16px; }

#toast { position: fixed; left: 50%; bottom: 28px; translate: -50% 20px; z-index: 60; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 12px 18px 12px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; transition: opacity .2s, translate .25s cubic-bezier(.2, .8, .2, 1); }
#toast .i { width: 18px; height: 18px; color: var(--ok); }
:root[data-theme="light"] #toast .i { color: #34e19b; }
#toast.on { opacity: 1; translate: -50% 0; }
#toast.bad .i { color: var(--danger); }

/* ---------- footer ---------- */
.foot { margin-top: 128px; border-top: 1px solid var(--line); }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 56px 32px 40px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.foot-brand p { margin-top: 14px; color: var(--muted); font-size: 14px; max-width: 34ch; }
.foot h2, .foot h3 { font: 700 14px/1.2 var(--f-display); letter-spacing: -.01em; margin-bottom: 14px; color: var(--ink); text-transform: none; }
.foot ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.foot a { color: var(--muted); text-decoration: none; font-size: 14px; }
.foot a:hover { color: var(--ink); }
.foot-base { max-width: 1200px; margin: 0 auto; padding: 0 32px 36px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* =========================================================
   Tablet
   ========================================================= */
@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "copy" "panel" "perks"; gap: 32px; max-width: 680px; margin-inline: auto; }
  .hero-copy { align-self: start; }
  .hero h1 { max-width: 14ch; }
  .bento { grid-template-columns: repeat(2, 1fr); }
  .feat, .feat.wide { grid-column: span 1; }
  .feat.wide { grid-column: 1 / -1; }
  .dev { grid-template-columns: 1fr; padding: 34px; }
}

/* =========================================================
   Mobile — dock navigation, thumb-first stacking
   ========================================================= */
@media (max-width: 719px) {
  :root { --header-h: 58px; }
  body { padding-bottom: calc(var(--dock-h) + 14px + env(safe-area-inset-bottom)); }
  .d-only { display: none !important; }
  .m-only { display: inline; }
  .top-in { padding: 0 16px; gap: 12px; }
  .brand { font-size: 19px; } .brand-mark { width: 31px; height: 31px; }
  .main-nav, .top-actions [data-auth] { display: none; }
  .icon-btn { width: 40px; height: 40px; }

  .dock { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; height: var(--dock-h); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 6px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 84%, transparent); backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5); box-shadow: var(--shadow-pop), 0 0 0 1px var(--line-2); }
  .dock > * { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 16px; background: none; color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color .18s, background .18s; }
  .dock .i { width: 22px; height: 22px; }
  .dock > .on { color: var(--accent); background: var(--accent-soft); }
  #toast { bottom: calc(var(--dock-h) + 28px + env(safe-area-inset-bottom)); }

  main { padding: 20px 16px 24px; }
  .section { margin-top: 76px; }
  .section-head { margin-bottom: 28px; }
  .section-head p { font-size: 16px; }

  .hero { gap: 20px; }
  .hero h1 { font-size: clamp(34px, 10.4vw, 44px); letter-spacing: -.04em; max-width: 11ch; }
  .lede { margin-top: 14px; font-size: 16px; line-height: 1.6; }
  /* perks become a swipeable row */
  .perks { display: flex; flex-wrap: nowrap; margin: 0 -16px; padding: 2px 16px 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; gap: 10px; }
  .perks::-webkit-scrollbar { display: none; }
  .perks li { flex: 0 0 auto; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 12px 18px 12px 12px; scroll-snap-align: start; }
  .perks b { white-space: nowrap; } .perks span.s { white-space: nowrap; }
  .lede .more { display: none; }
  .drop-sub { display: none; }
  .drop-limit { margin-top: 12px; white-space: nowrap; font-size: 12px; padding: 6px 10px; }

  .panel { padding: 12px; border-radius: 24px; gap: 12px; }
  .drop { min-height: 236px; padding: 30px 20px; --inset: 12px; }
  .drop:hover, .drop.over { --inset: 12px; }
  .drop-ico { width: 56px; height: 56px; }
  .drop strong { font-size: 19px; }
  .opts { grid-template-columns: 1fr; }
  .summary-hint { display: none; }
  .opts-wrap summary .chev { margin-left: auto; }

  .item { grid-template-columns: 56px minmax(0, 1fr); padding: 12px; gap: 6px 12px; border-radius: 16px; }
  .thumb { width: 56px; height: 56px; }
  .short { font-size: 12.5px; }
  .chips .chip { flex: 1 1 auto; justify-content: center; }
  .recent { margin-top: 44px; }
  .rgrid { grid-template-columns: repeat(4, 1fr); gap: 8px; }

  /* features become a compact list instead of a bento */
  .bento { grid-template-columns: 1fr; gap: 0; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
  .feat, .feat.wide { grid-column: 1; display: grid; grid-template-columns: 44px 1fr; gap: 2px 14px; padding: 18px; border-radius: 0; background: none; box-shadow: none; border-top: 1px solid var(--line); }
  .feat:first-child { border-top: 0; }
  .feat-ico { grid-row: span 2; margin: 0; }
  .feat h3 { font-size: 18px; align-self: end; }
  .feat p { font-size: 14.5px; }
  .feat-vis { display: none; }

  /* steps become a vertical timeline */
  .steps { grid-template-columns: 1fr; gap: 0; }
  .steps li { padding: 0 0 28px 56px; border-top: 0; }
  .steps li::before { top: 0; box-shadow: none; }
  .steps li::after { content: ""; position: absolute; left: 18px; top: 44px; bottom: 6px; width: 2px; background: var(--line-2); border-radius: 2px; }
  .steps li:last-child { padding-bottom: 0; } .steps li:last-child::after { display: none; }
  .steps h3 { font-size: 19px; }

  .faq summary { font-size: 17px; padding: 18px 2px; }
  .faq .ans { font-size: 15.5px; }
  .dev { padding: 22px; border-radius: 22px; gap: 24px; }
  .dev .btn { width: 100%; }
  .codebox pre { font-size: 12px; }

  .bar { position: sticky; top: var(--header-h); z-index: 5; margin: 0 -16px 18px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .search { max-width: none; flex-basis: 100%; }
  .bar .btn { flex: 1; }
  .grid { columns: 2 140px; column-gap: 10px; }
  .card { margin-bottom: 10px; border-radius: 14px; }

  /* dialogs become bottom sheets */
  dialog:not(.lb) { margin: auto 0 0; width: 100%; max-width: none; border-radius: 26px 26px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet .28s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .lb-stage { padding: 0 8px 14px; }
  .nav { display: none; }

  .foot { margin-top: 76px; }
  .foot-in { grid-template-columns: 1fr 1fr; gap: 32px 20px; padding: 40px 16px 24px; }
  .foot-brand { grid-column: 1 / -1; }
  .foot-base { padding: 0 16px 24px; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 32px; }
  .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- upload state labels ---------- */
.st { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.st.ok { color: var(--ok); }
.item .notice-i { color: var(--danger); }
.notice .i { margin-top: 2px; }
code { font: .88em var(--f-mono); padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
