    .gen-screen .back-row { margin-bottom: 16px; }
    .gen-top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0 4px; position: relative; }
    .gen-top-left { display: flex; align-items: center; }
    .gen-top-balance-wrap { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; pointer-events: none; }
    .gen-top-balance-label { font-size: 0.9rem; color: var(--text-muted); }
    .gen-top-balance { font-size: 0.95rem; font-weight: 600; color: var(--text-highlight); font-variant-numeric: tabular-nums; }
    .gen-trash-btn {
      width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid rgba(168,85,247,0.12);
      background: rgba(168,85,247,0.05); color: var(--text); font-size: 1.2rem;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
    }
    .gen-trash-btn:hover { color: var(--text); background: rgba(168,85,247,0.1); }

    .gen-header-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 14px;
      box-shadow: 0 12px 30px rgba(0,0,0,0.4);
      margin-bottom: 8px;
    }
    .gen-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
    .gen-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
    .gen-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
    .gen-subtitle { font-size: 0.8rem; color: var(--tg-theme-hint); line-height: 1.35; }
    .gen-balance-chip {
      display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
      border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap;
      background: rgba(168,85,247,0.08); color: var(--green);
    }

    .gen-history-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
    .gen-history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
    .gen-history-title { font-weight: 700; font-size: 0.9rem; }
    .gen-history-hint { font-size: 0.72rem; color: var(--tg-theme-hint); }

    .gen-panel {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 18px 18px 14px 14px;
      padding: 10px 12px;
      box-shadow: 0 -10px 22px rgba(0,0,0,0.3);
    }
    .gen-panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
    .gen-panel-title { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--tg-theme-hint); }
    /* Gen params sidebar / bottom bar — общие стили (мобильные + декстоп) */
    .gen-params-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); gap: 8px; flex-shrink: 0; }
    .gen-params-body { padding: 4px 12px 10px; display: flex; flex-direction: column; }
    .gen-param-row { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border); }
    .gen-param-row:last-child { border-bottom: none; }
    .gen-param-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
    .gen-param-trigger { width: 100%; text-align: left; justify-content: space-between; display: flex; align-items: center; }
    .gen-panel-footer { display: grid; gap: 0; }
    .gen-panel-footer #gen-msg.msg:empty { display: none; }
    .gen-panel-footer .chat-submit { margin-top: 6px; }
    .back-btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 10px 16px; border-radius: var(--radius-sm);
      background: rgba(168,85,247,0.05); border: 1px solid rgba(168,85,247,0.12);
      color: var(--tg-theme-text); font-family: inherit; font-size: 0.9rem; font-weight: 600;
      cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s;
    }
    .back-btn:hover { background: rgba(168,85,247,0.08); border-color: rgba(168,85,247,0.2); color: var(--tg-theme-text); }
    .back-btn:active { background: rgba(168,85,247,0.12); }
    .back-btn .back-arrow { opacity: 0.9; font-size: 1em; }
    .gen-screen .model-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px;
    }
    .gen-screen .model-btn {
      padding: 12px; border-radius: var(--radius-sm); border: 1px solid rgba(168,85,247,0.12);
      background: rgba(168,85,247,0.04); color: var(--tg-theme-text); font-family: inherit;
      font-size: 0.85rem; font-weight: 600; cursor: pointer; text-align: left;
    }
    .gen-screen .model-btn.active { border-color: rgba(168,85,247,0.28); background: rgba(168,85,247,0.1); }
    .gen-screen .field-label { font-size: 0.75rem; color: var(--tg-theme-hint); margin-bottom: 6px; display: block; }
    .gen-screen textarea {
      width: 100%; min-height: 80px; padding: 12px; border-radius: var(--radius-sm);
      border: 1px solid var(--border); background: rgba(168,85,247,0.04); color: var(--text);
      font-family: inherit; font-size: 0.95rem; resize: vertical; box-sizing: border-box;
    }
    .gen-screen .file-wrap { margin: 12px 0; }
    .gen-screen .file-wrap input[type=file] { font-size: 0.85rem; color: var(--tg-theme-hint); }
    .gen-screen .opt-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
    .gen-screen select {
      padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
      background: rgba(255,255,255,0.04); color: var(--tg-theme-text); font-family: inherit;
    }
    .gen-screen .submit-btn {
      width: 100%; margin-top: 20px; padding: 16px; border: none; border-radius: var(--radius-sm);
      background: var(--accent); color: #fff; font-weight: 600; font-family: inherit; font-size: 1rem;
      cursor: pointer;
    }
    .gen-screen .submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
    .gen-result img { width: 100%; border-radius: var(--radius-sm); display: block; margin: 12px 0; }
    .gen-result .result-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
    .gen-result .result-actions a { color: var(--accent); }
    .gen-result video { width: 100%; border-radius: var(--radius-sm); margin: 12px 0; background: #000; }
    .video-screen .model-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
    .video-screen .model-btn { flex: 1; min-width: 120px; }
    .video-screen .aspect-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
    .video-screen .aspect-btn {
      flex: 1; min-width: 120px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid rgba(168,85,247,0.12);
      background: rgba(168,85,247,0.05); color: var(--tg-theme-text); font-family: inherit; font-size: 0.9rem;
      cursor: pointer; text-align: center; transition: background 0.2s, border-color 0.2s;
    }
    .video-screen .aspect-btn.active { border-color: rgba(168,85,247,0.28); background: rgba(168,85,247,0.1); color: var(--tg-theme-text); }
    .video-kling-sound-wrap { align-items: center; gap: 8px; }
    .video-kling-sound-label { font-size: 0.82rem; color: var(--tg-theme-hint); }
    .video-sound-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
    .video-sound-switch input { opacity: 0; width: 0; height: 0; }
    .video-sound-slider {
      position: absolute; inset: 0; border-radius: 24px; background: rgba(168,85,247,0.15);
      border: 1px solid rgba(168,85,247,0.25); transition: background 0.2s, border-color 0.2s;
    }
    .video-sound-slider::before {
      content: ''; position: absolute; width: 18px; height: 18px; left: 2px; bottom: 2px;
      border-radius: 50%; background: var(--tg-theme-hint); transition: transform 0.2s, background 0.2s;
    }
    .video-sound-switch input:checked + .video-sound-slider {
      background: rgba(168,85,247,0.25); border-color: rgba(168,85,247,0.45);
    }
    .video-sound-switch input:checked + .video-sound-slider::before {
      transform: translateX(20px); background: var(--accent);
    }
    .video-kling-quality-row { margin-top: 10px; }
    .video-kling-quality-wrap { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .video-kling-quality-label { font-size: 0.82rem; color: var(--tg-theme-hint); }
    .video-kling-quality-switch {
      display: inline-flex; border-radius: 24px; padding: 2px; background: rgba(168,85,247,0.15);
      border: 1px solid rgba(168,85,247,0.25);
    }
    .video-kling-quality-btn {
      padding: 4px 12px; border: none; border-radius: 20px; font-size: 0.8rem; font-family: inherit;
      cursor: pointer; color: var(--tg-theme-hint); background: transparent; transition: background 0.2s, color 0.2s;
    }
    .video-kling-quality-btn:hover { color: var(--tg-theme-text); }
    .video-kling-quality-btn.active {
      background: var(--accent); color: var(--tg-theme-button-text); font-weight: 600;
    }
    .video-kling-frames-wrap { margin-bottom: 10px; }
    .video-kling-duration-row {
      display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap;
    }
    .video-kling-duration-label { font-size: 0.85rem; color: var(--tg-theme-text); min-width: 110px; }
    .video-kling-duration-slider {
      flex: 1; min-width: 120px; height: 6px; -webkit-appearance: none; appearance: none;
      background: rgba(168,85,247,0.15); border-radius: 3px; outline: none;
    }
    .video-kling-duration-slider::-webkit-slider-thumb {
      -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
      background: var(--accent); cursor: pointer; box-shadow: 0 0 0 2px rgba(168,85,247,0.3);
      transition: transform 0.15s, box-shadow 0.15s;
    }
    .video-kling-duration-slider::-webkit-slider-thumb:hover {
      transform: scale(1.08); box-shadow: 0 0 0 3px rgba(168,85,247,0.4);
    }
    .video-kling-duration-slider::-moz-range-thumb {
      width: 18px; height: 18px; border-radius: 50%; border: none;
      background: var(--accent); cursor: pointer; box-shadow: 0 0 0 2px rgba(168,85,247,0.3);
    }
    .video-kling-duration-slider::-moz-range-track { background: rgba(168,85,247,0.15); border-radius: 3px; height: 6px; }
    .video-kling-frames-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
    .video-kling-frame-slot {
      position: relative; width: 88px; height: 52px; border-radius: 10px; overflow: hidden;
      flex-shrink: 0; border: 1px dashed rgba(168,85,247,0.35);
      background: rgba(168,85,247,0.04); display: flex; align-items: center; justify-content: center;
      cursor: pointer; color: var(--tg-theme-hint); text-align: center; padding: 6px;
    }
    .video-kling-frame-slot:hover { border-color: rgba(168,85,247,0.5); color: var(--tg-theme-text); background: rgba(168,85,247,0.08); }
    .video-kling-frame-label { font-size: 0.7rem; font-weight: 500; line-height: 1.25; }
    .video-kling-frame-slot.has-photo { padding: 0; }
    .video-kling-frame-slot.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .video-kling-frame-slot .video-kling-frame-remove {
      position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
      background: rgba(0,0,0,0.7); color: #fff; border: none; cursor: pointer; font-size: 12px;
      line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center;
    }
    .video-kling-frame-slot .video-kling-frame-remove:hover { background: #c44; }
    .video-kling-frame-arrow { color: var(--tg-theme-hint); font-size: 1.25rem; flex-shrink: 0; user-select: none; }
    .video-script-btn-wrap { margin-bottom: 8px; width: 100%; }
    .video-script-btn { border-style: dashed; width: 100%; box-sizing: border-box; text-align: center; }
    .video-shots-wrap { margin-bottom: 10px; }
    .video-shots-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
    .video-shots-title { font-size: 0.9rem; font-weight: 600; color: var(--tg-theme-text); }
    .video-shots-total { font-size: 0.8rem; color: var(--tg-theme-hint); }
    .video-shot-card {
      border: 1px solid rgba(168,85,247,0.2); border-radius: var(--radius-sm);
      background: rgba(168,85,247,0.04); padding: 10px 12px; margin-bottom: 10px;
    }
    .video-shot-card-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: var(--tg-theme-text); }
    .video-shot-prompt-wrap { margin-bottom: 8px; }
    .video-shot-prompt-wrap label { font-size: 0.75rem; color: var(--tg-theme-hint); display: block; margin-bottom: 4px; }
    .video-shot-prompt-wrap textarea { width: 100%; min-height: 60px; padding: 8px; border-radius: 8px; border: 1px solid rgba(168,85,247,0.2); background: rgba(168,85,247,0.04); color: var(--tg-theme-text); font-size: 0.85rem; resize: vertical; box-sizing: border-box; }
    .video-shot-prompt-count { font-size: 0.7rem; color: var(--tg-theme-hint); margin-top: 2px; }
    .video-shot-duration-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
    .video-shot-duration-wrap label { font-size: 0.75rem; color: var(--tg-theme-hint); }
    .video-shot-duration-slider { flex: 1; min-width: 80px; height: 6px; -webkit-appearance: none; background: rgba(168,85,247,0.15); border-radius: 3px; }
    .video-shot-duration-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }
    .video-shot-duration-num { width: 36px; padding: 4px 6px; border-radius: 6px; border: 1px solid rgba(168,85,247,0.2); background: rgba(168,85,247,0.04); color: var(--tg-theme-text); font-size: 0.85rem; text-align: center; }
    .video-shot-describe-btn {
      width: 100%; padding: 12px 14px; margin-bottom: 8px; border: 1px dashed rgba(168,85,247,0.35); border-radius: var(--radius-sm);
      background: transparent; color: var(--tg-theme-hint); font-size: 0.9rem; cursor: pointer; text-align: center; box-sizing: border-box;
    }
    .video-shot-describe-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(168,85,247,0.06); }
    .video-shot-elements-btn { font-size: 0.8rem; padding: 6px 10px; border: 1px dashed rgba(168,85,247,0.35); border-radius: 8px; background: transparent; color: var(--tg-theme-hint); cursor: pointer; }
    .video-shot-elements-btn:hover { color: var(--accent); border-color: var(--accent); }
    .video-shot-remove { float: right; background: none; border: none; color: var(--tg-theme-hint); cursor: pointer; font-size: 1rem; padding: 0 4px; }
    .video-view-scenes-btn {
      width: 100%; margin-bottom: 8px; box-sizing: border-box;
      display: flex; align-items: center; justify-content: center; text-align: center;
      padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(168,85,247,0.26);
      background: var(--accent);
      color: var(--tg-theme-button-text); font-weight: 800; font-family: inherit; font-size: 0.95rem;
      cursor: pointer;
      box-shadow: 0 6px 18px rgba(168,85,247,0.3);
      border: none;
    }
    .video-view-scenes-btn:hover {
      opacity: 0.9;
      box-shadow: 0 10px 24px rgba(168,85,247,0.4);
    }
    .video-scenes-summary-overlay { align-items: stretch; padding: 0; }
    .video-scenes-summary-overlay .video-scenes-summary-popup {
      width: 100%; max-width: 420px; height: 100vh; max-height: 100vh; display: flex; flex-direction: column;
      background: var(--bg-card); border-radius: 0; border: none; box-shadow: none;
    }
    .video-scenes-summary-overlay .video-scenes-summary-title { font-size: 1rem; font-weight: 700; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
    .video-scenes-summary-overlay .video-scenes-summary-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; -webkit-overflow-scrolling: touch; }
    .video-scenes-summary-overlay .video-scenes-summary-item { margin-bottom: 14px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid rgba(168,85,247,0.2); background: rgba(168,85,247,0.04); }
    .video-scenes-summary-overlay .video-scenes-summary-item-title { font-size: 0.8rem; font-weight: 600; color: var(--tg-theme-hint); margin-bottom: 6px; }
    .video-scenes-summary-overlay .video-scenes-summary-item-prompt { font-size: 0.9rem; color: var(--tg-theme-text); line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
    .video-scenes-summary-overlay .video-scenes-summary-item-dur { font-size: 0.8rem; color: var(--tg-theme-hint); margin-top: 6px; }
    .video-scenes-summary-overlay .video-scenes-summary-actions { flex-shrink: 0; display: flex; gap: 10px; padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg-card); }
    .video-scenes-summary-overlay .video-scenes-summary-actions .back-btn { flex: 1; justify-content: center; text-align: center; }
    .video-scenes-summary-overlay .video-scenes-summary-actions .chat-submit.video-scenes-summary-submit-btn {
      flex: 1; font-size: 0.88rem; padding: 10px 14px;
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    }
    .video-scenes-summary-overlay .video-scenes-summary-actions .chat-submit.video-scenes-summary-submit-btn .video-scenes-summary-submit-label { line-height: 1.2; }
    .video-scenes-summary-overlay .video-scenes-summary-actions .chat-submit.video-scenes-summary-submit-btn .price { font-size: 0.78rem; opacity: 0.9; }
    .video-shot-prompt-popup { z-index: 110; }
    .video-shot-prompt-popup .gen-popup { max-width: 420px; width: 100%; max-height: 85vh; display: flex; flex-direction: column; }
    .gen-overlay.video-element-overlay { z-index: 150; }
    .video-shot-prompt-popup .video-shot-prompt-popup-textarea { width: 100%; min-height: 180px; padding: 12px; border-radius: 8px; border: 1px solid rgba(168,85,247,0.2); background: rgba(168,85,247,0.04); color: var(--tg-theme-text); font-size: 0.9rem; resize: vertical; box-sizing: border-box; margin-bottom: 10px; }
    .video-shot-prompt-popup .video-shot-prompt-popup-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
    .video-add-shot-btn {
      width: 100%; padding: 12px; border: 1px dashed rgba(168,85,247,0.35); border-radius: var(--radius-sm);
      background: transparent; color: var(--tg-theme-hint); font-size: 0.9rem; cursor: pointer;
    }
    .video-add-shot-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(168,85,247,0.06); }
    .video-element-popup { max-width: 340px; }
    .video-element-field { display: block; margin-bottom: 10px; font-size: 0.8rem; color: var(--tg-theme-hint); }
    .video-element-field input[type=text] { width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(168,85,247,0.2); background: rgba(168,85,247,0.04); color: var(--tg-theme-text); font-size: 0.9rem; box-sizing: border-box; transition: border-color 0.2s; }
    .video-element-field.has-error input[type=text] { border-color: #c44; box-shadow: 0 0 0 1px #c44; }
    .video-element-err { display: none; margin-top: 6px; font-size: 0.8rem; color: #c44; }
    .video-element-images-row { margin: 12px 0; }
    .video-element-images-row.has-error .video-element-images-label { color: #c44; }
    .video-element-images-label { font-size: 0.8rem; color: var(--tg-theme-hint); display: block; margin-bottom: 6px; }
    .video-element-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; min-height: 24px; }
    .video-element-thumb { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(168,85,247,0.2); }
    .video-element-thumb img { width: 100%; height: 100%; object-fit: cover; }
    .video-element-thumb-remove { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff; border: none; cursor: pointer; font-size: 12px; }
    .video-element-upload-btn {
      width: 100%; padding: 12px 16px; border: 1px dashed rgba(168,85,247,0.4); border-radius: var(--radius-sm);
      background: rgba(168,85,247,0.06); color: var(--accent); font-size: 0.9rem; font-weight: 600; cursor: pointer;
      display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
      transition: background 0.2s, border-color 0.2s, color 0.2s;
    }
    .video-element-upload-btn:hover { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.5); color: var(--tg-theme-text); }
    .video-element-create-btn {
      width: 100%; padding: 14px 18px; margin-top: 12px; border: 1px dashed rgba(168,85,247,0.45); border-radius: var(--radius-sm);
      background: rgba(168,85,247,0.08); color: var(--accent); font-size: 0.95rem; font-weight: 600; cursor: pointer;
      display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
      transition: background 0.2s, border-color 0.2s, color 0.2s; font-family: inherit;
    }
    .video-element-create-btn:hover { background: rgba(168,85,247,0.14); border-color: rgba(168,85,247,0.55); color: var(--tg-theme-text); }
    .video-element-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
    .video-element-popup .video-element-actions .submit-btn,
    .video-shot-prompt-popup .video-shot-prompt-popup-actions .submit-btn {
      padding: 12px 24px; border: none; border-radius: var(--radius-sm);
      background: var(--accent); color: var(--tg-theme-button-text); font-weight: 600; font-size: 0.95rem; font-family: inherit;
      cursor: pointer; transition: opacity 0.2s, background 0.2s;
    }
    .video-element-popup .video-element-actions .submit-btn:hover,
    .video-shot-prompt-popup .video-shot-prompt-popup-actions .submit-btn:hover { opacity: 0.95; background: rgb(178, 235, 88); }
    .video-element-popup .video-element-actions .back-btn,
    .video-shot-prompt-popup .video-shot-prompt-popup-actions .back-btn {
      padding: 12px 20px; font-size: 0.95rem;
    }
    .file-upload {
      display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px;
      padding: 14px; border-radius: var(--radius-sm); border: 1px dashed rgba(168,85,247,0.18);
      background: rgba(168,85,247,0.04);
    }
    .file-upload input[type=file] { position: absolute; width: 0.1px; height: 0.1px; opacity: 0; overflow: hidden; z-index: -1; }
    .file-upload .file-trigger {
      padding: 12px 20px; border-radius: var(--radius-sm); border: 1px solid rgba(168,85,247,0.2);
      background: rgba(168,85,247,0.1); color: var(--tg-theme-text); font-weight: 700; font-family: inherit;
      cursor: pointer; font-size: 0.9rem; white-space: nowrap;
    }
    .file-upload .file-trigger:active { opacity: 0.9; }
    .file-upload .file-status { font-size: 0.85rem; color: var(--tg-theme-hint); }
    .file-upload .file-status.has-files { color: var(--green); }
    .gen-page { display: flex; flex-direction: column; height: calc(100vh - 20px); max-height: 720px; gap: 0; position: relative; }

    .gen-balance-corner {
      flex-shrink: 0;
      align-self: flex-end;
      margin: calc(env(safe-area-inset-top, 0px) + 6px) 12px 4px;
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--text-highlight);
      background: rgba(168,85,247,0.08);
      border: 1px solid rgba(168,85,247,0.18);
      border-radius: 20px;
      padding: 4px 10px;
      pointer-events: none;
      font-variant-numeric: tabular-nums;
    }
    .gen-page .gen-chat { margin-top: auto; flex-shrink: 0; }
    body.screen-gen { padding-bottom: 0; height: var(--app-height, 100vh); overflow: hidden; }
    body.screen-gen .wrap { height: 100%; display: flex; flex-direction: column; padding-bottom: 0; }
    body.screen-gen #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
    body.screen-gen .gen-page { flex: 1; min-height: 0; height: auto; max-height: none; }
    body.screen-gen .footer-note { display: none; }
    body.screen-video { padding-bottom: 0; height: var(--app-height, 100vh); overflow: hidden; }
    body.screen-video .wrap { height: 100%; display: flex; flex-direction: column; padding-bottom: 0; }
    body.screen-video #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
    body.screen-video .footer-note { display: none; }
    body.screen-video .gen-page { flex: 1; min-height: 0; height: auto; max-height: none; display: flex; flex-direction: column; }
    body.screen-video:not(.web-mode) .gen-page .gen-history-wrap { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
    body.screen-video:not(.web-mode) .gen-page .gen-history-wrap .gen-history { flex: 1; min-height: 0; }
    body.screen-motion { padding-bottom: 0; height: var(--app-height, 100vh); overflow: hidden; }
    body.screen-motion .wrap { height: 100%; display: flex; flex-direction: column; padding-bottom: 0; }
    body.screen-motion #app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
    body.screen-motion .footer-note { display: none; }
    body.screen-motion .gen-page { flex: 1; min-height: 0; height: auto; max-height: none; display: flex; flex-direction: column; }
    body.screen-motion .gen-main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    body.screen-motion .gen-main::-webkit-scrollbar { display: none; }
    body.screen-motion .gen-page .gen-history-wrap { flex: none; overflow: visible; display: block; }
    body.screen-video .gen-page .gen-chat { flex: 0 0 auto; margin-top: auto; min-height: 0; max-height: 72vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    body.screen-gen .gen-main, body.screen-video .gen-main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    body.screen-gen .gen-main .gen-history-wrap, body.screen-video .gen-main .gen-history-wrap { flex: none; overflow: visible; display: block; }
    body.screen-gen .gen-params-sidebar, body.screen-video .gen-params-sidebar { flex-shrink: 0; }
    body.screen-gen .gen-bottom-bar, body.screen-video .gen-bottom-bar { flex-shrink: 0; }
    /* Дропдауны параметров не обрезать overflow от gen-chat */
    body.screen-gen .gen-page .gen-params-sidebar,
    body.screen-video .gen-page .gen-params-sidebar { overflow: visible; max-height: none; }
    /* Mobile only: params — model + aspect triggers in one row */
    body.screen-gen:not(.web-mode) .gen-params-body,
    body.screen-video:not(.web-mode) .gen-params-body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; }
    body.screen-gen:not(.web-mode) .gen-params-body .gen-param-row,
    body.screen-video:not(.web-mode) .gen-params-body .gen-param-row { flex: 0 0 auto; padding: 0; border-bottom: none; }
    body.screen-gen:not(.web-mode) .gen-params-body .gen-param-label,
    body.screen-video:not(.web-mode) .gen-params-body .gen-param-label { display: none; }
    body.screen-gen:not(.web-mode) .gen-params-body .gen-param-trigger,
    body.screen-video:not(.web-mode) .gen-params-body .gen-param-trigger { width: auto; }
    /* Mobile: photo thumbs hidden when empty */
    body.screen-gen .gen-photo-thumbs:empty,
    body.screen-video .gen-photo-thumbs:empty { display: none; min-height: 0; }
    /* Mobile: bottom bar — photo left, textarea full-width, submit full-width */
    body.screen-gen:not(.web-mode) .gen-bottom-bar,
    body.screen-video:not(.web-mode) .gen-bottom-bar { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
    body.screen-gen:not(.web-mode) .gen-bottom-row,
    body.screen-video:not(.web-mode) .gen-bottom-row { display: flex; flex-direction: column; gap: 6px; }
    body.screen-gen:not(.web-mode) .gen-bottom-bar .prompt-wrap,
    body.screen-video:not(.web-mode) .gen-bottom-bar .prompt-wrap { width: 100%; }
    body.screen-gen:not(.web-mode) .gen-bottom-actions .chat-submit,
    body.screen-video:not(.web-mode) .gen-bottom-actions .chat-submit { width: 100%; }

    /* ── Уведомление «хранятся 7 дней» над историей генераций/карточек ── */
    .gen-shelf-notice {
      display: flex;
      align-items: center;
      gap: 6px;
      margin: 0 0 10px;
      padding: 8px 12px;
      border-radius: 10px;
      background: rgba(234, 179, 8, 0.08);
      border: 1px solid rgba(234, 179, 8, 0.22);
      font-size: 0.78rem;
      font-weight: 500;
      color: rgba(234, 179, 8, 0.9);
      line-height: 1.4;
    }
    .gen-shelf-notice b { font-weight: 800; }
    .pc-shelf-notice { margin: 0 0 12px; }

    /* ── Уведомление о сроке хранения фото (над полем промпта) ─── */
    body.screen-gen .gen-storage-notice {
      margin: 0 0 8px;
      padding: 0 4px;
      font-size: 0.72rem;
      line-height: 1.45;
      font-weight: 500;
      color: var(--tg-theme-hint, rgba(255, 255, 255, 0.55));
      text-align: center;
    }
    body.screen-gen .gen-storage-notice-days {
      font-weight: 800;
      color: var(--accent, #c084fc);
      letter-spacing: 0.02em;
    }

    /* ── Компактная строка параметров (чипы) ─────────────────── */

    .gen-params-bar {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 10px 12px 6px;
      flex-shrink: 0;
      /* Единый блок с bottom-bar — верхняя граница и радиус только здесь */
      border-top: 1px solid var(--border);
      border-radius: 16px 16px 0 0;
      background: var(--bg-card);
    }

    .gen-params-row {
      display: flex;
      align-items: center;
      gap: 6px;
      overflow: visible;
      flex-wrap: wrap;
    }

    .gen-chip-model-icon {
      width: 16px;
      height: 16px;
      border-radius: 4px;
      object-fit: cover;
      flex-shrink: 0;
      display: block;
    }

    .gen-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 6px 11px;
      border-radius: 20px;
      border: 1px solid rgba(168,85,247,0.18);
      background: rgba(168,85,247,0.05);
      color: var(--text);
      font-family: inherit;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: background 0.15s, border-color 0.15s;
      flex-shrink: 0;
      line-height: 1;
    }
    .gen-chip:active { background: rgba(168,85,247,0.12); }
    .gen-chip .arr { font-size: 0.6rem; opacity: 0.6; }

    .gen-chip-model {
      background: rgba(168,85,247,0.1);
      border-color: rgba(168,85,247,0.3);
      color: var(--accent);
      max-width: 160px;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .gen-chip-photo { border-style: dashed; }
    .gen-chip-photo.has {
      border-style: solid;
      border-color: rgba(168,85,247,0.3);
      background: rgba(168,85,247,0.1);
    }
    .gen-chip.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }
    .video-veo-type-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }

    /* ── Строка отправки (маска + кнопка генерации) ──────────── */

    .gen-submit-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
    }
    .gen-submit-row .msg { display: none; }
    .gen-submit-row .chat-submit { flex: 1; }

    .gen-mask-btn {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      border: 1px solid rgba(168,85,247,0.2);
      background: rgba(168,85,247,0.06);
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      transition: background 0.15s, border-color 0.15s, color 0.15s;
    }
    .gen-mask-btn:active { background: rgba(168,85,247,0.15); color: var(--accent); }
    .gen-mask-thumb {
      width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
      border: 1.5px solid rgba(168,85,247,0.4);
    }
    .gen-mask-thumb .gen-photo-remove { top: 2px; right: 2px; width: 18px; height: 18px; font-size: 11px; }

    /* gen-bottom-bar — продолжение единого блока (без верхней границы и радиуса) */
    .gen-bottom-bar.gen-chat {
      border-top: none;
      border-radius: 0;
    }
    body.screen-gen:not(.web-mode) .gen-submit-row,
    body.screen-video:not(.web-mode) .gen-submit-row { padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); }
    body.screen-gen:not(.web-mode) .gen-bottom-bar,
    body.screen-video:not(.web-mode) .gen-bottom-bar { padding: 6px 12px 0; }

    /* ── Mobile web browser: fixed bottom panel (как в product-card) ── */
    body.mobile-web-mode.screen-gen .gen-mobile-bottom,
    body.mobile-web-mode.screen-video .gen-mobile-bottom,
    body.mobile-web-mode.screen-motion .gen-mobile-bottom {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 50;
      background: var(--bg-card, #141414);
      border-top: 1px solid rgba(168,85,247,0.12);
      border-radius: 16px 16px 0 0;
      backdrop-filter: blur(12px);
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    body.mobile-web-mode.screen-gen .gen-main,
    body.mobile-web-mode.screen-video .gen-main,
    body.mobile-web-mode.screen-motion .gen-main {
      padding-bottom: 280px;
    }
