/* Diana's Food — big, calm, high-contrast. Light theme only on purpose:
   one look on every device is easier for John than following dark mode. */

:root {
  --bg: #fbf8f3;
  --card: #ffffff;
  --ink: #1f2328;
  --muted: #57606a;
  --line: #d8d2c8;
  --brand: #0f5e63;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0f0;

  --yes: #1a7334;
  --yes-bg: #e5f4e9;
  --no: #b42318;
  --no-bg: #fdecea;
  --ask: #8a5a00;
  --ask-bg: #fff2cc;

  --radius: 18px;
  --tap: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { font-size: 20px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--brand); color: var(--brand-ink);
}
.bar-title { margin: 0; line-height: 1.2; font-size: 1.15rem; font-weight: 700; text-align: center; }
.bar-home {
  justify-self: start; min-height: 52px; min-width: 52px; padding: 0 14px; white-space: nowrap;
  border: 2px solid rgba(255,255,255,.6); border-radius: 14px;
  background: transparent; color: inherit; font-weight: 700; font-size: 1rem;
}
body.is-home .bar-home { display: none; }
body.is-home .bar-title { grid-column: 1 / -1; }

main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }

/* ---------- Home ---------- */
.stage-banner {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.stage-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 0;
  background: none; border: 0; text-align: left;
}
.stage-now { flex: 1; }
.stage-now > span { display: block; }
.stage-banner .who { color: var(--muted); font-size: 1rem; }
.stage-banner .stage { margin-top: 2px; font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.stage-banner .short { font-size: 1.15rem; }
.stage-banner .change {
  flex: none; min-height: 52px; padding: 0 16px; display: grid; place-items: center;
  border: 2px solid var(--brand); border-radius: 999px; color: var(--brand); font-weight: 800; font-size: 1rem;
}
.stage-banner.open { border-color: var(--brand); }
.stage-banner.open .change { background: var(--brand); color: #fff; }
.stage-rule { margin: 14px 0 12px; }

.big-buttons { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.big {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 140px; padding: 14px;
  background: var(--card); border: 3px solid var(--brand); border-radius: var(--radius);
  color: var(--brand); font-size: 1.2rem; font-weight: 800; text-align: center; line-height: 1.2;
}
.big .ico { font-size: 2.6rem; line-height: 1; }
.big:active { background: var(--brand-soft); }

.link-row { display: flex; justify-content: center; margin-top: 18px; }
.quiet {
  min-height: 52px; padding: 0 18px; border-radius: 14px;
  background: transparent; border: 2px solid var(--line); color: var(--muted); font-size: 1rem; font-weight: 600;
}

/* ---------- Generic ---------- */
h2 { font-size: 1.35rem; margin: 6px 0 12px; }
h3 { font-size: 1.15rem; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 22px; border-radius: 16px;
  background: var(--brand); color: var(--brand-ink); border: 0; font-weight: 800; font-size: 1.1rem;
}
.btn.secondary { background: var(--card); color: var(--brand); border: 3px solid var(--brand); }
.btn.danger { background: var(--no); }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.btn-row .btn { flex: 1 1 auto; }

.card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px;
}

/* ---------- Search ---------- */
.search { display: flex; gap: 10px; margin-bottom: 8px; }
.search input {
  flex: 1; min-width: 0; min-height: 72px; padding: 0 18px;
  border: 3px solid var(--brand); border-radius: 16px; background: #fff; font-size: 1.3rem;
}
.mic {
  flex: none; width: 72px; min-height: 72px; border-radius: 16px;
  border: 3px solid var(--brand); background: var(--brand); color: #fff; font-size: 1.8rem;
}
.mic.listening { background: var(--no); border-color: var(--no); }
.hint { color: var(--muted); font-size: 1rem; margin: 0 0 14px; }

.answer { border-width: 4px; }
.answer.yes { border-color: var(--yes); background: var(--yes-bg); }
.answer.no  { border-color: var(--no);  background: var(--no-bg); }
.answer.ask { border-color: var(--ask); background: var(--ask-bg); }
.answer .food { margin: 0; font-size: 1.1rem; font-weight: 700; }
.verdict { display: flex; align-items: center; gap: 12px; margin: 6px 0 8px; font-size: 1.6rem; font-weight: 900; line-height: 1.15; }
.verdict .mark { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: #fff; font-size: 2rem; }
.yes .verdict { color: var(--yes); } .yes .mark { background: var(--yes); }
.no  .verdict { color: var(--no); }  .no  .mark { background: var(--no); }
.ask .verdict { color: var(--ask); } .ask .mark { background: var(--ask); }
.limit { font-weight: 800; padding: 8px 12px; border-radius: 12px; background: #fff; border: 2px dashed currentColor; margin: 8px 0; }
.instead { margin: 10px 0 4px; }
.instead ul { margin: 4px 0 0; padding-left: 1.2em; }
.page-ref { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.nz-note { font-size: .95rem; color: var(--ask); font-weight: 600; }
.label-check { font-size: .95rem; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  min-height: 56px; padding: 0 16px; border-radius: 999px;
  background: #fff; border: 2px solid var(--line); font-weight: 700; font-size: 1rem;
}
.chip.on-up { background: var(--yes-bg); border-color: var(--yes); color: var(--yes); }
.chip.on-down { background: var(--no-bg); border-color: var(--no); color: var(--no); }

.others h3 { margin-top: 22px; }
.row-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: var(--tap); padding: 10px 14px; margin-bottom: 8px;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
}
.row-btn .dot { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; }
.dot.yes { background: var(--yes); } .dot.no { background: var(--no); } .dot.ask { background: var(--ask); }

.btn.back { margin-bottom: 14px; justify-content: flex-start; }

.groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.groups .row-btn { margin: 0; font-weight: 700; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px; }
.tab {
  flex: none; min-height: 56px; padding: 0 18px; border-radius: 999px;
  background: #fff; border: 2px solid var(--brand); color: var(--brand); font-weight: 800;
}
.tab[aria-selected="true"] { background: var(--brand); color: #fff; }

.meal .dish { margin: 0; font-size: 1.2rem; font-weight: 800; }
.meal .note { margin: 6px 0 0; }
.meal.liked { border-color: var(--yes); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 800; vertical-align: middle; }
.badge.up { background: var(--yes-bg); color: var(--yes); }
.badge.ask { background: var(--ask-bg); color: var(--ask); }
.add-tip { background: var(--brand-soft); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }

/* ---------- Shopping ---------- */
.shop-add { display: flex; gap: 10px; margin-bottom: 12px; }
.shop-add input { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 16px; border: 3px solid var(--brand); border-radius: 14px; font-size: 1.2rem; }
.shop-add .btn { flex: none; padding: 0 18px; }
.shop-section { margin-top: 16px; }
.shop-section h3 { margin: 0 0 8px; color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; }
.shop-item { display: flex; align-items: stretch; gap: 8px; margin-bottom: 8px; }
.shop-item .tick {
  flex: 1; display: flex; align-items: center; gap: 14px; min-height: var(--tap); padding: 8px 14px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; font-size: 1.2rem;
}
.shop-item .box { flex: none; width: 36px; height: 36px; border: 3px solid var(--brand); border-radius: 8px; display: grid; place-items: center; font-weight: 900; color: #fff; }
.shop-item.done .box { background: var(--brand); }
.shop-item.done .tick { color: var(--muted); text-decoration: line-through; background: #f3f0ea; }
.shop-item .del { flex: none; width: 56px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-size: 1.2rem; color: var(--muted); }
.empty { text-align: center; padding: 24px 12px; color: var(--muted); }
.quiet.danger { color: var(--no); border-color: var(--no); }
.sync { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: .95rem; }
.sync.warn-sync { color: var(--ask); background: var(--ask-bg); border: 2px solid var(--ask); border-radius: 12px; padding: 10px 12px; font-weight: 700; text-align: left; }

/* ---------- Tastes ---------- */
textarea.notes { width: 100%; min-height: 140px; padding: 14px; border: 3px solid var(--brand); border-radius: 14px; font-size: 1.15rem; background: #fff; }
.taste-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.taste-row span { flex: 1; }

/* ---------- Settings ---------- */
.stage-pick { display: grid; gap: 10px; }
.stage-pick button {
  text-align: left; min-height: 76px; padding: 10px 16px; border-radius: 16px;
  background: #fff; border: 3px solid var(--line);
}
.stage-pick button b { display: block; font-size: 1.2rem; }
.stage-pick button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
label.field { display: block; font-weight: 700; margin: 12px 0 6px; }
input.field { width: 100%; min-height: var(--tap); padding: 0 16px; border: 3px solid var(--line); border-radius: 14px; font-size: 1.2rem; background: #fff; }
.rules li { margin: 6px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(150%);
  width: max-content; max-width: calc(100% - 32px); padding: 14px 20px; border-radius: 14px; text-align: center;
  background: var(--ink); color: #fff; font-weight: 700; z-index: 10;
  visibility: hidden; transition: transform .25s, visibility 0s .25s;
}
.toast.show { transform: translateX(-50%) translateY(0); visibility: visible; transition: transform .25s; }

/* ---------- Print ---------- */
#print { display: none; }

@media (max-width: 380px) {
  html { font-size: 18px; }
  .big { min-height: 120px; }
}

@media print {
  /* Black-and-white friendly: everything readable without colour */
  @page { size: A4; margin: 11mm 11mm 10mm; }
  html { font-size: 11pt; }
  body { background: #fff; padding: 0; }
  .bar, main, .toast { display: none !important; }
  #print { display: block; color: #000; font: 11pt/1.35 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
           -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print ul { margin: 0; padding: 0; list-style: none; }
  #print h3 { margin: 0; }

  /* Page header */
  #print .ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm;
               border-bottom: 3pt solid #000; padding-bottom: 2mm; margin-bottom: 4mm; }
  #print .ph h1 { font-size: 24pt; line-height: 1.05; margin: 0; font-weight: 900; }
  #print .ph-sub { margin: 1mm 0 0; font-size: 12pt; font-weight: 600; }
  #print .ph-side { text-align: right; flex: none; }
  #print .badge { display: block; border: 2.5pt solid #000; border-radius: 2.5mm; padding: 1mm 3.5mm;
                  font-size: 15pt; font-weight: 900; margin-bottom: 1mm; }
  #print .date { font-size: 9pt; color: #333; }

  /* Section header bar */
  #print .sec { background: #e4e4e4; border-left: 3.5mm solid #000; font-size: 13pt; font-weight: 900;
                margin: 4mm 0 2.5mm; padding: 1.4mm 3mm; break-after: avoid; }
  #print .sec .mk { font-size: 14pt; }
  #print .keep { break-inside: avoid; }
  #print .new-page { break-before: page; }

  /* Boxes */
  #print .callout { border: 2pt solid #000; border-radius: 2mm; padding: 2.5mm 4mm; margin: 0 0 3mm; break-inside: avoid; }
  #print .callout h3 { font-size: 12pt; font-weight: 900; margin-bottom: 1mm; }
  #print .callout p { margin: 1mm 0 0; }
  #print .rules ul { columns: 2; column-gap: 8mm; }
  #print .rules { font-size: 10pt; }
  #print .rules li { margin: 0; padding: .2mm 0 .2mm 4mm; position: relative; break-inside: avoid; }
  #print .rules li::before { content: "•"; position: absolute; left: 0; font-weight: 900; }

  /* Checkboxes */
  #print .checklist { columns: 2; column-gap: 10mm; font-size: 13pt; }
  #print .checklist li { display: flex; gap: 3mm; align-items: flex-start; break-inside: avoid;
                         padding: 1.8mm 0; border-bottom: .6pt solid #999; }
  #print .checklist li::before { content: ""; flex: none; width: 5mm; height: 5mm; border: 1.6pt solid #000; border-radius: .8mm; margin-top: .4mm; }
  #print .checklist.blank li { min-height: 8mm; }
  #print .checklist.small { font-size: 10pt; }
  #print .checklist.small li { padding: 1mm 0; }
  #print .checklist.small li::before { width: 4mm; height: 4mm; }
  #print .how { display: block; font-size: 8.5pt; color: #333; }

  /* ✓ / ✗ / ? lists */
  #print .marks li { padding: .5mm 0 .5mm 4.5mm; position: relative; border-bottom: .4pt solid #ccc; break-inside: avoid; }
  #print .marks li::before { position: absolute; left: 0; font-weight: 900; }
  #print .marks.yes li::before { content: "✓"; }
  #print .marks.no li::before { content: "✗"; }
  #print .marks.ask li::before { content: "?"; }
  #print .marks.inline li { display: inline-block; border: 0; margin-right: 6mm; }
  #print .how-i { font-style: italic; color: #333; }

  /* Fridge sheet: food groups in four columns */
  #print .cols4 { columns: 4; column-gap: 5mm; column-rule: .5pt solid #999; font-size: 8.4pt; line-height: 1.2; }
  #print .cols4 .marks li { padding: .15mm 0 .15mm 4mm; }
  #print .run { margin: 0; }
  #print .gl { margin-bottom: 2mm; }
  #print .gl h3 { font-size: 9.5pt; font-weight: 900; border-bottom: 1.5pt solid #000; padding-bottom: .4mm; margin-bottom: .6mm; break-after: avoid; break-inside: avoid; }

  /* Supermarket guide: tick list, then ask/avoid lines */
  #print .sub-h { font-size: 10.5pt; font-weight: 900; margin: 0 0 1mm; break-after: avoid; }
  #print .checklist.small { columns: 2; column-gap: 8mm; }
  #print .mini { font-size: 9.5pt; margin: 1.6mm 0 0; padding-top: 1.2mm; border-top: 1pt solid #000; }

  /* Meal ideas */
  #print .key { font-size: 10pt; margin: 0 0 2mm; }
  #print .meals { columns: 2; column-gap: 8mm; column-rule: .5pt solid #999; }
  #print .meals li { break-inside: avoid; padding: 1.4mm 0; border-bottom: .6pt solid #999; }
  #print .meals b { display: block; font-size: 11.5pt; }
  #print .meals span { display: block; font-size: 9.5pt; color: #222; }
  #print .tip { font-size: 9.5pt; margin: 2mm 0 0; font-style: italic; }

  #print .empty-note { font-size: 12pt; }
  #print .foot { margin-top: 2.5mm; padding-top: 1mm; border-top: .6pt solid #999; font-size: 8pt; color: #444; }
}
