/* ========== CSS Reset & 基础设定 ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 配色 */
  --bg-primary: #0a0a1a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-input: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(139, 92, 246, 0.4);

  --text-primary: #f0f0f5;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-violet: #8B5CF6;
  --accent-cyan: #06B6D4;
  --accent-pink: #EC4899;
  --gradient-primary: linear-gradient(135deg, #8B5CF6, #06B6D4);
  --gradient-hover: linear-gradient(135deg, #7C3AED, #0891B2);
  --gradient-error: linear-gradient(135deg, #EF4444, #EC4899);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15), 0 0 60px rgba(6, 182, 212, 0.08);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========== 背景装饰光球 ========== */
.bg-orbs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-violet);
  top: -15%;
  left: -10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-cyan);
  top: 40%;
  right: -12%;
  animation-delay: -7s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--accent-pink);
  bottom: -10%;
  left: 30%;
  animation-delay: -14s;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(30px, -40px) scale(1.05);
  }

  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }

  75% {
    transform: translate(15px, 35px) scale(1.02);
  }
}

/* ========== 容器 ========== */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 40px;
}

/* ========== 标题区 ========== */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 50%, #67e8f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ========== 输入区 ========== */
.input-section {
  margin-bottom: 32px;
}

.input-wrapper {
  display: flex;
  gap: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.input-wrapper input {
  flex: 1;
  padding: 18px 24px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: var(--font-family);
  color: var(--text-primary);
}

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

.input-wrapper button {
  padding: 18px 32px;
  background: var(--gradient-primary);
  border: none;
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-wrapper button:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.input-wrapper button:active {
  transform: scale(0.98);
}

.input-wrapper button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.hint {
  text-align: center;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* 加载旋转动画 */
.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* ========== 错误提示 ========== */
.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  color: #FCA5A5;
  font-size: 0.9rem;
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease;
}

.error-box[hidden] {
  display: none;
}

/* ========== 结果卡片 ========== */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 48px;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card[hidden] {
  display: none;
}

.video-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

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

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity var(--transition);
}

.video-preview:hover .play-overlay {
  opacity: 1;
}

.video-info {
  padding: 24px;
}

.video-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-author {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.provider-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-violet);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

/* V8 新增样式 */
.version-badge {
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 100px;
  background: var(--gradient-primary);
  color: white;
}

.platforms-hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.platform-tag {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.platform-tag:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.video-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.platform-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.cached-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ADE80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.cached-badge[hidden] {
  display: none;
}

.video-duration {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.quality-section {
  margin-bottom: 16px;
}

.quality-section[hidden] {
  display: none;
}

.quality-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.quality-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.quality-tag {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* 按钮组 */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-family);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn[hidden] {
  display: none;
}

/* ========== 特性展示 ========== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.feature-card {
  text-align: center;
  padding: 28px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========== 动画 ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .container {
    padding: 32px 16px 24px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .input-wrapper {
    flex-direction: column;
    border-radius: var(--radius-md);
  }

  .input-wrapper input {
    padding: 16px 18px;
  }

  .input-wrapper button {
    padding: 16px;
    justify-content: center;
    border-radius: 0;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }
}