/* Студия askmeai.ru -- страница сайта в стиле neuroplace: панель создания слева,
   результат и выбор справа. Токены -- из ui.css сайта (--surface, --border,
   --text, --accent), поэтому тёмная тема и синий совпадают с главной. Классы с
   приставкой st-, чтобы не спорить ни с ui.css, ни с sc.css. */
.studio { --st-line: var(--border, #e2e7f0); --st-ink: var(--text, #16202f); --st-sub: var(--text-soft, #46536b);
  --st-surface: var(--surface, #fff); --st-surface-2: var(--surface-3, #f1f5f9); --st-accent: var(--accent, #2563eb);
  --st-accent-soft: var(--accent-soft, #e8efff); }
.studio .sf { margin-top: 40px; }
.st-who { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--st-sub); }
.st-who b { color: var(--st-ink); font-weight: 600; }
.st-who button { border: 0; background: none; color: var(--st-sub); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.st.sc {
  max-width: var(--maxw, 1240px); margin: 0 auto; padding: 24px var(--pad, 24px) 0;
  display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 24px; align-items: start;
  font-family: 'Onest', var(--font, system-ui, sans-serif); color: var(--st-ink);
}
.st [hidden] { display: none !important; }

/* ── Панель ────────────────────────────────────────── */
.st-panel {
  position: sticky; top: calc(var(--header-h, 68px) + 8px);
  background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 22px; padding: 16px;
  box-shadow: 0 20px 40px -28px rgba(37, 99, 235, .35);
  max-height: calc(100vh - 100px); overflow-y: auto;
}
.st-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--st-surface-2); border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.st-tabs button {
  border: 0; background: none; padding: 10px 6px; border-radius: 11px; font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  color: var(--st-sub); cursor: pointer;
}
.st-tabs button.on { background: var(--st-surface); color: var(--st-accent); box-shadow: 0 1px 3px rgba(15, 27, 51, .08); }

.st-form { display: flex; flex-direction: column; gap: 14px; }
.st-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.st-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-label { font-size: 13px; font-weight: 600; color: var(--st-sub); }
.st-note { font-size: 12.5px; color: var(--st-sub); }
.st-select, .st-text, .st-search {
  width: 100%; border: 1px solid var(--st-line); background: var(--st-surface); color: var(--st-ink);
  border-radius: 12px; padding: 11px 12px; font-family: inherit; font-size: 15px; line-height: 1.45;
}
.st-text { resize: vertical; min-height: 110px; }
.st-select:focus, .st-text:focus, .st-search:focus { outline: 2px solid var(--st-accent); outline-offset: 1px; border-color: transparent; }
.st-link { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--st-accent); font-family: inherit; font-weight: 500; font-size: 13px; cursor: pointer; }
.st-seg { flex-wrap: wrap; }
.st-seg button { font-size: 13px; padding: 6px 12px; }
.st-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.st-check input { width: 18px; height: 18px; accent-color: var(--st-accent); }

.st-picked { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; background: var(--st-surface-2); }
.st-picked-img { flex: 0 0 72px; height: 96px; border-radius: 12px; overflow: hidden; background: var(--st-line); }
.st-picked-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-picked-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-picked-tx b { font-size: 16px; }
.st-picked-tx small { color: var(--st-sub); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.st-drop {
  position: relative; display: grid; place-items: center; min-height: 150px; border: 1.5px dashed var(--st-line);
  border-radius: 16px; background: var(--st-surface-2); cursor: pointer; overflow: hidden; transition: border-color .15s;
}
.st-drop:hover, .st-drop.drag { border-color: var(--st-accent); }
.st-drop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 18px; color: var(--st-sub); }
.st-drop-empty b { color: var(--st-ink); }
.st-drop-empty small { font-size: 12.5px; }
.st-drop-img { width: 100%; max-height: 260px; object-fit: contain; display: block; }
.st-drop-x {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(15, 27, 51, .7); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}

.st-go { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.st-go .sc-btn:disabled { opacity: .55; cursor: default; }
.st-balance { margin: 0; text-align: center; font-size: 13px; color: var(--st-sub); }
.st-balance a { color: var(--st-accent); }
.st-error { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--bad-soft, #fdecec); color: var(--bad, #b91c1c); font-size: 13.5px; }
.st-error a { color: inherit; font-weight: 600; }

.st-login { margin-top: 16px; padding: 18px; border-radius: 16px; background: var(--st-accent-soft); text-align: center; }
.st-login b { font-size: 16px; }
.st-login p { margin: 6px 0 12px; color: var(--st-sub); font-size: 14px; }
.st-login-btn { min-height: 44px; display: flex; justify-content: center; }

/* ── Результат ─────────────────────────────────────── */
.st-main { min-width: 0; }
.st-result {
  background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 22px; min-height: 320px;
  display: grid; overflow: hidden;
}
.st-result-empty { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; padding: 28px; }
.st-result-empty h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.1; font-weight: 800; }
.st-result-empty p { margin: 0; color: var(--st-sub); }
.st-result-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.st-result-art img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; display: block; }
.st-result-art img:nth-child(2) { transform: translateY(-14px); }
.st-result-busy, .st-result-fail { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px; text-align: center; }
.st-result-busy small, .st-result-fail p { color: var(--st-sub); max-width: 460px; margin: 0; }
.st-result-fail b { color: var(--bad, #b91c1c); }
.st-spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--st-accent-soft); border-top-color: var(--st-accent); animation: st-spin 1s linear infinite; }
@keyframes st-spin { to { transform: rotate(360deg); } }
.st-result-done { display: flex; flex-direction: column; }
.st-result-media { background: #0b1220; display: grid; place-items: center; }
.st-result-media img, .st-result-media video { max-width: 100%; max-height: 72vh; display: block; }
.st-result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; flex-wrap: wrap; }
.st-result-bar div { display: flex; gap: 8px; }

.st-block { margin-top: 32px; }
.st-search { max-width: 260px; }
.st-cat-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-aud { flex: none; }
.st-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.st-card-on { outline: 3px solid var(--st-accent); outline-offset: 2px; }

.st-mine { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.st-work {
  position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--st-surface-2);
  border: 1px solid var(--st-line); cursor: pointer; padding: 0;
}
.st-work img, .st-work video { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-work span {
  position: absolute; left: 6px; right: 6px; bottom: 6px; font-size: 11.5px; color: #fff; text-align: left;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.st-guide {
  background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 18px; padding: 18px 20px; margin-bottom: 28px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px;
}
.st-guide h3 { grid-column: 1 / -1; margin: 0; font-size: 18px; }
.st-guide h4 { margin: 0 0 6px; font-size: 13px; color: var(--st-sub); text-transform: uppercase; letter-spacing: .04em; }
.st-guide ul { margin: 0; padding-left: 18px; font-size: 14px; }
.st-guide p { margin: 0; font-size: 14px; color: var(--st-sub); }
.st-guide blockquote { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--st-surface-2); font-size: 14px; font-style: italic; }

@media (max-width: 980px) {
  .st.sc { grid-template-columns: 1fr; }
  .st-panel { position: static; max-height: none; }
  .st-result-empty { grid-template-columns: 1fr; }
  .st-guide { grid-template-columns: 1fr; }
  .st-who { display: none; }
}
@media (max-width: 560px) {
  .st.sc { padding: 14px 12px 0; gap: 16px; }
  .st-result-empty { padding: 18px; }
  .st-result-empty h1 { font-size: 24px; }
  .st-grid { grid-template-columns: repeat(2, 1fr); }
  .st-search { max-width: none; }
  .st-cat-tools { width: 100%; }
  .st-cat-tools .st-search { flex: 1; min-width: 0; }
}

/* Кнопки панели -- во всю ширину, заметные. */
.st .st-go .sc-btn { width: 100%; }
.st .sc-btn:disabled { background: var(--st-surface-2); color: var(--st-sub); cursor: default; }

/* Ролик в ленте -- плитка со знаком, файл откроется по нажатию. */
.st-work-video { background: linear-gradient(135deg, var(--st-accent), #7c3aed); }
/* Значок ролика -- поверх первого кадра, пока кадра нет -- на градиенте. */
.st-work-video::before {
  content: "▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(15, 27, 51, .55); color: #fff; font-size: 16px; padding-left: 3px;
}

/* «Выбранный образ» -- кнопка: ведёт к каталогу образов под результатом. */
button.st-picked {
  width: 100%; border: 1px solid transparent; text-align: left; cursor: pointer; font: inherit; color: inherit;
  transition: border-color .15s, background .15s;
}
button.st-picked:hover { border-color: var(--st-accent); }
.st-picked:not(.st-picked-on) { border: 1.5px dashed var(--st-accent); background: var(--st-accent-soft); }
.st-picked:not(.st-picked-on) .st-picked-img { display: grid; place-items: center; background: var(--st-surface); }
.st-picked:not(.st-picked-on) .st-picked-img::before { content: "✦"; color: var(--st-accent); font-size: 26px; }
.st-picked-go {
  margin-left: auto; flex: 0 0 auto; align-self: center; padding: 7px 12px; border-radius: 10px;
  background: var(--st-accent); color: #fff; font-size: 13px; font-weight: 600;
}
.st-picked-on .st-picked-go { background: var(--st-surface); color: var(--st-accent); border: 1px solid var(--st-line); }
.st-mine .st-work[hidden] { display: none; }

/* «Мои генерации» -- в левой колонке, под панелью создания: результат рядом с
   тем, где его заказывали. Панель поэтому больше не прилипает при прокрутке --
   иначе она наезжала бы на ленту. */
.st-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.st-left .st-panel { position: static; max-height: none; overflow: visible; }
.st-mine-box {
  background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 22px; padding: 16px;
}
.st-mine-title { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.st-mine-box .st-mine { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.st-mine-box .sc-more { margin-top: 12px; }
.st-mine-box .sc-more .sc-btn { width: 100%; }
@media (max-width: 980px) {
  .st-mine-box .st-mine { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 560px) {
  .st-mine-box .st-mine { grid-template-columns: repeat(3, 1fr); }
}

/* ══ Личный кабинет (/app/#account) ══════════════════════════════════════ */
.cab { max-width: var(--maxw, 1240px); margin: 0 auto; padding: 24px var(--pad, 24px) 0; color: var(--st-ink);
  font-family: 'Onest', var(--font, system-ui, sans-serif); display: flex; flex-direction: column; gap: 16px; }
.cab[hidden] { display: none; }
.cab h1 { margin: 0; font-size: 26px; font-weight: 800; }
.cab h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.cab h3 { margin: 18px 0 8px; font-size: 15px; }
.cab-note a, .cab-links a { color: var(--st-accent); }
.cab-note { margin: 0 0 12px; color: var(--st-sub); font-size: 14px; }
.cab-card { background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 20px; padding: 18px 20px; }

.cab-head { display: flex; align-items: center; gap: 16px; background: var(--st-surface); border: 1px solid var(--st-line);
  border-radius: 22px; padding: 18px 20px; box-shadow: 0 20px 40px -28px rgba(37, 99, 235, .35); }
.cab-ava { flex: 0 0 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; font-weight: 800;
  color: #fff; background: linear-gradient(135deg, var(--st-accent), #7c3aed); }
.cab-id p { margin: 2px 0 0; color: var(--st-sub); font-size: 14px; }
.cab-actions { margin-left: auto; display: flex; gap: 8px; }
.cab-actions .sc-btn { text-decoration: none; }

.cab-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cab-stat { background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.cab-stat span { font-size: 13px; color: var(--st-sub); font-weight: 600; }
.cab-stat b { font-size: 22px; font-weight: 800; }
.cab-stat b i { font-style: normal; font-size: 15px; color: var(--st-sub); font-weight: 600; }
.cab-stat small { color: var(--st-sub); font-size: 13px; }
.cab-meter { height: 8px; border-radius: 99px; background: var(--st-surface-2); overflow: hidden; margin: 4px 0 2px; }
.cab-meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--st-accent), #7c3aed); }

.cab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cab-wide { grid-column: 1 / -1; }
.cab-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cab .cab-plan { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 16px; border: 1px solid var(--st-line);
  background: var(--st-surface-2); color: var(--st-ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.cab .cab-plan:hover { border-color: var(--st-accent); transform: translateY(-2px); }
.cab .cab-plan.on { border: 2px solid var(--st-accent); background: var(--st-accent-soft); }
.cab-plan b { font-size: 15px; }
.cab-plan em { font-style: normal; font-size: 24px; font-weight: 800; color: var(--st-accent); }
.cab-plan i { font-style: normal; font-size: 13px; color: var(--st-sub); }
.cab-packs { display: flex; flex-wrap: wrap; gap: 10px; }
.cab .cab-pack { display: flex; flex-direction: column; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--st-line);
  color: var(--st-ink); text-decoration: none; }
.cab .cab-pack:hover { border-color: var(--st-accent); }
.cab-pack span { font-size: 13px; color: var(--st-sub); }

.cab-promo, .cab-ref { display: flex; gap: 8px; }
.cab-promo input, .cab-ref input { flex: 1; min-width: 0; border: 1px solid var(--st-line); background: var(--st-surface); color: var(--st-ink);
  border-radius: 12px; padding: 11px 12px; font-family: inherit; font-size: 15px; }
.cab-promo input { text-transform: uppercase; }
.cab-msg { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: var(--st-surface-2); }
.cab-msg.ok { background: var(--ok-soft, #e7f6ec); color: var(--ok, #15803d); }
.cab-msg.bad { background: var(--bad-soft, #fdecec); color: var(--bad, #b91c1c); }
.cab-refstats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 14px; color: var(--st-sub); }
.cab-refstats b { color: var(--st-ink); font-size: 16px; }

.cab-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.cab-model { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--st-line); border-radius: 14px; cursor: pointer; }
.cab-model.on { border-color: var(--st-accent); background: var(--st-accent-soft); }
.cab-model input { accent-color: var(--st-accent); }
.cab-model span { display: flex; flex-direction: column; min-width: 0; }
.cab-model small { color: var(--st-sub); font-size: 12.5px; }
.cab-model em { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--st-sub); white-space: nowrap; }

.cab-works { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.cab-links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; }
.cab-empty { max-width: 460px; margin: 40px auto; text-align: center; background: var(--st-surface); border: 1px solid var(--st-line);
  border-radius: 22px; padding: 28px; }
.cab-empty p { color: var(--st-sub); }
.cab-empty .st-login { margin-top: 12px; }
.st-who-cab { color: var(--st-sub); text-decoration: none; }
.st-who-cab:hover { color: var(--st-accent); }
.sh-nav a.on { color: var(--st-accent); background: var(--st-accent-soft); }

@media (max-width: 980px) {
  .cab-stats { grid-template-columns: repeat(2, 1fr); }
  .cab-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cab { padding: 14px 12px 0; }
  .cab-head { flex-wrap: wrap; }
  .cab-actions { margin-left: 0; width: 100%; }
  .cab-actions .sc-btn { flex: 1; }
  .cab-stat b { font-size: 19px; }
}

/* Плашка «Обновляем сайт» -- пока бот перезапускается после выкладки. */
.st-updating {
  max-width: var(--maxw, 1240px); margin: 16px auto 0; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 16px; background: var(--st-accent-soft); color: var(--st-ink);
  border: 1px solid var(--st-line); font-size: 15px; font-family: 'Onest', var(--font, system-ui, sans-serif);
  width: calc(100% - 2 * var(--pad, 24px));
}
.st-updating-dot {
  flex: 0 0 14px; height: 14px; border-radius: 50%; border: 3px solid var(--st-surface); border-top-color: var(--st-accent);
  animation: st-spin 1s linear infinite;
}

/* Замок канала: карточка подписки в панели и в кабинете. */
.st-gate {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 20px 16px; margin-bottom: 14px; border-radius: 18px;
  background: var(--st-accent-soft); border: 1px solid var(--st-line);
}
.st-gate-ico {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, var(--st-accent), #7c3aed);
}
.st-gate b { font-size: 17px; }
.st-gate p { margin: 0; color: var(--st-sub); font-size: 14px; }
.st-gate-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.st-gate-row .sc-btn { text-decoration: none; }
.st-gate-note { color: var(--st-sub); font-size: 13px; min-height: 1em; }
.cab-empty .st-gate { margin: 16px 0 0; }

/* Вход через бота: большая кнопка с логотипом телеграма, под ней -- что
   происходит, ещё ниже -- запасной способ по номеру телефона. */
.st-login { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.st-login p { margin: 0 0 6px; }
.st .st-bot-login { width: 100%; gap: 10px; text-decoration: none; }
.st-bot-login svg { flex: none; }
.st-login-state { min-height: 1.2em; text-align: center; }
.st-login-alt { font-size: 13px; color: var(--st-sub); }
.st-login-alt:hover { color: var(--st-accent); }
.cab-empty .st-login { background: none; padding: 0; }

/* Кнопки кабинета на телефоне -- сеткой: у администратора их три, и в одну
   строку «Выйти» уезжала за край экрана, таща за собой всю страницу вбок. */
.cab-actions { flex-wrap: wrap; }
@media (max-width: 560px) {
  .cab-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cab-actions .sc-btn { width: 100%; min-width: 0; white-space: normal; text-align: center; }
  .cab-actions a[href="/panel/"] { grid-column: 1 / -1; }
  .cab-id { min-width: 0; }
  .cab-id h1 { font-size: 22px; overflow-wrap: anywhere; }
}
