:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --soft: #f1eae1;
  --text: #2b2622;
  --muted: #8a8178;
  --accent: #a8735a;
  --radius: 18px;
  --tabs-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--soft); }

#app { padding: 16px; max-width: 640px; margin: 0 auto; }

.brand { text-align: center; margin: 4px 0 18px; }
.brand small { display: block; color: var(--accent); letter-spacing: .08em; font-size: 12px; text-transform: uppercase; }
.brand b { font-size: 24px; letter-spacing: .02em; }

h1 { font-size: 26px; line-height: 1.2; margin: 6px 0 4px; }
h2 { font-size: 20px; margin: 26px 0 12px; }
.crumbs { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

.hello {
  background: var(--soft); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
}
.hello b { font-size: 18px; }
.hello div { color: var(--muted); font-size: 14px; }

.search {
  position: sticky; top: 8px; z-index: 5; box-shadow: 0 -8px 0 8px var(--bg);
  display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 999px;
  padding: 0 16px; margin: 0 0 14px;
}
.search input {
  flex: 1; border: 0; background: transparent; font: inherit; padding: 13px 0; outline: none; color: var(--text);
}

.tile {
  position: relative; display: block; border-radius: var(--radius); overflow: hidden; background: var(--soft);
  aspect-ratio: 1 / 1;
}
.tile.wide { aspect-ratio: 16 / 9; margin-bottom: 12px; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.55)); }
.tile .label {
  position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; color: #fff;
  font-weight: 800; font-size: 20px; line-height: 1.15; text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.tile.wide .label { font-size: 28px; }
.tile .label small { display: block; font-weight: 500; font-size: 13px; opacity: .9; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.card { display: block; background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(43,38,34,.06); }
.card .photo { aspect-ratio: 4 / 3; }
.card .body { padding: 12px 16px 16px; }
.card .title { font-weight: 700; font-size: 17px; line-height: 1.25; }
.card .intro { color: var(--muted); font-size: 14px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.row { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 14px; padding: 8px; margin-bottom: 10px; }
.row .thumb { width: 72px; height: 72px; flex: none; border-radius: 10px; overflow: hidden; }
.row .title { font-weight: 600; line-height: 1.25; }
.row .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery figure { position: relative; flex: none; width: 86%; margin: 0; scroll-snap-align: center; }
.gallery figure:only-child { width: 100%; }
.gallery img, .gallery video { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); background: #000; }
.set-cover, .cover-badge {
  position: absolute; left: 12px; bottom: 12px; border: 0; border-radius: 999px; padding: 8px 14px;
  font: inherit; font-size: 14px; font-weight: 600; background: rgba(31,27,24,.78); color: #fff;
}
.cover-badge { background: var(--accent); }

.recipe-head { display: flex; align-items: flex-start; gap: 12px; }
.recipe-head h1 { flex: 1; }
.fav {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--soft);
  font-size: 22px; color: var(--accent); margin-top: 4px;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.tags span { background: var(--soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 13px; }

.recipe p { margin: 0 0 10px; }
.recipe h3 { font-size: 18px; margin: 22px 0 10px; }
.recipe ul { list-style: none; padding: 0; margin: 0 0 10px; background: var(--card); border-radius: 14px; }
.recipe ul li { padding: 10px 14px; border-bottom: 1px solid var(--soft); }
.recipe ul li:last-child { border-bottom: 0; }
.recipe ol { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.recipe ol li { position: relative; padding: 0 0 14px 42px; }
.recipe ol li::before {
  counter-increment: step; content: counter(step); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 14px; display: grid; place-items: center;
}

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.notice { text-align: center; padding: 48px 12px; }
.notice .big { font-size: 48px; }
.btn {
  display: inline-block; margin-top: 18px; background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 13px 26px; font: inherit; font-weight: 600;
}

.tabs {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 616px; margin: 0 auto; height: var(--tabs-h); display: flex; background: #1f1b18;
  border-radius: 999px; padding: 6px; z-index: 10;
}
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #f3ede6; font-size: 11px; border-radius: 999px; }
.tabs a span { font-size: 19px; line-height: 1.1; }
.tabs a.active { color: #e6a988; }

.loader { width: 34px; height: 34px; margin: 120px auto; border-radius: 50%; border: 3px solid var(--soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs[hidden] { display: none; }
.section-cover {
  display: block; width: 100%; margin: -6px 0 14px; padding: 10px 14px; border: 1px dashed var(--accent);
  border-radius: 12px; background: transparent; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; text-align: left;
}
.section-cover.is-set { border-style: solid; background: var(--soft); }
.tile-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; background: var(--soft); }
.tile-emoji.small { font-size: 32px; }
.recipe a { color: var(--accent); text-decoration: underline; }
.file {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 10px; padding: 12px 14px; border: 0;
  border-radius: 14px; background: var(--card); font: inherit; color: var(--text); text-align: left;
  box-shadow: 0 1px 2px rgba(43,38,34,.06);
}
.file-icon { font-size: 28px; }
.file b { display: block; font-weight: 600; line-height: 1.25; }
.file small { color: var(--accent); font-weight: 600; }
.card .photo { display: block; }
.card a.title { display: block; }
.card-files { margin-top: 12px; }
.card-files .file { background: var(--soft); box-shadow: none; }
[hidden] { display: none !important; }
