[hidden] { display: none !important; }
:root {
  --bg: #080808; --panel: #161616; --panel2: #222222; --line: #2e2e33; --text: #eeeef2; --muted: #a3a3ad;
  --accent: #6c61ee; --accent2: #9d95f5; --sel: #242136; --selb: #7568d1; --danger: #f87171; --ok: #4ade80; --warn: #fbbf24;
  --kb: 0px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
body { overflow-x: hidden; min-height: 100dvh; }
img { max-width: 100%; display: block; }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 12px 8px; background: rgba(8,8,8,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: var(--panel2); font-size: 20px; }
.pill { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; }
main { padding: 12px 12px calc(24px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
h2 { font-size: 18px; margin: 18px 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:disabled { opacity: .55; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 10px; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.demo-banner { background: #3b1d0d; color: #fed7aa; border: 1px solid #9a3412; border-radius: 12px; padding: 8px 12px; font-size: 14px; margin-bottom: 10px; }
.err { color: var(--danger); font-size: 14px; }

/* composer */
.composer { position: sticky; bottom: 0; z-index: 15; margin: 12px -12px 0; padding: 10px 12px calc(10px + var(--safe-b)); background: rgba(22,22,22,.97); border-top: 1px solid var(--line); transform: translateY(calc(-1 * var(--kb))); }
.composer.inline { position: relative; transform: none; margin: 10px 0 0; border: 1px solid var(--line); border-radius: 16px; }
.composer.inline.floating { position: sticky; bottom: 0; transform: translateY(calc(-1 * var(--kb))); margin: 10px -12px 0; border-radius: 16px 16px 0 0; }
.composer.top-mode { position: static; transform: none; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 16px; }
.composer .label { font-size: 13px; color: var(--accent2); margin-bottom: 6px; font-weight: 600; }
.composer textarea { width: 100%; min-height: 48px; max-height: 30vh; resize: none; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px 12px; }
.composer textarea:focus { outline: 2px solid var(--accent2); }
.composer .c-title { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px 12px; margin-bottom: 10px; }
.composer .c-title:focus { outline: 2px solid var(--accent2); }
.composer .bar { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.launch { min-height: 48px; min-width: 120px; padding: 0 16px; border: 0; border-radius: 24px; background: var(--accent); color: #fff; font-weight: 700; display: flex; flex-direction: column; justify-content: center; line-height: 1.1; }
.launch small { font-weight: 500; opacity: .85; font-size: 12px; }
.launch:disabled { opacity: .5; }
.sources { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.src { position: relative; flex: 0 0 auto; width: 84px; }
.src img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.src select { width: 84px; font-size: 11px; margin-top: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; min-height: 30px; }
.src .x { position: absolute; top: -6px; right: -6px; width: 28px; height: 28px; border-radius: 14px; border: 0; background: #000c; color: #fff; font-size: 14px; }
.src.base img { outline: 2px solid var(--accent2); }
.src .tag { font-size: 11px; color: var(--accent2); }
.status { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--panel2); font-size: 14px; }

/* feed */
.feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.vcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; padding: 0; text-align: left; min-width: 0; }
/* фиолетовая рамка = вариант, открытый сейчас как основа правки (цвет кнопки «Новый вариант») */
.vcard.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.vcard .vimg { display: block; width: 100%; padding: 0; border: 0; background: #000; }
.vcard img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.vcard .meta { padding: 6px 8px 8px; font-size: 13px; }
.vcard .mrow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-height: 32px; }
.vcard .num { font-weight: 700; }
.vcard .small { font-size: 12px; }
.vcard .more { margin-left: auto; min-width: 36px; min-height: 32px; border: 0; border-radius: 10px; background: var(--panel2); font-size: 18px; line-height: 1; }
.vcard .txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: 100%; padding: 0; border: 0; background: none; color: var(--muted); text-align: left; font-size: 13px; }
.fav-mark { display: inline-flex; color: var(--accent2); }
.fav-mark svg { width: 15px; height: 15px; }
.feed-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.feed-bar .seg button { min-height: 36px; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.feed-bar .seg svg { width: 15px; height: 15px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: #9a3412; color: #fff; margin-left: 4px; }
.badge.sel { background: var(--ok); color: #052e16; }
.jobcard { background: var(--panel); border: 1px dashed var(--accent2); border-radius: 14px; padding: 10px; font-size: 14px; }
.jobcard.failed { border-color: var(--danger); }

/* variant */
.hero { background: #000; border-radius: 14px; overflow: hidden; }
.hero img { width: 100%; max-height: 58vh; object-fit: contain; margin: 0 auto; }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.actions .btn { padding: 0 6px; font-size: 14px; }
details { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-top: 10px; }
summary { min-height: 32px; font-weight: 600; cursor: pointer; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
pre.prompt { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--bg); padding: 8px; border-radius: 8px; }

/* sheet */
.backdrop { position: fixed; inset: 0; background: #0009; z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 85dvh; overflow-y: auto; background: var(--panel); border-radius: 18px 18px 0 0; padding: 14px 14px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); max-width: 760px; margin: 0 auto; }
.sheet h3 { margin: 0 0 10px; }
.opt { margin: 12px 0; }
.opt .t { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); }
.seg button.on { background: var(--sel); border-color: var(--selb); color: #fff; }
.menu-item { display: block; width: 100%; min-height: 52px; text-align: left; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); margin-bottom: 8px; font-weight: 600; }
.pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pick-grid button { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #000; position: relative; }
.pick-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.pick-grid span { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: #000b; padding: 1px 5px; border-radius: 6px; }

.zoom { position: fixed; inset: 0; z-index: 60; background: #000; overflow: auto; touch-action: pinch-zoom; display: flex; align-items: center; justify-content: center; }
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }
.zoom-close { position: fixed; top: calc(10px + var(--safe-t)); right: 10px; }
.toasts { position: fixed; left: 12px; right: 12px; top: calc(64px + var(--safe-t)); z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: 736px; margin: 0 auto; pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel2); border: 1px solid var(--accent2); border-radius: 12px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; box-shadow: 0 8px 24px #0008; }
.compare { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.login { max-width: 420px; margin: 10vh auto 0; }
.login input { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; margin: 10px 0; }
.list .proj { display: flex; gap: 10px; align-items: center; padding: 8px; margin-bottom: 8px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.list .proj img, .list .proj .ph { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--panel2); flex: 0 0 auto; }
table.hist { width: 100%; border-collapse: collapse; font-size: 14px; }
table.hist td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel2); font-size: 14px; }
.sheet-foot { position: sticky; bottom: calc(-16px - var(--safe-b)); background: var(--panel); padding: 10px 0 4px; border-top: 1px solid var(--line); margin-top: 8px; }
.sheet .t { margin: 6px 0; }

/* ---------- UI v3: оверлей просмотра поверх ленты ---------- */
body.locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
.ov { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: calc(24px + var(--safe-b)); }
.ov-inner { max-width: 760px; margin: 0 auto; }
.ov-top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) calc(12px + env(safe-area-inset-right, 0px)) 8px calc(12px + env(safe-area-inset-left, 0px)); background: rgba(8,8,8,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.ov-top h2 { margin: 0; font-size: 17px; }
.ov-pad { margin: 8px 12px; }
.ov-hero { position: relative; background: #000; }
.ov-hero img { width: 100%; max-height: 72dvh; object-fit: contain; margin: 0 auto; cursor: zoom-in; }
.ov-hero img:focus-visible { outline: 2px solid var(--accent2); outline-offset: -2px; }
.ov-edit { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; }
.ov-bar { display: flex; align-items: flex-end; gap: 4px; padding: 5px; border-radius: 16px; background: rgba(28,28,30,.78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.14); }
.ov-bar textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 30vh; resize: none; border: 0; background: transparent; padding: 10px 4px; line-height: 1.3; }
.ov-bar textarea:focus { outline: none; }
.ov-bar textarea::placeholder { color: #c8c8d0; }
.ov-bar .icon-btn { min-width: 40px; min-height: 40px; background: transparent; font-size: 18px; }
.ov-send { min-width: 54px; min-height: 44px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 3px 8px; }
.ov-send svg { width: 20px; height: 20px; }
.ov-send small { font-size: 10px; opacity: .9; margin-top: 2px; white-space: nowrap; }
.ov-send:disabled { opacity: .5; }
.ov-edit .sources { margin-bottom: 6px; }
.ov-edit .src select { background: #222c; }
/* клавиатура открыта: поле правки над клавиатурой (вне картинки), остальное листается */
.ov.typing { padding-bottom: calc(240px + var(--kb)); }
.ov.typing .ov-edit { position: fixed; left: 0; right: 0; bottom: var(--kb); padding: 8px calc(10px + env(safe-area-inset-right, 0px)) calc(8px + var(--safe-b)) calc(10px + env(safe-area-inset-left, 0px)); background: rgba(8,8,8,.96); border-top: 1px solid var(--line); max-width: 760px; margin: 0 auto; z-index: 5; }
.ov-body { padding: 0 calc(12px + env(safe-area-inset-right, 0px)) 0 calc(12px + env(safe-area-inset-left, 0px)); }
.ov-sub { margin-top: 8px; }
.ov-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 6px 2px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel2); font-size: 12px; font-weight: 600; }
.act svg { width: 24px; height: 24px; }
.act.danger { color: var(--danger); }
.act[aria-pressed="true"] { color: var(--accent2); border-color: var(--accent); background: var(--sel); }
.ov-more { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.gd { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 2px 14px 12px; margin-top: 10px; }
.gd h3 { font-size: 16px; margin: 12px 0 2px; }
.gd-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.gd-row > span:first-child { font-weight: 600; flex: 0 0 auto; }
.gd-row > span:last-child { color: var(--muted); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.gd-prompt { display: block; }
.gd-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.gd-head .btn, #pr-copy { display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.gd-head svg, #pr-copy svg { width: 16px; height: 16px; }
.gd-text { margin: 6px 0 0; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.gd details { margin-top: 8px; background: var(--bg); }
.prompt-full { white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; max-height: 50dvh; overflow-y: auto; }
.menu-item.danger { color: var(--danger); }
.hid-list .hid { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--panel2); }
.hid img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.hid .txt1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.composer.editing { border-color: var(--accent); }
.composer .label.row { margin-bottom: 6px; }
/* диалог подтверждения */
.confirm { position: fixed; inset: 0; z-index: 80; background: #000b; display: flex; align-items: center; justify-content: center; padding: 24px calc(24px + env(safe-area-inset-right, 0px)) calc(24px + var(--safe-b)) calc(24px + env(safe-area-inset-left, 0px)); }
.confirm-box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; width: 100%; max-width: 360px; box-shadow: 0 16px 48px #000c; }
.confirm-box h3 { margin: 0 0 6px; font-size: 18px; }
.confirm-box p { margin: 0 0 16px; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #2a0606; }
.composer textarea, .ov-bar textarea { scrollbar-width: none; }
.composer textarea::-webkit-scrollbar, .ov-bar textarea::-webkit-scrollbar { display: none; }
