:root {
  --bg: #eef7f2;
  --surface: #ffffff;
  --surface-soft: #f7fbf8;
  --ink: #17221d;
  --muted: #6b7771;
  --line: #d9e5df;
  --forest: #24724f;
  --forest-dark: #14563b;
  --mint: #dff3e9;
  --mint-strong: #bfe7d3;
  --steel: #dde5e6;
  --steel-dark: #202522;
  --amber: #f0a63a;
  --amber-soft: #fff1d7;
  --red: #d95240;
  --red-soft: #ffe8e4;
  --shadow: 0 18px 46px rgba(25, 52, 39, 0.16);
  font-family: "Pretendard", "Noto Sans KR", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, #dff2e8 0, #f7fbf8 260px, #eef7f2 100%),
    var(--bg);
}

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

button {
  border: 0;
  cursor: pointer;
}

.phone-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 198px;
}

.hero {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.hero-copy p,
.section-kicker {
  margin: 0 0 3px;
  color: var(--forest-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.hero h1,
.card-title h2,
.sheet-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.hero h1 {
  font-size: 28px;
  line-height: 1.05;
}

.chip-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chip strong {
  color: var(--ink);
}

.chip.warning {
  border-color: #f5d391;
  background: var(--amber-soft);
}

.chip.danger {
  border-color: #f3b8af;
  background: var(--red-soft);
}

.today-card,
.fridge-card,
.inventory-card {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 229, 223, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 32px rgba(25, 52, 39, 0.09);
}

.card-title,
.sheet-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  margin-bottom: 12px;
}

.card-title h2,
.sheet-header h2 {
  font-size: 18px;
  line-height: 1.2;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
}

.alert-list {
  display: grid;
  gap: 8px;
}

.alert-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.food-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--mint);
  font-size: 20px;
}

.food-avatar > img,
.food-card .food-avatar > img,
.mini-food .food-avatar > img,
.alert-row .food-avatar > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.alert-row strong,
.mini-food strong,
.food-card strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-row span,
.mini-food span,
.food-card span,
.selected-card span,
.sheet-header p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e7f4ed;
  color: var(--forest-dark);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.soon {
  background: var(--amber-soft);
  color: #80520c;
}

.status-pill.review {
  background: #e7f0ff;
  color: #315c91;
}

.status-pill.expired {
  background: var(--red-soft);
  color: #a83127;
}

.fridge-title {
  align-items: flex-end;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 132px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf5f1;
}

.segment {
  min-height: 30px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.segment.active {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 6px 14px rgba(36, 114, 79, 0.25);
}

.fridge-map {
  position: relative;
  display: block;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(35, 43, 39, 0.18);
  border-radius: 18px;
  background-color: #edf2f1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 12px 26px rgba(21, 35, 29, 0.13);
  overflow: hidden;
}

.fridge-map.fridge-view {
  aspect-ratio: 0.98;
  background-image: url("./assets/fridge-interior-cropped.png");
  background-position: center top;
}

.fridge-map.freezer-view {
  aspect-ratio: 1.2;
  background-image: url("./assets/freezer-interior.png");
}

.fridge-map::before {
  content: none;
}

.zone {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: #1d2b25;
  text-align: center;
  box-shadow: none;
}

.zone span {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 4px 10px rgba(20, 31, 26, 0.09);
  overflow-wrap: anywhere;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
}

.zone:hover,
.zone:focus-visible {
  outline: none;
  border-color: rgba(36, 114, 79, 0.42);
  background: rgba(223, 243, 233, 0.24);
}

.zone.selected {
  border-color: var(--forest-dark);
  background: rgba(189, 232, 210, 0.45);
  box-shadow: 0 0 0 3px rgba(36, 114, 79, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(0.5px);
}

.zone.selected span {
  background: rgba(36, 114, 79, 0.92);
  color: #fff;
}

.zone.has-food::after {
  content: attr(data-count);
  position: absolute;
  top: -6px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--forest);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.zone.left-door-1 { left: 8%; top: 25%; width: 16%; height: 18%; }
.zone.left-door-2 { left: 8%; top: 49%; width: 16%; height: 17%; }
.zone.left-door-3 { left: 8%; top: 71%; width: 16%; height: 17%; }
.zone.right-door-1 { left: 76%; top: 25%; width: 16%; height: 18%; }
.zone.right-door-2 { left: 76%; top: 49%; width: 16%; height: 17%; }
.zone.right-door-3 { left: 76%; top: 71%; width: 16%; height: 17%; }
.zone.shelf-1 { left: 29%; top: 14%; width: 42%; height: 15%; }
.zone.shelf-2 { left: 28%; top: 31%; width: 44%; height: 17%; }
.zone.shelf-3 { left: 28%; top: 51%; width: 44%; height: 16%; }
.zone.veg-left { left: 28%; top: 70%; width: 21%; height: 20%; }
.zone.veg-right { left: 51%; top: 70%; width: 21%; height: 20%; }

.zone.freezer-door-left-1 { left: 9%; top: 28%; width: 14%; height: 18%; }
.zone.freezer-door-left-2 { left: 9%; top: 48%; width: 14%; height: 18%; }
.zone.freezer-door-left-3 { left: 9%; top: 68%; width: 14%; height: 18%; }
.zone.freezer-door-right-1 { left: 77%; top: 28%; width: 14%; height: 18%; }
.zone.freezer-door-right-2 { left: 77%; top: 48%; width: 14%; height: 18%; }
.zone.freezer-door-right-3 { left: 77%; top: 68%; width: 14%; height: 18%; }
.zone.freezer-left-1 { left: 29%; top: 21%; width: 20%; height: 21%; }
.zone.freezer-left-2 { left: 29%; top: 43%; width: 20%; height: 21%; }
.zone.freezer-left-3 { left: 29%; top: 65%; width: 20%; height: 21%; }
.zone.freezer-right-1 { left: 51%; top: 21%; width: 20%; height: 21%; }
.zone.freezer-right-2 { left: 51%; top: 43%; width: 20%; height: 21%; }
.zone.freezer-right-3 { left: 51%; top: 65%; width: 20%; height: 21%; }

.selected-card {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.selected-card strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.primary-action,
.secondary-action,
.text-button {
  min-height: 44px;
  border-radius: 11px;
  font-weight: 900;
}

.primary-action {
  border: 1px solid var(--forest-dark);
  background: var(--forest);
  color: #fff;
  box-shadow: 0 9px 18px rgba(36, 114, 79, 0.22);
}

.primary-action.compact {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary-action.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.text-button {
  min-height: 32px;
  padding: 0;
  background: transparent;
  color: var(--forest-dark);
  font-size: 13px;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 8px;
  margin-bottom: 10px;
}

.field,
.filter-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.field em {
  color: #8b9891;
  font-style: normal;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(36, 114, 79, 0.14);
}

.inventory-list {
  display: grid;
  gap: 8px;
}

.food-card,
.mini-food {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.food-card {
  min-height: 58px;
}

.food-actions {
  display: flex;
  gap: 6px;
}

.food-actions button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  background: #edf5f1;
  color: var(--forest-dark);
  font-size: 12px;
  font-weight: 900;
}

.food-actions .delete {
  background: var(--red-soft);
  color: #a83127;
}

.empty-list {
  padding: 18px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(11, 18, 15, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.sheet-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  right: 50%;
  bottom: 0;
  z-index: 30;
  width: min(430px, 100%);
  max-height: calc(100vh - 28px);
  padding: 8px 14px calc(12px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -16px 42px rgba(22, 43, 34, 0.22);
  transform: translate(50%, calc(100% + 12px));
  transition: transform 220ms ease;
}

.bottom-sheet.open {
  transform: translate(50%, 0);
}

.location-sheet {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.add-sheet {
  overflow-y: auto;
}

.list-sheet {
  display: flex;
  flex-direction: column;
  height: min(86vh, 760px);
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: #d3ded8;
}

.sheet-header {
  margin-bottom: 9px;
}

.sheet-header p {
  margin: 4px 0 0;
}

.mini-food-list {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.list-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf5f1;
}

.list-tab {
  min-width: 0;
  min-height: 32px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.list-tab.active {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 6px 14px rgba(36, 114, 79, 0.2);
}

.sheet-filter {
  flex: 0 0 auto;
}

.full-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}

.media-picker {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.thumb-preview {
  display: grid;
  place-items: center;
  min-height: 112px;
  overflow: hidden;
  border: 1px dashed #b9cbc2;
  border-radius: 14px;
  background: #f3faf6;
  color: var(--muted);
}

.thumb-preview span {
  font-size: 38px;
  line-height: 1;
}

.thumb-preview img {
  width: 100%;
  height: 112px;
  object-fit: cover;
  object-position: center center;
}

.thumb-preview strong {
  margin-top: 4px;
  font-size: 13px;
}

.media-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.icon-option {
  display: grid;
  place-items: center;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 18px;
}

.icon-option.active {
  border-color: var(--forest);
  background: var(--mint);
  box-shadow: 0 0 0 2px rgba(36, 114, 79, 0.12);
}

form {
  display: grid;
  gap: 10px;
}

.field-pair {
  display: grid;
  grid-template-columns: 0.86fr 1fr;
  gap: 8px;
}

.submit {
  width: 100%;
  margin-top: 2px;
}

@media (min-width: 720px) {
  body {
    display: grid;
    place-items: start center;
  }

  .phone-shell {
    min-height: auto;
  }
}

@media (max-width: 370px) {
  .phone-shell {
    padding-inline: 10px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .chip-row {
    width: 100%;
    justify-content: stretch;
  }

  .chip {
    flex: 1;
    justify-content: center;
  }

  .fridge-map {
    min-height: 286px;
    padding: 10px;
  }

  .zone span {
    font-size: 10px;
  }
}
