:root {
  --bg: #faf6f1;
  --card: #ffffff;
  --ink: #2b2622;
  --muted: #8a7f74;
  --line: #ece5dc;
  --accent: #e07a5f;
  --accent-ink: #ffffff;
  --soft: #f4ede4;
  --warn: #b5541c;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(43, 38, 34, .06), 0 6px 18px rgba(43, 38, 34, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1815; --card: #262220; --ink: #f3ece4; --muted: #a2978b; --line: #3a332e; --soft: #302a26;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: inherit; }
h1, h2, h3 { margin: 0 0 .35em; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
p { margin: 0 0 .6em; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.kicker { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
.lead { font-size: 18px; color: var(--muted); }
.hint { color: var(--muted); font-size: 15px; margin: 4px 0 14px; }
.warn { color: var(--warn); }
.reason { color: var(--muted); font-style: italic; font-size: 15px; margin: 2px 0 8px; }
.prep { background: var(--soft); border-radius: 10px; padding: 8px 12px; font-size: 15px; display: inline-block; }
.prep.big { font-size: 17px; }

/* Layout */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; padding-top: calc(14px + env(safe-area-inset-top)); }
.brand { text-decoration: none; font-weight: 700; letter-spacing: -.01em; font-size: 18px; }
.page { padding: 8px 16px 24px; max-width: 720px; margin: 0 auto; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5;
}
.tabs a { flex: 1; text-decoration: none; text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; border-radius: 10px; }
.tabs a .ic { display: block; font-size: 22px; line-height: 1.1; }
.tabs a.on { color: var(--ink); font-weight: 600; }
.flash { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; margin: 6px 0 14px; font-size: 15px; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.notice { background: var(--soft); box-shadow: none; }
.card.cta { display: block; text-decoration: none; background: var(--accent); color: var(--accent-ink); }
.card.cta strong { display: block; font-size: 18px; }
.card.cta span { opacity: .9; font-size: 15px; }
.hero { padding: 8px 0 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.section-head h1, .section-head h2 { margin: 0; }
.section-head a { text-decoration: none; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.three > label { flex: 1; }
.row > label { flex: 1; }
.inline { display: inline; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c, var(--accent)); color: #fff; font-weight: 700; text-decoration: none; }
.avatar.big { width: 64px; height: 64px; font-size: 26px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 999px; padding: 3px 10px; font-size: 13px; text-decoration: none; white-space: nowrap; border-left: 4px solid var(--c, transparent); }
.chip.soft { border-left: none; }
.chip.on { background: var(--ink); color: var(--bg); }
.chip.warn { background: var(--warn); color: #fff; }
.chip.check { cursor: pointer; border-left: none; margin: 2px 2px 2px 0; }
.chip.check input { margin: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tick { color: #3d8f5f; font-size: 13px; font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--soft); color: var(--ink);
  border: none; border-radius: 12px; padding: 10px 16px; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: transparent; color: var(--warn); }
.btn.small { padding: 7px 12px; font-size: 14px; min-height: 36px; }
.btn.big { width: 100%; padding: 14px; font-size: 18px; }
.btn:active { transform: scale(.98); }
.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 0; cursor: pointer; font-size: 15px; }
label { display: block; font-size: 14px; color: var(--muted); }
label > input, label > select, label > textarea {
  display: block; width: 100%; margin-top: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; color: var(--ink);
}
label.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); }
label.check input { width: auto; margin: 0; }
textarea { resize: vertical; }
fieldset { border: none; padding: 0; margin: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; color: var(--ink); }
fieldset.person { border-top: 1px solid var(--line); padding-top: 10px; }
form.search input { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; margin: 8px 0; }
form.import input { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; min-width: 0; }
.row input[name="body"], .row input[name="item"] { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; min-width: 0; }
.row select { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.photo-pick img.current { width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; margin: 6px 0; }
.photo-pick input { margin-top: 6px; }

/* Login */
.login .people { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin: 10px 0 20px; }
.person-pick { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-size: 16px; font-weight: 600; }
.person-pick.on .avatar { outline: 4px solid var(--ink); outline-offset: 3px; }
.pinpad { max-width: 280px; margin: 0 auto; }
.dots { display: flex; justify-content: center; gap: 14px; margin: 10px 0 18px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.full { background: var(--ink); border-color: var(--ink); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button { background: var(--card); border: 1px solid var(--line); border-radius: 50%; aspect-ratio: 1; font-size: 24px; cursor: pointer; box-shadow: var(--shadow); }

/* Tonight */
.tonight h1 { font-size: 30px; }
.tonight h1 a { text-decoration: none; }
.tonight.ask { border: 2px solid var(--accent); }
.photo-hero { display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 16/10; background: var(--soft); margin-bottom: 12px; }
.photo-hero img { width: 100%; height: 100%; object-fit: cover; }
.photo-hero.big { aspect-ratio: 4/3; margin: 0 -16px 10px; border-radius: 0 0 18px 18px; }
.ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 48px; background: var(--soft); }
.verdict-card h2 { margin-top: 8px; }
.verdicts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 10px; }
.verdicts .v { background: var(--soft); border: 2px solid transparent; border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; cursor: pointer; }
.verdicts .v .em { font-size: 26px; }
.verdicts .v.on { border-color: var(--ink); background: var(--card); }
.verdict-card.compact .verdicts .v .em { font-size: 22px; }
.who-said { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-form { margin: 8px 0; }
.strip { display: flex; gap: 6px; overflow-x: auto; }
.strip img { height: 72px; width: 72px; object-fit: cover; border-radius: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 2px; }

.glance .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.glance .day { text-decoration: none; text-align: center; font-size: 11px; background: var(--card); border-radius: 12px; padding: 6px 3px; box-shadow: var(--shadow); position: relative; min-height: 96px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.glance .day .d { font-weight: 700; color: var(--muted); }
.glance .day .ic { font-size: 22px; }
.glance .day img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
.glance .day .t { line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.glance .day.today { outline: 2px solid var(--accent); }
.glance .day.past { opacity: .6; }
.glance .day .dot { position: absolute; top: 6px; right: 6px; }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.quick-links a { background: var(--card); border-radius: 12px; padding: 12px; text-decoration: none; font-weight: 600; font-size: 15px; box-shadow: var(--shadow); }

/* Week */
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 12px; }
.week-head h1 { font-size: 20px; margin: 0; }
.week-head .nav { text-decoration: none; font-size: 28px; padding: 4px 14px; color: var(--muted); }
.meal-list { display: flex; flex-direction: column; gap: 10px; }
.meal { display: flex; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.meal.today { outline: 2px solid var(--accent); }
.meal.inlaws, .meal.leftovers, .meal.out, .meal.takeaway { background: var(--soft); box-shadow: none; }
.meal .when { text-align: center; min-width: 44px; }
.meal .when .dow { display: block; font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.meal .when .dom { display: block; font-size: 24px; font-weight: 700; line-height: 1; }
.meal .body { flex: 1; min-width: 0; }
.meal h3 { font-size: 18px; margin: 2px 0; }
.meal h3 a { text-decoration: none; }
.meal .who { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pick-row { display: flex; gap: 12px; align-items: flex-start; }
.pick-row > div { min-width: 0; flex: 1; }
.thumb { flex: none; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 26px; text-decoration: none; }
.thumb.lg { width: 96px; height: 96px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.shortlist { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.option button { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: var(--soft); border: none; border-radius: 14px; padding: 10px; cursor: pointer; }
.option .txt { display: flex; flex-direction: column; min-width: 0; }
.option .txt small { color: var(--muted); font-size: 13px; }
.all-recipes { margin-top: 12px; }
.all-recipes summary { cursor: pointer; color: var(--muted); }
.all-recipes form { margin-top: 8px; }
.parent-tools { border: 1px dashed var(--line); box-shadow: none; background: transparent; }

/* Cook */
.timeline { margin: 10px 0; }
.tl { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-left: 3px solid var(--accent); padding-left: 12px; }
.tl .t { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; }
.scaler { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.scaler button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-size: 18px; cursor: pointer; }
.scaler b { color: var(--ink); font-size: 18px; min-width: 20px; text-align: center; }
.ingredients { list-style: none; padding: 0; margin: 0 0 16px; }
.ingredients li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ingredients label { color: var(--ink); font-size: 17px; display: flex; gap: 10px; align-items: baseline; }
.ingredients input[type=checkbox] { width: 20px; height: 20px; flex: none; }
.ingredients input:checked ~ * { text-decoration: line-through; color: var(--muted); }
.ingredients .qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.steps { padding-left: 0; counter-reset: step; list-style: none; }
.steps li { counter-increment: step; position: relative; padding: 12px 0 12px 44px; border-bottom: 1px solid var(--line); font-size: 18px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 12px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.steps .timer { margin-top: 6px; }
.steps .timer.running { background: var(--ink); color: var(--bg); }
.notes { list-style: none; padding: 0; margin: 0 0 10px; }
.notes li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.cookmode:fullscreen { overflow: auto; padding: 24px; background: var(--bg); font-size: 20px; }
.cookmode:fullscreen .steps li { font-size: 22px; }

/* Cookbook */
.tagbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.tagbar.wrap { flex-wrap: wrap; overflow: visible; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { text-decoration: none; background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tile img, .tile .ph { aspect-ratio: 4/3; width: 100%; object-fit: cover; height: auto; font-size: 36px; }
.tile-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.tile-body small { color: var(--muted); font-size: 12px; }
.recipe-page .hero h1 { font-size: 26px; }
.family-record .record span { display: block; }
.story { margin: 10px 0; padding: 10px 14px; border-left: 3px solid var(--accent); font-style: italic; color: var(--muted); }
.people-verdicts { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.pv { display: flex; gap: 8px; align-items: center; }
.pv .tally { display: flex; gap: 8px; font-size: 14px; }
.video { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rate-item h3 { font-size: 17px; align-self: center; margin: 0; }
.rate-item h3 a { text-decoration: none; }

/* Diary and awards */
.diary { display: flex; flex-direction: column; gap: 10px; }
.entry { display: flex; gap: 12px; background: var(--card); border-radius: 14px; padding: 10px; text-decoration: none; box-shadow: var(--shadow); }
.entry img, .entry .ph { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: none; font-size: 32px; }
.entry-body { min-width: 0; }
.entry-body strong { display: block; font-size: 17px; margin-bottom: 4px; }
.awards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.award { position: relative; background: var(--card); border-radius: 16px; padding: 12px; text-decoration: none; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.award img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; margin-bottom: 8px; }
.award .trophy { position: absolute; top: 8px; left: 8px; font-size: 28px; background: var(--card); border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); z-index: 1; }
.award small { color: var(--muted); }

/* Shopping */
.shoplist { list-style: none; padding: 0; margin: 0 0 12px; }
.shoplist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shoplist .tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; flex: none; cursor: pointer; font-size: 14px; }
.shoplist li.checked .tick { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.shoplist li.checked .item { text-decoration: line-through; color: var(--muted); }
.shoplist li.have { opacity: .5; }
.shoplist li.have .tick { visibility: hidden; }
.shoplist .item { flex: 1; }
.shoplist .item small { color: var(--muted); margin-left: 6px; }
.shoplist .have, .shoplist .rm { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px 6px; color: var(--muted); }

/* Profile */
.nights { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.night { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--soft); border-radius: 12px; padding: 10px 2px; cursor: pointer; color: var(--ink); font-weight: 600; font-size: 14px; border: 2px solid transparent; }
.night input { position: absolute; opacity: 0; }
.night.on, .night:has(input:checked) { border-color: var(--accent); background: var(--card); }
.night small { font-size: 10px; color: var(--muted); font-weight: 400; }
.night.off { opacity: .5; cursor: default; }
.member-form { border-left: 4px solid var(--line); }

@media (min-width: 600px) {
  .page { padding: 12px 24px 32px; }
  .verdicts .v { font-size: 13px; }
  .awards { grid-template-columns: repeat(4, 1fr); }
  .quick-links { grid-template-columns: repeat(4, 1fr); }
}

/* Tags */
.tag-row { background: var(--card); border-radius: 12px; padding: 6px 8px; margin-bottom: 6px; box-shadow: var(--shadow); }
.tag-row input[name="name"] { flex: 1; background: transparent; border: none; padding: 8px; font-size: 16px; min-width: 0; }
.tag-row .small { white-space: nowrap; }
.card.row input[name="name"] { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; min-width: 0; }
