:root {
  --fridge: #E3EEEB;
  --fridge-deep: #CFE0DB;
  --ink: #13292B;
  --mute: #4E6668;
  --paper: #FFFFFF;
  --butter: #FFE680;
  --chili: #D8382A;
  --chili-dark: #B52B1F;
  --pandan: #1F6B4B;
  --radius: 14px;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fridge);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--chili); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Header */
.top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  max-width: 1120px; margin: 0 auto; padding: 1.25rem 1.25rem 0;
}
.brand {
  font: 800 1.5rem/1 var(--font-display);
  color: var(--ink); text-decoration: none; letter-spacing: -0.02em;
}
.brand-note { color: var(--mute); font-size: 0.875rem; }

main { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem 3rem; }

/* Intro */
.intro { padding: 2.5rem 0 1.5rem; max-width: 40rem; }
.intro h1 { font-size: clamp(2.25rem, 6vw, 4rem); font-weight: 800; letter-spacing: -0.03em; }
.intro p { margin-top: 0.9rem; font-size: 1.125rem; color: var(--mute); max-width: 34rem; }

/* Status */
.status:empty { display: none; }
.status {
  margin-bottom: 1rem; padding: 0.8rem 1rem;
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--butter); font-weight: 500;
}
.status.error { background: #FFD9D4; border-color: var(--chili-dark); }

/* Workspace */
.workspace { display: grid; gap: 1.25rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1.75rem; }
}

.door {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 22px;
  padding: 0.9rem;
  position: relative;
}
/* gagang pintu kulkas */
.door::after {
  content: ""; position: absolute; top: 1.6rem; right: -9px;
  width: 8px; height: 4.5rem; border-radius: 0 6px 6px 0;
  background: var(--ink);
}
@media (max-width: 899px) { .door::after { display: none; } }

.drop {
  border: 2px dashed var(--ink); border-radius: var(--radius);
  background: var(--fridge);
  min-height: 21rem; padding: 2rem 1.25rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 0.5rem;
  transition: background-color 0.15s;
}
.drop.over { background: var(--butter); }
.drop-title { font: 800 1.75rem/1.1 var(--font-display); letter-spacing: -0.02em; }
.drop-sub { color: var(--mute); max-width: 24rem; }
.drop-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-top: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.55rem 1.25rem;
  font: 600 1rem var(--font-body);
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer; text-decoration: none;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { background: var(--butter); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { background: var(--chili); color: #fff; }
.btn-primary:hover { background: var(--chili-dark); }
.btn-small { min-height: 2.25rem; padding: 0.3rem 1rem; font-size: 0.9rem; margin-top: 0.8rem; }
input[type="file"]:focus-visible + .btn { outline: 3px solid var(--chili); outline-offset: 2px; }

.photo { position: relative; }
.photo canvas { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--fridge); }
.loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  background: rgba(227, 238, 235, 0.88); border-radius: var(--radius);
  font: 800 1.25rem var(--font-display);
}
.spinner {
  width: 1.4rem; height: 1.4rem; border-radius: 50%;
  border: 3px solid var(--ink); border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shelf: bahan sebagai magnet */
.shelf {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 22px; padding: 1.25rem;
}
.shelf h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.hint { color: var(--mute); font-size: 0.875rem; margin-top: 0.4rem; }
.magnets { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 2.5rem; }
.magnets:empty::before { content: "Belum ada bahan."; color: var(--mute); font-size: 0.9rem; }

.magnet {
  display: inline-flex; align-items: center; gap: 0.15rem;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--fridge); padding: 0.15rem 0.2rem 0.15rem 0.35rem;
  font-weight: 600;
}
.magnet:hover, .magnet:focus-within { background: var(--butter); }
.magnet .dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 2px solid var(--ink); margin-right: 0.4rem; flex: none; }
.magnet .count { color: var(--mute); font-weight: 500; font-size: 0.85rem; margin-left: 0.35rem; }
.magnet button {
  width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%; background: transparent;
  font: 700 1.1rem/1 var(--font-body); color: var(--ink); cursor: pointer; margin-left: 0.2rem;
}
.magnet button:hover { background: var(--chili); color: #fff; }

.add { margin-top: 1.1rem; display: grid; gap: 0.35rem; }
.add label, .field label { font-weight: 600; font-size: 0.9rem; }
select {
  min-height: 2.75rem; padding: 0 0.75rem;
  font: 500 1rem var(--font-body); color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 10px;
}

.settings { margin-top: 1.25rem; border-top: 2px solid var(--fridge-deep); padding-top: 0.9rem; }
.settings summary { cursor: pointer; font-weight: 600; min-height: 2rem; }
.field { margin-top: 0.9rem; }
.field label { display: flex; justify-content: space-between; gap: 1rem; }
.field output { font-variant-numeric: tabular-nums; color: var(--mute); }
input[type="range"] { width: 100%; accent-color: var(--chili); margin-top: 0.4rem; }

/* Resep */
.recipes { margin-top: 3rem; }
.recipes > h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -0.03em; }
.group { margin-top: 1.75rem; }
.group > h3 { font-size: 1.25rem; font-weight: 800; display: flex; align-items: baseline; gap: 0.6rem; }
.group > h3 span { font: 500 0.95rem var(--font-body); color: var(--mute); }
.cards { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }

.note {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink); border-radius: 6px 6px 14px 6px;
  padding: 1.6rem 1.1rem 1rem;
  box-shadow: 4px 5px 0 var(--ink);
}
.note.ready { background: var(--butter); }
.note::before { /* magnet penahan catatan */
  content: ""; position: absolute; top: -0.7rem; left: 1.1rem;
  width: 1.3rem; height: 1.3rem; border-radius: 50%;
  background: var(--chili); border: 2px solid var(--ink);
}
.note h4 { font: 800 1.3rem/1.15 var(--font-display); letter-spacing: -0.01em; margin: 0; }
.match { margin-top: 0.3rem; font-size: 0.875rem; font-weight: 600; color: var(--pandan); }
.note:not(.ready) .match { color: var(--chili-dark); }

.needs { list-style: none; padding: 0; margin: 0.8rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.needs li { font-size: 0.875rem; font-weight: 600; padding: 0.1rem 0.6rem; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); }
.needs li.have { background: var(--pandan); color: #fff; border-color: var(--pandan); }
.needs li.miss { background: transparent; border-style: dashed; color: var(--chili-dark); border-color: var(--chili-dark); }

.note details { margin-top: 0.9rem; border-top: 2px solid var(--ink); padding-top: 0.6rem; }
.note summary { cursor: pointer; font-weight: 600; min-height: 2rem; }
.note .detail { margin-top: 0.5rem; font-size: 0.95rem; }
.note .detail p { margin-top: 0.4rem; }
.note ol { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.note ol li { margin-top: 0.3rem; }

.empty { margin-top: 1.25rem; padding: 1.25rem; border: 2px dashed var(--ink); border-radius: var(--radius); max-width: 36rem; }

.foot { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; color: var(--mute); font-size: 0.875rem; border-top: 2px solid var(--fridge-deep); }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .btn, .drop { transition: none; }
}
