* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

:root {
  --bg1: #fff0f6;
  --bg2: #e0f2fe;
  --card: #ffffff;

  --text: #1f2937;
  --muted: #6b7280;

  --accent: #8b5cf6;
  --accent-soft: #f472b6;

  --btn1: #ec4899;
  --btn2: #8b5cf6;

  --border: #e5e7eb;
}

body.dark {
  --bg1: #1a1020;
  --bg2: #0f172a;
  --card: #22162b;

  --text: #f5f3ff;
  --muted: #c4b5fd;

  --accent: #a78bfa;
  --accent-soft: #f472b6;

  --btn1: #ec4899;
  --btn2: #8b5cf6;

  --border: #3b2a45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  backdrop-filter: blur(60px);
  pointer-events: none;
}
body {
  margin: 0;
  min-height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;

  background:
    radial-gradient(
      900px circle at 15% 15%,
      rgba(236, 72, 153, 0.12),
      transparent 40%
    ),
    radial-gradient(
      800px circle at 85% 85%,
      rgba(139, 92, 246, 0.12),
      transparent 40%
    ),
    linear-gradient(135deg, var(--bg1), var(--bg2));

  background-attachment: fixed;
  background-size: 200% 200%;
  animation: bgMove 18s ease infinite;

  transition: background 0.4s ease;
  will-change: background-position;
}

@keyframes bgMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

body.dark {
  background:
    radial-gradient(
      900px circle at 15% 15%,
      rgba(236, 72, 153, 0.08),
      transparent 40%
    ),
    radial-gradient(
      800px circle at 85% 85%,
      rgba(139, 92, 246, 0.08),
      transparent 40%
    ),
    linear-gradient(135deg, var(--bg1), var(--bg2));
}
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  transition:
    transform 0.2s ease,
    background 0.3s ease,
    color 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.05);
}
.theme-toggle:active {
  transform: scale(0.9);
}

.main {
  width: 90%;
  max-width: 400px;
  padding: 25px 35px;
  position: absolute;
  top: auto;
  left: auto;
  transform: none;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}
body.dark .main {
  background: rgba(34, 22, 43, 0.6);
}
.main p {
    align-self: start;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text);
}
.main input {
  height: 50px;
  width: 100%;
  padding: 10px 15px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  margin: 10px 0 20px;
  outline: 0;
}
.main input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}
.main button {
  width: 100%;
  padding: 10px 15px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  outline: 0;
  border-radius: 5px;
  background: var(--btn1);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 10px 10px rgba(236, 72, 153, 0.3);
  transition: all 0.25s ease;
}
.main button:hover {
  background: var(--btn2);
  transform: translateY(-1px);
}
.main button:focus-visible,
.main input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#imgBox {
  width: 200px;
  border-radius: 5px;
  max-height: 0;
  margin: 0 auto;
  overflow: hidden;
  opacity: 0;
  display: block;
  transition:
    max-height 0.6s ease,
    opacity 0.4s ease;
}
#imgBox img {
  width: 100%;
  padding: 10px;
  display: block;
  margin: auto;
}
#imgBox.show-img {
  max-height: 300px;
  margin: 10px auto;
  border: 1px solid var(--text);
  opacity: 1;
}

#downloadBtn {
  margin-top: 15px;
  padding: 8px 12px;
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--text);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: none;
}
#downloadBtn:hover{
  background:var(--accent);
  transform:translateY(-1px);
}
@media (max-width: 600px) {
  body::before {
    backdrop-filter: blur(20px);
  }
}
