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

:root {
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #fe2c55;
  --accent-hover: #e0264d;
  --border: #e5e5ea;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px 80px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  margin-bottom: 10px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #fe2c55, #ff6b6b, #ff2442);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.header .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Input Card */
.input-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.input-wrapper {
  display: flex;
  gap: 10px;
}

.input-wrapper input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg);
  min-width: 0;
}

.input-wrapper input:focus {
  border-color: var(--accent);
}

.input-wrapper input::placeholder {
  color: var(--text-tertiary);
}

.btn-primary {
  flex-shrink: 0;
  padding: 12px 24px;
  background: linear-gradient(135deg, #fe2c55, #ff6b6b);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: scale(1.02);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error-msg {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff0f0;
  color: #d63031;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}

.error-msg:not(:empty) {
  display: block;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result */
.result-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.platform-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.tag-douyin {
  background: #1a1a2e;
  color: #fff;
}

.tag-xiaohongshu {
  background: #ff2442;
  color: #fff;
}

.tag-kuaishou {
  background: #ff4906;
  color: #fff;
}

.result-type {
  font-size: 13px;
  color: var(--text-secondary);
}

.result-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  word-break: break-word;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Media preview */
.media-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-hint {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff8e1;
  border-radius: 8px;
  font-size: 12px;
  color: #8d6e00;
  text-align: center;
}

.media-preview video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  max-height: 520px;
}

.btn-download,
.btn-download-img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  cursor: pointer;
}

.btn-download:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}

.btn-download:active {
  transform: scale(0.98);
}

.btn-direct {
  background: #2196F3;
  color: #fff;
}

.btn-direct:hover {
  background: #1976D2;
}

.btn-music {
  background: #f0f0f0;
  color: var(--text);
}

.btn-music:hover {
  background: #e5e5ea;
}

/* 下载全部按钮 */
.image-actions {
  margin-bottom: 16px;
}

.btn-download-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #ff6b35, #f7c948);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
  width: 100%;
  justify-content: center;
}

.btn-download-all:hover {
  transform: scale(1.02);
}

.btn-download-all:active {
  transform: scale(0.98);
}

/* Image grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.image-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f0f0;
}

.image-item img {
  width: 100%;
  display: block;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.btn-download-img {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 6px 12px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 8px;
  gap: 4px;
}

.btn-download-img:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-tertiary);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 20px 12px 80px;
  }

  .header h1 {
    font-size: 24px;
  }

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

  .btn-primary {
    width: 100%;
  }

  .image-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}
