/* ============================================================
   疯狂表情包制作 - H5 公共样式（粉色可爱治愈风）
   主色 #FF6B9D，圆角卡片，柔和阴影，移动端优先
   ============================================================ */

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

:root {
  --primary: #FF6B9D;
  --primary-light: #FF8FB3;
  --primary-lighter: #FFB8CE;
  --bg: #FFF0F5;
  --card: #FFFFFF;
  --text: #4A4A4A;
  --text-light: #9B9B9B;
  --gold: #FFB800;
  --shadow: 0 6px 20px rgba(255, 107, 157, 0.14);
  --shadow-sm: 0 3px 10px rgba(255, 107, 157, 0.10);
  --radius: 18px;
  --gradient: linear-gradient(135deg, #FF6B9D, #FF8FB3);
}

html, body {
  width: 100%;
  min-height: 100%;
}

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

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }

/* 页面容器：移动端优先，桌面居中 */
.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 74px; /* 给底部导航留空间 */
  overflow-x: hidden;
}

/* ===== 顶部栏 ===== */
.h5-header {
  background: var(--gradient);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(255, 107, 157, 0.25);
}
.h5-header .back {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  border-radius: 50%;
}
.h5-header .back:active { background: rgba(255, 255, 255, 0.2); }
.h5-header .title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.h5-header .right { font-size: 13px; opacity: 0.95; cursor: pointer; padding: 6px 10px; }

/* ===== 底部导航 ===== */
.h5-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  display: flex;
  border-top: 1px solid #ffe4ec;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.h5-tabbar .tab {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  color: #b9b9b9;
  font-size: 11px;
  cursor: pointer;
}
.h5-tabbar .tab .tab-icon { font-size: 22px; display: block; margin-bottom: 1px; }
.h5-tabbar .tab.active { color: var(--primary); font-weight: 600; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 12px 12px;
  padding: 16px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient);
  color: #fff;
  border-radius: 26px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.05s;
  box-shadow: 0 4px 14px rgba(255, 107, 157, 0.3);
}
.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; display: flex; }
.btn-lg { padding: 14px 30px; font-size: 17px; border-radius: 30px; }
.btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  box-shadow: none;
}
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 18px; }

/* ===== 固定底部操作条 ===== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(255, 107, 157, 0.12);
  z-index: 90;
  border-radius: 18px 18px 0 0;
}

/* ===== 表单 ===== */
.input-wrap {
  position: relative;
}
.name-input {
  width: 100%;
  border: 1.5px solid #ffd6e4;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  background: #fffafc;
  color: var(--text);
}
.name-input:focus { border-color: var(--primary); background: #fff; }
.name-input::placeholder { color: #c9c9c9; }

/* ===== 滑杆 ===== */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ffe0eb;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  box-shadow: 0 2px 6px rgba(255, 107, 157, 0.3);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  cursor: pointer;
}
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row .slider-val {
  min-width: 52px;
  text-align: center;
  font-size: 13px;
  color: var(--primary);
  font-weight: 700;
  background: #fff0f5;
  border-radius: 12px;
  padding: 4px 6px;
}

/* ===== 颜色选择 ===== */
.color-list { display: flex; gap: 14px; flex-wrap: wrap; }
.color-item {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: transform 0.12s;
}
.color-item:active { transform: scale(0.9); }
.color-item.active { border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.color-item .check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.color-item.color-custom {
  background: conic-gradient(#ff6b6b, #ffd93d, #6bcb77, #4d96ff, #b16bff, #ff6b6b);
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-item.color-custom span { font-size: 16px; }

/* ===== 字体选择 ===== */
.font-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.font-item {
  background: #fffafc;
  border: 2px solid #ffe0eb;
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.font-item.active { border-color: var(--primary); background: #fff0f6; box-shadow: 0 3px 10px rgba(255, 107, 157, 0.15); }
.font-name { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.font-desc { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.font-vip {
  display: inline-block;
  background: var(--gradient);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 6px;
}

/* ===== 分类横滑 ===== */
.cat-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-item {
  flex: none;
  padding: 7px 16px;
  border-radius: 18px;
  background: #fff;
  color: #888;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  white-space: nowrap;
}
.cat-item.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

/* ===== 表情套组卡片 ===== */
.set-grid { padding: 0 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.set-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
}
.set-card .set-cover {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #ffe0eb;
}
.set-card .set-body { padding: 12px 14px; }
.set-card .set-name { font-size: 16px; font-weight: 700; color: var(--text); }
.set-card .set-meta { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.set-card .set-meta .tag {
  display: inline-block;
  background: #fff0f5;
  color: var(--primary);
  border-radius: 10px;
  padding: 1px 8px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
}

/* ===== 表情网格 ===== */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px;
}
.emoji-cell {
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #fff0f5;
  cursor: pointer;
  border: 2px solid transparent;
}
.emoji-cell img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.emoji-cell.selected { border-color: var(--primary); }

/* ===== 制作页预览区 ===== */
.preview-box {
  position: relative;
  width: 100%;
  height: 280px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}
.preview-box .preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.watermark-drag {
  position: absolute;
  cursor: grab;
  touch-action: none;
  white-space: nowrap;
  font-weight: 700;
  text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000;
  user-select: none;
  -webkit-user-select: none;
}
.watermark-drag:active { cursor: grabbing; }
.preview-tip {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  pointer-events: none;
  white-space: nowrap;
}

/* ===== 区块标题 ===== */
.section-title {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  gap: 6px;
}
.section-title .title-icon { font-size: 18px; }
.section-title .val { margin-left: auto; font-size: 13px; color: var(--primary); font-weight: 600; }

/* ===== VIP 套餐 ===== */
.plan-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  border: 2px solid transparent;
  cursor: pointer;
}
.plan-card.hot { border-color: var(--primary); }
.plan-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--gradient);
  color: #fff;
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 12px;
  font-weight: 600;
}
.plan-name { font-size: 17px; font-weight: 700; }
.plan-price { font-size: 28px; color: var(--primary); font-weight: 800; margin: 6px 0 2px; }
.plan-price small { font-size: 13px; font-weight: 500; }
.plan-desc { font-size: 12px; color: var(--text-light); }

/* ===== 权益列表 ===== */
.benefit-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.benefit-item {
  flex: 1 1 45%;
  background: #fffafc;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.benefit-item .b-icon { font-size: 22px; }

/* ===== 用户信息卡 ===== */
.user-card {
  background: var(--gradient);
  border-radius: 20px;
  margin: 12px;
  padding: 20px 18px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 6px 20px rgba(255, 107, 157, 0.3);
}
.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  overflow: hidden;
  flex: none;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 18px; font-weight: 700; }
.user-vip-tag {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  font-size: 11px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ===== 功能列表 ===== */
.func-list { background: #fff; border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; margin: 12px; }
.func-item {
  display: flex;
  align-items: center;
  padding: 15px 16px;
  cursor: pointer;
  border-bottom: 1px solid #fff0f5;
  gap: 12px;
}
.func-item:last-child { border-bottom: none; }
.func-item:active { background: #fff5f8; }
.func-item .f-icon { font-size: 22px; }
.func-item .f-label { flex: 1; font-size: 15px; }
.func-item .f-arrow { color: #d0d0d0; font-size: 16px; }
.func-item .f-value { font-size: 13px; color: var(--primary); font-weight: 600; }

/* ===== 加载遮罩 ===== */
.h5-loading-mask {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.h5-loading-mask .spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #ffd6e4;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.h5-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999998;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 14px;
  max-width: 80%;
  text-align: center;
  animation: fadein 0.25s ease;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== 结果弹窗 ===== */
.result-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.result-modal {
  background: #fff;
  border-radius: 22px;
  padding: 22px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  max-height: 88vh;
  overflow-y: auto;
}
.result-title { font-size: 20px; font-weight: 800; margin-bottom: 14px; }
.result-image-wrap { border-radius: 14px; overflow: hidden; background: #fff0f5; margin-bottom: 12px; }
.result-image-wrap img { width: 100%; }
.result-tip { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.result-tip.vip-tip { color: var(--gold); }

/* ===== 空状态 ===== */
.empty { text-align: center; color: #b9b9b9; padding: 50px 0; font-size: 14px; }
.empty .empty-icon { font-size: 50px; }

/* ===== 作品列表 ===== */
.works-list { display: flex; flex-direction: column; }
.work-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid #fff0f5;
}
.work-item:last-child { border-bottom: none; }
.work-item:active { background: #fff5f8; border-radius: 12px; }
.work-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ffe0eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex: none;
}
.work-info { flex: 1; min-width: 0; }
.work-title { font-size: 15px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-arrow { color: #d0d0d0; font-size: 18px; }

/* ===== 备案信息 ===== */
.icp-footer {
  text-align: center;
  font-size: 12px;
  color: #b9b9b9;
  padding: 8px 16px 4px;
  line-height: 1.8;
}
.icp-footer a { color: #b9b9b9; }
.icp-divider { margin: 0 8px; }

/* ===== 公众号引流 ===== */
.mp-box { text-align: center; padding: 10px 0; }
.mp-qrcode {
  width: 160px;
  height: 160px;
  margin: 0 auto 10px;
  border-radius: 14px;
  background: #fff0f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.mp-qrcode img { width: 100%; height: 100%; object-fit: contain; }
.mp-name { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.mp-tip { font-size: 13px; color: var(--text-light); }

/* 工具类 */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.hidden { display: none !important; }

/* ===== 响应式：桌面 / 平板适配 ===== */
@media (min-width: 768px) {
  body {
    background: linear-gradient(135deg, #ffe0ec 0%, #fff5f9 50%, #ffe9f1 100%);
  }
  .app {
    max-width: 560px;
    box-shadow: 0 0 40px rgba(255, 107, 157, 0.12);
  }
  .h5-tabbar, .bottom-bar { max-width: 560px; }
  .set-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .card { margin: 14px 16px; padding: 18px; }
  .preview-box { height: 380px; }

  /* 桌面端 hover 交互 */
  .set-card, .func-item, .work-item, .font-item, .color-item { transition: transform 0.15s, box-shadow 0.15s, background 0.15s; }
  .set-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(255, 107, 157, 0.22); }
  .func-item:hover { background: #fff5f8; }
  .font-item:hover { border-color: var(--primary-light); transform: translateY(-1px); }
  .btn:hover { opacity: 0.88; transform: translateY(-1px); }
}

/* ===== 极窄屏微调 ===== */
@media (max-width: 360px) {
  .set-grid { gap: 8px; }
  .set-card .set-cover { height: 100px; }
  .font-list { gap: 8px; }
}