:root {
  --cream: #fff9f6;
  --pink: #e8a7ae;
  --pink-soft: #fbe8ea;
  --bean: #c98f8f;
  --ink: #5b4a45;
  --ink-soft: #9c8982;
  --line: #f4e4e1;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  overscroll-behavior-y: none;
}
body { position: relative; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; }
input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.bg img {
  width: 100%; height: 100%; object-fit: cover;
  transition: filter .18s ease, transform .18s ease;
  transform: scale(1.08);
}
.bg img.noblur { transform: scale(1); }
.veil {
  position: fixed; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(255,249,246,.72), rgba(255,249,246,.9) 42%, rgba(255,249,246,.97));
  pointer-events: none;
}

/* ---------- shell ---------- */
.view {
  position: relative; z-index: 2;
  max-width: 480px; margin: 0 auto;
  padding: 14px 16px calc(96px + var(--safe-b));
  min-height: 100%;
}
.view.page { padding-bottom: calc(88px + var(--safe-b)); }

/* ---------- home toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding-top: 8px; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.82);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(201,143,143,.08);
  backdrop-filter: blur(8px);
}
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; }
.search input::placeholder { color: var(--ink-soft); }
.ico { width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; }
.dice {
  width: 46px; height: 46px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line);
  display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(201,143,143,.12);
  transition: transform .12s ease;
}
.dice:active { transform: scale(.94); }
.dice svg { width: 22px; height: 22px; fill: none; stroke: var(--bean); stroke-width: 1.8; }
.dice svg circle { fill: var(--pink); stroke: none; }

/* ---------- categories ---------- */
.cats {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 14px 0 6px; scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 16px; border-radius: 999px;
  background: rgba(255,255,255,.7); border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 14px;
  transition: all .15s ease;
}
.chip.on { background: var(--pink); border-color: var(--pink); color: #fff; box-shadow: 0 6px 16px rgba(232,167,174,.35); }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- dish grid ---------- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding-top: 10px;
}
.card {
  background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 6px 20px rgba(201,143,143,.12);
  position: relative; text-align: left;
  transition: transform .12s ease;
}
.card:active { transform: scale(.975); }
.card-img { width: 100%; aspect-ratio: 1 / 1; background: var(--pink-soft); object-fit: cover; }
.card-img.ph { display: grid; place-items: center; color: var(--bean); font-size: 28px; }
.card-meta { padding: 10px 12px 12px; }
.card-name { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.card-cat { margin-top: 3px; font-size: 12px; color: var(--ink-soft); }
.heart { position: absolute; top: 8px; right: 10px; color: #fff; font-size: 14px; text-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* ---------- floating bar & fab ---------- */
.bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + var(--safe-b)); z-index: 5;
  width: min(440px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px; border-radius: 999px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(201,143,143,.22);
  backdrop-filter: blur(10px);
}
.bar-title { font-size: 14px; color: var(--ink-soft); }
.bar-count { font-size: 15px; font-weight: 600; color: var(--bean); }
.fab {
  position: fixed; right: max(16px, calc(50vw - 240px + 16px)); z-index: 6;
  bottom: calc(84px + var(--safe-b));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--pink); color: #fff; font-size: 13px; letter-spacing: 1px;
  box-shadow: 0 10px 26px rgba(232,167,174,.45);
}
.fab:active { transform: scale(.94); }

/* ---------- page ---------- */
.page-head { display: flex; align-items: center; gap: 10px; padding: 6px 0 14px; }
.page-head h1 { font-size: 19px; margin: 0; font-weight: 600; flex: 1; letter-spacing: .5px; }
.back {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.85); border: 1px solid var(--line);
  font-size: 24px; line-height: 1; color: var(--ink-soft);
  display: grid; place-items: center; padding-bottom: 3px;
}
.count { font-size: 13px; color: var(--ink-soft); }
.muted { font-size: 12px; color: var(--ink-soft); font-weight: 400; }

/* ---------- today ---------- */
.today-list { display: flex; flex-direction: column; gap: 12px; }
.today-item {
  display: flex; gap: 12px; align-items: center;
  background: #fff; border-radius: var(--radius); padding: 12px;
  box-shadow: 0 6px 20px rgba(201,143,143,.1);
}
.today-item img, .today-item .thumb {
  width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--pink-soft);
  flex: 0 0 auto;
}
.today-main { flex: 1; min-width: 0; }
.today-name { font-size: 15px; font-weight: 600; }
.today-note {
  margin-top: 6px; width: 100%; border: 0; border-bottom: 1px dashed var(--line);
  background: none; outline: none; font-size: 13px; color: var(--ink-soft); padding: 3px 0;
}
.del { width: 32px; height: 32px; border-radius: 50%; background: var(--pink-soft); color: var(--bean); font-size: 16px; }
.page-foot { display: flex; gap: 10px; margin-top: 18px; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 30px; height: 30px; border-radius: 50%; background: var(--pink-soft);
  color: var(--bean); font-size: 17px; line-height: 1;
}
.stepper b { min-width: 18px; text-align: center; font-size: 15px; }

/* ---------- admin ---------- */
.block { margin-bottom: 22px; }
.block-title { font-size: 13px; color: var(--ink-soft); margin: 0 4px 10px; letter-spacing: .5px; }
.bg-card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--pink-soft); box-shadow: 0 6px 20px rgba(201,143,143,.12);
}
.bg-card img { width: 100%; height: 170px; object-fit: cover; }
.bg-card .btn { position: absolute; right: 10px; bottom: 10px; }
.blur-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 0 4px; }
.blur-label { font-size: 13px; color: var(--ink-soft); }
.blur-row input[type=range] { flex: 1; accent-color: var(--pink); }
.blur-val { font-size: 13px; color: var(--bean); width: 42px; text-align: right; }
.add-row { display: flex; gap: 10px; margin-top: 12px; }
.add-row input { flex: 1; }
.dish-list { display: flex; flex-direction: column; gap: 10px; }
.dish-row {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border-radius: 14px; padding: 10px; box-shadow: 0 4px 14px rgba(201,143,143,.1);
}
.dish-row img, .dish-row .thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--pink-soft); }
.dish-row .nm { flex: 1; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad { height: 30px; }

/* ---------- inputs & buttons ---------- */
input[type=text], input[type=search], input:not([type]), select, .note {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; outline: none; font-size: 15px; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
select { background-image: none; }
.btn {
  padding: 11px 18px; border-radius: 12px; font-size: 15px;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  transition: transform .1s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; box-shadow: 0 8px 20px rgba(232,167,174,.32); }
.btn.ghost { background: rgba(255,255,255,.7); color: var(--ink-soft); }
.btn.danger { background: #fff; border-color: #f0c3c3; color: #c25b5b; }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.wide { width: 100%; }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.sheet-mask { position: absolute; inset: 0; background: rgba(60,40,38,.35); animation: fade .2s ease; }
.sheet {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(480px, 100%);
  background: var(--cream); border-radius: 24px 24px 0 0;
  padding-bottom: calc(18px + var(--safe-b));
  animation: rise .24s cubic-bezier(.2,.8,.3,1);
  max-height: 92vh; overflow-y: auto;
}
@keyframes rise { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-img img { width: 100%; height: 210px; object-fit: cover; border-radius: 24px 24px 0 0; background: var(--pink-soft); }
.sheet-body { padding: 16px 20px 4px; }
.s-name { font-size: 20px; font-weight: 600; letter-spacing: .4px; }
.s-cat { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.s-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.6; margin: 10px 0 14px; }
.row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.row-label { font-size: 14px; color: var(--ink-soft); }
.note { width: 100%; margin-bottom: 14px; }

/* ---------- editor ---------- */
.editor {
  position: fixed; inset: 0; z-index: 30; background: var(--cream);
  overflow-y: auto; padding: 12px 18px calc(24px + var(--safe-b));
}
.ed-body { display: flex; flex-direction: column; gap: 14px; }
.ed-img {
  width: 100%; height: 200px; border-radius: var(--radius); overflow: hidden;
  background: var(--pink-soft); border: 1px dashed var(--bean); color: var(--bean);
  display: grid; place-items: center;
}
.ed-img img { width: 100%; height: 100%; object-fit: cover; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--ink-soft); }

/* ---------- crop ---------- */
.crop {
  position: fixed; inset: 0; z-index: 40; background: #1a1513;
  display: flex; flex-direction: column;
}
.crop canvas { flex: 1; width: 100%; touch-action: none; }
.crop-hint {
  color: rgba(255,255,255,.66); font-size: 12px; text-align: center;
  padding: 8px 20px; line-height: 1.5;
}
.crop-foot { display: flex; gap: 12px; padding: 4px 20px calc(20px + var(--safe-b)); }
.crop-foot .btn { flex: 1; }
.crop-foot .ghost { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(60,40,38,.35); display: grid; place-items: center; padding: 24px; }
.modal-card {
  width: min(360px, 100%); background: var(--cream); border-radius: 18px;
  padding: 20px; box-shadow: 0 20px 60px rgba(60,40,38,.3);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.modal-input { width: 100%; margin-bottom: 6px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.modal-foot .btn { min-width: 84px; }

/* ---------- toast / empty ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(110px + var(--safe-b)); z-index: 60;
  background: rgba(91,74,69,.92); color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; animation: fade .18s ease;
}
.empty { text-align: center; color: var(--ink-soft); font-size: 14px; padding: 48px 20px; line-height: 1.8; }
