:root {
  --primary: #4e75c8;
  --secondary: #8fb5fb;
  --accent: #ff6b6b;
  --light: #f8f9ff;
  --dark: #2c3e50;
  --success: #7bed9f;
  --warning: #ffd32a;
  --info: #70a1ff;
  --border-radius: 16px;
  --box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  --section-gap: 25px;
  --moveset-bg: rgba(143, 148, 251, 0.2);
}

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

body {
  font-family: "Poppins", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  max-width: 1400px;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  margin: 20px;
}

.app-header {
  background: linear-gradient(120deg, var(--primary), var(--secondary));
  color: white;
  padding: 35px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.app-content {
  display: flex;
  flex-wrap: wrap;
  padding: 30px;
  gap: var(--section-gap);
}

.form-section {
  flex: 1;
  min-width: 350px;
  background: var(--light);
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(143, 148, 251, 0.15);
}

.section-title {
  font-family: "Quicksand", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 25px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--secondary);
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
}
.preview-section {
  flex: 1;
  min-width: 350px;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  position: sticky; /* 粘性定位 */
  top: 20px; /* 距离顶部20px时固定 */
  align-self: flex-start; /* 保持顶部对齐 */
  /* 移除 max-height 限制 */
  overflow-y: visible; /* 允许内容自然扩展 */
  padding-bottom: 20px; /* 底部留白 */
}
/* 确保父容器没有设置 overflow 限制 */
.container {
  overflow: visible; /* 确保不限制粘性定位 */
}
.form-group {
  margin-bottom: 25px;
  position: relative;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e1e5ee;
  border-radius: 10px;
  font-size: 1.05rem;
  background: white;
  font-family: "Poppins", sans-serif;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(143, 148, 251, 0.2);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

button {
  background: linear-gradient(120deg, var(--primary), var(--secondary));
  color: white;
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Quicksand", sans-serif;
}

.removeSkill {
  background: linear-gradient(120deg, #ff6b6b, #ff8e8e);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.image-upload-container {
  margin-bottom: 20px;
}

.image-preview {
  width: 200px;
  height: 200px;
  border: 2px dashed #e1e5ee;
  border-radius: 12px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: white;
  cursor: pointer;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.skill-entry {
  background: white;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  border: 1px solid #f0f2ff;
  position: relative;
  overflow: hidden;
}

.action-buttons {
  display: flex;
  gap: 20px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
  border-radius: var(--border-radius);
  padding: 35px;
  box-shadow: var(--box-shadow);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(143, 148, 251, 0.2);
}

.card-decoration {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(143, 148, 251, 0.1) 0%,
    rgba(143, 148, 251, 0) 70%
  );
  z-index: 0;
  opacity: 0.7;
}

.decoration-1 {
  top: -60px;
  right: -60px;
}

.decoration-2 {
  bottom: -60px;
  left: -60px;
}

.card-header {
  display: flex;
  align-items: stretch;
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 2px solid #f0f2ff;
  position: relative;
  z-index: 1;
  gap: 30px;
}

.pet-image-container {
  width: 220px;
  height: 220px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  position: relative;
}

.pet-meta-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  position: absolute;
  left: 0;
  top: -45px;
  z-index: 2;
  width: 100%;
}

.pet-number {
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border-radius: 20px;
}

.pet-types {
  display: flex;
  gap: 8px;
}

.pet-type {
  padding: 5px 12px;
  border-radius: 20px;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.type-normal {
  background-color: #fecc03;
}
.type-fire {
  background-color: #f73100;
}
.type-water {
  background-color: #58cbfc;
}
.type-electric {
  background-color: #ff9900;
}
.type-grass {
  background-color: #98d33d;
}
.type-ice {
  background-color: #98d8d8;
}
.type-fighting {
  background-color: #f84b06;
}
.type-poison {
  background-color: #8882ca;
}
.type-ground {
  background-color: #b99379;
}
.type-flying {
  background-color: #bfadf6;
}
.type-fairy {
  background-color: #fe70a9;
}
.type-bug {
  background-color: #a8b820;
}
.type-rock {
  background-color: #b8a038;
}
.type-ghost {
  background-color: #da8f9f;
}
.type-dragon {
  background-color: #f5b95c;
}
.type-dark {
  background-color: #de3a3a;
}
.type-steel {
  background-color: #adb9c9;
}
.type-light {
  background-color: #fce628;
}
.type-holyfire {
  background: linear-gradient(135deg, #f73100, #de3a3a);
}
.type-holygrass {
  background: linear-gradient(135deg, #78c850, #a8b820);
}
.type-holywater {
  background: linear-gradient(135deg, #58cbfc, #64b5f6);
}

.pet-name-overlay {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 8px;
  font-family: "Quicksand", sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  border-radius: 0 0 16px 16px;
}

.pet-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stats-container {
  flex: 1;
  display: flex;
  align-items: center;
  height: 100%;
}

.pet-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.pet-name {
  font-family: "Quicksand", sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
}

.pet-number {
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pet-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pet-group img {
  width: 20px;
  height: 20px;
}

.basic-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.info-row {
  display: flex;
  margin-bottom: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed #f0f2ff;
}

.info-row.personality-row {
  border-bottom: 1px dashed #f0f2ff;
  padding: 10px 0;
  margin-bottom: 12px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 700;
  width: 100px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.info-value {
  flex: 1;
  color: var(--dark);
  font-weight: 500;
}

.card-body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--section-gap);
  position: relative;
  z-index: 1;
}

.info-section {
  flex: 1;
  min-width: 300px;
  background: white;
  border-radius: 16px;
  padding: 25px;
  border: 1px solid #f0f2ff;
  margin-bottom: var(--section-gap);
}

.info-section h3 {
  font-family: "Quicksand", sans-serif;
  font-size: 1.4rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f2ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  width: 100%;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 15px;
  background: #f8f9ff;
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid #eef1ff;
  height: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.stat-name {
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 0.9rem;
}

.stat-value {
  font-weight: 800;
  color: var(--dark);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
}

.moveset-list {
  list-style-type: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 15px;
}

.moveset-item {
  background: var(--moveset-bg);
  color: var(--primary);
  padding: 8px 20px;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.skill-item {
  margin-bottom: 25px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  border: 1px solid #f0f2ff;
  position: relative;
  overflow: hidden;
}

.skill-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.skill-name {
  font-weight: 800;
  color: var(--dark);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.skill-details {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.skill-detail {
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-desc {
  margin-top: 15px;
  font-size: 1rem;
  color: #555;
  line-height: 1.6;
  padding: 10px 0;
}

.bloodline {
  margin-bottom: var(--section-gap);
  padding: 25px;
  background: linear-gradient(
    135deg,
    rgba(255, 245, 245, 0.8),
    rgba(255, 230, 230, 0.8)
  );
  border-radius: 16px;
  border: 1px solid #ffecec;
  position: relative;
  z-index: 1;
}

.bloodline + .bloodline {
  margin-top: 20px;
}

.bloodline-title {
  font-family: "Quicksand", sans-serif;
  font-size: 1.5rem;
  color: var(--dark);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.bloodline-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
  border: 2px solid white;
}

.bloodline-name {
  font-weight: 800;
  color: #d63031;
}

.bloodline-desc {
  margin-top: 15px;
  font-size: 1.05rem;
  color: #555;
  line-height: 1.6;
}

.card-footer {
  margin-top: 30px;
  text-align: center;
  font-size: 1rem;
  color: var(--primary);
  padding-top: 20px;
  border-top: 1px dashed #eef1ff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.upload-area {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.upload-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pet-info-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.pet-name-container {
  flex: 1;
}

.pet-image-box {
  width: 100px;
  height: 100px;
  border: 2px dashed #e1e5ee;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: white;
  cursor: pointer;
}

.pet-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.equipment-select,
#intimacyType {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e1e5ee;
  border-radius: 10px;
  font-size: 1.05rem;
  background: white;
  font-family: "Poppins", sans-serif;
  margin-bottom: 10px;
}

.equipment-select:focus,
#intimacyType:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(143, 148, 251, 0.2);
}

.equipment-card {
  background: rgba(143, 148, 251, 0.1);
  border-radius: 10px;
  padding: 15px;
  border: 1px solid rgba(143, 148, 251, 0.2);
  margin-bottom: 15px;
  flex: 1;
}

.equipment-name {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.equipment-desc {
  color: var(--dark);
  font-size: 0.95rem;
}

.intimacy-card {
  background: rgba(255, 215, 0, 0.1);
  border-radius: 10px;
  padding: 15px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  margin-bottom: 15px;
}

.intimacy-type {
  font-weight: 700;
  color: #ff8e00;
  margin-bottom: 8px;
}

.intimacy-desc {
  color: var(--dark);
  font-size: 0.95rem;
}

.type-container {
  display: flex;
  gap: 10px;
}

.type-select {
  flex: 1;
}

.fa-hashtag:before {
  content: "#";
  font-family: inherit;
  font-weight: bold;
}

.pet-meta-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 15px;
}

.pet-name-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.pet-header-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}

.pet-name-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.pet-name {
  font-family: "Quicksand", sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
}

.pet-number {
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 12px;
  border-radius: 20px;
}

.pet-types {
  display: flex;
  gap: 8px;
}

.hidden-file-input {
  display: none;
}

.bloodline-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
}

.bloodline-image-box {
  width: 80px;
  height: 80px;
  border: 2px dashed #e1e5ee;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: white;
  cursor: pointer;
}

.bloodline-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bloodline-name-container {
  flex: 1;
}

.floating-buttons {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 25px;
  border-radius: 50px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.floating-buttons button {
  background: linear-gradient(120deg, #4e54c8, #8f94fb);
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  font-family: "Quicksand", sans-serif;
}

.floating-buttons button:nth-child(2) {
  background: linear-gradient(120deg, #00b09b, #96c93d);
}

.skill-entry hr {
  display: none;
}

.info-row {
  border-bottom: 1px dashed #eef1ff !important;
  padding: 10px 0 !important;
  border-radius: 8px;
  padding: 10px 15px;
  margin-bottom: 8px;
}

.info-label {
  color: var(--primary);
  font-weight: 700;
}

.info-value {
  color: var(--dark);
  font-weight: 600;
}

/* 新增或修改的样式 */
.info-section .moveset-list {
  margin-bottom: 15px;
}

/* 当没有装备、亲密度和血脉时，增加技能部分的上边距 */
.info-section:has(h3:first-child:contains("技能")) {
  margin-top: 40px;
}

/* 调整血脉和技能之间的间距 */
.bloodline + .info-section h3 {
  margin-top: 30px;
}

/* 调整装备和亲密度卡片之间的间距 */
.equipment-card + .intimacy-card,
.equipment-card + .info-section h3,
.intimacy-card + .info-section h3 {
  margin-top: 20px;
}

/* 调整技能项之间的间距 */
.skill-item {
  margin-bottom: 30px;
}

/* 装备水平排列 */
.equipment-container {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.navbar-link {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.navbar-link:hover {
  color: var(--primary);
}

.footer-link {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--primary);
}

@media (max-width: 1000px) {
  .app-content {
    flex-direction: column;
  }

  .card-body {
    flex-direction: column;
  }

  .card-header {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .header-content {
    align-items: center;
    text-align: center;
  }

  .pet-title-row {
    justify-content: center;
  }

  .basic-info-grid {
    grid-template-columns: 1fr;
  }

  .upload-area {
    flex-direction: column;
  }

  .pet-image-container {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
  }

  .stats-container {
    width: 100%;
  }

  .pet-info-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .pet-image-box {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
  }

  .equipment-container {
    flex-direction: column;
  }
}

@media (max-width: 650px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-direction: column;
    gap: 15px;
  }

  .skill-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .bloodline-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bloodline-image-box {
    width: 80px;
    height: 80px;
  }
}

.watermark {
  position: absolute;
  bottom: 20px;
  right: 20px;
  opacity: 0.2;
  pointer-events: none;
  z-index: 100;
  width: 150px;
  height: auto;
}

.effort-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e1e5ee;
  border-radius: 6px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
}

.effort-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(143, 148, 251, 0.2);
}
