:root {
  --ink: #52645f;
  --muted: #87938a;
  --cream: #fbf8f1;
  --line: #e7dfd2;
  --sage: #dfeae0;
  --accent: #91b5a4;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: radial-gradient(circle at 12% 8%, #f8eae3 0, transparent 27%), linear-gradient(135deg,#f5f2eb,#eaf2ec);
  min-height: 100vh;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.header {
  max-width: 1180px; margin: 0 auto; padding: 24px 28px 8px;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.header h1 { margin: 0; font-size: clamp(25px,3vw,34px); letter-spacing: .08em; color: #667c70; }
.brand-mark { position: absolute; left: 30px; color: #a7bca9; font-size: 30px; }
#settingsBtn {
  position: absolute; right: 30px; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid #d9e2d9; background: #fffdf8; color: #75877b; font-size: 23px;
  box-shadow: 0 3px 0 #e0e7df;
}
.container {
  max-width: 1180px; margin: 0 auto; padding: 12px 28px 38px;
  display: grid; grid-template-columns: minmax(0,1.35fr) minmax(330px,.85fr);
  gap: 24px; align-items: center;
}
.fridge-area { min-width: 0; text-align: center; }
.intro-copy { margin: 10px 0 0; }
.eyebrow { margin: 0 0 6px; color: #a2ad9f; font-size: 11px; font-weight: 700; letter-spacing: .18em; }
.intro-copy h2 { margin: 0 0 8px; font-size: 25px; color: #64786d; }
.intro-copy > p:last-child { margin: 0; color: var(--muted); font-size: 15px; }
.fridge-scene { width: 100%; max-width: 760px; margin: 0 auto; position: relative; }
.fridge-art { display: block; width: 100%; height: auto; }
.fridge-hotspots {
  /* SVG viewBox 1200×920；對齊冰箱五個實際抽屜範圍 x=371..779、y=84..776 */
  position: absolute; left: 30.92%; top: 9.13%; width: 34%; height: 75.22%;
  display: flex; flex-direction: column; gap: 1.6%; padding: 0;
}
.fridge-zone {
  min-height: 0; border: 2px solid transparent; border-radius: 12px;
  background: rgba(255,255,255,.12); color: #52645f;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-weight: 700; font-size: clamp(12px,1.55vw,18px);
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
  text-shadow: 0 1px 5px rgba(255,255,255,.9);
}
.fridge-zone small { font-size: .78em; font-weight: 500; color: #7e9187; }
.fridge-zone:hover, .fridge-zone:focus-visible {
  outline: none; background: rgba(255,255,255,.68); border-color: #91b5a4;
  box-shadow: 0 0 0 3px rgba(145,181,164,.2); transform: scale(1.015);
}
.top-zone { flex: 2.15; }
.middle-small-zones { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 2%; min-height: 0; }
.middle-small-zones .fridge-zone { font-size: clamp(10px,1.25vw,15px); }
.middle-zone { flex: .83; }
.bottom-zone { flex: .68; }
.scene-caption { margin: -5px 0 0; color: #8d9b91; font-size: 13px; }
.items-area {
  align-self: center; width: 100%; min-height: 360px; padding: 25px;
  border: 1px solid #e8e0d4; border-radius: 24px; background: rgba(255,253,248,.94);
  box-shadow: 0 12px 35px rgba(104,123,110,.09);
}
.list-heading { display: flex; gap: 13px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid #eee8de; }
.heading-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #edf3e9; color: #8eae98; font-size: 24px; }
.items-area h2 { margin: 0; color: #64786d; font-size: 22px; }
.list-hint { color: #9aa49b; font-size: 14px; line-height: 1.8; padding: 18px 2px; }
.add-item-button {
  width: 100%; padding: 14px; margin: 16px 0 10px; border: 0; border-radius: 13px;
  background: #e2eee4; color: #4f7160; font-size: 17px; font-weight: 700;
}
.add-item-button:hover { background: #d5e7d9; }
.add-item-button[hidden], #itemForm[hidden], .cancel-button[hidden] { display: none !important; }
#itemForm { margin: 14px 0; padding: 18px; border-radius: 16px; background: #f8f5ee; border: 1px solid #ebe3d7; }
#itemForm h3 { margin: 0 0 12px; font-size: 18px; color: #62786b; }
#itemForm label { display: block; margin: 12px 0 5px; font-size: 15px; font-weight: 600; color: #69786d; }
#itemForm input, #itemForm textarea {
  width: 100%; padding: 12px; border: 1px solid #ddd9ce; border-radius: 9px;
  background: #fffefa; color: #4d5d54; font-size: 16px;
}
#itemForm textarea { min-height: 78px; resize: vertical; }
.save-button { margin-top: 16px; padding: 12px 18px; border: 0; border-radius: 10px; background: #91b5a4; color: white; font-weight: 700; }
.cancel-button { margin: 16px 0 0 8px; padding: 11px 16px; border: 1px solid #dcd7cd; border-radius: 9px; background: #fffefa; color: #68766d; }
.item-list { list-style: none; padding: 0; margin: 12px 0; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 8px; border-bottom: 1px solid #eee8de; }
.item-main { min-width: 0; flex: 1; }
.item-name { font-size: 17px; font-weight: 700; color: #4f5d53; overflow-wrap: anywhere; }
.item-summary { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 6px; font-size: 13px; color: #858e84; }
.item-actions { display: flex; flex-shrink: 0; gap: 6px; }
.item-actions button { padding: 8px 11px; border: 1px solid #e1ddd4; border-radius: 8px; background: #fffefa; color: #627166; font-size: 14px; }
.item-actions button:hover { background: #edf3e9; }
.expiry-status { display: inline-block; width: fit-content; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.expiry-status.expired { color: #a52727; background: #ffe0dc; }
.expiry-status.expiring-soon { color: #a64b16; background: #ffead8; }
.expiry-status.expiring-warning { color: #866000; background: #fff2bd; }
.expiry-status.expiry-normal { color: #77736b; background: #f1efe9; }
.item-row.expired { background-color: #ffe1df; border-radius: 10px; }
.item-row.expiring-soon { background-color: #ffead8; border-radius: 10px; }
.item-row.expiring-warning { background-color: #fff4cc; border-radius: 10px; }
.items-area > #itemsList > p { color: #929c92; line-height: 1.8; }
.footer-note { padding: 8px 16px 25px; text-align: center; color: #a0aaa0; font-size: 12px; letter-spacing: .06em; }
@media (max-width: 820px) {
  .container { grid-template-columns: 1fr; gap: 12px; padding: 8px 16px 28px; }
  .fridge-scene { max-width: 650px; }
  .fridge-hotspots { left: 30.92%; width: 34%; }
  .fridge-zone { font-size: clamp(12px,2.4vw,17px); }
  .middle-small-zones .fridge-zone { font-size: clamp(10px,2vw,14px); }
  .items-area { max-width: 650px; margin: 0 auto; min-height: 220px; }
}
@media (max-width: 480px) {
  .header { padding: 18px 60px 8px; }
  .header h1 { font-size: 22px; white-space: nowrap; }
  .brand-mark { left: 16px; }
  #settingsBtn { right: 14px; width: 42px; height: 42px; }
  .container { padding: 5px 10px 24px; }
  .intro-copy h2 { font-size: 21px; }
  .intro-copy > p:last-child { font-size: 13px; }
  .fridge-hotspots { gap: 1.4%; }
  .fridge-zone { border-radius: 7px; font-size: 11px; gap: 1px; }
  .fridge-zone small { font-size: 10px; }
  .middle-small-zones .fridge-zone { font-size: 9px; }
  .items-area { padding: 18px 15px; border-radius: 18px; }
  .item-row { gap: 6px; }
  .item-actions { gap: 4px; }
  .item-actions button { padding: 8px; font-size: 12px; }
}
