:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e8ecf3;
  --text: #14171c;
  --muted: #8a9099;

  /* vivo 品牌蓝 —— OriginOS 的主色系 */
  --brand: #2b5ce6;
  --brand-dark: #1c46c4;
  --brand-soft: rgba(43, 92, 230, 0.08);
  --brand-grad: linear-gradient(145deg, #415fff, #2b5ce6);

  --ok: #22c55e;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow: 0 2px 14px rgba(43, 92, 230, 0.07);
  --shadow-lg: 0 6px 22px rgba(43, 92, 230, 0.1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

.page {
  max-width: 560px; margin: 0 auto;
  padding: 0 18px calc(28px + var(--safe-b));
}

/* ---------- 头部 ---------- */
.hero {
  padding: 34px 4px 22px;
  text-align: center;
}
.hero .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
}
.hero h1 {
  font-size: 23px; line-height: 1.4; margin: 14px 0 6px;
  font-weight: 700; letter-spacing: -0.2px;
}
.hero .sub {
  color: var(--muted); font-size: 14px; margin: 0;
}
.hero .addr {
  color: var(--muted); font-size: 12px; margin: 8px 0 0;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}

/* 浏览器不支持 Web Share 时的引导 */
.browser-warn {
  background: linear-gradient(145deg, #fff7ed, #ffedd5);
  border: 1px solid #fdba74;
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 18px;
}
.browser-warn .bw-title {
  font-size: 15px; font-weight: 700; color: #9a3412; margin-bottom: 6px;
}
.browser-warn .bw-text {
  font-size: 13px; color: #7c2d12; line-height: 1.75; margin-bottom: 12px;
}
.browser-warn .bw-text b { color: #9a3412; }
.browser-warn .bw-url {
  display: block; background: #fff; border: 1px dashed #fdba74;
  border-radius: 8px; padding: 9px 11px; margin-bottom: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px; color: #7c2d12; word-break: break-all;
  user-select: text; -webkit-user-select: text;
}
.browser-warn .bw-btn {
  width: 100%; padding: 12px 16px;
  background: #ea580c; color: #fff; border: none;
  border-radius: 11px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.browser-warn .bw-btn:active { transform: scale(0.98); }

/* ---------- 素材预览 ---------- */
.preview {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.preview .label {
  font-size: 12px; color: var(--muted); margin: 0 0 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.preview .label .auto {
  color: var(--ok); background: rgba(34, 197, 94, 0.1);
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}

.thumbs { display: flex; gap: 8px; }
.thumbs .t {
  flex: 1; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--line); position: relative;
}
.thumbs .t img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .t .play {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: rgba(0,0,0,0.22); color: #fff;
  font-size: 26px;
}
.thumbs .t.empty {
  border: 1.5px dashed var(--line); background: transparent;
}

.copy-box {
  margin-top: 12px; padding: 11px 13px;
  background: var(--bg); border-radius: 11px;
  font-size: 13.5px; line-height: 1.75; color: #4b5563;
  position: relative;
}
/* 文案常驻展开 —— 顾客不需要多点一下「展开」才看得到全文 */
.copy-box #copytext {
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}
.copy-box.expand #copytext { max-height: none; }
.copy-box .more {
  position: absolute; right: 0; bottom: 0; padding: 2px 8px 2px 20px;
  background: linear-gradient(90deg, transparent, var(--bg) 30%);
  color: var(--brand); font-size: 12px; cursor: pointer;
}

/* 换一换 */
.swap-row { display: flex; justify-content: flex-end; margin-top: 8px; }
.swap-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; font-size: 12.5px; font-weight: 500;
  color: var(--brand); background: var(--brand-soft);
  border: 1px solid rgba(43, 92, 230, 0.18); border-radius: 999px;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, transform 0.12s, opacity 0.15s;
}
.swap-btn:hover { background: rgba(43, 92, 230, 0.14); }
.swap-btn:active { transform: scale(0.95); }
.swap-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.swap-btn.spin { animation: spin 0.7s linear infinite; }

/* ---------- 平台按钮 ---------- */
.section-title {
  font-size: 13px; color: var(--muted); margin: 0 2px 11px;
  font-weight: 500;
}

.grid { display: grid; gap: 11px; }

.platform {
  display: flex; align-items: center; gap: 13px;
  background: var(--card); border: 1px solid transparent;
  border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
  position: relative;
}
.platform:active { transform: scale(0.985); }
.platform.loading { opacity: 0.6; pointer-events: none; }
.platform .icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--bg);
}
.platform .info { flex: 1; min-width: 0; }
.platform .info .name {
  font-size: 16px; font-weight: 600; letter-spacing: -0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.platform .info .desc {
  font-size: 12.5px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.platform .go {
  color: var(--muted); font-size: 18px; flex-shrink: 0;
}
.platform .tag {
  position: absolute; top: -7px; right: 12px;
  background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; letter-spacing: 0.3px;
}

/* 步骤说明 —— 常驻在每组按钮下面，省掉点击时的中间弹层 */
.step-note {
  margin: 11px 4px 0;
  padding: 10px 13px;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 10px;
  font-size: 12.5px;
  color: #4b5563;
  line-height: 1.85;
}
.step-note b { color: var(--brand); font-weight: 600; }

/* ============================================================
   平台入口 —— 手机桌面 App 图标式宫格
   ============================================================ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 6px;
  padding: 4px 0 2px;
}
@media (min-width: 480px) {
  .app-grid { grid-template-columns: repeat(5, 1fr); }
}

.app-tile {
  display: flex; flex-direction: column; align-items: center;
  gap: 7px; cursor: pointer; background: none; border: none;
  padding: 0; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.app-tile:active .app-icon { transform: scale(0.9); }
.app-tile.loading { opacity: 0.55; pointer-events: none; }

.app-icon {
  width: 58px; height: 58px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 29px;
  box-shadow: 0 2px 8px rgba(20, 23, 28, 0.12);
  transition: transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.app-tile .app-name {
  font-size: 11.5px; line-height: 1.35; color: var(--text);
  text-align: center; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 各平台配色，做成 APP 图标的观感 */
.ic-xhs   { background: linear-gradient(145deg, #ff5a5f, #e63946); color: #fff; }
.ic-dy    { background: linear-gradient(145deg, #17181c, #2c2f36); color: #fff; }
.ic-ks    { background: linear-gradient(145deg, #ff7a00, #ff5200); color: #fff; }
.ic-wx    { background: linear-gradient(145deg, #2dc25b, #1aad19); color: #fff; }
.ic-poi   { background: linear-gradient(145deg, #ffb02e, #ff8c00); color: #fff; }
.ic-dp    { background: linear-gradient(145deg, #ff6a00, #f24e00); color: #fff; }
.ic-amap  { background: linear-gradient(145deg, #3ec2ff, #0f92e6); color: #fff; }

/* ============================================================
   保存素材 —— 独立一行、加大
   ============================================================ */
.save-row { margin: 18px 0 2px; }
.save-btn {
  width: 100%; padding: 16px 18px;
  font-size: 16px; font-weight: 600;
  border: none; border-radius: var(--radius-lg);
  background: var(--brand-grad); color: #fff;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: var(--shadow-lg);
  transition: transform 0.12s, opacity 0.15s, box-shadow 0.15s;
}
.save-btn:hover { box-shadow: 0 8px 26px rgba(43, 92, 230, 0.22); }
.save-btn:active { transform: scale(0.98); }
.save-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.save-btn .sub { font-size: 12px; font-weight: 400; opacity: 0.82; }

/* ============================================================
   素材预览 —— 视频一行、图片一行，各占一行
   早先混在一条横铺里，顾客分不出哪个是视频。
   ============================================================ */
/* 每行一个独立卡片块 —— 视频和图片不能看着像挤在一起 */
.media-row {
  background: #f7f9fc;
  border: 1px solid #eef1f6;
  border-radius: 12px;
  padding: 11px 11px 9px;
  margin-bottom: 10px;
}
.media-row:last-of-type { margin-bottom: 0; }

.strip-label {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 9px;
  font-size: 12.5px; color: var(--muted); font-weight: 600;
}
.strip-label b {
  background: #e4ecfa; color: #2b6cf0;
  font-size: 11px; padding: 1px 8px; border-radius: 999px;
}
.strip-empty {
  padding: 22px 12px; text-align: center;
  color: var(--muted); font-size: 13px;
  background: #f7f9fc; border-radius: 10px;
}

.media-strip {
  display: flex; gap: 8px;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.media-strip::-webkit-scrollbar { height: 0; }

.media-strip .m {
  flex: 0 0 auto;
  width: 84px; height: 84px;
  border-radius: 12px; overflow: hidden;
  background: var(--line); position: relative;
  scroll-snap-align: start;
}
.media-strip .m img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-strip .m .play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.28); color: #fff; font-size: 22px;
}
.media-strip .m .tag {
  position: absolute; left: 4px; bottom: 4px;
  background: rgba(0, 0, 0, 0.6); color: #fff;
  font-size: 9.5px; padding: 1px 6px; border-radius: 999px;
  letter-spacing: 0.2px;
}
.media-strip .m.vid { width: 108px; }
.media-strip .m.empty {
  border: 1.5px dashed var(--line); background: transparent;
}
/* 点开预览的手势提示 —— 缩略图要能看出能点 */
.media-strip .m[data-src] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.media-strip .m[data-src]:active { transform: scale(0.96); }

/* ============================================================
   素材预览层 —— 点缩略图全屏看
   ============================================================ */
.lightbox { position: fixed; inset: 0; z-index: 999; }
.lightbox[hidden] { display: none; }
.lightbox-mask {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.9);
}
.lightbox-body {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.lightbox-media {
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-media img {
  max-width: 100%; max-height: calc(100vh - 36px);
  object-fit: contain; border-radius: 10px;
}
.lightbox-media video {
  max-width: 100%; max-height: calc(100vh - 36px);
  border-radius: 10px; background: #000;
}
.lightbox-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16); color: #fff;
  border: none; font-size: 18px; line-height: 1;
  cursor: pointer;
}
.lightbox-close:active { background: rgba(255, 255, 255, 0.3); }

/* ---------- 页脚 ---------- */
.foot {
  text-align: center; color: var(--muted);
  font-size: 11.5px; margin: 26px 0 0; line-height: 1.9;
}
.foot .hint-warn { color: #d97706; }

/* ---------- 底部浮层 ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-mask {
  position: absolute; inset: 0; background: rgba(15, 18, 22, 0.5);
  animation: fadeIn 0.2s ease;
}
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: #fff; border-radius: 22px 22px 0 0;
  padding: 26px 22px calc(26px + var(--safe-b));
  text-align: center; animation: slideUp 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet-icon {
  width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 27px; background: rgba(34, 197, 94, 0.12); color: var(--ok);
}
.sheet-icon.warn { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.sheet-icon.err { background: rgba(220, 38, 38, 0.12); color: var(--err, #dc2626); }
.sheet-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.sheet-text {
  color: var(--muted); font-size: 14px; line-height: 1.8;
  margin-bottom: 20px; text-align: left;
  max-height: 40vh; overflow-y: auto;
}
.sheet-text .copy-plain {
  background: var(--bg); border-radius: 11px; padding: 12px 14px;
  color: var(--text); font-size: 14px; line-height: 1.8;
}
.sheet-actions { display: flex; flex-direction: column; gap: 10px; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp {
  from { transform: translateY(100%) }
  to { transform: translateY(0) }
}

/* ---------- 按钮 ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 15px; font-size: 16px; font-weight: 600;
  border: none; border-radius: 13px; cursor: pointer;
  background: var(--bg); color: var(--text);
  transition: opacity 0.15s, transform 0.12s;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(32px + var(--safe-b));
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 23, 28, 0.92); color: #fff;
  padding: 11px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity 0.22s, transform 0.22s;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 骨架屏 ---------- */
.skeleton { padding: 40px 22px; }
.sk-logo {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--line); margin: 0 auto 18px;
  animation: pulse 1.2s ease-in-out infinite;
}
.sk-line {
  height: 15px; border-radius: 8px; background: var(--line);
  margin: 0 auto 11px; animation: pulse 1.2s ease-in-out infinite;
}
.sk-line.w60 { width: 60%; height: 21px; }
.sk-line.w40 { width: 40%; }
.sk-card {
  height: 76px; border-radius: var(--radius); background: var(--line);
  margin-top: 13px; animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1 }
  50% { opacity: 0.45 }
}

/* ---------- 空态 / 错误 ---------- */
.state {
  text-align: center; padding: 72px 26px; color: var(--muted);
}
.state .emoji { font-size: 48px; margin-bottom: 16px; }
.state .t { font-size: 17px; color: var(--text); font-weight: 600; margin-bottom: 8px; }
.state .d { font-size: 14px; line-height: 1.8; }

/* ---------- 小红书式进度点 ---------- */
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite; display: inline-block;
}
.spinner.dark { border-color: rgba(20,23,28,0.18); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg) } }
