:root {
  --primary-color: #e79549; 
  --secondary-color: #f7a242;
  --background-color: #f5f5f5;
  --text-color: #333;
  --light-text-color: #666;
  --border-color: #ddd;
  --box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  --radius: 8px; /* 补充 radius 变量定义 */
}

body {
  font-family: 'Open Sans', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.image-gallery-container {
  margin: 1rem 0;
  padding: 1rem;
  background-color: #f9f9f9;
  border-radius: var(--radius);
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.gallery-header h4 {
  color: var(--primary-color);
  font-size: 1.1rem;
}

.gallery-tip {
  font-size: 0.85rem;
  color: var(--light-text-color);
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
}

.gallery-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.8rem;
  padding: 4px 8px;
  text-align: center;
}

/* 图片模态框优化 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  max-width: 90%;
  max-height: 90vh;
  border: 4px solid white;
  border-radius: 8px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--primary-color);
}

/* 容器样式 */
.container {
  background-color: #fff;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: var(--box-shadow);
  width: 100%;
  max-width: 800px;
  animation: fadeIn 0.5s ease-out;
}

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

/* 头部样式 */
header {
  text-align: center;
  margin-bottom: 2.5rem;
}

h1 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 2.2rem;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

header p {
  color: var(--light-text-color);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* 输入组样式 */
.input-group {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

#input-url {
  flex: 1;
  padding: 1rem 1.2rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#input-url:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(35, 173, 229, 0.2);
}

#parse-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

#parse-button:hover {
  background-color: #eb9a58;
  transform: translateY(-1px);
}

#parse-button:active {
  transform: translateY(0);
}

/* 结果区域样式 */
.result {
  min-height: 100px;
  padding: 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background-color: #f9f9f9;
  transition: all 0.3s ease;
  position: relative;
  overflow: auto;
}

.result:empty::before {
  content: "等待解析结果...";
  color: var(--light-text-color);
  opacity: 0.7;
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.video-player {
  display: block; 
  margin: 0 auto; 
  max-width: 100%;
}

.video-header {
  text-align: center;
}

.video-title {
  color: var(--primary-color);
  margin-bottom: 1rem;
  word-break: break-word;
}

.video-cover {
  width: 100%;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

.video-info {
  line-height: 1.8;
}

.video-desc {
  margin-top: 1rem;
  padding: 1rem;
  background-color: rgba(251, 114, 153, 0.05);
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
}

.video-desc p {
  margin: 0.5rem 0 0 0;
  white-space: pre-line;
}

.video-player {
  margin-top: 1rem;
}

/* UP主信息样式 */
.owner-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.owner-info:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* UP 主信息标题 */
.owner-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  text-align: center;
}

.owner-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--secondary-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.owner-details {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.owner-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
}

.owner-uid {
  font-size: 1rem;
  color: var(--light-text-color);
}

/* 统计信息样式 */
.video-stats {
  margin-top: 1rem;
}

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

.stat-item {
  background-color: #fff;
  padding: 0.8rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-item span:first-child {
  display: block;
  color: var(--light-text-color);
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.stat-item span:last-child {
  display: block;
  font-weight: 600;
  color: var(--secondary-color);
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--light-text-color);
}

@media (max-width: 768px) {
  .container {
    padding: 1.5rem;
  }

  .input-group {
    flex-direction: column;
  }

  #parse-button {
    width: 100%;
  }

  h1 {
    font-size: 1.8rem;
  }

  .owner-info {
    flex-direction: column;
    text-align: center;
  }

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

.video-music {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.music-play-btn {
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 1.6rem;
  height: 1.6rem; 
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease;
}

.music-play-btn:hover {
  background-color: #1976D2;
}

.music-audio {
  display: none;
}

/* 模态框样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9); /* 半透明背景 */
}

/* 模态框中的图片样式 */
.modal-content {
    display: block;
    margin: auto; /* 水平居中 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 垂直居中 */
    max-width: 90%; /* 限制图片最大宽度 */
    max-height: 90%; /* 限制图片最大高度 */
    border: none; /* 去除边框 */
}

/* 关闭按钮样式 */
.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}