
/* ── PC Layout (sidebar + content) ─────────────────────────── */

@media (min-width: 1200px) {
  body.web-mode {
    padding-bottom: 0;
  }
  body.web-mode .wrap {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 100vh;
  }
  body.web-mode header,
  body.web-mode .footer-note {
    display: none;
  }
  body.web-mode #app {
    flex: 1;
    padding: 48px 56px;
    max-width: 740px;
    min-height: 100vh;
  }
  /* Override: лендинг не использует sidebar-layout — должен идти ПОСЛЕ body.web-mode #app */
  body.web-login-mode .wrap {
    display: block;
    flex-direction: unset;
    align-items: unset;
  }
  body.web-login-mode #app {
    flex: unset;
    max-width: 100%;
    width: 100%;
    padding: 0;
    min-height: unset;
  }
  body.web-mode .theme-toggle {
    position: fixed;
    top: 20px;
    right: 28px;
    z-index: 200;
  }

  /* ── Custom scrollbars ─────────────────────────────────────── */

  body.web-mode *::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  body.web-mode *::-webkit-scrollbar-track {
    background: transparent;
  }
  body.web-mode *::-webkit-scrollbar-thumb {
    background: rgba(168,85,247,0.18);
    border-radius: 6px;
  }
  body.web-mode *::-webkit-scrollbar-thumb:hover {
    background: rgba(168,85,247,0.3);
  }
  body.web-mode * {
    scrollbar-width: thin;
    scrollbar-color: rgba(168,85,247,0.18) transparent;
  }

  /* ── Dashboard PC overrides ───────────────────────────────── */

  body.web-mode .dash-header {
    padding: 0 0 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
    animation: none;
  }
  body.web-mode .dash-avatar {
    width: 66px;
    height: 66px;
    font-size: 1.55rem;
    font-weight: 900;
  }
  body.web-mode .dash-name {
    font-size: 1.65rem;
  }
  body.web-mode .dash-balance {
    padding: 28px 32px;
    border-radius: 24px;
    margin-bottom: 28px;
    animation: none;
  }
  body.web-mode .dash-balance-label {
    font-size: 0.72rem;
    margin-bottom: 10px;
  }
  body.web-mode .dash-balance-row .d-balance {
    font-size: 3.4rem;
    letter-spacing: -0.05em;
  }
  body.web-mode .dash-actions {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
    animation: none;
  }
  body.web-mode .dash-action-btn {
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 26px 24px;
    gap: 18px;
    border-radius: 24px;
    min-height: 164px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  }
  body.web-mode .dash-action-btn:hover {
    border-color: rgba(168,85,247,0.3);
    box-shadow: 0 8px 32px rgba(168,85,247,0.12);
  }
  body.web-mode .dash-action-btn:active {
    transform: scale(0.99);
  }
  body.web-mode .dash-action-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(168,85,247,0.08);
    border: 1px solid rgba(168,85,247,0.16);
  }
  body.web-mode .dash-action-image .dash-action-icon {
    background: rgba(168,85,247,0.09);
    border-color: rgba(168,85,247,0.2);
  }
  body.web-mode .dash-action-video .dash-action-icon {
    background: rgba(129,140,248,0.09);
    border-color: rgba(129,140,248,0.2);
  }
  body.web-mode .dash-action-icon svg { width: 32px; height: 32px; }
  body.web-mode .dash-action-image .dash-action-icon svg { width: 40px; height: 40px; }
  body.web-mode .dash-action-text { gap: 6px; }
  body.web-mode .dash-action-title { font-size: 1.25rem; }
  body.web-mode .dash-action-image .dash-action-sub,
  body.web-mode .dash-action-video .dash-action-sub { font-size: 0.8rem; }
  body.web-mode .dash-action-arrow { display: none; }
  body.web-mode .dash-extras {
    border-radius: 20px;
    animation: none;
  }
  body.web-mode .dash-extra-item {
    padding: 16px 20px;
    transition: background 0.15s;
  }
  body.web-mode .dash-extra-item:hover {
    background: rgba(168,85,247,0.04);
  }
  body.web-mode .btn-open-bot { display: none; }
  body.web-mode .gen-back-btn,
  body.web-mode .video-back-btn { display: none; }

  /* ── Gen / Video: chat-layout (история + bottom bar + правый сайдбар) ── */

  body.web-mode.screen-gen,
  body.web-mode.screen-video {
    height: 100vh;
    overflow: hidden;
  }
  body.web-mode.screen-gen .wrap,
  body.web-mode.screen-video .wrap {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
  }
  body.web-mode.screen-gen #app,
  body.web-mode.screen-video #app,
  body.web-mode.screen-ideas #app {
    flex: 1;
    padding: 0;
    max-width: none;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  /* gen-page = CSS Grid: история → параметры → панель ввода */
  body.web-mode.screen-gen .gen-page,
  body.web-mode.screen-video .gen-page {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    grid-template-areas:
      "main"
      "params"
      "bar";
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* ── Основная колонка — история ───────────────────────────── */

  body.web-mode.screen-gen .gen-main,
  body.web-mode.screen-video .gen-main {
    grid-area: main;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.web-mode.screen-gen .gen-history-wrap,
  body.web-mode.screen-video .gen-history-wrap,
  body.web-mode.screen-gen .gen-main .gen-history-wrap,
  body.web-mode.screen-video .gen-main .gen-history-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 20px 24px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    scrollbar-gutter: stable;
  }
  body.web-mode.screen-gen .gen-history,
  body.web-mode.screen-video .gen-history {
    flex: none;
    overflow: visible;
    height: auto;
    max-height: none;
    gap: 8px;
    /* Не сжимать превью в «ленту»: при узкой колонке — горизонтальный скролл */
    grid-template-columns: repeat(6, minmax(176px, 1fr));
    grid-auto-rows: auto;
    align-content: start;
  }
  /* Video: gen.css задаёт flex:1 на .gen-history с более высокой специфичностью — на ПК ломает строки грида */
  body.web-mode.screen-video .gen-main .gen-history-wrap .gen-history:not(:has(.gen-history-empty)) {
    flex: none;
    align-self: stretch;
  }
  /* Пустое состояние: растягиваем грид на всю высоту и центрируем */
  body.web-mode.screen-gen .gen-history:has(.hist-card:only-child:not(.hist-card-img):not(.hist-card-video):not(.pending):not(.hist-card-waiting)),
  body.web-mode.screen-video .gen-history:has(.hist-card:only-child:not(.hist-card-img):not(.hist-card-video):not(.pending):not(.hist-card-waiting)),
  body.web-mode.screen-gen .gen-history:has(.gen-history-empty),
  body.web-mode.screen-video .gen-history:has(.gen-history-empty) {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Уведомление «хранятся 7 дней» (десктоп) ── */
  body.web-mode .gen-shelf-notice {
    margin: 0 0 12px;
    padding: 9px 14px;
    border-radius: 10px;
    background: rgba(234, 179, 8, 0.07);
    border: 1px solid rgba(234, 179, 8, 0.2);
    font-size: 0.79rem;
    font-weight: 500;
    color: rgba(234, 179, 8, 0.88);
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 7px;
  }
  body.web-mode .gen-shelf-notice b { font-weight: 800; }

  /* ── Empty state component ── */
  .gen-history-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    text-align: center;
    position: relative;
    user-select: none;
  }
  .gen-empty-glow {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168,85,247,0.10) 0%, transparent 68%);
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .gen-empty-glow--video {
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 68%);
  }
  .gen-empty-icon-wrap {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: 22px;
    background: rgba(168,85,247,0.07);
    border: 1px solid rgba(168,85,247,0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    animation: gen-empty-float 4s ease-in-out infinite;
    box-shadow: 0 8px 28px rgba(168,85,247,0.10);
  }
  .gen-empty-icon-wrap--video {
    background: rgba(99,102,241,0.07);
    border-color: rgba(99,102,241,0.18);
    box-shadow: 0 8px 28px rgba(99,102,241,0.12);
    animation-delay: .4s;
  }
  @keyframes gen-empty-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-9px); }
  }
  .gen-empty-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 9px;
    letter-spacing: -0.025em;
  }
  .gen-empty-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.65;
    max-width: 270px;
    margin: 0;
  }

  /* ── Карточки истории ──────────────────────────────────────── */

  body.web-mode.screen-gen .gen-history .hist-card,
  body.web-mode.screen-video .gen-history .hist-card {
    aspect-ratio: 1;
    min-height: 0;
    width: 100%;
    border-radius: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    position: relative;
  }
  body.web-mode.screen-gen .gen-history .hist-card.hist-card-img:hover,
  body.web-mode.screen-video .gen-history .hist-card.hist-card-img:hover,
  body.web-mode.screen-gen .gen-history .hist-card.hist-card-video:hover,
  body.web-mode.screen-video .gen-history .hist-card.hist-card-video:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 28px rgba(168,85,247,0.2);
    border-color: rgba(168,85,247,0.3);
    z-index: 2;
  }

  /* ── Оживить / Редактировать — hover-оверлей на карточке ── */
  body.web-mode.screen-gen .hist-card-actions,
  body.web-mode.screen-video .hist-card-actions {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex; gap: 5px; padding: 22px 6px 6px;
    background: linear-gradient(to top, rgba(7,4,15,0.82) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.18s;
    pointer-events: none;
    border-radius: 0 0 10px 10px;
  }
  body.web-mode.screen-gen .hist-card-img:hover .hist-card-actions,
  body.web-mode.screen-video .hist-card-img:hover .hist-card-actions {
    opacity: 1;
    pointer-events: auto;
  }
  body.web-mode .hist-card-action-btn {
    flex: 1;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 5px 4px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
  }
  body.web-mode .hist-card-action-btn:active { transform: scale(0.95); }
  body.web-mode .hist-card-animate {
    background: rgba(99,102,241,0.88);
    color: #fff;
  }
  body.web-mode .hist-card-animate:hover { background: #6366f1; }
  body.web-mode .hist-card-edit {
    background: rgba(255,255,255,0.14);
    color: #fff;
    backdrop-filter: blur(4px);
  }
  body.web-mode .hist-card-edit:hover { background: rgba(255,255,255,0.25); }

  /* Кнопки «Оживить»/«Редактировать» в лайтбоксе — на ПК не нужны (есть hover на карточках) */
  .lb-image-actions { display: none !important; }

  /* Blink — мигание поля промпта при «Оживить» */
  @keyframes inputPulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 3px rgba(99,102,241,0.55), 0 0 14px rgba(99,102,241,0.28); }
  }
  .input-pulse { animation: inputPulse 0.5s ease; }

  /* ── Нижняя chat-панель ──────────────────────────────────────── */

  body.web-mode.screen-gen .gen-bottom-bar,
  body.web-mode.screen-video .gen-bottom-bar {
    grid-area: bar;
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding: 12px 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  body.web-mode.screen-gen .gen-bottom-bar.gen-chat .gen-storage-notice {
    margin: -4px 0 0;
    padding: 0 2px 2px;
    font-size: 0.78rem;
    line-height: 1.45;
    font-weight: 500;
    color: var(--tg-theme-hint, rgba(196, 164, 255, 0.55));
    text-align: left;
  }
  body.web-mode.screen-gen .gen-bottom-bar.gen-chat .gen-storage-notice-days {
    font-weight: 800;
    color: var(--accent, #c084fc);
    letter-spacing: 0.02em;
  }
  /* Строка: [📎] [textarea] [кнопки] */
  body.web-mode.screen-gen .gen-bottom-row,
  body.web-mode.screen-video .gen-bottom-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
  }
  /* Промпт тянется на всю ширину */
  body.web-mode.screen-gen .gen-bottom-bar .prompt-wrap,
  body.web-mode.screen-video .gen-bottom-bar .prompt-wrap {
    flex: 1;
    min-width: 0;
    margin: 0;
  }
  body.web-mode.screen-gen .gen-bottom-bar .chat-prompt,
  body.web-mode.screen-video .gen-bottom-bar .chat-prompt {
    min-height: 48px;
    max-height: 160px;
    resize: none;
    border-radius: 14px;
    padding: 12px 38px 12px 14px;
    font-size: 0.92rem;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  body.web-mode.screen-gen .gen-bottom-bar .chat-prompt:focus,
  body.web-mode.screen-video .gen-bottom-bar .chat-prompt:focus {
    border-color: rgba(168,85,247,0.35);
    box-shadow: 0 0 0 3px rgba(168,85,247,0.08);
    outline: none;
  }
  /* Кнопка добавления фото — иконка */
  body.web-mode.screen-gen .chat-add-photo,
  body.web-mode.screen-video .chat-add-photo {
    width: 48px;
    height: 48px;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    border-radius: 12px;
    transition: background 0.15s, border-color 0.15s;
  }
  body.web-mode.screen-gen .chat-add-photo:hover,
  body.web-mode.screen-video .chat-add-photo:hover {
    background: rgba(168,85,247,0.1);
    border-color: rgba(168,85,247,0.3);
  }
  body.web-mode.screen-gen .chat-add-photo svg,
  body.web-mode.screen-video .chat-add-photo svg {
    width: 20px;
    height: 20px;
    display: block;
  }
  /* Строка отправки на десктопе */
  body.web-mode.screen-gen .gen-submit-row,
  body.web-mode.screen-video .gen-submit-row {
    padding: 0;
  }
  body.web-mode.screen-gen .gen-submit-row .chat-submit,
  body.web-mode.screen-video .gen-submit-row .chat-submit {
    white-space: nowrap;
    flex: 0 0 auto;
    width: 250px;
    border-radius: 14px;
    padding: 13px 20px;
    font-size: 0.95rem;
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s;
  }
  body.web-mode.screen-gen .gen-submit-row .chat-submit:not(:disabled):hover,
  body.web-mode.screen-video .gen-submit-row .chat-submit:not(:disabled):hover {
    box-shadow: 0 10px 28px rgba(168,85,247,0.4);
  }
  body.web-mode.screen-gen .gen-submit-row .chat-submit:not(:disabled):active,
  body.web-mode.screen-video .gen-submit-row .chat-submit:not(:disabled):active {
    transform: scale(0.98);
  }
  /* Блок кнопок справа (legacy video) */
  body.web-mode.screen-gen .gen-bottom-actions,
  body.web-mode.screen-video .gen-bottom-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
  body.web-mode.screen-gen .gen-bottom-actions .chat-submit,
  body.web-mode.screen-video .gen-bottom-actions .chat-submit {
    white-space: nowrap;
  }
  body.web-mode.screen-gen .gen-bottom-actions .video-script-btn-wrap,
  body.web-mode.screen-video .gen-bottom-actions .video-script-btn-wrap {
    display: flex;
  }
  /* Превью фото над строкой ввода */
  body.web-mode.screen-gen .gen-bottom-bar .gen-photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
  }

  /* ── DESKTOP: плавающая карточка ввода (ChatGPT-style) ─────── */

  /* Grid: main + card (2 строки) — gen и video */
  body.web-mode.screen-gen .gen-page,
  body.web-mode.screen-video .gen-page {
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "main"
      "card";
  }


  /* Карточка: центрирована, max-width, скруглённые углы, тень */
  body.web-mode .gen-input-card {
    grid-area: card;
    max-width: 820px;
    width: calc(100% - 48px);
    margin: 0 auto 16px;
    padding: 0;
    border-radius: 22px;
    background: var(--bg);
    border: 1px solid rgba(168,85,247,0.16);
    box-shadow:
      0 2px 8px rgba(0,0,0,0.18),
      0 8px 32px rgba(0,0,0,0.14),
      0 0 0 1px rgba(168,85,247,0.04);
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  body.web-mode .gen-input-card:focus-within {
    border-color: rgba(168,85,247,0.3);
    box-shadow:
      0 2px 8px rgba(0,0,0,0.18),
      0 8px 32px rgba(168,85,247,0.1),
      0 0 0 1px rgba(168,85,247,0.1);
  }

  /* ── Drag & Drop подсветка ───────────────────────────────── */
  body.web-mode .gen-input-card.drag-over {
    border-color: rgba(168,85,247,0.5);
    box-shadow:
      0 0 0 2px rgba(168,85,247,0.2),
      0 8px 32px rgba(168,85,247,0.15);
  }
  body.web-mode .gen-input-card.drag-over::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: rgba(168,85,247,0.04);
    pointer-events: none;
    z-index: 5;
  }

  /* ── Верхний toolbar с чипами параметров ─────────────────── */
  body.web-mode .gen-input-card .gen-toolbar-top {
    border-top: none;
    border-bottom: 1px solid rgba(168,85,247,0.07);
    padding: 10px 14px;
    border-radius: 22px 22px 0 0;
  }

  /* ── Чип кол-ва генераций (×1 / ×3 / ×5) ────────────────── */
  body.web-mode .gen-input-card .gen-count-wrap {
    display: inline-block;
  }
  body.web-mode .gen-input-card .gen-count-chip {
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  /* ── Полоса миниатюр фото + кнопка добавить (строка 2) ──── */
  body.web-mode .gen-card-photos {
    padding: 0 14px;
    overflow: visible;
    border-bottom: 1px solid rgba(168,85,247,0.07);
    position: relative;
    z-index: 10;
  }
  body.web-mode .gen-card-photos .gen-photo-strip-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: visible;
    padding: 8px 0;
  }
  body.web-mode .gen-card-photos .gen-photo-thumbs {
    display: contents;
  }
  body.web-mode .gen-card-photos .gen-photo-thumbs .gen-photo-thumb {
    flex: 0 0 auto;
  }
  body.web-mode .gen-card-photos .gen-photo-strip-scroll .gen-photo-add-wrap {
    flex: 0 0 auto;
    position: relative;
    z-index: 50;
  }
  body.web-mode .gen-card-photos .gen-photo-strip-scroll .gen-photo-counter {
    flex: 0 0 auto;
    font-size: 0.78rem;
    opacity: 0.5;
    white-space: nowrap;
  }

  /* ── Уведомление о сроке хранения (над промптом, desktop) ─── */
  body.web-mode .gen-input-card .gen-storage-notice {
    margin: 4px 0 6px;
    padding: 0 16px;
    font-size: 0.78rem;
    line-height: 1.45;
    font-weight: 500;
    color: var(--popup-desc, rgba(196, 164, 255, 0.55));
    text-align: left;
  }
  body.web-mode .gen-input-card .gen-storage-notice-days {
    font-weight: 800;
    color: var(--accent, #c084fc);
    letter-spacing: 0.02em;
  }

  /* ── Область ввода промпта ────────────────────────────────── */
  body.web-mode .gen-input-card .gen-prompt-area {
    padding: 8px 12px 4px;
  }
  body.web-mode .gen-input-card .gen-prompt-area .prompt-wrap {
    margin: 0;
  }
  body.web-mode .gen-input-card .chat-prompt {
    min-height: 72px;
    max-height: none;
    overflow-y: auto;
    resize: none;
    border: 1px solid var(--border);
    background: rgba(168,85,247,0.03);
    border-radius: 14px;
    padding: 12px 52px 12px 14px;
    font-size: 0.93rem;
    line-height: 1.5;
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  body.web-mode .gen-input-card .chat-prompt::placeholder {
    color: rgba(168,85,247,0.55);
  }
  body.web-mode .gen-input-card .chat-prompt:focus {
    border-color: rgba(168,85,247,0.35);
    box-shadow: 0 0 0 3px rgba(168,85,247,0.06);
    outline: none;
  }
  /* Кнопки improve/clear внутри промпта */
  body.web-mode .gen-input-card .prompt-improve-btn,
  body.web-mode .gen-input-card .prompt-clear-btn {
    opacity: 0.5;
    transition: opacity 0.15s;
  }
  /* ── Чип «@Стиль» в поле ввода (desktop) ──────────────── */
  body.web-mode .gen-input-card .prompt-wrap.has-idea-chip {
    min-height: 72px;
    border-radius: 14px;
    border: 1px solid rgba(168,85,247,0.2);
    background: rgba(168,85,247,0.03);
    display: flex; align-items: center;
    padding: 14px 16px;
    margin: 0;
  }
  body.web-mode .gen-input-card .prompt-wrap.has-idea-chip .prompt-improve-btn,
  body.web-mode .gen-input-card .prompt-wrap.has-idea-chip .prompt-clear-btn { display: none !important; }
  body.web-mode .gen-input-card .gen-idea-chip {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-radius: 10px;
    background: linear-gradient(135deg, rgba(168,85,247,0.14) 0%, rgba(129,140,248,0.08) 100%);
    border: 1px solid rgba(168,85,247,0.25);
    font-family: inherit;
    animation: ideaChipIn 0.25s ease-out;
  }
  body.web-mode .gen-input-card .gen-idea-chip-icon {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    background: rgba(168,85,247,0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; color: #a855f7;
  }
  body.web-mode .gen-input-card .gen-idea-chip-text {
    flex: 1; min-width: 0;
    font-size: 0.95rem; font-weight: 600;
    color: #c084fc;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  body.web-mode .gen-input-card .gen-idea-chip-remove {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    border: none; background: rgba(255,255,255,0.08);
    color: var(--text-muted); font-size: 1.05rem; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
  }
  body.web-mode .gen-input-card .gen-idea-chip-remove:hover {
    background: rgba(255,255,255,0.16); color: var(--text);
  }
  body.web-mode .gen-input-card .prompt-improve-btn:hover,
  body.web-mode .gen-input-card .prompt-clear-btn:hover {
    opacity: 1;
  }
  /* msg между prompt-area и submit-row */
  body.web-mode .gen-input-card .msg:empty {
    display: none;
  }

  /* ── Строка кнопки «Сгенерировать» (под textarea, на всю ширину) ── */
  body.web-mode .gen-input-card .gen-submit-row-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 12px;
  }
  body.web-mode .gen-input-card .gen-submit-row-desktop .chat-submit {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    border-radius: 14px;
    padding: 13px 28px;
    font-size: 0.93rem;
    border: none;
    background: var(--accent);
    color: var(--tg-theme-button-text, #fff);
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(168,85,247,0.3);
    opacity: 0.55;
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s;
  }
  body.web-mode .gen-input-card .gen-submit-row-desktop .chat-submit:not(:disabled) {
    opacity: 1;
    box-shadow: 0 6px 18px rgba(168,85,247,0.35);
  }
  body.web-mode .gen-input-card .gen-submit-row-desktop .chat-submit:not(:disabled):hover {
    box-shadow: 0 6px 22px rgba(168,85,247,0.5);
  }
  body.web-mode .gen-input-card .gen-submit-row-desktop .chat-submit:not(:disabled):active {
    transform: scale(0.97);
  }
  body.web-mode .gen-input-card .gen-submit-row-desktop .chat-submit:disabled {
    cursor: not-allowed;
  }
  /* Кнопка маски (справа от кнопки «Сгенерировать») */
  body.web-mode .gen-input-card .gen-submit-row-desktop #gen-mask-slot {
    flex: 0 0 auto;
  }
  body.web-mode .gen-input-card .gen-submit-row-desktop #gen-mask-slot .gen-chip {
    border-radius: 14px;
    padding: 13px 18px;
    font-size: 0.88rem;
    height: 100%;
    box-sizing: border-box;
  }

  /* ── Video: элементы внутри карточки ─────────────────────── */
  body.web-mode .gen-input-card .video-script-btn-wrap {
    flex: 1;
    min-width: 0;
  }
  body.web-mode .gen-input-card .video-script-btn {
    border-radius: 14px;
    padding: 9px 18px;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
  }
  body.web-mode .gen-input-card .video-view-scenes-btn {
    border-radius: 12px;
    font-size: 0.88rem;
    flex: 0 0 auto;
  }
  body.web-mode .gen-input-card .video-shots-wrap {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(168,85,247,0.07);
  }
  /* Kling доп. настройки внутри карточки */
  body.web-mode .gen-input-card .video-card-kling {
    padding: 8px 16px;
    border-top: 1px solid rgba(168,85,247,0.06);
  }
  body.web-mode .gen-input-card .video-kling-frames-wrap {
    padding: 10px 16px;
    border-top: 1px solid rgba(168,85,247,0.06);
  }
  /* Veo type row + Kling 2.6 wrap inside desktop card */
  body.web-mode .gen-input-card #video-veo-type-wrap {
    padding: 8px 16px;
    border-top: 1px solid rgba(168,85,247,0.06);
  }
  body.web-mode .gen-input-card #video-kling26-wrap > .gen-params-row {
    padding: 8px 16px;
    border-top: 1px solid rgba(168,85,247,0.06);
  }

  /* ── Toolbar (нижняя часть карточки, общее для gen + video) ── */
  body.web-mode .gen-toolbar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: visible;
    padding: 6px 12px 10px;
    border-top: 1px solid rgba(168,85,247,0.07);
  }
  body.web-mode .gen-toolbar-spacer {
    flex: 1;
    min-width: 0;
  }
  /* Чипы в тулбаре чуть мельче */
  body.web-mode .gen-toolbar-row .gen-chip {
    font-size: 0.82rem;
    padding: 6px 12px;
    border-radius: 10px;
  }
  /* Кнопка «Сгенерировать» / «Создать видео» */
  body.web-mode .gen-toolbar-row .chat-submit {
    white-space: nowrap;
    flex: 0 0 auto;
    border-radius: 14px;
    padding: 9px 22px;
    font-size: 0.88rem;
    border: none;
    background: var(--accent);
    color: var(--tg-theme-button-text, #fff);
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(168,85,247,0.3);
    opacity: 0.55;
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s;
  }
  body.web-mode .gen-toolbar-row .chat-submit:not(:disabled) {
    opacity: 1;
    box-shadow: 0 6px 18px rgba(168,85,247,0.35);
  }
  body.web-mode .gen-toolbar-row .chat-submit:not(:disabled):hover {
    box-shadow: 0 6px 22px rgba(168,85,247,0.5);
  }
  body.web-mode .gen-toolbar-row .chat-submit:not(:disabled):active {
    transform: scale(0.97);
  }
  body.web-mode .gen-toolbar-row .chat-submit:disabled {
    cursor: not-allowed;
  }
  body.web-mode .gen-toolbar-row .msg:empty {
    display: none;
  }
  /* Photo-add кнопка в тулбаре */
  body.web-mode .gen-toolbar-row .gen-photo-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  body.web-mode .gen-toolbar-row .gen-photo-counter {
    font-size: 0.78rem;
    opacity: 0.5;
  }

  /* ── Строка параметров над полем ввода ───────────────────────── */

  body.web-mode.screen-gen .gen-params-bar,
  body.web-mode.screen-video .gen-params-bar {
    grid-area: params;
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding: 10px 24px;
    gap: 10px;
    border-radius: 0;
  }
  body.web-mode.screen-gen .gen-chip,
  body.web-mode.screen-video .gen-chip {
    font-size: 0.84rem;
    padding: 7px 14px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  body.web-mode.screen-gen .gen-chip:hover,
  body.web-mode.screen-video .gen-chip:hover {
    background: rgba(168,85,247,0.1);
    border-color: rgba(168,85,247,0.3);
  }
  body.web-mode .gen-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }
  .video-veo-type-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
  /* Kling frames внутри сайдбара */
  body.web-mode .gen-params-body .video-kling-frames-wrap {
    padding: 0;
    background: none;
    border: none;
    gap: 10px;
  }
  body.web-mode .gen-params-body .video-kling-frames-row {
    justify-content: flex-start;
    gap: 8px;
  }
  body.web-mode .gen-params-body .video-kling-sound-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  /* ── Попап выбора модели ───────────────────────────────────── */

  /* ═══════════════════════════════════════════════════════════════
     PC: Model Selection Popup — Full Redesign
  ═══════════════════════════════════════════════════════════════ */
  body.web-mode #gen-model-overlay.gen-overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(14px);
    align-items: center;
    justify-content: center;
    padding: 32px;
  }

  /* ─── Контейнер ─── */
  body.web-mode .gen-popup-models {
    max-width: 940px;
    width: 100%;
    height: auto;
    min-height: auto;
    max-height: 88vh;
    border-radius: 28px;
    border: 1px solid rgba(168,85,247,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--popup-bg, #100c1a);
    box-shadow: 0 32px 80px rgba(0,0,0,0.65), 0 0 0 1px rgba(168,85,247,0.1) inset;
    padding: 0;
  }

  /* ─── Шапка ─── */
  body.web-mode .gen-popup-models .popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 32px 22px;
    background: linear-gradient(135deg, rgba(168,85,247,0.1) 0%, rgba(124,58,237,0.04) 100%);
    border-bottom: 1px solid rgba(168,85,247,0.1);
    flex-shrink: 0;
    position: relative;
  }
  body.web-mode .gen-popup-models .popup-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #a855f7 35%, #7c3aed 65%, transparent 100%);
  }
  body.web-mode .gen-popup-models-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  body.web-mode .gen-popup-models .popup-title {
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ede0ff 0%, #c084fc 55%, #9333ea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    color: unset;
  }
  body.web-mode .gen-popup-models-sub {
    display: block;
    font-size: 0.78rem;
    color: rgba(196,164,255,0.45);
    font-weight: 500;
    letter-spacing: 0.01em;
  }
  body.web-mode .gen-popup-models .gen-models-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(168,85,247,0.22);
    background: rgba(168,85,247,0.07);
    color: rgba(196,164,255,0.65);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  body.web-mode .gen-popup-models .gen-models-close:hover {
    background: rgba(168,85,247,0.16);
    color: #e9d5ff;
    border-color: rgba(168,85,247,0.4);
  }

  /* ─── Сетка 3 колонки ─── */
  body.web-mode .gen-popup-models .model-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: none;
    grid-auto-rows: auto;
    height: auto;
    max-height: none;
    overflow-y: auto;
    align-content: start;
    gap: 14px;
    padding: 24px 28px 28px;
    background: rgba(0,0,0,0.2);
  }
  body.web-mode .gen-popup-models .model-list::-webkit-scrollbar { width: 4px; }
  body.web-mode .gen-popup-models .model-list::-webkit-scrollbar-track { background: transparent; }
  body.web-mode .gen-popup-models .model-list::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.25); border-radius: 4px; }

  /* ─── Карточка — вертикальный лейаут ─── */
  body.web-mode .gen-popup-models .model-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    height: auto;
    min-height: 176px;
    padding: 20px 20px 52px;
    color: var(--text);
    border-radius: 20px;
    border: 1px solid rgba(168,85,247,0.12);
    background: rgba(255,255,255,0.022);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.18s;
    position: relative;
    overflow: hidden;
  }
  body.web-mode .gen-popup-models .model-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    opacity: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(168,85,247,0.12) 0%, transparent 70%);
    transition: opacity 0.25s;
    pointer-events: none;
  }
  body.web-mode .gen-popup-models .model-card:hover {
    background: rgba(168,85,247,0.07);
    border-color: rgba(168,85,247,0.3);
    box-shadow: 0 8px 32px rgba(168,85,247,0.18);
    transform: translateY(-4px);
  }
  body.web-mode .gen-popup-models .model-card:hover::after { opacity: 1; }
  body.web-mode .gen-popup-models .model-card:active { transform: translateY(-1px) scale(0.99); }
  body.web-mode .gen-popup-models .model-card.active {
    border-color: rgba(168,85,247,0.5);
    background: rgba(168,85,247,0.1);
    box-shadow: 0 0 0 1px rgba(168,85,247,0.18) inset, 0 10px 36px rgba(168,85,247,0.22);
    transform: translateY(-2px);
  }
  body.web-mode .gen-popup-models .model-card.active::after { opacity: 1; }

  /* ─── Иконка ─── */
  body.web-mode .gen-popup-models .model-card .model-icon {
    grid-column: unset;
    grid-row: unset;
    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;
    flex-shrink: 0;
    align-self: flex-start;
    border-radius: 16px;
    background: rgba(168,85,247,0.13);
    border: 1px solid rgba(168,85,247,0.14);
    margin-bottom: 14px;
  }
  body.web-mode .gen-popup-models .model-card.active .model-icon {
    background: rgba(168,85,247,0.2);
    border-color: rgba(168,85,247,0.28);
  }

  /* ─── Тело карточки ─── */
  body.web-mode .gen-popup-models .model-card .model-body {
    position: static;
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  body.web-mode .gen-popup-models .model-card .model-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
  }
  body.web-mode .gen-popup-models .model-card-nsfw .model-name-row {
    align-items: flex-start;
  }
  body.web-mode .gen-popup-models .model-card-nsfw .model-name-row .model-badge-18 {
    margin-top: 0.28em;
  }
  body.web-mode .gen-popup-models .model-card .model-icon.model-icon-refined img {
    object-fit: contain;
    padding: 8px;
    box-sizing: border-box;
    border-radius: 10px;
  }
  body.web-mode .gen-popup-models .model-card .model-name {
    text-align: left;
    color: var(--popup-text, #ede0ff);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    display: block;
    font-size: 1rem;
    font-weight: 800;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-text-fill-color: var(--popup-text, #ede0ff);
  }
  body.web-mode .gen-popup-models .model-card .model-desc {
    text-align: left;
    color: var(--popup-desc, rgba(196,164,255,0.55));
    font-size: 0.74rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: unset;
    margin-top: 2px;
  }
  body.web-mode .gen-popup-models .model-card .model-tags {
    display: flex;
    gap: 5px;
    margin-top: 6px;
    flex-wrap: wrap;
  }
  body.web-mode .gen-popup-models .model-card .model-tag {
    font-size: 0.6rem;
    padding: 3px 7px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 99px;
    background: rgba(168,85,247,0.1);
    color: rgba(196,164,255,0.6);
    font-weight: 600;
  }

  /* ─── Цена ─── */
  body.web-mode .gen-popup-models .model-card .model-price {
    grid-column: unset;
    grid-row: unset;
    position: absolute;
    bottom: 14px;
    right: 14px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 10px;
  }

  /* ─── Галочка выбранной ─── */
  body.web-mode .gen-popup-models .model-card .model-check {
    display: none;
    position: absolute;
    top: 14px; right: 14px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(168,85,247,0.2);
    border: 1.5px solid rgba(168,85,247,0.45);
    color: var(--accent);
    align-items: center;
    justify-content: center;
  }
  body.web-mode .gen-popup-models .model-card.active .model-check { display: flex; }

  /* ─── NSFW карточки ─── */
  body.web-mode .gen-popup-models .model-card-nsfw {
    border-color: rgba(239,68,68,0.12);
    background: rgba(239,68,68,0.022);
  }
  body.web-mode .gen-popup-models .model-card-nsfw::after {
    background: radial-gradient(ellipse at 50% 0%, rgba(239,68,68,0.1) 0%, transparent 70%);
  }
  body.web-mode .gen-popup-models .model-card-nsfw:hover {
    border-color: rgba(239,68,68,0.35);
    background: rgba(239,68,68,0.07);
    box-shadow: 0 8px 32px rgba(239,68,68,0.14);
  }
  body.web-mode .gen-popup-models .model-card-nsfw.active {
    border-color: rgba(239,68,68,0.5);
    background: rgba(239,68,68,0.09);
    box-shadow: 0 0 0 1px rgba(239,68,68,0.18) inset, 0 10px 36px rgba(239,68,68,0.18);
  }
  body.web-mode .gen-popup-models .model-card-nsfw .model-icon {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.15);
  }
  body.web-mode .gen-popup-models .model-card-nsfw .model-icon.model-icon-refined {
    background: linear-gradient(145deg, rgba(244,114,182,0.14), rgba(168,85,247,0.1));
    border-color: rgba(239,68,68,0.18);
  }

  /* ══════════════════════════════════════════════════════════════
     LIGHT THEME — попап выбора модели
  ══════════════════════════════════════════════════════════════ */
  [data-theme="light"] body.web-mode #gen-model-overlay.gen-overlay {
    background: rgba(90,50,140,0.25);
    backdrop-filter: blur(14px);
  }
  [data-theme="light"] body.web-mode .gen-popup-models {
    background: #ffffff;
    border-color: rgba(124,58,237,0.14);
    box-shadow: 0 24px 60px rgba(100,50,200,0.18), 0 0 0 1px rgba(124,58,237,0.08) inset;
    --popup-bg: #ffffff;
    --popup-text: #1a0a2e;
    --popup-desc: rgba(80,50,120,0.6);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .popup-header {
    background: linear-gradient(135deg, rgba(124,58,237,0.06) 0%, rgba(168,85,247,0.02) 100%);
    border-bottom: 1px solid rgba(124,58,237,0.1);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .popup-header::before {
    background: linear-gradient(90deg, transparent 0%, #7c3aed 35%, #a855f7 65%, transparent 100%);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .popup-title {
    background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 55%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  [data-theme="light"] body.web-mode .gen-popup-models-sub {
    color: rgba(100,60,160,0.55);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .gen-models-close {
    background: rgba(124,58,237,0.06);
    border-color: rgba(124,58,237,0.18);
    color: rgba(100,60,160,0.7);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .gen-models-close:hover {
    background: rgba(124,58,237,0.12);
    color: #5b21b6;
    border-color: rgba(124,58,237,0.36);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-list {
    background: rgba(124,58,237,0.03);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card {
    background: rgba(255,255,255,0.9);
    border-color: rgba(124,58,237,0.1);
    color: #1a0a2e;
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card::after {
    background: radial-gradient(ellipse at 50% 0%, rgba(124,58,237,0.08) 0%, transparent 70%);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card:hover {
    background: rgba(245,237,255,0.95);
    border-color: rgba(124,58,237,0.28);
    box-shadow: 0 8px 28px rgba(124,58,237,0.12);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card.active {
    background: rgba(237,224,255,0.8);
    border-color: rgba(124,58,237,0.4);
    box-shadow: 0 0 0 1px rgba(124,58,237,0.15) inset, 0 8px 28px rgba(124,58,237,0.15);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card .model-icon {
    background: rgba(124,58,237,0.1);
    border-color: rgba(124,58,237,0.12);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card.active .model-icon {
    background: rgba(124,58,237,0.16);
    border-color: rgba(124,58,237,0.24);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card .model-name {
    color: #1a0a2e;
    -webkit-text-fill-color: #1a0a2e;
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card .model-desc {
    color: rgba(80,50,120,0.65);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card .model-tag {
    background: rgba(124,58,237,0.08);
    color: rgba(80,50,140,0.7);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card .model-check {
    background: rgba(124,58,237,0.14);
    border-color: rgba(124,58,237,0.4);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card-nsfw {
    background: rgba(255,248,248,0.9);
    border-color: rgba(239,68,68,0.1);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card-nsfw:hover {
    background: rgba(255,240,240,0.95);
    border-color: rgba(239,68,68,0.28);
    box-shadow: 0 8px 28px rgba(239,68,68,0.1);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card-nsfw.active {
    background: rgba(255,232,232,0.85);
    border-color: rgba(239,68,68,0.4);
    box-shadow: 0 0 0 1px rgba(239,68,68,0.15) inset, 0 8px 28px rgba(239,68,68,0.12);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card-nsfw .model-icon {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.12);
  }
  [data-theme="light"] body.web-mode .gen-popup-models .model-card-nsfw .model-icon.model-icon-refined {
    background: linear-gradient(145deg, rgba(244,114,182,0.14), rgba(168,85,247,0.08));
    border-color: rgba(239,68,68,0.14);
  }

  /* ── Lightbox — desktop polish ─────────────────────────────── */

  body.web-mode .gen-lightbox {
    backdrop-filter: blur(12px);
    background: rgba(0,0,0,0.88);
    cursor: zoom-out;
  }
  body.web-mode .gen-lightbox img {
    cursor: default;
    border-radius: 8px;
    max-height: 90vh;
    max-width: 90vw;
    box-shadow: 0 16px 64px rgba(0,0,0,0.5);
  }
  body.web-mode .gen-lightbox .gen-lightbox-top {
    padding: 16px 24px;
  }
  body.web-mode .gen-lightbox .gen-lightbox-top .lb-btn {
    transition: background 0.15s, color 0.15s;
  }
  body.web-mode .gen-lightbox .gen-lightbox-top .lb-btn:hover {
    background: rgba(168,85,247,0.25);
  }
  body.web-mode .gen-lightbox .gen-lightbox-close {
    width: 40px;
    height: 40px;
    transition: background 0.15s, transform 0.1s;
  }
  body.web-mode .gen-lightbox .gen-lightbox-close:hover {
    background: rgba(168,85,247,0.25);
    transform: scale(1.05);
  }
  body.web-mode .gen-lightbox .gen-lightbox-download {
    transition: opacity 0.15s, box-shadow 0.15s;
  }
  body.web-mode .gen-lightbox .gen-lightbox-download:hover {
    box-shadow: 0 4px 16px rgba(168,85,247,0.3);
  }

  /* ── Попапы общие — desktop ────────────────────────────────── */

  body.web-mode .gen-overlay {
    backdrop-filter: blur(8px);
  }
  body.web-mode .gen-popup {
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  }

  /* ── Маска (inpainting) — desktop ──────────────────────────── */

  body.web-mode .gen-mask-overlay {
    background: rgba(7,4,16,0.7);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 32px;
  }
  /* Внутренний контейнер — модальное окно */
  body.web-mode .gen-mask-overlay > * {
    max-width: 900px;
    width: 100%;
  }
  body.web-mode .gen-mask-toolbar {
    background: rgba(14,10,28,0.95);
    border-bottom: 1px solid rgba(168,85,247,0.12);
    border-radius: 18px 18px 0 0;
    padding: 12px 16px;
    gap: 8px;
  }
  body.web-mode .gen-mask-tool {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  body.web-mode .gen-mask-tool:hover {
    background: rgba(168,85,247,0.12);
    border-color: rgba(168,85,247,0.3);
  }
  body.web-mode .gen-mask-size-slider {
    max-width: 280px;
  }
  body.web-mode .gen-mask-canvas-wrap {
    flex: 0 1 auto;
    max-height: 65vh;
    background: #0a0714;
    border-left: 1px solid rgba(168,85,247,0.08);
    border-right: 1px solid rgba(168,85,247,0.08);
  }
  body.web-mode #gen-mask-canvas {
    max-height: 65vh;
  }
  body.web-mode .gen-mask-actions {
    background: rgba(14,10,28,0.95);
    border-top: 1px solid rgba(168,85,247,0.12);
    border-radius: 0 0 18px 18px;
    padding: 14px 18px;
    gap: 12px;
  }
  body.web-mode .gen-mask-cancel {
    flex: 1;
    border-radius: 12px !important;
    padding: 12px 20px;
    font-size: 0.92rem;
    transition: background 0.15s;
  }
  body.web-mode .gen-mask-cancel:hover {
    background: rgba(255,255,255,0.15) !important;
  }
  body.web-mode .gen-mask-confirm {
    flex: 2;
    border-radius: 12px !important;
    padding: 12px 20px;
    font-size: 0.92rem;
    transition: box-shadow 0.15s, transform 0.1s;
  }
  body.web-mode .gen-mask-confirm:hover {
    box-shadow: 0 8px 24px rgba(168,85,247,0.5);
  }
  body.web-mode .gen-mask-confirm:active {
    transform: scale(0.98);
  }
  body.web-mode .gen-mask-cursor {
    display: block;
  }

  /* ── No-money popup — desktop ──────────────────────────────── */

  body.web-mode .gen-popup-topup {
    max-width: 420px;
    border-radius: 20px;
  }

  /* ── Баланс в углу — скрыт на ПК (есть в сайдбаре) ─────── */

  body.web-mode .gen-balance-corner {
    display: none;
  }

  /* ── Error toast — desktop position ────────────────────────── */

  body.web-mode .gen-error-toast {
    top: 28px;
    border-radius: 14px;
    font-size: 0.9rem;
  }
}

/* ══════════════════════════════════════════════════════════════
   Mobile Web Mode  (web-mode but < 1200px — мобильный браузер)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1199px) {

  /* Sidebar hidden — нет места */
  .pc-sidebar { display: none !important; }

  /* Wrap: full-width на экранах gen/video */
  body.web-mode.screen-gen .wrap,
  body.web-mode.screen-video .wrap {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  body.web-mode.screen-gen,
  body.web-mode.screen-video {
    height: 100vh;
    overflow: hidden;
    padding-bottom: 0;
  }

  body.web-mode.screen-gen #app,
  body.web-mode.screen-video #app {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    max-width: 100%;
  }

  body.web-mode.screen-gen .gen-page,
  body.web-mode.screen-video .gen-page {
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
    display: flex;
    flex-direction: column;
  }

  body.web-mode.screen-gen .gen-main,
  body.web-mode.screen-video .gen-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.web-mode.screen-gen .gen-history-wrap,
  body.web-mode.screen-video .gen-history-wrap {
    flex: none;
    overflow: visible;
    display: block;
    padding: 12px 16px;
  }

  body.web-mode.screen-gen .gen-history,
  body.web-mode.screen-video .gen-history {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Mobile web: используем TG-структуру (gen-params-bar + gen-bottom-bar gen-chat).
     gen-input-card здесь не рендерится — только PC ≥1200px.
     Применяем те же правила что у TG, но добавляем :not(.web-mode) → web-mode варианты. */

  body.mobile-web-mode.screen-gen .gen-bottom-row,
  body.mobile-web-mode.screen-video .gen-bottom-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  body.mobile-web-mode.screen-gen .gen-bottom-bar .prompt-wrap,
  body.mobile-web-mode.screen-video .gen-bottom-bar .prompt-wrap {
    width: 100%;
  }

  body.mobile-web-mode.screen-gen .gen-submit-row,
  body.mobile-web-mode.screen-video .gen-submit-row {
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  }

  body.mobile-web-mode.screen-gen .gen-bottom-bar,
  body.mobile-web-mode.screen-video .gen-bottom-bar {
    padding: 6px 12px 0;
  }

  /* Показываем баланс и кнопку назад */
  body.web-mode .gen-balance-corner { display: block; }
  body.web-mode .gen-back-btn,
  body.web-mode .video-back-btn { display: flex; }
}

/* ── Экран «Готовые идеи» ───────────────────────────────────────────────── */

.ideas-screen {
  flex: 1;
  overflow-y: auto;
  padding: 28px 40px 48px;
  scrollbar-width: thin;
  scrollbar-color: rgba(168,85,247,0.2) transparent;
}

/* Фильтр-чипы */
.ideas-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.ideas-chip {
  padding: 7px 18px;
  border-radius: 20px;
  border: 1px solid rgba(168,85,247,0.18);
  background: transparent;
  color: rgba(240,232,255,0.7);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ideas-chip:hover {
  border-color: rgba(168,85,247,0.35);
  color: #f0e8ff;
}
.ideas-chip.active {
  background: #f0e8ff;
  color: #0d0a14;
  border-color: #f0e8ff;
}

/* Секции */
.ideas-section {
  margin-bottom: 36px;
}
.ideas-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.ideas-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f0e8ff;
  margin: 0;
  letter-spacing: -0.02em;
}
.ideas-see-all {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(168,85,247,0.2);
  background: transparent;
  color: rgba(240,232,255,0.7);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.ideas-see-all:hover { border-color: rgba(168,85,247,0.4); color: #f0e8ff; }
.ideas-fire { font-style: normal; }
.ideas-coming-soon {
  text-align: center;
  padding: 32px 16px;
  font-size: 0.85rem;
  color: rgba(200,180,255,0.4);
  font-weight: 500;
}
[data-theme="light"] .ideas-coming-soon { color: #8b7aa8; }
.ideas-empty {
  color: rgba(200,180,255,0.4);
  font-size: 0.88rem;
  padding: 20px 0;
}

/* Сетка карточек */
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 20px;
}

/* Карточка */
.ideas-card {
  cursor: pointer;
  position: relative;
  transition: transform 0.18s;
}
.ideas-card:hover { transform: translateY(-3px); }

/* Мозаика: большая слева + 2 маленькие справа */
.ideas-card-mosaic {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  aspect-ratio: 25/36;
  gap: 3px;
  border-radius: 14px;
  overflow: hidden;
}
.ideas-card-mosaic--single {
  grid-template-columns: 1fr;
}
.ideas-mosaic-main {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s;
}
.ideas-mosaic-side {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}
.ideas-mosaic-side img {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  display: block;
  transition: transform 0.35s;
}
.ideas-card:hover .ideas-card-mosaic img { transform: scale(1.04); }

/* Градиентное затемнение + название на карточке */
.ideas-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 12px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  border-radius: 0 0 14px 14px;
  pointer-events: none;
}
.ideas-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ── Попап идеи ─────────────────────────────────────────────────────────── */

.ideas-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.ideas-popup {
  background: #0d0a18;
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: 20px;
  width: 750px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: auto;
  position: relative;
  padding: 24px;
}

.ideas-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.2s;
}
.ideas-popup-close:hover { background: rgba(255,255,255,0.15); }

.ideas-popup-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #f0e8ff;
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  padding-right: 40px;
}

.ideas-popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.ideas-popup-cover {
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 3/4;
}
.ideas-popup-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ideas-popup-upload-zone {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  aspect-ratio: 3/4;
  position: relative;
  overflow: hidden;
}
.ideas-popup-upload-zone:hover,
.ideas-popup-upload-zone.drag-active {
  border-color: rgba(168,85,247,0.5);
  background: rgba(168,85,247,0.04);
}
.ideas-popup-upload-zone.filled {
  border-style: solid;
  border-color: rgba(34,197,94,0.5);
}
.ideas-popup-slot-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  border-radius: 12px;
}
.ideas-popup-slot-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}
.ideas-popup-slot-remove:hover {
  background: rgba(239,68,68,0.8);
}
.ideas-popup-upload-icon {
  font-size: 2rem;
  color: rgba(255,255,255,0.3);
  line-height: 1;
}
.ideas-popup-upload-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
}

.ideas-popup-hint {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.85);
  margin: 0 0 16px;
  line-height: 1.45;
}

.ideas-popup-upload-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ideas-popup-upload-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.18);
}

/* ── Готовые идеи: светлая тема ─────────────────────────────────────────── */
[data-theme="light"] .ideas-section-title { color: #1a1025; }
[data-theme="light"] .ideas-chip {
  border-color: rgba(124,58,237,0.18);
  color: #3d2a5c;
}
[data-theme="light"] .ideas-chip:hover {
  border-color: rgba(124,58,237,0.35);
  color: #1a1025;
}
[data-theme="light"] .ideas-chip.active {
  background: #1a1025;
  color: #fff;
  border-color: #1a1025;
}
[data-theme="light"] .ideas-card-title { color: #fff; }
[data-theme="light"] .ideas-screen-sub,
[data-theme="light"] .ideas-empty { color: #6b5a85; }
[data-theme="light"] .ideas-card {
  border-color: rgba(124,58,237,0.1);
}
[data-theme="light"] .ideas-card:hover {
  border-color: rgba(124,58,237,0.3);
}
[data-theme="light"] .ideas-popup {
  background: #fff;
  border-color: rgba(124,58,237,0.15);
}
[data-theme="light"] .ideas-popup-close {
  background: rgba(0,0,0,0.06);
  color: #3d2a5c;
}
[data-theme="light"] .ideas-popup-close:hover { background: rgba(0,0,0,0.12); }
[data-theme="light"] .ideas-popup-title { color: #1a1025; }
[data-theme="light"] .ideas-popup-hint { color: #6b5a85; }
[data-theme="light"] .ideas-popup-upload-zone {
  border-color: rgba(0,0,0,0.15);
}
[data-theme="light"] .ideas-popup-upload-zone:hover {
  border-color: rgba(124,58,237,0.4);
  background: rgba(124,58,237,0.03);
}
[data-theme="light"] .ideas-popup-upload-icon { color: rgba(0,0,0,0.25); }
[data-theme="light"] .ideas-popup-upload-text { color: rgba(0,0,0,0.4); }
[data-theme="light"] .ideas-popup-upload-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.12);
  color: #1a1025;
}
[data-theme="light"] .ideas-popup-upload-btn:hover {
  background: rgba(0,0,0,0.07);
}
[data-theme="light"] .ideas-popup-upload-zone.filled {
  border-color: rgba(34,197,94,0.5);
}
[data-theme="light"] .ideas-popup-slot-remove {
  background: rgba(0,0,0,0.5);
}
[data-theme="light"] .ideas-see-all {
  border-color: rgba(124,58,237,0.2);
  color: #3d2a5c;
}
[data-theme="light"] .ideas-see-all:hover { border-color: rgba(124,58,237,0.4); color: #1a1025; }

/* ── Готовые идеи: мобильная версия ─────────────────────────────────────── */
@media (max-width: 1199px) {
  .ideas-screen {
    padding: 16px;
  }

  /* Чипы: горизонтальный скролл */
  .ideas-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px 20px;
    padding: 0 16px;
    gap: 6px;
  }
  .ideas-chips::-webkit-scrollbar { display: none; }
  .ideas-chip {
    padding: 6px 14px;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  /* Секция */
  .ideas-section { margin-bottom: 28px; }
  .ideas-section-head { margin-bottom: 12px; }
  .ideas-section-title { font-size: 1.1rem; }

  /* Карточки: горизонтальный скролл */
  .ideas-grid {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 12px;
    margin: 0 -16px;
    padding: 0 16px;
  }
  .ideas-grid::-webkit-scrollbar { display: none; }

  .ideas-card {
    flex-shrink: 0;
    width: 160px;
  }

  .ideas-card-mosaic {
    aspect-ratio: 3/4;
    border-radius: 12px;
  }

  .ideas-card-overlay {
    padding: 20px 8px 8px;
    border-radius: 0 0 12px 12px;
  }
  .ideas-card-title {
    font-size: 0.76rem;
  }

  /* Попап: полноэкранный на мобиле */
  .ideas-popup-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .ideas-popup {
    width: 100%;
    max-height: 85vh;
    border-radius: 20px;
    padding: 20px;
  }
  .ideas-popup-grid {
    gap: 8px;
  }
  .ideas-popup-close {
    top: 12px;
    right: 12px;
  }
}


/* ══════════════════════════════════════════════════════════════════════════════
   ADMIN PANEL
   ══════════════════════════════════════════════════════════════════════════════ */

.admin-screen {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-tab {
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(15, 12, 28, 0.6);
  color: #c4b8dc;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin-tab:hover {
  border-color: rgba(167, 85, 247, 0.45);
  color: #eee6ff;
}
.admin-tab--active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.45), rgba(168, 85, 247, 0.35));
  border-color: rgba(168, 85, 247, 0.55);
  color: #fff;
}
.admin-panel-shorts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.admin-shorts-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.admin-shorts-top textarea.admin-input {
  flex: 1 1 280px;
  min-height: 72px;
  resize: vertical;
}
.admin-shorts-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-shorts-actions .admin-add-btn {
  margin: 0;
}
.admin-shorts-actions .admin-add-btn--secondary {
  background: rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.4);
}
.admin-shorts-limits {
  font-size: 0.8rem;
  color: #9088a8;
  line-height: 1.5;
}
.admin-shorts-status {
  font-size: 1rem;
  font-weight: 600;
  color: #e8def8;
  margin: 8px 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.25);
  min-height: 1.4em;
}
.admin-shorts-refs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-shorts-refs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}
.admin-shorts-ref-label {
  font-size: 0.75rem;
  color: #a898c8;
  width: 100%;
}
.admin-shorts-ref-thumb {
  width: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1528;
  aspect-ratio: 9/16;
}
.admin-shorts-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-shorts-details summary {
  cursor: pointer;
  color: #b8a8d8;
  font-size: 0.85rem;
  margin: 8px 0;
}
.admin-shorts-state {
  font-size: 0.85rem;
  color: #b8aed4;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  padding: 14px 16px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
}
.admin-shorts-kf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.admin-shorts-kf-item {
  border-radius: 10px;
  overflow: hidden;
  background: #1a1528;
  aspect-ratio: 9/16;
}
.admin-shorts-kf-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-shorts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.admin-shorts-label {
  font-size: 0.82rem;
  color: #b8a8d8;
  white-space: nowrap;
}
.admin-shorts-select {
  background: #1e1630;
  color: #e8def8;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}
.admin-add-btn--warn {
  background: rgba(220, 100, 20, 0.18);
  border: 1px solid rgba(251, 146, 60, 0.5);
  color: #fb923c;
}
.admin-add-btn--warn:hover { background: rgba(220, 100, 20, 0.3); }
.admin-shorts-videos {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-shorts-seg-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(168,85,247,0.15);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-shorts-seg-num {
  font-size: 0.88rem;
  font-weight: 700;
  color: #c4b5fd;
}
.admin-shorts-seg-dlg {
  font-size: 0.82rem;
  color: #a3e635;
  line-height: 1.45;
  background: rgba(163, 230, 53, 0.06);
  border-radius: 6px;
  padding: 4px 8px;
}
.admin-shorts-seg-mp {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
  border-left: 2px solid rgba(168,85,247,0.3);
  padding-left: 8px;
}
.admin-shorts-seg-card video {
  width: 100%;
  max-width: 240px;
  border-radius: 10px;
  background: #000;
  margin-top: 4px;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.admin-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #f0e8ff;
  margin: 0;
}
.admin-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.admin-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
}

/* Grid */
.admin-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-loading, .admin-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
  font-size: 0.95rem;
}

/* Card row */
.admin-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 16px;
  transition: background 0.15s;
}
.admin-card:hover {
  background: rgba(255,255,255,0.08);
}
.admin-card-img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.admin-card-body {
  flex: 1;
  min-width: 0;
}
.admin-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f0e8ff;
  margin-bottom: 2px;
}
.admin-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.admin-card-prompt {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.admin-btn-edit, .admin-btn-delete {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: #ccc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.admin-btn-edit:hover { background: rgba(124,58,237,0.2); color: #a855f7; }
.admin-btn-delete:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Overlay / popup */
.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.admin-overlay.open { opacity: 1; }

.admin-form-popup {
  background: #1a1025;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.admin-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-form-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #f0e8ff;
  margin: 0;
}
.admin-form-close {
  border: none;
  background: none;
  color: #999;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.admin-form-close:hover { color: #fff; }

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.admin-form-row label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-form-row-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.admin-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: #f0e8ff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.admin-input:focus {
  border-color: rgba(124,58,237,0.5);
}
.admin-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}
select.admin-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}
select.admin-input option {
  background: #1a1025;
  color: #f0e8ff;
}

/* Photo upload area */
.admin-photo-upload {
  width: 100%;
  min-height: 160px;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s;
  position: relative;
}
.admin-photo-upload:hover, .admin-photo-upload.dragover {
  border-color: rgba(124,58,237,0.5);
}
.admin-photo-placeholder {
  color: rgba(255,255,255,0.35);
  font-size: 0.88rem;
  text-align: center;
  padding: 20px;
}
.admin-photo-preview {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
}

.admin-submit-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.admin-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
}
.admin-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Admin: light theme ─────────────────────────────────────────────── */
[data-theme="light"] .admin-title { color: #1a1025; }
[data-theme="light"] .admin-card {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .admin-card:hover { background: rgba(0,0,0,0.06); }
[data-theme="light"] .admin-card-title { color: #1a1025; }
[data-theme="light"] .admin-card-prompt { color: rgba(0,0,0,0.45); }
[data-theme="light"] .admin-btn-edit,
[data-theme="light"] .admin-btn-delete {
  border-color: rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.03);
  color: #666;
}
[data-theme="light"] .admin-form-popup {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .admin-form-header h2 { color: #1a1025; }
[data-theme="light"] .admin-input {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.12);
  color: #1a1025;
}
[data-theme="light"] .admin-photo-upload {
  border-color: rgba(0,0,0,0.15);
}
[data-theme="light"] .admin-photo-placeholder {
  color: rgba(0,0,0,0.4);
}
[data-theme="light"] select.admin-input option {
  background: #fff;
  color: #1a1025;
}
