﻿  /* Контейнер ровно 150x150 */
  .ailion_ai_gen{
    width:250px;height:250px;
    display:inline-block;
    user-select:none;
  }

  .ailion_ai_gen .ag_frame{
    width:100%;height:100%;
    position:relative;
    overflow:hidden;
    border-radius:14px;
    background: linear-gradient(135deg, #101017 0%, #0b0d1c 100%);
    border: 1px solid rgba(212, 175, 55, 0.22);
    box-shadow:
      0 18px 45px rgba(0,0,0,.75),
      inset 0 1px 0 rgba(212,175,55,.10),
      0 0 28px rgba(212,175,55,.12);
  }

  /* Подсветка по углам */
  .ailion_ai_gen .ag_frame::before{
    content:"";
    position:absolute; inset:-30px;
    background:
      radial-gradient(circle at 18% 22%, rgba(240,201,74,.18) 0%, transparent 45%),
      radial-gradient(circle at 80% 78%, rgba(212,175,55,.10) 0%, transparent 52%);
    filter: blur(0px);
    opacity:.9;
    pointer-events:none;
  }

  /* "Нейросеточная" сетка */
  .ailion_ai_gen .ag_grid{
    position:absolute; inset:0;
    background:
      linear-gradient(to right, rgba(212,175,55,.08) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(212,175,55,.06) 1px, transparent 1px);
    background-size: 14px 14px;
    opacity:.55;
    transform: translateZ(0);
    animation: agGridShift 2.8s linear infinite;
    mix-blend-mode: screen;
  }
  @keyframes agGridShift{
    0%{ transform: translate(0,0); }
    100%{ transform: translate(14px,14px); }
  }

  /* Сканирующая полоса */
  .ailion_ai_gen .ag_scan{
    position:absolute; left:-20%; right:-20%;
    height:34px;
    top:-40px;
    background: linear-gradient(90deg,
      transparent 0%,
      rgba(255,216,107,.10) 20%,
      rgba(240,201,74,.28) 50%,
      rgba(212,175,55,.18) 72%,
      transparent 100%);
    filter: blur(.2px);
    box-shadow: 0 0 18px rgba(240,201,74,.18);
    transform: skewY(-12deg);
    animation: agScan 1.65s ease-in-out infinite;
    opacity:.95;
  }
  @keyframes agScan{
    0%{ top:-50px; opacity:.0; }
    12%{ opacity:.95; }
    55%{ opacity:.85; }
    100%{ top:170px; opacity:0; }
  }

  /* Ядро */
  .ailion_ai_gen .ag_core{
    position:absolute;
    width:78px;height:78px;
    left:50%; top:48%;
    transform: translate(-50%,-50%);
    border-radius: 50%;
    background:
      radial-gradient(circle at 35% 30%, rgba(255,216,107,.95) 0%, rgba(240,201,74,.55) 32%, rgba(212,175,55,.18) 60%, transparent 72%),
      radial-gradient(circle at 65% 70%, rgba(212,175,55,.25) 0%, transparent 55%);
    box-shadow:
      0 0 20px rgba(240,201,74,.22),
      0 0 44px rgba(212,175,55,.16),
      inset 0 1px 0 rgba(255,255,255,.08);
    animation: agPulse 1.15s ease-in-out infinite;
    filter: saturate(1.1);
  }
  @keyframes agPulse{
    0%,100%{ transform: translate(-50%,-50%) scale(0.98); opacity:.92; }
    50%{ transform: translate(-50%,-50%) scale(1.05); opacity:1; }
  }

  /* Частицы (создаются JS-ом как span) */
  .ailion_ai_gen .ag_particles{
    position:absolute; inset:0;
    pointer-events:none;
  }
  .ailion_ai_gen .ag_p{
    position:absolute;
    width:2px;height:2px;
    border-radius:50%;
    background: rgba(255,216,107,.85);
    box-shadow: 0 0 10px rgba(240,201,74,.35);
    opacity:.0;
    animation: agParticle 1.8s linear infinite;
  }
  @keyframes agParticle{
    0%   { transform: translate(0,0) scale(.8); opacity:0; }
    12%  { opacity:.95; }
    70%  { opacity:.55; }
    100% { transform: translate(var(--dx), var(--dy)) scale(1.3); opacity:0; }
  }

  /* Статус */
  .ailion_ai_gen .ag_status{
    position:absolute; left:10px; right:10px; bottom:10px;
    padding:8px 8px;
    border-radius:10px;
    background: rgba(6, 9, 32, 0.55);
    border: 1px solid rgba(212,175,55,.18);
    box-shadow: inset 0 1px 0 rgba(212,175,55,.06);
    backdrop-filter: blur(6px);
  }
  .ailion_ai_gen .ag_title{
	font-size: 12px;
	line-height: 200%;
    letter-spacing:1.6px;
    color:#e9e9ee;
    opacity:.92;
    text-transform:uppercase;
	text-align:center;
  }
  .ailion_ai_gen .ag_title span {
	cursor:pointer;
	padding: 2px 5px;
	margin: 5px 10px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	min-width: max(35%, 100px);
	color: #d4af37;
	display: inline-block;
	background: linear-gradient(135deg, #d4af37 0%, #f0c94a 100%);
	box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
	color: #060920;
	border-radius: 4px;
	}
  .ailion_ai_gen .ag_title span:hover {
	background: linear-gradient(135deg, #f0c94a 0%, #ffd86b 100%);
	box-shadow: 0 12px 30px rgba(212, 175, 55, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
	transform: translateY(-2px);
}

  .ailion_ai_gen .ag_sub{
    margin-top:2px;
    font-size:12px;
    font-weight:600;
    color:#d4af37;
    text-shadow: 0 2px 10px rgba(212,175,55,.25);
  }

  /* Небольшое "дыхание" рамки */
  .ailion_ai_gen .ag_frame{
    animation: agFrameGlow 2.4s ease-in-out infinite;
  }
  
  .ag_frame .prompt_div {
		text-align:center;
		pointer-events: none;
		position: absolute;
		width:250px;
		bottom:10px;
		color:#fff;
		-opacity:0.75;
		padding:0 10px;
		max-height:110px;
		overflow:hidden;
		font-size:20px;
		line-height:35px;
		font-weight:600;
		text-transform:uppercase;
		text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
	}
  
  @keyframes agFrameGlow{
    0%,100%{
      box-shadow:
        0 18px 45px rgba(0,0,0,.75),
        inset 0 1px 0 rgba(212,175,55,.10),
        0 0 24px rgba(212,175,55,.10);
    }
    50%{
      box-shadow:
        0 18px 45px rgba(0,0,0,.75),
        inset 0 1px 0 rgba(212,175,55,.12),
        0 0 38px rgba(240,201,74,.16);
    }
  }
  
.ailion_ai_gen img, .ailion_ai_gen video {
	width: 100%;
    object-fit: cover;
    height: 100%;
}

.generation_history {
	display: flex;
    flex-wrap: wrap;
	gap: 20px;
	justify-content: center;
}

.fancy-history-open {
	-position:relative;
	display:none;
	background: content-box;
	width:auto;
	display: flex;
	flex-direction: column;
	height: 100vh;
	justify-content:flex-start;
	gap:0;
}

.fancy-history-open img, .fancy-history-open video {
	  -flex: 0 1 auto; /* не расти, но сжиматься */
	  -max-height: 100%; /* ограничение по высоте контейнера */
	  -width: auto; /* сохраняем пропорции */
	  -object-fit: contain; /* сохраняем пропорции изображения */
	  -align-self: center; /* центрируем по горизонтали */
  
	flex: 1 1 auto; /* занимает всё доступное пространство */
	max-height: calc(100% - 180px); /* вычитаем высоту второго блока */
	width: auto;
	object-fit: contain; /* заполняем область, обрезая края */
	align-self: stretch; /* растягиваем на всю ширину */
	margin:0;
}

.fancy-history-open .generation-management {
	background: linear-gradient(135deg, #101017 0%, #0f0f1a 100%);
	display:block;
	-border-radius:20px !important;
	padding:10px 10px;
	text-align:center;
	opacity:0.85;
	margin:0 auto;
	flex: 0 0 100px;
}

.fancy-history-open .generation-management a, .attention .new_gen {
	padding:2px 5px;
	margin:5px 10px;
	font-size:12px;
	font-weight:700;
	text-transform: uppercase;
	min-width: max(35%, 100px);
	color: #d4af37;
	display:inline-block;
	background: linear-gradient(135deg, #d4af37 0%, #f0c94a 100%);
	box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
	color: #060920;
	border-radius:4px;
}

.attention .new_gen {
	min-width: 140px;
	display:inline-block;
	clear:b
}

.fancy-history-open .generation-management a:hover, .attention .new_gen:hover {
	background: linear-gradient(135deg, #f0c94a 0%, #ffd86b 100%);
    box-shadow: 0 12px 30px rgba(212, 175, 55, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.fancy-history-open .generation-management .links {
	display:flex;
	flex-wrap:wrap;
	justify-content: center;
	border: 1px solid #d4af37;
	border-radius: 4px;
	min-height:30px;
	padding:5px;
}

.fancy-history-open .generation-management .links>div {
	--min-width:250px;
	--display: flex;
	--justify-content: space-between;
}

.fancy-history-open p a:hover {
	text-decoration:underline;
}

.fancy-history-open .generation-management a.delete-gen {
  padding: 2px 5px;
  margin: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  min-width: max(35%, 100px);
  display: inline-block;
  background: linear-gradient(135deg, #ff6b9d 0%, #ff8fb3 100%);
  box-shadow: 0 8px 20px rgba(255, 107, 157, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #060920;
  border-radius: 4px;
}

.fancy-history-open .generation-management a.unactiv-gen {
  padding: 2px 5px;
  margin: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  min-width: max(35%, 100px);
  display: inline-block;
  background: linear-gradient(135deg, #888888 0%, #bbbbbb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #444444;
  border-radius: 4px;
  -cursor: not-allowed;
  -user-select: none;
  -pointer-events: none;
  border: none;
}

.fancy-history-open .generation-management a.published-gen {
  padding: 2px 5px;
  margin: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  min-width: max(35%, 100px);
  display: inline-block;
  background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
  box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #060920;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fancy-history-open .generation-management a.published-gen:hover,
.fancy-history-open .generation-management a.published-gen:focus {
  background: linear-gradient(135deg, #388e3c 0%, #66bb6a 100%);
  box-shadow: 0 12px 28px rgba(56, 142, 60, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 0 3px rgba(76, 175, 80, 0.3);
  transform: translateY(-2px);
}

/*
.fancy-history-open .generation-management a:focus {
  padding: 2px 5px;
  margin: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  min-width: max(35%, 100px);
  display: inline-block;
  background: linear-gradient(135deg, #ff4d7f 0%, #ff7aa3 100%);
  box-shadow: 0 12px 28px rgba(255, 107, 157, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 0 3px rgba(255, 107, 157, 0.3);
  color: #060920;
  border-radius: 4px;
  transform: translateY(-2px);
  transition: all 0.2s ease;
}
*/
.fancybox__content {
	padding:0;
	-background-color:#000;
	-max-width:100% !important;
	--max-height:calc(100vh - 150px) !important;
	-display:block;
}


.generation-management details
{
	max-height: 80vh; /* 80 % от высоты viewport */
	overflow-y: auto; /* Вертикальная прокрутка при переполнении */
	border: 1px solid #d4af37;
	border-radius: 4px;
	margin-bottom:5px;
	min-height:30px;
}

.generation-management textarea {
	width:stretch;
	padding: 12px 16px;
	background: rgba(6, 9, 32, 0.6);
	border: 1px solid rgba(212, 175, 55, 0.3);
	border-radius: 6px;
	color: #e9e9ee;
	font-size: 14px;
	font-family: inherit;
	transition: all 0.3s ease;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
	resize: vertical;
	min-height: 100px;
}

.generation-management textarea:focus {
	outline: none;
	background: rgba(6, 9, 32, 0.8);
	border-color: #d4af37;
	box-shadow: 
		inset 0 2px 4px rgba(0, 0, 0, 0.3),
		0 0 15px rgba(212, 175, 55, 0.4);
}


.generation-management details summary {
	color: #d4af37;
	font-size:14px;
	line-height:30px;
	text-transform: uppercase;
	font-weight:700;
	cursor:pointer;
}

details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none; 
}

summary .arrow-summ::before {
	font-family: 'Font Awesome 6 Free';
	font-weight: 900;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
	-webkit-font-smoothing: antialiased;
	display:inline-block;
	content:"\f105";
	padding:0 5px;
}

/* Поворачиваем стрелку при раскрытии */
details[open] > summary .arrow-summ::before {
  transform: rotate(90deg);
}

details[open] > summary {
  padding-top: 10px;
}

#copy-prompt {
	padding-left:15px;
}

#copy-prompt::after {
	font-family: 'Font Awesome 6 Free';
	font-weight: 900;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
	-webkit-font-smoothing: antialiased;
	display:inline-block;
	content:"\f0c5";
	padding:0 5px;
}

#prompt {margin:10px 15px; color:#fff; line-height:150%; font-size:13px;}

#fancy-publish-open {
	box-shadow: var(--shadow-soft);
	border: 1px solid var(--gold);
	background: radial-gradient(300px circle at 0 0, var(--gold-soft), transparent 60%), radial-gradient(300px circle at 100% 100%, var(--gold-soft), transparent 60%), linear-gradient(180deg, #14141b 0%, #060920 100%);
	filter: drop-shadow(0 0 0 #214867);
	color: #fafeff;
	margin: 0 30px 20px 30px;
	width: auto;
	max-width:600px !important;
	padding: 30px 40px;
	border-radius:20px;
}

#fancy-publish-open>h3, #fancy-publish-open>p {
	text-align:center;
	margin: 0 0 5px 0;
}
#fancy-publish-open h4 {
	margin:0 0 0 0;
	padding:0;
}
#fancy-publish-open>div {
	padding:15px 20px 10px 80px;
	position:relative;
	text-align:left;
	border-radius:15px;
	margin:5px 0;
	background-image: linear-gradient(90deg, #2b4661 0%, #486c86 50% 50%, #2b4661 100%);
	filter: drop-shadow(0 0 5px #214867);
	transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
#fancy-publish-open>div .publish-icon {
	position:absolute;
	top: 15px;
	left: 25px;
	font-size:24px;
}

#fancy-publish-open>div p {
	margin:0 0 0 0;
}

.publish-rules p {font-size:12px;}

#fancy-publish-open .btn {
	margin: 10px 0 0 0;
}

@media (max-width: 600px) {
	.fancy-history-open p {
		-max-width:300px;
		-display: grid;
		-grid-template-columns: repeat(2, 1fr);
	}
	.fancy-history-open p a:nth-child(even) {
		text-align:right;
	}
	.fancy-history-open p a:nth-child(odd) {
		text-align:left;
	}
	.fancy-history-open p a {
		padding:0 0;
	}
}

@media (max-width: 720px) {
	.fancy-history-open .generation-management .links>div {
		display: flex;
		justify-content: space-around;
		width: 100%;
	}
}