:root {
  --bg: #fbf6ef; --card: #ffffff; --ink: #2b211b; --muted: #75665b; --line: #eadfd2; --ember: #2f6f4f; --ember-soft: #e1efe6; --gold: #d98a14;
  --shadow: 0 1px 2px rgba(60, 35, 20, .06), 0 6px 18px rgba(60, 35, 20, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1613; --card: #251e1a; --ink: #f3e9df; --muted: #b6a596; --line: #3a2f28; --ember: #74c69d; --ember-soft: #1c3127; --gold: #f2b14a; --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--ember); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 9; background: var(--card); padding: 8px 12px; border-radius: 8px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand .logo { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.brand b { display: block; font-size: 1.1rem; letter-spacing: .2px; }
.brand small { display: block; color: var(--muted); font-size: .8rem; }
main { max-width: 1080px; margin: 0 auto; padding: 16px 16px 40px; outline: none; }
.hero { padding: 18px 0 8px; }
.hero h1 { font-size: clamp(1.7rem, 4.6vw, 2.5rem); line-height: 1.15; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0 0 14px; max-width: 60ch; }
.search { width: 100%; font: inherit; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: inherit; box-shadow: var(--shadow); }
.search:focus { outline: 3px solid color-mix(in srgb, var(--ember) 35%, transparent); border-color: var(--ember); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; font: inherit; font-size: .9rem; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ember); border-color: var(--ember); color: #fff; }
.count { color: var(--muted); font-size: .9rem; margin: 6px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s; }
.card:hover { transform: translateY(-2px); }
.card img, .card .noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.card .noimg { display: grid; place-items: center; font-size: 2.6rem; background: color-mix(in srgb, var(--gold) 14%, var(--card)); }
.card-body { padding: 9px 12px 12px; }
.card h2 { font-size: 1rem; line-height: 1.3; margin: 0 0 3px; }
.meta { color: var(--muted); font-size: .82rem; margin: 0; }
.rate { color: var(--gold); font-size: .85rem; margin: 2px 0 0; }
.loading, .empty { color: var(--muted); padding: 30px 0; text-align: center; }
.back { display: inline-block; margin: 4px 0 10px; text-decoration: none; }
.recipe { max-width: 760px; margin: 0 auto; }
.recipe h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); line-height: 1.15; margin: 6px 0 10px; }
.hero-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 18px; display: block; margin: 4px 0 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill { font-size: .88rem; padding: 4px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.pill.tag { color: var(--ember); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 650; border: 0; border-radius: 12px; padding: 10px 16px; background: var(--ember); color: #fff; cursor: pointer; text-decoration: none; }
.btn.ghost { background: var(--ember-soft); color: var(--ember); }
.btn.small { font-size: .88rem; padding: 7px 12px; }
.btn:disabled { opacity: .45; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 2px 0 10px; }
.scale { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.scale .lbl { color: var(--muted); font-size: .9rem; margin-right: 2px; }
.ing { list-style: none; padding: 0; margin: 0; }
.ing li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.ing li:last-child { border-bottom: 0; }
.ing li.sub { font-weight: 700; border-bottom: 0; padding-top: 12px; }
.ing label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ing input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--ember); flex: none; }
.ing input:checked + span, .ing label:has(input:checked) { color: var(--muted); text-decoration: line-through; }
.scaled { color: var(--ember); }
.note { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }
.steps { margin: 0; padding-left: 1.4em; }
.steps li { padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.steps li.cur { background: var(--ember-soft); }
.source p { margin: 0 0 12px; }
.foot { max-width: 760px; margin: 0 auto; padding: 10px 16px calc(30px + env(safe-area-inset-bottom)); color: var(--muted); font-size: .85rem; text-align: center; }
.offline { background: var(--ember-soft); color: var(--ember); text-align: center; padding: 6px 12px; font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 20; }
.cook { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.cook-top, .cook-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid var(--line); }
.cook-nav { border-top: 1px solid var(--line); border-bottom: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.cook-body { flex: 1; overflow: auto; padding: 20px; max-width: 760px; width: 100%; margin: 0 auto; }
.cook-step { font-size: clamp(1.4rem, 4.5vw, 2rem); line-height: 1.4; }
.ing.big li { font-size: 1.25rem; }
/* ---- layout helpers ---- */
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
.row.two > div { flex: 1; min-width: 0; }
.row input[type="url"], .row input[type="text"] { flex: 1; min-width: 0; }
.center { text-align: center; }
.pre { white-space: pre-wrap; margin: 0; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.hero-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.hero-row .search { flex: 1 1 240px; }
.hero-row .btn { flex: none; justify-content: center; }
.sorts { display: flex; gap: 6px; margin: 2px 0 4px; }
.chip.small { font-size: .82rem; padding: 4px 10px; }
.byline { color: var(--muted); margin: -4px 0 10px; }
.hero-link { position: relative; display: block; }
.hero-credit { position: absolute; right: 10px; bottom: 18px; background: rgba(0,0,0,.6); color: #fff; font-size: .78rem; padding: 3px 8px; border-radius: 8px; }
.src-card { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.src-card img { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; }
.src-card b { display: block; }
.small-link { color: var(--ember); font-size: .85rem; margin-top: 2px; }
.originals { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.orig img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.file { padding: 6px 0; }
.rate-avg { color: var(--gold); font-weight: 700; }
.stars { display: inline-flex; gap: 2px; }
.stars button { font: inherit; font-size: 1.6rem; line-height: 1; background: none; border: 0; color: var(--gold); cursor: pointer; padding: 2px; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.check input { accent-color: var(--ember); width: 18px; height: 18px; }
.c-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.c-item { padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--line) 35%, transparent); }
.c-item.q { border-left: 4px solid var(--gold); }
.c-item.reply { margin-left: 22px; background: transparent; border-left: 2px solid var(--line); border-radius: 0 12px 12px 0; }
.c-text { white-space: pre-wrap; margin: 4px 0; overflow-wrap: anywhere; }
.badge { margin-left: 6px; font-size: .78rem; padding: 1px 8px; border-radius: 999px; background: var(--ember-soft); color: var(--ember); }
.badge.ok { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--ink); }
.c-form textarea, .recipe-form input, .recipe-form textarea, .sheet input, .row input[type="url"], .tab-body textarea { width: 100%; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: inherit; box-sizing: border-box; }
.c-form textarea:focus, .recipe-form input:focus, .recipe-form textarea:focus { outline: 3px solid color-mix(in srgb, var(--ember) 30%, transparent); border-color: var(--ember); }
.name-in { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: inherit; }
.recipe-form { max-width: 760px; margin: 0 auto; }
.recipe-form label { display: block; font-weight: 650; font-size: .92rem; margin: 12px 0 4px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab-body { margin: 6px 0; }
.status { margin: 8px 0; font-size: .92rem; }
.status.busy { color: var(--muted); }
.status.ok { color: var(--ember); }
.status.err { color: #b3261e; }
.thumbs .t { position: relative; display: inline-block; margin-top: 8px; }
.thumbs img { width: 140px; height: 105px; object-fit: cover; border-radius: 12px; display: block; }
.thumbs button { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; width: 26px; height: 26px; cursor: pointer; }
.btn.block { width: 100%; justify-content: center; margin: 14px 0 6px; padding: 13px 16px; }
.btn.plain { background: transparent; color: var(--ember); }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.share-grid .btn { justify-content: center; }
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel { position: relative; background: var(--bg); width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-sizing: border-box; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-panel { border-radius: 20px; } }
.sheet-x { position: absolute; top: 10px; right: 10px; }
.sheet-panel h2 { margin-top: 4px; padding-right: 40px; }
.sheet-panel label { display: block; font-weight: 650; margin: 10px 0 4px; }
.hist { list-style: none; padding: 0; }
.hist-item { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 6px 0; cursor: pointer; }
@media print {
  .rate-box, #talk, .src-card img, .originals, .hero-credit { display: none !important; }
  .top, .foot, .actions, .scale, .back, .offline, .note { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .panel { box-shadow: none; border: 0; padding: 0; }
  .hero-img { max-height: 220px; }
}
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
