/* 灶台 · 我的菜谱 —— 样式 */

:root {
  --paper: #FBF7F1;
  --card: #FFFFFF;
  --ink: #241D19;
  --ink-soft: #4A3E35;
  --sub: #8C8075;
  --mute: #AFA096;
  --line: #EDE3D6;
  --red: #C4462C;
  --red-deep: #B23A22;
  --red-soft: #FBEBE6;
  --green: #3E7A54;
  --green-soft: #EAF3ED;
  --amber: #B07A18;
  --amber-soft: #FBF1DE;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(70, 45, 25, .04), 0 10px 26px rgba(70, 45, 25, .05);
}

* { box-sizing: border-box; }

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

body {
  background: var(--paper);
  background-image:
    radial-gradient(900px 420px at 50% -180px, #FDF0E7 0%, rgba(253, 240, 231, 0) 70%);
  color: var(--ink);
  font: 15px/1.62 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.lock { overflow: hidden; }

button, input, select, textarea { font-family: inherit; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 247, 241, .86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(237, 227, 214, .8);
}

.topbar-in {
  max-width: 720px;
  margin: 0 auto;
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #D4543A, #AE3620);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(178, 58, 34, .28);
  user-select: none;
}

.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .6px; line-height: 1.25; }
.brand-sub { font-size: 11px; color: var(--mute); line-height: 1.3; letter-spacing: .3px; }

/* ---------- 主体 ---------- */

#view {
  max-width: 720px;
  margin: 0 auto;
  padding: 2px 18px 150px;
}

.hero { padding: 18px 0 4px; }
.hero h1 {
  margin: 0 0 4px;
  font-size: 27px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.4px;
}
.hero p { margin: 0; color: var(--sub); font-size: 13.5px; }

/* ---------- 搜索 ---------- */

.search { position: relative; margin: 16px 0 4px; }
.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--mute);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.search input::placeholder { color: #BDAF9F; }
.search input:focus {
  border-color: #DCC7B1;
  box-shadow: 0 0 0 3.5px rgba(196, 70, 44, .07);
}

/* ---------- 已选 ---------- */

.picked {
  margin-top: 14px;
  padding: 12px 14px 10px;
  background: #FFFDFB;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.picked-top {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12.5px;
  color: var(--sub);
  margin-bottom: 9px;
}
.picked-top b { color: var(--red); font-size: 15px; font-weight: 800; }
.link {
  margin-left: auto;
  background: none;
  border: 0;
  padding: 0;
  color: var(--mute);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 5px 6px 5px 11px;
  background: var(--red-soft);
  color: var(--red-deep);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s;
}
.pill span {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(196, 70, 44, .14);
  font-size: 9px;
  color: var(--red);
}
.pill:active { transform: scale(.95); }

/* ---------- 食材 ---------- */

.groups { margin-top: 4px; }

.group h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 20px 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: 1.2px;
}
.group h3 em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: #B7A492;
  background: #F4EBDF;
  padding: 1px 6px;
  border-radius: 999px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s, transform .12s, box-shadow .16s;
}
.chip i { font-style: normal; font-size: 10.5px; color: #C3B3A2; }
.chip:active { transform: scale(.95); }
.chip.on {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 5px 14px rgba(196, 70, 44, .26);
}
.chip.on i { color: rgba(255, 255, 255, .72); }

/* ---------- 结果 ---------- */

.results { margin-top: 30px; scroll-margin-top: 74px; }

/* 悬浮的实时结果条 */
.livebar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 16px;
  background: rgba(255, 253, 250, .97);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(70, 45, 25, .16);
  white-space: nowrap;
}
.lb-txt { font-size: 13px; color: var(--ink-soft); }
.lb-txt b { color: var(--red); font-size: 17px; font-weight: 800; margin: 0 2px; }
.lb-sub { margin-left: 8px; font-size: 11.5px; color: var(--amber); }
.livebar button {
  border: 0;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.livebar button:active { transform: scale(.96); }

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.results-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.2px;
}
.results-head h2 b { color: var(--red); font-size: 23px; margin: 0 1px; }
.results-head .sub { margin: 2px 0 0; font-size: 12.5px; color: var(--mute); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, background .16s, border-color .16s, box-shadow .16s;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn.tiny { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; font-weight: 600; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 5px 14px rgba(196, 70, 44, .22);
}
.btn.on { background: var(--red-soft); border-color: #F3D2C7; color: var(--red-deep); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--mute); font-weight: 500; }
.btn.wide { flex: 1; }
.btn:disabled { opacity: .45; }

.seg {
  display: inline-flex;
  gap: 2px;
  margin: 14px 0 2px;
  padding: 3px;
  background: #F3EADF;
  border-radius: 999px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--sub);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .16s, color .16s, box-shadow .16s;
}
.seg button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(80, 55, 30, .12);
}

/* ---------- 卡片 ---------- */

.cards { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 13px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .14s, box-shadow .18s, border-color .18s;
}
.card:active { transform: scale(.994); }
@media (hover: hover) {
  .card:hover { border-color: #E3D4C1; box-shadow: 0 2px 4px rgba(70, 45, 25, .05), 0 14px 30px rgba(70, 45, 25, .08); }
}

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
  line-height: 1.35;
}

.badge {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.full { background: var(--green-soft); color: var(--green); }
.badge.one { background: var(--amber-soft); color: var(--amber); }
.badge.far { background: #F4ECE2; color: #9C8C7B; }

.meta { margin-top: 3px; font-size: 12.5px; color: var(--mute); letter-spacing: .2px; }

.line {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed #F1E7DA;
  font-size: 12.5px;
  color: #9A8C7C;
}
.line.miss b { color: var(--amber); font-weight: 600; }
.line.ok { color: var(--green); display: flex; align-items: center; gap: 5px; }
.tick {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tags span {
  font-size: 11.5px;
  color: #A38F7B;
  background: #FAF4EB;
  padding: 1px 8px;
  border-radius: 6px;
  letter-spacing: .2px;
}

.empty {
  margin: 18px 0;
  padding: 22px 18px;
  text-align: center;
  color: var(--mute);
  font-size: 13.5px;
  background: #FDFAF5;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.count { font-size: 12.5px; color: var(--mute); margin: 0; }
.lib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 4px;
}

/* ---------- 菜谱库 ---------- */

.tagbar {
  margin: 14px -18px 0;
  padding: 0 18px 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.tagbar::-webkit-scrollbar { display: none; }
.tagbar .chip { flex: none; }

/* ---------- 我的 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}
.stats > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.stats b { display: block; font-size: 22px; font-weight: 800; line-height: 1.3; color: var(--red); }
.stats span { font-size: 11.5px; color: var(--mute); }

.sec {
  margin: 28px 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: 1.2px;
}

.minilist { display: flex; flex-wrap: wrap; gap: 8px; }
.mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s, border-color .16s;
}
.mini:active { transform: scale(.97); }
.mini em { font-style: normal; font-size: 11px; color: var(--mute); }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.switch-row > span { flex: 1; font-size: 14px; }
.switch-row em {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  color: var(--mute);
  margin-top: 2px;
}
.switch {
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #E7DCCF;
  position: relative;
  transition: background .2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 40, 20, .25);
  transition: transform .2s;
}
.switch.on { background: var(--red); }
.switch.on::after { transform: translateX(18px); }

.rowbtn {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #F4EBE0;
  background: transparent;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.rowbtn:last-child { border-bottom: 0; }
.rowbtn em { font-style: normal; font-size: 11.5px; color: var(--mute); margin-left: auto; text-align: right; }
.rowbtn.danger { color: #B23A22; }
.rowbtn:active { background: #FCF7F1; }

.foot {
  margin: 26px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #BCAC9C;
}

/* ---------- 弹层 ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(36, 24, 16, .38);
  z-index: 40;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.sheet {
  pointer-events: auto;
  width: 100%;
  max-width: 720px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(40, 25, 15, .18);
  animation: up .28s cubic-bezier(.2, .85, .25, 1);
  overflow: hidden;
}
@keyframes up {
  from { transform: translateY(36px); opacity: .5; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-head {
  position: relative;
  padding: 20px 20px 14px;
  background: linear-gradient(180deg, #FFF9F3, var(--paper));
  border-bottom: 1px solid var(--line);
  flex: none;
}
.close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--mute);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.dish-title {
  margin: 0 34px 4px 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.3;
}
.dish-title.small { font-size: 21px; }
.sheet-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--mute); }

.sheet-body {
  padding: 16px 20px 26px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.sheet-foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: #FFFDFB;
  border-top: 1px solid var(--line);
}
.sheet-foot .btn { flex: 1; padding: 11px 6px; font-size: 13.5px; white-space: nowrap; }

.missbar {
  background: var(--amber-soft);
  color: #8A5E0F;
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 13px;
}
.missbar b { font-weight: 700; }
.missbar.ok { background: var(--green-soft); color: var(--green); }

.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: 1.3px;
}
.sec-title .hint {
  font-weight: 400;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--mute);
}

.ing {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid #F4EBE0;
}
.dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  border: 1.6px solid #D6C5B2;
  background: transparent;
}
.dot.have { background: var(--green); border-color: var(--green); }
.ing-name { font-size: 14.5px; }
.ing.miss .ing-name { color: #8C8075; }
.ing-kind {
  font-size: 10px;
  color: #A38F7B;
  border: 1px solid #EEE2D3;
  border-radius: 5px;
  padding: 0 5px;
  line-height: 1.6;
}
.ing-kind.soft { color: #B7A492; border-style: dashed; }
.ing-amt { margin-left: auto; font-size: 13px; color: var(--sub); white-space: nowrap; }
.sub-hint {
  font-size: 12px;
  color: var(--amber);
  padding: 0 0 9px 18px;
  margin-top: -4px;
}

.steps {
  list-style: none;
  counter-reset: s;
  margin: 6px 0 0;
  padding: 0;
}
.steps li {
  position: relative;
  padding: 0 0 15px 34px;
  font-size: 14.5px;
  color: #3B312A;
}
.steps li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  left: 0;
  top: 1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #F7E6DC;
  color: var(--red);
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.tipbox {
  margin-top: 8px;
  padding: 12px 14px;
  background: #FFF9EC;
  border: 1px solid #F3E4C8;
  border-radius: 12px;
  font-size: 13px;
  color: #7A5B22;
  line-height: 1.65;
}
.tipbox b {
  display: block;
  font-size: 11.5px;
  letter-spacing: 1px;
  color: #A8813A;
  margin-bottom: 2px;
}

/* ---------- 表单 ---------- */

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #DCC7B1;
  box-shadow: 0 0 0 3px rgba(196, 70, 44, .06);
}
.field textarea { min-height: 118px; resize: vertical; line-height: 1.75; }
.row { display: flex; gap: 9px; }
.row .field { flex: 1; }
.row .field:nth-child(2) { flex: .8; }

.ing-row {
  display: grid;
  grid-template-columns: 1fr 74px 82px 28px;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.ing-row input, .ing-row select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.ing-row input:focus, .ing-row select:focus { border-color: #DCC7B1; }
.ing-row .i-sub {
  grid-column: 1 / -1;
  font-size: 12.5px;
  padding: 5px 10px;
  background: #FBF6EF;
  border-style: dashed;
}
.i-del {
  border: 1px solid var(--line);
  background: #fff;
  color: #C0AE9C;
  border-radius: 9px;
  height: 33px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.i-del:active { background: var(--red-soft); color: var(--red); }

.hint { font-size: 11.5px; color: var(--mute); }
.hintbox {
  margin-top: 12px;
  padding: 11px 13px;
  background: #FBF6EF;
  border-radius: 11px;
  font-size: 12px;
  color: #8C7A67;
  line-height: 1.7;
}
.file { font-size: 12.5px; color: var(--sub); }

/* ---------- 底部导航 ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 7px 14px calc(7px + env(safe-area-inset-bottom));
  background: rgba(251, 247, 241, .93);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid rgba(237, 227, 214, .9);
}
.tab {
  flex: 1;
  max-width: 148px;
  border: 0;
  background: none;
  color: #AE9F90;
  padding: 5px 0 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border-radius: 12px;
  cursor: pointer;
  transition: color .16s, background .16s;
}
.tab svg { width: 22px; height: 22px; }
.tab span { font-size: 10.5px; letter-spacing: .6px; font-weight: 600; }
.tab.on { color: var(--red); }
.tab:active { background: rgba(196, 70, 44, .06); }

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: 82vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: #2E241D;
  color: #fff;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  box-shadow: 0 8px 24px rgba(30, 20, 12, .28);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
