body {
  background: linear-gradient(145deg, #f7f0fc 0%, #e9def0 100%);
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
}

.card-meme {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  border-radius: 2.5rem;
  border: none;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.card-meme:hover {
  box-shadow: 0 30px 50px -16px rgba(0, 0, 0, 0.3);
}

.meme-preview {
  background: #1a1a2e;
  border-radius: 2rem;
  overflow: hidden;
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #2d2d44;
  background-image: radial-gradient(circle at 20% 30%, #4a4a6a 0%, #1e1e32 90%);
  position: relative;
}

#memeCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  background: #1a1a2e;
  border-radius: 1.5rem;
  transition: 0.2s;
}

.template-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.template-item {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: 0.2s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  background: white;
  flex-shrink: 0;
}

.template-item:hover {
  transform: scale(1.05);
  border-color: #a78bfa;
}

.template-item.active {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.3);
}

.template-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker-wrapper input[type="color"] {
  width: 50px;
  height: 50px;
  border: 2px solid #ddd;
  border-radius: 30px;
  padding: 3px;
  cursor: pointer;
  background: white;
}

.upload-area {
  border: 2px dashed #c4b5d4;
  border-radius: 30px;
  padding: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.4);
  transition: 0.2s;
  cursor: pointer;
}

.upload-area:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: #7c3aed;
}

.upload-area.dragover {
  background: rgba(124, 58, 237, 0.15);
  border-color: #7c3aed;
}

.upload-label {
  cursor: pointer;
  display: block;
  width: 100%;
  padding: 20px;
  text-align: center;
}

.btn-fun {
  border-radius: 60px;
  padding: 12px 28px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: 0.2s;
}

.btn-fun-primary {
  background: #7c3aed;
  color: white;
  border: none;
}

.btn-fun-primary:hover {
  background: #6d28d9;
  transform: translateY(-3px);
  box-shadow: 0 12px 20px -8px #7c3aed80;
  color: white;
}

.btn-fun-outline {
  background: transparent;
  border: 2px solid #7c3aed;
  color: #7c3aed;
}

.btn-fun-outline:hover {
  background: #7c3aed;
  color: white;
  transform: translateY(-3px);
}

.share-icons i {
  font-size: 2.2rem;
  color: #4b3b5e;
  transition: 0.2s;
  cursor: pointer;
  margin: 0 6px;
}

.share-icons i:hover {
  color: #7c3aed;
  transform: scale(1.15);
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.font-size-control input[type="range"] {
  flex: 1;
  accent-color: #7c3aed;
}

.font-size-control span {
  min-width: 40px;
  font-weight: 700;
  color: #4b3b5e;
}

.ai-section {
  background: linear-gradient(135deg, #f0e6ff 0%, #e6d5ff 100%);
  border-radius: 20px;
  padding: 15px;
  margin-top: 10px;
}

.ai-section textarea {
  border-radius: 15px;
  border: 2px solid #d4c4e8;
  resize: vertical;
  min-height: 60px;
}

.ai-section textarea:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.generating-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 2rem;
  flex-direction: column;
  color: white;
  z-index: 10;
}

.generating-overlay.show {
  display: flex;
}

.spinner-border {
  width: 4rem;
  height: 4rem;
}

.hidden {
  display: none !important;
}

.image-placeholder {
  background: repeating-linear-gradient(45deg, #2d2d44, #2d2d44 10px, #3a3a55 10px, #3a3a55 20px);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8888aa;
  font-size: 1.2rem;
}

.badge-ai {
  background: #7c3aed;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 576px) {
  .template-item {
    width: 60px;
    height: 60px;
  }
}