/* ====== Глобальные стили и тема ====== */
:root{
  --container-max-width: 1400px;
  --container-padding: 1.25rem;   /* Единые боковые отступы */
  --bg:#0b1020;
  --panel:#121831;
  --panel-2:#0f162b;
  --card:#151c36;
  --primary:#3b82f6;
  --primary-600:#2563eb;
  --accent:#f59e0b;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --success:#22c55e;
  --danger:#ef4444;
  --border:rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --glass: rgba(255,255,255,.05);
  --glass-strong: rgba(255,255,255,.08);
  --glow-primary: 0 0 24px rgba(59,130,246,.25);
  --glow-muted: 0 0 24px rgba(148,163,184,.12);
}

/* Make results panel content fill height and video cover */
.premium-results{ display:flex; flex-direction:column; overflow:hidden }
.premium-results .grid {
  flex: 1; /* <-- КЛЮЧЕВОЙ МОМЕНТ */
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  padding: 12px;
  gap: 10px;
}
.result-card, .result-media{ height:100% }
.result-video{ width:100%; height:100%; object-fit:cover; display:block }

/* Clip and fit the waiting placeholder inside results */
.premium-results .placeholder,
.premium-results .premium-placeholder{ aspect-ratio:auto; width:100%; height:100%; max-width:100%; max-height:100%; overflow:hidden; box-sizing:border-box }

/* Ensure card/layout can shrink within flex container */
.result-card{ display:flex; flex-direction:column; min-height:0 }
.result-media{ flex:1; min-height:0 }

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
  color:var(--text);
  background-color: var(--bg);
  overflow-x: hidden;
  position: relative;
}

/* Aurora mesh gradient background reacting to cursor */
body::before{
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(1000px 700px at calc(50% + var(--mx,0px)*.05) calc(40% + var(--my,0px)*.05), rgba(88,101,242,.18), transparent 60%),
    radial-gradient(900px 600px at calc(20% - var(--mx,0px)*.04) calc(30% - var(--my,0px)*.04), rgba(14,165,233,.16), transparent 60%),
    radial-gradient(900px 600px at calc(80% + var(--mx,0px)*.04) calc(70% + var(--my,0px)*.04), rgba(168,85,247,.18), transparent 60%),
    linear-gradient(180deg, #080c19 0%, #0b1020 100%);
  filter: saturate(110%);
  animation: auroraFloat 38s ease-in-out infinite alternate;
}
 @keyframes auroraFloat{ 
  0%{ transform:scale(1) } 
  100%{ transform:scale(1.03) }
}

/* ====== Кнопки ====== */
.btn{
  appearance:none; border:1px solid var(--border); background:rgba(255,255,255,.04); color:var(--text);
  padding:.65rem 1rem; border-radius:12px; cursor:pointer; transition:all .22s ease;
  backdrop-filter: blur(8px) saturate(140%);
  box-shadow: var(--glow-muted);
  position:relative; overflow:hidden;
  min-height: 44px; /* Минимальная высота для удобного нажатия */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.btn:hover{border-color:rgba(255,255,255,.18); transform:translateY(-1px); box-shadow:0 8px 24px rgba(0,0,0,.35)}
.btn.primary{ background:var(--primary); border-color:transparent; color:white; box-shadow: var(--glow-primary) }
.btn.primary:hover{ background:var(--primary-600) }
.btn.ghost{ background:rgba(255,255,255,.04) }
.btn.danger{ background:rgba(239,68,68,.12); color:#fecaca; border-color:rgba(239,68,68,.25) }
.btn.danger:hover{ background:rgba(239,68,68,.18) }
.btn.link{ background:transparent; border:0; padding:.5rem 1rem; color:var(--muted); text-decoration:none; border-radius:8px; transition:all .22s ease; }
.btn.link:hover{ background:rgba(255,255,255,.08); color:var(--text); transform:translateY(-1px); }
.btn.block{ width:100% }
.btn.round{ border-radius:999px }
.btn.icon{ padding:.5rem; display:inline-flex; align-items:center; gap:.4rem }
.btn.disabled, .disabled .btn{ opacity:.5; pointer-events:none }

/* ====== Топбар ====== */
@media (max-width: 768px) {
  .topbar{ position:sticky; top:0; z-index:50; background:transparent; }
  .topbar .inner{ background:var(--bg) !important; backdrop-filter:none !important; }
}
@media (min-width: 769px) {
  .topbar{ position:sticky; top:0; z-index:50; background:transparent; }
}
.topbar .inner{ 
  max-width: calc(var(--container-max-width) - 40px);
  padding: .6rem var(--container-padding);

  margin:10px auto; padding:.6rem .9rem; 
  display:flex; align-items:center; gap:1rem;
  background: var(--glass);
  border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow);
  backdrop-filter: blur(14px) saturate(160%);
}
.brand{ font-weight:700; letter-spacing:.3px }
.brand svg{ width:22px; height:22px; vertical-align:-3px; margin-right:6px; filter: drop-shadow(0 0 8px rgba(59,130,246,.35)); }
.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.nav a, .nav button {
  text-decoration: none;
  position: relative;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  color: var(--muted);
  overflow: hidden;
}

.nav a::before, .nav button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(167, 139, 250, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav a:hover, .nav button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(96, 165, 250, 0.3);
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.nav a:hover::before, .nav button:hover::before {
  opacity: 1;
}

.nav .active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(167, 139, 250, 0.15));
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--text);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.2),
    0 8px 32px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.nav .active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  border-radius: 1px;
}

.nav .btn.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fecaca;
}

.nav .btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3);
}

/* Убираем внешние вертикальные границы возле лого и возле кнопки выхода */
.premium-topbar .inner .nav > :first-child { border-left: none !important; }
/* keep right border for last nav item */

/* ====== Профиль в хедере ====== */
.nav .profile-info{
  display:flex; align-items:center; gap:.5rem; margin-right:.25rem;
  padding:.4rem .75rem; border-radius:12px; white-space:nowrap;
  background: rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px) saturate(150%);
  box-shadow: var(--glow-muted);
}
.profile-info .pi-item{ color: var(--text); font-size:.85rem; font-weight:500; opacity:.95 }
.profile-info .pi-item strong{ font-weight:800; letter-spacing:.2px; }
.profile-info .pi-plan{ font-weight:700; background: linear-gradient(135deg, #e5e7eb, #f9fafb); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text }
.profile-info .pi-days{ font-weight:700 }
.profile-info .pi-sep{ opacity:.35; margin:0 .15rem }

/* Скрываем короткие/мобильные лейблы по умолчанию (для десктопа) */
.profile-info .pi-label-short {
  display: none;
}

 @media (max-width: 720px){
  .nav .profile-info{ font-size:.8rem; padding:.35rem .6rem }
  .profile-info .pi-item{ font-size:.8rem }
}

/* ====== Контейнеры ====== */
.wrapper{ 
  max-width: var(--container-max-width); /* уже 1400px */
  margin:0 auto; 
  padding: var(--container-padding);
}
.cards{ display:grid; grid-template-columns:repeat(3, 1fr); gap:12px }
.card{ background:var(--glass); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); backdrop-filter: blur(10px) saturate(150%) }
.card.padded{ padding:14px }

/* Premium concepts with background videos */
.premium-concepts{ display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:8px; justify-content: stretch }
.premium-concepts > .premium-concept{ max-width: none }
.premium-concept{ position:relative; isolation:isolate; overflow:hidden; min-height:0; aspect-ratio: 9 / 16; border-radius:18px; clip-path: inset(0 round 18px); min-width:0; width:100% }
.premium-concept.concept{ padding:0 }

.premium-concept::after{ content:none }
.premium-concept .concept-video{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:center; z-index:0; pointer-events:none; opacity:.6; filter: saturate(110%) contrast(105%); transition: opacity .25s ease; border-radius: inherit; clip-path: inset(0 round 18px) }
.premium-concept:hover .concept-video{ opacity:.8 }
.premium-concept .concept-icon{ position:absolute; top:10px; left:10px; z-index:1; background:rgba(0,0,0,.35); border:1px solid var(--border); padding:.45rem; border-radius:12px; backdrop-filter: blur(8px); box-shadow: var(--shadow) }
.premium-concept .concept-label{ position:absolute; left:50%; bottom:10px; transform: translateX(-50%); z-index:1; background:rgba(0,0,0,.4); border:1px solid var(--border); padding:.55rem .85rem; border-radius:12px; backdrop-filter: blur(10px); font-size:14px; font-weight:800; text-shadow:0 2px 8px rgba(0,0,0,.55); text-align:center }

/* Подсветка выбранного концепта: тускним остальные */
.premium-concepts .premium-concept{ transition: opacity .25s ease, transform .25s ease }
.premium-concepts .premium-concept:not(.active){ opacity:.5 }
.premium-concepts .premium-concept:not(.active):hover{ opacity:.8 }

/* Загрузки */
.uploads{ display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:6px }
.dropzone{ 
  position:relative; display:flex; align-items:center; justify-content:center; flex-direction:column;
  min-height:260px; height:auto; padding:16px; border:2px dashed rgba(255,255,255,.18); border-radius:16px; 
  background: rgba(255,255,255,.02);
  backdrop-filter: blur(8px) saturate(140%);
  box-shadow: var(--shadow);
}
.dropzone input[type=file]{ position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer }
.dropzone .hint{ color:#e9f0ff; opacity:.85; margin-top:8px; width: 90%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-icon{ width:42px; height:42px; opacity:.9; filter: drop-shadow(0 0 12px rgba(59,130,246,.25)); }
.dropzone.disabled{ opacity:.45; pointer-events:none; filter:saturate(.6) }
.dropzone.dragging{ animation:pulseBorder 1.4s ease-in-out infinite }
 @keyframes pulseBorder{ 0%,100%{ border-color:rgba(255,255,255,.18) } 50%{ border-color:rgba(59,130,246,.55) } }

 @media (max-width: 680px){
  .dropzone{ min-height: 200px; }
}

/* Image preview inside dropzones */
.dropzone .dz-preview{ position:absolute; inset:0; border-radius: inherit; overflow:hidden; background:none; border:0; box-shadow:none }
.dropzone .dz-preview-img{ width:100%; height:100%; object-fit:cover; display:block; background:#000 }
.dropzone.has-preview .dz-icon, .dropzone.has-preview .hint {
  display: none;
}

.actions{ margin-top:10px; display:flex; gap:10px }

/* Результаты */
.results{ background:var(--glass); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow); backdrop-filter: blur(10px) saturate(150%) }
.results{ overflow:hidden }
.results .header{ padding:12px 16px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center }
.results .grid{ padding:12px; display:grid; grid-template-columns: 1fr; gap:10px }
.placeholder{ aspect-ratio: 3 / 4; border-radius:12px; background:linear-gradient(135deg, #1b2447, #131c37); border:1px solid #1e2a54 }

/* Result cards with shimmer + tilt */
.result-card{ position:relative; border-radius:14px; overflow:hidden; border:1px solid var(--border); background:rgba(255,255,255,.03); transform-style:preserve-3d; transition: transform .12s ease, box-shadow .2s ease; box-shadow: var(--shadow); }
.result-card:hover{ box-shadow: 0 20px 40px rgba(0,0,0,.35) }
.result-media {
  flex: 1; /* <-- КЛЮЧЕВОЙ МОМЕНТ */
  min-height: 0;
  width: 100%;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-video {
  width: 100%;
  height: 100%;
  object-fit: contain; /* <-- Убеждаемся, что здесь 'contain' */
  display: block;
}
.skeleton{ position:absolute; inset:0; background: linear-gradient(120deg, rgba(255,255,255,.06) 25%, rgba(255,255,255,.12) 37%, rgba(255,255,255,.06) 63%); background-size:400% 100%; animation: shimmer 1.5s infinite; }
 @keyframes shimmer{ 0%{ background-position:100% 0 } 100%{ background-position:0 0 } }
/* ====== ИЗМЕНЕНИЕ: Современные иконки управления результатом ====== */
.card-actions{
  position:absolute;
  top: 12px;
  right: 12px;
  display:flex;
  flex-direction: column;
  gap: 8px;
  opacity:0;
  transform: translateX(8px);
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.result-card:hover .card-actions{
  opacity:1;
  transform: translateX(0);
}

/* Стили для новых кнопок-иконок */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(11, 16, 32, 0.5); /* Полупрозрачный фон */
  border: 1px solid rgba(255, 255, 255, 0.2); /* Белый контур */
  border-radius: 50%; /* Круглая форма */
  color: white;
  cursor: pointer;
  backdrop-filter: blur(10px) saturate(150%);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none; /* для тега 'a' */
}

.icon-btn:hover {
  background: rgba(11, 16, 32, 0.75);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1); /* Эффект увеличения при наведении */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Улучшенная карточка результата */
.result-card {
    display: flex; /* <-- КЛЮЧЕВОЙ МОМЕНТ */
    flex-direction: column;
    min-height: 0;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .03);
}

.result-card:hover{
  box-shadow: 0 20px 40px rgba(0,0,0,.4);
  border-color: rgba(255,255,255,.15);
  transform: translateY(-4px);
}

/* Улучшенный overlay для видео при hover */
.result-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.3) 100%);
  opacity: 0;
  transition: opacity .25s ease;
  z-index: 1;
  pointer-events: none;
}

.result-card:hover::before {
  opacity: 1;
}

/* ====== Премиальные модальные окна ====== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.75);
  backdrop-filter: blur(20px) saturate(150%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: modalOverlayIn 0.4s ease-out;
}

 @keyframes modalOverlayIn {
  from {
    backdrop-filter: blur(0px);
    background: rgba(4, 7, 15, 0);
  }
  to {
    backdrop-filter: blur(20px) saturate(150%);
    background: rgba(4, 7, 15, 0.75);
  }
}

.modal.show {
  display: flex;
  opacity: 1;
}

.dialog {
  width: min(640px, 95vw);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 2px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transform: translateY(32px) scale(0.95);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.dialog::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.3), rgba(167, 139, 250, 0.3), rgba(244, 114, 182, 0.2));
  border-radius: 24px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show .dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal.show .dialog::before {
  opacity: 1;
}

.dialog .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  position: relative;
}

.dialog .head::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 2rem;
  right: 2rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.3), transparent);
}

.dialog .head strong {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e5e7eb, #f9fafb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dialog .head .btn {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.dialog .head .btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.dialog .content {
  padding: 2rem;
  position: relative;
}

/* ====== Страница оплат ====== */
.plans{ display:grid; grid-template-columns: repeat(3, 1fr); gap:16px }
.plan-card{ background:var(--glass); border:1px solid var(--border); border-radius:18px; padding:22px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:14px; transform-style:preserve-3d; transition: transform .16s ease, box-shadow .2s ease }
.plan-card:hover{ box-shadow: 0 30px 60px rgba(0,0,0,.35) }
.plan-card.active, .plan-card[data-plan-id="pro"]{ outline:2px solid var(--primary); box-shadow: 0 0 0 4px rgba(59,130,246,.15), var(--glow-primary) }
.plan-title{ font-weight:700 }
.price{ font-size:28px; font-weight:800 }
.features{ color:var(--muted); font-size:14px; display:grid; gap:6px }
.features .feat{ display:flex; align-items:center; gap:8px }
.features .feat::before{ content:""; width:14px; height:14px; border-radius:50%; background: conic-gradient(from 0deg, #22c55e, #16a34a); box-shadow:0 0 0 2px rgba(34,197,94,.2) }
.buy-pulse{ animation: buyPulse 1.8s ease-in-out infinite }
 @keyframes buyPulse{ 0%,100%{ transform: translateY(0); box-shadow: var(--glow-primary) } 50%{ transform: translateY(-1px); box-shadow: 0 0 28px rgba(59,130,246,.35) } }

/* Адаптивность */
 @media (max-width: 1024px){
  .app-layout{ grid-template-columns:1fr }
}
 @media (min-width: 1280px){
  .app-layout{ grid-template-columns: 640px 1fr }
  .premium-concept{ min-height: 380px }
}
 @media (min-width: 1536px){
  .app-layout{ grid-template-columns: 720px 1fr }
  .premium-concept{ min-height: 440px }
}
 @media (max-width: 680px){
  .cards, .concepts, .plans{ grid-template-columns:1fr }
  .uploads{ grid-template-columns:1fr }
}

/* ====== Ripple effect ====== */
.ripple{ position:absolute; border-radius:50%; transform: scale(0); animation:ripple .6s ease-out forwards; background: rgba(255,255,255,.35); pointer-events:none; }
 @keyframes ripple{ to{ transform:scale(3); opacity:0 } }

/* ====== Tilt helpers ====== */
.tilt{ will-change: transform; transform-style: preserve-3d; }

/* ====== Современная страница авторизации ====== */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
}

.auth-hero {
  text-align: center;
  margin-bottom: 3rem;
  z-index: 2;
  position: relative;
}

.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand-logo svg {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 8px 32px rgba(96, 165, 250, 0.3));
  animation: logoFloat 3s ease-in-out infinite;
}

 @keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.brand-logo h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--muted);
  margin: 0;
  font-weight: 400;
}

.auth-card {
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 2;
  animation: cardSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

 @keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.5), rgba(167, 139, 250, 0.5), rgba(244, 114, 182, 0.3));
  border-radius: 24px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-card:hover::before {
  opacity: 1;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-card-header h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.025em;
}

.auth-card-header p {
  color: var(--muted);
  margin: 0;
  font-size: 1rem;
}

.auth-methods {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.auth-method::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(167, 139, 250, 0.08));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-method:hover {
  border-color: rgba(96, 165, 250, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.auth-method:hover::before {
  opacity: 1;
}

.method-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(96, 165, 250, 0.3);
}

.method-content {
  flex: 1;
  z-index: 1;
}

.method-content.full-width {
  width: 100%;
}

.method-content h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.method-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.telegram-auth .method-icon {
  background: linear-gradient(135deg, #0088cc, #229ed9);
}

.telegram-widget {
  margin-top: 1rem;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 0.5rem 0;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.auth-divider span {
  background: var(--bg);
  padding: 0 1rem;
  color: var(--muted);
  font-size: 0.875rem;
  position: relative;
  z-index: 1;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Fix: чтобы поле Telegram выглядело как остальные
   JS включает его через style.display = 'block', из-за чего теряется flex + gap.
   Принудительно возвращаем flex при показе. */
#tgUsernameGroup[style*="display: block"] {
  display: flex !important;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.form-input {
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
  color: var(--muted);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn {
  position: relative;
  overflow: hidden;
}

.btn-text {
  position: relative;
  z-index: 1;
}

.btn-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  opacity: 0;
  z-index: 2;
}

 @keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.btn.loading .btn-text {
  opacity: 0;
}

.btn.loading .btn-loader {
  opacity: 1;
}

/* Floating Shapes - Статичные декоративные элементы */
.floating-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.08;
}

.shape-1 {
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  top: 10%;
  left: -100px;
}

.shape-2 {
  width: 150px;
  height: 150px;
  background: linear-gradient(135deg, #f472b6, #ec4899);
  bottom: 20%;
  right: -75px;
}

.shape-3 {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
  top: 60%;
  left: -50px;
}

/* ====== Премиальный дизайн главной страницы ====== */
.premium-wrapper {
  max-width: var(--container-max-width); /* уже 1400px */
  margin: 0 auto;
  padding: var(--container-padding);
  display: grid;
  grid-template-columns: 1fr 1fr; /* одинаковая ширина панелей */
  gap: 1rem;
  align-items: stretch; /* одинаковая высота панелей */
}

.premium-panel {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(180%);
  border: none;
  border-radius: 24px;
  padding: 1rem;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

/* ИЗМЕНЕНИЕ: Убираем псевдоэлемент для чистого вида */

/* ИЗМЕНЕНИЕ: Подсветка дропзон при наведении на всю панель */
.premium-dropzone {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Подсветка дропзон при наведении на панель */
.premium-panel:hover .premium-dropzone {
  border-color: rgba(96, 165, 250, 0.6) !important;
  background: rgba(96, 165, 250, 0.08) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(96, 165, 250, 0.2);
}

/* Дополнительная подсветка при наведении непосредственно на дропзону */
.premium-dropzone:hover {
  border-color: rgba(96, 165, 250, 0.8) !important;
  background: rgba(96, 165, 250, 0.12) !important;
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.08) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(96, 165, 250, 0.2);
}

.premium-panel-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, #e5e7eb, #f9fafb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.premium-concepts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  justify-content: stretch;
}

.premium-concept {
  padding: 1.5rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  aspect-ratio: 9 / 16;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.premium-concept::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(167, 139, 250, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.premium-concept:hover {
  border-color: rgba(96, 165, 250, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.premium-concept:hover::before {
  opacity: 1;
}

.premium-concept.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2), 0 20px 40px rgba(59, 130, 246, 0.15);
}

.premium-results {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(180%);
  border: none;
  border-radius: 24px;
  padding: 1rem;
  position: relative;
  box-shadow: none;
}

/* ИЗМЕНЕНИЕ: Обновлённый оверлей загрузки с процентами */
.premium-results .results-loading{
  position:absolute; inset:0; z-index:5;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
  background:
    radial-gradient(1200px 800px at 50% 0%, rgba(59,130,246,.10), transparent 60%),
    radial-gradient(1000px 700px at 80% 80%, rgba(167,139,250,.10), transparent 60%),
    rgba(8,12,25,.55);
  backdrop-filter: blur(8px) saturate(140%);
  transition: opacity .25s ease, transform .25s ease;
}
.premium-results .results-loading.hide{ opacity:0; transform:scale(.98); pointer-events:none }
.results-loading .loading-title{ font-weight:700; letter-spacing:.2px }
.results-loading .loading-percentage{ font-size:1.25rem; font-weight:700; color:var(--text); letter-spacing:0.5px; }
.results-loading .loading-spinner{
  width:40px; height:40px; border:3px solid rgba(255,255,255,.25); border-top-color:#fff; border-radius:50%;
  animation: spin360 1s linear infinite;
}
.results-loading .loading-bar{
  width:min(480px,70%); height:12px; border-radius:999px; background:rgba(255,255,255,.08);
  border:1px solid var(--border); overflow:hidden; position:relative; margin-top:12px;
}
/* Determinate fill when progress known */
.results-loading .loading-bar .loading-fill{
  position:absolute; left:0; top:0; bottom:0; width:0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-600));
  box-shadow: var(--glow-primary);
  transition: width .25s ease;
  border-radius: inherit;
}
/* Hide shimmer when we have real progress */
.results-loading .loading-bar.has-progress::before{ display:none }

 @keyframes spin360{ from{ transform:rotate(0deg) } to{ transform:rotate(360deg) } }

.premium-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.premium-results-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  background: linear-gradient(135deg, #e5e7eb, #f9fafb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.premium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.premium-placeholder {
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.875rem;
  transition: all 0.3s ease;
  text-align: center;
  padding: 1rem;
}

.premium-placeholder:hover {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.05);
}

.concept-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 0.75rem;
  color: var(--primary);
  opacity: 0.8;
}

.concept-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  z-index: 1;
  position: relative;
}

.premium-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.75rem;
  font-weight: 900;
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  letter-spacing: -0.02em;
  text-decoration: none;
  transition: all 0.3s ease;
  line-height: 1;
}

.premium-brand:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 4px 20px rgba(96, 165, 250, 0.3));
}

.premium-brand svg {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 8px 24px rgba(96, 165, 250, 0.6));
  animation: logoGlow 3s ease-in-out infinite alternate;
}

 @keyframes logoGlow {
  0% {
    filter: drop-shadow(0 8px 24px rgba(96, 165, 250, 0.6));
  }
  100% {
    filter: drop-shadow(0 12px 32px rgba(167, 139, 250, 0.8));
  }
}

.premium-panel-header {
  margin-bottom: 0; /* Убираем margin, используем gap */
}

.premium-panel-header p {
  color: var(--muted);
  margin: 0;
  font-size: 1rem;
}

.premium-uploads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0; /* Убираем margin, используем gap */
}

.premium-dropzone {
  min-height: 240px;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  position: relative;
}

.premium-dropzone:hover {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.05);
}

.premium-dropzone .dz-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--primary);
  opacity: 0.8;
  filter: drop-shadow(0 4px 16px rgba(96, 165, 250, 0.3));
}

.premium-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ====== ИЗМЕНЕНИЕ: Адаптивная вёрстка для любых экранов ====== */

/* 1. Основной контейнер динамически адаптируется к любой высоте */
.premium-wrapper {
  /* Используем динамический расчёт высоты */
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
  overflow: hidden; /* Предотвращаем прокрутку */
  align-items: stretch;
}

/* 2. Левая панель с динамическими размерами */
.premium-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: min(1rem, 2vh); /* Динамический отступ зависящий от высоты */
  overflow: hidden;
}
.premium-panel > * { margin: 0 !important; }

/* 3. Заголовок адаптируется к высоте */
.premium-panel-header {
  flex-shrink: 0;
  min-height: min(4rem, 8vh);
}

.premium-panel-header h2 {
  font-size: clamp(1rem, 2.5vh, 1.5rem);
  margin-bottom: min(0.5rem, 1vh);
}

.premium-panel-header p {
  font-size: clamp(0.8rem, 2vh, 1rem);
}

/* 4. Концепты растягиваются на больших экранах */
.premium-concepts {
  flex: 1 1 auto; /* Концепты теперь растягиваются больше */
  min-height: min(8rem, 15vh);
  max-height: min(20rem, 45vh); /* Больший максимум для концептов */
}

.premium-concept {
  min-height: min(100px, 12vh);
  height: 100%; /* Концепты заполняют весь контейнер */
  aspect-ratio: 9 / 16;
  padding: min(1rem, 1.5vh) min(0.5rem, 1vh);
}

.concept-label {
  font-size: clamp(0.7rem, 1.8vh, 0.8rem);
}

/* 5. Загрузки имеют фиксированную высоту */
.premium-uploads {
  flex-shrink: 0; /* Дропзоны не растягиваются */
  min-height: min(200px, 25vh);
  max-height: min(240px, 30vh); /* Фиксированная максимальная высота */
  display: flex;
  gap: min(0.75rem, 1.5vh);
}

.premium-uploads > .premium-dropzone {
  flex: 1 1 0;
  height: 100%; /* Фиксированная высота равная родителю */
  min-height: 0; /* Убираем min-height чтобы не расширялось */
  max-height: none; /* Убираем max-height */
  padding: min(1.5rem, 2vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* Предотвращаем выход за границы */
}

.premium-dropzone .dz-icon {
  width: min(48px, 8vh);
  height: min(48px, 8vh);
}

.premium-dropzone .hint {
  font-size: clamp(0.7rem, 1.8vh, 0.875rem);
}

/* 6. Кнопки всегда видны внизу */
.premium-actions {
  flex-shrink: 0;
  min-height: min(3rem, 6vh);
  gap: min(0.75rem, 1.5vh);
}

.premium-actions .btn {
  min-height: min(44px, 7vh);
  padding: min(0.65rem, 1.2vh) min(1rem, 2vh);
  font-size: clamp(0.8rem, 2vh, 1rem);
}

/* 6. Адаптация для экранов с разной ВЫСОТОЙ */

/* Для экранов ниже 900px */
@media (max-height: 900px) {
  .premium-wrapper {
    min-height: calc(100vh - 100px);
  }
  .premium-panel { gap: 0.75rem; }
  .premium-concept { aspect-ratio: 9 / 14; min-height: 120px; }
  .premium-dropzone { min-height: 160px; }
  .btn { padding: 0.55rem 0.85rem; min-height: 40px; font-size: 0.9rem; }
}

/* Для экранов ниже 780px */
@media (max-height: 780px) {
  .premium-wrapper {
    min-height: calc(100vh - 80px);
  }
  .premium-panel { gap: 0.5rem; padding: 0.75rem; }
  .premium-concept { aspect-ratio: 9 / 12; min-height: 100px; }
  .premium-dropzone { min-height: 130px; padding: 1rem; }
  .premium-actions .btn { padding: 0.45rem 0.75rem; font-size: 0.85rem; min-height: 34px; }
  .btn { padding: 0.45rem 0.75rem; min-height: 34px; font-size: 0.85rem; }
  .nav a, .nav button { padding: 0.55rem 0.9rem; font-size: 0.8rem; }
  .profile-info { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
  .topbar .inner { padding: 0.5rem 0.7rem; }
}

/* Для экранов ниже 650px */
@media (max-height: 650px) {
  .premium-wrapper {
    min-height: calc(100vh - 70px);
  }
  .premium-concept { aspect-ratio: 4 / 3; min-height: 80px; }
  .premium-dropzone { min-height: 100px; padding: 0.75rem; }
  .premium-panel-header h2 { font-size: 1.2rem; margin-bottom: 0.25rem; }
  .premium-panel-header p { font-size: 0.875rem; }
  .btn { padding: 0.4rem 0.65rem; min-height: 30px; font-size: 0.8rem; }
  .nav a, .nav button { padding: 0.45rem 0.7rem; font-size: 0.75rem; }
  .premium-actions { gap: 0.4rem; }
  .topbar .inner { padding: 0.4rem 0.6rem; }
  .premium-panel { padding: 0.6rem; gap: 0.4rem; }
}

/* Для экстремально низких экранов */
@media (max-height: 500px) {
  .premium-wrapper {
    min-height: calc(100vh - 60px);
  }
  .premium-concepts {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .premium-concept {
    aspect-ratio: 3 / 2;
    min-height: 60px;
    padding: 0.5rem 0.25rem;
  }
  .concept-label { font-size: 0.7rem; }
  .premium-dropzone { min-height: 80px; padding: 0.5rem; }
  .premium-dropzone .dz-icon { width: 24px; height: 24px; }
  .btn { padding: 0.3rem 0.5rem; min-height: 26px; font-size: 0.7rem; }
  .nav a, .nav button { padding: 0.35rem 0.5rem; font-size: 0.65rem; }
  .topbar .inner { padding: 0.3rem 0.5rem; }
  .premium-panel { padding: 0.4rem; gap: 0.3rem; }
  .premium-actions { gap: 0.3rem; }
  .premium-panel-header h2 { font-size: 1rem; margin-bottom: 0.2rem; }
  .premium-panel-header p { font-size: 0.8rem; }
}

/* Для очень низких экранов - делаем всё компактнее */
@media (max-height: 420px) {
  .premium-wrapper {
    min-height: calc(100vh - 50px);
    gap: 0.5rem;
  }
  .premium-concepts { gap: 3px; }
  .premium-concept {
    min-height: 45px;
    padding: 0.3rem 0.2rem;
    aspect-ratio: 2 / 1;
  }
  .premium-dropzone { min-height: 60px; padding: 0.4rem; }
  .btn { padding: 0.25rem 0.4rem; min-height: 24px; font-size: 0.65rem; }
  .premium-panel { padding: 0.3rem; gap: 0.25rem; }
  .premium-actions { gap: 0.25rem; }
  .premium-panel-header h2 { font-size: 0.9rem; margin-bottom: 0.1rem; }
  .premium-panel-header p { font-size: 0.75rem; }
}

/* На экранах с большой высотой (от 901px), позволяем блокам загрузки растягиваться */
@media (min-height: 901px) {
  .premium-uploads {
    flex-grow: 1;
    min-height: 0; /* Allow shrinking if needed, good practice with flex-grow */
    max-height: none; /* Remove the max-height limit */
  }
}


/* Стандартная адаптация для ШИРИНЫ экрана */
@media (max-width: 1024px) {
  .premium-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
    min-height: auto;
    max-height: none;
  }
  
  .premium-panel {
    order: 1;
    height: auto;
    max-height: none;
    min-height: 600px; /* Минимальная высота на планшетах, чтобы все влезло */
  }
  
  .premium-results {
    order: 2;
  }
  
  /* Адаптация кнопок для планшетов */
  .btn { padding: 0.6rem 1rem; min-height: 42px; }
  .nav a, .nav button { padding: 0.65rem 1.1rem; }
}

@media (max-width: 640px) {
  .premium-panel { min-height: auto; } /* Убираем min-height на мобильных */
  .premium-uploads { flex-direction: row; }
  
  /* Адаптация кнопок для мобильных */
  .btn { padding: 0.7rem 1.2rem; min-height: 48px; font-size: 1rem; }
  .premium-actions .btn { width: 100%; }
  .nav a, .nav button { padding: 0.75rem 1.25rem; }
  .topbar .inner { padding: 0.6rem 0.8rem; }
}

/* Дополнительная адаптивность для маленьких мобильных экранов */
@media (max-width: 360px) {
  .btn { padding: 0.6rem 1rem; min-height: 44px; font-size: 0.9rem; }
  .nav a, .nav button { padding: 0.6rem 1rem; font-size: 0.8rem; }
  .premium-panel { padding: 0.75rem; }
  .topbar .inner { padding: 0.5rem 0.6rem; }
}

.dropzone.has-preview {
  border: 2px solid rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.05);
}



.dropzone.has-preview .dz-icon,
.dropzone.has-preview .hint {
  display: none;
}
/* Исправление размера дропзон при загрузке изображений */
.premium-dropzone {
  position: relative;
  overflow: hidden; /* Предотвращаем расширение при загрузке */
}

/* Фиксируем размеры preview изображения */
.premium-dropzone .dz-preview {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: none;
  border: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.premium-dropzone .dz-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* Скрываем иконки и подсказки при загрузке изображения */
.premium-dropzone.has-preview .dz-icon,
.premium-dropzone.has-preview .hint {
  display: none;
}

/* ====== Адаптация для мобильных устройств (добавлено по инструкции) ====== */

/* Для планшетов и больших телефонов */
@media (max-width: 1024px) {
  /* 1. Главный макет: Переход на одну колонку */
  .premium-wrapper {
    grid-template-columns: 1fr;
  }

  /* 3. Перестройка сеток контента */
  .premium-concepts {
    grid-template-columns: 1fr 1fr;
  }
  .premium-uploads {
    grid-template-columns: 1fr;
  }
  .premium-results .grid {
    grid-template-columns: 1fr 1fr;
  }
  .plans {
    grid-template-columns: 1fr;
  }
}

/* Для стандартных мобильных */
@media (max-width: 768px) {
  /* 2. Адаптация хедера (Топбара) */
  .brand span {
    display: none;
  }
  /* Показываем короткие лейблы и скрываем длинные на мобильных */
  .profile-info .pi-label-long,
  .profile-info .pi-total-wrap,
  .profile-info .pi-plan {
    display: none;
  }

  .profile-info .pi-label-short {
    display: inline;
  }
  
  /* Убеждаемся, что сам элемент с днями видим */
  .profile-info .pi-days {
    display: inline;
  }
  .nav a, .nav button {
    padding: 0.6rem 1rem; /* Уменьшаем внутренние отступы */
  }

  /* 3. Перестройка сеток контента (дальнейшая адаптация) */
  .premium-results .grid {
    grid-template-columns: 1fr;
  }

  /* 4. Типографика и отступы */
  h2 {
    font-size: 1.3rem;
  }
  :root {
    --container-padding: 1rem;
  }
  .premium-panel, .premium-results {
    padding: 1rem;
  }
}

/* Для маленьких мобильных */
@media (max-width: 480px) {
  /* 4. Типографика и отступы */
  :root {
    --container-padding: 0.75rem;
  }

  /* 3. Перестройка сеток контента */
  .premium-concepts {
    grid-template-columns: 1fr 1fr;
  }

  /* 5. Улучшение удобства использования (UX) */
  .premium-actions .btn {
    width: 100%;
  }
}
/* ====== ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ТОЛЬКО ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ ====== */

/* CSS переменные для мобильных */
 @media (max-width: 768px) {
  :root {
    --mobile-padding: 1rem;
    --mobile-gap: 0.75rem;
    --touch-target: 48px;
    --mobile-border-radius: 16px;
  }
}

/* Улучшения для touch-интерфейса */
 @media (max-width: 768px) {
  /* Touch оптимизация для всех интерактивных элементов */
  .btn, .nav a, .nav button, .auth-method, .premium-concept, .dropzone, .premium-dropzone, .icon-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  /* Улучшенная типографика для мобильных */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100%;
  }

  /* Минимальные размеры для touch-элементов */
  .btn {
    min-height: var(--touch-target);
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
  }

  .icon-btn {
    min-width: var(--touch-target);
    min-height: var(--touch-target);
  }

  /* Активные состояния для touch */
  .btn:active, .nav a:active, .nav button:active, .premium-concept:active, .auth-method:active {
    transform: translateY(0) !important;
    transition-duration: 0.1s;
  }
}

/* Топбар для мобильных */
@media (max-width: 768px) {
  .topbar {
    padding: 0 var(--mobile-padding);
  }

  .topbar .inner {
    padding: 0.625rem 0.875rem;
    margin: 0.375rem auto;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .brand {
    font-size: 1rem;
    order: 1;
  }

  .brand svg {
    width: 20px;
    height: 20px;
  }

  .nav {
    order: 2;
    width: 100%;
    justify-content: center;
    margin-left: 0;
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .nav a, .nav button {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    min-height: 40px;
    flex: 1;
    min-width: 0;
    text-align: center;
  }

  /* Скрываем профиль на мобильных */
  .profile-info {
    display: none;
  }
}

/* Адаптация главной страницы */
 @media (max-width: 1024px) {
  .premium-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    height: auto;
    max-height: none;
    padding: var(--mobile-padding);
  }
  
  .premium-panel {
    height: auto;
    min-height: 600px;
    gap: 1.25rem;
  }
  
  .premium-uploads {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    min-height: 200px;
  }
  
  .premium-dropzone {
    min-height: 200px;
    padding: 1.5rem;
  }
}

 @media (max-width: 768px) {
  .premium-wrapper {
    padding: var(--mobile-padding);
    gap: 1.25rem;
  }
  
  .premium-panel {
    padding: 1rem;
    gap: 1rem;
    min-height: 500px;
  }
  
  .premium-panel-header h2 {
    font-size: 1.25rem;
  }
  
  .premium-panel-header p {
    font-size: 0.875rem;
  }
  
  .premium-concepts {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .premium-concept {
    padding: 1rem 0.5rem;
    aspect-ratio: 3 / 4;
  }
  
  .concept-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 0.5rem;
  }
  
  .concept-label {
    font-size: 0.7rem;
  }
  
  /* Дропзоны в одну строку на мобильных */
  .premium-uploads, .uploads {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  
  .premium-dropzone, .dropzone {
    min-height: unset;
    height: auto;
    aspect-ratio: 4 / 3;
    padding: 1rem;
    /* Плавный переход для границы */
    transition: border-color .2s ease;
  }

  /* 2. Фиксируем размер при загрузке превью */
  .dropzone .dz-preview,
  .premium-dropzone .dz-preview {
    position: absolute;
    /* Уменьшим отступ для более плотного вида */
    inset: 6px;
    border-radius: 10px; /* Слегка уменьшим радиус для соответствия отступу */
    overflow: hidden;
  }

  .dropzone .dz-preview-img,
  .premium-dropzone .dz-preview-img {
    width: 100%;
    height: 100%;
    /* Меняем contain на cover, чтобы избавиться от черных полос */
    object-fit: contain;
    display: block;
  }

  /* Улучшаем вид дропзоны, когда в ней есть фото */
  .dropzone.has-preview,
  .premium-dropzone.has-preview {
    border-color: var(--primary);
    /* Добавляем внутреннюю тень для эффекта глубины */
    box-shadow: inset 0 0 10px rgba(0,0,0,.25);
  }
  
  .premium-dropzone .dz-icon, .dz-icon {
    width: 40px;
    height: 40px;
  }
  
  .premium-dropzone .hint, .dropzone .hint {
    font-size: 0.8rem;
  }
  
  .premium-actions .btn, .actions .btn {
    width: 100%;
    padding: 0.875rem;
    font-size: 0.95rem;
    min-height: var(--touch-target);
  }
}

/* Адаптация сеток */
 @media (max-width: 768px) {
  .cards, .plans {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .plan-card {
    padding: 1.25rem;
  }
}

/* Модальные окна для мобильных */
 @media (max-width: 768px) {
  .modal {
    background: rgba(4, 7, 15, 0.85);
    padding: var(--mobile-padding);
  }
  
  .dialog {
    margin: var(--mobile-padding);
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
  
  .dialog .head {
    padding: 1.25rem 1.5rem;
  }
  
  .dialog .content {
    padding: 1.5rem;
  }
}

/* Страница авторизации для мобильных */
 @media (max-width: 768px) {
  .auth-container {
    padding: 1rem;
    min-height: 100vh;
  }
  
  .auth-card {
    padding: 1.5rem;
    max-width: 100%;
  }
  
  .brand-logo h1 {
    font-size: 2rem;
  }
  
  .brand-logo svg {
    width: 48px;
    height: 48px;
  }
  
  .auth-card-header h2 {
    font-size: 1.5rem;
  }
  
  .auth-method {
    padding: 1rem;
    gap: 0.875rem;
    min-height: var(--touch-target);
  }
  
  .method-icon {
    width: 40px;
    height: 40px;
  }
  
  .form-input {
    padding: 0.875rem;
    font-size: 1rem;
    min-height: var(--touch-target);
    -webkit-appearance: none;
    appearance: none;
  }
  
  .form-actions .btn {
    min-height: var(--touch-target);
  }
}

/* Маленькие мобильные устройства */
@media (max-width: 480px) {
  :root {
    --mobile-padding: 0.75rem;
    --mobile-gap: 0.5rem;
    --touch-target: 44px;
  }
  
  .topbar .inner {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }
  
  .brand {
    font-size: 0.95rem;
  }
  
  .nav a, .nav button {
    padding: 0.45rem 0.6rem;
    font-size: 0.7rem;
    min-height: 36px;
  }
  
  .premium-panel {
    padding: 0.875rem;
    gap: 0.875rem;
    min-height: 450px;
  }
  
  .premium-panel-header h2 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
  }
  
  .premium-panel-header p {
    font-size: 0.8rem;
  }
  
  .premium-concepts {
    gap: 4px;
  }
  
  .premium-concept {
    padding: 0.75rem 0.375rem;
    aspect-ratio: 3 / 3;
  }
  
  .concept-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 0.375rem;
  }
  
  .concept-label {
    font-size: 0.65rem;
  }
  
  .premium-dropzone, .dropzone {
    min-height: 140px;
    padding: 1rem;
  }
  
  .premium-dropzone .dz-icon, .dz-icon {
    width: 32px;
    height: 32px;
  }
  
  .premium-dropzone .hint, .dropzone .hint {
    font-size: 0.75rem;
    margin-top: 0.5rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    min-height: var(--touch-target);
  }
  
  /* Авторизация на маленьких экранах */
  .auth-container {
    padding: 0.75rem;
  }
  
  .auth-card {
    padding: 1.25rem;
    border-radius: 20px;
  }
  
  .brand-logo h1 {
    font-size: 1.75rem;
  }
  
  .brand-logo svg {
    width: 40px;
    height: 40px;
  }
  
  .auth-card-header h2 {
    font-size: 1.375rem;
  }
  
  .auth-card-header p {
    font-size: 0.85rem;
  }
  
  .auth-method {
    padding: 0.875rem;
    gap: 0.75rem;
  }
  
  .method-icon {
    width: 36px;
    height: 36px;
  }
  
  .method-content h3 {
    font-size: 0.95rem;
  }
  
  .method-content p {
    font-size: 0.8rem;
  }
  
  .form-input {
    padding: 0.75rem 0.875rem;
    font-size: 0.95rem;
  }
  
  .dialog {
    border-radius: 20px;
  }
  
  .dialog .head {
    padding: 1rem 1.25rem;
  }
  
  .dialog .head strong {
    font-size: 1.125rem;
  }
  
  .dialog .content {
    padding: 1.25rem;
  }
}

/* Очень маленькие экраны */
 @media (max-width: 360px) {
  :root {
    --mobile-padding: 0.625rem;
    --mobile-gap: 0.375rem;
    --touch-target: 42px;
  }
  
  .topbar .inner {
    padding: 0.375rem 0.625rem;
  }
  
  .brand {
    font-size: 0.875rem;
  }
  
  .brand svg {
    width: 18px;
    height: 18px;
    margin-right: 4px;
  }
  
  .nav a, .nav button {
    padding: 0.4rem 0.5rem;
    font-size: 0.65rem;
    min-height: 32px;
  }
  
  .premium-panel {
    padding: 0.75rem;
    gap: 0.75rem;
    min-height: 400px;
  }
  
  .premium-panel-header h2 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
  }
  
  .premium-panel-header p {
    font-size: 0.75rem;
  }
  
  .premium-concepts {
    gap: 3px;
  }
  
  .premium-concept {
    padding: 0.5rem 0.25rem;
    aspect-ratio: 4 / 3;
  }
  
  .concept-icon {
    width: 16px;
    height: 16px;
    margin-bottom: 0.25rem;
  }
  
  .concept-label {
    font-size: 0.6rem;
    font-weight: 600;
  }
  
  .premium-dropzone, .dropzone {
    min-height: 120px;
    padding: 0.875rem;
  }
  
  .premium-dropzone .dz-icon, .dz-icon {
    width: 28px;
    height: 28px;
  }
  
  .premium-dropzone .hint, .dropzone .hint {
    font-size: 0.7rem;
  }
  
  .btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
    min-height: var(--touch-target);
  }
  
  .auth-card {
    padding: 1rem;
  }
  
  .brand-logo h1 {
    font-size: 1.5rem;
  }
  
  .brand-logo svg {
    width: 36px;
    height: 36px;
  }
  
  .auth-card-header h2 {
    font-size: 1.25rem;
  }
  
  .auth-method {
    padding: 0.75rem;
  }
  
  .method-icon {
    width: 32px;
    height: 32px;
  }
  
  .form-input {
    padding: 0.625rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* Адаптивность по высоте экрана для мобильных */
 @media (max-height: 700px) and (max-width: 768px) {
  .premium-panel {
    min-height: auto;
  }
  
  .premium-concepts {
    min-height: 120px;
  }
  
  .premium-concept {
    aspect-ratio: 3 / 2;
  }
  
  .premium-dropzone, .dropzone {
    min-height: 100px;
  }
  
  .auth-container {
    justify-content: flex-start;
    padding-top: 2rem;
  }
  
  .auth-hero {
    margin-bottom: 1rem;
  }
  
  .brand-logo h1 {
    font-size: 1.5rem;
  }
  
  .brand-logo svg {
    width: 40px;
    height: 40px;
  }
}

 @media (max-height: 600px) and (max-width: 480px) {
  .premium-concept {
    aspect-ratio: 2 / 1;
    padding: 0.5rem 0.25rem;
  }
  
  .premium-dropzone, .dropzone {
    min-height: 80px;
    padding: 0.75rem;
  }
  
  .auth-container {
    padding-top: 1rem;
  }
  
  .auth-card {
    padding: 0.875rem;
  }
  
  .brand-logo {
    margin-bottom: 0.75rem;
  }
  
  .auth-hero {
    margin-bottom: 0.75rem;
  }
}

/* Ландшафтная ориентация на мобильных */
 @media (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
  .premium-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: calc(100vh - 80px);
  }
  
  .premium-panel {
    height: 100%;
    min-height: 0;
    gap: 0.75rem;
  }
  
  .premium-concepts {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  
  .premium-concept {
    aspect-ratio: 3 / 2;
    padding: 0.5rem 0.25rem;
  }
  
  .premium-uploads {
    grid-template-columns: 1fr 1fr;
    min-height: 120px;
  }
  
  .premium-dropzone, .dropzone {
    min-height: 120px;
    padding: 1rem;
  }
  
  .auth-container {
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem;
  }
  
  .auth-hero {
    flex: 1;
    text-align: left;
    margin-bottom: 0;
  }
  
  .auth-card {
    flex: 1;
    max-width: 400px;
  }
}

/* Улучшения доступности на мобильных */
 @media (max-width: 768px) {
  /* Снижение анимаций для экономии батареи и производительности */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
    
    .premium-concept:hover,
    .premium-dropzone:hover,
    .btn:hover,
    .auth-method:hover {
      transform: none !important;
    }
  }
  
  /* Высокий контраст для мобильных */
  @media (prefers-contrast: high) {
    .btn {
      border-width: 2px;
    }
    
    .premium-concept.active {
      outline: 3px solid var(--primary);
      outline-offset: 2px;
    }
    
    .form-input:focus {
      outline: 2px solid var(--primary);
      outline-offset: 2px;
    }
  }
  
  /* Темная тема на мобильных */
  @media (prefers-color-scheme: dark) {
    .form-input {
      background: rgba(255, 255, 255, 0.03);
    }
    
    .premium-dropzone, .dropzone {
      background: rgba(255, 255, 255, 0.01);
    }
  }
}

/* Улучшения для устройств с высоким DPI */
 @media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2),
       (max-width: 768px) and (min-resolution: 192dpi) {
  .brand svg, .premium-brand svg, .dz-icon, .premium-dropzone .dz-icon {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Оптимизация для iOS Safari */
 @supports (-webkit-overflow-scrolling: touch) {
  @media (max-width: 768px) {
    .dialog {
      -webkit-overflow-scrolling: touch;
    }
    
    .form-input {
      -webkit-appearance: none;
      border-radius: 12px;
    }
    
    .btn {
      -webkit-appearance: none;
    }
  }
}

/* Скрываем короткие/мобильные лейблы по умолчанию (для десктопа) */
.profile-info .pi-label-short {
  display: none;
}
/* =================================================================== */
/* ====== АВТОРИТЕТНЫЙ БЛОК ДЛЯ АДАПТИВНОСТИ ХЕДЕРА (PROFILE INFO) ====== */
/* =================================================================== */

/* 
 * Этот блок должен находиться в самом конце styles.css, 
 * чтобы переопределить все предыдущие конфликтующие правила.
 */

/* --- Стили по умолчанию (ДЕСКТОП) --- */

/* Показываем полные текстовые метки */
.profile-info .pi-label-long {
  display: inline;
}
.profile-info .pi-total-wrap {
  display: inline;
}

/* Скрываем короткие мобильные метки */
.profile-info .pi-label-short {
  display: none !important; /* Используем !important для гарантии */
}

/* Показываем текст в кнопках хедера */
.topbar .nav .btn > .btn-text-desktop {
    display: inline-block;
    margin-left: 0.5rem; /* Отступ между иконкой и текстом */
}


/* --- Стили для МОБИЛЬНЫХ устройств (до 768px) --- */
@media (max-width: 768px) {

  /* Скрываем полные текстовые метки */
  .profile-info .pi-label-long,
  .profile-info .pi-total-wrap {
    display: none !important;
  }

  /* Показываем короткие мобильные метки */
  .profile-info .pi-label-short {
    display: inline !important;
  }
  
  /* Убеждаемся, что дни и их контейнер видимы */
  .profile-info .pi-item,
  .profile-info .pi-days {
    display: inline !important;
  }

  /* Скрываем текст в кнопках хедера, оставляя только иконки */
  .topbar .nav .btn > .btn-text-desktop {
    display: none !important;
  }
}
/* =================================================================== */
/* ====== РЕДИЗАЙН ПАНЕЛИ РЕЗУЛЬТАТОВ НА МОБИЛЬНЫХ ====== */
/* =================================================================== */

@media (max-width: 768px) {

  .premium-results {
    /* Гарантируем, что панель является позиционированным предком для оверлея */
    position: relative !important;
    /* Добавляем минимальную высоту, чтобы панель не "схлопывалась" */
    min-height: 300px;
    display: flex !important;
    flex-direction: column !important;
  }

  .premium-results .grid {
    flex-grow: 1 !important;
  }

  /* 1. Делаем плейсхолдер более подходящим для видео */
  .premium-placeholder {
    aspect-ratio: 16 / 9 !important;
    width: 100%;
  }

  /* 2. Улучшаем вид загрузчика */
  .premium-results .results-loading {
    background: rgba(8, 12, 25, 0.85) !important; /* Более плотный фон */
    border-radius: 16px; /* Скругляем углы в соответствии с панелью */
  }

  /* 3. Заставляем финальное видео заполнять контейнер */
  .premium-results .result-video {
    object-fit: cover !important;
  }
}