/* ==================================================================
 * 福袋组队互助站 —— 样式
 * ------------------------------------------------------------------
 * 参考常见互助工具站的设计系统：
 *   · 移动端优先，容器锁 440px
 *   · 橙 #f97316 只在导航（框架层），绿 #22c55e 只在行动（CTA）
 *   · 卡片 22px 圆角 + 内高光 + 极淡外阴影
 *   · 断点精确到 320/360/420/430/768，并适配刘海屏安全区
 * ================================================================== */

:root {
  --or: #f97316;
  --or-600: #ea580c;
  --or-50: #fff7ed;
  --or-100: #ffedd5;
  --or-700: #c2410c;

  --gr: #22c55e;
  --gr-600: #16a34a;
  --gr-light: #b4e4c2;
  --gr-caret: #34c759;

  --ink: #1a202c;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f5f6f8;

  --radius-card: 22px;
  --radius-input: 16px;
  --radius-btn: 14px;
  --ctl-h: 46px;

  --shadow-card: inset 0 1px #fffffff2, 0 8px 20px #0f172a0a;
  --shadow-nav: 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-toast: 0 2px 12px #0000001a;

  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  background: linear-gradient(to bottom right, #eff6ff, #e0e7ff);
  min-height: 100vh;
}

/* ---------- 全局水印：防截图搬运（参考站同款思路） ---------- */
.watermark {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0.36;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='390' height='246' viewBox='0 0 390 246'%3E%3Cg font-family='-apple-system,BlinkMacSystemFont,sans-serif'%3E%3Ctext x='106' y='111' fill='rgba(15,23,42,0.115)' font-size='24' font-weight='760' letter-spacing='2.6' transform='rotate(-24 195 123)'%3E福袋%3C/text%3E%3Ctext x='106' y='149' fill='rgba(15,23,42,0.092)' font-size='20' font-weight='680' letter-spacing='1.3' transform='rotate(-24 195 123)'%3E组队互助%3C/text%3E%3C/g%3E%3C/svg%3E"),
    repeating-linear-gradient(-24deg, rgba(15, 23, 42, 0.014) 0 1px, transparent 1px 152px);
  background-position: 52px 16px, 0 0;
  background-repeat: repeat;
  background-size: 390px 246px, auto;
}

/* ==================================================================
 * 导航（sticky + 毛玻璃）
 * ================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 237, 213, 0.8);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-nav);
}

.nav__inner {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  height: 56px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1;
  text-decoration: none;
  color: inherit;
}

.nav__logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fb923c, #ea580c);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 8px 18px rgba(249, 115, 22, 0.12);
  flex: 0 0 auto;
}

.nav__brand-text { display: none; flex-direction: column; min-width: 0; }
@media (min-width: 768px) { .nav__brand-text { display: flex; } }

.nav__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
}

.nav__sub {
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 窄屏时品牌绝对居中（参考站用两套 DOM 解决 grid 中间列被挤掉的问题） */
.nav__brand-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(100%, calc(100% - 7.5rem));
}
@media (min-width: 768px) { .nav__brand-center { display: none; } }

.nav__links {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav__links::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .nav__links { display: flex; } }

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav__link:hover { background: var(--or-50); color: var(--or-700); }
.nav__link--active { background: var(--or-50); color: var(--or-700); font-weight: 600; }

.nav__badge {
  padding: 1px 6px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}
.nav__badge--hot { background: rgba(249, 115, 22, 0.16); color: var(--or-700); }
.nav__badge--beta { background: rgba(34, 197, 94, 0.14); color: #15803d; }
.nav__badge--new { background: rgba(96, 165, 250, 0.14); color: #1d4ed8; }

/* 窄屏汉堡 */
.nav__menu-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--or-100);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-2);
}
@media (min-width: 768px) { .nav__menu-btn { display: none; } }

/* ==================================================================
 * 主容器：锁 440px
 * ================================================================== */
.container {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  padding: 12px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px 18px 14px;
  margin-bottom: 10px;
  overflow: hidden;
}

/* ---------- 卡片 1：Hero ---------- */
.hero__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hero__title {
  font-size: 1.52rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--ink);
  white-space: nowrap;
}

.hero__meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }

.hero__badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.hero__ver {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
}

.hero__group-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--or-100);
  border-radius: 12px;
  background: var(--or-50);
  color: var(--or-700);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.hero__contact {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #fafafa, #f5f5f5);
  text-align: left;
}

.hero__contact-title { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.hero__contact-sub { display: block; font-size: 11.5px; color: var(--muted); }
.hero__chev { margin-left: auto; color: var(--muted-2); font-size: 18px; }

/* 双入口导流 */
.dual {
  display: flex;
  gap: 0;
  margin: 10px 0 -2px;
  border: 1px solid #ebe6de;
  border-radius: 18px;
  background: linear-gradient(135deg, #fffefd, #faf8f3);
  box-shadow: 0 3px 10px #624e2d06;
  overflow: hidden;
}

.dual__item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #624e2d;
  text-decoration: none;
  min-width: 0;
}
.dual__item + .dual__item { border-left: 1px solid #efe9df; }
.dual__item:hover { background: rgba(249, 115, 22, 0.05); }
.dual__chev { margin-left: auto; color: #b8a58c; font-size: 15px; }

/* ---------- 卡片 2：发布 ---------- */
.input-area {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 14px;
}

.input-shell {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  height: var(--ctl-h);
  min-width: 0;
  background: #fff;
  border: 1.5px solid var(--gr-light);
  border-radius: var(--radius-input);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input-shell:focus-within {
  border-color: var(--gr);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0 8px 0 16px;
  font-size: 16px;                     /* ≥16px 防 iOS 聚焦缩放 */
  font-weight: 600;
  color: #1f2937;
  caret-color: var(--gr-caret);
  font-variant-numeric: tabular-nums;  /* 等宽数字，输入时不跳动 */
}
.input::placeholder { color: var(--muted-2); font-weight: 500; }

.input-ocr {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid #e8f5ec;
  background: transparent;
  color: var(--gr-600);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* 自绘扫码框图标：4 角 + 1 扫描线 */
.scan-icon {
  position: relative;
  width: 15px;
  height: 15px;
  display: inline-block;
}
.scan-icon i {
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1.5px solid currentColor;
}
.scan-icon i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scan-icon i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.scan-icon i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.scan-icon i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.scan-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  opacity: 0.85;
}

.btn-publish {
  flex: 0 0 clamp(96px, 30%, 120px);
  height: var(--ctl-h);
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--gr);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 0 12px;
  white-space: nowrap;
  transition: filter 0.2s ease, transform 0.1s ease;
}
.btn-publish:hover:not(:disabled) { filter: brightness(1.05); }
.btn-publish:active:not(:disabled) { transform: scale(0.98); }
.btn-publish:disabled { background: #cbd5e1; cursor: not-allowed; }

/* 诚信勾选 */
.pledge {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.pledge input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--gr); flex: 0 0 auto; }
.pledge__more {
  border: 0;
  background: none;
  color: var(--or-600);
  font-size: 12.5px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  white-space: nowrap;
}
.pledge__rest {
  display: none;
  margin-top: 6px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}
.pledge__rest.is-open { display: block; }

/* ---------- 卡片 3：推广位 ---------- */
.promo { margin-bottom: 10px; }
.promo__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.promo__tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.promo__tabs::-webkit-scrollbar { display: none; }

.promo__tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  background: var(--surface-2);
}
.promo__tab--active { background: var(--or-50); color: var(--or-700); }
.promo__close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

/* ---------- 卡片 4：列表 ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.section-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--gr-600);
  font-family: var(--mono);
}

.section-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #4ade80, var(--gr) 55%, #10b981);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(34, 197, 94, 0.28);
  white-space: nowrap;
  transition: filter 0.16s, transform 0.1s;
}
.btn-primary:hover:not(:disabled) { filter: saturate(1.04); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}

/* 空态提示 */
.tip {
  margin: 6px 0;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}
.tip strong { color: var(--ink-2); font-weight: 700; }

/* 列表 */
.code-list { list-style: none; margin-top: 4px; }

.code-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 7px;
}
.code-item:last-child { margin-bottom: 0; }
.code-item--mine { border-color: var(--gr-light); background: #f6fdf8; }
.code-item--banned { opacity: 0.55; }

.code-item__num {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.code-item__tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
}
.code-item__tag--mine { background: rgba(34, 197, 94, 0.14); color: #15803d; }
.code-item__tag--banned { background: rgba(248, 113, 113, 0.14); color: #b91c1c; }

.code-item__meta { flex: 0 0 auto; font-size: 11px; color: var(--muted-2); font-family: var(--mono); }

.code-item__act {
  flex: 0 0 auto;
  padding: 6px 13px;
  border: 0;
  border-radius: 9px;
  background: var(--gr);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}
.code-item__act:disabled { background: #cbd5e1; cursor: not-allowed; }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 16px;
  padding: 14px 4px 10px;
  border-top: 1px solid var(--line-2);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.footer__brand { color: var(--ink-2); font-weight: 700; }
.footer__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.footer__btn {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 0;
  text-decoration: underline;
}
.footer__link { color: var(--muted); }

/* ==================================================================
 * 弹窗 / 引导
 * ================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.modal.is-open { display: flex; }

.modal__panel {
  width: min(400px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  padding: 20px 18px 18px;
  animation: modal-in 0.22s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal__title { font-size: 17px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.modal__body { font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }

.modal__code {
  display: block;
  margin: 14px 0;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px dashed var(--gr-light);
  text-align: center;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #15803d;
  user-select: all;
}

.modal__steps { margin: 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); line-height: 1.9; }

.modal__actions { display: flex; gap: 8px; margin-top: 18px; }
.modal__actions .btn-primary,
.modal__actions .btn-ghost { flex: 1; justify-content: center; padding: 11px 16px; }

/* 引导弹窗里的剩余可领提示 */
.modal__hint {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}

/* ==================================================================
 * Toast
 * ================================================================== */
.toast-wrap {
  position: fixed;
  left: 50%;
  top: 22vh;
  transform: translateX(-50%);
  z-index: 20000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 88vw;
}

.toast {
  padding: 10px 18px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-toast);
  font-size: 13.5px;
  font-weight: 600;
  max-width: 88vw;
  animation: toast-in 0.24s ease;
}
.toast--success { background: #f0fdf4; border-color: #4ade80; color: #065f46; }
.toast--warning { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.toast--error { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.toast--info { background: #eff6ff; border-color: #60a5fa; color: #1e40af; }
.toast.is-out { opacity: 0; transform: translateY(-10px); transition: all 0.25s ease; }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to { opacity: 1; transform: none; }
}

/* ==================================================================
 * 额度条（Demo 增强：让限流可见）
 * ================================================================== */
.quota {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--muted);
}
.quota__item { flex: 1; min-width: 0; }
.quota__label { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 3px; }
.quota__bar { height: 4px; border-radius: 2px; background: #e2e8f0; overflow: hidden; }
.quota__fill { height: 100%; background: var(--gr); transition: width 0.3s ease; }
.quota__fill--warn { background: #f59e0b; }
.quota__fill--danger { background: #ef4444; }

/* ==================================================================
 * 响应式：断点精确到小屏
 * ================================================================== */
@media (max-width: 430px) {
  .container { padding: 10px; }
  .card { padding: 14px 14px 12px; border-radius: 20px; }
  .hero__title { font-size: 1.4rem; }
}

@media (max-width: 380px) {
  .hero__title { font-size: 1.3rem; }
  .hero__group-btn { padding: 6px 9px; font-size: 11.5px; }
  .input-area { gap: 10px; }
  .input { padding-left: 12px; }
  .input-ocr { padding: 0 9px; }
  .input-ocr span:not(.scan-icon) { display: none; }
  .btn-publish { font-size: 15px; }
  .dual__item { padding: 10px 9px; font-size: 12px; }
}

@media (max-width: 340px) {
  .hero__title { font-size: 1.2rem; white-space: normal; }
  .section-actions { width: 100%; }
  .code-item { flex-wrap: wrap; }
  .code-item__num { flex-basis: 100%; }
}

/* 刘海屏安全区 */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* 无障碍：尊重用户的减弱动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
