/* KRUKOV Mockup Studio 5 — light frosted glass, one canvas, few buttons. */
@font-face { font-family: 'Golos Text'; font-style: normal; font-display: swap; font-weight: 400 900; src: url(/fonts/golos-text-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-display: swap; font-weight: 400 900; src: url(/fonts/golos-text-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Unbounded'; font-weight: 400; font-display: swap; src: url(/fonts/unbounded-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-045F,U+0490-0491,U+2116; }
@font-face { font-family: 'Unbounded'; font-weight: 400; font-display: swap; src: url(/fonts/unbounded-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Unbounded'; font-weight: 700; font-display: swap; src: url(/fonts/unbounded-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0400-045F,U+0490-0491,U+2116; }
@font-face { font-family: 'Unbounded'; font-weight: 700; font-display: swap; src: url(/fonts/unbounded-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-display: swap; src: url(/fonts/playfair-display-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-045F,U+0490-0491,U+2116; }
@font-face { font-family: 'Playfair Display'; font-weight: 400; font-display: swap; src: url(/fonts/playfair-display-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-display: swap; src: url(/fonts/playfair-display-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0400-045F,U+0490-0491,U+2116; }
@font-face { font-family: 'Playfair Display'; font-weight: 700; font-display: swap; src: url(/fonts/playfair-display-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Caveat'; font-weight: 400; font-display: swap; src: url(/fonts/caveat-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-045F,U+0490-0491,U+2116; }
@font-face { font-family: 'Caveat'; font-weight: 400; font-display: swap; src: url(/fonts/caveat-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Caveat'; font-weight: 700; font-display: swap; src: url(/fonts/caveat-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0400-045F,U+0490-0491,U+2116; }
@font-face { font-family: 'Caveat'; font-weight: 700; font-display: swap; src: url(/fonts/caveat-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Rubik Mono One'; font-weight: 400; font-display: swap; src: url(/fonts/rubik-mono-one-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-045F,U+0490-0491,U+2116; }
@font-face { font-family: 'Rubik Mono One'; font-weight: 400; font-display: swap; src: url(/fonts/rubik-mono-one-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122; }

:root {
  color-scheme: light;
  --bg: #e9ecf2;
  --blob-1: #ffd8c2;
  --blob-2: #cfd6ff;
  --blob-3: #d6f1ea;
  --text: #171a24;
  --muted: #5b6275;
  --faint: #8a90a0;
  --line: rgb(23 26 36 / .09);
  --line-strong: rgb(23 26 36 / .16);
  --field: rgb(255 255 255 / .82);
  --field-hover: #fff;
  --glass-bg: rgb(255 255 255 / .6);
  --glass-strong: rgb(255 255 255 / .8);
  --glass-edge: rgb(255 255 255 / .8);
  --glass-blur: blur(24px) saturate(1.7);
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / .9), 0 18px 40px -24px rgb(28 34 60 / .35), 0 2px 8px -2px rgb(28 34 60 / .08);
  --primary: #171a24;
  --primary-hover: #2b2f3d;
  --on-primary: #fff;
  --select: #4f5dff;
  --select-soft: rgb(79 93 255 / .12);
  --ai: linear-gradient(115deg, #6d5bff 0%, #b75cff 45%, #ff6f8e 78%, #ffa052 100%);
  --ok: #178a5b;
  --danger: #d23b4b;
  --board-shadow: 0 30px 60px -30px rgb(28 34 60 / .45), 0 4px 16px -6px rgb(28 34 60 / .18);
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
:root[data-theme="dark"],
:root[data-theme="auto"]:not(.is-light) {
  color-scheme: dark;
  --bg: #0e1016;
  --blob-1: #3a2433;
  --blob-2: #1f2550;
  --blob-3: #10302b;
  --text: #eef0f6;
  --muted: #a3a9ba;
  --faint: #737a8c;
  --line: rgb(255 255 255 / .08);
  --line-strong: rgb(255 255 255 / .16);
  --field: rgb(255 255 255 / .06);
  --field-hover: rgb(255 255 255 / .1);
  --glass-bg: rgb(26 29 38 / .62);
  --glass-strong: rgb(32 35 46 / .88);
  --glass-edge: rgb(255 255 255 / .09);
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 20px 50px -24px rgb(0 0 0 / .7);
  --primary: #f3f4f8;
  --primary-hover: #fff;
  --on-primary: #11131a;
  --select: #8b95ff;
  --select-soft: rgb(139 149 255 / .16);
  --board-shadow: 0 30px 60px -30px rgb(0 0 0 / .8), 0 4px 16px -6px rgb(0 0 0 / .5);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
[hidden] { display: none !important; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; }

/* ---------- Backdrop ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .9; }
.backdrop i:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: var(--blob-1); }
.backdrop i:nth-child(2) { width: 50vw; height: 50vw; right: -16vw; top: 10vh; background: var(--blob-2); }
.backdrop i:nth-child(3) { width: 40vw; height: 40vw; left: 26vw; bottom: -22vw; background: var(--blob-3); }

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}

/* ---------- Buttons ---------- */
.primary, .secondary, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: background .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease), opacity .18s;
}
.primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 20px -10px rgb(20 20 40 / .6); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.primary:active:not(:disabled), .secondary:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.primary.ai { background: var(--ai); color: #fff; box-shadow: 0 10px 24px -10px rgb(160 80 255 / .7); background-size: 140% 100%; background-position: 0 0; }
.primary.ai:hover:not(:disabled) { background-position: 100% 0; }
.secondary { background: var(--field); border-color: var(--line-strong); }
.secondary:hover:not(:disabled) { background: var(--field-hover); }
.ghost { background: transparent; color: var(--muted); }
.ghost:hover:not(:disabled) { background: var(--field); color: var(--text); }
.icon-only { padding: 0; width: 38px; }
.big { min-height: 48px; padding: 0 22px; border-radius: 14px; font-size: 15px; }
.wide { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.danger { color: var(--danger) !important; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 6px; }
.link-btn:hover { color: var(--text); }

/* ---------- App frame ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; gap: 12px; padding: 12px; }
.topbar { flex: none; height: 60px; border-radius: 18px; display: flex; align-items: center; gap: 16px; padding: 0 10px 0 18px; position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-caption { font-weight: 600; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line-strong); white-space: nowrap; }
.krukov-brand { display: inline-flex; align-items: center; height: 22px; }
.krukov-brand-image { height: 22px; width: auto; display: none; }
.krukov-brand.has-brand-image .krukov-brand-image { display: block; }
.krukov-brand.has-brand-image .krukov-wordmark { display: none; }
.krukov-wordmark { display: inline-flex; align-items: baseline; gap: 6px; }
.krukov-wordmark b { font-weight: 800; letter-spacing: .14em; font-size: 15px; }
.krukov-wordmark small { font-size: 9px; letter-spacing: .3em; color: var(--muted); }

.mode-switch { position: absolute; left: 50%; transform: translateX(-50%); display: flex; padding: 4px; border-radius: 14px; background: var(--field); border: 1px solid var(--line); }
.mode-switch button { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px; border: 0; background: transparent; border-radius: 10px; font-weight: 600; color: var(--muted); transition: color .2s; }
.mode-switch button[aria-selected="true"] { color: var(--on-primary); }
.mode-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 10px; background: var(--primary); transition: transform .35s var(--ease), background .3s; }
.app[data-mode="ai"] .mode-pill { background: var(--ai); }
.app[data-mode="manual"] .mode-pill { transform: translateX(100%); }
.app[data-screen="start"] .mode-switch { display: none; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; padding: 6px; border-radius: 16px; z-index: 50;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow), 0 24px 50px -20px rgb(0 0 0 / .35);
}
.menu.up .menu-panel { top: calc(100% + 10px); bottom: auto; }
.menu-panel > button, .menu-panel > a { display: flex; align-items: center; min-height: 38px; padding: 0 12px; border: 0; background: none; border-radius: 10px; text-align: left; text-decoration: none; font-weight: 500; }
.menu-panel > button:hover, .menu-panel > a:hover { background: var(--field); }
.theme-switch { display: flex; gap: 4px; padding: 6px 4px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.theme-switch button { flex: 1; height: 32px; border: 1px solid var(--line); background: transparent; border-radius: 8px; font-size: 12px; color: var(--muted); }
.theme-switch button.active { background: var(--primary); color: var(--on-primary); border-color: transparent; }

/* auth.js bar */
.auth-userbar { display: flex; align-items: center; }
.auth-userbar > button, .auth-userbar > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); font-weight: 600; cursor: pointer; }
.auth-quota { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: var(--select-soft); color: var(--select); }
.account-email { padding: 8px 12px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Start ---------- */
.start { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 20px; overflow: auto; }
.app[data-screen="studio"] .start { display: none; }
.start-head { text-align: center; }
.start-head h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.05; letter-spacing: -.02em; font-weight: 750; }
.start-head p { margin-top: 10px; font-size: 17px; color: var(--muted); }
.start-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 18px; }
.start-card { display: flex; flex-direction: column; text-align: left; gap: 0; padding: 10px; border-radius: 26px; cursor: pointer; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.start-card:hover { transform: translateY(-4px); box-shadow: var(--glass-shadow), 0 34px 60px -30px rgb(40 30 90 / .45); }
.start-copy { display: flex; flex-direction: column; gap: 8px; padding: 16px 12px 12px; }
.start-copy strong { font-size: 24px; letter-spacing: -.01em; }
.start-copy > span { color: var(--muted); font-size: 15px; line-height: 1.45; }
.tag { align-self: flex-start; margin-top: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--field); border: 1px solid var(--line); }
.tag-ai { background: var(--ai); color: #fff; border-color: transparent; }
.start-art { position: relative; height: 190px; border-radius: 18px; overflow: hidden; background: linear-gradient(160deg, #f6f7fa, #dfe3ea); }
:root[data-theme="dark"] .start-art, :root[data-theme="auto"]:not(.is-light) .start-art { background: linear-gradient(160deg, #262a36, #151821); }
.art-ai { background: linear-gradient(150deg, #ffd7c7, #c9c3ff 60%, #a9d8ff) !important; }
.start-art i { position: absolute; left: 50%; bottom: 26px; width: 92px; height: 110px; transform: translateX(-50%); border-radius: 10px 10px 18px 18px; background: linear-gradient(90deg, #d8dbe3, #fff 40%, #e4e6ec); box-shadow: 0 24px 30px -18px rgb(0 0 0 / .45); }
.start-art i::after { content: ''; position: absolute; right: -26px; top: 22px; width: 30px; height: 50px; border: 9px solid #e3e5eb; border-left: 0; border-radius: 0 26px 26px 0; }
.start-art b { position: absolute; left: 50%; bottom: 72px; width: 44px; height: 18px; transform: translateX(-50%); border-radius: 5px; background: var(--primary); opacity: .85; }
.art-manual b { outline: 2px dashed var(--select); outline-offset: 6px; }
.art-ai em { position: absolute; inset: 0; background: radial-gradient(circle at 25% 20%, #fff8 0 8%, transparent 9%), radial-gradient(circle at 80% 30%, #fff6 0 5%, transparent 6%); }
.start-note { color: var(--faint); font-size: 13px; }

/* ---------- Studio layout ---------- */
.studio { flex: 1; min-height: 0; display: grid; grid-template-columns: 78px 320px minmax(0, 1fr); gap: 12px; }
.app[data-screen="start"] .studio { display: none !important; }
.app.panel-collapsed .studio { grid-template-columns: 78px minmax(0, 1fr); }
.app.panel-collapsed .panel { display: none; }
.rail { border-radius: var(--r-lg); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.rail button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 66px; border-radius: 14px; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; transition: background .2s, color .2s; }
.rail button .i { width: 24px; height: 24px; }
.rail button:hover { background: var(--field); color: var(--text); }
.rail button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.app[data-mode="ai"] .rail [data-tool="scene"][aria-pressed="true"] { background: var(--ai); color: #fff; }
.rail button.attention::after { content: ''; position: absolute; top: 9px; right: 14px; width: 9px; height: 9px; border-radius: 50%; background: #ff6f5a; box-shadow: 0 0 0 3px var(--glass-bg); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { transform: scale(1.35); } }
.rail-badge { position: absolute; top: 7px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--select); color: #fff; font-size: 10.5px; line-height: 18px; }
.app[data-mode="ai"] [data-only="manual"], .app[data-mode="manual"] [data-only="ai"] { display: none !important; }

.panel { position: relative; border-radius: var(--r-lg); padding: 20px 18px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.panel-close { display: none; position: absolute; right: 10px; top: 10px; }
.tool { display: flex; flex-direction: column; gap: 16px; }
.tool-head h2 { font-size: 20px; letter-spacing: -.01em; }
.tool-head p { margin-top: 4px; color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.hint.warn { color: var(--danger); background: rgb(210 59 75 / .08); padding: 10px 12px; border-radius: 10px; }

.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 14px; border-radius: 16px; border: 1.5px dashed var(--line-strong); background: var(--field); text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.drop:hover, .drop.is-over { border-color: var(--select); background: var(--select-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .i { width: 28px; height: 28px; color: var(--select); }
.drop strong { font-size: 15px; }
.drop small { color: var(--muted); }
.drop-sm { padding: 16px 12px; }
.link-row { display: flex; gap: 6px; }
.link-row input, .field input:not([type="range"]):not([type="color"]), .field textarea, .field select {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); outline: none; transition: border-color .15s, box-shadow .15s;
}
.link-row input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--select); box-shadow: 0 0 0 3px var(--select-soft); }
.field textarea { resize: vertical; min-height: 64px; line-height: 1.35; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span, .field-row { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field > span em { font-style: normal; font-weight: 400; color: var(--faint); }
.field-row { display: flex; justify-content: space-between; }
.field-row output { color: var(--text); font-variant-numeric: tabular-nums; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); font-size: 12.5px; color: var(--muted); }
.color-field input { width: 34px; height: 28px; border: 0; padding: 0; background: none; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(var(--select), var(--select)) 0 / var(--fill, 50%) 100% no-repeat, var(--line-strong); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-strong); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--select); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; border: 1px solid var(--line-strong); box-shadow: 0 2px 6px rgb(0 0 0 / .2); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid var(--line-strong); box-shadow: 0 2px 6px rgb(0 0 0 / .2); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch > span { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong); transition: background .2s; }
.switch > span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--select); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--select); outline-offset: 2px; }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); }
.seg button { min-width: 38px; height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; }
.seg-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ratio { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; }
.r11 { width: 11px; height: 11px; } .r23 { width: 9px; height: 13px; } .r32 { width: 14px; height: 9px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--field); font-weight: 600; font-size: 13px; color: var(--muted); }
.chips button[aria-selected="true"] { background: var(--primary); color: var(--on-primary); border-color: transparent; }
details.more { border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
details.more summary::before { content: '›'; display: inline-block; transition: transform .2s; font-size: 18px; line-height: 1; }
details.more[open] summary::before { transform: rotate(90deg); }
details.more[open] { display: flex; flex-direction: column; gap: 14px; }

/* products */
.product-list { display: flex; flex-direction: column; gap: 8px; }
.product-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); cursor: pointer; text-align: left; width: 100%; }
.product-row[aria-current="true"] { border-color: var(--select); box-shadow: 0 0 0 3px var(--select-soft); }
.product-row img { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; background: #fff; flex: none; }
.product-row div { flex: 1; min-width: 0; }
.product-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.product-row small { color: var(--muted); font-size: 12px; }
.product-row .remove { width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; color: var(--faint); display: grid; place-items: center; }
.product-row .remove:hover { background: rgb(210 59 75 / .1); color: var(--danger); }

/* logos */
.logo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.logo-tile { position: relative; aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line-strong); background: repeating-conic-gradient(#e7e9ee 0 25%, #fff 0 50%) 0 0 / 14px 14px; display: grid; place-items: center; padding: 10px; transition: transform .2s var(--ease), box-shadow .2s; }
:root[data-theme="dark"] .logo-tile, :root[data-theme="auto"]:not(.is-light) .logo-tile { background: repeating-conic-gradient(#2a2e3a 0 25%, #1f222c 0 50%) 0 0 / 14px 14px; }
.logo-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -12px rgb(0 0 0 / .4); }
.logo-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-tile.used { border-color: var(--select); box-shadow: 0 0 0 3px var(--select-soft); }
.logo-tile .add { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 11px; font-weight: 600; opacity: 0; transition: opacity .2s; white-space: nowrap; }
.logo-tile:hover .add, .logo-tile:focus-visible .add { opacity: 1; }
.logo-tile .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--glass-strong); color: var(--muted); font-size: 14px; line-height: 1; display: grid; place-items: center; opacity: 0; }
.logo-tile:hover .x { opacity: 1; }

/* text */
.text-styles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.text-style { height: 64px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--field); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; transition: border-color .15s, transform .2s var(--ease); }
.text-style:hover { border-color: var(--select); transform: translateY(-1px); }
.text-style[aria-pressed="true"] { border-color: var(--select); box-shadow: 0 0 0 3px var(--select-soft); }
.text-style b { font-size: 20px; line-height: 1.1; font-weight: inherit; }
.text-style small { font-size: 11px; color: var(--muted); font-family: var(--font); font-weight: 500; font-style: normal; }
.text-style.add-new { grid-column: 1 / -1; height: 48px; flex-direction: row; gap: 8px; background: var(--primary); color: var(--on-primary); border-color: transparent; font-weight: 600; }
.quick-text { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--select-soft); }
.quick-text .chips button { height: 30px; }
.quick-text > span { width: 100%; font-size: 12.5px; font-weight: 600; color: var(--muted); }

.text-editor { display: flex; flex-direction: column; gap: 14px; padding: 14px; border-radius: 16px; background: var(--field); border: 1px solid var(--line); }
.text-editor textarea { font-size: 16px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong); box-shadow: inset 0 0 0 2px rgb(255 255 255 / .6); padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--select); outline-offset: 2px; }
.swatch-custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* scene */
.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scene-card { position: relative; display: flex; flex-direction: column; padding: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-strong); background: var(--field); text-align: left; transition: transform .2s var(--ease), box-shadow .2s; }
.scene-card:hover { transform: translateY(-2px); }
.scene-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.scene-card strong { padding: 7px 9px 1px; font-size: 13px; }
.scene-card small { margin: 0 9px 8px; font-size: 11px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scene-card[aria-pressed="true"] { border-color: transparent; box-shadow: 0 0 0 2.5px #9c5cff, 0 10px 24px -12px rgb(150 80 255 / .7); }
.scene-card[aria-pressed="true"]::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ai); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }

/* print */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--field); text-align: center; }
.tiles svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; color: var(--muted); }
.tiles strong { font-size: 13px; }
.tiles small { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.tiles button[aria-pressed="true"] { border-color: var(--select); box-shadow: 0 0 0 3px var(--select-soft); }
.tiles button[aria-pressed="true"] svg { color: var(--select); }

/* ---------- Stage ---------- */
.stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-top { position: absolute; z-index: 6; left: 12px; right: 12px; top: 96px; display: flex; align-items: flex-start; gap: 10px; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
/* stepper: the one thing that tells the user what to do next */
.stepper { position: relative; z-index: 12; flex: none; display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 10px 10px 14px; border-radius: var(--r-lg); }
.steps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.step-text { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.step-text small { flex: none; font-size: 12px; font-weight: 600; color: var(--faint); letter-spacing: .02em; }
.step-text strong { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.step-bar i { height: 4px; border-radius: 2px; background: var(--line-strong); transition: background .4s var(--ease); }
.step-bar i.done { background: var(--primary); }
.step-bar i.now { background: linear-gradient(90deg, var(--select) 45%, var(--line-strong) 45%); }
.app[data-mode="ai"] .step-bar i.now { background: linear-gradient(90deg, #a35bff 45%, var(--line-strong) 45%); }
.step-bar.complete i { background: var(--ok); }
.stepper > .dock-actions { margin-left: auto; }
.step-cta:not(:empty) { margin-left: auto; }
.step-cta { flex: none; display: flex; align-items: center; gap: 8px; }
.step-cta .primary { min-height: 48px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.step-cta .primary.ai { background: var(--ai); color: #fff; }
.step-cta .busy { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--muted); padding: 0 12px; }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-2px); } 90% { transform: translateY(1px); } }
.coach { position: absolute; z-index: 7; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 14px; font-size: 13px; transform: translateX(-50%); white-space: nowrap; pointer-events: none; animation: toast-in .35s var(--ease); background: var(--primary); color: var(--on-primary); border: 0; }
.coach span { opacity: .85; }
.coach::before { content: ''; position: absolute; left: 50%; top: -6px; width: 12px; height: 12px; margin-left: -6px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.history-btns { margin-left: auto; display: flex; gap: 2px; padding: 3px; border-radius: 14px; }
.variants { display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 14px; max-width: 52%; overflow-x: auto; scrollbar-width: none; }
.variants button { position: relative; flex: none; width: 44px; height: 44px; padding: 0; border-radius: 10px; border: 2px solid transparent; overflow: hidden; background: var(--field); }
.variants button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.variants button[aria-pressed="true"] { border-color: var(--select); }
.variants button span { position: absolute; left: 3px; bottom: 3px; font-size: 9.5px; font-weight: 700; background: rgb(0 0 0 / .55); color: #fff; padding: 0 4px; border-radius: 4px; }
.variants .pending { display: grid; place-items: center; }

.canvas-area { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 72px 24px 24px; border-radius: var(--r-lg);
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1.2px); background-size: 22px 22px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-drop { position: relative; width: min(460px, 80vw); aspect-ratio: 4 / 3; border-radius: 28px; border: 2px dashed var(--line-strong); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px; cursor: pointer; background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); transition: border-color .2s, transform .3s var(--ease); }
.empty-drop:hover, .empty-drop.is-over { border-color: var(--select); transform: scale(1.01); }
.empty-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.empty-drop strong { font-size: 20px; }
.empty-drop > span:not(.empty-icon) { color: var(--muted); }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.empty-icon .i { width: 30px; height: 30px; }

.board { position: relative; border-radius: 6px; box-shadow: var(--board-shadow); background: #fff; touch-action: none; user-select: none; -webkit-user-select: none; }
.board-base { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 6px; pointer-events: none; }
.layers { position: absolute; inset: 0; overflow: hidden; border-radius: 6px; z-index: 1; isolation: isolate; }
.layer { position: absolute; transform-origin: 50% 50%; cursor: move; }
.layer > img { display: block; width: 100%; height: auto; pointer-events: none; transition: opacity .12s; }
.layer:hover:not(.selected) { outline: 1.5px dashed var(--select); outline-offset: 2px; }
.selection { position: absolute; z-index: 3; border: 1.5px solid var(--select); pointer-events: none; transform-origin: 50% 50%; box-shadow: 0 0 0 1px rgb(255 255 255 / .6); }
.handle { position: absolute; width: 16px; height: 16px; margin: -8px; border-radius: 50%; border: 2px solid var(--select); background: #fff; pointer-events: auto; padding: 0; box-shadow: 0 1px 4px rgb(0 0 0 / .3); touch-action: none; }
.h-tl { left: 0; top: 0; cursor: nwse-resize; } .h-tr { left: 100%; top: 0; cursor: nesw-resize; }
.h-bl { left: 0; top: 100%; cursor: nesw-resize; } .h-br { left: 100%; top: 100%; cursor: nwse-resize; }
.h-side { width: 10px; height: 22px; margin: -11px 0 0 -5px; border-radius: 5px; cursor: ew-resize; }
.h-ml { left: 0; top: 50%; } .h-mr { left: 100%; top: 50%; }
.selection:not(.is-text) .h-side { display: none; }
.board.is-editing .selection { display: none; }
.layer.editing > img { opacity: 0 !important; }
.inline-edit { position: absolute; z-index: 5; margin: 0; border: 0; outline: 1.5px dashed var(--select); outline-offset: 0; resize: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; transform-origin: 50% 50%; caret-color: var(--select); background: transparent; }
.inline-edit::selection { background: rgb(79 93 255 / .35); }
.h-rot { left: 50%; top: -34px; width: 28px; height: 28px; margin: 0 0 0 -14px; display: grid; place-items: center; cursor: grab; color: var(--select); }
.h-rot svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.h-rot::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 8px; background: var(--select); }
.guides { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.guides i { position: absolute; background: #ff4fa3; opacity: 0; transition: opacity .1s; pointer-events: none; }
.guides .gv { left: 50%; top: 0; bottom: 0; width: 1px; }
.guides .gh { top: 50%; left: 0; right: 0; height: 1px; }
.guides.v .gv, .guides.h .gh { opacity: .9; }
.mask-overlay { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; border-radius: 6px; }
.board.brushing { cursor: none; }
.board.brushing .layer { pointer-events: none; }
.board.brushing .selection, .board.brushing ~ .ctx { display: none !important; }
.brush-cursor { position: absolute; z-index: 6; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / .5), inset 0 0 0 1px rgb(0 0 0 / .3); pointer-events: none; transform: translate(-50%, -50%); }
.result-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 14px; font-weight: 600; cursor: pointer; }
.result-btn:hover { background: var(--glass-strong); }
.product-row .copy { width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; color: var(--faint); display: grid; place-items: center; }
.product-row .copy:hover { background: var(--select-soft); color: var(--select); }
.board-busy { position: absolute; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--select); animation: spin .8s linear infinite; display: inline-block; }
.spin.big { width: 34px; height: 34px; border-width: 3px; border-top-color: #b75cff; }
@keyframes spin { to { transform: rotate(360deg); } }

.generating { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgb(0 0 0 / .08); border-radius: var(--r-lg); }
.gen-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 34px; border-radius: 22px; text-align: center; }
.gen-card strong { font-size: 17px; }
.gen-card span { color: var(--muted); }

.ctx { position: absolute; z-index: 7; display: flex; gap: 2px; padding: 4px; border-radius: 14px; transform: translate(-50%, -100%); white-space: nowrap; }
.ctx button { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; background: transparent; border-radius: 10px; font-weight: 600; font-size: 13px; }
.ctx button:hover { background: var(--field); }
.ctx .i { width: 18px; height: 18px; }

.drop-overlay { position: absolute; inset: 0; z-index: 9; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px; border-radius: var(--r-lg); background: rgb(20 22 40 / .25); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.drop-overlay.single { grid-template-columns: 1fr; }
.drop-overlay.single [data-drop-as="logo"] { display: none; }
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-radius: 20px; border: 2px dashed rgb(255 255 255 / .7); color: #fff; font-size: 18px; background: rgb(255 255 255 / .08); transition: background .15s, transform .2s var(--ease); }
.drop-zone .i { width: 40px; height: 40px; }
.drop-zone.is-over { background: rgb(79 93 255 / .5); transform: scale(1.02); border-style: solid; }

/* dock */
.dock { flex: none; min-height: 72px; border-radius: var(--r-lg); display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 12px; }
.strip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.strip::-webkit-scrollbar { display: none; }
.strip-item { position: relative; flex: none; width: 54px; height: 54px; border-radius: 12px; border: 2px solid transparent; padding: 0; overflow: hidden; background: #fff; box-shadow: 0 2px 8px -4px rgb(0 0 0 / .3); transition: transform .2s var(--ease); }
.strip-item:hover { transform: translateY(-2px); }
.strip-item[aria-current="true"] { border-color: var(--select); }
.strip-item img { width: 100%; height: 100%; object-fit: contain; }
.strip-item .dot { position: absolute; right: 3px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px #fff; }
.strip-add { position: relative; flex: none; height: 54px; padding: 0 16px; border-radius: 12px; border: 1.5px dashed var(--line-strong); background: transparent; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); cursor: pointer; }
.strip-add:hover { border-color: var(--select); color: var(--select); }
.dock { position: relative; z-index: 11; }
.add-pop { position: absolute; bottom: calc(100% + 10px); z-index: 40; width: 340px; padding: 14px; border-radius: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--glass-strong); box-shadow: var(--glass-shadow), 0 24px 50px -20px rgb(0 0 0 / .35); animation: toast-in .25s var(--ease); }
.add-pop > strong { font-size: 15px; }
.dock-actions { flex: none; display: flex; align-items: center; gap: 10px; }
.balance { color: var(--muted); font-size: 12.5px; text-align: right; max-width: 170px; line-height: 1.3; }
.split { display: flex; }
.split > .primary { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split .split-arrow { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 12px; margin-left: 1px; min-height: 48px; }
.split:not(:has(#downloadMenu:not([hidden]))) > .primary { border-radius: 14px; }
.split .menu-panel { right: 0; }
#primaryAction { min-width: 190px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 100; max-width: min(560px, 92vw); padding: 12px 18px; border-radius: 14px; background: var(--primary); color: var(--on-primary); font-weight: 500; box-shadow: 0 20px 40px -16px rgb(0 0 0 / .5); animation: toast-in .3s var(--ease); }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Dialogs ---------- */
.dlg { border: 1px solid var(--glass-edge); border-radius: 24px; padding: 22px; color: var(--text); background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: 0 40px 80px -30px rgb(0 0 0 / .5); max-height: 90dvh; overflow: auto; }
.dlg::backdrop { background: rgb(15 18 30 / .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dlg-head, .history-head, .picker-head, .feedback-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dlg h2 { font-size: 22px; }
.dlg-actions, .picker-actions, .feedback-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.history-dialog { width: min(1000px, 94vw); }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.history-card { display: flex; flex-direction: column; text-align: left; padding: 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--field); }
.history-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.history-card > span { padding: 12px; }
.history-card strong, .history-card small { display: block; }
.history-card small { color: var(--muted); margin-top: 4px; }
.history-pending { display: grid; place-items: center; aspect-ratio: 1; color: var(--muted); }
.history-empty { max-width: 420px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.history-empty p { color: var(--muted); }
.history-detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); gap: 24px; margin-top: 16px; }
.history-detail > img { width: 100%; max-height: 64vh; object-fit: contain; border-radius: 14px; background: var(--field); }
.history-detail > div { display: flex; flex-direction: column; gap: 10px; }
.history-detail .download { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); text-decoration: none; font-weight: 600; }
.history-detail p { color: var(--muted); }
.history-restore-status { color: var(--danger) !important; }
#historyMore { margin: 18px auto 0; display: flex; }
.picker-dialog { width: min(860px, 94vw); }
.picker-head p { color: var(--muted); margin-top: 4px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.picker-option { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--field); text-align: left; }
.picker-option img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #fff; }
.picker-option small { color: var(--muted); }
.picker-option.active { border-color: var(--select); box-shadow: 0 0 0 3px var(--select-soft); }
.kp-dialog { width: min(820px, 94vw); }
.kp-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kp-items { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.kp-item { display: grid; grid-template-columns: 22px 72px 1fr; gap: 12px; align-items: start; padding: 10px; border-radius: 14px; background: var(--field); border: 1px solid var(--line); }
.kp-item img { width: 72px; height: 72px; object-fit: contain; border-radius: 10px; background: #fff; }
.kp-item .kp-fields { display: grid; grid-template-columns: 1fr 120px; gap: 6px; }
.kp-item .kp-fields textarea { grid-column: 1 / -1; min-height: 40px; }
.kp-item input[type="checkbox"] { margin-top: 28px; width: 18px; height: 18px; accent-color: var(--select); }
.kp-fields input, .kp-fields textarea { width: 100%; min-height: 36px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--field); }
.help-dialog { width: min(520px, 92vw); }
.help-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.help-steps li { display: flex; gap: 14px; }
.help-steps b { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); }
.help-steps div { display: flex; flex-direction: column; gap: 3px; }
.help-steps span { color: var(--muted); line-height: 1.45; }
.preview-dialog { width: min(1200px, 96vw); }
.preview-dialog[open] { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.preview-dialog img { max-width: 100%; max-height: 80dvh; border-radius: 12px; margin: auto; }
.feedback-dialog { border: 1px solid var(--glass-edge); border-radius: 24px; padding: 22px; color: var(--text); background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); width: min(520px, 92vw); }
.feedback-dialog::backdrop { background: rgb(15 18 30 / .35); }
.feedback-card { display: flex; flex-direction: column; gap: 12px; }
.feedback-card .text-field { display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.feedback-card textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); font-weight: 400; font-size: 14px; color: var(--text); }
.feedback-count, .panel-note { color: var(--muted); font-size: 12px; }
.feedback-status[data-tone="error"] { color: var(--danger); }
.feedback-status[data-tone="success"] { color: var(--ok); }

/* auth gate (auth.js) */
.auth-gate { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 24px; background: rgb(15 18 30 / .35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.auth-gate-close { position: absolute; top: 18px; right: 18px; min-height: 36px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--glass-strong); font-weight: 600; }
.auth-card { width: min(100%, 440px); padding: 30px; border-radius: 26px; background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-edge); box-shadow: 0 40px 80px -30px rgb(0 0 0 / .5); display: flex; flex-direction: column; gap: 16px; }
.auth-brand { margin-bottom: 6px; }
.auth-reason { padding: 10px 12px; border-radius: 12px; background: var(--select-soft); color: var(--select); font-weight: 500; }
.auth-kicker { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.auth-copy h1 { font-size: 26px; margin: 4px 0 6px; }
.auth-copy p { color: var(--muted); }
#authForm, #authEmailStep, #authCodeStep { display: flex; flex-direction: column; gap: 12px; }
#authCodeStep.hidden, #authEmailStep.hidden { display: none; }
.auth-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.auth-field input { min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); font-size: 16px; color: var(--text); }
.auth-code { letter-spacing: .5em; text-align: center; font-size: 22px !important; }
.auth-submit { min-height: 48px; border-radius: 14px; border: 0; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 15px; }
.auth-secondary-actions { display: flex; justify-content: space-between; }
.auth-secondary-actions button { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 4px 0; }
.auth-status { min-height: 18px; color: var(--muted); }
.auth-status.error { color: var(--danger); }
.auth-sent { color: var(--muted); }
.auth-security { color: var(--faint); font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .studio { grid-template-columns: 72px 290px minmax(0, 1fr); }
  .header-actions #historyOpen span { display: none; }
  #primaryAction { min-width: 0; }
  .balance { display: none; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .app { padding: 8px; gap: 8px; height: auto; min-height: 100dvh; }
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 8px 8px 14px; gap: 8px; }
  .brand-caption { display: none; }
  .brand { flex: 1; }
  .header-actions { margin-left: 0; }
  .mode-switch { position: relative; left: auto; transform: none; order: 3; flex: 0 0 100%; }
  .mode-switch button { flex: 1; justify-content: center; }
  .start-cards { grid-template-columns: 1fr; width: 100%; max-width: 420px; }
  .start-art { height: 130px; }
  .studio { display: flex; flex-direction: column; gap: 8px; }
  .stage { order: 1; min-height: 0; }
  .canvas-area { min-height: 56dvh; padding: 64px 10px 12px; }
  .panel { order: 2; max-height: none; }
  .app.panel-collapsed .panel { display: none; }
  .panel-close { display: grid; }
  .app[data-screen="studio"] { padding-bottom: 84px; }
  .rail { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 30; flex-direction: row; padding: 6px; background: var(--glass-strong); }
  .rail button { flex: 1; height: 56px; }
  .dock { flex-wrap: wrap; padding: 8px; }
  .dock-actions { width: 100%; }
  .split { flex: 1; }
  .split > .primary { flex: 1; }
  .stage-top { left: 8px; right: 8px; top: 8px; flex-wrap: wrap; }
  .stepper { flex-wrap: wrap; min-height: 0; padding: 8px; }
          .step-cta { width: 100%; }
  .step-cta .primary { flex: 1; }
  .stage-top { top: auto; position: static; order: 1; }
  .canvas-area { order: 2; padding-top: 12px !important; }
  .dock { order: 3; }
  .variants { max-width: 100%; order: 3; }
  .ctx button span { display: none; }
  .kp-meta { grid-template-columns: 1fr; }
  .history-detail { grid-template-columns: 1fr; }
  .toast { bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* manual mode: editor on the left, exact result on the right */
.app.split-view .canvas-area { grid-template-columns: auto auto; justify-content: center; align-content: center; gap: 20px; }
.result-pane { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.result-pane figcaption { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.result-pane figcaption span { display: flex; align-items: baseline; gap: 8px; }
.result-pane figcaption b { font-size: 14px; }
.result-pane figcaption small { color: var(--muted); font-size: 12px; }
.result-pane .ghost { min-height: 32px; padding: 0 10px; font-size: 13px; }
.result-frame { position: relative; border-radius: 6px; overflow: hidden; background: #fff; box-shadow: var(--board-shadow); }
.result-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.result-wait { position: absolute; right: 10px; bottom: 10px; display: none; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--glass-strong); font-size: 12px; font-weight: 600; box-shadow: 0 4px 14px -6px rgb(0 0 0 / .3); }
.result-pane.stale .result-wait { display: flex; }
.result-pane.stale img { opacity: .55; transition: opacity .2s; }
.app.split-view #board { margin-top: 42px; }
@media (max-width: 900px) {
  .app.split-view .canvas-area { grid-template-columns: 1fr; justify-items: center; }
  .app.split-view #board { margin-top: 0; }
}
.app.split-view #board::before { content: 'Редактор'; position: absolute; left: 0; top: -34px; font-size: 14px; font-weight: 700; color: var(--text); }
.app.split-view #board::after { content: 'двигайте, крутите, меняйте размер'; position: absolute; left: 76px; top: -32px; font-size: 12px; color: var(--muted); white-space: nowrap; }
