* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: #ffffff;
  text-align: center;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.30), transparent 30%),
    radial-gradient(circle at top right, rgba(168, 85, 247, 0.28), transparent 32%),
    radial-gradient(circle at bottom, rgba(14, 165, 233, 0.20), transparent 30%),
    #020617;
  overflow-x: hidden;
}

.background-blobs span {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.5;
  z-index: 0;
  animation: float 8s ease-in-out infinite;
}

.background-blobs span:nth-child(1) {
  left: 5%;
  top: 15%;
  background: #22c55e;
}

.background-blobs span:nth-child(2) {
  right: 8%;
  top: 20%;
  background: #a855f7;
  animation-delay: 1.2s;
}

.background-blobs span:nth-child(3) {
  left: 40%;
  bottom: 5%;
  background: #06b6d4;
  animation-delay: 2.2s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-22px) scale(1.06); }
}

.page {
  position: relative;
  z-index: 1;
  width: min(1040px, 92%);
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  margin-bottom: 34px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  font-weight: 800;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 7vw, 74px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.06em;
  text-shadow: 0 12px 44px rgba(0,0,0,0.35);
}

.subtitle {
  max-width: 640px;
  margin: 18px auto 0;
  color: rgba(255,255,255,0.72);
  font-size: 18px;
  line-height: 1.5;
}

.input-panel {
  width: min(560px, 100%);
  margin: 28px auto 0;
  padding: 14px;
  display: flex;
  gap: 12px;
  border-radius: 24px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
}

input {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(2, 6, 23, 0.72);
  color: white;
  font-size: 17px;
  outline: none;
  text-align: center;
}

input::placeholder {
  color: rgba(255,255,255,0.45);
}

button {
  border: none;
  cursor: pointer;
  border-radius: 16px;
  padding: 14px 18px;
  color: #06120b;
  font-weight: 900;
  font-size: 15px;
  background: linear-gradient(135deg, #bbf7d0, #22c55e 45%, #14b8a6);
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 18px 42px rgba(34, 197, 94, 0.34);
}

.result-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-card {
  width: min(440px, 100%);
  min-height: 620px;
  margin: 0 auto;
  padding: 24px;
  border-radius: 34px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid rgba(255,255,255,0.20);
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 45%, #020617 100%);
  box-shadow:
    0 28px 100px rgba(0,0,0,0.48),
    0 0 70px rgba(34,197,94,0.18);
  animation: popIn 0.35s ease both;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: -80px;
  background:
    radial-gradient(circle at 20% 10%, var(--glow, rgba(34,197,94,0.35)), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.11), transparent 24%);
  pointer-events: none;
}

@keyframes popIn {
  from { transform: translateY(22px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.card-topline {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.rarity-pill,
.card-tag {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
}

.personality-img {
  position: relative;
  z-index: 2;
  margin: 26px 0 12px;
  width: 180px;
  height: 180px;
  border-radius: 34px;
  display: grid;
  place-items: center;
  font-size: 78px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04)),
    radial-gradient(circle at top, var(--glow, rgba(34,197,94,0.34)), transparent 60%);
  border: 1px solid rgba(255,255,255,0.20);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.20), 0 20px 50px rgba(0,0,0,0.28);
}

.personality-img::after {
  content: attr(data-caption);
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  min-width: 170px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #020617;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 25px rgba(0,0,0,0.28);
}

.handle-display {
  position: relative;
  z-index: 2;
  margin: 18px 0 0;
  color: rgba(255,255,255,0.68);
  font-weight: 800;
}

#personality-name {
  position: relative;
  z-index: 2;
  margin: 8px 0 8px;
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.05em;
}

#description {
  position: relative;
  z-index: 2;
  max-width: 340px;
  margin: 0 auto 18px;
  color: rgba(255,255,255,0.78);
  line-height: 1.45;
}

.stats-grid {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 4px 0 16px;
}

.stat {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat span {
  color: rgba(255,255,255,0.56);
  font-size: 13px;
  font-weight: 800;
}

.stat strong {
  font-size: 16px;
}

.meme-line {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
  padding: 14px;
  border-radius: 20px;
  color: #020617;
  background: #facc15;
  font-weight: 900;
  transform: rotate(-1deg);
  box-shadow: 0 16px 30px rgba(0,0,0,0.24);
}

.disclaimer {
  position: relative;
  z-index: 2;
  margin: 18px 0 0;
  max-width: 340px;
  color: rgba(255,255,255,0.48);
  font-size: 12px;
  line-height: 1.35;
}

.actions {
  margin: 26px auto 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.result-card.common {
  --glow: rgba(34,197,94,0.44);
}

.result-card.rare {
  --glow: rgba(59,130,246,0.52);
  box-shadow:
    0 28px 100px rgba(0,0,0,0.48),
    0 0 85px rgba(59,130,246,0.24);
}

.result-card.legendary {
  --glow: rgba(168,85,247,0.62);
  box-shadow:
    0 28px 100px rgba(0,0,0,0.48),
    0 0 100px rgba(168,85,247,0.34);
}

.result-card.legendary .rarity-pill {
  background: linear-gradient(135deg, #facc15, #a855f7);
  color: #020617;
}

.result-card.rare .rarity-pill {
  background: linear-gradient(135deg, #dbeafe, #60a5fa);
  color: #020617;
}

.result-card.common .rarity-pill {
  background: linear-gradient(135deg, #dcfce7, #22c55e);
  color: #020617;
}

@media (max-width: 640px) {
  .page {
    padding: 28px 0;
  }

  .input-panel {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .result-card {
    min-height: auto;
    padding: 20px;
  }

  .personality-img {
    width: 150px;
    height: 150px;
    font-size: 62px;
  }
}


/* Download image fix: use real gradient backgrounds rather than transparent overlays */
.result-card.common {
  background:
    radial-gradient(circle at top, rgba(34,197,94,0.36), transparent 38%),
    linear-gradient(145deg, #1e293b 0%, #0f172a 45%, #020617 100%);
}

.result-card.rare {
  background:
    radial-gradient(circle at top, rgba(59,130,246,0.42), transparent 38%),
    linear-gradient(145deg, #172554 0%, #0f172a 48%, #020617 100%);
}

.result-card.legendary {
  background:
    radial-gradient(circle at top, rgba(168,85,247,0.48), transparent 38%),
    linear-gradient(145deg, #3b0764 0%, #111827 48%, #020617 100%);
}
