:root {
  --bg-main: #0f0e11; --bg-form: #17151b; --border-color: #444444; --border-radius: 8px;
  --btn-active: #008df1; --btn-active-hover: #0073c4; --btn-inactive: #444444;
  --btn-hover-bg: rgba(255, 255, 255, 0.05); --text-main: #ffffff; --text-muted: #888888;
  --transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
html, body { overflow-x: hidden; width: 100%; }
.widget-wrapper { width: 100%; margin: -65px auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text-main); background: var(--bg-main); padding: 0px; border-radius: 12px; }

.bar__item_mobile { display: none; }
@media (max-width: 1040px) {
  .bar__item_mobile { display: flex !important; margin-left: 15px; }
  .widget-wrapper { margin: -65px auto !important; }
  .techwave_fn_leftpanel { transition: transform 0.3s ease, left 0.3s ease !important; }
  .techwave_fn_leftpanel.is-active-mobile { left: 0 !important; transform: translateX(0) !important; z-index: 10000; }
}

.premium-widget { display: flex; flex-direction: column; gap: 24px; }
.input-container { position: relative; background-color: var(--bg-form); border: 1px solid var(--border-color); border-radius: var(--border-radius); transition: var(--transition); display: flex; flex-direction: column; }
.input-container:focus-within { border-color: var(--btn-active); box-shadow: 0 0 0 3px rgba(0, 141, 241, 0.15); }
.chat-textarea { width: 100%; field-sizing: content; min-height: 100px; max-height: 350px; background: transparent; border: none; color: var(--text-main); font-size: 15px; line-height: 1.5; padding: 16px 16px 50px 16px; resize: none; outline: none; box-sizing: border-box; }
.chat-textarea::placeholder { color: var(--text-muted); }

.btn { position: relative; width: 36px; height: 36px; border-radius: var(--border-radius); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); border: 1px solid transparent; background: transparent; color: var(--btn-inactive); }
.btn-active { background: var(--btn-active); color: #fff; pointer-events: auto; opacity: 1; }
.btn-active:hover { background: var(--btn-active-hover); pointer-events: auto; opacity: 1; }
.btn.btn-text { width: auto; padding: 0 20px; font-size: 13px; font-weight: 600; letter-spacing: 0.5px; }
.attach-btn, .submit-btn { position: absolute; bottom: 8px; width: 36px; height: 36px; border-radius: var(--border-radius); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); border: none; background: transparent; color: var(--text-muted); }
.attach-btn { left: 8px; } .attach-btn:hover { background: var(--btn-hover-bg); color: var(--text-main); }
.icon { color: var(--btn-active); width: 20px; height: 20px; transition: var(--transition); }
.submit-btn { right: 8px; background: var(--btn-inactive); color: #111; pointer-events: none; opacity: 0.5; }
.submit-btn-active { background: var(--btn-active); color: #fff; pointer-events: auto; opacity: 1; }

.controls-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.control-group { display: flex; flex-direction: column; gap: 12px; background: var(--bg-form); padding: 16px; border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.toggle-wrapper { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.custom-toggle { position: relative; width: 36px; height: 20px; }
.custom-toggle input { display: none; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--bg-main); border: 1px solid var(--border-color); transition: .3s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: var(--text-muted); transition: .3s; border-radius: 50%; }
.custom-toggle input:checked + .slider { background-color: var(--btn-active); border-color: var(--btn-active); }
.custom-toggle input:checked + .slider:before { transform: translateX(16px); background-color: white; }

.segmented-radio { display: flex; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: var(--border-radius); overflow: hidden; }
.segmented-radio input { display: none; }
.segmented-radio label { flex: 1; text-align: center; padding: 8px 0; font-size: 13px; cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.segmented-radio input:checked + label { background: var(--bg-form); color: var(--btn-active); font-weight: 500; box-shadow: 0 0 5px rgba(0,0,0,0.2); }

.select-wrapper { position: relative; }
.select-wrapper::after { content: "▼"; font-size: 10px; color: var(--text-muted); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.custom-select { width: 100%; appearance: none; background: var(--bg-main); border: 1px solid var(--border-color); color: var(--text-main); padding: 0px 30px 10px 12px; border-radius: var(--border-radius); font-size: 14px; outline: none; cursor: pointer; transition: var(--transition); }
.custom-select:focus { border-color: var(--btn-active); }

@media (min-width: 769px) { #toggle-settings-btn { display: none !important; } #ai-settings-panel { display: block !important; } #save-settings-wrapper { display: flex !important; } #clear-settings-btn { display: inline-block !important; } }
.app-container { transition: filter 0.3s ease; } .app-container.is-blurred { filter: blur(8px) brightness(0.6); pointer-events: none; }
.task-card { background: var(--bg-form); border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: var(--transition); min-width: 0; }
.task-header { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.task-meta-left, .task-meta-right { display: flex; align-items: center; }
.task-id { font-weight: 600; } .status-done { color: var(--text-success); }

/* ПУНКТ 1: СДЕЛАЛ РОВНО 3 СТРОКИ */
.prompt-text-wrapper { position: relative; font-size: 11px; line-height: 1.5; color: var(--text-main); max-height: 4.5em; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); word-break: break-word; }
.prompt-text-wrapper.no-thumbs { max-height: 4.5em; }
.prompt-text-wrapper.is-truncated { cursor: pointer; mask-image: linear-gradient(to bottom, rgba(0,0,0, 1) 40%, rgba(0,0,0, 0) 100%); -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0, 1) 40%, rgba(0,0,0, 0) 100%); }
.prompt-text-wrapper.is-expanded { max-height: 1000px; mask-image: none; -webkit-mask-image: none; }

.prompt-btn { background: transparent; border: none; padding: 3px; margin: 0; cursor: pointer; color: inherit; opacity: 0.6; transition: opacity 0.2s, transform 0.2s, background-color 0.2s; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; outline: none; }
.prompt-btn:hover { opacity: 1; transform: scale(1.15); background-color: rgba(255, 255, 255, 0.08); }
.prompt-btn svg { width: 13px; height: 13px; fill: currentColor; }
.task-card.is-processing-state .prompt-text-wrapper { color: var(--btn-active) !important; transition: color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }

.task-media { display: flex; gap: 12px; align-items: center; width: 100%; }
.main-thumb { width: 90px; height: 90px; border-radius: 8px; object-fit: cover; flex-shrink: 0; cursor: zoom-in; border: 1px solid var(--border-color); transition: transform 0.2s; margin: 0 !important; }
.main-thumb:hover { transform: scale(1.05); }
.ref-stack { display: flex; flex: 1; min-width: 0; min-height: 70px; }
.prompt-in-ref { border-left: 2px solid var(--border-color); padding-left: 12px; margin-left: 4px; min-height: 70px; flex: 1; transition: border-color 0.3s ease; }
.ref-stack.is-processing .prompt-in-ref { border-left-color: var(--btn-active); }
.ref-thumb { width: 70px; height: 70px; min-width: 15px; object-fit: cover; object-position: left; border-radius: 6px; cursor: zoom-in; border: 1px solid var(--border-color); border-right: 2px solid var(--bg-form); position: relative; filter: brightness(0.5) grayscale(30%); transition: all 0.3s ease; }
.ref-thumb:last-child { min-width: 70px; border-right: 1px solid var(--border-color); }
.ref-thumb:hover { filter: brightness(1.1) grayscale(0%); transform: scale(1.05); z-index: 10; }
.ref-stack.is-processing .ref-thumb { animation: ai-pulse-blue 1.5s infinite alternate; }

@keyframes ai-pulse-blue { 0% { filter: sepia(0.8) hue-rotate(180deg) saturate(2) brightness(0.4); border-color: rgba(0, 141, 241, 0.2); box-shadow: 0 0 2px rgba(0, 141, 241, 0.1); } 100% { filter: sepia(1) hue-rotate(190deg) saturate(4) brightness(1.1); border-color: var(--btn-active); box-shadow: 0 0 15px rgba(0, 141, 241, 0.8); } }

.task-actions { display: flex; gap: 8px; position: relative; }
.btn svg { width: 20px; height: 20px; }
.spinner { position: absolute; width: 16px; height: 16px; border: 2px solid transparent; border-top-color: currentColor; border-right-color: currentColor; border-radius: 50%; animation: spin 0.8s linear infinite; display: none; }
.btn.is-loading { pointer-events: none; color: var(--text-muted); }
.btn.btn-active.is-loading { color: #fff; } .btn.is-loading svg { opacity: 0; } .btn.is-loading .spinner { display: block; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.image-modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); z-index: 9999; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; padding: 16px; box-sizing: border-box; overflow: hidden; }
.image-modal-overlay.active { opacity: 1; pointer-events: auto; }
.image-modal-content { border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); transform: scale(0.95); transform-origin: center center; margin: auto; transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
img.image-modal-content { display: block; max-width: 100%; max-height: calc(100vh - 32px); width: auto; height: auto; object-fit: contain; }
.image-modal-overlay.active .image-modal-content { transform: scale(1); }
.modal-box { background: var(--bg-form); padding: 24px; width: 100%; max-width: 600px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--border-color); box-sizing: border-box; overflow-y: auto; }
.modal-box.small { max-width: 400px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; width: 100%; flex-wrap: wrap; }
.modal-actions .btn { width: 100%; max-width: 180px; flex: 1 1 auto; height: auto; min-height: 36px; padding: 10px 16px; box-sizing: border-box; text-align: center; }

@media (max-width: 600px) {
  .techwave_fn_home { zoom: 0.8; } .techwave_fn_header > *, .techwave_fn_leftpanel > * { zoom: 0.75; }
  .image-modal-overlay { padding: 0px; } img.image-modal-content { max-height: calc(100vh - 20px); }
  .modal-box { padding: 10px 6px; max-height: calc(100vh - 20px); } .model-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 50vh; }
  .model-item { height: 120px; } #imageModal:not(.active) .image-modal-content, #deleteConfirmModal:not(.active) .image-modal-content { transform: scale(0.9); }
  #imageModal.active .image-modal-content, #deleteConfirmModal.active .image-modal-content { transform: scale(1); }
  #deleteConfirmModal .image-modal-content { width: 75%; } #imageModal img.image-modal-content { max-width: 85%; max-height: calc(85vh - 20px); }
  #modelsModal:not(.active) .image-modal-content { transform: scale(0.7); } #modelsModal.active .image-modal-content { transform: scale(0.8); }
}

.model-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.model-tab { background: transparent; color: var(--text-muted); border: none; font-size: 16px; cursor: pointer; padding: 5px 10px; transition: 0.2s; }
.model-tab.active { color: var(--btn-active); border-bottom: 2px solid var(--btn-active); }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 15px; max-height: 50vh; overflow-y: auto; padding: 5px; }
.model-item-wrap { position: relative; cursor: pointer; } .model-item { width: 100%; height: 160px; object-fit: cover; border-radius: 8px; border: 3px solid transparent; transition: 0.2s; background: #222; }
.model-item-wrap.selected .model-item { border-color: var(--btn-active); filter: brightness(1.1); transform: scale(1.02); }
.model-check { position: absolute; top: 10px; right: 10px; background: var(--btn-active); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(0.5); transition: 0.2s; }
.model-item-wrap.selected .model-check { opacity: 1; transform: scale(1); }

textarea { overflow: hidden; }
.btnm, .btnmd, .btnmg { display: inline-block; padding: 2px 8px 0px 8px; border-radius: 5px; border: none; cursor: pointer; }
.btnm.inactive { background: #393442; cursor: not-allowed; } .btnm { background: #737373; color: #cfcfcf; }
.btnmd, .btnmg { background: #505050; color: #a2a2a2; } .btnmg { cursor: not-allowed; }

#upload-area { width: 240px; text-align:center; padding:10px; border:1px dashed #333; border-radius:8px; background:#0b0c0e; }
#upload-area img { cursor:pointer; width:100%; max-width:200px; }
#thumbs { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-start; padding:10px; }
.thumb-wrap { position:relative; width:90px; height:90px; background:#fff; border-radius:6px; overflow:hidden; }
.thumb-wrap img { width:100%; height:100%; object-fit:cover; display:block; }
.loader { border: 4px solid var(--btn-active); border-left-color: transparent; border-radius: 50%; width: 36px; height: 36px; animation: spin89345 1s linear infinite; }
@keyframes spin89345 { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.progress { position: absolute; left:0; bottom:0; height:6px; width:0; background: #ff3b3b; transition: width .2s linear; }
.del-btn { position:absolute; top:6px; right:6px; width:28px; height:28px; background:rgba(0,0,0,0.6); color:#fff; border-radius:50%; display:flex; justify-content:center; align-items:center; cursor:pointer; opacity:0; transition:opacity .15s; }
.thumb-wrap:hover .del-btn { opacity:1; }

.section_right { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #888 transparent; }
.section-right::-webkit-scrollbar { width: 6px; } .section-right::-webkit-scrollbar-thumb { background: #888; border-radius: 999px; } .section-right::-webkit-scrollbar-track { background: transparent; }
.loader-pulse { width: 32px; height: 32px; border-radius: 50%; background: var(--btn-active); animation: pulse-ring 1.2s infinite ease-in-out; }
@keyframes pulse-ring { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(1.2); opacity: 0; } }
.loader-orbit { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--btn-active); border-bottom-color: #3be1ff; animation: spin-orbit 1.5s linear infinite; position: relative; }
.loader-orbit::before { content: ''; position: absolute; top: 4px; left: 4px; right: 4px; bottom: 4px; border-radius: 50%; border: 3px solid transparent; border-left-color: var(--btn-active); border-right-color: #3be1ff; animation: spin-orbit 0.75s linear infinite reverse; }
@keyframes spin-orbit { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loader-rejected { width: 32px; height: 32px; position: relative; animation: pulse-error 1.5s infinite alternate ease-in-out; }
.loader-rejected::before, .loader-rejected::after { content: ''; position: absolute; top: 50%; left: 50%; width: 24px; height: 4px; background-color: #ff4d4d; border-radius: 2px; box-shadow: 0 0 8px rgba(255, 77, 77, 0.6); }
.loader-rejected::before { transform: translate(-50%, -50%) rotate(45deg); } .loader-rejected::after { transform: translate(-50%, -50%) rotate(-45deg); }
.loader-cancelled { width: 28px; height: 28px; border: 3px solid #ffb84d; border-radius: 50%; position: relative; box-shadow: 0 0 8px rgba(255, 184, 77, 0.4); animation: pulse-error 1.5s infinite alternate ease-in-out; }
.loader-cancelled::before { content: '!'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #ffb84d; font-weight: bold; font-size: 16px; font-family: sans-serif; }
@keyframes pulse-error { 0% { opacity: 0.7; transform: scale(0.95); } 100% { opacity: 1; transform: scale(1.05); } }

.custom-select:disabled { opacity: 0.4; cursor: not-allowed; background-color: rgba(255, 255, 255, 0.02); }
.task-delete-btn { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg-form); border: 1px solid var(--border-color); color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; line-height: 1; transition: var(--transition); z-index: 10; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.task-delete-btn:hover { background: #ff4d4d; color: #fff; border-color: #ff4d4d; transform: scale(1.1); }
.task-card:has(.task-delete-btn:hover) { border-color: rgba(255, 77, 77, 0.6) !important; background-color: rgba(255, 77, 77, 0.04) !important; box-shadow: 0 4px 15px rgba(255, 77, 77, 0.15), inset 0 0 0 1px rgba(255, 77, 77, 0.1) !important; }
.task-card { transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
@keyframes task-appear-blink { 0% { background-color: rgba(0, 141, 241, 0.3); border-color: var(--btn-active); box-shadow: 0 0 20px rgba(0, 141, 241, 0.4), inset 0 0 10px rgba(0, 141, 241, 0.2); transform: translateY(-15px) scale(0.98); opacity: 0; } 40% { background-color: rgba(0, 141, 241, 0.15); box-shadow: 0 0 10px rgba(0, 141, 241, 0.2); transform: translateY(0) scale(1.01); opacity: 1; } 100% { background-color: var(--bg-form); border-color: var(--border-color); box-shadow: none; transform: scale(1); opacity: 1; } }
.task-new-animated { animation: task-appear-blink 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }

.task-arrow, .task-id, .task-duration, .task-model-name { transition: color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important; }
.task-arrow { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; color: var(--text-muted); margin: 0 !important; }
.task-arrow svg { width: 100%; height: 100%; transition: inherit; }
.task-model-name { color: var(--text-muted); }
.task-card.is-processing-state .task-arrow, .task-card.is-processing-state .task-id, .task-card.is-processing-state .task-duration, .task-card.is-processing-state .task-model-name { color: var(--btn-active) !important; }
.task-card.is-rejected .task-arrow, .task-card.is-rejected .task-id, .task-card.is-rejected .task-duration, .task-card.is-rejected .task-model-name { color: #ff4d4d !important; }
.task-card.is-cancelled .task-arrow, .task-card.is-cancelled .task-id, .task-card.is-cancelled .task-duration, .task-card.is-cancelled .task-model-name { color: #ffb84d !important; }

.batch-slider-container { margin-top: 5px; padding: 0 4px; }
.batch-slider-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.batch-slider-value { color: var(--btn-active); font-weight: 700; font-size: 13px; background: rgba(0, 141, 241, 0.1); padding: 2px 8px; border-radius: 12px; border: 1px solid rgba(0, 141, 241, 0.2); }
.batch-slider { -webkit-appearance: none; width: 100%; height: 6px; background: var(--bg-form); border-radius: 4px; outline: none; border: 1px solid var(--border-color); transition: background 0.2s; }
.batch-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; cursor: pointer; border: 2px solid var(--btn-active); box-shadow: 0 0 10px rgba(0, 141, 241, 0.4); transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s; }
.batch-slider::-webkit-slider-thumb:hover { transform: scale(1.2); box-shadow: 0 0 15px rgba(0, 141, 241, 0.8); }
