@font-face {
  font-family: "Benzin";
  src: url("/static/fonts/Benzin-Bold.woff2") format("woff2"),
       url("/static/fonts/Benzin-Bold.woff") format("woff");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0c10;
  color: #f5f5f5;
}

.home {
  background: radial-gradient(circle at top left, #12162a 0%, #0b0c10 55%)
      no-repeat,
    radial-gradient(circle at 80% 10%, #1b1230 0%, transparent 55%) no-repeat,
    radial-gradient(circle at 20% 80%, #0f1c2a 0%, transparent 50%) no-repeat,
    #0b0c10;
}

.orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  /* Single blur+saturate on the container = 1 GPU op instead of 10.
     Also removes mix-blend-mode from individual orbs so the GPU compositor
     thread can handle page scroll independently — the main cause of jank. */
  filter: blur(44px) saturate(130%);
  contain: layout paint;
}

.floating-words {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  /* Safari fix: clip-path instead of overflow:hidden prevents children
     from being stuck at 0,0 when transform is applied via JS */
  -webkit-clip-path: inset(0);
  clip-path: inset(0);
}

.bg-word {
  position: absolute;
  display: block;
  left: 0;
  top: 0;
  font-size: clamp(22px, 3.4vw, 52px);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(197, 207, 255, 0.16);
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(116, 146, 255, 0.2);
  will-change: transform;
  white-space: nowrap;
}

.bg-emoji {
  position: absolute;
  display: block;
  left: 0;
  top: 0;
  font-size: clamp(40px, 5.5vw, 88px);
  opacity: 1;
  filter: drop-shadow(0 0 14px rgba(255, 240, 120, 0.55));
  will-change: transform;
  white-space: nowrap;
  user-select: none;
}

.orb {
  position: absolute;
  width: var(--size);
  height: var(--size);
  left: var(--x);
  top: var(--y);
  border-radius: 50%;
  opacity: var(--opacity);
  /* No individual filter: blur() — moved to container (1 pass instead of 10) */
  /* No mix-blend-mode: screen — this was forcing main-thread compositing, killing scroll smoothness */
  background: radial-gradient(
    circle at 30% 30%,
    hsla(var(--hue), 85%, 68%, 1),
    hsla(calc(var(--hue) + 40), 80%, 50%, 0.6) 50%,
    transparent 72%
  );
  animation: float var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
  will-change: transform;
}

@keyframes float {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(30px, -40px, 0) scale(1.05);
  }
  100% {
    transform: translate3d(-20px, 20px, 0) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb {
    animation: none;
  }
  .bg-word {
    animation: none;
  }
  .brand {
    animation: none;
  }
  .loading-glow {
    animation: none;
  }
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 76px 20px 60px;
  position: relative;
  z-index: 2;
}

.landing {
  max-width: none;
  width: 100%;
  padding: 28px 36px 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 2;
}

/* Single continuous page — no height cap, flows as one scroll */
.landing-page {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 28px 36px 80px;
  display: flex;
  flex-direction: column;
}

.top-nav {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 3;
  align-items: flex-start;
  min-height: 76px;
}
.tg-icon-btn {
  position: absolute;
  left: 0;
  top: 0;
  color: #2AABEE;
  text-decoration: none;
  padding: 10px;
  border-radius: 12px;
  transition: color 0.2s, background 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px rgba(42,171,238,0.5));
}
.tg-icon-btn:hover {
  color: #fff;
  background: rgba(42,171,238,0.2);
  transform: scale(1.12);
  filter: drop-shadow(0 0 10px rgba(42,171,238,0.8));
}

.pick-model-btn {
  display: inline-block;
  text-decoration: none;
  color: #ffffff;
  background: rgba(17, 24, 39, 0.72);
  border: 1px solid rgba(95, 130, 255, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.glow {
  box-shadow: 0 0 22px rgba(96, 165, 250, 0.35), inset 0 0 12px rgba(59, 130, 246, 0.18);
}

.pick-model-btn:hover {
  transform: translateY(-1px);
  border-color: #60a5fa;
}

.start-generate-btn {
  display: inline-block;
  text-decoration: none;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.85), rgba(124, 58, 237, 0.85));
  border: 1px solid rgba(125, 167, 255, 0.65);
  border-radius: 999px;
  padding: 11px 24px;
  font-family: "Benzin", sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
}

.top-auth {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.global-model-btn {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  text-decoration: none;
  color: #fff;
  background: rgba(19, 28, 53, 0.78);
  border: 1px solid rgba(108, 136, 255, 0.55);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
}

.auth-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 8px;
}

.user-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(91, 122, 216, 0.4);
  color: #dbe8ff;
  font-size: 12px;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(28px, 4vh, 60px);
  height: calc(100svh - 88px);
  min-height: 460px;
  position: relative;
}

/* Category pill nav */
.cat-pills {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 3;
  position: relative;
}
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: #e2e8f0;
  background: rgba(17, 24, 39, 0.65);
  border: 1px solid rgba(120, 160, 255, 0.35);
  border-radius: 999px;
  padding: 13px 28px;
  font-size: 16px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.cat-pill:hover {
  background: rgba(77, 130, 255, 0.2);
  border-color: rgba(120, 160, 255, 0.7);
  transform: translateY(-2px);
}
.cat-pill-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4d82ff, #7c5cf2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
}

/* Banana scroll arrow */
.scroll-hint {
  margin-top: 12px;
  z-index: 4;
  text-decoration: none;
  animation: scroll-bounce 2.4s ease-in-out infinite;
  cursor: pointer;
  user-select: none;
}
.banana-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  /* Safari fix: filter on container, not on individual elements with transform */
  -webkit-filter: drop-shadow(0 0 7px rgba(255,200,0,0.45));
  filter: drop-shadow(0 0 7px rgba(255,200,0,0.45));
}
.ba-s {
  font-size: 28px;
  line-height: 1;
  display: block;
  transform: rotate(90deg);
  opacity: 0.9;
}
.ba-wide {
  display: flex;
  gap: 32px;
  margin-top: 2px;
}
.ba-wide span {
  font-size: 28px;
  line-height: 1;
  display: block;
  transform: rotate(90deg);
  opacity: 0.95;
}
.ba-close {
  display: flex;
  gap: 8px;
}
.ba-close span {
  font-size: 28px;
  line-height: 1;
  display: block;
  transform: rotate(90deg);
  opacity: 1;
}
.ba-tip {
  font-size: 36px;
  line-height: 1;
  display: block;
  transform: rotate(90deg);
  margin-top: 2px;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0);    opacity: 0.6; }
  50%       { transform: translateY(10px); opacity: 1; }
}

.brand {
  margin: 0;
  font-family: "Benzin", sans-serif;
  font-size: clamp(78px, 14vw, 190px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #7dd3fc, #a78bfa, #f472b6, #34d399, #7dd3fc);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 26px rgba(96, 165, 250, 0.45), 0 0 64px rgba(167, 139, 250, 0.3);
  animation: brand-float 7.5s ease-in-out infinite, brand-shift 5s linear infinite;
  line-height: 0.9;
  text-align: center;
  position: relative;
  z-index: 3;
}

.welcome-brand {
  font-family: "Benzin", sans-serif;
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: clamp(44px, 8vw, 116px);
  line-height: 1.0;
  max-width: min(96vw, 1200px);
}

@keyframes brand-float {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -16px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes brand-shift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 220% 50%;
  }
}

.page-header h1 {
  margin: 0 0 10px;
  font-size: 32px;
}

.page-header p {
  margin: 0;
  color: #b8b8b8;
}

.grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: 12px;
  background: rgba(18, 20, 27, 0.78);
  border: 1px solid rgba(75, 86, 120, 0.4);
  box-shadow: 0 10px 30px rgba(7, 9, 18, 0.35);
  backdrop-filter: blur(8px);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
  box-shadow: 0 16px 36px rgba(12, 15, 28, 0.55);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
}

.card-subtitle {
  font-size: 14px;
  color: #9aa0aa;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: #3b82f6;
  text-decoration: none;
}

.detail {
  margin-top: 20px;
  padding: 20px;
  background: #12141b;
  border-radius: 12px;
  border: 1px solid #1f2230;
}

.model-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.model-workspace .detail {
  margin-top: 0;
}

.model-workspace.simple-ui {
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  align-items: start;
}

.model-workspace.simple-ui #motion-video-field,
.model-workspace.simple-ui #audio-field {
  display: none !important;
}
/* #resolution-field не скрыт в simple-ui — nano-banana-2 использует его для выбора 1K/4K */

.model-workspace.simple-ui .generate-form textarea {
  min-height: 170px;
}

@media (max-width: 980px) {
  .model-workspace.simple-ui {
    grid-template-columns: 1fr;
  }
}

.examples-note {
  margin: 6px 0 14px;
  color: #9eb0d1;
  font-size: 13px;
}

.examples-empty {
  margin: 0;
  color: #95a3bf;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.example-card {
  background: rgba(11, 16, 30, 0.75);
  border: 1px solid #26304a;
  border-radius: 12px;
  padding: 12px;
}

.example-card video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #2e3a5c;
  background: #05070e;
}

.example-card img {
  width: 220px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #2e3a5c;
  background: #05070e;
  display: block;
}

.prompt-toggle {
  margin-top: 8px;
}

.prompt-toggle summary {
  cursor: pointer;
  color: #77a8ff;
}

.prompt-toggle pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  color: #c7d3f0;
  margin: 8px 0 0;
}

.generate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 14px;
  color: #c8cfde;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

textarea,
select,
input[type="file"],
input[type="text"] {
  width: 100%;
  border: 1px solid #2d3448;
  background: #0f1118;
  color: #f5f5f5;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

textarea:focus,
select:focus,
input[type="file"]:focus,
input[type="text"]:focus {
  border-color: #3b82f6;
}

.submit-btn {
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  color: #fff;
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.result-link {
  display: inline-block;
  margin-top: 12px;
  color: #60a5fa;
  text-decoration: none;
}

.result-media {
  margin-top: 12px;
}

.result-media video,
.result-media img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #2e3a5c;
  background: #05070e;
  max-height: 520px;
  object-fit: contain;
}

.image-preview-wrap {
  margin-top: 12px;
  border: 1px solid #26304a;
  border-radius: 12px;
  padding: 8px;
  background: rgba(11, 16, 30, 0.75);
  width: 100%;
}

.image-preview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.image-preview-list.preview-stack {
  grid-template-columns: 1fr;
}

.image-preview-list img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  background: #05070e;
  border: 1px solid #2e3a5c;
}

.image-preview-item {
  position: relative;
}

.image-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(3, 7, 18, 0.78);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-remove-btn:hover {
  background: rgba(15, 23, 42, 0.95);
}

.hidden-file-input {
  position: absolute;
  left: -9999px;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.image-dropzone {
  border: 2px dashed #3a4568;
  border-radius: 14px;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: rgba(21, 26, 40, 0.55);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  padding: 18px;
  text-align: center;
}

.image-dropzone:hover,
.image-dropzone.drag-over {
  border-color: #6ea8ff;
  background: rgba(30, 39, 63, 0.62);
  transform: translateY(-1px);
}

.image-drop-icon {
  font-size: 34px;
  opacity: 0.9;
}

.image-drop-title {
  font-size: 20px;
  color: #dbe7ff;
}

.image-drop-subtitle {
  font-size: 14px;
  color: #98a8c9;
}

.image-drop-btn {
  margin-top: 4px;
  border-radius: 12px;
  padding: 10px 22px;
  background: linear-gradient(135deg, #4d82ff, #5e7cf2);
  color: #fff;
  font-weight: 600;
}

.image-dropzone.has-images .image-drop-icon,
.image-dropzone.has-images .image-drop-title,
.image-dropzone.has-images .image-drop-subtitle,
.image-dropzone.has-images .image-drop-btn {
  display: none;
}

.warn-text {
  margin: 0 0 14px;
  color: #fda4af;
  font-size: 14px;
}

/* Start / End frame two-column upload */
.start-end-frames {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.frame-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.frame-slot > span {
  font-size: 13px;
  color: #98a8c9;
  font-weight: 500;
  text-align: center;
}
.frame-dropzone {
  border: 2px dashed #3a4568;
  border-radius: 14px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: rgba(21, 26, 40, 0.55);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  padding: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.frame-dropzone:hover,
.frame-dropzone.drag-over {
  border-color: #6ea8ff;
  background: rgba(30, 39, 63, 0.62);
  transform: translateY(-1px);
}
.frame-drop-icon { font-size: 30px; opacity: 0.9; }
.frame-drop-title { font-size: 15px; color: #dbe7ff; }
.frame-drop-subtitle { font-size: 13px; color: #98a8c9; }
.frame-drop-btn {
  margin-top: 2px;
  border-radius: 10px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #4d82ff, #5e7cf2);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.frame-dropzone.has-image .frame-drop-icon,
.frame-dropzone.has-image .frame-drop-title,
.frame-dropzone.has-image .frame-drop-subtitle,
.frame-dropzone.has-image .frame-drop-btn { display: none; }
.frame-img-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0; left: 0;
  border-radius: 12px;
  display: none;
}
.frame-dropzone.has-image .frame-img-preview { display: block; }
.frame-remove-btn {
  display: none;
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.65);
  border: none;
  border-radius: 50%;
  width: 28px; height: 28px;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.frame-dropzone.has-image .frame-remove-btn { display: flex; }
@media (max-width: 500px) {
  .start-end-frames { grid-template-columns: 1fr; }
}

.loading-box {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(91, 111, 255, 0.35);
  background: rgba(13, 18, 35, 0.7);
  position: relative;
  overflow: hidden;
}

.loading-glow {
  position: absolute;
  inset: -40% -10%;
  background: radial-gradient(circle, rgba(76, 126, 255, 0.25) 0%, transparent 60%);
  animation: pulse-glow 2.2s ease-in-out infinite;
}

.loading-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(34, 43, 79, 0.9);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.loading-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5, #3b82f6, #22d3ee);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.55);
  transition: width 0.55s ease;
}

.loading-text {
  margin-top: 8px;
  font-size: 13px;
  color: #d7e2ff;
  position: relative;
  z-index: 1;
}

.hidden {
  display: none;
}

.danger-btn {
  margin-top: 10px;
  border: 1px solid #7f1d1d;
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.auth-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.auth-btn {
  text-decoration: none;
  text-align: center;
}

@keyframes pulse-glow {
  0% {
    transform: translateX(-12%);
    opacity: 0.45;
  }
  50% {
    transform: translateX(10%);
    opacity: 0.7;
  }
  100% {
    transform: translateX(-12%);
    opacity: 0.45;
  }
}

/* ─── Hero three-button group ──────────────────────────────────── */
.hero-btn-group {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-btn-group .start-generate-btn {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.hero-btn-group .start-generate-btn:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 0 28px rgba(96, 165, 250, 0.4);
}

/* Side buttons: slightly muted vs the glowing center */
.hero-btn-group .start-generate-btn:not(.glow) {
  background: linear-gradient(135deg, rgba(30, 41, 70, 0.88), rgba(55, 38, 95, 0.88));
  border-color: rgba(125, 100, 255, 0.5);
  font-size: 15px;
  font-weight: 700;
}

/* ─── Balance page ──────────────────────────────────────────────── */
.balance-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .balance-layout {
    grid-template-columns: 1fr;
  }
}

.balance-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.balance-card {
  background: rgba(14, 20, 45, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.15);
}

.balance-card-label {
  font-size: 13px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.balance-amount {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.balance-gem {
  font-size: 40px;
  line-height: 1;
}

.balance-number {
  font-size: 56px;
  font-weight: 900;
  background: linear-gradient(135deg, #a5b4fc, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.balance-card-sub {
  margin-top: 8px;
  font-size: 14px;
  color: #666;
}

.balance-hint {
  background: rgba(14, 20, 45, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px 18px;
}

.balance-hint p {
  margin: 4px 0;
  font-size: 13px;
  color: #888;
  line-height: 1.5;
}

.balance-packages-title {
  font-size: 18px;
  font-weight: 700;
  color: #c7d2fe;
  margin: 0 0 20px;
}

.balance-packages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.balance-pkg {
  position: relative;
  background: rgba(14, 20, 45, 0.82);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 18px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.balance-pkg:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 28px rgba(99, 102, 241, 0.18);
}

.balance-pkg--popular {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 32px rgba(99, 102, 241, 0.2);
}

.balance-pkg-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.balance-pkg-badge--max {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.balance-pkg-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.balance-pkg-credits {
  font-size: 26px;
  font-weight: 800;
  color: #e0e7ff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.balance-pkg-gem {
  font-size: 20px;
}

.balance-pkg-price {
  font-size: 22px;
  font-weight: 700;
  color: #a5b4fc;
}

.balance-pkg-per {
  font-size: 12px;
  color: #555;
  margin-bottom: 8px;
}

.balance-pkg-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 10px;
  color: #a5b4fc;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  margin-top: auto;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.balance-pkg-btn:hover {
  background: rgba(99, 102, 241, 0.35);
  border-color: #6366f1;
}

.balance-pkg-btn--popular {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.5));
  border-color: #6366f1;
  color: #fff;
}

.balance-pkg-btn--popular:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.75), rgba(139, 92, 246, 0.75));
}

/* ─── My Generations page ───────────────────────────────────────── */
.gen-empty {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.gen-empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
}

.gen-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.gen-card {
  background: rgba(14, 20, 45, 0.82);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 16px;
  padding: 20px 22px;
  transition: border-color 0.15s ease;
}

.gen-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
}

.gen-card-header {
  margin-bottom: 12px;
}

.gen-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gen-model {
  font-size: 14px;
  font-weight: 700;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  padding: 3px 10px;
}

.gen-cost {
  font-size: 13px;
  color: #fbbf24;
  font-weight: 600;
}

.gen-date {
  font-size: 12px;
  color: #555;
  margin-left: auto;
}

.gen-card-prompt {
  margin-bottom: 14px;
}

.gen-prompt-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #555;
  display: block;
  margin-bottom: 4px;
}

.gen-prompt-text {
  font-size: 14px;
  color: #c0cff0;
  line-height: 1.55;
  margin: 0;
  max-height: 4.65em; /* ~3 lines */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.gen-media-toggle {
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  overflow: hidden;
}

.gen-media-toggle[open] .gen-media-summary-icon {
  transform: rotate(90deg);
}

.gen-media-summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 16px;
  font-size: 13px;
  color: #7c8fc8;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.08);
  user-select: none;
  transition: background 0.15s ease;
}

.gen-media-summary::-webkit-details-marker {
  display: none;
}

.gen-media-summary:hover {
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
}

.gen-media-summary-icon {
  display: inline-block;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.gen-media-wrap {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.gen-media-video,
.gen-media-img {
  width: 100%;
  max-width: 640px;
  border-radius: 10px;
  display: block;
}

.gen-download-btn {
  font-size: 13px;
  color: #7c8fc8;
  text-decoration: none;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  padding: 6px 16px;
  transition: background 0.15s ease, color 0.15s ease;
}

.gen-download-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.gen-no-media {
  font-size: 13px;
  color: #444;
  font-style: italic;
}

/* ─── Balance notice ────────────────────────────────────────────── */
.balance-notice {
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid;
}

.balance-notice--ok {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.balance-notice--err {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* ─── Trends Section ─────────────────────────────────────────── */

.trends-section {
  width: 100%;
  padding: 20px 0 60px;
  position: relative;
  z-index: 2;
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}

.trends-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 40px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.trends-title {
  font-family: "Benzin", sans-serif;
  font-size: clamp(32px, 5vw, 60px);
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #e2e8f0, #a78bfa, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  line-height: 1;
}

.trends-subtitle {
  font-size: 14px;
  color: rgba(160, 170, 200, 0.6);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 1200px) {
  .trends-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .trends-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.trend-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 9 / 14;
  background: rgba(14, 15, 26, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  contain: layout paint;
  /* reveal animation — starts hidden */
  opacity: 0;
  transform: translateY(36px) scale(0.97);
  transition: opacity 0.55s cubic-bezier(0.2, 0.8, 0.3, 1),
              transform 0.55s cubic-bezier(0.2, 0.8, 0.3, 1),
              box-shadow 0.3s ease;
}

.trend-card.visible {
  opacity: 1;
  transform: none;
}

.trend-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(124, 58, 237, 0.15);
}

.trend-card-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.trend-card:hover .trend-card-media {
  transform: scale(1.05);
}

/* gradient overlay at bottom */
.trend-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 45%,
    rgba(6, 6, 12, 0.55) 70%,
    rgba(6, 6, 12, 0.92) 100%
  );
  pointer-events: none;
}

/* camera icon — top-left */
.trend-card-icon {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(8, 8, 16, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

/* "Популярное" badge — top-right */
.trend-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.88), rgba(236, 72, 153, 0.88));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: "Benzin", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  text-transform: uppercase;
}

/* title at bottom */
.trend-card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 100px 16px 14px;
  font-family: "Benzin", sans-serif;
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  line-height: 1.3;
  pointer-events: none;
}

/* "Создать" button — bottom-right */
.trend-card-create {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.88), rgba(124, 58, 237, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  font-family: "Benzin", sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  text-decoration: none;
  letter-spacing: 0.05em;
  backdrop-filter: blur(8px);
  z-index: 5;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.trend-card-create:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.trends-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(160, 170, 200, 0.35);
  font-size: 15px;
  padding: 60px 0;
  font-style: italic;
}

/* ─── Admin Trends Page ──────────────────────────────────────── */

.admin-trends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.admin-trend-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 9 / 14;
  background: #13141d;
  border: 1px solid rgba(75, 86, 120, 0.4);
}

.admin-trend-card-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-trend-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(6,6,12,0.9) 100%);
}

.admin-trend-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 10px 12px;
}

.admin-trend-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 6px;
}

.admin-trend-card-delete {
  display: inline-block;
  background: rgba(239, 68, 68, 0.75);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
}

.admin-trend-card-delete:hover {
  background: rgba(239, 68, 68, 1);
}

.admin-trend-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(124, 58, 237, 0.85);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
