/* =========================================================
   냠냠일기 — 따뜻하고 아기자기한 게임 UI 스타일
   ========================================================= */
:root {
  --bg: #fbf1e2;
  --bg-dot: #f1e1c8;
  --paper: #fffdf7;
  --paper-2: #fff7ea;
  --ink: #4a3324;
  --ink-2: #7d6150;
  --ink-3: #ab917d;
  --line: #ecd8bd;
  --edge: #4a3324;

  --orange: #ff8a3d;
  --orange-d: #d9661c;
  --orange-l: #ffe3cd;
  --green: #6dbb5a;
  --green-d: #3d8730;
  --green-l: #e1f3d4;
  --plan: #8f87f2;
  --plan-d: #554dc0;
  --plan-l: #ecebff;
  --amber: #ffb23e;
  --amber-d: #b87500;
  --amber-l: #fff0cc;
  --red: #f0525a;
  --red-d: #c02c35;
  --red-l: #ffe1df;
  --sun: #e0524a;
  --sat: #4b7fd1;

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 15px;
  --r-sm: 11px;

  --font-display: 'Do Hyeon', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --font-body: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --bounce: cubic-bezier(.2, 1.45, .4, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.6px, transparent 1.8px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }

.app { max-width: 1120px; margin: 0 auto; padding: 20px 20px 48px; }

/* ---------- 상단 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-icon {
  display: grid; place-items: center;
  width: 54px; height: 54px; flex: none;
  font-size: 32px;
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--edge);

}
.brand-text h1 { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.1; letter-spacing: 1px; }
.brand-text p { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

.tabs {
  display: flex; gap: 6px; padding: 6px;
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--edge);
}
.tab {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 14px;
  font-family: var(--font-display); font-size: 17px;
  color: var(--ink-2);
  transition: background .2s, color .2s, transform .15s;
}
.tab:hover { background: var(--paper-2); }
.tab.is-active { background: var(--orange); color: #fff; box-shadow: inset 0 -3px 0 var(--orange-d); }
.tab-icon { font-size: 18px; }
.tab-alert {
  position: absolute; top: -6px; right: -6px;
  display: grid; place-items: center;
  width: 20px; height: 20px;
  font-style: normal; font-family: var(--font-display); font-size: 13px;
  color: #fff; background: var(--red);
  border: 2px solid var(--edge); border-radius: 50%;
  animation: pulse 1.6s ease-in-out infinite;
}

/* ---------- 공통 요소 ---------- */
.view { display: none; }
.view.is-active { display: block; animation: viewIn .35s var(--bounce); }

.panel {
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: var(--r-xl);
  box-shadow: 0 6px 0 var(--edge);
  padding: 18px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  font-family: var(--font-display); font-size: 16px;
  background: var(--paper);
  border: 2.5px solid var(--edge);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--edge);
  transition: transform .08s, box-shadow .08s, filter .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn-primary { background: var(--orange); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn-plan { background: var(--plan); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn-eat { background: var(--green); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn-ghost-danger { background: var(--red-l); color: var(--red-d); }
.btn-sm { padding: 6px 12px; font-size: 14px; border-radius: 11px; box-shadow: 0 3px 0 var(--edge); }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  font-size: 15px;
  background: var(--paper-2);
  border: 2.5px solid var(--edge);
  border-radius: 13px;
  box-shadow: 0 3px 0 var(--edge);
  transition: transform .08s, box-shadow .08s;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }

.pill-btn {
  padding: 7px 14px;
  font-family: var(--font-display); font-size: 15px;
  background: var(--orange-l); color: var(--orange-d);
  border: 2.5px solid var(--edge);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--edge);
  transition: transform .08s, box-shadow .08s;
}
.pill-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }

.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--paper-2);
  border: 2.5px solid var(--edge);
  border-radius: 16px;
}
.seg-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 10px;
  font-family: var(--font-display); font-size: 15px;
  color: var(--ink-2);
  border-radius: 11px;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.seg-btn:hover { background: #fff; }
.seg-btn.is-on { background: var(--ink); color: #fff; }
.seg-btn .count {
  min-width: 22px; padding: 0 6px;
  font-size: 13px; line-height: 20px;
  background: rgba(255,255,255,.22);
  border-radius: 999px;
}
.seg-btn:not(.is-on) .count { background: var(--line); }

/* ---------- 확정 대기 배너 ---------- */
.banner {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 12px 16px;
  text-align: left;
  background: var(--amber-l);
  border: 3px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 0 var(--edge);
  animation: dropIn .45s var(--bounce);
  transition: transform .08s, box-shadow .08s;
}
.banner:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.banner-icon { font-size: 26px; }
.banner-text { flex: 1; min-width: 0; }
.banner-text b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 17px; }
.banner-text small { color: var(--ink-2); font-size: 13px; }
.banner-go {
  flex: none;
  padding: 6px 12px;
  font-family: var(--font-display);
  color: #fff; background: var(--amber-d);
  border-radius: 999px;
}

/* ---------- 달력 ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.month-title {
  flex: 1; text-align: center;
  font-family: var(--font-display); font-weight: 400; font-size: 26px;
}
.cal-head .pill-btn { margin-left: 4px; }

.weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
  margin-bottom: 6px;
  text-align: center;
  font-family: var(--font-display); font-size: 14px; color: var(--ink-2);
}
.weekdays .sun { color: var(--sun); }
.weekdays .sat { color: var(--sat); }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
}
.cal-grid.slide-next { animation: slideNext .35s var(--bounce); }
.cal-grid.slide-prev { animation: slidePrev .35s var(--bounce); }

.cell {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0; min-height: 108px;
  padding: 6px;
  text-align: left;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  transition: transform .15s var(--bounce), border-color .15s, box-shadow .15s;
}
.cell:hover { transform: translateY(-2px); border-color: var(--ink-3); box-shadow: 0 3px 0 var(--line); }
.cell:active { transform: translateY(1px); }
.cell.is-future { background: var(--paper-2); }
.cell.is-other { opacity: .42; }
.cell-day {
  align-self: flex-start;
  font-family: var(--font-display); font-size: 15px; line-height: 22px;
  padding: 0 4px;
  border-radius: 999px;
}
.cell.sun .cell-day { color: var(--sun); }
.cell.sat .cell-day { color: var(--sat); }
.cell.is-today {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-l);
  background: #fffaf3;
}
.cell.is-today .cell-day { background: var(--orange); color: #fff; padding: 0 8px; }
.cell.is-today::after {
  content: '오늘';
  position: absolute; top: 7px; right: 7px;
  font-family: var(--font-display); font-size: 11px;
  color: var(--orange-d);
}
.cell-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.chip {
  display: flex; align-items: center; gap: 3px;
  min-width: 0;
  padding: 1px 6px;
  font-size: 12px; line-height: 18px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  white-space: nowrap;
}
.chip-i { flex: none; font-style: normal; }
.chip-t { overflow: hidden; text-overflow: ellipsis; font-style: normal; }
.chip.eaten { background: var(--green-l); color: var(--green-d); }
.chip.planned { background: var(--plan-l); color: var(--plan-d); border-style: dashed; border-color: var(--plan); }
.chip.overdue { background: var(--amber-l); color: var(--amber-d); border-style: dashed; border-color: var(--amber); }
.chip.more { justify-content: center; color: var(--ink-2); background: var(--paper-2); font-family: var(--font-display); }

.legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
  margin-top: 14px;
  font-size: 13px; color: var(--ink-2);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 5px; border: 1.5px solid transparent; }
.dot.eaten { background: var(--green-l); border-color: var(--green); }
.dot.planned { background: var(--plan-l); border: 1.5px dashed var(--plan); }
.dot.overdue { background: var(--amber-l); border: 1.5px dashed var(--amber); }

/* ---------- 곳간 ---------- */
.pantry-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pantry-top .seg { flex: 1; max-width: 420px; background: var(--paper); box-shadow: 0 4px 0 var(--edge); border-width: 3px; }
.pantry-top .seg-btn { padding: 10px; font-size: 16px; }
.pantry-top .btn { margin-left: auto; }

.alert {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 12px 16px;
  background: var(--red-l);
  border: 3px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 0 var(--edge);
  animation: dropIn .45s var(--bounce);
}
.alert-icon { font-size: 24px; }
.alert b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 16px; color: var(--red-d); }
.alert small { color: var(--ink-2); font-size: 13px; }

.item-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px;
}
.item-grid.animate-in .item-card { animation: popIn .4s var(--bounce) both; animation-delay: calc(var(--i, 0) * 35ms); }

.item-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 12px 12px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: 0 5px 0 var(--edge);
  cursor: pointer;
  transition: transform .15s var(--bounce), box-shadow .15s;
}
.item-card:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--edge); }
.item-card.is-empty .item-icon { filter: grayscale(.8); opacity: .55; }
.item-card.is-short { background: #fff6f5; border-color: var(--red-d); box-shadow: 0 5px 0 var(--red-d); }
.card-pencil {
  position: absolute; top: 8px; right: 10px;
  font-size: 13px; opacity: .5;
}
.item-card:hover .card-pencil { opacity: 1; }
.item-icon {
  display: grid; place-items: center;
  width: 62px; height: 62px;
  font-size: 36px;
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  border-radius: 18px;
}
.item-name {
  width: 100%;
  font-family: var(--font-display); font-weight: 400; font-size: 17px; line-height: 1.25;
  overflow-wrap: anywhere;
}
.stock-label { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stock { display: flex; align-items: center; gap: 8px; }
.round-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  font-family: var(--font-display); font-size: 18px; line-height: 1;
  background: var(--paper-2);
  border: 2.5px solid var(--edge);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--edge);
  transition: transform .08s, box-shadow .08s;
}
.round-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.stock-num { min-width: 64px; display: flex; align-items: baseline; justify-content: center; gap: 2px; }
.stock-num b { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1; }
.stock-num small { font-size: 13px; color: var(--ink-2); }
.stock-num.bump b { animation: bump .35s var(--bounce); }
.expect {
  width: 100%;
  margin-top: 4px; padding: 5px 8px;
  font-size: 12.5px; color: var(--ink-2);
  background: var(--paper-2);
  border-radius: 10px;
}
.expect b { font-family: var(--font-display); font-weight: 400; font-size: 14px; }
.expect.has { background: var(--plan-l); color: var(--plan-d); }
.expect.warn { background: var(--red); color: #fff; font-family: var(--font-display); font-size: 14px; animation: pulse 1.6s ease-in-out infinite; }
.note-bubble {
  position: relative;
  max-width: 100%;
  margin-top: 4px; padding: 6px 12px;
  font-size: 14px;
  background: var(--green-l); color: var(--green-d);
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.note-bubble.empty { background: var(--paper-2); color: var(--ink-3); }

.empty-card {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 20px;
  text-align: center;
  background: var(--paper);
  border: 3px dashed var(--ink-3);
  border-radius: var(--r-xl);
  color: var(--ink-2);
}
.empty-card .big-emoji { font-size: 40px; opacity: .8; }
.empty-card b { font-family: var(--font-display); font-weight: 400; font-size: 19px; color: var(--ink); }

/* ---------- 모달 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(74, 51, 36, .42);
  opacity: 0;
  transition: opacity .2s;
}
.overlay.show { opacity: 1; }
.overlay.hide { opacity: 0; pointer-events: none; }
.modal {
  position: relative;
  width: min(580px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: var(--r-xl);
  box-shadow: 0 8px 0 var(--edge);
  transform: scale(.88) translateY(14px);
  transition: transform .3s var(--bounce);
}
.overlay.show .modal { transform: none; }
.overlay.hide .modal { transform: scale(.94) translateY(8px); }
.confirm-modal { width: min(400px, 100%); text-align: center; }

.sheet-handle { display: none; }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.modal-head .close { margin-left: auto; align-self: flex-start; }
.head-text { min-width: 0; }
.head-text h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.2; }
.head-text .sub { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.date-tile {
  flex: none;
  display: flex; flex-direction: column; align-items: center;
  width: 66px; padding: 6px 0 7px;
  background: var(--orange);
  color: #fff;
  border: 3px solid var(--edge);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--edge);
  font-family: var(--font-display);
  animation: popIn .4s var(--bounce);
}
.date-tile.future { background: var(--plan); }
.date-tile small { font-size: 12px; line-height: 1.1; opacity: .9; }
.date-tile b { font-weight: 400; font-size: 28px; line-height: 1.05; }
.head-icon {
  flex: none;
  display: grid; place-items: center;
  width: 62px; height: 62px;
  font-size: 36px;
  background: var(--paper-2);
  border: 3px solid var(--edge);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--edge);
}
.head-icon.pop { animation: popIn .35s var(--bounce); }
.mode-pill {
  display: inline-block;
  margin-top: 5px; padding: 3px 10px;
  font-size: 12.5px;
  border-radius: 999px;
}
.mode-pill.eaten { background: var(--green-l); color: var(--green-d); }
.mode-pill.planned { background: var(--plan-l); color: var(--plan-d); }

/* 기록 목록 */
.entry-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.meal-group { display: flex; flex-direction: column; gap: 6px; }
.meal-head { font-family: var(--font-display); font-size: 14px; color: var(--ink-2); padding-left: 4px; }
.date-group-head { font-family: var(--font-display); font-size: 15px; color: var(--ink); padding-left: 4px; }

.entry {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: #fff;
  border: 2.5px solid var(--line);
  border-left-width: 7px;
  border-radius: 15px;
  transition: border-color .2s, background .2s;
}
.entry.eaten { border-left-color: var(--green); }
.entry.planned { border-left-color: var(--plan); border-style: dashed; border-left-style: solid; }
.entry.overdue { border-left-color: var(--amber); background: #fffcf3; }
.entry.is-editing { border-color: var(--orange); background: var(--orange-l); }
.entry.is-new { animation: popIn .4s var(--bounce); }
.entry-icon {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  font-size: 23px;
  background: var(--paper-2);
  border-radius: 12px;
}
.entry-main { flex: 1; min-width: 0; }
.entry-name { font-family: var(--font-display); font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.entry-qty { color: var(--ink-2); font-size: 14px; margin-left: 4px; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px;
  font-size: 11.5px; line-height: 17px;
  color: var(--ink-2); background: var(--paper-2);
  border-radius: 999px;
  white-space: nowrap;
}
.tag-eaten { background: var(--green-l); color: var(--green-d); }
.tag-planned { background: var(--plan-l); color: var(--plan-d); }
.tag-overdue { background: var(--amber-l); color: var(--amber-d); }
.tag-warn { background: var(--red); color: #fff; }
.entry-actions { flex: none; display: flex; align-items: center; gap: 5px; }
.mini-btn {
  display: grid; place-items: center;
  min-width: 34px; height: 34px; padding: 0 6px;
  font-size: 15px;
  background: var(--paper-2);
  border: 2px solid var(--line);
  border-radius: 11px;
  transition: transform .1s, background .15s, border-color .15s;
}
.mini-btn:hover { border-color: var(--ink-3); }
.mini-btn:active { transform: scale(.92); }
.mini-btn.is-armed {
  padding: 0 10px;
  font-family: var(--font-display); font-size: 13px;
  color: #fff; background: var(--red); border-color: var(--red-d);
  animation: shake .35s;
}
.confirm-btn {
  padding: 6px 10px;
  font-family: var(--font-display); font-size: 13px;
  color: #fff; background: var(--green);
  border: 2px solid var(--edge);
  border-radius: 11px;
  box-shadow: 0 2px 0 var(--edge);
  white-space: nowrap;
  transition: transform .08s, box-shadow .08s;
}
.confirm-btn:active { transform: translateY(2px); box-shadow: none; }

.empty-day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-bottom: 18px; padding: 18px;
  color: var(--ink-2); text-align: center;
  background: var(--paper-2);
  border: 2.5px dashed var(--line);
  border-radius: var(--r-lg);
}
.empty-day span { font-size: 30px; opacity: .8; }

/* 입력 폼 */
.day-form, .item-form {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  border-radius: var(--r-lg);
}
.day-form.is-editing { border-color: var(--orange); background: #fff6ec; }
.item-form { padding: 0; background: none; border: 0; }
.form-title { font-family: var(--font-display); font-size: 17px; }

.meal-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.meal-chips .field-label { margin-right: 2px; }
.meal-chip, .chip-opt {
  padding: 5px 11px;
  font-size: 13.5px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 999px;
  transition: transform .15s var(--bounce), background .15s, border-color .15s;
}
.meal-chip:hover, .chip-opt:hover { border-color: var(--ink-3); }
.meal-chip.is-on, .chip-opt.is-on { background: var(--ink); color: #fff; border-color: var(--ink); transform: scale(1.04); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-family: var(--font-display); font-size: 14px; color: var(--ink-2); }
.text-input {
  width: 100%;
  padding: 11px 14px;
  background: #fff;
  border: 2.5px solid var(--line);
  border-radius: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.text-input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-l); }
.text-input::placeholder { color: var(--ink-3); }

.inv {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px;
  max-height: 232px; overflow-y: auto;
  padding: 2px 2px 6px;
}
.slot {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0;
  padding: 8px 4px 6px;
  background: #fff;
  border: 2.5px solid var(--line);
  border-radius: 14px;
  transition: transform .15s var(--bounce), border-color .15s, box-shadow .15s;
}
.slot:hover { transform: translateY(-2px); border-color: var(--ink-3); }
.slot.is-sel { border-color: var(--edge); background: var(--orange-l); box-shadow: 0 3px 0 var(--edge); transform: translateY(-2px); }
.slot.is-low .slot-icon { filter: grayscale(.7); opacity: .6; }
.slot-icon { font-size: 26px; line-height: 1.2; }
.slot-name { width: 100%; font-size: 12.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-badge {
  max-width: 100%;
  padding: 0 7px;
  font-family: var(--font-display); font-size: 12px; line-height: 18px;
  color: var(--ink-2); background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot.is-low .slot-badge { color: #fff; background: var(--red); }
.slot.is-sel .slot-badge { background: #fff; }
.slot.is-sel.is-low .slot-badge { background: var(--red); }

.qty-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper {
  display: flex; align-items: center;
  background: #fff;
  border: 2.5px solid var(--edge);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--edge);
  overflow: hidden;
}
.stepper button {
  width: 40px; height: 40px;
  font-family: var(--font-display); font-size: 20px;
  background: var(--paper-2);
  transition: background .15s;
}
.stepper button:active { background: var(--orange-l); }
.stepper input {
  width: 64px; height: 40px;
  text-align: center;
  font-family: var(--font-display); font-size: 18px;
  border: 0; border-left: 2px solid var(--line); border-right: 2px solid var(--line);
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit-label { font-family: var(--font-display); color: var(--ink-2); }
.unit-input { width: 96px; }
.stock-hint {
  padding: 8px 12px;
  font-size: 13.5px; color: var(--ink-2);
  background: #fff;
  border-radius: 12px;
}
.stock-hint:empty { display: none; }
.stock-hint b { font-family: var(--font-display); font-weight: 400; color: var(--ink); }
.stock-hint .warn { color: var(--red-d); }
.stock-hint.is-warn { background: var(--red-l); }

.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.form-actions .btn-main { flex: 1; min-width: 140px; padding: 12px 18px; font-size: 17px; }

.empty-pick {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px;
  text-align: center; color: var(--ink-2);
  background: #fff;
  border: 2px dashed var(--line);
  border-radius: 14px;
}

.icon-pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px;
  max-height: 150px; overflow-y: auto;
  padding: 8px;
  background: var(--paper-2);
  border: 2px solid var(--line);
  border-radius: 14px;
}
.icon-opt {
  height: 40px;
  font-size: 22px;
  border-radius: 11px;
  border: 2px solid transparent;
  transition: transform .15s var(--bounce), background .15s;
}
.icon-opt:hover { background: #fff; transform: scale(1.12); }
.icon-opt.is-on { background: #fff; border-color: var(--edge); box-shadow: 0 2px 0 var(--edge); }

.qty-unit-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.info-box {
  padding: 10px 12px;
  font-size: 13.5px; color: var(--ink-2);
  background: var(--paper-2);
  border-radius: 12px;
}
.info-box b { font-family: var(--font-display); font-weight: 400; color: var(--ink); }
.info-box.warn { background: var(--red-l); color: var(--red-d); }

.confirm-body .big-emoji { font-size: 46px; display: block; margin-bottom: 6px; animation: popIn .4s var(--bounce); }
.confirm-body h3 { font-family: var(--font-display); font-weight: 400; font-size: 21px; margin-bottom: 6px; }
.confirm-body p { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }
.confirm-body .form-actions { justify-content: center; }
.confirm-body .btn { min-width: 110px; }

.pending-top { display: flex; justify-content: flex-end; margin-bottom: 12px; }

/* ---------- 토스트 ---------- */
#toast-root {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
  width: min(460px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: 100%;
  padding: 11px 16px;
  font-size: 14.5px;
  background: var(--paper);
  border: 2.5px solid var(--edge);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--edge);
  animation: toastIn .35s var(--bounce);
}
.toast.warn { background: var(--red-l); }
.toast.plan { background: var(--plan-l); }
.toast.ok { background: var(--green-l); }
.toast.out { animation: toastOut .3s ease forwards; }
.toast-icon { font-size: 20px; flex: none; }

/* ---------- 애니메이션 ---------- */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes dropIn { 0% { transform: translateY(-12px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes viewIn { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes slideNext { 0% { transform: translateX(28px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes slidePrev { 0% { transform: translateX(-28px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes toastIn { 0% { transform: translateY(16px) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(10px) scale(.95); opacity: 0; } }

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

/* ---------- 모바일 ---------- */
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .app { padding: 14px 16px calc(100px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 14px; }
  .brand-icon { width: 46px; height: 46px; font-size: 27px; border-radius: 15px; }
  .brand-text h1 { font-size: 25px; }
  .brand-text p { font-size: 12px; }

  .tabs {
    position: fixed; z-index: 50;
    left: 16px; right: 16px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .tab { flex: 1; padding: 11px 10px; font-size: 17px; }

  .panel { padding: 12px 10px; border-radius: 22px; }
  .cal-head { gap: 6px; margin-bottom: 10px; }
  .month-title { font-size: 21px; }
  .icon-btn { width: 36px; height: 36px; }
  .pill-btn { padding: 6px 11px; font-size: 14px; }
  .weekdays, .cal-grid { gap: 3px; }
  .weekdays { font-size: 12.5px; }

  .cell { min-height: 66px; padding: 3px; gap: 2px; border-radius: 10px; border-width: 1.5px; }
  .cell:hover { transform: none; box-shadow: none; }
  .cell-day { font-size: 13px; line-height: 19px; padding: 0 3px; }
  .cell.is-today .cell-day { padding: 0 6px; }
  .cell.is-today::after { display: none; }
  .cell-chips { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .chip { padding: 0 2px; font-size: 12.5px; line-height: 17px; border-radius: 6px; border-width: 1px; }
  .chip-t { display: none; }
  .chip.more { font-size: 11px; padding: 0 3px; }

  .banner { padding: 10px 12px; gap: 10px; }
  .banner-icon { font-size: 24px; }
  .banner-text b { font-size: 15px; }
  .banner-text small { font-size: 12px; }
  .banner-go { padding: 5px 10px; font-size: 13px; }

  .pantry-top { flex-wrap: wrap; }
  .pantry-top .seg { max-width: none; flex-basis: 100%; }
  .pantry-top .btn { width: 100%; margin-left: 0; }
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .item-card { padding: 14px 8px 10px; }
  .item-icon { width: 54px; height: 54px; font-size: 31px; }
  .item-name { font-size: 15.5px; }
  .stock { gap: 6px; }
  .stock-num { min-width: 46px; }
  .stock-num b { font-size: 26px; }

  /* 바텀시트 */
  .overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    max-height: 92vh; max-height: 92dvh;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.2, 1.1, .4, 1);
  }
  .overlay.hide .modal { transform: translateY(100%); }
  .confirm-modal { width: 100%; }
  .sheet-handle { display: block; width: 46px; height: 5px; margin: 0 auto 12px; background: var(--line); border-radius: 999px; }
  .modal-head { gap: 12px; margin-bottom: 14px; }
  .date-tile { width: 58px; }
  .date-tile b { font-size: 25px; }
  .head-text h3 { font-size: 20px; }
  .day-form { padding: 12px; }
  .inv { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); max-height: 200px; }
  .entry { padding: 8px; gap: 8px; }
  .entry-icon { width: 36px; height: 36px; font-size: 21px; }

  #toast-root { bottom: calc(92px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .brand-text p { display: none; }
  .entry { flex-wrap: wrap; }
  .entry-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- 오늘: 먹음 / 먹을 예정 ---------- */
.status-seg .seg-btn.is-on[data-status="eaten"] { background: var(--green-d); }
.status-seg .seg-btn.is-on[data-status="planned"] { background: var(--plan-d); }
.status-seg .seg-btn small { font-family: var(--font-body); font-size: 11.5px; opacity: .8; }

/* ---------- 날짜 창: 새 품목 바로 등록 슬롯 ---------- */
.slot-add { border-style: dashed; border-color: var(--ink-3); background: transparent; color: var(--ink-2); }
.slot-add .slot-icon { font-family: var(--font-display); font-size: 24px; color: var(--orange-d); }
.slot-add .slot-badge { background: var(--orange-l); color: var(--orange-d); }
.slot-add:hover { border-color: var(--orange); background: #fff; }

/* ---------- 달력 칸에서 바로 삭제 ---------- */
.cell { cursor: pointer; }
.chip { position: relative; transition: opacity .16s, transform .16s; }
.chip.is-removing { opacity: 0; transform: scale(.85); }
.chip-del { display: none; }
@media (hover: hover) and (min-width: 721px) {
  .chip:not(.more):hover { filter: brightness(.97); border-color: currentColor; }
  .chip:hover .chip-del,
  .chip:focus-within .chip-del {
    display: grid; place-items: center;
    flex: none;
    width: 16px; height: 16px;
    margin-left: auto;
    font-size: 9px; line-height: 1;
    color: #fff;
    background: var(--red);
    border-radius: 50%;
    animation: popIn .18s var(--bounce);
  }
  .chip-del:hover { background: var(--red-d); transform: scale(1.15); }
}
