:root {
  --bg: #f5f6f8;
  --bg-card: #ffffff;
  --text: #1a1d24;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ─── 顶栏 ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-size: 18px; font-weight: 700;
}
.brand-name { font-size: 18px; font-weight: 700; }
.brand-sub { font-size: 13px; color: var(--text-sub); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ─── 按钮 ─── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .18s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary {
  background: #fff; color: var(--primary);
  border-color: #d6e0fb;
}
.btn-secondary:hover { background: var(--primary-soft); }
.btn-ghost {
  background: transparent; color: var(--text-sub);
  border-color: var(--border);
}
.btn-ghost:hover { background: #f0f1f3; color: var(--text); }

.btn-spinner { display: none; }
.btn.loading .btn-spinner { display: block; animation: spin 1s linear infinite; }
.btn.loading .btn-label { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Hero ─── */
.hero { text-align: center; padding: 28px 0 8px; }
.hero-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.hero-desc { margin-top: 10px; color: var(--text-sub); font-size: 15px; }
.hero-desc b { color: var(--text); font-weight: 600; }

/* ─── 平台 chips ─── */
.platforms {
  display: flex; gap: 10px; justify-content: center;
  margin: 24px 0 18px; flex-wrap: wrap;
}
.platform-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px;
  background: #fff; border: 1px solid var(--border);
  font-size: 14px; color: var(--text-sub); cursor: pointer;
  transition: all .18s ease; font-family: var(--font);
}
.platform-chip:hover { border-color: #c7d2fe; color: var(--text); }
.platform-chip.active {
  background: var(--primary-soft); border-color: var(--primary);
  color: var(--primary); font-weight: 600;
}
.chip-emoji { font-size: 15px; }

/* ─── 输入卡片 ─── */
.input-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
  border: 1px solid var(--border);
}
#urlInput {
  width: 100%; resize: vertical; min-height: 92px;
  border: none; outline: none; font-size: 15px;
  font-family: var(--font); color: var(--text);
  line-height: 1.6; background: transparent;
}
#urlInput::placeholder { color: #b0b4bc; }
.input-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 10px; padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ─── 消息 ─── */
.message {
  margin-top: 16px; padding: 12px 16px; border-radius: 10px;
  font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.message.hidden { display: none; }
.message.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.message.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ─── 结果卡片 ─── */
.result { margin-top: 24px; }
.result.hidden { display: none; }
.result-card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
  border: 1px solid var(--border);
  display: grid; grid-template-columns: 1.05fr 1fr;
}
@media (max-width: 720px) {
  .result-card { grid-template-columns: 1fr; }
}

.media-pane {
  background: #0f1115; min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.video-wrap, .image-wrap { width: 100%; height: 100%; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; max-height: 460px; display: block; }
.image-wrap img { width: 100%; height: 100%; object-fit: contain; max-height: 460px; display: block; }
.cover-fallback {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: #6b7280; font-size: 14px;
}
.cover-fallback span { font-size: 44px; }

.hidden { display: none !important; }

.info-pane { padding: 22px; display: flex; flex-direction: column; }
.info-head { display: flex; gap: 8px; margin-bottom: 12px; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
}
.tag-type { background: #f0fdf4; color: #16a34a; }

.result-title {
  font-size: 17px; font-weight: 700; line-height: 1.5;
  margin-bottom: 18px; word-break: break-word;
}

.meta-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.meta-row { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; }
.meta-icon { width: 20px; text-align: center; flex-shrink: 0; }
.meta-label { color: var(--text-sub); flex-shrink: 0; }
.meta-value { color: var(--text); font-weight: 500; word-break: break-all; }
.meta-value.placeholder { color: #b0b4bc; font-weight: 400; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.actions .btn { justify-content: center; }
.actions .btn.hidden { display: none; }

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

/* ─── 历史 ─── */
.history { margin-top: 36px; }
.history.hidden { display: none; }
.history-title {
  font-size: 15px; font-weight: 700; color: var(--text-sub);
  margin-bottom: 12px;
}
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; cursor: pointer;
  transition: all .15s ease;
}
.history-item:hover { border-color: #c7d2fe; box-shadow: var(--shadow); }
.history-thumb {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover;
  background: #eef0f3; flex-shrink: 0;
}
.history-meta { flex: 1; min-width: 0; }
.history-title-text {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.history-platform {
  font-size: 12px; font-weight: 600; color: var(--primary);
  background: var(--primary-soft); padding: 3px 8px; border-radius: 6px;
  flex-shrink: 0;
}

/* ─── 页脚 ─── */
.footer {
  margin-top: 40px; text-align: center;
  font-size: 12px; color: #9ca3af; padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ─── 弹窗 ─── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 17, 21, 0.4); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: 440px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  border: none; background: transparent; cursor: pointer;
  font-size: 16px; color: var(--text-sub); width: 30px; height: 30px;
  border-radius: 8px;
}
.modal-close:hover { background: #f0f1f3; }
.modal-body { padding: 20px 22px; }
.modal-desc { font-size: 14px; color: var(--text-sub); margin-bottom: 16px; }
.modal-desc a { color: var(--primary); }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.field-input {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--border); font-size: 14px; outline: none;
  font-family: var(--font);
}
.field-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.modal-note { margin-top: 10px; font-size: 12px; color: #9ca3af; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--border); background: #fafafa;
}

/* ─── 提交到公众空间选项 ─── */
.submit-options { display: flex; flex-direction: column; gap: 10px; }
.submit-option {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; cursor: pointer; text-align: left;
  font-family: var(--font); transition: all .15s ease;
}
.submit-option:hover { border-color: var(--primary); background: var(--primary-soft); }
.submit-option.loading { opacity: .6; pointer-events: none; }
.so-emoji { font-size: 26px; }
.so-name { font-size: 15px; font-weight: 700; color: var(--text); }
.so-desc { font-size: 12px; color: var(--text-sub); margin-left: auto; }
