/* ============================================================
   柔和风格（恢复最初版）+ CSS 变量主题化，右上角可切换配色
   ============================================================ */
:root {
  --p1: #6366f1;      /* 主题亮色：渐变起 / 链接 */
  --p2: #a855f7;      /* 主题副色：渐变终 */
  --deep: #4f46e5;    /* 主题深色：logo / 焦点 / 悬停 */
  --soft: #eef2ff;    /* 主题浅底：badge / chip hover */
  --soft2: #fdf4ff;   /* 页面背景渐变终点 */
}

/* ---------- 配色主题 ---------- */
html[data-theme="ocean"]  { --p1: #0ea5e9; --p2: #2563eb; --deep: #0284c7; --soft: #e0f2fe; --soft2: #eff6ff; }
html[data-theme="mint"]   { --p1: #34d399; --p2: #10b981; --deep: #059669; --soft: #ecfdf5; --soft2: #f0fdfa; }
html[data-theme="sunset"] { --p1: #fb923c; --p2: #f43f5e; --deep: #ea580c; --soft: #fff7ed; --soft2: #fff1f2; }
html[data-theme="rose"]   { --p1: #f472b6; --p2: #ec4899; --deep: #db2777; --soft: #fdf2f8; --soft2: #fff1f2; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, var(--soft) 0%, #f8fafc 45%, var(--soft2) 100%);
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ---------- 头部 ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
}
.logo { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 700; color: var(--deep); }
.logo-mark { width: 27px; height: 27px; flex-shrink: 0; }
.header-right { display: flex; align-items: center; gap: 14px; }
.platforms { font-size: 12px; color: #94a3b8; }

/* 配色选择器 */
.theme-picker { display: flex; align-items: center; gap: 7px; }
.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #e2e8f0;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.swatch:hover { transform: scale(1.2); }
.swatch.active {
  box-shadow: 0 0 0 2px var(--deep);
  transform: scale(1.1);
}

/* ---------- 主体 ---------- */
main { flex: 1; width: min(860px, 92vw); margin: 24px auto 48px; }

.hero { text-align: center; }
.hero h1 { font-size: 34px; margin-bottom: 10px; }
.hero .sub { color: #64748b; margin-bottom: 28px; }

.parse-box {
  display: flex;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 40px rgba(79, 70, 229, 0.12);
}
.parse-box input {
  flex: 1;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.parse-box input:focus { border-color: var(--deep); }
.parse-box button {
  border: none;
  border-radius: 10px;
  padding: 13px 30px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.parse-box button:hover { opacity: 0.88; }
.parse-box button:disabled { opacity: 0.5; cursor: not-allowed; }

.examples { margin-top: 14px; font-size: 13px; color: #94a3b8; }
.chip {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  margin: 0 4px;
  font-size: 13px;
  color: var(--deep);
  cursor: pointer;
}
.chip:hover { background: var(--soft); }

.error {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
  text-align: left;
}

/* ---------- 加载 ---------- */
.loading { text-align: center; margin-top: 48px; color: #64748b; }
.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border: 4px solid var(--soft);
  border-top-color: var(--p1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 结果 ---------- */
#result { margin-top: 40px; }
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.meta { display: flex; gap: 18px; padding: 20px; align-items: flex-start; }
.meta .cover {
  width: 200px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.meta h2 { font-size: 18px; line-height: 1.45; margin-bottom: 10px; word-break: break-all; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--deep);
}
.badge.gray { background: #f1f5f9; color: #64748b; }

.player-wrap { padding: 0 20px 8px; }
.player-wrap video {
  width: 100%;
  max-height: 460px;
  border-radius: 10px;
  background: #000;
}
.tip {
  margin: 8px 0 4px;
  font-size: 13px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
}

.formats { padding: 16px 20px 20px; }
.formats h3 { font-size: 15px; margin-bottom: 12px; color: #334155; }
.fmt-head, .fmt-row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.9fr 1fr 1.6fr;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  font-size: 13px;
}
.fmt-head {
  color: #94a3b8;
  font-size: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.fmt-row { border-bottom: 1px solid #f8fafc; border-radius: 8px; }
.fmt-row:hover { background: #f8fafc; }
.fmt-row .quality { font-weight: 600; color: #0f172a; }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}
.tag.hl { background: #ecfdf5; color: #059669; }
.fmt-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn {
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary { background: var(--deep); color: #fff; }
.btn-primary:hover { background: var(--p1); }
.btn-ghost { background: #f1f5f9; color: #475569; }
.btn-ghost:hover { background: #e2e8f0; }

.again { text-align: center; margin-top: 18px; }
.again button {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 10px;
  padding: 9px 22px;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
}
.again button:hover { border-color: var(--deep); color: var(--deep); }

/* ---------- 页脚 ---------- */
footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: #94a3b8;
}
footer a { color: var(--p1); text-decoration: none; }

@media (max-width: 640px) {
  .parse-box { flex-direction: column; }
  .meta { flex-direction: column; }
  .meta .cover { width: 100%; }
  .fmt-head { display: none; }
  .fmt-row { grid-template-columns: 1fr 1fr; }
  .fmt-actions { grid-column: span 2; justify-content: flex-start; }
  .platforms { display: none; }
}
