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

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #F8FAFF;
  color: #1E293B;
  line-height: 1.6;
}

h1 { font-size: 48px; font-weight: 600; color: #4F46E5; margin-bottom: 20px; }
h2 { font-size: 36px; font-weight: 600; color: #1E293B; margin-bottom: 16px; }
h3 { font-size: 24px; font-weight: 600; color: #1E293B; margin-bottom: 12px; }

p {
  font-size: 16px;
  font-weight: 400;
  color: #1E293B;
  line-height: 1.8;
}

ul {
  padding-left: 0;
  list-style-position: inside;
}
li { margin-bottom: 12px; }

@media (max-width: 768px) {
  h1 { font-size: 36px; }
  h2 { font-size: 28px; }
  h3 { font-size: 20px; }
}

/* Header */
header {
  background: #F8FAFF;
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
@media (max-width: 768px) {
  header { position: relative; }
}
.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}
.logo {
  font-size: 24px;
  font-weight: 700;
  color: #4F46E5;
  text-decoration: none;
}
.social-links { display: flex; gap: 20px; }
.social-links a {
  color: #666;
  text-decoration: none;
  transition: color 0.3s;
}
.social-links a:hover { color: #4F46E5; }

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
}
.mobile-menu-btn span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #4F46E5;
  margin: 5px 0;
  border-radius: 3px;
  transition: 0.3s;
}
.mobile-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border-top: 1px solid #eee;
}
.mobile-nav.active { display: block; }
.mobile-nav a {
  display: block;
  padding: 12px 0;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid #f5f5f5;
}
@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
  .social-links { display: none; }
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero */
.hero {
  padding: 40px 0 80px;
  text-align: center;
}
.download-box {
  width: 80%;
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  padding: 100px 40px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.1);
}
.hero-description {
  max-width: 800px;
  margin: 0 auto 60px;
  font-size: 18px;
  line-height: 1.8;
}
@media (max-width: 768px) {
  .hero { padding: 0; }
  .download-box {
    width: auto;
    margin: 0 -20px;
    padding: 20px 20px 20px;
    border-radius: 0;
    min-height: 90vh;
  }
  .hero-description { font-size: 16px; }
}

/* Input */
.input-group {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}
.input-group input {
  flex: 1;
  min-width: 0;
  padding: 14px 20px;
  border: 2px solid #e5e7eb;
  border-right: none;
  border-radius: 12px 0 0 12px;
  font-size: 16px;
  outline: none;
  background: white;
  transition: border-color 0.3s;
}
.input-group input:focus {
  border-color: #4F46E5;
  z-index: 1;
}
.input-group button {
  padding: 14px 28px;
  background: #4F46E5;
  color: white;
  border: 2px solid #4F46E5;
  border-radius: 0 12px 12px 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  flex-shrink: 0;
  white-space: nowrap;
}
.input-group button:hover {
  background: #4338CA;
  border-color: #4338CA;
}

/* Error / Spinner / Disclaimer */
.error-toast {
  display: none;
  background-color: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}
.loading-spinner {
  display: none;
  margin: 16px auto 10px;
  width: 36px;
  height: 36px;
  border: 3px solid #E2E8F0;
  border-top: 3px solid #4F46E5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.disclaimer {
  font-size: 12px;
  color: #808080;
  font-style: italic;
  margin-top: 8px;
  margin-bottom: 0;
}

/* ===== Result Area (CLS fix) ===== */
#downloadResult {
  display: block;              /* 不再 none/block 切换 */
  margin-top: 0;
  text-align: left;
  border-top: 0;
  padding-top: 0;

  /* 默认收起，但保持可动画属性 */
  visibility: hidden;
  max-height: 0;
  opacity: 0;
  overflow: hidden;

  contain: layout paint;
  overflow-anchor: none;
  transition: max-height 0.2s ease, opacity 0.2s ease;
}

#downloadResult.is-active {
  visibility: visible;
  opacity: 1;
  max-height: 900px;           /* 足够容纳 header + scroll */
  margin-top: 12px;
  border-top: 1px solid #eee;
  padding-top: 12px;
}

.result-shell {
  height: auto;
  display: flex;
  flex-direction: column;
}
.result-header {
  flex: 0 0 auto;
  padding: 0 4px 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0;
}
.main-title {
  font-size: 20px;
  font-weight: 600;
  color: #1E293B;
  line-height: 1.4;
  margin: 0;
}

/* 固定高度，条目多时内部滚动，外层不再抖 */
.result-scroll {
  margin-top: 10px;
  height: 340px;
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 2px 2px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result-card {
  display: flex;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px;
  gap: 14px;
  align-items: center;
  min-height: 106px;
}
.card-thumbnail {
  flex: 0 0 160px;
  width: 160px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
}
.card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}
.card-thumbnail .no-thumb {
  width: 100%;
  height: 100%;
  background: #eee;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #999;
}
.card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-title {
  font-size: 14px;
  font-weight: 400;
  color: #64748B;
  margin-bottom: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.5em * 2);
  max-height: calc(1.5em * 2);
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.meta-info {
  font-size: 14px;
  color: #334155;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.download-btn-new {
  background: white;
  color: #4F46E5;
  border: 1px solid #4F46E5;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.download-btn-new:hover {
  background: #F8FAFF;
  border-color: #4338CA;
  color: #4338CA;
}
.empty-state {
  color: #64748B;
  font-size: 14px;
  padding: 6px 2px;
}

/* skeleton */
.skeleton-loading .result-card { pointer-events: none; }
.skeleton-card { min-height: 106px; }
.skeleton-thumb {
  background: linear-gradient(90deg, #f2f4f7 25%, #e9edf3 37%, #f2f4f7 63%);
  background-size: 400% 100%;
  animation: sk 1.2s ease-in-out infinite;
}
.skeleton-line {
  border-radius: 6px;
  background: linear-gradient(90deg, #f2f4f7 25%, #e9edf3 37%, #f2f4f7 63%);
  background-size: 400% 100%;
  animation: sk 1.2s ease-in-out infinite;
}
.main-title-skeleton { width: 180px; height: 28px; }
.skeleton-line-title { width: 62%; height: 16px; margin-bottom: 10px; }
.skeleton-line-meta { width: 42%; height: 14px; }

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

/* Sections */
section { padding: 60px 20px; }
.content-section { max-width: 1000px; margin: 0 auto; }
.content-section p { margin-bottom: 20px; }
.section-header { text-align: center; max-width: 800px; margin: 0 auto 80px; }

/* Platform Grid */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 30px;
  margin-top: 40px;
}
.platform-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: white;
  border-radius: 12px;
  text-decoration: none;
  color: #1E293B;
  transition: transform 0.3s, box-shadow 0.3s;
  height: 140px;
}
.platform-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.15);
}
.platform-item.disabled { opacity: 0.5; pointer-events: none; }

@media (max-width: 1024px) {
  .platform-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Description / Howto / Features / FAQ / Tools / Footer（保持你原风格） */
.description-section { padding: 80px 20px; }
.description-content { max-width: 1000px; margin: 0 auto; }
.description-intro { margin-bottom: 60px; }
.feature-text-block { margin-bottom: 50px; }

.howto-section { padding: 80px 20px; }
.howto-content { max-width: 1000px; margin: 0 auto; }
.howto-intro { margin-bottom: 60px; }
.step-block, .step-text-block { margin-bottom: 50px; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-top: 40px;
}
.feature-card {
  background: white;
  padding: 40px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: transform 0.3s, box-shadow 0.3s;
  margin-top: 30px;
}
.features-grid .feature-card { margin-top: 0; }
.features-grid ul { padding-left: 20px; }
.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.15);
}
.feature-icon {
  width: 50px;
  height: 50px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 24px;
}

.faq-section { padding: 80px 20px; }
.faq-content { max-width: 1000px; margin: 0 auto; }
.faq-intro { margin-bottom: 60px; }
.faq-block { margin-bottom: 50px; }
.faq-block h3 { font-size: 18px; margin-bottom: 16px; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 30px;
}
.tool-link {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: #F8FAFF;
  border-radius: 8px;
  text-decoration: none;
  color: #1E293B;
  transition: all 0.3s;
  text-align: center;
  font-weight: 500;
  min-height: 80px;
  line-height: 1.4;
}
.tool-link:hover { background: transparent; color: #4F46E5; }

footer {
  background: #EDF2F7;
  padding: 0;
  margin-top: 60px;
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px 0;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.8fr;
  gap: 40px;
  margin-bottom: 40px;
  text-align: left;
}
.footer-about h3 { font-size: 20px; margin-bottom: 16px; }
.footer-links h3 { font-size: 20px; margin-bottom: 20px; }
.footer-links ul { list-style: none; padding-left: 0; margin: 0; }
.footer-links li { margin-bottom: 12px; }
.footer-links a {
  color: #666;
  text-decoration: none;
  transition: color 0.3s;
}
.footer-links a:hover { color: #4F46E5; }
.footer-bottom {
  padding: 30px 20px 20px;
  border-top: 1px solid #CBD5E0;
}
.footer-bottom-inner { max-width: 1200px; margin: 0 auto; }
.footer-disclaimer { font-size: 14px; color: #808080; margin-bottom: 20px; }
.footer-copyright { font-size: 14px; color: #808080; text-align: center; }

/* Mobile */
@media (max-width: 768px) {
  .platform-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .platform-item { height: 120px; }

  .description-section,
  .howto-section,
  .faq-section { padding: 60px 20px; }

  .features-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .footer-content { grid-template-columns: 1fr; gap: 40px; }

  .input-group {
    flex-direction: column;
    gap: 12px;
  }
  .input-group input {
    width: 100%;
    border-radius: 12px;
    border-right: 2px solid #e5e7eb;
  }
  .input-group button {
    width: 100%;
    border-radius: 12px;
  }

  #downloadResult.is-active {
    max-height: 78vh;
  }
  .result-scroll {
    height: 44vh;
    max-height: 44vh;
  }

  .result-card {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }
  .card-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
  }
  .card-meta { flex-wrap: wrap; }
  .download-btn-new {
    width: 100%;
    text-align: center;
  }
}
