* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --tg-theme-bg-color: #1B2629;
  --tg-theme-text-color: #ffffff;
  --tg-theme-hint-color: #a1a1aa;
  --tg-theme-link-color: #DECA8F;
  --tg-theme-button-color: #5F7374;
  --tg-theme-button-text-color: #ffffff;
  
  /* New color scheme */
  --primary-color: #DECA8F;  /* yellow */
  --secondary-color: #D4B5A1; /* pink */
  --accent-green: #5F7374;   /* green */
  --success-color: #5F7374;
  --error-color: #ef4444;
  --gradient: linear-gradient(135deg, #DECA8F 0%, #D4B5A1 50%, #5F7374 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(222, 202, 143, 0.1) 0%, rgba(212, 181, 161, 0.1) 50%, rgba(95, 115, 116, 0.1) 100%);
  
  /* Dark theme colors with new background */
  --bg-primary: #1B2629;
  --bg-secondary: #2A3A3E;
  --bg-card: #344A4F;
  --bg-hover: #3E5A60;
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: #5F7374;
  --border-hover: #DECA8F;
}

@font-face {
  font-family: 'DrukTextWideTT';
  src: url('druktextwidecyr-medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: 'DrukTextWideTT', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0;
}

/* Header - 130PX */
.compact-header {
  background: var(--gradient);
  color: white;
  padding: 0.75rem 0;
  border-radius: 0 0 1.5rem 1.5rem;
  margin-bottom: 1.5rem;
  height: 130px;
  overflow: hidden;
}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  height: 100%;
  gap: 1rem;
}

.compact-logo {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

.compact-progress {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: -20px;
  margin-left: 0px; /* Сдвинули на 50px вправо (было -50px, стало 0px) */
}

/* Кнопка-цветочек с токенами */
.token-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px; /* Сдвинули еще на 50px вправо (было -40px, стало 10px) */
}

.token-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient); /* Используем основной градиент вместо розового */
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 2px 8px rgba(222, 202, 143, 0.3); /* Изменили цвет тени */
}

.token-button:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(222, 202, 143, 0.5); /* Изменили цвет тени при наведении */
}

.flower-icon {
  width: 16px;
  height: 16px;
  color: #2d5a2d; /* Темно-зеленый цвет для иконки цветка */
}

.token-count {
  font-size: 12px;
  font-weight: bold;
  color: var(--text-primary);
  background: var(--bg-card);
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  min-width: 32px;
  text-align: center;
}

/* Модальное окно покупки токенов */
.token-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.token-modal-content {
  background: var(--bg-primary);
  border-radius: 1rem;
  padding: 1.6rem;
  max-width: 300px;
  width: 90%;
  text-align: center;
  border: 1px solid var(--border-color);
}

.token-modal h3 {
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  font-size: 0.96rem;
}

.token-modal p {
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.token-packages {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.token-package {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.token-package:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.token-package.selected {
  border-color: var(--primary-color);
  background: rgba(255, 107, 157, 0.1);
}

.package-group {
  margin-bottom: 1.2rem;
}

.package-group:last-child {
  margin-bottom: 0;
}

.package-group-title {
  color: var(--text-secondary);
  font-size: 0.72rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.token-package h4 {
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
}

.token-package .tokens-info {
  color: var(--text-secondary);
  font-size: 0.68rem;
  margin-bottom: 0.4rem;
}

.token-package .price {
  color: var(--primary-color);
  font-weight: bold;
  font-size: 0.88rem;
}

.buy-tokens-btn {
  background: linear-gradient(135deg, #ff6b9d, #ff8fab);
  color: white;
  border: none;
  border-radius: 0.75rem;
  padding: 0.8rem 1.6rem;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.buy-tokens-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

.buy-tokens-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.close-modal {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem;
}

.compact-step {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.step-icon {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.compact-step.active {
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.1);
}

.logo-image {
  max-width: 100%;
  max-height: 15px;
  width: auto;
  height: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
  padding: 0.0625rem 0.125rem;
}

/* Progress Bar */
.progress-bar {
  display: flex;
  justify-content: center;
  gap: 0.0625rem;
  margin-top: 0.0625rem;
  padding: 0 0.125rem 0.0625rem;
}

.progress-step {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.step-icon {
  width: 6px;
  height: 6px;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.progress-step.active {
  background: rgba(0, 0, 0, 0.4);
  transform: scale(1.05);
}

.progress-step.active .step-icon {
  color: var(--accent-green);
  filter: drop-shadow(0 0 8px var(--accent-green));
}

.progress-step.completed {
  background: rgba(49, 200, 125, 0.2);
}

.progress-step.completed .step-icon {
  color: var(--accent-green);
}

/* Main Content */
.main-content {
  padding: 0 1.5rem 2rem;
}

/* Step Sections */
.step-section {
  display: none;
  animation: fadeIn 0.5s ease;
}

.step-section.active {
  display: block;
}

.step-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Upload Section */
.upload-box {
  border: 3px dashed var(--border-color);
  border-radius: 1.5rem;
  padding: 2rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-card);
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-box:hover {
  border-color: var(--accent-green);
  background: var(--bg-hover);
}

.upload-placeholder {
  text-align: center;
}

.upload-icon {
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

.upload-icon-svg {
  width: 80px;
  height: 80px;
  color: var(--accent-green);
  filter: drop-shadow(0 0 12px rgba(49, 200, 125, 0.5));
}

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

.upload-placeholder h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.upload-placeholder p {
  color: var(--text-muted);
}

.preview-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Categories Grid - 3 колонки, меньше размер */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.category-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 156px;
  width: 100%;
}

.category-card:hover {
  border-color: var(--accent-green);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(49, 200, 125, 0.2);
  background: var(--bg-hover);
}

.category-card.selected {
  border-color: var(--accent-green);
  background: var(--gradient-subtle);
  box-shadow: 0 8px 24px rgba(49, 200, 125, 0.3);
}

.category-card--disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(0.85);
  border-color: var(--border-color);
  background: var(--bg-card);
}

.category-card--disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-color);
  background: var(--bg-card);
}

.category-card--disabled .category-name {
  color: #8a8f9a;
}

.category-soon {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
  margin-top: 0.15rem;
}

.category-icon {
  max-width: 86px;
  max-height: 130px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  margin-bottom: 0.4rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.category-name {
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* Prompts Grid - 3 колонки, меньше размер */
.prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
  max-height: 400px;
  overflow-y: auto;
}

/* Стильный скроллбар для промптов */
.prompts-grid::-webkit-scrollbar {
  width: 8px;
}

.prompts-grid::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.prompts-grid::-webkit-scrollbar-thumb {
  background: var(--accent-green);
  border-radius: 4px;
}

.prompts-grid::-webkit-scrollbar-thumb:hover {
  background: #2ab36d;
}

.prompt-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 156px;
  width: 100%;
}

.prompt-card:hover {
  border-color: var(--accent-green);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(49, 200, 125, 0.2);
  background: var(--bg-hover);
}

.prompt-card.selected {
  border-color: var(--accent-green);
  background: var(--gradient-subtle);
  box-shadow: 0 8px 24px rgba(49, 200, 125, 0.3);
}

.prompt-icon {
  max-width: 86px;
  max-height: 130px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  margin-bottom: 0.4rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.prompt-name {
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* Custom Prompt */
.custom-prompt-section {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.custom-prompt-section h3 {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.custom-prompt-section textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 1rem;
  font-size: 0.95rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  resize: vertical;
  transition: border-color 0.3s ease;
  background: var(--bg-card);
  color: var(--text-primary);
}

.custom-prompt-section textarea:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(49, 200, 125, 0.1);
}

/* Aspect Ratios Grid */
.aspect-ratios-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.aspect-ratio-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 1rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  width: 160px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.aspect-ratio-card:hover {
  border-color: var(--accent-green);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(49, 200, 125, 0.2);
  background: var(--bg-hover);
}

.aspect-ratio-card.selected {
  border-color: var(--accent-green);
  background: var(--gradient-subtle);
  box-shadow: 0 8px 24px rgba(49, 200, 125, 0.3);
}

.aspect-ratio-preview {
  width: 120px;
  height: 120px;
  margin: 0 auto 5px;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.aspect-ratio-name {
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Navigation Buttons */
.navigation-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.navigation-buttons .btn {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: block;
  margin-bottom: 0.75rem;
  font-family: 'DrukTextWideTT', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn:last-child {
  margin-bottom: 0;
}

.btn-primary {
  background: var(--gradient);
  color: #1a1625;
  box-shadow: 0 4px 12px rgba(49, 200, 125, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(49, 200, 125, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent-green);
}

.btn-generate {
  background: var(--gradient);
  color: #1a1625;
  box-shadow: 0 4px 12px rgba(49, 200, 125, 0.3);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-generate:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(49, 200, 125, 0.4);
}

.btn-video {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1a1625;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-video:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.btn-video:active {
  transform: translateY(0);
}

/* Loading Section */
.loading-content {
  text-align: center;
  padding: 3rem 0;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--bg-card);
  border-top: 4px solid var(--accent-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-content h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.loading-content p {
  color: var(--text-muted);
}

/* Result Section */
.result-box {
  margin-bottom: 1.5rem;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.result-image {
  width: 100%;
  display: block;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Video Result Section */
.video-result-box {
  margin-bottom: 1.5rem;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  background: #000;
}

.result-video {
  width: 100%;
  display: block;
  max-height: 70vh;
}

/* Loading Progress */
.loading-progress {
  margin-top: 2rem;
  text-align: center;
}

.progress-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Error Message */
.error-message {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-top: 1rem;
  text-align: center;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 480px) {
  .header {
    min-height: 450px;
  }
  
  .logo-image {
    max-height: 350px;
    padding: 1.5rem 1.5rem;
  }

  .step-section h2 {
    font-size: 1.25rem;
  }

  .categories-grid,
  .prompts-grid {
    gap: 0.75rem;
  }

  .aspect-ratios-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .main-content {
    padding: 0 1rem 2rem;
  }

  .progress-step {
    width: 42px;
    height: 42px;
  }
  
  .step-icon {
    width: 24px;
    height: 24px;
  }
}

/* Telegram Mini App specific styles */
.telegram-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
}

.telegram-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Telegram WebApp specific adjustments */
body.telegram-webapp {
  padding-top: 0;
  margin-top: 0;
}

body.telegram-webapp .header {
  padding-top: 0.5rem;
}

/* Mobile optimizations for Telegram */
@media (max-width: 768px) {
  .telegram-close-btn {
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
}
