:root {
  --bg-main: #041327;
  --bg-accent: #0d2240;
  --surface: #0f1c36;
  --surface-2: #15284c;
  --line: #244778;
  --text: #f8fafc;
  --muted: #9fb6d7;
  --brand-yellow: #ffcb05;
  --brand-blue: #2a75bb;
  --brand-red: #ff3b30;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

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

body {
  font-family: "Poppins", sans-serif;
  background: radial-gradient(circle at 15% 10%, #12386b 0%, var(--bg-main) 45%, #040914 100%);
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
}

.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particles span {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 203, 5, 0.6) 0%, transparent 70%);
  animation: float linear infinite;
  opacity: 0;
}

.bg-particles span:nth-child(1) {
  width: 60px;
  height: 60px;
  left: 10%;
  animation-duration: 18s;
  animation-delay: 0s;
  top: 100%;
}

.bg-particles span:nth-child(2) {
  width: 32px;
  height: 32px;
  left: 24%;
  animation-duration: 22s;
  animation-delay: 3s;
  top: 100%;
}

.bg-particles span:nth-child(3) {
  width: 78px;
  height: 78px;
  left: 38%;
  animation-duration: 16s;
  animation-delay: 1s;
  top: 100%;
}

.bg-particles span:nth-child(4) {
  width: 24px;
  height: 24px;
  left: 56%;
  animation-duration: 20s;
  animation-delay: 5s;
  top: 100%;
}

.bg-particles span:nth-child(5) {
  width: 52px;
  height: 52px;
  left: 66%;
  animation-duration: 17s;
  animation-delay: 2s;
  top: 100%;
}

.bg-particles span:nth-child(6) {
  width: 42px;
  height: 42px;
  left: 75%;
  animation-duration: 24s;
  animation-delay: 4s;
  top: 100%;
}

.bg-particles span:nth-child(7) {
  width: 28px;
  height: 28px;
  left: 86%;
  animation-duration: 19s;
  animation-delay: 6s;
  top: 100%;
}

.bg-particles span:nth-child(8) {
  width: 72px;
  height: 72px;
  left: 6%;
  animation-duration: 21s;
  animation-delay: 7s;
  top: 100%;
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 0.14;
  }

  90% {
    opacity: 0.08;
  }

  100% {
    transform: translateY(-110vh) rotate(720deg);
    opacity: 0;
  }
}

.container {
  position: relative;
  z-index: 1;
  width: 92%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 0 3em;
}

.header {
  text-align: center;
  padding: 2.6em 0 1.8em;
  animation: slideDown 0.6s ease both;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand-badge {
  display: inline-block;
  background: linear-gradient(90deg, var(--brand-yellow), #ffd84d);
  color: #0d2647;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.55em;
  letter-spacing: 4px;
  padding: 4px 18px;
  border-radius: 4px;
  margin-bottom: 0.45em;
  box-shadow: 0 0 24px rgba(255, 203, 5, 0.55), 0 0 44px rgba(42, 117, 187, 0.25);
  animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 24px rgba(255, 203, 5, 0.55), 0 0 44px rgba(42, 117, 187, 0.25);
  }

  50% {
    box-shadow: 0 0 36px rgba(255, 203, 5, 0.9), 0 0 60px rgba(42, 117, 187, 0.45);
  }
}

.app-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 3.1em;
  letter-spacing: 6px;
  color: var(--text);
  line-height: 1;
  text-shadow: 0 0 30px rgba(42, 117, 187, 0.45);
}

.app-subtitle {
  color: var(--muted);
  font-size: 0.78em;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  margin-top: 0.45em;
}

.search-wrapper {
  position: relative;
  z-index: 100;
  animation: slideDown 0.6s 0.15s ease both;
}

.input-container {
  display: flex;
  align-items: center;
  background: rgba(10, 24, 49, 0.92);
  border: 1.5px solid var(--line);
  border-radius: 50px;
  padding: 6px 6px 6px 18px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-container:focus-within {
  border-color: var(--brand-yellow);
  box-shadow: 0 0 0 3px rgba(255, 203, 5, 0.16), 0 0 20px rgba(42, 117, 187, 0.25);
}

.search-icon {
  color: #6e8bb7;
  font-size: 1.1em;
  margin-right: 10px;
  flex-shrink: 0;
}

.input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: "Poppins", sans-serif;
  font-size: 0.95em;
  min-width: 0;
}

.input::placeholder {
  color: #7994be;
}

.button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, var(--brand-yellow), #ffd84d);
  color: #0b2a4f;
  border: none;
  border-radius: 50px;
  padding: 0.75em 1.4em;
  font-family: "Poppins", sans-serif;
  font-size: 0.88em;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.25s;
  box-shadow: 0 4px 16px rgba(255, 203, 5, 0.45);
}

.button:hover {
  transform: scale(1.05);
  box-shadow: 0 7px 24px rgba(255, 203, 5, 0.65);
}

.button:active {
  transform: scale(0.97);
}

.btn-arrow {
  font-size: 1.1em;
  transition: transform 0.2s;
}

.button:hover .btn-arrow {
  transform: translateX(3px);
}

.list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  overflow-y: auto;
  max-height: 300px;
  z-index: 999;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.65);
  animation: dropdownOpen 0.25s ease both;
}

@keyframes dropdownOpen {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.list::-webkit-scrollbar {
  width: 4px;
}

.list::-webkit-scrollbar-track {
  background: transparent;
}

.list::-webkit-scrollbar-thumb {
  background: var(--brand-yellow);
  border-radius: 4px;
}

.alpha-header {
  padding: 0.4em 1.2em 0.2em;
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--brand-yellow);
  text-transform: uppercase;
  background: rgba(255, 203, 5, 0.06);
  border-top: 1px solid rgba(255, 203, 5, 0.2);
  position: sticky;
  top: 0;
  z-index: 1;
}

.alpha-header:first-child {
  border-top: none;
}

.autocomplete-items {
  padding: 0.68em 1.2em 0.68em 1.5em;
  color: #bfd0eb;
  font-size: 0.88em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, padding-left 0.18s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.autocomplete-items:last-child {
  border-bottom: none;
}

.autocomplete-items:hover {
  background: rgba(42, 117, 187, 0.2);
  color: var(--text);
  padding-left: 1.9em;
}

.autocomplete-items b {
  color: var(--brand-yellow);
  font-weight: 700;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
}

.item small {
  color: #7aa0d4;
  font-size: 0.78em;
}

.display-container {
  margin-top: 1.6em;
  position: relative;
  z-index: 1;
}

.card-container {
  background: linear-gradient(165deg, rgba(12, 26, 52, 0.96), rgba(8, 18, 40, 0.98));
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 0 1px rgba(42, 117, 187, 0.08);
  animation: cardReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-origin: top center;
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-image-wrapper {
  position: relative;
  background: radial-gradient(circle at top right, rgba(255, 203, 5, 0.24), rgba(42, 117, 187, 0.1));
  min-height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-image-wrapper img {
  width: 82%;
  max-height: 260px;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.5));
  animation: popIn 0.5s ease;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.card-image-id {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(4, 20, 45, 0.7);
  border: 1px solid rgba(255, 203, 5, 0.35);
  color: #ffdb56;
  font-size: 0.76em;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 0.38em 0.62em;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.download-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  border: none;
  border-radius: 10px;
  padding: 0.5em 0.75em;
  background: rgba(8, 21, 43, 0.8);
  border: 1px solid rgba(255, 203, 5, 0.35);
  color: #ffdb56;
  font-size: 0.82em;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.download-btn:hover {
  transform: translateY(-1px);
  background: rgba(11, 29, 58, 0.95);
}

.download-btn:disabled {
  opacity: 0.8;
  cursor: default;
}

.card-body {
  padding: 1.25em 1.2em 1.3em;
}

.character-name {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 2px;
  font-size: 2.05em;
  line-height: 1;
  color: var(--text);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin-top: 0.45em;
}

.type-chip {
  background: var(--type-color, var(--brand-yellow));
  color: #0a1f3b;
  font-size: 0.73em;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  padding: 0.3em 0.65em;
  border-radius: 999px;
}

.generation-chip {
  background: rgba(42, 117, 187, 0.18);
  border: 1px solid rgba(42, 117, 187, 0.45);
  color: #9dd0ff;
  font-size: 0.73em;
  font-weight: 600;
  padding: 0.3em 0.62em;
  border-radius: 999px;
}

.divider {
  height: 1px;
  margin: 0.85em 0 0.8em;
  background: linear-gradient(90deg, rgba(255, 203, 5, 0.45), rgba(42, 117, 187, 0.05));
}

.info-list {
  display: grid;
  gap: 0.42em;
}

.info-row {
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: 0.6em;
  align-items: start;
}

.info-label {
  color: #91aed3;
  font-size: 0.76em;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.info-value {
  color: #dbe9ff;
  font-size: 0.83em;
  line-height: 1.45;
  font-weight: 500;
  word-break: break-word;
}

.not-found {
  background: linear-gradient(165deg, rgba(12, 26, 52, 0.96), rgba(8, 18, 40, 0.98));
  border: 1px solid var(--line);
  color: #bfd2f2;
  border-radius: 16px;
  padding: 1.3em 1.1em;
  text-align: center;
  line-height: 1.6;
  box-shadow: var(--shadow);
}

.not-found span {
  display: inline-block;
  margin-bottom: 0.4em;
  font-size: 1.45em;
}

.loading-card {
  background: linear-gradient(165deg, rgba(12, 26, 52, 0.96), rgba(8, 18, 40, 0.98));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1em;
  box-shadow: var(--shadow);
}

.shimmer-img,
.shimmer-line {
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(31, 57, 98, 0.35) 25%, rgba(82, 130, 189, 0.35) 50%, rgba(31, 57, 98, 0.35) 75%);
  background-size: 250% 100%;
  animation: shimmer 1.3s infinite linear;
}

.shimmer-img {
  height: 240px;
  margin-bottom: 1em;
}

.shimmer-line {
  height: 12px;
  margin-bottom: 0.6em;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.copyright {
  margin-top: 1.4em;
  text-align: center;
  color: #8fa9cf;
  font-size: 0.78em;
}

.copyright-divider {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 1em;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 203, 5, 0.5), transparent);
}

.copyright-name {
  font-weight: 700;
  color: #bdd9ff;
  letter-spacing: 0.5px;
  margin-bottom: 0.2em;
}

.copyright-detail {
  margin-top: 0.08em;
}

.copyright-detail a {
  color: #9dd0ff;
  text-decoration: none;
}

.copyright-detail a:hover {
  text-decoration: underline;
}

.copyright-year {
  margin-top: 0.45em;
  color: #7f9ac1;
}

@media (max-width: 640px) {
  .container {
    width: 94%;
  }

  .app-title {
    font-size: 2.6em;
  }

  .input-container {
    padding-left: 14px;
  }

  .button {
    padding: 0.72em 1em;
  }

  .btn-text {
    display: none;
  }

  .info-row {
    grid-template-columns: 1fr;
    gap: 0.18em;
  }

  .info-label {
    font-size: 0.7em;
  }

  .info-value {
    font-size: 0.82em;
  }
}
