:root {
  --primary: #FF2442;
  --primary-dark: #E01E39;
  --primary-soft: #FDECEF;
  --bg: #FAF8F6;
  --card: #FFFFFF;
  --text: #1F1F1F;
  --text-2: #757575;
  --text-3: #B0ACA5;
  --border: #F0EDE8;
  --shadow: 0 6px 28px rgba(31, 31, 31, 0.06);
  --radius: 20px;
}

* { box-sizing: border-box; }

/* 元素带 display 声明时会覆盖 [hidden] 的默认隐藏，这里强制兜底 */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 880px;
  margin: 0 auto;
  height: 66px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--primary);
  position: relative;
}

.logo::before,
.logo::after {
  content: "";
  position: absolute;
  left: 7px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
}

.logo::before { top: 10px; width: 16px; }
.logo::after { top: 17px; width: 10px; }

.brand-name { font-size: 17px; font-weight: 600; letter-spacing: 0.3px; }

.nav { display: flex; gap: 28px; }

.nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
}

.nav a:hover { color: var(--primary); }

/* 主体容器 */
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* 首屏 */
.hero { text-align: center; padding: 72px 0 36px; }

.hero h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.hero-sub {
  margin: 14px auto 0;
  max-width: 520px;
  font-size: 17px;
  color: var(--text-2);
}

.platforms {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.platform {
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 999px;
  color: #fff;
}

.platform-xhs { background: var(--primary); }
.platform-dy { background: #1F1F1F; }

.platform-more {
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border);
}

/* 卡片通用 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.card + .card,
.card + .result,
.result + .card { margin-top: 22px; }

/* 解析面板 */
.panel { padding: 24px 28px 28px; }

#input {
  width: 100%;
  min-height: 128px;
  border: none;
  outline: none;
  resize: vertical;
  background: transparent;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  font-family: inherit;
}

#input::placeholder { color: var(--text-3); }

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 12px;
}

.detect { font-size: 13px; color: var(--text-3); }

.detect-tag {
  display: inline-block;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.panel-actions { display: flex; gap: 22px; }

.btn-text {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.btn-text:hover { color: var(--primary-dark); }

.btn-primary {
  width: 100%;
  height: 52px;
  margin-top: 20px;
  border: none;
  border-radius: 26px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { background: #F5A3B1; cursor: not-allowed; }

.btn-primary.is-loading::after {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-left: 10px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 结果区 */
.result { animation: fadeUp 0.32s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.badge {
  font-size: 13px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: 6px;
}

.author { font-size: 14px; color: var(--text-2); }

.media { margin-bottom: 22px; }

.video-box {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.video-box video {
  display: block;
  width: 100%;
  max-height: 460px;
  background: #000;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  background: var(--border);
  cursor: zoom-in;
  transition: transform 0.2s;
}

.grid img:hover { transform: scale(1.02); }

.copy-block {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.copy-title { font-size: 17px; font-weight: 600; }

.copy-desc {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-2);
  white-space: pre-wrap;
}

.btn-ghost {
  margin-top: 16px;
  height: 38px;
  padding: 0 22px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: #fff;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.action-bar {
  display: flex;
  gap: 14px;
  margin-top: 18px;
}

.btn-outline {
  flex: 1;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-outline-main {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-outline-main:hover {
  background: var(--primary-dark);
  color: #fff;
}

/* 教程 */
.guide h2,
.history-card h2 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 600;
}

.steps { list-style: none; margin: 0; padding: 0; }

.steps li {
  display: flex;
  gap: 16px;
  padding: 14px 0;
}

.steps li + li { border-top: 1px solid var(--border); }

.step-index {
  flex: 0 0 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

.steps b { font-size: 15px; font-weight: 600; }
.steps p { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }

/* 历史记录 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-head h2 { margin: 0; }

.history-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.history-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.2s;
}

.history-item:hover { background: #F3F0EB; }

.history-item img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--border);
  flex: 0 0 52px;
}

.history-info { min-width: 0; flex: 1; }

.history-title {
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-3);
}

/* 调试面板，仅在 ?debug=1 时显示 */
.debug { font-size: 14px; }

.debug-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-2);
}

.debug-row b { color: var(--text); }
.debug-actions { margin-top: 14px; }

.debug pre {
  margin: 14px 0 0;
  padding: 14px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow: auto;
}

/* 页脚 */
.footer {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  margin-top: 56px;
}

.footer p { margin: 0; }
.footer-sub { margin-top: 6px; font-size: 12px; }

/* 图片预览 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  font-size: 34px;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(31, 31, 31, 0.92);
  color: #fff;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 22px;
  animation: fadeUp 0.2s ease both;
}

@media (max-width: 640px) {
  .hero { padding: 44px 0 28px; }
  .hero h1 { font-size: 29px; }
  .hero-sub { font-size: 15px; }
  .wrap { padding: 0 16px 56px; }
  .card { padding: 20px; border-radius: 16px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .history-list { grid-template-columns: 1fr; }
  .nav { gap: 16px; }
  .action-bar { flex-direction: column; }
}
