/* ============================================================
   祈饼的日常 · 样式
   暖奶油底色 + 珊瑚主色，移动优先
   ============================================================ */

:root {
  color-scheme: light;

  --bg: #fff7f0;
  --bg-warm: #ffeade;
  --card: #fffdfb;
  --ink: #3a2b26;
  --ink-soft: #8d766c;
  --ink-faint: #b8a79d;
  --line: rgba(58, 43, 38, 0.09);
  --line-strong: rgba(58, 43, 38, 0.14);

  --accent: #ff7a59;
  --accent-deep: #ef5b37;
  --accent-soft: #ffe6dc;
  --green: #4fae7a;

  --radius: 20px;
  --shadow-sm: 0 2px 10px rgba(120, 70, 40, 0.06);
  --shadow: 0 12px 30px -16px rgba(120, 60, 30, 0.4);
  --shadow-lift: 0 18px 40px -18px rgba(120, 60, 30, 0.45);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body.sheet-open { overflow: hidden; }

body {
  min-height: 100dvh;
  font-family: var(--font-main, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(560px 380px at 84% -8%, rgba(255, 158, 118, 0.22), transparent 70%),
    radial-gradient(520px 360px at -10% 18%, rgba(255, 210, 170, 0.35), transparent 72%),
    radial-gradient(600px 420px at 50% 112%, rgba(255, 196, 170, 0.24), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 输入框里还是要能选、能长按复制 */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }
input { -webkit-appearance: none; appearance: none; }
::selection { background: var(--accent-soft); }

/* ───────────────────────────── 骨架 ───────────────────────────── */

.app {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px calc(180px + var(--safe-b));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-t)) 0 12px;
  background: linear-gradient(180deg, var(--bg) 62%, rgba(255, 247, 240, 0));
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 19px;
  background: #fff;
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  flex: none;
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.2;
}
.brand-text p {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  letter-spacing: 0.2px;
}

.me-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  flex: none;
  transition: transform 0.15s ease;
}
.me-pill:active { transform: scale(0.96); }
.me-avatar {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 14px;
}
.me-name { font-size: 13px; font-weight: 600; }

/* iOS 加桌面提示 */
.ios-tip {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 122, 89, 0.1);
  border: 1px solid rgba(255, 122, 89, 0.2);
  color: #a4462a;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}
.ios-tip b { font-weight: 700; }
.ios-tip-x { margin-left: auto; color: #a4462a99; font-size: 14px; padding: 2px 4px; flex: none; }

/* ───────────────────────────── 日期栏 ───────────────────────────── */

.date-rail {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 253, 251, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 6px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.rail-btn {
  width: 38px; height: 42px;
  display: grid; place-items: center;
  font-size: 21px;
  color: var(--ink-faint);
  border-radius: 12px;
  transition: background 0.15s, color 0.15s;
  flex: none;
}
.rail-btn:active { background: var(--bg-warm); color: var(--ink); }

.rail-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 0;
  border-radius: 12px;
}
.rail-main { font-size: 15px; font-weight: 700; letter-spacing: 0.3px; }
.rail-sub { font-size: 11px; color: var(--ink-soft); }

.hidden-date {
  position: absolute;
  left: 50px; right: 50px; top: 0; bottom: 0;
  width: calc(100% - 100px);
  opacity: 0;
  border: none;
  background: transparent;
  pointer-events: auto;
}
.hidden-date::-webkit-date-and-time-value { opacity: 0; }

/* ───────────────────────────── 撞车横幅 ───────────────────────────── */

.match {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(118deg, #ff8f68, #ff6f91 92%);
  color: #fff;
  border-radius: 18px;
  padding: 13px 16px;
  margin-bottom: 14px;
  box-shadow: 0 12px 26px -14px rgba(255, 111, 92, 0.85);
  animation: pop 0.35s cubic-bezier(0.22, 1.4, 0.4, 1);
}
.match-emoji { font-size: 26px; line-height: 1; flex: none; }
.match-text { min-width: 0; }
.match-title { font-size: 14.5px; font-weight: 700; letter-spacing: 0.2px; }
.match-sub { font-size: 11.5px; opacity: 0.88; margin-top: 2px; }

/* ───────────────────────────── 菜单板 ───────────────────────────── */

.slot-group { margin-bottom: 20px; }

.slot-head {
  display: flex; align-items: center; gap: 8px;
  margin: 0 4px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
}
.slot-head .dash { flex: 1; height: 1px; background: var(--line); }
.slot-head .slot-ico { font-size: 13px; }

.wish {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.2s;
}
.wish-emoji {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 22px;
  border-radius: 14px;
  background: var(--tint, var(--accent-soft));
  flex: none;
}
.wish-main { flex: 1; min-width: 0; }

.wish-top { display: flex; align-items: center; gap: 7px; }
.wish-name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wish-meta {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wish-meta .dot { margin: 0 5px; opacity: 0.5; }
.wish-note { color: var(--ink-faint); }

.person-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px 2px 4px;
  border-radius: 999px;
  background: var(--person-bg, #fff0e8);
  color: var(--person-fg, #c2552f);
  flex: none;
}
.person-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.wish-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }

.wish-check {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  color: transparent;
  font-size: 14px;
  transition: all 0.18s;
}
.wish-check:active { transform: scale(0.9); }
.wish.is-eaten .wish-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.wish.is-eaten { opacity: 0.55; }
.wish.is-eaten .wish-name { text-decoration: line-through; text-decoration-thickness: 1.5px; }

.wish-actions { display: flex; gap: 2px; margin-top: 5px; margin-left: -6px; }

.wish-join {
  font-size: 11px;
  color: var(--ink-faint);
  padding: 3px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.wish-join:active { background: var(--bg-warm); color: var(--ink); }

.wish-del {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 40px 24px 34px;
  background: rgba(255, 253, 251, 0.55);
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  margin-bottom: 10px;
}
.empty-emoji { font-size: 38px; line-height: 1; margin-bottom: 12px; display: block; }
.empty-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.empty-cta {
  margin-top: 16px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 18px -8px rgba(255, 122, 89, 0.9);
}
.empty-cta:active { transform: scale(0.97); }

/* 日期小计 */
.day-summary {
  display: flex; gap: 8px;
  margin: 2px 0 16px;
  flex-wrap: wrap;
}
.sum-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.sum-pill b { color: var(--ink); font-weight: 700; }

/* ───────────────────────────── 备选栏 ───────────────────────────── */

.pool-head { padding: 4px 2px 14px; }
.pool-title { display: flex; align-items: center; gap: 8px; }
.pool-title h2 { font-size: 19px; font-weight: 700; letter-spacing: 0.4px; }

.link-btn {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  padding: 4px 8px;
  border-radius: 9px;
}
.link-btn:active { background: var(--accent-soft); }
.count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
}
.pool-hint { font-size: 12px; color: var(--ink-soft); margin-top: 5px; }

.search-wrap {
  position: relative;
  display: flex; align-items: center;
  background: rgba(255, 253, 251, 0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.search-icon { font-size: 13px; opacity: 0.55; }
.search-wrap input {
  flex: 1;
  height: 44px;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  padding: 0 8px;
}
.search-wrap input::placeholder { color: var(--ink-faint); }

.tag-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scrollbar-width: none;
}
.tag-row::-webkit-scrollbar { display: none; }

.tag {
  flex: none;
  font-size: 12.5px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  transition: transform 0.12s, background 0.16s, color 0.16s;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.tag.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.tag[data-id].is-dragging {
  transform: scale(1.1);
  box-shadow: 0 10px 22px -10px rgba(120, 60, 30, 0.65);
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  opacity: 0.95;
  position: relative;
  z-index: 3;
  pointer-events: none;
}
body.tag-dragging {
  -webkit-user-select: none;
  user-select: none;
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.dish-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s, box-shadow 0.18s;
}
.dish-card:active { transform: scale(0.97); box-shadow: var(--shadow); }
.dish-emoji { font-size: 24px; line-height: 1.2; margin-bottom: 2px; }
.dish-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 22px;
}
.dish-tags { font-size: 10.5px; color: var(--ink-faint); min-height: 13px; }
.dish-heat { font-size: 10.5px; color: var(--accent-deep); font-weight: 600; }

.dish-edit {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 10px;
}
.dish-edit:active { background: var(--accent); color: #fff; }

.add-dish-btn {
  width: 100%;
  margin-top: 12px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 15px;
  border-radius: 17px;
  border: 1px dashed var(--line-strong);
  color: var(--accent-deep);
  font-size: 13.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.16s;
}
.add-dish-btn:active { background: var(--accent-soft); }

/* ───────────────────────────── 底部按钮 ───────────────────────────── */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 10px 10px calc(10px + var(--safe-b));
  background: linear-gradient(180deg, rgba(255, 247, 240, 0), var(--bg) 46%);
  pointer-events: none;
}

.tab {
  pointer-events: auto;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 44px;
  border-radius: 13px;
  background: rgba(255, 253, 251, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.tab-icon { font-size: 13px; }
.tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  box-shadow: 0 12px 26px -12px rgba(58, 43, 38, 0.7);
}

.tab.is-dragging {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 14px 28px -12px rgba(58, 43, 38, 0.75);
  position: relative;
  z-index: 4;
  opacity: 0.92;
  pointer-events: none;
}

/* 拖动排序：原位置留空，浮起的副本跟着手指走 */
/* 用 opacity 而不是 visibility，也不用 pointer-events —— 尽量不动手指下的元素，避免 iOS 取消触摸 */
.is-drag-src { opacity: 0 !important; }
.drag-ghost {
  box-shadow: 0 18px 36px -16px rgba(58, 43, 38, 0.6);
  pointer-events: none;
  will-change: transform;
  opacity: 0.97;
}
.is-sorting { cursor: grabbing; }

.fab {
  position: fixed;
  z-index: 31;
  right: max(20px, calc(50% - 280px));
  bottom: calc(78px + var(--safe-b));
  display: flex;
  align-items: center;
  gap: 6px;
  height: 50px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a66, #ff6547);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 14px 30px -10px rgba(255, 101, 71, 0.85);
  transition: transform 0.16s;
}
.fab:active { transform: scale(0.95); }
.fab-plus { font-size: 19px; font-weight: 400; line-height: 1; margin-top: -1px; }

/* ───────────────────────────── 弹层 ───────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet[hidden] { display: none; }

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(48, 33, 27, 0.34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}

.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -18px 50px -20px rgba(80, 40, 20, 0.45);
  animation: slideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: var(--safe-b);
}
.sheet-small { max-width: 420px; }

.sheet-grip {
  width: 38px; height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 9px auto 2px;
  flex: none;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px 4px;
  flex: none;
}
.sheet-head h2 { font-size: 17.5px; font-weight: 700; letter-spacing: 0.3px; }
.sheet-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--ink-faint);
  font-size: 14px;
  background: var(--bg);
  flex: none;
}
.icon-btn:active { background: var(--bg-warm); color: var(--ink); }

.sheet-body {
  padding: 8px 20px 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sheet-foot {
  padding: 10px 20px calc(14px + var(--safe-b));
  border-top: 1px solid var(--line);
  flex: none;
  background: var(--card);
}
.sheet-foot.split { display: flex; gap: 10px; }
.sheet-foot.split .btn-primary { flex: 1; }

/* 表单 */
.field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}
.opt { font-weight: 400; color: var(--ink-faint); font-size: 11px; }
.field-note { font-size: 11px; color: var(--ink-faint); margin-top: 8px; line-height: 1.5; }

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 14px;
  transition: border-color 0.15s, background 0.15s;
}
.input-wrap:focus-within { border-color: var(--accent); background: #fff; }

.field > input[type="text"],
.field > input[type="password"],
.field > input[type="search"],
.input-wrap input {
  width: 100%;
  height: 46px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
}
.field > input[type="text"],
.field > input[type="search"] {
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 14px;
  transition: border-color 0.15s, background 0.15s;
}
.field > input[type="text"]:focus,
.field > input[type="search"]:focus { border-color: var(--accent); background: #fff; }
.field input::placeholder { color: var(--ink-faint); }

/* 选中某个菜 */
.picked {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 122, 89, 0.25);
  border-radius: 14px;
  padding: 8px 8px 8px 12px;
  margin-bottom: 8px;
  animation: pop 0.2s ease;
}
.picked-emoji { font-size: 19px; }
.picked-name { font-size: 15px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked-x {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.7);
  color: #b1533a;
  font-size: 11px;
  flex: none;
}

/* 输入建议 */
.suggest { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.suggest:empty { display: none; }
.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  text-align: left;
  font-size: 14px;
  transition: background 0.12s;
}
.suggest-item:active { background: var(--bg-warm); }
.suggest-item .s-emoji { font-size: 16px; width: 20px; text-align: center; flex: none; }
.suggest-item .s-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .s-tag { font-size: 10.5px; color: var(--ink-faint); flex: none; }
.suggest-new { color: var(--accent-deep); font-weight: 600; }
.suggest-new .s-emoji { opacity: 0.8; }

/* 选择 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid transparent;
  font-size: 13.5px;
  color: var(--ink-soft);
  transition: all 0.15s;
}
.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 600;
}
.chip-date { position: relative; }
.chip-date input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  border: none;
  background: transparent;
}

/* emoji 选择 */
.emoji-preview-row { display: flex; align-items: center; gap: 10px; }
.field .emoji-input,
.emoji-input {
  width: 56px;
  min-width: 56px;
  height: 50px;
  text-align: center;
  font-size: 24px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 14px;
  flex: none;
  padding: 0;
}
.emoji-row { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.emoji-row::-webkit-scrollbar { display: none; }
.emoji-pick {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 19px;
  border-radius: 11px;
  background: var(--bg);
  flex: none;
}
.emoji-pick:active { background: var(--accent-soft); }

/* 设置里：我是谁 */
.who-row { display: flex; gap: 10px; }
.who-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--bg);
  border: 1.5px solid transparent;
  transition: all 0.16s;
  text-align: left;
}
.who-card.is-on { border-color: var(--accent); background: var(--accent-soft); }
.who-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-size: 15px; flex: none; }
.who-name { font-size: 14px; font-weight: 600; }

.name-row { display: flex; gap: 10px; margin-bottom: 10px; }
.name-cell {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 14px;
  padding: 0 12px;
}
.name-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.name-cell input { height: 44px; border: none; background: none; outline: none; width: 100%; font-size: 14.5px; }

/* 分享 */
.share-box { background: var(--bg); border-radius: 14px; padding: 11px 12px; }
.share-url {
  font-size: 12px;
  color: var(--ink-soft);
  word-break: break-all;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.share-btns { display: flex; gap: 8px; margin-top: 10px; }
.steps {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.75;
}
.steps b { color: var(--ink); }

/* 按钮 */
.btn-primary {
  width: 100%;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(135deg, #ff8a66, #ff6547);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 12px 26px -12px rgba(255, 101, 71, 0.9);
  transition: transform 0.14s, opacity 0.2s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; box-shadow: none; }

.btn-soft {
  padding: 9px 16px;
  border-radius: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.btn-soft:active { background: var(--bg-warm); }

.btn-ghost {
  height: 50px;
  padding: 0 18px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg);
  color: var(--ink-soft);
}
.btn-danger { color: #d0452f; background: rgba(208, 69, 47, 0.08); }

/* 口令 */
.lock-error { color: #d0452f; font-size: 12.5px; margin-top: 10px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(150px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 90;
  background: rgba(48, 33, 27, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.26s cubic-bezier(0.22, 1.4, 0.4, 1);
  max-width: calc(100vw - 48px);
  text-align: center;
}
.toast[hidden] { display: none; }

/* 弹层打开时，提示挪到顶部，别盖住弹层里的内容 */
body.sheet-open .toast {
  top: calc(16px + var(--safe-t));
  bottom: auto;
  animation: toastInTop 0.26s cubic-bezier(0.22, 1.4, 0.4, 1);
}
@keyframes toastInTop {
  from { opacity: 0; transform: translate(-50%, -8px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ───────────────────────────── 动画 ───────────────────────────── */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { 0% { opacity: 0; transform: scale(0.94); } 100% { opacity: 1; transform: scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px) scale(0.95); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ───────────────────────────── 头像 ───────────────────────────── */

.avatar-row { display: flex; gap: 10px; }

.avatar-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid transparent;
  text-align: left;
}
.avatar-card:active { background: var(--bg-warm); }

.avatar-thumb {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 19px;
  overflow: hidden;
  flex: none;
  background: var(--accent-soft);
}
.avatar-thumb img,
.me-avatar img,
.who-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.avatar-name { font-size: 13.5px; font-weight: 600; }
.avatar-hint { font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }

/* ───────────────────────────── 标签管理 ───────────────────────────── */

.tag-manage { display: flex; flex-direction: column; gap: 4px; min-height: 28px; }

.tag-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
}
.tag-line:last-child { border-bottom: none; }

.tag-line-move { display: flex; gap: 3px; flex: none; }
.tag-line-move button {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 13px;
}
.tag-line-move button:disabled { opacity: 0.25; }
.tag-line-move button:active:not(:disabled) { background: var(--accent-soft); color: var(--accent-deep); }

.tag-line-name {
  flex: 1;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 4px 2px;
}

.tag-line-x {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-size: 11px;
  color: var(--ink-faint);
  flex: none;
}
.tag-line-x:active { background: var(--accent-soft); color: var(--accent-deep); }

/* 背景色选择 */
.bg-row { display: flex; gap: 10px; }
.bg-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.bg-dot span {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(58, 43, 38, 0.12);
}
.bg-dot em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-faint);
}
.bg-dot.is-on span { border-color: var(--accent); }
.bg-dot.is-on em { color: var(--accent-deep); }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 4px 3px 11px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.tag-chip-name { font-size: 12.5px; color: var(--ink); }
.tag-chip-x {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 9px;
  color: var(--ink-faint);
}
.tag-chip-x:active { background: var(--accent-soft); color: var(--accent-deep); }

.tag-add { display: flex; gap: 8px; margin-top: 10px; }
.tag-add input {
  flex: 1;
  height: 40px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 13.5px;
  outline: none;
}
.tag-add input:focus { border-color: var(--accent); background: #fff; }

/* ───────────────────────────── 食材 ───────────────────────────── */

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 11px 13px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.2s;
}
.item.is-used { opacity: 0.45; }
.item.is-used .item-name { text-decoration: line-through; }
.item.is-used .wish-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.item-photo {
  width: 52px; height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex: none;
  background: var(--bg-warm);
  display: grid; place-items: center;
  font-size: 22px;
}
.item-main { flex: 1; min-width: 0; }
.item-name {
  font-size: 15.5px;
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-qty { font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-left: 6px; }
.item-meta {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-meta .dot { margin: 0 5px; opacity: 0.5; }

/* ───────────────────────────── 备忘 ───────────────────────────── */

.note {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 13px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
}
.note-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 12px;
  color: transparent;
  flex: none;
  margin-top: 1px;
}
.note.is-done .note-check { background: var(--green); border-color: var(--green); color: #fff; }
.note.is-done .note-text { text-decoration: line-through; opacity: 0.5; }

.note-main { flex: 1; min-width: 0; }
.note-text {
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-meta { font-size: 11px; color: var(--ink-faint); margin-top: 6px; }
.note-kind {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  margin-right: 6px;
}
.note-kind.long { background: rgba(91, 157, 224, 0.16); color: #3d7bb8; }
.note-kind.short { background: var(--accent-soft); color: #b1533a; }

.note-del {
  width: 26px; height: 26px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 12px;
  color: var(--ink-faint);
  flex: none;
}
.note-del:active { background: var(--bg-warm); }

/* ───────────────────────────── 图片上传 ───────────────────────────── */

.photo-row { display: flex; align-items: center; gap: 10px; }

.photo-preview {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 14px;
  overflow: hidden;
  flex: none;
  background: var(--bg);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-x {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid; place-items: center;
  font-size: 10px;
}

.photo-add {
  height: 84px;
  flex: 1;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
}
.photo-add:active { background: var(--accent-soft); }

/* ───────────────────────────── 多行输入 ───────────────────────────── */

.qty-row { display: flex; gap: 8px; }
.qty-row input {
  height: 46px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 12px;
  font-size: 15px;
  outline: none;
}
.qty-row input[type="number"] {
  flex: 0 0 92px;
  text-align: center;
}
.qty-row input[type="text"] { flex: 1; }
.qty-row input:focus { border-color: var(--accent); background: #fff; }

.qty-stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.qty-stepper button {
  width: 28px; height: 28px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}
.qty-stepper button:active { background: var(--accent-soft); color: var(--accent-deep); }
.qty-stepper .n {
  min-width: 38px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* 通知开关 */
.push-on { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.push-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  background: rgba(79, 174, 122, 0.12);
  padding: 5px 10px;
  border-radius: 999px;
}
.push-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
  outline: none;
  min-height: 96px;
}
.field textarea:focus { border-color: var(--accent); background: #fff; }
.field textarea::placeholder { color: var(--ink-faint); }

/* ───────────────────────────── 桌面微调 ───────────────────────────── */

@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-panel {
    border-radius: 26px;
    max-height: 82dvh;
    animation: pop 0.22s ease;
  }
  .sheet-panel { padding-bottom: 0; }
  .sheet-foot { padding-bottom: 16px; }
  .fab { right: calc(50% - 280px); }
}

.hidden { display: none !important; }

/* 备案号（工信部要求展示在页面底部） */
.site-footer {
  text-align: center;
  padding: 26px 0 10px;
  font-size: 11px;
  letter-spacing: 0.2px;
}
.site-footer a {
  color: var(--ink-faint);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
}
.site-footer a:active { background: var(--bg-warm); }
