:root {
  --bg: #f6f0ff;
  --surface: #ffffff;
  --surface-soft: #f3e9ff;
  --primary: #8f5bff;
  --primary-dark: #6f3fe0;
  --text: #221a33;
  --muted: #6d6086;
  --shadow: 0 12px 30px rgba(111, 63, 224, 0.14);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(170deg, #fcf9ff 0%, var(--bg) 55%, #efe4ff 100%);
  min-height: 100vh;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 10%, rgba(143, 91, 255, 0.2), transparent 32%),
    radial-gradient(circle at 90% 90%, rgba(197, 163, 255, 0.3), transparent 25%);
  z-index: -1;
}

.container {
  width: min(1080px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
  display: grid;
  gap: 1.5rem;
}

.profile-card {
  perspective: 1200px;
}

.profile-card-inner {
  position: relative;
  min-height: 320px;
  transition: transform 0.8s ease, min-height 0.35s ease;
  transform-style: preserve-3d;
}

.profile-card.is-flipped .profile-card-inner {
  transform: rotateY(180deg);
}

.profile-face {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(143, 91, 255, 0.12);
  backface-visibility: hidden;
}

.profile-front {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
}

.profile-back {
  transform: rotateY(180deg);
  display: grid;
  place-items: center;
  gap: 0.9rem;
  text-align: center;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  border: 2px solid rgba(143, 91, 255, 0.25);
}

.eyebrow {
  margin: 0;
  color: var(--primary-dark);
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
}

.intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.strengths {
  margin-top: 0.9rem;
}

.strengths-title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  color: var(--primary-dark);
}

.quick-facts {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.quick-facts span {
  background: var(--surface-soft);
  color: var(--primary-dark);
  border: 1px solid rgba(143, 91, 255, 0.22);
  border-radius: 999px;
  padding: 0.32rem 0.72rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.pokemon-btn {
  display: inline-block;
  margin-top: 0.8rem;
  border: 0;
  border-radius: 10px;
  padding: 0.58rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), #c47dff);
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
  text-decoration: none;
}

.pokemon-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.pokemon-btn:active {
  transform: translateY(0);
}

.pokemon-card-image {
  width: min(260px, 100%);
  max-height: 430px;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(111, 63, 224, 0.26);
  border: 1px solid rgba(143, 91, 255, 0.28);
}

.pokemon-card-link {
  width: 100%;
  display: flex;
  justify-content: center;
}

.pokemon-actions {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.pokemon-actions .pokemon-btn {
  margin-top: 0;
}

.pokemon-card-image {
  display: block;
  margin-inline: auto;
}

#pokemon-back-btn {
  color: var(--primary-dark);
  background: var(--surface-soft);
  border: 1px solid rgba(143, 91, 255, 0.25);
}

#pokemon-back-btn:hover {
  filter: brightness(0.98);
}

#pokemon-btn {
  display: block;
  width: fit-content;
  margin: 1.1rem auto 0;
  padding: 0.85rem 1.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow:
    0 10px 24px rgba(111, 63, 224, 0.34),
    0 0 0 0 rgba(143, 91, 255, 0.45);
  animation: pulseGlow 1.8s ease-in-out infinite;
}

#pokemon-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
}

@media (min-width: 701px) {
  .profile-card.is-flipped .profile-card-inner {
    min-height: 560px;
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 10px 24px rgba(111, 63, 224, 0.34),
      0 0 0 0 rgba(143, 91, 255, 0.45);
  }
  50% {
    transform: scale(1.08);
    box-shadow:
      0 14px 30px rgba(111, 63, 224, 0.42),
      0 0 0 16px rgba(143, 91, 255, 0);
  }
}

.feed-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(143, 91, 255, 0.12);
  padding: 1rem;
}

.section-head h2 {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.stories-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.9rem;
}

.story-tile {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(143, 91, 255, 0.16);
}

.story-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.story-media {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #f0e4ff;
  overflow: hidden;
}

.story-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-play-icon {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(17, 14, 27, 0.68);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
}

.story-title {
  margin: 0;
  padding: 0.7rem 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.story-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.story-modal[hidden] {
  display: none;
}

.story-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 6, 18, 0.72);
}

.story-modal-content {
  position: relative;
  z-index: 1;
  width: min(420px, 94vw);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.story-modal-video {
  width: 100%;
  max-height: 86vh;
  display: block;
}

.story-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(12, 10, 20, 0.6);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.feed-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.9rem;
}

.reel-link {
  width: 100%;
  display: block;
  color: inherit;
  text-decoration: none;
}

.reel-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.25s ease;
}

.reel-link:hover .reel-thumb {
  transform: scale(1.03);
}

@media (max-width: 700px) {
  .profile-card-inner {
    min-height: 520px;
  }

  .profile-front {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .avatar {
    margin: 0 auto;
  }

  .quick-facts {
    justify-content: center;
  }

  .feed-grid {
    max-height: none;
    overflow-y: visible;
  }
}
