/* খাবার খাতা — styles
   Layout: a ledger page. Map and tick-list on the left, the share card pinned on the right; one column on phones. */
:root {
  --bg: #FBF6F7;
  --surface: #FFFFFF;
  --ink: #26121A;
  --muted: #7C626B;
  --line: #EBDCE0;
  --accent: #C2183F;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBE7EC;
  --map-empty: #ECD9DE;
  --map-stroke: #FFFFFF;
  --me: #C2183F;
  --friend: #1F6FC4;
  --both: #5A2A82;
  --ok: #1D7A4F;

  --f-display: "Anek Bangla", "Hind Siliguri", "Noto Sans Bengali", system-ui, sans-serif;
  --f-body: "VK Digits", "Hind Siliguri", "Noto Sans Bengali", system-ui, sans-serif;
  --r: 14px;
}
/* the English page uses the same families (they carry Latin too); Bangla stays available for names and foods typed in Bangla */
html[lang="en"] {
  --f-display: "Anek Bangla", system-ui, sans-serif;
  --f-body: "Hind Siliguri", system-ui, sans-serif;
}
/* boot.js adds .tp for the instant between the page arriving and its words being swapped to English */
html.tp body { visibility: hidden; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #160A0E; --surface: #211118; --ink: #F7EAEE; --muted: #B799A3; --line: #3A222B;
    --accent: #FF577F; --accent-ink: #1B070D; --accent-soft: #3A1622;
    --map-empty: #38212A; --map-stroke: #160A0E;
    --me: #FF577F; --friend: #5AA9F2; --both: #B88BE8; --ok: #5FD39E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #160A0E; --surface: #211118; --ink: #F7EAEE; --muted: #B799A3; --line: #3A222B;
  --accent: #FF577F; --accent-ink: #1B070D; --accent-soft: #3A1622;
  --map-empty: #38212A; --map-stroke: #160A0E;
  --me: #FF577F; --friend: #5AA9F2; --both: #B88BE8; --ok: #5FD39E;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.6 var(--f-body);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; padding-block: 0 96px; }

/* top bar */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-block: 18px 6px; }
.brand { font: 800 26px/1 var(--f-display); color: var(--accent); text-decoration: none; }
.by { font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.by b { color: var(--ink); font-weight: 600; }

/* the language switch stays in view while the page scrolls */
.stick { position: sticky; top: 0; z-index: 6; background: var(--bg); margin-inline: -16px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.loc { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
/* inside Facebook / Messenger: say up front that saving needs the real browser */
.iab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 13px; line-height: 1.35; }
.iab .btn { flex: none; padding: 5px 12px; font-size: 13px; white-space: nowrap; }
.seg.sm { padding: 2px; }
.seg.sm a, .seg.sm button { padding: 3px 12px; font-size: 13px; line-height: 1.5; }
.seg a { border-radius: 999px; font-weight: 600; color: var(--muted); text-decoration: none; }
.loc a, .loc button { font-family: system-ui, "Noto Sans Bengali", sans-serif; }

/* intro + ledger strip */
.intro h1 { font: 800 clamp(30px, 6.2vw, 50px)/1.15 var(--f-display); margin: 18px 0 8px; text-wrap: balance; }
.intro p { margin: 0; color: var(--muted); max-width: 46ch; }
.ledger {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-block: 22px 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.ledger div { padding: 12px 14px; border-left: 1px solid var(--line); min-width: 0; }
.ledger div:first-child { border-left: 3px double var(--accent); }
.ledger dt { font-size: 13px; color: var(--muted); }
.ledger dd { margin: 0; font: 700 24px/1.25 var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger dd small { font: 500 14px var(--f-body); color: var(--muted); }

.challenge {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 12px 14px; margin-bottom: 18px; border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid var(--line);
}
.challenge p { margin: 0; flex: 1 1 220px; min-width: 0; }

.cols { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr) 372px; gap: 32px; }
  .card-pane { position: sticky; top: 16px; }
}
h2 { font: 700 22px/1.25 var(--f-display); margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* tabs */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--map-empty); border-radius: 999px; }
.seg button { border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.map-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }

/* map */
.map-box { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; }
#map { display: block; width: 100%; height: auto; max-height: 78vh; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#map path { vector-effect: non-scaling-stroke; }
#map .d { fill: var(--map-empty); stroke: var(--map-stroke); stroke-width: 1; cursor: pointer; transition: fill .15s; }
#map .d.on { fill: var(--accent); }
#map text, #map tspan {
  font-family: var(--f-body); font-weight: 600; fill: var(--ink); text-anchor: middle; dominant-baseline: middle;
  pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-linejoin: round;
}
@media (hover: hover) { #map .d:hover { filter: brightness(.93); } }
.hint { font-size: 14px; color: var(--muted); margin: 8px 2px 0; }

/* the food list */
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row h3 { font: 700 17px/1.3 var(--f-display); margin: 0; }
.row h3 span { font: 500 14px var(--f-body); color: var(--muted); font-variant-numeric: tabular-nums; }
.mini { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
/* one chip per district: the food in front, the district after it in smaller type */
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 18px;
  padding: 5px 12px; font-size: 15px; line-height: 1.35; max-width: 100%; text-align: start;
}
.chip b { font-weight: 600; }
.chip small { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on small { color: inherit; opacity: .85; }
.search { width: 100%; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.divs { display: grid; gap: 16px; margin-top: 16px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* card pane */
.preview { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.preview.story { max-width: 260px; margin-inline: auto; }
.field { display: grid; gap: 4px; margin-top: 14px; }
.field > span, .field > label { font-size: 13px; color: var(--muted); }
.field input[type="text"] { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); width: 100%; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#themes { display: grid; grid-template-columns: repeat(5, 40px); gap: 10px 12px; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); padding: 0; position: relative; overflow: hidden; }
.sw::after { content: ""; position: absolute; inset: 0 0 0 50%; background: var(--b); }
.sw[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: 10px 20px; font-weight: 700; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.sm { padding: 6px 14px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions .btn { flex: 1 1 140px; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; overflow-wrap: anywhere; }

/* badges */
.block { margin-top: 44px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); min-width: 0; }
.badge b { display: block; font: 700 16px/1.3 var(--f-display); }
.badge span { font-size: 13px; line-height: 1.4; display: block; margin-top: 2px; }
.badge.got { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--ink); }
.badge.got b { color: var(--accent); }

/* compare */
.cmp { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 720px) { .cmp { grid-template-columns: minmax(0, 1fr) 300px; } }
.cmp-in { display: flex; gap: 8px; flex-wrap: wrap; }
.cmp-in input { flex: 1 1 220px; min-width: 0; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
#cmpMap { width: 100%; height: auto; display: block; }
#cmpMap path { stroke: var(--bg); stroke-width: 1; vector-effect: non-scaling-stroke; fill: var(--map-empty); }
#cmpMap .me { fill: var(--me); } #cmpMap .fr { fill: var(--friend); } #cmpMap .bo { fill: var(--both); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 15px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.verdict { font: 700 20px/1.35 var(--f-display); margin: 16px 0 4px; }
.next { color: var(--muted); font-size: 15px; margin: 6px 0 0; }

/* promo + footer */
.promo {
  margin-top: 48px; padding: 22px; border-radius: var(--r);
  background: var(--accent); color: var(--accent-ink);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
}
.promo h2 { margin: 0 0 2px; font-size: 24px; }
.promo p { margin: 0; opacity: .92; max-width: 44ch; }
.promo .btn { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
/* the sister site, under the promo */
.sister { margin: 14px 2px 0; font-size: 15px; font-weight: 600; }
.sister a { text-decoration: none; }
.sister a:hover { text-decoration: underline; }
.foot { margin-top: 28px; font-size: 13px; color: var(--muted); max-width: 70ch; }
.foot p { margin: 0 0 6px; }

/* phone bottom bar */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line);
}
.bar b { font: 700 18px var(--f-display); font-variant-numeric: tabular-nums; }
.bar span { font-size: 13px; color: var(--muted); margin-left: 6px; }
@media (min-width: 900px) { .bar { display: none; } .wrap { padding-block-end: 56px; } }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 9;
  width: max-content; max-width: min(340px, calc(100% - 32px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 16px;
  font-size: 14px; font-weight: 600; line-height: 1.45; text-align: center;
  box-shadow: 0 10px 28px rgb(0 0 0 / .28); animation: toast-in .22s ease-out;
}
.toast.top { top: 66px; bottom: auto; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* collapsible food list */
.list { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; }
.list summary { cursor: pointer; padding: 12px 0; font: 700 17px/1.3 var(--f-display); list-style-position: inside; }
.list[open] { padding-bottom: 16px; }
.list .chip { background: var(--bg); }
.list .chip.on { background: var(--accent); }

@media (max-width: 560px) {
  .ledger div { padding: 10px 10px; }
  .ledger dd { font-size: 21px; }
  .ledger dd small { font-size: 12px; }
}

/* "save your card" sheet, shown where a normal download cannot work (Facebook / Messenger in-app browser) */
.sheet {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center;
  background: rgb(20 6 10 / .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: sheet-fade .2s ease-out;
}
.sheet-box {
  position: relative; width: 100%; max-width: 440px; max-height: 96vh; overflow-y: auto;
  background: var(--surface); color: var(--ink);
  border-radius: 28px 28px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 10px; justify-items: stretch; text-align: center;
  box-shadow: 0 -12px 40px rgb(0 0 0 / .28);
  animation: sheet-up .28s cubic-bezier(.2, .9, .3, 1);
}
.sheet-box .grab { justify-self: center; width: 44px; height: 5px; border-radius: 99px; background: var(--line); }
.sheet-box .x {
  position: absolute; top: 14px; right: 14px; z-index: 1; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgb(0 0 0 / .18);
}
.sheet-box .shot {
  margin-top: 2px; padding: 16px; border-radius: 20px;
  background: radial-gradient(120% 90% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg);
}
.sheet-box img {
  display: block; width: auto; max-width: 100%; max-height: 36vh; margin-inline: auto; border-radius: 10px;
  box-shadow: 0 10px 26px rgb(0 0 0 / .22), 0 0 0 1px rgb(0 0 0 / .06);
  -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto;
}
.sheet-box h2 { margin: 6px 0 0; font: 800 23px/1.25 var(--f-display); }
.sheet-box .sub { margin: 0 auto 4px; max-width: 34ch; font-size: 14px; line-height: 1.5; }
.btn.big { padding: 14px 20px; font-size: 17px; gap: 10px; border-width: 2px; }
@media (max-width: 360px) { .btn.big { padding: 12px 14px; font-size: 15px; } }
.sheet-box .btn.big:not(.ghost) { box-shadow: 0 8px 20px -6px var(--accent); }
.sheet-box .btn svg { flex: none; }
.sheet-box .tips {
  margin: 4px 0 0; padding: 12px 14px 12px 30px; border-radius: 14px; background: var(--bg);
  text-align: start; font-size: 12.5px; line-height: 1.5; color: var(--muted); display: grid; gap: 4px;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-fade { from { opacity: 0; } }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet-box { border-radius: 28px; } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-box, .toast { animation: none; } }
.ver { opacity: .55; font-size: 11px; white-space: nowrap; }
