/* ---------- Tokens ---------- */
:root {
  --pokeball-red: #ee1515;
  --pokeball-red-light: #ff3a3a;
  --pokeball-red-dark: #b80f0f;
  --pokeball-black: #1a1a1a;
  --pokeball-white: #ffffff;
  --pokemon-blue: #3b4cca;
  --pokemon-blue-light: #5f6fde;
  --pokemon-blue-dark: #2939a8;
  --pokemon-yellow: #ffcb05;
  --pokemon-yellow-dark: #d4a704;

  --sky-top: #cfe9ff;
  --sky-bottom: #7cc0ff;
  --cloud: #ffffff;

  --text-dark: #1a1f4a;
  --text-muted: #4a5495;

  --card-bg: #fdfdff;
  --card-border: #1a1a1a;
  --card-shadow: 0 18px 0 -2px rgba(26, 26, 26, 0.12),
    0 30px 60px -10px rgba(25, 35, 100, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--text-dark);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
  background: linear-gradient(
    180deg,
    var(--sky-top) 0%,
    var(--sky-bottom) 100%
  );
  overflow-x: hidden;
  position: relative;
}

/* ---------- Sky / clouds / decorative pokeballs ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cloud) 0%, transparent 70%);
  filter: blur(20px);
  opacity: 0.85;
}

.cloud--a {
  width: 380px;
  height: 200px;
  top: 8%;
  left: -80px;
  animation: float-x 22s ease-in-out infinite alternate;
}

.cloud--b {
  width: 480px;
  height: 240px;
  top: 55%;
  right: -160px;
  opacity: 0.7;
  animation: float-x 28s ease-in-out infinite alternate-reverse;
}

.cloud--c {
  width: 320px;
  height: 180px;
  bottom: -40px;
  left: 30%;
  opacity: 0.6;
  animation: float-x 24s ease-in-out infinite alternate;
}

@keyframes float-x {
  from { transform: translateX(0); }
  to   { transform: translateX(40px); }
}

/* Big translucent pokeballs floating behind the card */
.pokeball-bg {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background:
    linear-gradient(
      to bottom,
      var(--pokeball-red) 0%,
      var(--pokeball-red) 46%,
      var(--pokeball-black) 46%,
      var(--pokeball-black) 54%,
      var(--pokeball-white) 54%,
      var(--pokeball-white) 100%
    );
  opacity: 0.18;
  filter: blur(2px);
  box-shadow: 0 0 0 6px var(--pokeball-black) inset;
}

.pokeball-bg::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  background: var(--pokeball-white);
  box-shadow: 0 0 0 6px var(--pokeball-black);
}

.pokeball-bg--1 {
  top: 6%;
  right: -60px;
  transform: rotate(-15deg);
  animation: spin-slow 60s linear infinite;
}

.pokeball-bg--2 {
  bottom: 4%;
  left: -70px;
  width: 280px;
  height: 280px;
  transform: rotate(20deg);
  opacity: 0.14;
  animation: spin-slow 90s linear infinite reverse;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- Card (Trainer Card) ---------- */
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 40px 26px 28px;
  border-radius: 24px;
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  box-shadow: var(--card-shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 26px;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* Faint Poké Ball watermark inside the card */
.card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 21px;
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(238, 21, 21, 0.05) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 0% 100%,
      rgba(59, 76, 202, 0.05) 0%,
      transparent 40%
    );
  pointer-events: none;
  border-radius: inherit;
}

/* Yellow accent corners — TCG card vibe */
.card__corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid var(--pokeball-black);
  background: var(--pokemon-yellow);
  border-radius: 4px;
}

.card__corner--tl { top: -8px; left: -8px; }
.card__corner--tr { top: -8px; right: -8px; }
.card__corner--bl { bottom: -8px; left: -8px; }
.card__corner--br { bottom: -8px; right: -8px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
}

.avatar-wrap {
  position: relative;
  width: 124px;
  height: 124px;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    linear-gradient(135deg, #ffcb05 0%, #ee1515 60%, #3b4cca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 4px solid var(--pokeball-black);
  box-shadow:
    0 0 0 4px var(--pokemon-yellow),
    0 0 0 7px var(--pokeball-black),
    0 14px 24px -8px rgba(26, 35, 100, 0.5);
  background-size: cover;
  background-position: 55% 22%;
  background-repeat: no-repeat;
  overflow: hidden;
}

.avatar.has-image .avatar__initial { display: none; }

.avatar__initial {
  font-family: "Lilita One", "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: 56px;
  color: #fff;
  line-height: 1;
  text-shadow: 0 3px 0 var(--pokeball-black);
}

/* Mini Poké Ball badge — bottom right corner of avatar */
.avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--pokeball-black);
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  background: var(--pokeball-white);
}

.avatar-badge__top {
  position: absolute;
  inset: 0 0 50% 0;
  background: var(--pokeball-red);
}

.avatar-badge__band {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 2.5px);
  height: 5px;
  background: var(--pokeball-black);
}

.avatar-badge__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--pokeball-white);
  box-shadow: 0 0 0 2px var(--pokeball-black);
}

.hero__ornament {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 240px;
}

.hero__line {
  flex: 1;
  height: 2px;
  background: var(--pokeball-black);
  border-radius: 2px;
}

.hero__icon {
  color: var(--pokeball-red);
  font-size: 18px;
  text-shadow: 1px 1px 0 var(--pokeball-black);
}

/* Pokémon-logo styled name */
.name {
  position: relative;
  font-family: "Lilita One", "Bungee", system-ui, sans-serif;
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--pokemon-yellow);
  -webkit-text-stroke: 2px var(--pokemon-blue);
  text-shadow:
    3px 3px 0 var(--pokemon-blue),
    3px 4px 0 rgba(0, 0, 0, 0.15);
  transform: rotate(-1.5deg);
}

/* ---------- Links ---------- */
.links {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 2px;
}

.link-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  padding: 16px 24px;
  border-radius: 16px;
  border: 3px solid var(--pokeball-black);
  background: var(--pokemon-blue);
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 0 0 2px var(--pokeball-white) inset,
    0 5px 0 0 var(--pokemon-blue-dark),
    0 5px 0 3px var(--pokeball-black);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  transition:
    transform 0.12s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.12s cubic-bezier(0.2, 0.7, 0.2, 1),
    background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Glossy sheen across top half */
.link-btn::before {
  content: "";
  position: absolute;
  inset: 4px 4px 50% 4px;
  border-radius: 12px 12px 6px 6px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  pointer-events: none;
}

.link-btn:hover {
  background: var(--pokemon-blue-light);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 2px var(--pokeball-white) inset,
    0 7px 0 0 var(--pokemon-blue-dark),
    0 7px 0 3px var(--pokeball-black);
}

.link-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 2px var(--pokeball-white) inset,
    0 2px 0 0 var(--pokemon-blue-dark),
    0 2px 0 3px var(--pokeball-black);
}

.link-btn:focus-visible {
  outline: 3px solid var(--pokemon-yellow);
  outline-offset: 3px;
}

/* Primary — Poké Ball red */
.link-btn--primary {
  background: var(--pokeball-red);
  box-shadow:
    0 0 0 2px var(--pokeball-white) inset,
    0 5px 0 0 var(--pokeball-red-dark),
    0 5px 0 3px var(--pokeball-black);
}

.link-btn--primary:hover {
  background: var(--pokeball-red-light);
  box-shadow:
    0 0 0 2px var(--pokeball-white) inset,
    0 7px 0 0 var(--pokeball-red-dark),
    0 7px 0 3px var(--pokeball-black);
}

.link-btn--primary:active {
  box-shadow:
    0 0 0 2px var(--pokeball-white) inset,
    0 2px 0 0 var(--pokeball-red-dark),
    0 2px 0 3px var(--pokeball-black);
}

/* ---------- Footer (pixel "© KIM RYU") ---------- */
.footer {
  margin-top: 4px;
  color: var(--text-muted);
  font-family: "Press Start 2P", "Inter", sans-serif;
  font-size: 9px;
  letter-spacing: 0.05em;
  line-height: 1.5;
}

.footer p { margin: 0; }

/* ---------- Small screens ---------- */
@media (max-width: 380px) {
  .card {
    padding: 34px 20px 24px;
    border-radius: 20px;
  }
  .name { font-size: 36px; }
  .avatar-wrap { width: 108px; height: 108px; }
  .avatar__initial { font-size: 48px; }
  .link-btn {
    min-height: 56px;
    font-size: 13.5px;
  }
  .footer { font-size: 8px; }
}

/* ---------- Larger screens ---------- */
@media (min-width: 720px) {
  .card {
    max-width: 460px;
    padding: 52px 36px 32px;
  }
  .name { font-size: 50px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cloud,
  .pokeball-bg,
  .card,
  .link-btn {
    animation: none !important;
    transition: none !important;
  }
  .link-btn:hover,
  .link-btn:active { transform: none; }
}
