:root {
  --bg: #fbf6ee; --paper: #fffdf8; --ink: #2d2420; --muted: #8a7b70; --line: #eadfd1;
  --accent: #c2562f; --accent-dark: #a2441f; --soft: #f5e6d6; --green: #5f7f4f;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, sans-serif;
  --r: 14px; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 6px 20px rgba(60,40,20,.07);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; margin: 0; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; color: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 14px; }
label input, label textarea { margin-top: 6px; font-weight: 400; }
label small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.error { color: #b3261e; font-size: 14px; min-height: 1em; margin: 0 0 8px; }

.primary { background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; transition: background .15s; }
.primary:hover { background: var(--accent-dark); }
.primary:disabled { opacity: .6; cursor: wait; }
.ghost { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-weight: 500; }
.ghost:hover { border-color: var(--accent); }
.danger { color: #b3261e; }
.link { color: var(--accent); font-weight: 600; padding: 0; }
.link:hover { text-decoration: underline; }

/* sign in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 20% 10%, #f6dcc4 0, transparent 40%), radial-gradient(circle at 85% 90%, #e5ecd8 0, transparent 40%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--paper); padding: 36px 32px; border-radius: 20px; box-shadow: var(--shadow); text-align: center; }
.auth-card form { text-align: left; margin-top: 22px; }
.auth-card .primary { width: 100%; padding: 12px; }
.logo { font-size: 44px; }
.switch { margin: 18px 0 0; font-size: 14px; color: var(--muted); }

/* top */
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { font-family: var(--serif); font-weight: 700; font-size: 18px; }
.who { font-size: 14px; color: var(--muted); }
.who .link { margin-left: 10px; }

.hero { max-width: 760px; margin: 0 auto; padding: 44px 20px 18px; text-align: center; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); margin-bottom: 20px; }
.modes { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.mode { padding: 8px 18px; border-radius: 999px; font-weight: 500; color: var(--muted); }
.mode.active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.search { display: flex; gap: 8px; background: var(--paper); padding: 6px; border-radius: 999px; box-shadow: var(--shadow); }
.search input { border: 0; border-radius: 999px; padding: 12px 18px; font-size: 16px; }
.search input:focus { outline: none; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chip { font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); }
.chip:hover { color: var(--accent); border-color: var(--accent); }

.tabs { max-width: 1160px; margin: 18px auto 0; padding: 0 20px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.tab.active { background: var(--ink); color: #fff; }
.spacer { flex: 1; }
.results-head { max-width: 1160px; margin: 14px auto 0; padding: 0 20px; display: flex; gap: 14px; align-items: baseline; color: var(--muted); }
.results-head b { color: var(--ink); }

.grid { max-width: 1160px; margin: 0 auto; padding: 18px 20px 60px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.card { background: var(--paper); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(60,40,20,.13); outline: none; }
.pic { position: relative; aspect-ratio: 4/3; background: var(--soft); }
.pic img, .view-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 56px; }
.ph0 { background: linear-gradient(135deg, #f7d9c0, #f0bfa0); } .ph1 { background: linear-gradient(135deg, #e3ead2, #c9d8b4); }
.ph2 { background: linear-gradient(135deg, #f6e5b8, #ecd08a); } .ph3 { background: linear-gradient(135deg, #f1d2d2, #e3b0b0); }
.ph4 { background: linear-gradient(135deg, #d9e2ec, #b9c9da); }
.heart { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.92); font-size: 19px; color: var(--accent); line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.12); transition: transform .12s; }
.heart:hover { transform: scale(1.1); }
.heart.on { background: var(--accent); color: #fff; }
.card .body { padding: 14px 16px 16px; }
.card h3 { font-size: 18px; line-height: 1.25; }
.why { margin: 6px 0 0; font-size: 13.5px; color: var(--green); font-style: italic; }
.meta { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: #7a5a44; }
.tag.pending { background: none; color: var(--muted); font-style: italic; padding-left: 0; }
.link-tag:hover { background: var(--accent); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 30px 20px 80px; font-size: 16px; }

.loading { grid-column: 1/-1; display: flex; justify-content: center; gap: 8px; padding: 50px; }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: bounce 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* dialogs */
.sheet { border: 0; padding: 0; border-radius: 20px; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.sheet::backdrop { background: rgba(45,36,32,.45); backdrop-filter: blur(2px); }
#edit { width: min(560px, calc(100vw - 24px)); }
#edit-form { padding: 22px 26px 24px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.x { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); font-size: 15px; }
.x.float { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.92); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }
.photo-pick { position: relative; display: grid; place-items: center; aspect-ratio: 16/7; border: 2px dashed var(--line); border-radius: var(--r); background: var(--bg); cursor: pointer; overflow: hidden; color: var(--muted); }
.photo-pick:hover { border-color: var(--accent); color: var(--accent); }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick.has span { position: absolute; bottom: 10px; right: 10px; background: rgba(255,255,255,.92); color: var(--ink); padding: 4px 10px; border-radius: 999px; font-size: 13px; }

.view-pic { position: relative; aspect-ratio: 16/8; background: var(--soft); }
.view-pic .ph { font-size: 90px; }
.view-main { padding: 22px 28px 30px; }
.view-main h2 { font-size: 30px; }
.desc { font-size: 16px; margin: 14px 0 0; }
.mood-note { margin: 10px 0 0; color: var(--green); font-style: italic; }
.view-actions { display: flex; gap: 8px; margin: 18px 0 4px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: 1fr 1.5fr; gap: 28px; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.cols h4 { font-family: var(--serif); font-size: 18px; margin: 0 0 8px; }
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { padding: 7px 0; border-bottom: 1px dotted var(--line); }
.steps { padding-left: 22px; margin: 0; }
.steps li { margin-bottom: 10px; padding-left: 4px; }
.steps li::marker { color: var(--accent); font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); z-index: 100; }

@media (max-width: 640px) {
  .top { padding: 12px 16px; }
  .who #me-name { display: none; }
  .hero { padding-top: 28px; }
  .tabs .primary { width: 100%; margin-top: 8px; }
  .cols { grid-template-columns: 1fr; }
  .view-main { padding: 18px 20px 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
}
