/* 淘宝双11 橙红主题 · 手机优先 */
:root {
  --brand: #ff4d4f;
  --brand-deep: #e8382f;
  --brand-soft: #fff1f0;
  --gold: #ffb300;
  --ink: #1f2225;
  --ink-2: #5c6470;
  --ink-3: #98a1ad;
  --line: #eef0f3;
  --bg: #f5f6f8;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(20, 24, 35, 0.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

/* 关键：让 hidden 属性压过 .sheet-mask{display:flex} 之类的规则 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(135deg, #ff5a4e 0%, #ff3b30 55%, #e8382f 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232, 56, 47, 0.28);
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-badge {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: grid; place-items: center;
  flex: none;
}
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: 0.3px; }
.brand-sub { font-size: 11.5px; opacity: 0.86; margin-top: 1px; }
.ghost-btn {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.ghost-btn:active { background: rgba(255, 255, 255, 0.3); }

/* ---------------- 容器 ---------------- */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 12px calc(28px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------------- 数据条 ---------------- */
.statbar {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 8px;
  box-shadow: var(--shadow);
}
.stat { flex: 1; text-align: center; }
.stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-label { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.stat-sep { width: 1px; height: 26px; background: var(--line); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-kicker {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; }

/* ---------------- 提交区 ---------------- */
.paste-box {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fafbfc;
  resize: none;
  outline: none;
  line-height: 1.55;
  font-size: 14px;
  transition: border-color .15s, background .15s;
}
.paste-box:focus { border-color: var(--brand); background: #fff; }
.paste-box::placeholder { color: #b8bfc9; font-size: 13px; }

.row-between {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.nick-input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafbfc;
  outline: none;
  font-size: 14px;
}
.nick-input:focus { border-color: var(--brand); background: #fff; }

.primary-btn {
  flex: none;
  padding: 11px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6a3d, #ff3b30);
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.primary-btn:active { transform: scale(0.97); box-shadow: 0 2px 6px rgba(255, 59, 48, 0.25); }
.primary-btn[disabled] { opacity: .55; box-shadow: none; }
.primary-btn.wide { width: 100%; padding: 13px; }

.hint { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }
.hint.err { color: var(--brand-deep); }
.hint.ok { color: #12a150; }

/* ---------------- 我的口令 ---------------- */
.quota-tip {
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #fff6f2;
  border: 1px solid #ffe0d6;
  color: #a8402a;
  font-size: 12.5px;
  line-height: 1.55;
}
.quota-tip b { color: var(--brand); font-weight: 800; }
.mine-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mine-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 13px;
}
.mine-item .mono { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-item .cnt { color: var(--brand-deep); font-weight: 700; font-variant-numeric: tabular-nums; }
.mine-del {
  color: var(--ink-3);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .04);
}

/* ---------------- 列表 ---------------- */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.list-title { font-size: 15.5px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.refresh-dot { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  padding: 6px 14px;
  border-radius: 999px;
  background: #f2f4f7;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.tab.is-active { background: var(--brand-soft); color: var(--brand-deep); }

.code-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.code-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  transition: background .15s;
}
.code-item.is-done { opacity: .6; }
.code-item.is-full { opacity: .55; }

.avatar {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, #ffb84d, #ff7a45);
}

.code-main { flex: 1; min-width: 0; }
.code-name {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: #eef1f5;
  color: var(--ink-2);
}
.tag.hot { background: #fff2e8; color: #e8730c; }
.tag.done { background: #e8f8ee; color: #12a150; }

.code-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.code-meta .mono { color: var(--ink-2); }

.copy-btn {
  flex: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6a3d, #ff3b30);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.copy-btn:active { transform: scale(.96); }
.copy-btn.is-done {
  background: #eef1f5;
  color: var(--ink-3);
  box-shadow: none;
}
.copy-btn[disabled] { opacity: .5; }

.empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 26px 0; }

/* ---------------- 页脚 ---------------- */
.foot { text-align: center; color: var(--ink-2); font-size: 12px; padding: 4px 8px; }
.foot p { margin: 3px 0; }
.foot-dim { color: var(--ink-3); font-size: 11.5px; }

/* ---------------- 弹层 ---------------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16, 18, 22, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.sheet {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + var(--safe-b));
  animation: rise .22s cubic-bezier(.22,.8,.3,1);
  max-height: 88vh;
  overflow-y: auto;
}
@keyframes rise { from { transform: translateY(28px) } to { transform: translateY(0) } }

.sheet-grab {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: #e3e7ec;
  margin: 2px auto 14px;
}
.sheet-title { font-size: 16.5px; font-weight: 700; margin: 0 0 6px; }
.sheet-lead { font-size: 13px; color: var(--ink-2); margin: 0 0 14px; }

.sheet-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
  background: #f7f8fa;
  border: 1px dashed #dfe4ea;
  border-radius: 12px;
  padding: 12px;
  color: var(--ink);
  max-height: 30vh;
  overflow-y: auto;
  user-select: all;
  -webkit-user-select: all;
}

.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions > button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  padding: 13px 10px;
}
.sheet-actions .ghost-btn {
  background: #f2f4f7;
  color: var(--ink-2);
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 700;
}
.sheet-actions .ghost-btn:active { background: #e8ebf0; }
.sheet-actions .ghost-btn[hidden] { display: none; }

.sheet-close {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  color: var(--ink-3);
  font-size: 14px;
}

.help-steps {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
}
.help-steps b { color: var(--ink); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + var(--safe-b));
  transform: translateX(-50%) translateY(8px);
  z-index: 90;
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(28, 31, 36, 0.9);
  color: #fff;
  font-size: 13.5px;
  opacity: 0;
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 720px) {
  .sheet-mask { align-items: center; }
  .sheet { border-radius: 22px; max-width: 460px; padding-bottom: 18px; }
}
