/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Cormorant Garamond", serif;
}

body {
  background: black;
  margin: 0;
  margin-top: 20px;
  padding: 20px;
  color: white;
  font-family: Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.7;
}

.footer {
  font-size: 1em;
  font-weight: 600;
  color: white;
  font-style: italic;
  text-align: center;
  margin-bottom: 2vh;
  margin-top: 4vh;
}

/* Layout */
.layout-container {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  /* max-width: 1200px; */
  margin: 0 auto;
  padding: 20px;
  flex-wrap: nowrap;
}

/* Card Container */
.card-container {
  /* flex: 0 0 auto; */
  perspective: 700px;
  width: 50vh;
  height: auto; /* height will adjust automatically to maintain the aspect ratio */
  aspect-ratio: 5 / 7;
  /* width: min(300px, 90vw);
  height: min(420px, 126vw); */
  flex-shrink: 0;
}

@media (max-width: 992px) {
  .layout-container {
    justify-content: center;
    gap: 20px;
  }

  .layout-container {
    flex-wrap: wrap; /* 在较小屏幕上允许换行 */
  }

  .education-section {
    flex: 1 1 100%; /* 在换行时占满整行 */
  }

  .card-container {
    width: 300px;
    height: 420px;
    margin: 0 auto; /* 居中显示 */
  }
}

/* Pokemon Card Base */
.pokemon-card {
  background-image: url("./profile3.png");
  --rotateX: 0deg;
  --rotateY: 0deg;
  --moveX: 50;
  --moveY: 50;
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: translate3d(0, 0, 0) rotateX(var(--rotateX))
    rotateY(var(--rotateY));
  transition: transform 0.1s ease-out;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; /* Add this */
  transform-origin: center center;
  -webkit-font-smoothing: antialiased; /* Add this */
}

/* Holographic Border */
.holographic-border {
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, #ffffff, #2affffe7, #ffffff, #000000);
  /* background: linear-gradient(125deg, #ff96e3, #88d1ff, #ff96e3, #88d1ff); */
  background-size: 400% 400%;
  animation: borderAnimation 3s ease infinite;
  z-index: 1;
  opacity: 0.8;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Card Frame */
.card-frame {
  position: absolute;
  inset: 14px;
  /* background: linear-gradient(135deg, #f8f8f800, #e8e8e800); */
  border-radius: 12px;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  z-index: 2;
}

.card-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.2) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.1) 75%,
    rgba(255, 255, 255, 0.2) 100%
  );
  animation: textureShift 8s linear infinite;
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* padding: 8px 16px; */
  padding: 2.5% 2%;
  /* background: linear-gradient(90deg, #f0f0f0, #e0e0e0); */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.basic-tag {
  font-size: clamp(10px, 3.5vh, 36px);
  color: #000000;
  font-weight: bold;
  /* text-transform: uppercase; */
  letter-spacing: 0.5px;
  font-family: Arial, Helvetica, sans-serif;
}

.hp {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(12px, 3vh, 36px);
  color: #000000;
  font-weight: bold;
  font-family: Arial, Helvetica, sans-serif;
}

/* Profile Container */
.profile-container {
  width: 100%;
  height: 100%;
  /* margin: 10px auto; */
  /* background: linear-gradient(135deg, #e6f3ff, #c8e6ff); */
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

/* Move Container */
.move-container {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  /* background: linear-gradient(90deg, #f0f0f0, #e8e8e8); */
  /* border-top: 1px solid rgba(255, 255, 255, 0.8); */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.water-symbol {
  width: 2.5vh;
  height: 2.5vh;
  background: rgb(14, 8, 34);
  /* background: linear-gradient(135deg, #6890f0, #4870d0); */
  border-radius: 50%;
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.5);
}

.move-name {
  font-size: clamp(14px, 3.5vw, 16px);
  color: #000000;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
  font-weight: bold;
}

.move-power {
  margin-left: auto;
  font-weight: bold;
  color: #000000;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

/* Description */
.description {
  font-size: clamp(10px, 2.5vw, 12px);
  font-style: italic;
  font-weight: bold;
  color: #000000;
  padding: 16px;
  /* background: linear-gradient(90deg, #f0f0f0, #e8e8e8);
  border-top: 1px solid rgba(255, 255, 255, 0.8); */
}

/* Shine Effects 基础光泽感 */
/* .shine-effect {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    calc(var(--moveX) * 1deg),
    rgba(164, 164, 164, 0) 0%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(121, 121, 121, 0) 100%
  );
  z-index: 5;
  pointer-events: none;
  mix-blend-mode: overlay;
  transform: translateZ(0);
  will-change: transform, background;
  transition: background 0.1s ease-out;
} */

.shine-effect {
  background: linear-gradient(
    calc(var(--moveX) * 1deg),
    transparent 0%,
    rgba(255, 255, 255, 0.5) 25%,
    rgba(255, 255, 255, 0.7) 45%,
    rgba(255, 255, 255, 0.5) 65%,
    transparent 100%
  );
  opacity: 0.6;
}

/* Shine Effects 基础反光效果，就像光线掠过卡片表面时产生的白色光泽 */
/* .energy-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    calc(var(--moveX) * 1deg),
    rgba(135, 206, 235, 0) 0%,
    rgba(135, 206, 235, 0.2) calc(var(--moveY) * 1%),
    rgba(135, 206, 235, 0) 100%
  );
  pointer-events: none;
  mix-blend-mode: color-dodge;
  z-index: 4;
  transform: translateZ(0);
  will-change: transform, background;
  transition: background 0.1s ease-out;
} */

/* 全息彩虹效果 */
.rainbow-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    calc(var(--moveX) * 1.5deg),
    transparent 0%,
    rgba(255, 255, 255, 0.4) calc(var(--moveY) - 30%),
    rgba(255, 255, 255, 0.6) calc(var(--moveY)),
    rgba(0, 0, 0, 0.4) calc(var(--moveY) + 30%),
    /* rgba(255, 150, 227, 0.4) calc(var(--moveY) - 30%),
    rgba(136, 209, 255, 0.6) calc(var(--moveY)),
    rgba(255, 150, 227, 0.4) calc(var(--moveY) + 30%), */
      transparent 100%
  );
  z-index: 6;
  pointer-events: none;
  mix-blend-mode: color-dodge;
  opacity: 0.6;
  transform: translateZ(0);
  will-change: transform, background;
  transition: background 0.1s ease-out;
}

/* Education Section */
.education-section {
  flex: 1 1 auto;
  padding-top: 40px;
  min-width: 300px;
  overflow-y: auto; /* 内容过多时可滚动 */
  padding: 10px;
}

.education-title {
  font-size: clamp(20px, 3vw, 40px);
  font-weight: 500;
  /* margin-bottom: 20px; */
  color: #88d1ff;
  text-shadow: 0 0 10px rgba(136, 209, 255, 0.5);
}

.education-item {
  /* margin-bottom: 20px; */
  font-weight: 300;
  backdrop-filter: blur(5px);
  background: rgba(255, 255, 255, 0.05);

  border-radius: 10px;
  transform: translateZ(0);
}

.education-item h3 {
  font-size: clamp(18px, 2.5vw, 36px);
  color: #88d1ff;
  margin: 0 0 5px 0;
  /* text-shadow: 0 0 8px rgba(255, 150, 227, 0.5); */
}

.education-item p {
  margin: 0;
  color: #ffffff;
  font-size: clamp(20px, 1.6vw, 32px);
}

/* Animations */
@keyframes borderAnimation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Mobile optimization */
@media (max-width: 768px) {
  .pokemon-card {
    /* Remove hover-based transforms */
    transform: none !important;
    transition: none;
    animation: mobilePokemonCard 5s infinite;
  }

  .shine-effect {
    /* Simplified shine for mobile */
    background: linear-gradient(
      70deg,
      transparent 0%,
      rgba(255, 255, 255, 0) 35%,
      rgba(255, 255, 255, 0.4) 50%,
      rgba(255, 255, 255, 0) 65%,
      transparent 100%
    );
    background-size: 200% 200%;
    animation: mobileShine 3s infinite;
  }

  .rainbow-shine {
    background: linear-gradient(
      70deg,
      transparent 0%,
      rgba(255, 150, 227, 0) 35%,
      rgba(255, 150, 227, 0.2) 50%,
      rgba(136, 209, 255, 0.3) 51%,
      rgba(255, 150, 227, 0) 65%,
      transparent 100%
    );
    background-size: 200% 200%;
    animation: mobileRainbow 3s infinite;
    opacity: 0.3;
  }

  .energy-overlay {
    background: linear-gradient(
      70deg,
      rgba(135, 206, 235, 0) 0%,
      rgba(135, 206, 235, 0) 35%,
      rgba(135, 206, 235, 0.3) 50%,
      rgba(173, 216, 230, 0.5) 51%,
      rgba(135, 206, 235, 0) 65%,
      rgba(135, 206, 235, 0) 100%
    );
    background-size: 200% 200%;
    animation: mobileEnergy 3s infinite;
    opacity: 0.5;
  }

  @keyframes mobilePokemonCard {
    0%,
    100% {
      transform: rotate3d(0.5, -0.5, 0, 2deg);
    }
    50% {
      transform: rotate3d(-0.5, 0.5, 0, 2deg);
    }
  }

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

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

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

.accordion-section {
  border-bottom: 0.2px solid rgba(255, 255, 255);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem; /* Add padding to the section itself */
  overflow: hidden;
}

.accordion-button {
  width: 100%;
  background: none;
  border: none;
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  color: #ffffff;
  font-size: clamp(1.2rem, 2.5vw, 1.4rem);
  /* text-shadow: 2px 2px 2px white; */

  text-align: left;
}

.accordion-button:hover {
  text-shadow: 2px 1px 3px white;
}

.icon {
  font-size: 2.5rem; /* Made larger */
  font-weight: 300;
  color: white;
  display: inline-block;
  transition: transform 0.3s ease;
  transform-origin: center center;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  padding: 0 1rem;
}

.accordion-content.active {
  padding-bottom: 5rem;
}

.accordion-button.active .icon {
  transform: rotate(45deg); /* Rotates + to make it look like × */
}

/* Keep existing Pokemon card styles and add: */

.layout-container {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  max-width: 1200px;
  margin: 4rem auto 2rem;
  padding: 0 1rem;
}

.card-container {
  flex: 0 0 auto;
  width: 40%;
  max-width: 400px;
  position: relative;
}

.title {
  text-align: center;
  color: #2affff;
  margin-top: 1.5rem;
  font-size: 1.7rem;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(42, 255, 255, 0.5);
}

.card-prompt {
  text-align: center;
  color: #2affff;
  font-size: 1.2rem;
  text-shadow: 0 0 10px rgba(42, 255, 255, 0.5);
}

.chat-container {
  flex: 1;
  max-width: 600px;
}

.chat-history {
  /* background: rgba(0, 0, 0, 0.5); */
  border-radius: 1rem;
  padding: 1.5rem;
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

.default-message {
  opacity: 0;
  color: white !important;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease forwards;
  text-shadow: 1px 1px 2px rgba(42, 255, 255, 0.2);
  will-change: transform, opacity;
  animation-fill-mode: forwards;
}

/* Stagger the animations for each message */
.default-message:nth-child(1) {
  animation-delay: 0.5s;
  animation-fill-mode: forwards;
}

.default-message:nth-child(2) {
  animation-delay: 1s;
  animation-fill-mode: forwards;
}

.default-message:nth-child(3) {
  animation-delay: 1.5s;
  animation-fill-mode: forwards;
}

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

/* Add a subtle hover effect */
.default-message:hover {
  color: white;
  transform: translateY(-2px);
  transition: all 0.3s ease;
}

.chat-message {
  /* background: rgba(42, 255, 255, 0.1); */
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  animation: fadeIn 0.5s ease-out;
}

.chat-message p {
  color: white;
  font-size: 1.1rem;
  line-height: 1.5;
  margin: 0;
}

.connect-section {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.connect-section h2 {
  color: #2affff;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  background: rgba(42, 255, 255, 0.1);
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-link:hover {
  background: rgba(42, 255, 255, 0.2);
  transform: translateY(-2px);
}

.social-link img {
  width: 24px;
  height: 24px;
}

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

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .layout-container {
    flex-direction: column;
    margin-top: 2rem;
    gap: 3rem; /* Increase gap between card and chat sections */
  }

  .card-container {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    /* margin-bottom: 1rem;  Add space after card container */
  }

  .title {
    position: absolute; /* Position absolutely */
    color: whitesmoke;
    bottom: -9rem; /* Move below the card */
    margin-top: 1.5rem;
    margin-bottom: 3rem; /* Increase bottom margin on mobile */
  }

  .chat-container {
    width: 100%;
    margin-top: 2rem; /* Add top margin */
    padding-top: 2rem; /* Add padding */
    /* margin-top: 1rem; */
  }

  .card-prompt {
    font-style: italic;
    margin-top: 1rem; /* Add top margin */
    margin-bottom: 1rem; /* Increase bottom margin on mobile */
  }

  .chat-history {
    min-height: 300px;
  }

  .social-links {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .social-link {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }
}

/* connect star*/
.connect-star-container {
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 1000;
}

.connect-star {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.3s ease;
}

.star {
  font-size: 24px;
  color: #2affff;
  text-shadow: 0 0 10px rgba(42, 255, 255, 0.8);
  animation: twinkle 1.5s infinite ease-in-out;
  position: relative;
  z-index: 2;
}

.star-trail {
  position: absolute;
  top: 50%;
  right: 24px;
  height: 2px;
  width: 0;
  background: linear-gradient(to left, #2affff, transparent);
  transform: translateY(-50%);
  opacity: 0;
  transition: all 0.3s ease;
}

.connect-text {
  color: white;
  font-size: 16px;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.connect-star:hover .star-trail {
  width: 60px;
  opacity: 1;
}

.connect-star:hover .connect-text {
  opacity: 1;
  transform: translateX(0);
}

.connect-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.connect-popup.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.connect-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.connect-link:hover {
  background: rgba(42, 255, 255, 0.2);
  transform: translateX(5px);
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.9);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .connect-star-container {
    bottom: 20px;
    right: 20px;
  }

  .connect-text {
    display: none;
  }

  .connect-popup {
    right: 0;
  }
}

/* Crystal Spellbook Styles */
.crystal-spellbook {
  flex: 1;
  position: relative;
  min-height: 600px;
  perspective: 1000px;
}

.crystal-nav {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.crystal-shard {
  position: relative;
  background: none;
  border: none;
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
}

.crystal-shard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(42, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: 1rem;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transform: translateZ(-1px);
}

.crystal-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(42, 255, 255, 0.2),
    rgba(255, 255, 255, 0.1)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 1rem;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.crystal-shard:hover {
  transform: translateY(-5px) rotateX(10deg);
}

.crystal-shard:hover .crystal-glow {
  opacity: 1;
}

.crystal-shard span {
  color: white;
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.crystal-pages {
  position: relative;
  height: 100%;
}

.crystal-page {
  position: absolute;
  inset: 0;
  background: rgba(42, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  padding: 2rem;
  opacity: 0;
  transform: translateY(20px) rotateX(5deg);
  transition: all 0.5s ease;
  pointer-events: none;
}

.crystal-page.active {
  opacity: 1;
  transform: translateY(0) rotateX(0);
  pointer-events: all;
}

.page-content {
  color: white;
  max-width: 800px;
  margin: 0 auto;
}

.page-content h2 {
  color: #2affff;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 10px rgba(42, 255, 255, 0.5);
}
